diff --git a/packages/-ember-data/addon/-private/index.js b/packages/-ember-data/addon/-private/index.js index 038230776a0..959b1e2781a 100644 --- a/packages/-ember-data/addon/-private/index.js +++ b/packages/-ember-data/addon/-private/index.js @@ -11,17 +11,13 @@ export { InternalModel, ManyArray, PromiseArray, - Relationship, PromiseManyArray, PromiseObject, - RecordData, RecordArray, RecordArrayManager, RootState, SnapshotRecordArray, - recordDataFor, - relationshipStateFor, - relationshipsFor, normalizeModelName, coerceId, } from '@ember-data/store/-private'; +export { RecordData, Relationship } from '@ember-data/record-data/-private'; diff --git a/packages/-ember-data/addon/index.js b/packages/-ember-data/addon/index.js index f9497696eaa..26b2c5ca7f5 100644 --- a/packages/-ember-data/addon/index.js +++ b/packages/-ember-data/addon/index.js @@ -1,5 +1,6 @@ import { VERSION } from '@ember/version'; import EmberError from '@ember/error'; +import Store from './store'; if (VERSION.match(/^1\.([0-9]|1[0-2])\./)) { throw new EmberError( @@ -9,7 +10,7 @@ if (VERSION.match(/^1\.([0-9]|1[0-2])\./)) { ); } -import Store, { normalizeModelName } from '@ember-data/store'; +import { normalizeModelName } from '@ember-data/store'; import DebugAdapter from '@ember-data/debug'; import { diff --git a/packages/-ember-data/addon/store.ts b/packages/-ember-data/addon/store.ts index fa482881caf..d6c2c79c4d3 100644 --- a/packages/-ember-data/addon/store.ts +++ b/packages/-ember-data/addon/store.ts @@ -1 +1,21 @@ -export { default } from '@ember-data/store'; +import Store from '@ember-data/store'; +import { RecordData } from '@ember-data/record-data/-private'; +import { identifierCacheFor } from '@ember-data/store/-private'; +import { IDENTIFIERS } from '@ember-data/canary-features'; + +type RecordDataStoreWrapper = import('@ember-data/store/-private/ts-interfaces/record-data-store-wrapper').RecordDataStoreWrapper; + +export default class DefaultStore extends Store { + createRecordDataFor(modelName: string, id: string | null, clientId: string, storeWrapper: RecordDataStoreWrapper) { + if (IDENTIFIERS) { + let identifier = identifierCacheFor(this).getOrCreateRecordIdentifier({ + type: modelName, + id, + lid: clientId, + }); + return new RecordData(identifier, storeWrapper); + } else { + return new RecordData(modelName, id, clientId, storeWrapper); + } + } +} diff --git a/packages/-ember-data/app/services/store.js b/packages/-ember-data/app/services/store.js new file mode 100644 index 00000000000..f41e1d3d9a3 --- /dev/null +++ b/packages/-ember-data/app/services/store.js @@ -0,0 +1 @@ +export { default } from 'ember-data/store'; diff --git a/packages/-ember-data/index.js b/packages/-ember-data/index.js index 6d1249481a0..63df18138c5 100644 --- a/packages/-ember-data/index.js +++ b/packages/-ember-data/index.js @@ -8,7 +8,13 @@ const merge = require('broccoli-merge-trees'); module.exports = Object.assign({}, addonBaseConfig, { shouldRollupPrivate: true, externalDependenciesForPrivateModule() { - return ['ember-data/version', '@ember-data/store/-private', '@ember-data/store', '@ember-data/model']; + return [ + '@ember-data/record-data/-private', + 'ember-data/version', + '@ember-data/store/-private', + '@ember-data/store', + '@ember-data/model', + ]; }, treeForAddon(tree) { tree = merge([tree, version()]); diff --git a/packages/-ember-data/package.json b/packages/-ember-data/package.json index 20fd2f28fc1..f954b6aa134 100644 --- a/packages/-ember-data/package.json +++ b/packages/-ember-data/package.json @@ -28,6 +28,7 @@ "@ember-data/adapter": "3.15.0-alpha.0", "@ember-data/debug": "3.15.0-alpha.0", "@ember-data/model": "3.15.0-alpha.0", + "@ember-data/record-data": "3.15.0-alpha.0", "@ember-data/serializer": "3.15.0-alpha.0", "@ember-data/store": "3.15.0-alpha.0", "@ember/ordered-set": "^2.0.3", diff --git a/packages/-ember-data/tests/integration/identifiers/configuration-test.ts b/packages/-ember-data/tests/integration/identifiers/configuration-test.ts index 7ebab1167f8..a7e5746b6d9 100644 --- a/packages/-ember-data/tests/integration/identifiers/configuration-test.ts +++ b/packages/-ember-data/tests/integration/identifiers/configuration-test.ts @@ -533,7 +533,7 @@ if (IDENTIFIERS) { name: 'callback-hell', }, relationships: { - retainer: { type: 'retainer', id: '1' }, + retainer: { data: { type: 'retainer', id: '1' } }, }, }, }); diff --git a/packages/-ember-data/tests/integration/multiple-stores-test.js b/packages/-ember-data/tests/integration/multiple-stores-test.js index 1e024b29580..d0beaa9035e 100644 --- a/packages/-ember-data/tests/integration/multiple-stores-test.js +++ b/packages/-ember-data/tests/integration/multiple-stores-test.js @@ -2,7 +2,9 @@ import { run } from '@ember/runloop'; import { setupTest } from 'ember-qunit'; import { module, test } from 'qunit'; import { get } from '@ember/object'; -import Store from '@ember-data/store'; +// we intentionally test against the ember-data version here +// because the ember-data/store uses DefaultRecordData while @ember-data/store does not +import Store from 'ember-data/store'; import Model, { attr, belongsTo, hasMany } from '@ember-data/model'; import RESTSerializer, { EmbeddedRecordsMixin } from '@ember-data/serializer/rest'; import RESTAdapter from '@ember-data/adapter/rest'; diff --git a/packages/-ember-data/tests/integration/record-data/unloading-record-data-test.js b/packages/-ember-data/tests/integration/record-data/unloading-record-data-test.js index 52a128b049d..ab851b52cab 100644 --- a/packages/-ember-data/tests/integration/record-data/unloading-record-data-test.js +++ b/packages/-ember-data/tests/integration/record-data/unloading-record-data-test.js @@ -3,7 +3,8 @@ import { setupTest } from 'ember-qunit'; import Model from '@ember-data/model'; import { run } from '@ember/runloop'; import { assign } from '@ember/polyfills'; -import { RecordData, recordDataFor } from 'ember-data/-private'; +import { recordDataFor } from '@ember-data/store/-private'; +import { RecordData } from '@ember-data/record-data/-private'; import { resolve } from 'rsvp'; import { attr, hasMany, belongsTo } from '@ember-data/model'; diff --git a/packages/-ember-data/tests/integration/records/unload-test.js b/packages/-ember-data/tests/integration/records/unload-test.js index 83ae5530f3c..c00cabc8409 100644 --- a/packages/-ember-data/tests/integration/records/unload-test.js +++ b/packages/-ember-data/tests/integration/records/unload-test.js @@ -6,7 +6,7 @@ import { run } from '@ember/runloop'; import { module, test } from 'qunit'; import DS from 'ember-data'; import { setupTest } from 'ember-qunit'; -import { recordDataFor } from 'ember-data/-private'; +import { recordDataFor } from '@ember-data/store/-private'; import JSONAPIAdapter from '@ember-data/adapter/json-api'; import JSONAPISerializer from '@ember-data/serializer/json-api'; diff --git a/packages/-ember-data/tests/integration/relationships/belongs-to-test.js b/packages/-ember-data/tests/integration/relationships/belongs-to-test.js index f39f893d7c0..6198d4328e4 100644 --- a/packages/-ember-data/tests/integration/relationships/belongs-to-test.js +++ b/packages/-ember-data/tests/integration/relationships/belongs-to-test.js @@ -9,8 +9,8 @@ import Store from '@ember-data/store'; import Model from '@ember-data/model'; import testInDebug from 'dummy/tests/helpers/test-in-debug'; import DS from 'ember-data'; -import { RecordData, recordDataFor, relationshipsFor, relationshipStateFor } from '@ember-data/store/-private'; -import { identifierCacheFor } from '@ember-data/store/-private'; +import { RecordData, relationshipsFor, relationshipStateFor } from '@ember-data/record-data/-private'; +import { identifierCacheFor, recordDataFor } from '@ember-data/store/-private'; import { IDENTIFIERS } from '@ember-data/canary-features'; import { setupContext, teardownContext } from '@ember/test-helpers'; diff --git a/packages/-ember-data/tests/integration/relationships/has-many-test.js b/packages/-ember-data/tests/integration/relationships/has-many-test.js index 9af478d1686..4ecef75b41a 100644 --- a/packages/-ember-data/tests/integration/relationships/has-many-test.js +++ b/packages/-ember-data/tests/integration/relationships/has-many-test.js @@ -8,7 +8,7 @@ import { setupTest } from 'ember-qunit'; import testInDebug from 'dummy/tests/helpers/test-in-debug'; import { deprecatedTest } from 'dummy/tests/helpers/deprecated-test'; import { module, test } from 'qunit'; -import { relationshipStateFor, relationshipsFor } from 'ember-data/-private'; +import { relationshipStateFor, relationshipsFor } from '@ember-data/record-data/-private'; import Adapter from '@ember-data/adapter'; import JSONAPISerializer from '@ember-data/serializer/json-api'; diff --git a/packages/-ember-data/tests/unit/model-test.js b/packages/-ember-data/tests/unit/model-test.js index 7d815a771f2..0aac3d349d6 100644 --- a/packages/-ember-data/tests/unit/model-test.js +++ b/packages/-ember-data/tests/unit/model-test.js @@ -13,7 +13,7 @@ import JSONAPIAdapter from '@ember-data/adapter/json-api'; import JSONAPISerializer from '@ember-data/serializer/json-api'; import JSONSerializer from '@ember-data/serializer/json'; import { attr as DSattr } from '@ember-data/model'; -import { recordDataFor } from 'ember-data/-private'; +import { recordDataFor } from '@ember-data/store/-private'; import { attr, hasMany, belongsTo } from '@ember-data/model'; import { gte } from 'ember-compatibility-helpers'; diff --git a/packages/-ember-data/tsconfig.json b/packages/-ember-data/tsconfig.json index 8d3d511aa8f..728c143dfad 100644 --- a/packages/-ember-data/tsconfig.json +++ b/packages/-ember-data/tsconfig.json @@ -25,13 +25,14 @@ "@ember-data/model/*": ["../model/addon/*"], "@ember-data/adapter": ["../adapter/addon"], "@ember-data/adapter/*": ["../adapter/addon/*"], + "@ember-data/adapter/error": ["../adapter/addon/error"], "@ember-data/serializer": ["../serializer/addon"], "@ember-data/serializer/*": ["../serializer/addon/*"], "ember-data/test-support": ["addon-test-support"], "ember-data/test-support/*": ["addon-test-support/*"], - "@ember-data/adapter/error": ["../adapter/addon/error"], + "@ember-data/record-data/*": ["../record-data/addon/*"], "@ember-data/canary-features": ["../canary-features/addon"], - "*": ["../store/types/*"] + "*": ["../store/types/*", "../record-data/types/*"] } }, "include": ["app/**/*", "addon/**/*", "tests/**/*", "types/**/*", "test-support/**/*", "addon-test-support/**/*"], diff --git a/packages/-record-data-encapsulation-test-app/package.json b/packages/-record-data-encapsulation-test-app/package.json index 503483065d2..adad900e443 100644 --- a/packages/-record-data-encapsulation-test-app/package.json +++ b/packages/-record-data-encapsulation-test-app/package.json @@ -22,6 +22,7 @@ "@ember-data/serializer": "3.15.0-alpha.0", "@ember-data/model": "3.15.0-alpha.0", "@ember-data/store": "3.15.0-alpha.0", + "@ember-data/debug": "3.15.0-alpha.0", "ember-inflector": "^3.0.1" }, "devDependencies": { diff --git a/packages/-serializer-encapsulation-test-app/app/services/store.js b/packages/-serializer-encapsulation-test-app/app/services/store.js new file mode 100644 index 00000000000..42676ed5734 --- /dev/null +++ b/packages/-serializer-encapsulation-test-app/app/services/store.js @@ -0,0 +1,19 @@ +import Store from '@ember-data/store'; +import { RecordData } from '@ember-data/record-data/-private'; +import { identifierCacheFor } from '@ember-data/store/-private'; +import { IDENTIFIERS } from '@ember-data/canary-features'; + +export default class DefaultStore extends Store { + createRecordDataFor(modelName, id, clientId, storeWrapper) { + if (IDENTIFIERS) { + let identifier = identifierCacheFor(this).getOrCreateRecordIdentifier({ + type: modelName, + id, + lid: clientId, + }); + return new RecordData(identifier, storeWrapper); + } else { + return new RecordData(modelName, id, clientId, storeWrapper); + } + } +} diff --git a/packages/-serializer-encapsulation-test-app/package.json b/packages/-serializer-encapsulation-test-app/package.json index 46e87239fe9..c356637339e 100644 --- a/packages/-serializer-encapsulation-test-app/package.json +++ b/packages/-serializer-encapsulation-test-app/package.json @@ -21,6 +21,7 @@ "@ember-data/adapter": "3.15.0-alpha.0", "@ember-data/model": "3.15.0-alpha.0", "@ember-data/store": "3.15.0-alpha.0", + "@ember-data/record-data": "3.15.0-alpha.0", "ember-inflector": "^3.0.1" }, "devDependencies": { diff --git a/packages/-serializer-encapsulation-test-app/tests/integration/create-record-test.js b/packages/-serializer-encapsulation-test-app/tests/integration/create-record-test.js index db6c881143b..6b4314fea4f 100644 --- a/packages/-serializer-encapsulation-test-app/tests/integration/create-record-test.js +++ b/packages/-serializer-encapsulation-test-app/tests/integration/create-record-test.js @@ -1,5 +1,5 @@ import Model, { attr } from '@ember-data/model'; -import Store from '@ember-data/store'; +import Store from 'serializer-encapsulation-test-app/services/store'; import JSONAPIAdapter from '@ember-data/adapter/json-api'; import EmberObject from '@ember/object'; import { setupTest } from 'ember-qunit'; @@ -27,7 +27,7 @@ class Person extends Model { } } -module('inteegration/create-record - running createRecord with minimum serializer', function(hooks) { +module('integration/create-record - running createRecord with minimum serializer', function(hooks) { setupTest(hooks); hooks.beforeEach(function(assert) { diff --git a/packages/-serializer-encapsulation-test-app/tests/integration/errors-test.js b/packages/-serializer-encapsulation-test-app/tests/integration/errors-test.js index 5d8e45a6296..6f3ef8a0bbb 100644 --- a/packages/-serializer-encapsulation-test-app/tests/integration/errors-test.js +++ b/packages/-serializer-encapsulation-test-app/tests/integration/errors-test.js @@ -1,5 +1,5 @@ import Model, { attr } from '@ember-data/model'; -import Store from '@ember-data/store'; +import Store from 'serializer-encapsulation-test-app/services/store'; import JSONAPIAdapter from '@ember-data/adapter/json-api'; import EmberObject from '@ember/object'; import { setupTest } from 'ember-qunit'; diff --git a/packages/-serializer-encapsulation-test-app/tests/integration/relationships-test.js b/packages/-serializer-encapsulation-test-app/tests/integration/relationships-test.js index a7bcfa4215b..c08b38b3d4c 100644 --- a/packages/-serializer-encapsulation-test-app/tests/integration/relationships-test.js +++ b/packages/-serializer-encapsulation-test-app/tests/integration/relationships-test.js @@ -2,7 +2,7 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; import { resolve } from 'rsvp'; import JSONAPIAdapter from '@ember-data/adapter/json-api'; -import Store from '@ember-data/store'; +import Store from 'serializer-encapsulation-test-app/services/store'; import Model, { attr, hasMany, belongsTo } from '@ember-data/model'; import EmberObject from '@ember/object'; diff --git a/packages/-serializer-encapsulation-test-app/tests/integration/requests-test.js b/packages/-serializer-encapsulation-test-app/tests/integration/requests-test.js index 96fa40a4ee7..691bfdc005d 100644 --- a/packages/-serializer-encapsulation-test-app/tests/integration/requests-test.js +++ b/packages/-serializer-encapsulation-test-app/tests/integration/requests-test.js @@ -1,5 +1,5 @@ import Model, { attr } from '@ember-data/model'; -import Store from '@ember-data/store'; +import Store from 'serializer-encapsulation-test-app/services/store'; import JSONAPIAdapter from '@ember-data/adapter/json-api'; import EmberObject from '@ember/object'; import { setupTest } from 'ember-qunit'; diff --git a/packages/-serializer-encapsulation-test-app/tests/integration/serialize-test.js b/packages/-serializer-encapsulation-test-app/tests/integration/serialize-test.js index 4e7ca616c44..da5403bbf1e 100644 --- a/packages/-serializer-encapsulation-test-app/tests/integration/serialize-test.js +++ b/packages/-serializer-encapsulation-test-app/tests/integration/serialize-test.js @@ -1,5 +1,5 @@ import Model, { attr } from '@ember-data/model'; -import Store from '@ember-data/store'; +import Store from 'serializer-encapsulation-test-app/services/store'; import EmberObject from '@ember/object'; import { setupTest } from 'ember-qunit'; import { module, test } from 'qunit'; diff --git a/packages/-serializer-encapsulation-test-app/tests/integration/update-record-test.js b/packages/-serializer-encapsulation-test-app/tests/integration/update-record-test.js index 3154b63fe1e..3f2732bcd05 100644 --- a/packages/-serializer-encapsulation-test-app/tests/integration/update-record-test.js +++ b/packages/-serializer-encapsulation-test-app/tests/integration/update-record-test.js @@ -1,5 +1,5 @@ import Model, { attr } from '@ember-data/model'; -import Store from '@ember-data/store'; +import Store from 'serializer-encapsulation-test-app/services/store'; import JSONAPIAdapter from '@ember-data/adapter/json-api'; import EmberObject from '@ember/object'; import { setupTest } from 'ember-qunit'; @@ -27,7 +27,7 @@ class Person extends Model { } } -module('inteegration/create-record - running createRecord with minimum serializer', function(hooks) { +module('integration/create-record - running createRecord with minimum serializer', function(hooks) { setupTest(hooks); hooks.beforeEach(function(assert) { diff --git a/packages/debug/README.md b/packages/debug/README.md index cd458c4080c..58bc9805722 100644 --- a/packages/debug/README.md +++ b/packages/debug/README.md @@ -10,7 +10,7 @@ Provides developer ergonomics and dev-mode enhancements for apps built with Embe ## Installation ``` -ember install @ember-data/record-data +ember install @ember-data/debug ``` ## Usage diff --git a/packages/debug/package.json b/packages/debug/package.json index 0fb31a924ad..48a91a7d14a 100644 --- a/packages/debug/package.json +++ b/packages/debug/package.json @@ -19,14 +19,14 @@ "test:all": "ember try:each" }, "dependencies": { - "@ember-data/-build-infra": "3.14.0-alpha.4", + "@ember-data/-build-infra": "3.15.0-alpha.0", "@ember/edition-utils": "^1.1.1", "ember-cli-babel": "^7.12.0", "ember-cli-test-info": "^1.0.0", "ember-cli-typescript": "^3.0.0" }, "devDependencies": { - "@ember-data/-test-infra": "3.14.0-alpha.4", + "@ember-data/-test-infra": "3.15.0-alpha.0", "@ember/optional-features": "^0.7.0", "broccoli-asset-rev": "^3.0.0", "ember-cli": "^3.13.1", diff --git a/packages/record-data/addon/-private/coerce-id.ts b/packages/record-data/addon/-private/coerce-id.ts new file mode 100644 index 00000000000..26db1c73e37 --- /dev/null +++ b/packages/record-data/addon/-private/coerce-id.ts @@ -0,0 +1,39 @@ +import { DEBUG } from '@glimmer/env'; + +// Used by the store to normalize IDs entering the store. Despite the fact +// that developers may provide IDs as numbers (e.g., `store.findRecord('person', 1)`), +// it is important that internally we use strings, since IDs may be serialized +// and lose type information. For example, Ember's router may put a record's +// ID into the URL, and if we later try to deserialize that URL and find the +// corresponding record, we will not know if it is a string or a number. +type Coercable = string | number | boolean | null | undefined | symbol; + +function coerceId(id: Coercable): string | null { + if (id === null || id === undefined || id === '') { + return null; + } + if (typeof id === 'string') { + return id; + } + if (typeof id === 'symbol') { + return id.toString(); + } + return '' + id; +} + +export function ensureStringId(id: Coercable): string { + let normalized: string | null = null; + if (typeof id === 'string') { + normalized = id.length > 0 ? id : null; + } else if (typeof id === 'number' && !isNaN(id)) { + normalized = '' + id; + } + + if (DEBUG && normalized === null) { + throw new Error(`Expected id to be a string or number, recieved ${String(id)}`); + } + + return normalized!; +} + +export default coerceId; diff --git a/packages/record-data/addon/-private/index.ts b/packages/record-data/addon/-private/index.ts new file mode 100644 index 00000000000..8feeeb1bf50 --- /dev/null +++ b/packages/record-data/addon/-private/index.ts @@ -0,0 +1,5 @@ +export { default as RecordData } from './record-data'; +export { default as Relationship } from './relationships/state/relationship'; +export { default as BelongsToRelationship } from './relationships/state/belongs-to'; +export { default as ManyRelationship } from './relationships/state/has-many'; +export { relationshipStateFor, relationshipsFor } from './record-data-for'; diff --git a/packages/store/addon/-private/system/normalize-link.js b/packages/record-data/addon/-private/normalize-link.ts similarity index 60% rename from packages/store/addon/-private/system/normalize-link.js rename to packages/record-data/addon/-private/normalize-link.ts index 6fc44c129fb..ebd419c86c2 100644 --- a/packages/store/addon/-private/system/normalize-link.js +++ b/packages/record-data/addon/-private/normalize-link.ts @@ -1,7 +1,3 @@ -/** - @module @ember-data/store -*/ - /* This method normalizes a link to an "links object". If the passed link is already an object it's returned without any modifications. @@ -9,11 +5,14 @@ See http://jsonapi.org/format/#document-links for more information. @method _normalizeLink - @private + @internal @param {String} link @return {Object|null} */ -export default function _normalizeLink(link) { +type Link = import('@ember-data/store/-private/ts-interfaces/ember-data-json-api').Link; +type LinkObject = import('@ember-data/store/-private/ts-interfaces/ember-data-json-api').LinkObject; + +export default function _normalizeLink(link: Link): LinkObject | null { switch (typeof link) { case 'object': return link; diff --git a/packages/store/addon/-private/system/ordered-set.ts b/packages/record-data/addon/-private/ordered-set.ts similarity index 94% rename from packages/store/addon/-private/system/ordered-set.ts rename to packages/record-data/addon/-private/ordered-set.ts index 38945e1fb9e..96d0550b00d 100644 --- a/packages/store/addon/-private/system/ordered-set.ts +++ b/packages/record-data/addon/-private/ordered-set.ts @@ -1,10 +1,6 @@ import EmberOrderedSet from '@ember/ordered-set'; import { guidFor } from '@ember/object/internals'; -/** - @module @ember-data/store -*/ - export default class EmberDataOrderedSet extends EmberOrderedSet { static create() { return new this(); diff --git a/packages/record-data/addon/-private/record-data-for.ts b/packages/record-data/addon/-private/record-data-for.ts new file mode 100644 index 00000000000..6a4b4a4c4b3 --- /dev/null +++ b/packages/record-data/addon/-private/record-data-for.ts @@ -0,0 +1,27 @@ +import { recordDataFor } from '@ember-data/store/-private'; +import Relationships from './relationships/state/create'; +import Relationship from './relationships/state/relationship'; +import BelongsToRelationship from './relationships/state/belongs-to'; +import ManyRelationship from './relationships/state/has-many'; +import { ConfidentDict } from '@ember-data/store/-private/ts-interfaces/utils'; +import { RelationshipRecordData } from './ts-interfaces/relationship-record-data'; + +export function relationshipsFor(instance: any): Relationships { + let recordData = (recordDataFor(instance) || instance) as RelationshipRecordData; + + return recordData._relationships; +} + +export function relationshipStateFor(instance: any, propertyName: string): BelongsToRelationship | ManyRelationship { + return relationshipsFor(instance).get(propertyName); +} + +export function implicitRelationshipsFor(instance: any): ConfidentDict { + let recordData = (recordDataFor(instance) || instance) as RelationshipRecordData; + + return recordData._implicitRelationships; +} + +export function implicitRelationshipStateFor(instance: any, propertyName: string): Relationship { + return implicitRelationshipsFor(instance)[propertyName]; +} diff --git a/packages/store/addon/-private/system/model/record-data.ts b/packages/record-data/addon/-private/record-data.ts similarity index 96% rename from packages/store/addon/-private/system/model/record-data.ts rename to packages/record-data/addon/-private/record-data.ts index 2b3b77bdd77..a937b33f692 100644 --- a/packages/store/addon/-private/system/model/record-data.ts +++ b/packages/record-data/addon/-private/record-data.ts @@ -1,29 +1,30 @@ +/** + @module @ember-data/record-data +*/ import { DEBUG } from '@glimmer/env'; import { assign } from '@ember/polyfills'; import { isEqual } from '@ember/utils'; import { assert, warn, inspect } from '@ember/debug'; import { run } from '@ember/runloop'; -import Relationships from '../relationships/state/create'; -import coerceId from '../coerce-id'; -import BelongsToRelationship from '../relationships/state/belongs-to'; -import ManyRelationship from '../relationships/state/has-many'; -import Relationship from '../relationships/state/relationship'; -import RecordData, { ChangedAttributesHash } from '../../ts-interfaces/record-data'; +import Relationships from './relationships/state/create'; +import coerceId from './coerce-id'; +import BelongsToRelationship from './relationships/state/belongs-to'; +import ManyRelationship from './relationships/state/has-many'; +import Relationship from './relationships/state/relationship'; +import RecordData, { ChangedAttributesHash } from '@ember-data/store/-private/ts-interfaces/record-data'; import { JsonApiResource, - JsonApiBelongsToRelationship, - JsonApiHasManyRelationship, JsonApiValidationError, AttributesHash, -} from '../../ts-interfaces/record-data-json-api'; -import { RelationshipRecordData } from '../../ts-interfaces/relationship-record-data'; -import { RecordDataStoreWrapper } from '../../ts-interfaces/record-data-store-wrapper'; +} from '@ember-data/store/-private/ts-interfaces/record-data-json-api'; +import { + DefaultSingleResourceRelationship, + DefaultCollectionResourceRelationship, +} from './ts-interfaces/relationship-record-data'; +import { RelationshipRecordData } from './ts-interfaces/relationship-record-data'; +import { RecordDataStoreWrapper } from '@ember-data/store/-private/ts-interfaces/record-data-store-wrapper'; import { IDENTIFIERS, RECORD_DATA_ERRORS, RECORD_DATA_STATE } from '@ember-data/canary-features'; -import { RecordIdentifier } from '../../ts-interfaces/identifier'; - -/** - @module @ember-data/store -*/ +import { RecordIdentifier } from '@ember-data/store/-private/ts-interfaces/identifier'; let nextBfsId = 1; @@ -365,7 +366,7 @@ export default class RecordDataDefault implements RelationshipRecordData { } // get ResourceIdentifiers for "current state" - getHasMany(key): JsonApiHasManyRelationship { + getHasMany(key): DefaultCollectionResourceRelationship { return (this._relationships.get(key) as ManyRelationship).getData(); } @@ -405,7 +406,7 @@ export default class RecordDataDefault implements RelationshipRecordData { } } - getBelongsTo(key: string): JsonApiBelongsToRelationship { + getBelongsTo(key: string): DefaultSingleResourceRelationship { return (this._relationships.get(key) as BelongsToRelationship).getData(); } diff --git a/packages/store/addon/-private/system/relationships/state/belongs-to.ts b/packages/record-data/addon/-private/relationships/state/belongs-to.ts similarity index 93% rename from packages/store/addon/-private/system/relationships/state/belongs-to.ts rename to packages/record-data/addon/-private/relationships/state/belongs-to.ts index f3e4ea59549..44408472acf 100644 --- a/packages/store/addon/-private/system/relationships/state/belongs-to.ts +++ b/packages/record-data/addon/-private/relationships/state/belongs-to.ts @@ -2,14 +2,12 @@ import { assert, inspect } from '@ember/debug'; import { assertPolymorphicType } from '@ember-data/store/-debug'; import { isNone } from '@ember/utils'; import Relationship from './relationship'; -import { RelationshipRecordData } from '../../../ts-interfaces/relationship-record-data'; -import { JsonApiBelongsToRelationship } from '../../../ts-interfaces/record-data-json-api'; -import { RelationshipSchema } from '../../../ts-interfaces/record-data-schemas'; -import { ExistingResourceIdentifierObject } from '../../../ts-interfaces/ember-data-json-api'; - -/** - @module @ember-data/store -*/ +import { + RelationshipRecordData, + DefaultSingleResourceRelationship, +} from '../../ts-interfaces/relationship-record-data'; +import { RelationshipSchema } from '@ember-data/store/-private/ts-interfaces/record-data-schemas'; +import { ExistingResourceIdentifierObject } from '@ember-data/store/-private/ts-interfaces/ember-data-json-api'; export default class BelongsToRelationship extends Relationship { inverseRecordData: RelationshipRecordData | null; @@ -171,7 +169,7 @@ export default class BelongsToRelationship extends Relationship { this.canonicalState = null; } - getData(): JsonApiBelongsToRelationship { + getData(): DefaultSingleResourceRelationship { let data; let payload: any = {}; if (this.inverseRecordData) { diff --git a/packages/store/addon/-private/system/relationships/state/create.ts b/packages/record-data/addon/-private/relationships/state/create.ts similarity index 78% rename from packages/store/addon/-private/system/relationships/state/create.ts rename to packages/record-data/addon/-private/relationships/state/create.ts index 3598510f084..8b37091fd86 100644 --- a/packages/store/addon/-private/system/relationships/state/create.ts +++ b/packages/record-data/addon/-private/relationships/state/create.ts @@ -1,14 +1,10 @@ import ManyRelationship from './has-many'; import BelongsToRelationship from './belongs-to'; -import { RelationshipRecordData } from '../../../ts-interfaces/relationship-record-data'; -import { RelationshipSchema } from '../../../ts-interfaces/record-data-schemas'; -import RecordDataStoreWrapper from '../../store/record-data-store-wrapper'; -import { upgradeForInternal } from '../../ts-upgrade-map'; -import CoreStore from '../../core-store'; -/** - @module @ember-data/store -*/ +import { RelationshipRecordData } from '../../ts-interfaces/relationship-record-data'; +import { RelationshipSchema } from '@ember-data/store/-private/ts-interfaces/record-data-schemas'; +import { RecordDataStoreWrapper, upgradeForInternal } from '@ember-data/store/-private'; +import CoreStore from '@ember-data/store/-private/system/core-store'; function createRelationshipFor( relationshipMeta: RelationshipSchema, @@ -29,7 +25,9 @@ function createRelationshipFor( export default class Relationships { _store: CoreStore; _storeWrapper: RecordDataStoreWrapper; - initializedRelationships: { [key: string]: BelongsToRelationship | ManyRelationship }; + initializedRelationships: { + [key: string]: BelongsToRelationship | ManyRelationship; + }; constructor(public recordData: RelationshipRecordData) { this.initializedRelationships = Object.create(null); this._storeWrapper = upgradeForInternal(recordData.storeWrapper); diff --git a/packages/store/addon/-private/system/relationships/state/has-many.ts b/packages/record-data/addon/-private/relationships/state/has-many.ts similarity index 96% rename from packages/store/addon/-private/system/relationships/state/has-many.ts rename to packages/record-data/addon/-private/relationships/state/has-many.ts index 32d5dd0bae5..ac78a79f8a8 100755 --- a/packages/store/addon/-private/system/relationships/state/has-many.ts +++ b/packages/record-data/addon/-private/relationships/state/has-many.ts @@ -2,9 +2,11 @@ import { assertPolymorphicType } from '@ember-data/store/-debug'; import Relationship from './relationship'; import OrderedSet from '../../ordered-set'; import { isNone } from '@ember/utils'; -import { RelationshipRecordData } from '../../../ts-interfaces/relationship-record-data'; -import { JsonApiHasManyRelationship } from '../../../ts-interfaces/record-data-json-api'; -import { RelationshipSchema } from '../../../ts-interfaces/record-data-schemas'; +import { + RelationshipRecordData, + DefaultCollectionResourceRelationship, +} from '../../ts-interfaces/relationship-record-data'; +import { RelationshipSchema } from '@ember-data/store/-private/ts-interfaces/record-data-schemas'; import { CUSTOM_MODEL_CLASS } from '@ember-data/canary-features'; /** @@ -70,7 +72,7 @@ export default class ManyRelationship extends Relationship { this.notifyHasManyChange(); } - removeCanonicalRecordDataFromOwn(recordData: RelationshipRecordData, idx) { + removeCanonicalRecordDataFromOwn(recordData: RelationshipRecordData, idx?: number) { let i = idx; if (!this.canonicalMembers.has(recordData)) { return; @@ -216,7 +218,7 @@ export default class ManyRelationship extends Relationship { storeWrapper.notifyHasManyChange(recordData.modelName, recordData.id, recordData.clientId, this.key); } - getData(): JsonApiHasManyRelationship { + getData(): DefaultCollectionResourceRelationship { let payload: any = {}; if (this.hasAnyRelationshipData) { payload.data = this.currentState.map(recordData => recordData.getResourceIdentifier()); diff --git a/packages/store/addon/-private/system/relationships/state/relationship.ts b/packages/record-data/addon/-private/relationships/state/relationship.ts similarity index 95% rename from packages/store/addon/-private/system/relationships/state/relationship.ts rename to packages/record-data/addon/-private/relationships/state/relationship.ts index d7edd378b47..0bb97b2fb88 100644 --- a/packages/store/addon/-private/system/relationships/state/relationship.ts +++ b/packages/record-data/addon/-private/relationships/state/relationship.ts @@ -4,9 +4,9 @@ import { relationshipStateFor, implicitRelationshipStateFor } from '../../record import { assert, warn } from '@ember/debug'; import OrderedSet from '../../ordered-set'; import _normalizeLink from '../../normalize-link'; -import { RelationshipRecordData } from '../../..//ts-interfaces/relationship-record-data'; -import { JsonApiRelationship } from '../../../ts-interfaces/record-data-json-api'; -import { RelationshipSchema } from '../../../ts-interfaces/record-data-schemas'; +import { RelationshipRecordData } from '../../ts-interfaces/relationship-record-data'; +import { JsonApiRelationship } from '@ember-data/store/-private/ts-interfaces/record-data-json-api'; +import { RelationshipSchema } from '@ember-data/store/-private/ts-interfaces/record-data-schemas'; import { CUSTOM_MODEL_CLASS } from '@ember-data/canary-features'; /** @@ -201,7 +201,7 @@ export default class Relationship { return recordData._implicitRelationships !== undefined && recordData._implicitRelationships !== null; } - _hasSupportForRelationships(recordData: RelationshipRecordData): boolean { + _hasSupportForRelationships(recordData: RelationshipRecordData): recordData is RelationshipRecordData { return recordData._relationships !== undefined && recordData._relationships !== null; } @@ -447,10 +447,12 @@ export default class Relationship { if (!this._hasSupportForRelationships(recordData)) { return; } - let inverseRelationship = relationshipStateFor(recordData, this.inverseKey); - //Need to check for existence, as the record might unloading at the moment - if (inverseRelationship) { - inverseRelationship.removeRecordDataFromOwn(this.recordData); + if (this.inverseKey) { + let inverseRelationship = relationshipStateFor(recordData, this.inverseKey); + //Need to check for existence, as the record might unloading at the moment + if (inverseRelationship) { + inverseRelationship.removeRecordDataFromOwn(this.recordData); + } } } @@ -462,10 +464,12 @@ export default class Relationship { if (!this._hasSupportForRelationships(recordData)) { return; } - let inverseRelationship = relationshipStateFor(recordData, this.inverseKey); - //Need to check for existence, as the record might unloading at the moment - if (inverseRelationship) { - inverseRelationship.removeCanonicalRecordDataFromOwn(this.recordData); + if (this.inverseKey) { + let inverseRelationship = relationshipStateFor(recordData, this.inverseKey); + //Need to check for existence, as the record might unloading at the moment + if (inverseRelationship) { + inverseRelationship.removeCanonicalRecordDataFromOwn(this.recordData); + } } } @@ -498,8 +502,10 @@ export default class Relationship { const id = guidFor(inverseRecordData); if (this._hasSupportForRelationships(inverseRecordData) && seen[id] === undefined) { - const relationship = relationshipStateFor(inverseRecordData, this.inverseKey); - relationship.removeCompletelyFromOwn(recordData); + if (this.inverseKey) { + const relationship = relationshipStateFor(inverseRecordData, this.inverseKey); + relationship.removeCompletelyFromOwn(recordData); + } seen[id] = true; } }; diff --git a/packages/record-data/addon/-private/ts-interfaces/relationship-record-data.ts b/packages/record-data/addon/-private/ts-interfaces/relationship-record-data.ts new file mode 100644 index 00000000000..5530f8ed0d0 --- /dev/null +++ b/packages/record-data/addon/-private/ts-interfaces/relationship-record-data.ts @@ -0,0 +1,35 @@ +import Relationships from '../relationships/state/create'; +import Relationship from '../relationships/state/relationship'; +import RecordData from '@ember-data/store/-private/ts-interfaces/record-data'; +import { + SingleResourceRelationship, + CollectionResourceRelationship, +} from '@ember-data/store/-private/ts-interfaces/ember-data-json-api'; +import { RecordIdentifier } from '@ember-data/store/-private/ts-interfaces/identifier'; +import { RecordDataStoreWrapper } from '@ember-data/store/-private/ts-interfaces/record-data-store-wrapper'; +import BelongsToRelationship from '../relationships/state/belongs-to'; +import HasManyRelationship from '../relationships/state/has-many'; +import { ConfidentDict } from '@ember-data/store/-private/ts-interfaces/utils'; + +export interface DefaultSingleResourceRelationship extends SingleResourceRelationship { + _relationship: BelongsToRelationship; +} +export interface DefaultCollectionResourceRelationship extends CollectionResourceRelationship { + _relationship: HasManyRelationship; +} + +export interface RelationshipRecordData extends RecordData { + //Required by the relationship layer + isNew(): boolean; + modelName: string; + storeWrapper: RecordDataStoreWrapper; + id: string | null; + clientId: string | null; + isEmpty(): boolean; + getResourceIdentifier(): RecordIdentifier; + _relationships: Relationships; + _implicitRelationships: ConfidentDict; + __implicitRelationships: ConfidentDict | null; + getBelongsTo(key: string): DefaultSingleResourceRelationship; + getHasMany(key: string): DefaultCollectionResourceRelationship; +} diff --git a/packages/record-data/addon/index.ts b/packages/record-data/addon/index.ts deleted file mode 100644 index f561e63139d..00000000000 --- a/packages/record-data/addon/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -/** - @module @ember-data/record-data -*/ diff --git a/packages/record-data/index.js b/packages/record-data/index.js index aa6c2f47bc7..a2bb42327df 100644 --- a/packages/record-data/index.js +++ b/packages/record-data/index.js @@ -5,8 +5,14 @@ const addonBuildConfigForDataPackage = require('@ember-data/-build-infra/src/add const addonBaseConfig = addonBuildConfigForDataPackage(name); module.exports = Object.assign({}, addonBaseConfig, { - shouldRollupPrivate: false, + shouldRollupPrivate: true, externalDependenciesForPrivateModule() { - return []; + return [ + '@ember-data/store/-debug', + '@ember-data/store/-private', + '@ember/ordered-set', + '@ember-data/store', + '@ember-data/canary-features', + ]; }, }); diff --git a/packages/record-data/package.json b/packages/record-data/package.json index ac2dfbab18b..b32c5801de0 100644 --- a/packages/record-data/package.json +++ b/packages/record-data/package.json @@ -19,14 +19,17 @@ "test:all": "ember try:each" }, "dependencies": { - "@ember-data/-build-infra": "3.14.0-alpha.4", + "@ember-data/-build-infra": "3.15.0-alpha.0", "@ember/edition-utils": "^1.1.1", + "@ember-data/canary-features": "3.15.0-alpha.0", + "@ember-data/store": "3.15.0-alpha.0", "ember-cli-babel": "^7.12.0", + "ember-cli-typescript": "^3.0.0", "ember-cli-test-info": "^1.0.0", - "ember-cli-typescript": "^3.0.0" + "@ember/ordered-set": "^2.0.3" }, "devDependencies": { - "@ember-data/-test-infra": "3.14.0-alpha.4", + "@ember-data/-test-infra": "3.15.0-alpha.0", "@ember/optional-features": "^0.7.0", "broccoli-asset-rev": "^3.0.0", "ember-cli": "^3.13.1", diff --git a/packages/record-data/tsconfig.json b/packages/record-data/tsconfig.json index 2c599dd59d1..c55f2dab0cb 100644 --- a/packages/record-data/tsconfig.json +++ b/packages/record-data/tsconfig.json @@ -17,9 +17,21 @@ "paths": { "dummy/tests/*": ["tests/*"], "dummy/*": ["tests/dummy/app/*", "app/*"], + "@ember-data/canary-features": ["../canary-features/addon"], + "@ember-data/canary-features/*": ["../canary-features/addon/*"], + "@ember-data/store": ["../store/addon"], + "@ember-data/store/*": ["../store/addon/*"], "*": ["types/*"] } }, - "include": ["app/**/*", "addon/**/*", "tests/**/*", "types/**/*", "test-support/**/*", "addon-test-support/**/*"], + "include": [ + "app/**/*", + "addon/**/*", + "tests/**/*", + "types/**/*", + "test-support/**/*", + "addon-test-support/**/*", + "../-ember-data/app/initializers/default-record-data.js" + ], "exclude": ["node_modules"] } diff --git a/packages/record-data/types/@ember/debug/index.d.ts b/packages/record-data/types/@ember/debug/index.d.ts new file mode 100644 index 00000000000..d2c398a79dd --- /dev/null +++ b/packages/record-data/types/@ember/debug/index.d.ts @@ -0,0 +1,3 @@ +// https://github.com/DefinitelyTyped/DefinitelyTyped/issues/38682 +export { assert, warn, inspect } from '@ember/debug'; +export { deprecate } from '@ember/application/deprecations'; diff --git a/packages/store/types/@ember/ordered-set/index.d.ts b/packages/record-data/types/@ember/ordered-set/index.d.ts similarity index 100% rename from packages/store/types/@ember/ordered-set/index.d.ts rename to packages/record-data/types/@ember/ordered-set/index.d.ts diff --git a/packages/record-data/types/@ember/polyfills/index.d.ts b/packages/record-data/types/@ember/polyfills/index.d.ts new file mode 100644 index 00000000000..318e000b48a --- /dev/null +++ b/packages/record-data/types/@ember/polyfills/index.d.ts @@ -0,0 +1,16 @@ +/** + * Copy properties from a source object to a target object. + * https://github.com/DefinitelyTyped/DefinitelyTyped/issues/38681 + */ +export function assign(target: T, source: U): Mix; +export function assign( + target: T, + source1: U, + source2: V +): Mix3; +export function assign( + target: T, + source1: U, + source2: V, + source3: W +): Mix4; diff --git a/packages/record-data/types/@ember/runloop/index.d.ts b/packages/record-data/types/@ember/runloop/index.d.ts new file mode 100644 index 00000000000..770af7951b3 --- /dev/null +++ b/packages/record-data/types/@ember/runloop/index.d.ts @@ -0,0 +1,4 @@ +// necessary because our "run" is run.backburner +// which we use to avoid autorun triggering for Ember <= 3.4 +// we can drop this and use run directly ~11/1/2019 +export const run: any; diff --git a/packages/store/addon/-private/index.ts b/packages/store/addon/-private/index.ts index 20b6c108e8d..fa9d2d42b25 100644 --- a/packages/store/addon/-private/index.ts +++ b/packages/store/addon/-private/index.ts @@ -17,8 +17,6 @@ export { setIdentifierResetMethod, } from './identifiers/cache'; -// maybe public ? -export { default as recordDataFor, relationshipStateFor, relationshipsFor } from './system/record-data-for'; export { default as normalizeModelName } from './system/normalize-model-name'; export { default as coerceId } from './system/coerce-id'; @@ -28,22 +26,21 @@ export { errorsHashToArray, errorsArrayToHash } from './system/errors-utils'; export { default as RootState } from './system/model/states'; export { default as InternalModel } from './system/model/internal-model'; -export { default as RecordData } from './system/model/record-data'; - export { PromiseArray, PromiseObject, PromiseManyArray } from './system/promise-proxies'; export { RecordArray, AdapterPopulatedRecordArray } from './system/record-arrays'; export { default as ManyArray } from './system/many-array'; export { default as RecordArrayManager } from './system/record-array-manager'; -export { default as Relationship } from './system/relationships/state/relationship'; // // Used by tests export { default as diffArray } from './system/diff-array'; export { default as SnapshotRecordArray } from './system/snapshot-record-array'; // New -export { default as OrderedSet } from './system/ordered-set'; +export { default as recordDataFor } from './system/record-data-for'; +export { default as RecordDataStoreWrapper } from './system/store/record-data-store-wrapper'; +export { upgradeForInternal } from './system/ts-upgrade-map'; export { _bind, _guard, _objectIsAlive, guardDestroyedStore } from './system/store/common'; // for Model diff --git a/packages/store/addon/-private/system/core-store.ts b/packages/store/addon/-private/system/core-store.ts index ee81e53d84a..f171800edd0 100644 --- a/packages/store/addon/-private/system/core-store.ts +++ b/packages/store/addon/-private/system/core-store.ts @@ -38,7 +38,6 @@ import InternalModel, { extractRecordDataFromRecord, extractRecordDatasFromRecords, } from './model/internal-model'; -import RecordDataDefault from './model/record-data'; import edBackburner from './backburner'; import { IDENTIFIERS, @@ -53,11 +52,9 @@ import promiseRecord from '../utils/promise-record'; import { identifierCacheFor, IdentifierCache } from '../identifiers/cache'; import { internalModelFactoryFor, setRecordIdentifier, recordIdentifierFor } from './store/internal-model-factory'; import { RecordIdentifier, StableRecordIdentifier } from '../ts-interfaces/identifier'; -import RecordData from '../ts-interfaces/record-data'; import { RecordReference, HasManyReference, BelongsToReference } from './references'; import { Backburner } from '@ember/runloop/-private/backburner'; import Snapshot from './snapshot'; -import Relationship from './relationships/state/relationship'; import { EmptyResourceDocument, SingleResourceDocument, @@ -73,10 +70,15 @@ import { AttributesSchema } from '../ts-interfaces/record-data-schemas'; import { SchemaDefinitionService } from '../ts-interfaces/schema-definition-service'; import ShimModelClass from './model/shim-model-class'; import RecordDataRecordWrapper from '../ts-interfaces/record-data-record-wrapper'; +import RecordData from '../ts-interfaces/record-data'; import { Dict } from '../ts-interfaces/utils'; import constructResource from '../utils/construct-resource'; import { errorsArrayToHash } from './errors-utils'; + +type Relationship = import('@ember-data/record-data/-private').Relationship; +type RelationshipRecordData = import('@ember-data/record-data/-private/ts-interfaces/relationship-record-data').RelationshipRecordData; + const emberRun = emberRunLoop.backburner; const { ENV } = Ember; @@ -1633,7 +1635,7 @@ abstract class CoreStore extends Service { return this.findHasMany(parentInternalModel, resource.links.related, relationshipMeta, options).then( internalModels => { let payload: { data: any[]; meta?: any } = { - data: internalModels.map(im => recordDataFor(im).getResourceIdentifier()), + data: internalModels.map(im => (recordDataFor(im) as RelationshipRecordData).getResourceIdentifier()), }; if (internalModels.meta !== undefined) { payload.meta = internalModels.meta; @@ -1711,7 +1713,8 @@ abstract class CoreStore extends Service { } return this.findBelongsTo(parentInternalModel, resource.links.related, relationshipMeta, options).then( internalModel => { - let response = internalModel && recordDataFor(internalModel).getResourceIdentifier(); + let response = + internalModel && (recordDataFor(internalModel) as RelationshipRecordData).getResourceIdentifier(); parentInternalModel.linkWasLoadedForRelationship(relationshipMeta.key, { data: response }); if (internalModel === null) { return null; @@ -3080,16 +3083,7 @@ abstract class CoreStore extends Service { clientId: string, storeWrapper: RecordDataStoreWrapper ): RecordData { - if (IDENTIFIERS) { - let identifier = identifierCacheFor(this).getOrCreateRecordIdentifier({ - type: modelName, - id, - lid: clientId, - }); - return new RecordDataDefault(identifier, storeWrapper); - } else { - return new RecordDataDefault(modelName, id, clientId, storeWrapper); - } + throw new Error(`Expected store.createRecordDataFor to be implemented but it wasn't`); } /** diff --git a/packages/store/addon/-private/system/model/internal-model.ts b/packages/store/addon/-private/system/model/internal-model.ts index e1382b72a67..d7828926511 100644 --- a/packages/store/addon/-private/system/model/internal-model.ts +++ b/packages/store/addon/-private/system/model/internal-model.ts @@ -10,14 +10,13 @@ import { DEBUG } from '@glimmer/env'; import { assert, inspect } from '@ember/debug'; import RootState from './states'; import Snapshot from '../snapshot'; -import OrderedSet from '../ordered-set'; import ManyArray from '../many-array'; import { PromiseBelongsTo, PromiseManyArray } from '../promise-proxies'; import Store from '../ds-model-store'; import { errorsHashToArray } from '../errors-utils'; +import RecordArray from '../record-arrays/record-array'; import { RecordReference, BelongsToReference, HasManyReference } from '../references'; -import { default as recordDataFor, relationshipStateFor } from '../record-data-for'; import RecordData from '../../ts-interfaces/record-data'; import { JsonApiResource, JsonApiValidationError } from '../../ts-interfaces/record-data-json-api'; import { Record } from '../../ts-interfaces/record'; @@ -34,6 +33,24 @@ import { StableRecordIdentifier } from '../../ts-interfaces/identifier'; import { internalModelFactoryFor, setRecordIdentifier } from '../store/internal-model-factory'; import CoreStore from '../core-store'; import coerceId from '../coerce-id'; +import recordDataFor from '../record-data-for'; + +type DefaultRecordData = import('@ember-data/record-data/-private').RecordData; +type RecordArray = InstanceType; +type RelationshipRecordData = import('@ember-data/record-data/-private/ts-interfaces/relationship-record-data').RelationshipRecordData; +type Relationships = import('@ember-data/record-data/-private/relationships/state/create').default; + +// once the presentation logic is moved into the Model package we can make +// eliminate these lossy and redundant helpers +function relationshipsFor(instance: InternalModel): Relationships { + let recordData = recordDataFor(instance) as RelationshipRecordData; + + return recordData._relationships; +} + +function relationshipStateFor(instance: InternalModel, propertyName: string) { + return relationshipsFor(instance).get(propertyName); +} const { hasOwnProperty } = Object.prototype; @@ -213,9 +230,9 @@ export default class InternalModel { this.__recordData = newValue; } - get _recordArrays() { + get _recordArrays(): Set { if (this.__recordArrays === null) { - this.__recordArrays = new OrderedSet(); + this.__recordArrays = new Set(); } return this.__recordArrays; } @@ -652,7 +669,7 @@ export default class InternalModel { } getBelongsTo(key, options) { - let resource = this._recordData.getBelongsTo(key); + let resource = (this._recordData as DefaultRecordData).getBelongsTo(key); let identifier = resource && resource.data ? identifierCacheFor(this.store).getOrCreateRecordIdentifier(resource.data) : null; let relationshipMeta = this.store._relationshipMetaFor(this.modelName, null, key); @@ -670,7 +687,7 @@ export default class InternalModel { if (isAsync) { let internalModel = identifier !== null ? store._internalModelForResource(identifier) : null; - if (resource!._relationship!.hasFailedLoadAttempt) { + if (resource._relationship.hasFailedLoadAttempt) { return this._relationshipProxyCache[key]; } @@ -705,7 +722,7 @@ export default class InternalModel { // TODO Igor consider getting rid of initial state getManyArray(key, isAsync = false) { let relationshipMeta = this.store._relationshipMetaFor(this.modelName, null, key); - let jsonApi = this._recordData.getHasMany(key); + let jsonApi = (this._recordData as DefaultRecordData).getHasMany(key); let manyArray = this._manyArrayCache[key]; assert( @@ -765,7 +782,7 @@ export default class InternalModel { } getHasMany(key, options) { - let jsonApi = this._recordData.getHasMany(key); + let jsonApi = (this._recordData as DefaultRecordData).getHasMany(key); let relationshipMeta = this.store._relationshipMetaFor(this.modelName, null, key); let async = relationshipMeta.options.async; let isAsync = typeof async === 'undefined' ? true : async; @@ -820,7 +837,7 @@ export default class InternalModel { return loadingPromise; } - let jsonApi = this._recordData.getHasMany(key); + let jsonApi = (this._recordData as DefaultRecordData).getHasMany(key); // TODO move this to a public api if (jsonApi._relationship) { jsonApi._relationship.setHasFailedLoadAttempt(false); @@ -843,7 +860,7 @@ export default class InternalModel { return loadingPromise; } - let resource = this._recordData.getBelongsTo(key); + let resource = (this._recordData as DefaultRecordData).getBelongsTo(key); // TODO move this to a public api if (resource._relationship) { resource._relationship.setHasFailedLoadAttempt(false); diff --git a/packages/store/addon/-private/system/record-array-manager.js b/packages/store/addon/-private/system/record-array-manager.js index 73f2e16198b..d3fbb922c01 100644 --- a/packages/store/addon/-private/system/record-array-manager.js +++ b/packages/store/addon/-private/system/record-array-manager.js @@ -351,16 +351,18 @@ function updateLiveRecordArray(array, internalModels) { function removeFromAdapterPopulatedRecordArrays(internalModels) { for (let i = 0; i < internalModels.length; i++) { - let internalModel = internalModels[i]; - let list = internalModel._recordArrays.list; + removeFromAll(internalModels[i]); + } +} - for (let j = 0; j < list.length; j++) { - // TODO: group by arrays, so we can batch remove - list[j]._removeInternalModels([internalModel]); - } +function removeFromAll(internalModel) { + const recordArrays = internalModel._recordArrays; - internalModel._recordArrays.clear(); - } + recordArrays.forEach(function(recordArray) { + recordArray._removeInternalModels([internalModel]); + }); + + recordArrays.clear(); } export function associateWithRecordArray(internalModels, array) { diff --git a/packages/store/addon/-private/system/record-data-for.js b/packages/store/addon/-private/system/record-data-for.js deleted file mode 100644 index b12494e9771..00000000000 --- a/packages/store/addon/-private/system/record-data-for.js +++ /dev/null @@ -1,42 +0,0 @@ -/** - @module @ember-data/store -*/ - -/* - * Returns the RecordData instance associated with a given - * Model or InternalModel. - * - * Intentionally "loose" to allow anything with an _internalModel - * property until InternalModel is eliminated. - * - * Intentionally not typed to `InternalModel` due to circular dependency - * which that creates. - * - * Overtime, this should shift to a "weakmap" based lookup in the - * "Ember.getOwner(obj)" style. - */ -export default function recordDataFor(instance) { - let internalModel = instance._internalModel || instance.internalModel || instance; - - return internalModel._recordData || null; -} - -export function relationshipsFor(instance) { - let recordData = recordDataFor(instance) || instance; - - return recordData._relationships; -} - -export function relationshipStateFor(instance, propertyName) { - return relationshipsFor(instance).get(propertyName); -} - -export function implicitRelationshipsFor(instance) { - let recordData = recordDataFor(instance) || instance; - - return recordData.__implicitRelationships; -} - -export function implicitRelationshipStateFor(instance, propertyName) { - return implicitRelationshipsFor(instance)[propertyName]; -} diff --git a/packages/store/addon/-private/system/record-data-for.ts b/packages/store/addon/-private/system/record-data-for.ts new file mode 100644 index 00000000000..84c47991d71 --- /dev/null +++ b/packages/store/addon/-private/system/record-data-for.ts @@ -0,0 +1,31 @@ +import RecordData from '../ts-interfaces/record-data'; +/* + * Returns the RecordData instance associated with a given + * Model or InternalModel. + * + * Intentionally "loose" to allow anything with an _internalModel + * property until InternalModel is eliminated. + * + * Intentionally not typed to `InternalModel` due to circular dependency + * which that creates. + * + * Overtime, this should shift to a "weakmap" based lookup in the + * "Ember.getOwner(obj)" style. + */ +interface InternalModel { + _recordData: RecordData; +} + +type DSModelOrSnapshot = { _internalModel: InternalModel }; +type Reference = { internalModel: InternalModel }; + +type Instance = InternalModel | RecordData | DSModelOrSnapshot | Reference; + +export default function recordDataFor(instance: Instance): RecordData; +export default function recordDataFor(instance: object): null; +export default function recordDataFor(instance: Instance | object): RecordData | null { + let internalModel = + (instance as DSModelOrSnapshot)._internalModel || (instance as Reference).internalModel || instance; + + return internalModel._recordData || null; +} diff --git a/packages/store/addon/-private/system/snapshot.js b/packages/store/addon/-private/system/snapshot.js index dbfeaeb2c37..96bf3fe6c62 100644 --- a/packages/store/addon/-private/system/snapshot.js +++ b/packages/store/addon/-private/system/snapshot.js @@ -5,9 +5,19 @@ import { inspect } from '@ember/debug'; import EmberError from '@ember/error'; import { get } from '@ember/object'; import { assign } from '@ember/polyfills'; -import recordDataFor, { relationshipStateFor } from './record-data-for'; +import recordDataFor from './record-data-for'; import { CUSTOM_MODEL_CLASS } from '@ember-data/canary-features'; +function relationshipsFor(instance) { + let recordData = recordDataFor(instance) || instance; + + return recordData._relationships; +} + +function relationshipStateFor(instance, propertyName) { + return relationshipsFor(instance).get(propertyName); +} + /** @class Snapshot @private diff --git a/packages/store/addon/-private/ts-interfaces/ember-data-json-api.ts b/packages/store/addon/-private/ts-interfaces/ember-data-json-api.ts index 7fadb3b0937..bb035d15e4f 100644 --- a/packages/store/addon/-private/ts-interfaces/ember-data-json-api.ts +++ b/packages/store/addon/-private/ts-interfaces/ember-data-json-api.ts @@ -6,6 +6,18 @@ import { Dict } from './utils'; */ export type Meta = Dict; +export type LinkObject = { href: string; meta?: Dict }; +export type Link = string | LinkObject; +export interface Links { + related?: Link; + self?: Link; +} +export interface PaginationLinks extends Links { + first?: Link | null; + last?: Link | null; + prev?: Link | null; + next?: Link | null; +} /** * Serves as a reference to a `Resource` but does not contain @@ -70,15 +82,27 @@ export interface NewResourceIdentifierObject { export type ResourceIdentifierObject = ExistingResourceIdentifierObject | NewResourceIdentifierObject; +// TODO disallow NewResource, make narrowable +export interface SingleResourceRelationship { + data?: ResourceIdentifierObject | null; + meta?: Dict; + links?: Links; +} + +export interface CollectionResourceRelationship { + data?: ResourceIdentifierObject[]; + meta?: Dict; + links?: PaginationLinks; +} + /** * Contains the data for an existing resource in JSON:API format */ export interface ExistingResourceObject extends ExistingResourceIdentifierObject { meta?: Dict; attributes?: Dict; - // these are lossy, need improved typing - relationships?: Dict; - links?: Dict; + relationships?: Dict; + links?: Links; } interface Document { diff --git a/packages/store/addon/-private/ts-interfaces/record-data-json-api.ts b/packages/store/addon/-private/ts-interfaces/record-data-json-api.ts index 41ac537d2b0..2a25b2b5d9e 100644 --- a/packages/store/addon/-private/ts-interfaces/record-data-json-api.ts +++ b/packages/store/addon/-private/ts-interfaces/record-data-json-api.ts @@ -1,6 +1,4 @@ -import { ResourceIdentifierObject } from './ember-data-json-api'; -import BelongsToRelationship from '../system/relationships/state/belongs-to'; -import ManyRelationship from '../system/relationships/state/has-many'; +import { SingleResourceRelationship, CollectionResourceRelationship } from './ember-data-json-api'; /** @module @ember-data/store @@ -17,30 +15,11 @@ export interface JsonApiResource { type?: string; attributes?: AttributesHash; relationships?: { - [key: string]: JsonApiRelationship; + [key: string]: SingleResourceRelationship | CollectionResourceRelationship; }; meta?: any; } -export interface JsonApiBelongsToRelationship { - data?: ResourceIdentifierObject; - meta?: any; - links?: { - [key: string]: string; - }; - // Private - _relationship?: BelongsToRelationship; -} -export interface JsonApiHasManyRelationship { - data?: ResourceIdentifierObject[]; - meta?: any; - links?: { - [key: string]: string; - }; - // Private - _relationship?: ManyRelationship; -} - export interface JsonApiValidationError { title: string; detail: string; @@ -49,4 +28,4 @@ export interface JsonApiValidationError { }; } -export type JsonApiRelationship = JsonApiBelongsToRelationship | JsonApiHasManyRelationship; +export type JsonApiRelationship = SingleResourceRelationship | CollectionResourceRelationship; diff --git a/packages/store/addon/-private/ts-interfaces/record-data-record-wrapper.ts b/packages/store/addon/-private/ts-interfaces/record-data-record-wrapper.ts index 2b5ff73dd0f..c92f1906484 100644 --- a/packages/store/addon/-private/ts-interfaces/record-data-record-wrapper.ts +++ b/packages/store/addon/-private/ts-interfaces/record-data-record-wrapper.ts @@ -1,9 +1,5 @@ -import { - JsonApiHasManyRelationship, - JsonApiBelongsToRelationship, - JsonApiValidationError, -} from './record-data-json-api'; - +import { JsonApiValidationError } from './record-data-json-api'; +import { SingleResourceRelationship, CollectionResourceRelationship } from './ember-data-json-api'; import { RecordIdentifier } from './identifier'; import { ChangedAttributesHash } from './record-data'; @@ -18,13 +14,13 @@ export default interface RecordDataRecordWrapper { setDirtyAttribute(key: string, value: any): void; getAttr(key: string): any; - getHasMany(key: string): JsonApiHasManyRelationship; + getHasMany(key: string): CollectionResourceRelationship; addToHasMany(key: string, recordDatas: RecordDataRecordWrapper[], idx?: number): void; removeFromHasMany(key: string, recordDatas: RecordDataRecordWrapper[]): void; setDirtyHasMany(key: string, recordDatas: RecordDataRecordWrapper[]): void; - getBelongsTo(key: string): JsonApiBelongsToRelationship; + getBelongsTo(key: string): SingleResourceRelationship; setDirtyBelongsTo(name: string, recordData: RecordDataRecordWrapper | null): void; diff --git a/packages/store/addon/-private/ts-interfaces/record-data.ts b/packages/store/addon/-private/ts-interfaces/record-data.ts index 6b62d53adff..939adc172d3 100644 --- a/packages/store/addon/-private/ts-interfaces/record-data.ts +++ b/packages/store/addon/-private/ts-interfaces/record-data.ts @@ -1,9 +1,5 @@ -import { - JsonApiResource, - JsonApiHasManyRelationship, - JsonApiBelongsToRelationship, - JsonApiValidationError, -} from './record-data-json-api'; +import { JsonApiResource, JsonApiValidationError } from './record-data-json-api'; +import { SingleResourceRelationship, CollectionResourceRelationship } from './ember-data-json-api'; import { RecordIdentifier } from './identifier'; @@ -33,13 +29,13 @@ export default interface RecordData { setDirtyAttribute(key: string, value: any): void; getAttr(key: string): any; - getHasMany(key: string): JsonApiHasManyRelationship; + getHasMany(key: string): CollectionResourceRelationship; addToHasMany(key: string, recordDatas: RecordData[], idx?: number): void; removeFromHasMany(key: string, recordDatas: RecordData[]): void; setDirtyHasMany(key: string, recordDatas: RecordData[]): void; - getBelongsTo(key: string): JsonApiBelongsToRelationship; + getBelongsTo(key: string): SingleResourceRelationship; setDirtyBelongsTo(name: string, recordData: RecordData | null): void; didCommit(data: JsonApiResource | null): void; diff --git a/packages/store/addon/-private/ts-interfaces/relationship-record-data.ts b/packages/store/addon/-private/ts-interfaces/relationship-record-data.ts deleted file mode 100644 index 8529a953d57..00000000000 --- a/packages/store/addon/-private/ts-interfaces/relationship-record-data.ts +++ /dev/null @@ -1,28 +0,0 @@ -import Relationships from '../system/relationships/state/create'; -import Relationship from '../system/relationships/state/relationship'; -import RecordData from './record-data'; - -/** - @module @ember-data/store -*/ - -// we import the class not the interface because we expect -// because we expect to use this internally with the more complete set -// of APIs -import { RecordIdentifier } from './identifier'; -import { RecordDataStoreWrapper } from './record-data-store-wrapper'; - -export interface RelationshipRecordData extends RecordData { - //Required by the relationship layer - isNew(): boolean; - modelName: string; - storeWrapper: RecordDataStoreWrapper; - id: string | null; - clientId: string | null; - isEmpty(): boolean; - getResourceIdentifier(): RecordIdentifier; - _relationships: Relationships; - _implicitRelationships: { - [key: string]: Relationship; - }; -} diff --git a/packages/store/index.js b/packages/store/index.js index 9f2f689c77f..ccce266bf81 100644 --- a/packages/store/index.js +++ b/packages/store/index.js @@ -7,12 +7,6 @@ const addonBaseConfig = addonBuildConfigForDataPackage(name); module.exports = Object.assign({}, addonBaseConfig, { shouldRollupPrivate: true, externalDependenciesForPrivateModule() { - return [ - '@ember-data/canary-features', - 'ember-inflector', - '@ember/ordered-set', - '@ember-data/store/-debug', - 'require', - ]; + return ['@ember-data/canary-features', 'ember-inflector', '@ember-data/store/-debug', 'require']; }, }); diff --git a/packages/store/package.json b/packages/store/package.json index 493b8bab4bb..0639b343cff 100644 --- a/packages/store/package.json +++ b/packages/store/package.json @@ -22,7 +22,6 @@ "dependencies": { "@ember-data/-build-infra": "3.15.0-alpha.0", "@ember-data/canary-features": "3.15.0-alpha.0", - "@ember/ordered-set": "^2.0.3", "ember-cli-babel": "^7.12.0", "ember-cli-path-utils": "^1.0.0", "ember-cli-typescript": "^3.0.0", diff --git a/packages/store/tsconfig.json b/packages/store/tsconfig.json index 220761e1aa0..9d4645862b8 100644 --- a/packages/store/tsconfig.json +++ b/packages/store/tsconfig.json @@ -19,8 +19,11 @@ "dummy/*": ["tests/dummy/app/*", "app/*"], "@ember-data/store": ["addon"], "@ember-data/store/*": ["addon/*"], + "@ember-data/canary-features": ["../canary-features/addon"], + "@ember-data/canary-features/*": ["../canary-features/addon/*"], "@ember-data/adapter": ["../adapter/addon"], "@ember-data/adapter/*": ["../adapter/addon/*"], + "@ember-data/record-data/*": ["../record-data/addon/*"], "@ember-data/store/test-support": ["addon-test-support"], "@ember-data/store/test-support/*": ["addon-test-support/*"], "ember-data": ["../-ember-data/addon"], @@ -28,6 +31,14 @@ "*": ["types/*"] } }, - "include": ["app/**/*", "addon/**/*", "tests/**/*", "types/**/*", "test-support/**/*", "addon-test-support/**/*"], + "include": [ + "app/**/*", + "addon/**/*", + "tests/**/*", + "types/**/*", + "test-support/**/*", + "addon-test-support/**/*", + "../record-data/addon/-private/ts-interfaces/relationship-record-data.ts" + ], "exclude": ["node_modules"] } diff --git a/packages/store/types/@ember/array/index.d.ts b/packages/store/types/@ember/array/index.d.ts index 57ca9e7af0f..b22144c859f 100644 --- a/packages/store/types/@ember/array/index.d.ts +++ b/packages/store/types/@ember/array/index.d.ts @@ -1,6 +1,7 @@ import EmberArray, { A } from '@ember/array'; namespace EmberArray { + // detect is an intimate Mixin API, likely should not be typed upstream // eslint-disable-next-line @typescript-eslint/no-unused-vars function detect(arr: any): boolean; } diff --git a/packages/store/types/@ember/debug/index.d.ts b/packages/store/types/@ember/debug/index.d.ts index 790ec768507..d2c398a79dd 100644 --- a/packages/store/types/@ember/debug/index.d.ts +++ b/packages/store/types/@ember/debug/index.d.ts @@ -1,2 +1,3 @@ +// https://github.com/DefinitelyTyped/DefinitelyTyped/issues/38682 export { assert, warn, inspect } from '@ember/debug'; export { deprecate } from '@ember/application/deprecations'; diff --git a/packages/store/types/@ember/polyfills/index.d.ts b/packages/store/types/@ember/polyfills/index.d.ts index 1c8d53243ee..318e000b48a 100644 --- a/packages/store/types/@ember/polyfills/index.d.ts +++ b/packages/store/types/@ember/polyfills/index.d.ts @@ -1,6 +1,6 @@ /** * Copy properties from a source object to a target object. - * @deprecated Use Object.assign + * https://github.com/DefinitelyTyped/DefinitelyTyped/issues/38681 */ export function assign(target: T, source: U): Mix; export function assign( diff --git a/packages/store/types/@ember/runloop/index.d.ts b/packages/store/types/@ember/runloop/index.d.ts index 297af64376a..770af7951b3 100644 --- a/packages/store/types/@ember/runloop/index.d.ts +++ b/packages/store/types/@ember/runloop/index.d.ts @@ -1 +1,4 @@ +// necessary because our "run" is run.backburner +// which we use to avoid autorun triggering for Ember <= 3.4 +// we can drop this and use run directly ~11/1/2019 export const run: any; diff --git a/yarn.lock b/yarn.lock index 9334d39127a..96e21aeda21 100644 --- a/yarn.lock +++ b/yarn.lock @@ -384,7 +384,7 @@ dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-block-scoping@^7.4.4", "@babel/plugin-transform-block-scoping@^7.5.5", "@babel/plugin-transform-block-scoping@^7.6.0", "@babel/plugin-transform-block-scoping@^7.6.2": +"@babel/plugin-transform-block-scoping@^7.4.4", "@babel/plugin-transform-block-scoping@^7.5.5", "@babel/plugin-transform-block-scoping@^7.6.2": version "7.6.2" resolved "https://registry.npmjs.org/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.6.2.tgz#96c33ab97a9ae500cc6f5b19e04a7e6553360a79" integrity sha512-zZT8ivau9LOQQaOGC7bQLQOT4XPkPXgN2ERfUgk1X8ql+mVkLc4E8eKk+FO3o0154kxzqenWCorfmEXpEZcrSQ== @@ -795,51 +795,6 @@ exec-sh "^0.3.2" minimist "^1.2.0" -"@ember-data/-build-infra@3.14.0-alpha.4": - version "3.14.0-alpha.4" - resolved "https://registry.npmjs.org/@ember-data/-build-infra/-/-build-infra-3.14.0-alpha.4.tgz#2515450566c840c039b1b30bac2c5ac5b41efd4c" - integrity sha512-WI7bvfDvCtjLsZIJSiVINtDoTq/TfDcVy3dMjA+OYXL2ffEZ27ATaHhFeF0xYsLDAQqF+LQJpELt6EQit1gN1Q== - dependencies: - "@babel/plugin-transform-block-scoping" "^7.6.0" - "@ember-data/canary-features" "3.14.0-alpha.4" - "@ember/edition-utils" "^1.1.1" - babel-plugin-debug-macros "^0.3.3" - babel-plugin-feature-flags "^0.3.1" - babel-plugin-filter-imports "^3.0.0" - babel6-plugin-strip-class-callcheck "^6.0.0" - broccoli-debug "^0.6.5" - broccoli-file-creator "^2.1.1" - broccoli-funnel "^2.0.2" - broccoli-merge-trees "^3.0.2" - broccoli-rollup "^4.1.1" - calculate-cache-key-for-tree "^2.0.0" - chalk "^2.4.1" - ember-cli-path-utils "^1.0.0" - ember-cli-string-utils "^1.1.0" - ember-cli-version-checker "^3.1.2" - esm "^3.2.25" - git-repo-info "^2.0.0" - glob "^7.1.4" - npm-git-info "^1.0.3" - rimraf "^3.0.0" - rsvp "^4.8.5" - silent-error "^1.1.1" - -"@ember-data/-test-infra@3.14.0-alpha.4": - version "3.14.0-alpha.4" - resolved "https://registry.npmjs.org/@ember-data/-test-infra/-/-test-infra-3.14.0-alpha.4.tgz#1d35ebd5b0f0ea2a9ac6db0c386873d9247ccf2c" - integrity sha512-Z9QnLcp6ZueNL3T7ULrR/ndvx678uDkLDT0HCgko14Y3H/ZwvtNX76N+wzMalQQfBJHRsMxvj7Sfstb56DzASA== - dependencies: - "@ember/edition-utils" "^1.1.1" - ember-cli-blueprint-test-helpers "^0.19.1" - -"@ember-data/canary-features@3.14.0-alpha.4": - version "3.14.0-alpha.4" - resolved "https://registry.npmjs.org/@ember-data/canary-features/-/canary-features-3.14.0-alpha.4.tgz#eece9ede35ce90fc345069e44252807f8ebc826a" - integrity sha512-vtgqkgvTvT+0mzIX/bB77EqZyleFVe8RZ7uhRPsB/VocoKQvdousvN+hGZOckPsBS+WiaHZGAGvbi5/dGADprQ== - dependencies: - ember-cli-babel "^7.11.0" - "@ember-data/rfc395-data@^0.0.4": version "0.0.4" resolved "https://registry.npmjs.org/@ember-data/rfc395-data/-/rfc395-data-0.0.4.tgz#ecb86efdf5d7733a76ff14ea651a1b0ed1f8a843" @@ -5077,7 +5032,34 @@ ember-cli-babel@^6.0.0-beta.4, ember-cli-babel@^6.0.0-beta.7, ember-cli-babel@^6 ember-cli-version-checker "^2.1.2" semver "^5.5.0" -ember-cli-babel@^7.0.0, ember-cli-babel@^7.1.2, ember-cli-babel@^7.10.0, ember-cli-babel@^7.11.0, ember-cli-babel@^7.12.0, ember-cli-babel@^7.7.0, ember-cli-babel@^7.7.3, ember-cli-babel@^7.8.0: +ember-cli-babel@^7.0.0, ember-cli-babel@^7.1.2, ember-cli-babel@^7.10.0, ember-cli-babel@^7.7.0, ember-cli-babel@^7.7.3, ember-cli-babel@^7.8.0: + version "7.11.1" + resolved "https://registry.npmjs.org/ember-cli-babel/-/ember-cli-babel-7.11.1.tgz#77bc8f4001d47b91d80e3d36a4754412616fc0d8" + integrity sha512-Qgd7y9NVbRLEtwjBW/vPHXdTQrIgfgoCSFHfvBpEmLuWSWNpE/J6qwXrSbB9nEIlfzyjH0Almv4m0jwuJsB3ow== + dependencies: + "@babel/core" "^7.0.0" + "@babel/plugin-proposal-class-properties" "^7.3.4" + "@babel/plugin-proposal-decorators" "^7.3.0" + "@babel/plugin-transform-modules-amd" "^7.0.0" + "@babel/plugin-transform-runtime" "^7.2.0" + "@babel/polyfill" "^7.0.0" + "@babel/preset-env" "^7.0.0" + "@babel/runtime" "^7.2.0" + amd-name-resolver "^1.2.1" + babel-plugin-debug-macros "^0.3.0" + babel-plugin-ember-modules-api-polyfill "^2.12.0" + babel-plugin-module-resolver "^3.1.1" + broccoli-babel-transpiler "^7.3.0" + broccoli-debug "^0.6.4" + broccoli-funnel "^2.0.1" + broccoli-source "^1.1.0" + clone "^2.1.2" + ember-cli-babel-plugin-helpers "^1.1.0" + ember-cli-version-checker "^2.1.2" + ensure-posix-path "^1.0.2" + semver "^5.5.0" + +ember-cli-babel@^7.12.0: version "7.12.0" resolved "https://registry.npmjs.org/ember-cli-babel/-/ember-cli-babel-7.12.0.tgz#064997d199384be8c88d251f30ef67953d3bddc5" integrity sha512-+EGQsbPvh19nNXHCm6rVBx2CdlxQlzxMyhey5hsGViDPriDI4PFYXYaFWdGizDrmZoDcG/Ywpeph3hl0NxGQTg==