Skip to content

Commit

Permalink
more sanity
Browse files Browse the repository at this point in the history
  • Loading branch information
runspired committed Jul 27, 2022
1 parent 282bb4a commit 473893f
Show file tree
Hide file tree
Showing 47 changed files with 161 additions and 166 deletions.
35 changes: 16 additions & 19 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,26 +194,23 @@ module.exports = {
'ember-data-types/q/fetch-manager.ts',
'ember-data-types/q/ember-data-json-api.ts',
'ember-data-types/q/ds-model.ts',
'packages/store/addon/-private/record-data-store-wrapper.ts',
'packages/store/addon/-private/internal-model-factory.ts',
'packages/store/addon/-private/snapshot.ts',
'packages/store/addon/-private/snapshot-record-array.ts',
'packages/store/addon/-private/schema-definition-service.ts',
'packages/store/addon/-private/request-cache.ts',
'packages/store/addon/-private/references/reference.ts',
'packages/store/addon/-private/references/record.ts',
'packages/store/addon/-private/record-notification-manager.ts',
'packages/store/addon/-private/record-data-for.ts',
'packages/store/addon/-private/normalize-model-name.ts',
'packages/store/addon/-private/model/shim-model-class.ts',
'packages/store/addon/-private/model/internal-model.ts',
'packages/store/addon/-private/internal-model-map.ts',
'packages/store/addon/-private/identity-map.ts',
'packages/store/addon/-private/fetch-manager.ts',
'packages/store/addon/-private/core-store.ts',
'packages/store/addon/-private/coerce-id.ts',
'packages/store/addon/-private/managers/record-data-store-wrapper.ts',
'packages/store/addon/-private/caches/internal-model-factory.ts',
'packages/store/addon/-private/network/snapshot.ts',
'packages/store/addon/-private/network/snapshot-record-array.ts',
'packages/store/addon/-private/legacy-model-support/schema-definition-service.ts',
'packages/store/addon/-private/network/request-cache.ts',
'packages/store/addon/-private/legacy-model-support/record-reference.ts',
'packages/store/addon/-private/managers/record-notification-manager.ts',
'packages/store/addon/-private/caches/record-data-for.ts',
'packages/store/addon/-private/utils/normalize-model-name.ts',
'packages/store/addon/-private/legacy-model-support/shim-model-class.ts',
'packages/store/addon/-private/legacy-model-support/internal-model.ts',
'packages/store/addon/-private/network/fetch-manager.ts',
'packages/store/addon/-private/store-service.ts',
'packages/store/addon/-private/utils/coerce-id.ts',
'packages/store/addon/-private/index.ts',
'packages/store/addon/-private/identifier-cache.ts',
'packages/store/addon/-private/caches/identifier-cache.ts',
'packages/serializer/tests/dummy/app/routes/application/route.ts',
'packages/serializer/tests/dummy/app/router.ts',
'packages/serializer/tests/dummy/app/resolver.ts',
Expand Down
5 changes: 4 additions & 1 deletion ember-data-types/q/identifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
@module @ember-data/store
*/

import { DEBUG_CLIENT_ORIGINATED, DEBUG_IDENTIFIER_BUCKET } from '@ember-data/store/-private/identifer-debug-consts';
import {
DEBUG_CLIENT_ORIGINATED,
DEBUG_IDENTIFIER_BUCKET,
} from '@ember-data/store/-private/utils/identifer-debug-consts';

import type { ExistingResourceObject, ResourceIdentifierObject } from './ember-data-json-api';

Expand Down
4 changes: 2 additions & 2 deletions ember-data-types/q/minimum-adapter-interface.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type Store from '@ember-data/store';
import type Snapshot from '@ember-data/store/-private/network/snapshot';
import type SnapshotRecordArray from '@ember-data/store/-private/network/snapshot-record-array';
import type AdapterPopulatedRecordArray from '@ember-data/store/-private/record-arrays/adapter-populated-record-array';
import type Snapshot from '@ember-data/store/-private/snapshot';
import type SnapshotRecordArray from '@ember-data/store/-private/snapshot-record-array';

import type { ModelSchema } from './ds-model';
import type { RelationshipSchema } from './record-data-schemas';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import JSONAPIAdapter from '@ember-data/adapter/json-api';
import JSONAPISerializer from '@ember-data/serializer/json-api';
import Store from '@ember-data/store';
import type { RecordDataStoreWrapper, Snapshot } from '@ember-data/store/-private';
import type NotificationManager from '@ember-data/store/-private/record-notification-manager';
import type NotificationManager from '@ember-data/store/-private/managers/record-notification-manager';
import type { RecordIdentifier, StableRecordIdentifier } from '@ember-data/types/q/identifier';
import type { RecordDataRecordWrapper } from '@ember-data/types/q/record-data-record-wrapper';
import type { AttributesSchema, RelationshipsSchema } from '@ember-data/types/q/record-data-schemas';
Expand Down
4 changes: 2 additions & 2 deletions packages/adapter/addon/-private/build-url-mixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { camelize } from '@ember/string';

import { pluralize } from 'ember-inflector';

import type Snapshot from '@ember-data/store/-private/snapshot';
import type SnapshotRecordArray from '@ember-data/store/-private/snapshot-record-array';
import type Snapshot from '@ember-data/store/-private/network/snapshot';
import type SnapshotRecordArray from '@ember-data/store/-private/network/snapshot-record-array';
import type { Dict } from '@ember-data/types/q/utils';

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { assert } from '@ember/debug';
import type { Snapshot } from 'ember-data/-private';

import type Store from '@ember-data/store';
import type ShimModelClass from '@ember-data/store/-private/model/shim-model-class';
import type ShimModelClass from '@ember-data/store/-private/legacy-model-support/shim-model-class';
import type { DSModelSchema } from '@ember-data/types/q/ds-model';
import type { MinimumSerializerInterface } from '@ember-data/types/q/minimum-serializer-interface';

Expand Down
4 changes: 2 additions & 2 deletions packages/adapter/addon/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ import { Promise as RSVPPromise } from 'rsvp';

import type Store from '@ember-data/store';
import type { Snapshot } from '@ember-data/store/-private';
import type ShimModelClass from '@ember-data/store/-private/model/shim-model-class';
import type SnapshotRecordArray from '@ember-data/store/-private/snapshot-record-array';
import type ShimModelClass from '@ember-data/store/-private/legacy-model-support/shim-model-class';
import type SnapshotRecordArray from '@ember-data/store/-private/network/snapshot-record-array';
import type { AdapterPayload, MinimumAdapterInterface } from '@ember-data/types/q/minimum-adapter-interface';
import type { Dict } from '@ember-data/types/q/utils';

Expand Down
6 changes: 3 additions & 3 deletions packages/adapter/addon/rest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import { DEBUG } from '@glimmer/env';
import { Promise as RSVPPromise } from 'rsvp';

import type Store from '@ember-data/store';
import type ShimModelClass from '@ember-data/store/-private/model/shim-model-class';
import type Snapshot from '@ember-data/store/-private/snapshot';
import type SnapshotRecordArray from '@ember-data/store/-private/snapshot-record-array';
import type ShimModelClass from '@ember-data/store/-private/legacy-model-support/shim-model-class';
import type Snapshot from '@ember-data/store/-private/network/snapshot';
import type SnapshotRecordArray from '@ember-data/store/-private/network/snapshot-record-array';
import type { AdapterPayload } from '@ember-data/types/q/minimum-adapter-interface';
import type { Dict } from '@ember-data/types/q/utils';

Expand Down
2 changes: 1 addition & 1 deletion packages/model/addon/-private/legacy-data-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { assert } from '@ember/debug';
import { DEBUG } from '@glimmer/env';

import type Store from '@ember-data/store';
import type ShimModelClass from '@ember-data/store/-private/model/shim-model-class';
import type ShimModelClass from '@ember-data/store/-private/legacy-model-support/shim-model-class';
import type { JsonApiDocument } from '@ember-data/types/q/ember-data-json-api';
import type { StableExistingRecordIdentifier, StableRecordIdentifier } from '@ember-data/types/q/identifier';
import type { AdapterPayload } from '@ember-data/types/q/minimum-adapter-interface';
Expand Down
4 changes: 2 additions & 2 deletions packages/model/addon/-private/many-array.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import { all } from 'rsvp';

import type Store from '@ember-data/store';
import { PromiseArray, recordDataFor } from '@ember-data/store/-private';
import type { CreateRecordProperties } from '@ember-data/store/-private/core-store';
import type ShimModelClass from '@ember-data/store/-private/model/shim-model-class';
import type ShimModelClass from '@ember-data/store/-private/legacy-model-support/shim-model-class';
import type { CreateRecordProperties } from '@ember-data/store/-private/store-service';
import type { DSModelSchema } from '@ember-data/types/q/ds-model';
import type { Links, PaginationLinks } from '@ember-data/types/q/ember-data-json-api';
import type { StableRecordIdentifier } from '@ember-data/types/q/identifier';
Expand Down
2 changes: 1 addition & 1 deletion packages/model/addon/-private/notify-changes.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { cacheFor } from '@ember/object/internals';

import type Store from '@ember-data/store';
import type { NotificationType } from '@ember-data/store/-private/record-notification-manager';
import type { NotificationType } from '@ember-data/store/-private/managers/record-notification-manager';
import type { StableRecordIdentifier } from '@ember-data/types/q/identifier';

import type Model from './model';
Expand Down
4 changes: 2 additions & 2 deletions packages/model/addon/-private/record-state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { cached, tracked } from '@glimmer/tracking';
import type Store from '@ember-data/store';
import { storeFor } from '@ember-data/store';
import { errorsArrayToHash, recordIdentifierFor } from '@ember-data/store/-private';
import type { NotificationType } from '@ember-data/store/-private/record-notification-manager';
import type RequestCache from '@ember-data/store/-private/request-cache';
import type { NotificationType } from '@ember-data/store/-private/managers/record-notification-manager';
import type RequestCache from '@ember-data/store/-private/network/request-cache';
import type { StableRecordIdentifier } from '@ember-data/types/q/identifier';
import type { RecordData } from '@ember-data/types/q/record-data';

Expand Down
4 changes: 2 additions & 2 deletions packages/model/addon/-private/references/belongs-to.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import type { BelongsToRelationship } from '@ember-data/record-data/-private';
import type Store from '@ember-data/store';
import { assertPolymorphicType } from '@ember-data/store/-debug';
import { recordIdentifierFor } from '@ember-data/store/-private';
import type { NotificationType } from '@ember-data/store/-private/record-notification-manager';
import type { DebugWeakCache } from '@ember-data/store/-private/weak-cache';
import type { NotificationType } from '@ember-data/store/-private/managers/record-notification-manager';
import type { DebugWeakCache } from '@ember-data/store/-private/utils/weak-cache';
import type {
LinkObject,
Links,
Expand Down
4 changes: 2 additions & 2 deletions packages/model/addon/-private/references/has-many.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import type { ManyRelationship } from '@ember-data/record-data/-private';
import type Store from '@ember-data/store';
import { recordIdentifierFor } from '@ember-data/store';
import { assertPolymorphicType } from '@ember-data/store/-debug';
import type { NotificationType } from '@ember-data/store/-private/record-notification-manager';
import type { DebugWeakCache } from '@ember-data/store/-private/weak-cache';
import type { NotificationType } from '@ember-data/store/-private/managers/record-notification-manager';
import type { DebugWeakCache } from '@ember-data/store/-private/utils/weak-cache';
import type {
CollectionResourceDocument,
CollectionResourceRelationship,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ import type {
} from '@ember-data/types/q/identifier';
import type { ConfidentDict } from '@ember-data/types/q/utils';

import coerceId from './coerce-id';
import { DEBUG_CLIENT_ORIGINATED, DEBUG_IDENTIFIER_BUCKET } from './identifer-debug-consts';
import normalizeModelName from './normalize-model-name';
import isNonEmptyString from './utils/is-non-empty-string';
import WeakCache from './weak-cache';
import coerceId from '../utils/coerce-id';
import { DEBUG_CLIENT_ORIGINATED, DEBUG_IDENTIFIER_BUCKET } from '../utils/identifer-debug-consts';
import isNonEmptyString from '../utils/is-non-empty-string';
import normalizeModelName from '../utils/normalize-model-name';
import WeakCache from '../utils/weak-cache';

const IDENTIFIERS = new WeakSet();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@ import type { RecordData } from '@ember-data/types/q/record-data';
import type { RecordInstance } from '@ember-data/types/q/record-instance';
import type { FindOptions } from '@ember-data/types/q/store';

import coerceId, { ensureStringId } from './coerce-id';
import type { CreateRecordProperties } from './core-store';
import type Store from './core-store';
import { assertIdentifierHasId } from './core-store';
import InternalModel from '../legacy-model-support/internal-model';
import RecordReference from '../legacy-model-support/record-reference';
import RecordDataStoreWrapper from '../managers/record-data-store-wrapper';
import Snapshot from '../network/snapshot';
import type { CreateRecordProperties } from '../store-service';
import type Store from '../store-service';
import { assertIdentifierHasId } from '../store-service';
import coerceId, { ensureStringId } from '../utils/coerce-id';
import constructResource from '../utils/construct-resource';
import normalizeModelName from '../utils/normalize-model-name';
import WeakCache from '../utils/weak-cache';
import { internalModelFactoryFor, setRecordIdentifier } from './internal-model-factory';
import InternalModel from './model/internal-model';
import RecordReference from './model/record-reference';
import normalizeModelName from './normalize-model-name';
import recordDataFor, { setRecordDataFor } from './record-data-for';
import RecordDataStoreWrapper from './record-data-store-wrapper';
import Snapshot from './snapshot';
import constructResource from './utils/construct-resource';
import WeakCache from './weak-cache';

const RECORD_REFERENCES = new WeakCache<StableRecordIdentifier, RecordReference>(DEBUG ? 'reference' : '');
export const StoreMap = new WeakCache<RecordInstance, Store>(DEBUG ? 'store' : '');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ import type { RecordData } from '@ember-data/types/q/record-data';
import type { RecordInstance } from '@ember-data/types/q/record-instance';
import { Dict } from '@ember-data/types/q/utils';

import type Store from './core-store';
import InternalModel from '../legacy-model-support/internal-model';
import type Store from '../store-service';
import constructResource from '../utils/construct-resource';
import WeakCache from '../utils/weak-cache';
import type { IdentifierCache } from './identifier-cache';
import InternalModel from './model/internal-model';
import constructResource from './utils/construct-resource';
import WeakCache from './weak-cache';

/**
@module @ember-data/store
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type { StableRecordIdentifier } from '@ember-data/types/q/identifier';
import type { RecordData } from '@ember-data/types/q/record-data';
import type { RecordInstance } from '@ember-data/types/q/record-instance';

import WeakCache from './weak-cache';
import WeakCache from '../utils/weak-cache';

/*
* Returns the RecordData instance associated with a given
Expand Down
28 changes: 14 additions & 14 deletions packages/store/addon/-private/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,38 @@
@module @ember-data/store
*/

export { default as Store, storeFor } from './core-store';
export { default as Store, storeFor } from './store-service';

export { recordIdentifierFor } from './internal-model-factory';
export { recordIdentifierFor } from './caches/internal-model-factory';

export { default as Snapshot } from './snapshot';
export { default as Snapshot } from './network/snapshot';
export {
setIdentifierGenerationMethod,
setIdentifierUpdateMethod,
setIdentifierForgetMethod,
setIdentifierResetMethod,
} from './identifier-cache';
} from './caches/identifier-cache';

export { default as normalizeModelName } from './normalize-model-name';
export { default as coerceId } from './coerce-id';
export { default as normalizeModelName } from './utils/normalize-model-name';
export { default as coerceId } from './utils/coerce-id';

export { errorsHashToArray, errorsArrayToHash } from './errors-utils';
export { errorsHashToArray, errorsArrayToHash } from './utils/errors-utils';

// `ember-data-model-fragments` relies on `InternalModel`
export { default as InternalModel } from './model/internal-model';
export { default as InternalModel } from './legacy-model-support/internal-model';

export { PromiseArray, PromiseObject, deprecatedPromiseObject } from './promise-proxies';
export { PromiseArray, PromiseObject, deprecatedPromiseObject } from './proxies/promise-proxies';

export { default as RecordArray } from './record-arrays/record-array';
export { default as AdapterPopulatedRecordArray } from './record-arrays/adapter-populated-record-array';

export { default as RecordArrayManager } from './record-array-manager';
export { default as RecordArrayManager } from './managers/record-array-manager';

// // Used by tests
export { default as SnapshotRecordArray } from './snapshot-record-array';
export { default as SnapshotRecordArray } from './network/snapshot-record-array';

// New
export { default as recordDataFor, removeRecordDataFor } from './record-data-for';
export { default as RecordDataStoreWrapper } from './record-data-store-wrapper';
export { default as recordDataFor, removeRecordDataFor } from './caches/record-data-for';
export { default as RecordDataStoreWrapper } from './managers/record-data-store-wrapper';

export { default as WeakCache } from './weak-cache';
export { default as WeakCache } from './utils/weak-cache';
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import type { ChangedAttributesHash, RecordData } from '@ember-data/types/q/reco
import type { JsonApiResource, JsonApiValidationError } from '@ember-data/types/q/record-data-json-api';
import type { RecordInstance } from '@ember-data/types/q/record-instance';

import type Store from '../core-store';
import { errorsHashToArray } from '../errors-utils';
import { internalModelFactoryFor } from '../internal-model-factory';
import { internalModelFactoryFor } from '../caches/internal-model-factory';
import type Store from '../store-service';
import { errorsHashToArray } from '../utils/errors-utils';

/**
@module @ember-data/store
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import type { SingleResourceDocument } from '@ember-data/types/q/ember-data-json
import type { StableRecordIdentifier } from '@ember-data/types/q/identifier';
import type { RecordInstance } from '@ember-data/types/q/record-instance';

import type Store from '../core-store';
import type { NotificationType } from '../record-notification-manager';
import { unsubscribe } from '../record-notification-manager';
import type { NotificationType } from '../managers/record-notification-manager';
import { unsubscribe } from '../managers/record-notification-manager';
import type Store from '../store-service';

/**
@module @ember-data/store
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import { DEPRECATE_STRING_ARG_SCHEMAS } from '@ember-data/private-build-infra/de
import type { RecordIdentifier } from '@ember-data/types/q/identifier';
import type { AttributesSchema, RelationshipsSchema } from '@ember-data/types/q/record-data-schemas';

import type Store from './core-store';
import normalizeModelName from './normalize-model-name';
import type Store from '../store-service';
import normalizeModelName from '../utils/normalize-model-name';

type ModelForMixin = (store: Store, normalizedModelName: string) => Model | null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import type { ModelSchema } from '@ember-data/types/q/ds-model';
import type { AttributeSchema, RelationshipSchema } from '@ember-data/types/q/record-data-schemas';
import type { Dict } from '@ember-data/types/q/utils';

import type Store from '../core-store';
import WeakCache from '../weak-cache';
import type Store from '../store-service';
import WeakCache from '../utils/weak-cache';

const AvailableShims = new WeakCache<Store, Dict<ShimModelClass>>(DEBUG ? 'schema-shims' : '');
AvailableShims._generator = () => {
Expand Down
Loading

0 comments on commit 473893f

Please sign in to comment.