diff --git a/.eslintrc.js b/.eslintrc.js index 94842dece0e..64609170bb4 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -50,12 +50,18 @@ module.exports = { 'no-restricted-imports': [ 'error', { - paths: ['@glimmer/env', '@ember/utils', '@ember/runloop'], + paths: [ + '@glimmer/env', + '@ember/object/compat', + '@glimmer/tracking', + '@glimmer/validator', + '@ember/utils', + '@ember/runloop', + ], }, // '@ember/string', // '@ember/object', // '@ember/service', - // '@ember/object/compat', // 'ember-inflector', ], @@ -96,14 +102,18 @@ module.exports = { 'no-restricted-imports': [ 'error', { - paths: ['@glimmer/env', '@ember/utils', '@ember/runloop'], - // patterns: ['@ember/*'], + paths: [ + '@glimmer/env', + '@ember/object/compat', + '@glimmer/tracking', + '@glimmer/validator', + '@ember/utils', + '@ember/runloop', + ], }, - // '@ember/string', // '@ember/object', // '@ember/service', - // '@ember/object/compat', // 'ember-inflector', ], }, @@ -192,7 +202,6 @@ module.exports = { 'packages/unpublished-test-infra/addon-test-support/qunit-asserts/assert-warning.ts', 'packages/unpublished-test-infra/addon-test-support/qunit-asserts/assert-assertion.ts', 'tests/fastboot/types/global.d.ts', - 'tests/fastboot/types/fastboot-test-app/index.d.ts', 'tests/fastboot/app/serializers/application.ts', 'tests/fastboot/app/router.ts', 'tests/fastboot/app/resolver.ts', @@ -205,7 +214,6 @@ module.exports = { '@types/ember/index.d.ts', '@types/@glimmer/tracking.d.ts', '@types/@ember/utils/index.d.ts', - '@types/@ember/object/compat.d.ts', '@types/@ember/debug/index.d.ts', 'ember-data-types/q/schema-definition-service.ts', 'ember-data-types/q/record-instance.ts', diff --git a/packages/adapter/rollup.config.mjs b/packages/adapter/rollup.config.mjs index 9a5724fbac7..129deff4c04 100644 --- a/packages/adapter/rollup.config.mjs +++ b/packages/adapter/rollup.config.mjs @@ -14,16 +14,14 @@ export default { external: [ '@embroider/macros', - '@ember/service', + '@ember/service', // inject the store to base Adapter '@ember-data/store/-private', - 'require', - 'ember-inflector', - '@ember/debug', - '@ember/string', - '@ember/object', - '@ember/object/mixin', - '@ember/application', - '@ember/polyfills', + 'ember-inflector', // pluralize + '@ember/debug', // assert, deprecate + '@ember/string', // dasherize, camelize + '@ember/object', // Adapter base, computed for headers + '@ember/object/mixin', // BuildURLMixin + '@ember/application', // getOwner ], plugins: [ diff --git a/packages/adapter/src/index.ts b/packages/adapter/src/index.ts index edf017321db..1e4154df01c 100644 --- a/packages/adapter/src/index.ts +++ b/packages/adapter/src/index.ts @@ -67,17 +67,19 @@ your Adapter does not need the method. ```ts - import EmberObject from '@ember/object'; - async function fetchData(url, options = {}) { let response = await fetch(url, options); return response.toJSON(); } - export default class ApplicationAdapter extends EmberObject { + export default class ApplicationAdapter { findRecord(_, { modelName }, id) { return fetchData(`./${modelName}s/${id}`); } + + static create() { + return new this(); + } } ``` @@ -147,7 +149,7 @@ Note: If you are using Ember and would like to make use of `service` injections ```js import Store from '@ember-data/store'; import Adapter from '@ember-data/adapter/json-api'; - import { getOwner, setOwner } from '@ember/application'; + import { getOwner, setOwner } from '@ember/owner'; class extends Store { #adapter = null; diff --git a/packages/adapter/src/rest.ts b/packages/adapter/src/rest.ts index 0d57497360e..04f1d36ca92 100644 --- a/packages/adapter/src/rest.ts +++ b/packages/adapter/src/rest.ts @@ -115,7 +115,7 @@ declare const jQuery: JQueryStatic | undefined; { "posts": { "id": 1, - "title": "I'm Running to Reform the W3C's Tag", + "title": "I'm Running to Reform the W3C", "author": "Yehuda Katz" } } @@ -129,7 +129,7 @@ declare const jQuery: JQueryStatic | undefined; "posts": [ { "id": 1, - "title": "I'm Running to Reform the W3C's Tag", + "title": "I'm Running to Reform the W3C", "author": "Yehuda Katz" }, { @@ -187,7 +187,7 @@ declare const jQuery: JQueryStatic | undefined; { "posts": { "id": 5, - "title": "I'm Running to Reform the W3C's Tag", + "title": "I'm Running to Reform the W3C", "author": "Yehuda Katz", "comments": [1, 2] }, @@ -213,7 +213,7 @@ declare const jQuery: JQueryStatic | undefined; { "posts": { "id": 5, - "title": "I'm Running to Reform the W3C's Tag", + "title": "I'm Running to Reform the W3C", "author": "Yehuda Katz", "links": { "comments": "/posts/5/comments" diff --git a/packages/graph/rollup.config.mjs b/packages/graph/rollup.config.mjs index afb2c762bbc..551c5147bc5 100644 --- a/packages/graph/rollup.config.mjs +++ b/packages/graph/rollup.config.mjs @@ -15,14 +15,7 @@ export default { external: [ '@embroider/macros', '@ember-data/store/-private', - '@ember/service', - 'ember-inflector', - '@ember/debug', - '@ember/string', - '@ember/object', - '@ember/object/mixin', - '@ember/application', - '@ember/polyfills', + '@ember/debug', // assert, deprecate ], plugins: [ diff --git a/packages/json-api/rollup.config.mjs b/packages/json-api/rollup.config.mjs index fd1c5a7c0cd..bb73842c063 100644 --- a/packages/json-api/rollup.config.mjs +++ b/packages/json-api/rollup.config.mjs @@ -17,15 +17,9 @@ export default { '@ember-data/request-utils', '@ember-data/store', '@ember-data/store/-private', - '@ember/application', - '@ember/debug', - '@ember/object', - '@ember/object/mixin', - '@ember/polyfills', - '@ember/service', - '@ember/string', + '@ember/debug', // assert, deprecate '@embroider/macros', - 'ember-inflector', + 'ember-inflector', // pluralize ], plugins: [ diff --git a/packages/model/package.json b/packages/model/package.json index 0237322364c..b1ceb90ce75 100644 --- a/packages/model/package.json +++ b/packages/model/package.json @@ -63,13 +63,24 @@ }, "@ember/string": { "injected": true + }, + "@ember-data/tracking": { + "injected": true + }, + "@ember-data/graph": { + "injected": true + }, + "@ember-data/json-api": { + "injected": true + }, + "@ember-data/legacy-compat": { + "injected": true } }, "dependencies": { "@ember-data/private-build-infra": "workspace:5.5.0-alpha.10", "@ember/edition-utils": "^1.2.0", "@embroider/macros": "^1.13.2", - "ember-cached-decorator-polyfill": "^1.0.2", "ember-cli-babel": "^8.1.0", "ember-cli-string-utils": "^1.1.0", "ember-cli-test-info": "^1.0.0", diff --git a/packages/model/rollup.config.mjs b/packages/model/rollup.config.mjs index 037afd3fa6c..f83859d2e9c 100644 --- a/packages/model/rollup.config.mjs +++ b/packages/model/rollup.config.mjs @@ -15,11 +15,9 @@ export default { external: [ '@embroider/macros', '@ember/service', - 'ember', 'ember-inflector', '@ember/debug', '@ember/object/computed', - '@ember/object/compat', '@ember-data/store/-private', '@ember-data/store', '@ember/object/internals', @@ -32,7 +30,6 @@ export default { '@ember/object', '@ember/object/mixin', '@ember/application', - '@glimmer/tracking', '@ember/polyfills', ], diff --git a/packages/model/src/-private/has-many.js b/packages/model/src/-private/has-many.js index c5dc9565cb4..7e1dc4a67c5 100644 --- a/packages/model/src/-private/has-many.js +++ b/packages/model/src/-private/has-many.js @@ -1,7 +1,6 @@ /** @module @ember-data/model */ -import { A } from '@ember/array'; import { assert, deprecate } from '@ember/debug'; import { computed } from '@ember/object'; import { dasherize } from '@ember/string'; @@ -205,7 +204,7 @@ function hasMany(type, options) { } } if (this.isDestroying || this.isDestroyed) { - return A(); + return []; } return lookupLegacySupport(this).getHasMany(key); }, diff --git a/packages/model/src/-private/legacy-relationships-support.ts b/packages/model/src/-private/legacy-relationships-support.ts index f36af042ec0..8a9f01119a7 100644 --- a/packages/model/src/-private/legacy-relationships-support.ts +++ b/packages/model/src/-private/legacy-relationships-support.ts @@ -664,6 +664,7 @@ function handleCompletedRelationshipRequest( // for the async reload case there will be no proxy if the ui // has never been accessed if (proxy && !isHasMany) { + // @ts-expect-error unsure why this is not resolving the boolean but async belongsTo is weird // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access if (proxy.content && proxy.content.isDestroying) { (proxy as PromiseBelongsTo).set('content', null); diff --git a/packages/model/src/-private/many-array.ts b/packages/model/src/-private/many-array.ts index ee46938ce64..34de166b57e 100644 --- a/packages/model/src/-private/many-array.ts +++ b/packages/model/src/-private/many-array.ts @@ -5,7 +5,7 @@ import { assert } from '@ember/debug'; import type Store from '@ember-data/store'; import { - IDENTIFIER_ARRAY_TAG, + ARRAY_SIGNAL, MUTATE, notifyArray, RecordArray, @@ -275,8 +275,8 @@ export default class RelatedCollection extends RecordArray { } notify() { - const tag = this[IDENTIFIER_ARRAY_TAG]; - tag.shouldReset = true; + const signal = this[ARRAY_SIGNAL]; + signal.shouldReset = true; // @ts-expect-error notifyArray(this); } diff --git a/packages/model/src/-private/model-for-mixin.ts b/packages/model/src/-private/model-for-mixin.ts index a1f035202eb..f3b32274a79 100644 --- a/packages/model/src/-private/model-for-mixin.ts +++ b/packages/model/src/-private/model-for-mixin.ts @@ -6,10 +6,7 @@ import Model, { type ModelFactory } from './model'; /* In case someone defined a relationship to a mixin, for example: - ``` - import Model, { belongsTo, hasMany } from '@ember-data/model'; - import Mixin from '@ember/object/mixin'; - + ```ts class CommentModel extends Model { @belongsTo('commentable', { polymorphic: true }) owner; } diff --git a/packages/model/src/-private/model.d.ts b/packages/model/src/-private/model.d.ts index 2bbf47f8add..6525673897e 100644 --- a/packages/model/src/-private/model.d.ts +++ b/packages/model/src/-private/model.d.ts @@ -43,7 +43,6 @@ class Model extends EmberObject { deleteRecord(): void; unloadRecord(): void; serialize(): Record; - _notifyProperties(keys: string[]): void; static modelName: string; static fields: Map; diff --git a/packages/model/src/-private/model.js b/packages/model/src/-private/model.js index 2d389cb92b5..cca0a5930a8 100644 --- a/packages/model/src/-private/model.js +++ b/packages/model/src/-private/model.js @@ -4,9 +4,6 @@ import { assert, warn } from '@ember/debug'; import EmberObject from '@ember/object'; -import { dependentKeyCompat } from '@ember/object/compat'; -import { tracked } from '@glimmer/tracking'; -import Ember from 'ember'; import { importSync } from '@embroider/macros'; @@ -14,13 +11,14 @@ import { DEBUG } from '@ember-data/env'; import { HAS_DEBUG_PACKAGE } from '@ember-data/packages'; import { recordIdentifierFor, storeFor } from '@ember-data/store'; import { coerceId, peekCache } from '@ember-data/store/-private'; +import { compat } from '@ember-data/tracking'; +import { defineSignal } from '@ember-data/tracking/-private'; import Errors from './errors'; import { LegacySupport } from './legacy-relationships-support'; import notifyChanges from './notify-changes'; -import RecordState, { peekTag, tagged } from './record-state'; +import RecordState, { notifySignal, tagged } from './record-state'; -const { changeProperties } = Ember; export const LEGACY_SUPPORT = new Map(); export function lookupLegacySupport(record) { @@ -181,7 +179,7 @@ class Model extends EmberObject { @type {Boolean} @readOnly */ - @dependentKeyCompat + @compat get isEmpty() { return this.currentState.isEmpty; } @@ -197,7 +195,7 @@ class Model extends EmberObject { @type {Boolean} @readOnly */ - @dependentKeyCompat + @compat get isLoading() { return this.currentState.isLoading; } @@ -224,7 +222,7 @@ class Model extends EmberObject { @type {Boolean} @readOnly */ - @dependentKeyCompat + @compat get isLoaded() { return this.currentState.isLoaded; } @@ -254,7 +252,7 @@ class Model extends EmberObject { @type {Boolean} @readOnly */ - @dependentKeyCompat + @compat get hasDirtyAttributes() { return this.currentState.isDirty; } @@ -282,7 +280,7 @@ class Model extends EmberObject { @type {Boolean} @readOnly */ - @dependentKeyCompat + @compat get isSaving() { return this.currentState.isSaving; } @@ -325,7 +323,7 @@ class Model extends EmberObject { @type {Boolean} @readOnly */ - @dependentKeyCompat + @compat get isDeleted() { return this.currentState.isDeleted; } @@ -352,7 +350,7 @@ class Model extends EmberObject { @type {Boolean} @readOnly */ - @dependentKeyCompat + @compat get isNew() { return this.currentState.isNew; } @@ -368,7 +366,7 @@ class Model extends EmberObject { @type {Boolean} @readOnly */ - @dependentKeyCompat + @compat get isValid() { return this.currentState.isValid; } @@ -394,7 +392,7 @@ class Model extends EmberObject { @type {String} @readOnly */ - @dependentKeyCompat + @compat get dirtyType() { return this.currentState.dirtyType; } @@ -419,7 +417,7 @@ class Model extends EmberObject { @type {Boolean} @readOnly */ - @dependentKeyCompat + @compat get isError() { return this.currentState.isError; } @@ -445,7 +443,6 @@ class Model extends EmberObject { @type {Boolean} @readOnly */ - @tracked isReloading = false; /** All ember models have an id property. This is an identifier @@ -598,7 +595,7 @@ class Model extends EmberObject { @public @type {AdapterError} */ - @dependentKeyCompat + @compat get adapterError() { return this.currentState.adapterError; } @@ -634,10 +631,7 @@ class Model extends EmberObject { super in 4.0+ where sync observers are removed. */ notifyPropertyChange(prop) { - let tag = peekTag(this, prop); - if (tag) { - tag.notify(); - } + notifySignal(this, prop); super.notifyPropertyChange(prop); } @@ -649,24 +643,20 @@ class Model extends EmberObject { Example - ```app/controllers/model/delete.js - import Controller from '@ember/controller'; - import { action } from '@ember/object'; + ```js + import Component from '@glimmer/component'; - export default class ModelDeleteController extends Controller { - @action - softDelete() { - this.model.deleteRecord(); + export default class extends Component { + softDelete = () => { + this.args.model.deleteRecord(); } - @action - confirm() { - this.model.save(); + confirm = () => { + this.args.model.save(); } - @action - undo() { - this.model.rollbackAttributes(); + undo = () => { + this.args.model.rollbackAttributes(); } } ``` @@ -686,14 +676,12 @@ class Model extends EmberObject { Example - ```app/controllers/model/delete.js - import Controller from '@ember/controller'; - import { action } from '@ember/object'; + ```js + import Component from '@glimmer/component'; - export default class ModelDeleteController extends Controller { - @action - delete() { - this.model.destroyRecord().then(function() { + export default class extends Component { + delete = () => { + this.args.model.destroyRecord().then(function() { this.transitionToRoute('model.index'); }); } @@ -752,23 +740,6 @@ class Model extends EmberObject { storeFor(this).unloadRecord(this); } - /** - @method _notifyProperties - @private - */ - _notifyProperties(keys) { - // changeProperties defers notifications until after the delegate - // and protects with a try...finally block - // previously used begin...endPropertyChanges but this is private API - changeProperties(() => { - let prop; - for (let i = 0, length = keys.length; i < length; i++) { - prop = keys[i]; - this.notifyPropertyChange(prop); - } - }); - } - /** Returns an object, whose keys are changed properties, and value is an [oldProp, newProp] array. @@ -928,16 +899,13 @@ class Model extends EmberObject { Example - ```app/controllers/model/view.js - import Controller from '@ember/controller'; - import { action } from '@ember/object'; + ```js + import Component from '@glimmer/component'; - export default class ViewController extends Controller { - @action - reload() { - this.model.reload().then(function(model) { + export default class extends Component { + async reload = () => { + await this.args.model.reload(); // do something with the reloaded model - }); } } ``` @@ -1199,7 +1167,7 @@ class Model extends EmberObject { Represents the model's class name as a string. This can be used to look up the model's class name through `Store`'s modelFor method. - `modelName` is generated for you by Ember Data. It will be a lowercased, dasherized string. + `modelName` is generated for you by EmberData. It will be a lowercased, dasherized string. For example: ```javascript @@ -1497,7 +1465,6 @@ class Model extends EmberObject { relationships, like this: ```javascript - import { get } from '@ember/object'; import Blog from 'app/models/blog'; import User from 'app/models/user'; import Post from 'app/models/post'; @@ -1560,7 +1527,6 @@ class Model extends EmberObject { This property would contain the following: ```javascript - import { get } from '@ember/object'; import Blog from 'app/models/blog'; let relationshipNames = Blog.relationshipNames; @@ -1617,7 +1583,6 @@ class Model extends EmberObject { This property would contain the following: ```javascript - import { get } from '@ember/object'; import Blog from 'app/models/blog'; let relatedTypes = Blog.relatedTypes'); @@ -1625,9 +1590,9 @@ class Model extends EmberObject { ``` @property relatedTypes - @public + @public @static - @type Ember.Array + @type Array @readOnly */ @computeOnce @@ -1678,7 +1643,6 @@ class Model extends EmberObject { This property would contain the following: ```javascript - import { get } from '@ember/object'; import Blog from 'app/models/blog'; let relationshipsByName = Blog.relationshipsByName; @@ -1761,7 +1725,6 @@ class Model extends EmberObject { ``` ```js - import { get } from '@ember/object'; import Blog from 'app/models/blog' let fields = Blog.fields; @@ -1893,7 +1856,6 @@ class Model extends EmberObject { ``` ```javascript - import { get } from '@ember/object'; import Person from 'app/models/person' let attributes = Person.attributes @@ -1960,7 +1922,6 @@ class Model extends EmberObject { ``` ```javascript - import { get } from '@ember/object'; import Person from 'app/models/person'; let transformedAttributes = Person.transformedAttributes @@ -2126,6 +2087,8 @@ class Model extends EmberObject { } } +defineSignal(Model.prototype, 'isReloading', false); + // this is required to prevent `init` from passing // the values initialized during create to `setUnknownProperty` Model.prototype._createProps = null; diff --git a/packages/model/src/-private/promise-belongs-to.ts b/packages/model/src/-private/promise-belongs-to.ts index 076d05c2c74..6ee39400141 100644 --- a/packages/model/src/-private/promise-belongs-to.ts +++ b/packages/model/src/-private/promise-belongs-to.ts @@ -2,9 +2,9 @@ import { assert } from '@ember/debug'; import { computed } from '@ember/object'; import type PromiseProxyMixin from '@ember/object/promise-proxy-mixin'; import type ObjectProxy from '@ember/object/proxy'; -import { cached } from '@glimmer/tracking'; import type Store from '@ember-data/store'; +import { cached } from '@ember-data/tracking'; import type { RecordInstance } from '@ember-data/types/q/record-instance'; import { LegacySupport } from './legacy-relationships-support'; diff --git a/packages/model/src/-private/promise-many-array.ts b/packages/model/src/-private/promise-many-array.ts index d4dc7403618..1f29837606b 100644 --- a/packages/model/src/-private/promise-many-array.ts +++ b/packages/model/src/-private/promise-many-array.ts @@ -1,10 +1,8 @@ import { assert } from '@ember/debug'; -import { dependentKeyCompat } from '@ember/object/compat'; -import { tracked } from '@glimmer/tracking'; -import Ember from 'ember'; import { DEPRECATE_COMPUTED_CHAINS } from '@ember-data/deprecations'; -import { DEBUG } from '@ember-data/env'; +import { compat } from '@ember-data/tracking'; +import { defineSignal } from '@ember-data/tracking/-private'; import { FindOptions } from '@ember-data/types/q/store'; import type ManyArray from './many-array'; @@ -40,25 +38,18 @@ export default class PromiseManyArray { constructor(promise: Promise, content?: ManyArray) { this._update(promise, content); this.isDestroyed = false; - - if (DEBUG) { - const meta = Ember.meta(this); - meta.addMixin = (mixin: object) => { - assert(`Do not use A() on an EmberData PromiseManyArray`); - }; - } } //---- Methods/Properties on ArrayProxy that we will keep as our API - @tracked content: any | null = null; + declare content: ManyArray | null; /** * Retrieve the length of the content * @property length * @public */ - @dependentKeyCompat + @compat get length(): number { // shouldn't be needed, but ends up being needed // for computed chains even in 4.x @@ -68,17 +59,6 @@ export default class PromiseManyArray { return this.content ? this.content.length : 0; } - // ember-source < 3.23 (e.g. 3.20 lts) - // requires that the tag `'[]'` be notified - // on the ArrayProxy in order for `{{#each}}` - // to recompute. We entangle the '[]' tag from - @dependentKeyCompat - get '[]'() { - if (DEPRECATE_COMPUTED_CHAINS) { - return this.content?.length && this.content; - } - } - /** * Iterate the proxied content. Called by the glimmer iterator in #each * We do not guarantee that forEach will always be available. This @@ -116,28 +96,28 @@ export default class PromiseManyArray { * @property {boolean} isPending * @public */ - @tracked isPending: boolean = false; + declare isPending: boolean; /** * Whether the loading promise rejected * * @property {boolean} isRejected * @public */ - @tracked isRejected: boolean = false; + declare isRejected: boolean; /** * Whether the loading promise succeeded * * @property {boolean} isFulfilled * @public */ - @tracked isFulfilled: boolean = false; + declare isFulfilled: boolean; /** * Whether the loading promise completed (resolved or rejected) * * @property {boolean} isSettled * @public */ - @tracked isSettled: boolean = false; + declare isSettled: boolean; /** * chain this promise @@ -190,7 +170,7 @@ export default class PromiseManyArray { * @property links * @public */ - @dependentKeyCompat + @compat get links() { return this.content ? this.content.links : undefined; } @@ -200,7 +180,7 @@ export default class PromiseManyArray { * @property meta * @public */ - @dependentKeyCompat + @compat get meta() { return this.content ? this.content.meta : undefined; } @@ -219,6 +199,32 @@ export default class PromiseManyArray { return new this(promise, content); } } +defineSignal(PromiseManyArray.prototype, 'content', null); +defineSignal(PromiseManyArray.prototype, 'isPending', false); +defineSignal(PromiseManyArray.prototype, 'isRejected', false); +defineSignal(PromiseManyArray.prototype, 'isFulfilled', false); +defineSignal(PromiseManyArray.prototype, 'isSettled', false); + +// this will error if someone tries to call +// A(identifierArray) since it is not configurable +// which is preferrable to the `meta` override we used +// before which required importing all of Ember +if (DEPRECATE_COMPUTED_CHAINS) { + const desc = { + enumerable: true, + configurable: false, + get: function (this: PromiseManyArray) { + return this.content?.length && this.content; + }, + }; + compat(desc); + + // ember-source < 3.23 (e.g. 3.20 lts) + // requires that the tag `'[]'` be notified + // on the ArrayProxy in order for `{{#each}}` + // to recompute. We entangle the '[]' tag from content + Object.defineProperty(PromiseManyArray.prototype, '[]', desc); +} function tapPromise(proxy: PromiseManyArray, promise: Promise) { proxy.isPending = true; diff --git a/packages/model/src/-private/record-state.ts b/packages/model/src/-private/record-state.ts index 6fe4834bb7b..99afc7c8e4f 100644 --- a/packages/model/src/-private/record-state.ts +++ b/packages/model/src/-private/record-state.ts @@ -1,14 +1,12 @@ import { assert } from '@ember/debug'; -import { dependentKeyCompat } from '@ember/object/compat'; -import { cached, tracked } from '@glimmer/tracking'; -import { DEBUG } from '@ember-data/env'; import type Store from '@ember-data/store'; import { storeFor } from '@ember-data/store'; import { recordIdentifierFor } from '@ember-data/store/-private'; import type { NotificationType } from '@ember-data/store/-private/managers/notification-manager'; import type RequestStateService from '@ember-data/store/-private/network/request-cache'; -import { addToTransaction, subscribe } from '@ember-data/tracking/-private'; +import { cached, compat } from '@ember-data/tracking'; +import { addToTransaction, defineSignal, getSignal, peekSignal, subscribe } from '@ember-data/tracking/-private'; import type { Cache } from '@ember-data/types/q/cache'; import type { StableRecordIdentifier } from '@ember-data/types/q/identifier'; @@ -22,97 +20,44 @@ function isInvalidError(error) { } /** - * Tag provides a cache for a getter - * that recomputes only when a specific - * tracked property that it manages is dirtied. - * - * This allows us to bust the cache for a value - * that otherwise doesn't access anything tracked - * as well as control the timing of that notification. - * - * @internal - */ -class Tag { - declare rev: number; - declare isDirty: boolean; - declare value: any; - declare t: boolean; - declare _debug_base: string; - declare _debug_prop: string; - - constructor() { - if (DEBUG) { - const [base, prop] = arguments as unknown as [string, string]; - this._debug_base = base; - this._debug_prop = prop; - } - this.rev = 1; - this.isDirty = true; - this.value = undefined; - /* - * whether this was part of a transaction when mutated - */ - this.t = false; - } - @tracked ref = null; - - notify() { - this.isDirty = true; - addToTransaction(this); - this.rev++; - } - consume(v) { - this.isDirty = false; - this.value = v; // set cached value - } -} - -const Tags = new WeakMap(); -function getTag(record, key) { - let tags = Tags.get(record); - if (!tags) { - tags = Object.create(null); - Tags.set(record, tags); - } - // @ts-expect-error - return (tags[key] = tags[key] || (DEBUG ? new Tag(record.constructor.modelName, key) : new Tag())); -} - -export function peekTag(record, key) { - let tags = Tags.get(record); - return tags && tags[key]; -} - -/** - * A decorattor that caches a getter while + * A decorator that caches a getter while * providing the ability to bust that cache * when we so choose in a way that notifies - * glimmer's tracking system. + * tracking systems. * * @internal */ -export function tagged(_target, key, desc) { +export function tagged(_target: T, key: string, desc) { const getter = desc.get; const setter = desc.set; desc.get = function () { - let tag = getTag(this, key); - subscribe(tag); + const signal = getSignal(this, key, true); + subscribe(signal); - if (tag.isDirty) { - tag.consume(getter.call(this)); + if (signal.shouldReset) { + signal.shouldReset = false; + signal.lastValue = getter.call(this); } - return tag.value; + return signal.lastValue; }; - desc.set = function (v) { - getTag(this, key); // ensure tag is setup in case we want to use it. + desc.set = function (v: unknown) { + getSignal(this, key, true); // ensure signal is setup in case we want to use it. // probably notify here but not yet. setter.call(this, v); }; - dependentKeyCompat(desc); + compat(desc); return desc; } +export function notifySignal(obj: T, key: K) { + const signal = peekSignal(obj, key); + if (signal) { + signal.shouldReset = true; + addToTransaction(signal); + } +} + /** Historically EmberData managed a state machine for each record, the localState for which @@ -270,8 +215,8 @@ export default class RecordState { storeFor(this.record)!.notifications.unsubscribe(this.handler); } - notify(key) { - getTag(this, key).notify(); + notify(key: keyof this & string) { + notifySignal(this, key); } updateInvalidErrors(errors) { @@ -312,7 +257,7 @@ export default class RecordState { this._lastError = null; } - @tracked isSaving = false; + declare isSaving: boolean; @tagged get isLoading() { @@ -471,6 +416,7 @@ export default class RecordState { } } } +defineSignal(RecordState.prototype, 'isSaving', false); function notifyErrorsStateChanged(state: RecordState) { state.notify('isValid'); diff --git a/packages/model/src/-private/references/belongs-to.ts b/packages/model/src/-private/references/belongs-to.ts index efb509597a8..07aa9ae6eb9 100644 --- a/packages/model/src/-private/references/belongs-to.ts +++ b/packages/model/src/-private/references/belongs-to.ts @@ -1,6 +1,3 @@ -import { dependentKeyCompat } from '@ember/object/compat'; -import { cached, tracked } from '@glimmer/tracking'; - import type { Object as JSONObject, Value as JSONValue } from 'json-typescript'; import { DEBUG } from '@ember-data/env'; @@ -9,6 +6,8 @@ import type { Graph } from '@ember-data/graph/-private/graph'; import type Store from '@ember-data/store'; import { recordIdentifierFor } from '@ember-data/store/-private'; import type { NotificationType } from '@ember-data/store/-private/managers/notification-manager'; +import { cached, compat } from '@ember-data/tracking'; +import { defineSignal } from '@ember-data/tracking/-private'; import type { LinkObject, Links, @@ -59,7 +58,7 @@ export default class BelongsToReference { declare ___token: object; declare ___relatedToken: object | null; - @tracked _ref = 0; + declare _ref: number; constructor( store: Store, @@ -107,7 +106,7 @@ export default class BelongsToReference { * @public */ @cached - @dependentKeyCompat + @compat get identifier(): StableRecordIdentifier | null { if (this.___relatedToken) { this.store.notifications.unsubscribe(this.___relatedToken); @@ -602,3 +601,4 @@ export default class BelongsToReference { return support.reloadBelongsTo(this.key, options).then(() => this.value()); } } +defineSignal(BelongsToReference.prototype, '_ref', 0); diff --git a/packages/model/src/-private/references/has-many.ts b/packages/model/src/-private/references/has-many.ts index 9f3ce66b2b2..0cef1ce1e8f 100644 --- a/packages/model/src/-private/references/has-many.ts +++ b/packages/model/src/-private/references/has-many.ts @@ -1,6 +1,3 @@ -import { dependentKeyCompat } from '@ember/object/compat'; -import { cached, tracked } from '@glimmer/tracking'; - import type { Object as JSONObject, Value as JSONValue } from 'json-typescript'; import { ManyArray } from 'ember-data/-private'; @@ -11,6 +8,8 @@ import type { Graph } from '@ember-data/graph/-private/graph'; import type Store from '@ember-data/store'; import { recordIdentifierFor } from '@ember-data/store'; import type { NotificationType } from '@ember-data/store/-private/managers/notification-manager'; +import { cached, compat } from '@ember-data/tracking'; +import { defineSignal } from '@ember-data/tracking/-private'; import { CollectionRelationship } from '@ember-data/types/cache/relationship'; import type { CollectionResourceDocument, @@ -63,7 +62,7 @@ export default class HasManyReference { ___identifier: StableRecordIdentifier; ___relatedTokenMap!: Map; - @tracked _ref = 0; + declare _ref: number; constructor( store: Store, @@ -106,7 +105,7 @@ export default class HasManyReference { * @public */ @cached - @dependentKeyCompat + @compat get identifiers(): StableRecordIdentifier[] { this._ref; // consume the tracked prop @@ -647,3 +646,4 @@ export default class HasManyReference { return support.reloadHasMany(this.key, options); } } +defineSignal(HasManyReference.prototype, '_ref', 0); diff --git a/packages/schema-record/src/record.ts b/packages/schema-record/src/record.ts index 57f72f62c64..6fb4a30fb70 100644 --- a/packages/schema-record/src/record.ts +++ b/packages/schema-record/src/record.ts @@ -2,13 +2,12 @@ import type Store from '@ember-data/store'; import type { StableRecordIdentifier } from "@ember-data/types/q/identifier"; import type { FieldSchema, SchemaService } from './schema'; import { Cache } from '@ember-data/types/q/cache'; -import { tracked } from '@glimmer/tracking'; import { Link, Links, SingleResourceRelationship } from '@ember-data/types/q/ember-data-json-api'; import { StoreRequestInput } from '@ember-data/store/-private/cache-handler'; import { Future } from '@ember-data/request'; import { DEBUG } from '@ember-data/env'; import { NotificationType } from '@ember-data/store/-private/managers/notification-manager'; -import { addToTransaction, entangleSignal } from '@ember-data/tracking/-private'; +import { addToTransaction, entangleSignal, defineSignal } from '@ember-data/tracking/-private'; export const Destroy = Symbol('Destroy'); export const RecordStore = Symbol('Store'); @@ -49,9 +48,9 @@ class ResourceRelationship { declare [RecordStore]: Store; declare name: string; - @tracked declare data: T | null; - @tracked declare links: Links; - @tracked declare meta: Record; + declare data: T | null; + declare links: Links; + declare meta: Record; constructor(store: Store, cache: Cache, parent: SchemaRecord, identifier: StableRecordIdentifier, field: FieldSchema, name: string) { const rawValue = cache.getRelationship(identifier, name) as SingleResourceRelationship; @@ -89,6 +88,10 @@ class ResourceRelationship { } } +defineSignal(ResourceRelationship.prototype, 'data'); +defineSignal(ResourceRelationship.prototype, 'links'); +defineSignal(ResourceRelationship.prototype, 'meta'); + function getHref(link?: Link | null): string | null { if (!link) { return null; diff --git a/packages/store/package.json b/packages/store/package.json index a3f1e4297ce..10be5d55861 100644 --- a/packages/store/package.json +++ b/packages/store/package.json @@ -50,9 +50,7 @@ "dependencies": { "@ember-data/private-build-infra": "workspace:5.5.0-alpha.10", "@embroider/macros": "^1.13.2", - "ember-cached-decorator-polyfill": "^1.0.2", - "ember-cli-babel": "^8.1.0", - "@glimmer/validator": "^0.84.3" + "ember-cli-babel": "^8.1.0" }, "devDependencies": { "@babel/cli": "^7.23.0", diff --git a/packages/store/rollup.config.mjs b/packages/store/rollup.config.mjs index a2de505627d..9533cf348df 100644 --- a/packages/store/rollup.config.mjs +++ b/packages/store/rollup.config.mjs @@ -14,23 +14,16 @@ export default { external: [ '@embroider/macros', - '@glimmer/tracking', '@ember-data/tracking/-private', '@ember-data/private-build-infra/current-deprecations', - '@ember/-internals/glimmer', - '@ember/-internals/metal', - '@glimmer/validator', // to eliminate - '@ember/object/compat', '@ember/runloop', '@ember/string', - 'ember', // investigate why these are present '@ember/application', - '@ember/object/computed', // deprecated usages only '@ember/object', diff --git a/packages/store/src/-private/document.ts b/packages/store/src/-private/document.ts index fafc12c7bfc..b191eee7f6a 100644 --- a/packages/store/src/-private/document.ts +++ b/packages/store/src/-private/document.ts @@ -1,7 +1,7 @@ import { assert } from '@ember/debug'; -import { tracked } from '@glimmer/tracking'; import { RequestInfo } from '@ember-data/request/-private/types'; +import { defineSignal } from '@ember-data/tracking/-private'; import { StableDocumentIdentifier } from '@ember-data/types/cache/identifier'; import { Link, PaginationLinks } from '@ember-data/types/q/ember-data-json-api'; @@ -13,10 +13,10 @@ function urlFromLink(link: Link): string { } export class Document { - @tracked links?: PaginationLinks; - @tracked data?: T; - @tracked errors?: object; - @tracked meta?: object; + declare links?: PaginationLinks; + declare data?: T; + declare errors?: object; + declare meta?: object; declare identifier: StableDocumentIdentifier | null; @@ -78,3 +78,8 @@ export class Document { return data; } } + +defineSignal(Document.prototype, 'data'); +defineSignal(Document.prototype, 'links'); +defineSignal(Document.prototype, 'errors'); +defineSignal(Document.prototype, 'meta'); diff --git a/packages/store/src/-private/index.ts b/packages/store/src/-private/index.ts index 815627b8423..4ad66e9dc1f 100644 --- a/packages/store/src/-private/index.ts +++ b/packages/store/src/-private/index.ts @@ -27,7 +27,7 @@ export { notifyArray, SOURCE, MUTATE, - IDENTIFIER_ARRAY_TAG, + ARRAY_SIGNAL, } from './record-arrays/identifier-array'; export { default as RecordArrayManager, fastPush } from './managers/record-array-manager'; diff --git a/packages/store/src/-private/legacy-model-support/record-reference.ts b/packages/store/src/-private/legacy-model-support/record-reference.ts index 7102db1c0c1..3abe4f37766 100644 --- a/packages/store/src/-private/legacy-model-support/record-reference.ts +++ b/packages/store/src/-private/legacy-model-support/record-reference.ts @@ -1,6 +1,6 @@ import { assert } from '@ember/debug'; -import { tracked } from '@glimmer/tracking'; +import { defineSignal } from '@ember-data/tracking/-private'; /** @module @ember-data/store */ @@ -29,7 +29,7 @@ export default class RecordReference { ___token!: object; ___identifier: StableRecordIdentifier; - @tracked _ref = 0; + declare _ref: number; constructor(store: Store, identifier: StableRecordIdentifier) { this.store = store; @@ -235,3 +235,5 @@ export default class RecordReference { assert(`Unable to fetch record of type ${this.type} without an id`); } } + +defineSignal(RecordReference.prototype, '_ref'); diff --git a/packages/store/src/-private/managers/record-array-manager.ts b/packages/store/src/-private/managers/record-array-manager.ts index 9fc350b7198..228832e65f4 100644 --- a/packages/store/src/-private/managers/record-array-manager.ts +++ b/packages/store/src/-private/managers/record-array-manager.ts @@ -7,9 +7,9 @@ import type { CollectionResourceDocument } from '@ember-data/types/q/ember-data- import type { StableRecordIdentifier } from '@ember-data/types/q/identifier'; import IdentifierArray, { + ARRAY_SIGNAL, Collection, CollectionCreateOptions, - IDENTIFIER_ARRAY_TAG, NOTIFY, notifyArray, SOURCE, @@ -197,7 +197,7 @@ class RecordArrayManager { if (array === FAKE_ARR) { return; } - let tag = array[IDENTIFIER_ARRAY_TAG]; + let tag = array[ARRAY_SIGNAL]; if (!tag.shouldReset) { tag.shouldReset = true; addTransactionCB(array[NOTIFY]); diff --git a/packages/store/src/-private/record-arrays/identifier-array.ts b/packages/store/src/-private/record-arrays/identifier-array.ts index cf04c962640..1a3eb02f932 100644 --- a/packages/store/src/-private/record-arrays/identifier-array.ts +++ b/packages/store/src/-private/record-arrays/identifier-array.ts @@ -1,17 +1,18 @@ /** @module @ember-data/store */ -import { tagForProperty } from '@ember/-internals/metal'; import { assert } from '@ember/debug'; -import { dependentKeyCompat } from '@ember/object/compat'; -import { tracked } from '@glimmer/tracking'; -import { dirtyTag } from '@glimmer/validator'; -import Ember from 'ember'; -import { DEPRECATE_COMPUTED_CHAINS } from '@ember-data/deprecations'; -import { DEBUG } from '@ember-data/env'; import { ImmutableRequestInfo } from '@ember-data/request/-private/types'; -import { addToTransaction, subscribe } from '@ember-data/tracking/-private'; +import { compat } from '@ember-data/tracking'; +import { + addToTransaction, + createArrayTags, + createSignal, + defineSignal, + Signal, + subscribe, +} from '@ember-data/tracking/-private'; import { Links, PaginationLinks } from '@ember-data/types/q/ember-data-json-api'; import type { StableRecordIdentifier } from '@ember-data/types/q/identifier'; import type { RecordInstance } from '@ember-data/types/q/record-instance'; @@ -54,23 +55,14 @@ function isArraySetter(prop: KeyType): boolean { return ARRAY_SETTER_METHODS.has(prop); } -export const IDENTIFIER_ARRAY_TAG = Symbol('#tag'); +export const ARRAY_SIGNAL = Symbol('#signal'); export const SOURCE = Symbol('#source'); export const MUTATE = Symbol('#update'); export const NOTIFY = Symbol('#notify'); const IS_COLLECTION = Symbol.for('Collection'); export function notifyArray(arr: IdentifierArray) { - addToTransaction(arr[IDENTIFIER_ARRAY_TAG]); - - if (DEPRECATE_COMPUTED_CHAINS) { - // @ts-expect-error tagForProperty is mistyped to Tag instead of DirtyableTag - // eslint-disable-next-line - dirtyTag(tagForProperty(arr, 'length')); - // @ts-expect-error tagForProperty is mistyped to Tag instead of DirtyableTag - // eslint-disable-next-line - dirtyTag(tagForProperty(arr, '[]')); - } + addToTransaction(arr[ARRAY_SIGNAL]); } function convertToInt(prop: KeyType): number | null { @@ -83,28 +75,6 @@ function convertToInt(prop: KeyType): number | null { return num % 1 === 0 ? num : null; } -class Tag { - @tracked ref = null; - declare shouldReset: boolean; - /* - * whether this was part of a transaction when last mutated - */ - declare t: boolean; - declare _debug_base: string; - declare _debug_prop: string; - - constructor() { - if (DEBUG) { - const [arr, prop] = arguments as unknown as [IdentifierArray, string]; - - this._debug_base = arr.constructor.name + ':' + String(arr.modelName); - this._debug_prop = prop; - } - this.shouldReset = false; - this.t = false; - } -} - type ProxiedMethod = (...args: unknown[]) => unknown; declare global { interface ProxyConstructor { @@ -184,14 +154,14 @@ class IdentifierArray { @public @type Boolean */ - @tracked isUpdating: boolean = false; + declare isUpdating: boolean; isLoaded: boolean = true; isDestroying: boolean = false; isDestroyed: boolean = false; _updatingPromise: Promise | null = null; [IS_COLLECTION] = true; - declare [IDENTIFIER_ARRAY_TAG]: Tag; + declare [ARRAY_SIGNAL]: Signal; [SOURCE]: StableRecordIdentifier[]; [NOTIFY]() { notifyArray(this); @@ -220,7 +190,7 @@ class IdentifierArray { } // length must be on self for proxied methods to work properly - @dependentKeyCompat + @compat get length() { return this[SOURCE].length; } @@ -228,14 +198,6 @@ class IdentifierArray { this[SOURCE].length = value; } - // here to support computed chains - // and {{#each}} - get '[]'() { - if (DEPRECATE_COMPUTED_CHAINS) { - return this; - } - } - constructor(options: IdentifierArrayCreateOptions) { // eslint-disable-next-line @typescript-eslint/no-this-alias let self = this; @@ -243,11 +205,10 @@ class IdentifierArray { this.store = options.store; this._manager = options.manager; this[SOURCE] = options.identifiers; - // @ts-expect-error - this[IDENTIFIER_ARRAY_TAG] = DEBUG ? new Tag(this, 'length') : new Tag(); + this[ARRAY_SIGNAL] = createSignal(this, 'length'); const store = options.store; const boundFns = new Map(); - const _TAG = this[IDENTIFIER_ARRAY_TAG]; + const _SIGNAL = this[ARRAY_SIGNAL]; const PrivateState: PrivateState = { links: options.links || null, meta: options.meta || null, @@ -261,23 +222,23 @@ class IdentifierArray { const proxy = new Proxy(this[SOURCE], { get(target: StableRecordIdentifier[], prop: KeyType, receiver: IdentifierArray): unknown { let index = convertToInt(prop); - if (_TAG.shouldReset && (index !== null || SYNC_PROPS.has(prop) || isArrayGetter(prop))) { + if (_SIGNAL.shouldReset && (index !== null || SYNC_PROPS.has(prop) || isArrayGetter(prop))) { options.manager._syncArray(receiver as unknown as IdentifierArray); - _TAG.t = false; - _TAG.shouldReset = false; + _SIGNAL.t = false; + _SIGNAL.shouldReset = false; } if (index !== null) { const identifier = target[index]; if (!transaction) { - subscribe(_TAG); + subscribe(_SIGNAL); } return identifier && store._instanceCache.getRecord(identifier); } - if (prop === 'meta') return subscribe(_TAG), PrivateState.meta; - if (prop === 'links') return subscribe(_TAG), PrivateState.links; - if (prop === '[]') return subscribe(_TAG), receiver; + if (prop === 'meta') return subscribe(_SIGNAL), PrivateState.meta; + if (prop === 'links') return subscribe(_SIGNAL), PrivateState.links; + if (prop === '[]') return subscribe(_SIGNAL), receiver; if (isArrayGetter(prop)) { let fn = boundFns.get(prop); @@ -285,7 +246,7 @@ class IdentifierArray { if (fn === undefined) { if (prop === 'forEach') { fn = function () { - subscribe(_TAG); + subscribe(_SIGNAL); transaction = true; let result = safeForEach(receiver, target, store, arguments[0] as ForEachCB, arguments[1]); transaction = false; @@ -293,7 +254,7 @@ class IdentifierArray { }; } else { fn = function () { - subscribe(_TAG); + subscribe(_SIGNAL); // array functions must run through Reflect to work properly // binding via other means will not work. transaction = true; @@ -325,7 +286,7 @@ class IdentifierArray { transaction = true; let result: unknown = Reflect.apply(target[prop] as ProxiedMethod, receiver, args); self[MUTATE]!(prop as string, args, result); - addToTransaction(_TAG); + addToTransaction(_SIGNAL); // TODO handle cache updates transaction = false; return result; @@ -338,7 +299,7 @@ class IdentifierArray { } if (prop in self) { - if (prop === NOTIFY || prop === IDENTIFIER_ARRAY_TAG || prop === SOURCE) { + if (prop === NOTIFY || prop === ARRAY_SIGNAL || prop === SOURCE) { return self[prop]; } @@ -349,7 +310,7 @@ class IdentifierArray { if (typeof outcome === 'function') { fn = function () { - subscribe(_TAG); + subscribe(_SIGNAL); // array functions must run through Reflect to work properly // binding via other means will not work. return Reflect.apply(outcome as ProxiedMethod, receiver, arguments) as unknown; @@ -359,7 +320,7 @@ class IdentifierArray { return fn; } - return subscribe(_TAG), outcome; + return subscribe(_SIGNAL), outcome; } return target[prop]; @@ -369,7 +330,7 @@ class IdentifierArray { if (prop === 'length') { if (!transaction && value === 0) { transaction = true; - addToTransaction(_TAG); + addToTransaction(_SIGNAL); Reflect.set(target, prop, value); self[MUTATE]!('length 0', []); transaction = false; @@ -408,7 +369,7 @@ class IdentifierArray { (target as unknown as Record)[index] = newIdentifier; if (!transaction) { self[MUTATE]!('replace cell', [index, original, newIdentifier]); - addToTransaction(_TAG); + addToTransaction(_SIGNAL); } return true; @@ -427,12 +388,7 @@ class IdentifierArray { }, }) as IdentifierArray; - if (DEBUG) { - const meta = Ember.meta(this); - meta.addMixin = (mixin: object) => { - assert(`Do not call A() on EmberData RecordArrays`); - }; - } + createArrayTags(proxy, _SIGNAL); this[NOTIFY] = this[NOTIFY].bind(proxy); @@ -514,6 +470,22 @@ class IdentifierArray { } } +// this will error if someone tries to call +// A(identifierArray) since it is not configurable +// which is preferrable to the `meta` override we used +// before which required importing all of Ember +const desc = { + enumerable: true, + configurable: false, + get: function () { + return this; + }, +}; +compat(desc); +Object.defineProperty(IdentifierArray.prototype, '[]', desc); + +defineSignal(IdentifierArray.prototype, 'isUpdating', false); + export default IdentifierArray; export type CollectionCreateOptions = IdentifierArrayCreateOptions & { @@ -551,7 +523,7 @@ export class Collection extends IdentifierArray { Collection.prototype.query = null; // Ensure instanceof works correctly -//Object.setPrototypeOf(IdentifierArray.prototype, Array.prototype); +// Object.setPrototypeOf(IdentifierArray.prototype, Array.prototype); type PromiseProxyRecord = { then(): void; content: RecordInstance | null | undefined }; diff --git a/packages/store/src/-private/store-service.ts b/packages/store/src/-private/store-service.ts index a37d5538088..8375aaa2a67 100644 --- a/packages/store/src/-private/store-service.ts +++ b/packages/store/src/-private/store-service.ts @@ -840,9 +840,7 @@ class Store extends EmberObject { snapshot: ```app/adapters/application.js - import EmberObject from '@ember/object'; - - export default class Adapter extends EmberObject { + export default class Adapter { findRecord(store, schema, id, snapshot) { let type = schema.modelName; @@ -854,6 +852,10 @@ class Store extends EmberObject { .then(response => response.json()) } } + + static create() { + return new this(); + } } ``` @@ -871,10 +873,7 @@ class Store extends EmberObject { ``` ```app/adapters/application.js - import EmberObject from '@ember/object'; - - export default class Adapter extends EmberObject { - + export default class Adapter { findRecord(store, schema, id, snapshot) { let type = schema.modelName; @@ -885,6 +884,10 @@ class Store extends EmberObject { .then(response => response.json()) } } + + static create() { + return new this(); + } } ``` @@ -1044,10 +1047,7 @@ class Store extends EmberObject { ``` ```app/adapters/application.js - import EmberObject from '@ember/object'; - - export default class Adapter extends EmberObject { - + export default class Adapter { findRecord(store, schema, id, snapshot) { let type = schema.modelName; @@ -1058,6 +1058,10 @@ class Store extends EmberObject { .then(response => response.json()) } } + + static create() { + return new this(); + } } ``` diff --git a/packages/tracking/package.json b/packages/tracking/package.json index 3bd5521e191..46ff87ad83d 100644 --- a/packages/tracking/package.json +++ b/packages/tracking/package.json @@ -30,6 +30,7 @@ "@ember-data/private-build-infra": "workspace:5.5.0-alpha.10", "@embroider/macros": "^1.13.2", "ember-cli-babel": "^8.1.0", + "ember-cached-decorator-polyfill": "^1.0.2", "@glimmer/validator": "^0.84.3" }, "files": [ @@ -65,6 +66,8 @@ "@embroider/addon-dev": "^4.1.1", "@rollup/plugin-babel": "^6.0.3", "@rollup/plugin-node-resolve": "^15.2.1", + "ember-source": "~5.3.0", + "@glimmer/component": "^1.1.2", "rollup": "^3.29.4", "tslib": "^2.6.2", "typescript": "^5.2.2", diff --git a/packages/tracking/rollup.config.mjs b/packages/tracking/rollup.config.mjs index 9fecfb83ff7..08c5e026fe8 100644 --- a/packages/tracking/rollup.config.mjs +++ b/packages/tracking/rollup.config.mjs @@ -12,7 +12,14 @@ export default { // You can augment this if you need to. output: addon.output(), - external: ['@embroider/macros', '@glimmer/validator'], + external: [ + '@ember/debug', + '@embroider/macros', + '@glimmer/validator', + '@ember/-internals/metal', + '@glimmer/tracking/primitives/cache', + '@ember/object/compat', + ], plugins: [ // These are the modules that users should be able to import from your diff --git a/packages/tracking/src/-private.ts b/packages/tracking/src/-private.ts index a8b84ae14aa..1f2af17b9db 100644 --- a/packages/tracking/src/-private.ts +++ b/packages/tracking/src/-private.ts @@ -1,6 +1,8 @@ import { tagForProperty } from '@ember/-internals/metal'; +// eslint-disable-next-line no-restricted-imports import { consumeTag, dirtyTag } from '@glimmer/validator'; +import { DEPRECATE_COMPUTED_CHAINS } from '@ember-data/deprecations'; import { DEBUG } from '@ember-data/env'; /** @@ -40,10 +42,28 @@ function createTransaction() { TRANSACTION = transaction; } +function maybeConsume(tag: ReturnType | null): void { + if (tag) { + // @ts-expect-error - we are using Ember's Tag not Glimmer's + consumeTag(tag); + } +} + +function maybeDirty(tag: ReturnType | null): void { + if (tag) { + // @ts-expect-error - we are using Ember's Tag not Glimmer's + dirtyTag(tag); + } +} + export function subscribe(obj: Tag | Signal): void { if (TRANSACTION) { TRANSACTION.sub.add(obj); } else if ('tag' in obj) { + if (DEPRECATE_COMPUTED_CHAINS) { + maybeConsume(obj['[]']); + maybeConsume(obj['@length']); + } // @ts-expect-error - we are using Ember's Tag not Glimmer's consumeTag(obj.tag); } else { @@ -55,6 +75,10 @@ function updateRef(obj: Tag | Signal): void { if (DEBUG) { try { if ('tag' in obj) { + if (DEPRECATE_COMPUTED_CHAINS) { + maybeDirty(obj['[]']); + maybeDirty(obj['@length']); + } // @ts-expect-error - we are using Ember's Tag not Glimmer's dirtyTag(obj.tag); } else { @@ -62,17 +86,11 @@ function updateRef(obj: Tag | Signal): void { } } catch (e: unknown) { if (e instanceof Error) { - if (e.message.includes('You attempted to update `ref` on `Tag`')) { - e.message = e.message.replace( - 'You attempted to update `ref` on `Tag`', - // @ts-expect-error - `You attempted to update <${obj._debug_base}>.${obj._debug_prop}` // eslint-disable-line - ); - e.stack = e.stack?.replace( - 'You attempted to update `ref` on `Tag`', - // @ts-expect-error - `You attempted to update <${obj._debug_base}>.${obj._debug_prop}` // eslint-disable-line - ); + if (e.message.includes('You attempted to update `undefined`')) { + // @ts-expect-error + const key = `<${obj._debug_base}>.${obj.key}`; + e.message = e.message.replace('You attempted to update `undefined`', `You attempted to update ${key}`); + e.stack = e.stack?.replace('You attempted to update `undefined`', `You attempted to update ${key}`); const lines = e.stack?.split(`\n`); const finalLines: string[] = []; @@ -98,9 +116,9 @@ function updateRef(obj: Tag | Signal): void { } }); - const splitstr = '`ref` was first used:'; + const splitstr = '`undefined` was first used:'; const parts = e.message.split(splitstr); - parts.splice(1, 0, `Original Stack\n=============\n${finalLines.join(`\n`)}\n\n${splitstr}`); + parts.splice(1, 0, `Original Stack\n=============\n${finalLines.join(`\n`)}\n\n\`${key}\` was first used:`); e.message = parts.join(''); } @@ -109,6 +127,10 @@ function updateRef(obj: Tag | Signal): void { } } else { if ('tag' in obj) { + if (DEPRECATE_COMPUTED_CHAINS) { + maybeDirty(obj['[]']); + maybeDirty(obj['@length']); + } // @ts-expect-error - we are using Ember's Tag not Glimmer's dirtyTag(obj.tag); } else { @@ -130,6 +152,10 @@ function flushTransaction() { }); transaction.sub.forEach((obj) => { if ('tag' in obj) { + if (DEPRECATE_COMPUTED_CHAINS) { + maybeConsume(obj['[]']); + maybeConsume(obj['@length']); + } // @ts-expect-error - we are using Ember's Tag not Glimmer's consumeTag(obj.tag); } else { @@ -235,26 +261,74 @@ export function memoTransact(method: T): (...args: unknown[] }; } -interface Signal { +export const Signals = Symbol('Signals'); + +export function defineSignal(obj: T, key: K, v?: unknown) { + Object.defineProperty(obj, key, { + enumerable: true, + configurable: false, + get(this: T & { [Signals]: Map }) { + const signals = (this[Signals] = this[Signals] || new Map()); + const existing = signals.has(key); + const _signal = entangleSignal(signals, this, key); + if (!existing && v !== undefined) { + _signal.lastValue = v; + } + return _signal.lastValue; + }, + set(this: T & { [Signals]: Map }, value: unknown) { + const signals = (this[Signals] = this[Signals] || new Map()); + let _signal = signals.get(key); + if (!_signal) { + _signal = createSignal(this, key); + signals.set(key, _signal); + } + if (_signal.lastValue !== value) { + _signal.lastValue = value; + addToTransaction(_signal); + } + }, + }); +} + +export interface Signal { + key: string; _debug_base?: string; - _debug_prop?: string; t: boolean; shouldReset: boolean; tag: ReturnType; + '[]': ReturnType | null; + '@length': ReturnType | null; + lastValue: unknown; +} + +export function createArrayTags(obj: T, signal: Signal) { + if (DEPRECATE_COMPUTED_CHAINS) { + signal['[]'] = tagForProperty(obj, '[]'); + signal['@length'] = tagForProperty(obj, 'length'); + } } export function createSignal(obj: T, key: K): Signal { const _signal: Signal = { + key, tag: tagForProperty(obj, key), + t: false, shouldReset: false, + '[]': null, + '@length': null, + lastValue: undefined, }; if (DEBUG) { + // @ts-expect-error + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-base-to-string + const modelName = obj.modelName ?? obj.constructor?.modelName ?? ''; // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-base-to-string - _signal._debug_base = obj.constructor?.name ?? obj.toString?.() ?? 'unknown'; - _signal._debug_prop = key; + const className = obj.constructor?.name ?? obj.toString?.() ?? 'unknown'; + _signal._debug_base = `${className}${modelName ? `:${modelName}` : ''}`; } return _signal; @@ -264,11 +338,34 @@ export function entangleSignal( signals: Map, obj: T, key: K -): void { - let signal = signals.get(key); - if (!signal) { - signal = createSignal(obj, key); - signals.set(key, signal); +): Signal { + let _signal = signals.get(key); + if (!_signal) { + _signal = createSignal(obj, key); + signals.set(key, _signal); + } + subscribe(_signal); + return _signal; +} + +interface Signaler { + [Signals]: Map; +} + +export function getSignal(obj: T, key: K, initialState: boolean): Signal { + const signals = ((obj as Signaler)[Signals] = (obj as Signaler)[Signals] || new Map()); + let _signal = signals.get(key); + if (!_signal) { + _signal = createSignal(obj, key); + _signal.shouldReset = initialState; + signals.set(key, _signal); + } + return _signal; +} + +export function peekSignal(obj: T, key: K): Signal | undefined { + const signals = (obj as Signaler)[Signals]; + if (signals) { + return signals.get(key); } - subscribe(signal); } diff --git a/packages/tracking/src/index.ts b/packages/tracking/src/index.ts index ec6db514704..ea3605d8d92 100644 --- a/packages/tracking/src/index.ts +++ b/packages/tracking/src/index.ts @@ -1 +1,42 @@ -export { transact, memoTransact, untracked, entangleSignal } from './-private'; +import { assert } from '@ember/debug'; +import { createCache, getValue } from '@glimmer/tracking/primitives/cache'; + +export { transact, memoTransact, untracked } from './-private'; + +// temporary so we can remove the glimmer and ember imports elsewhere +// eslint-disable-next-line no-restricted-imports +export { dependentKeyCompat as compat } from '@ember/object/compat'; + +export function cached( + target: T, + key: K, + descriptor: PropertyDescriptor +) { + // Error on `@cached()`, `@cached(...args)`, and `@cached propName = value;` + assert( + 'You attempted to use @cached(), which is not necessary nor supported. Remove the parentheses and you will be good to go!', + target !== undefined + ); + assert( + `You attempted to use @cached on with ${arguments.length > 1 ? 'arguments' : 'an argument'} ( @cached(${Array.from( + arguments + ) + .map((d) => `'${d}'`) + .join( + ', ' + )}), which is not supported. Dependencies are automatically tracked, so you can just use ${'`@cached`'}`, + typeof target === 'object' && typeof key === 'string' && typeof descriptor === 'object' && arguments.length === 3 + ); + assert( + `The @cached decorator must be applied to getters. '${key}' is not a getter.`, + typeof descriptor.get === 'function' + ); + + const caches = new WeakMap(); + // eslint-disable-next-line @typescript-eslint/unbound-method + const getter = descriptor.get; + descriptor.get = function () { + if (!caches.has(this)) caches.set(this, createCache(getter.bind(this))); + return getValue(caches.get(this) as Parameters[0]); + }; +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 21d11440658..02fa193d742 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -190,7 +190,7 @@ importers: version: file:packages/legacy-compat(@babel/core@7.23.0)(@ember-data/graph@5.5.0-alpha.10)(@ember-data/json-api@5.5.0-alpha.10)(@ember-data/request@5.5.0-alpha.10) '@ember-data/model': specifier: workspace:5.5.0-alpha.10 - version: file:packages/model(@babel/core@7.23.0)(@ember-data/debug@5.5.0-alpha.10)(@ember-data/graph@5.5.0-alpha.10)(@ember-data/json-api@5.5.0-alpha.10)(@ember-data/legacy-compat@5.5.0-alpha.10)(@ember-data/store@5.5.0-alpha.10)(@ember-data/tracking@5.5.0-alpha.10)(@ember/string@3.1.1)(ember-inflector@4.0.2)(ember-source@5.3.0) + version: file:packages/model(@babel/core@7.23.0)(@ember-data/debug@5.5.0-alpha.10)(@ember-data/graph@5.5.0-alpha.10)(@ember-data/json-api@5.5.0-alpha.10)(@ember-data/legacy-compat@5.5.0-alpha.10)(@ember-data/store@5.5.0-alpha.10)(@ember-data/tracking@5.5.0-alpha.10)(@ember/string@3.1.1)(ember-inflector@4.0.2) '@ember-data/private-build-infra': specifier: workspace:5.5.0-alpha.10 version: file:packages/private-build-infra @@ -205,10 +205,10 @@ importers: version: file:packages/serializer(@babel/core@7.23.0)(@ember/string@3.1.1)(ember-inflector@4.0.2) '@ember-data/store': specifier: workspace:5.5.0-alpha.10 - version: file:packages/store(@babel/core@7.23.0)(@ember-data/tracking@5.5.0-alpha.10)(@ember/string@3.1.1)(@glimmer/tracking@1.1.2)(ember-source@5.3.0) + version: file:packages/store(@babel/core@7.23.0)(@ember-data/tracking@5.5.0-alpha.10)(@ember/string@3.1.1)(@glimmer/tracking@1.1.2) '@ember-data/tracking': specifier: workspace:5.5.0-alpha.10 - version: file:packages/tracking(@babel/core@7.23.0) + version: file:packages/tracking(@babel/core@7.23.0)(ember-source@5.3.0) '@ember/edition-utils': specifier: ^1.2.0 version: 1.2.0 @@ -762,9 +762,6 @@ importers: '@embroider/macros': specifier: ^1.12.2 version: 1.13.1(@babel/core@7.23.0) - ember-cached-decorator-polyfill: - specifier: ^1.0.2 - version: 1.0.2(@babel/core@7.23.0)(ember-source@5.3.0) ember-cli-babel: specifier: ^8.1.0 version: 8.1.0(@babel/core@7.23.0) @@ -839,10 +836,18 @@ importers: specifier: ^5.88.2 version: 5.88.2 dependenciesMeta: + '@ember-data/graph': + injected: true + '@ember-data/json-api': + injected: true + '@ember-data/legacy-compat': + injected: true '@ember-data/private-build-infra': injected: true '@ember-data/store': injected: true + '@ember-data/tracking': + injected: true '@ember/string': injected: true @@ -1271,12 +1276,6 @@ importers: '@embroider/macros': specifier: ^1.12.2 version: 1.13.1(@babel/core@7.23.0) - '@glimmer/validator': - specifier: ^0.84.3 - version: 0.84.3 - ember-cached-decorator-polyfill: - specifier: ^1.0.2 - version: 1.0.2(@babel/core@7.23.0)(ember-source@5.3.0) ember-cli-babel: specifier: ^8.1.0 version: 8.1.0(@babel/core@7.23.0) @@ -1358,6 +1357,9 @@ importers: '@glimmer/validator': specifier: ^0.84.3 version: 0.84.3 + ember-cached-decorator-polyfill: + specifier: ^1.0.2 + version: 1.0.2(@babel/core@7.23.0)(ember-source@5.3.0) ember-cli-babel: specifier: ^8.1.0 version: 8.1.0(@babel/core@7.23.0) @@ -1395,12 +1397,18 @@ importers: '@embroider/addon-dev': specifier: ^4.1.1 version: 4.1.1(rollup@3.29.4) + '@glimmer/component': + specifier: ^1.1.2 + version: 1.1.2(@babel/core@7.23.0) '@rollup/plugin-babel': specifier: ^6.0.3 version: 6.0.3(@babel/core@7.23.0)(rollup@3.29.4) '@rollup/plugin-node-resolve': specifier: ^15.2.1 version: 15.2.1(rollup@3.29.4) + ember-source: + specifier: ~5.3.0 + version: 5.3.0(@babel/core@7.23.0)(@glimmer/component@1.1.2)(webpack@5.88.2) rollup: specifier: ^3.29.4 version: 3.29.4 @@ -1550,7 +1558,7 @@ importers: version: file:packages/legacy-compat(@babel/core@7.23.0)(@ember-data/graph@5.5.0-alpha.10)(@ember-data/json-api@5.5.0-alpha.10)(@ember-data/request@5.5.0-alpha.10) '@ember-data/model': specifier: workspace:5.5.0-alpha.10 - version: file:packages/model(@babel/core@7.23.0)(@ember-data/debug@5.5.0-alpha.10)(@ember-data/graph@5.5.0-alpha.10)(@ember-data/json-api@5.5.0-alpha.10)(@ember-data/legacy-compat@5.5.0-alpha.10)(@ember-data/store@5.5.0-alpha.10)(@ember-data/tracking@5.5.0-alpha.10)(@ember/string@3.1.1)(ember-inflector@4.0.2)(ember-source@5.3.0) + version: file:packages/model(@babel/core@7.23.0)(@ember-data/debug@5.5.0-alpha.10)(@ember-data/graph@5.5.0-alpha.10)(@ember-data/json-api@5.5.0-alpha.10)(@ember-data/legacy-compat@5.5.0-alpha.10)(@ember-data/store@5.5.0-alpha.10)(@ember-data/tracking@5.5.0-alpha.10)(@ember/string@3.1.1)(ember-inflector@4.0.2) '@ember-data/request': specifier: workspace:5.5.0-alpha.10 version: file:packages/request(@babel/core@7.23.0) @@ -1562,10 +1570,10 @@ importers: version: file:packages/serializer(@babel/core@7.23.0)(@ember/string@3.1.1)(ember-inflector@4.0.2) '@ember-data/store': specifier: workspace:5.5.0-alpha.10 - version: file:packages/store(@babel/core@7.23.0)(@ember-data/tracking@5.5.0-alpha.10)(@ember/string@3.1.1)(@glimmer/tracking@1.1.2)(ember-source@5.3.0) + version: file:packages/store(@babel/core@7.23.0)(@ember-data/tracking@5.5.0-alpha.10)(@ember/string@3.1.1)(@glimmer/tracking@1.1.2) '@ember-data/tracking': specifier: workspace:5.5.0-alpha.10 - version: file:packages/tracking(@babel/core@7.23.0) + version: file:packages/tracking(@babel/core@7.23.0)(ember-source@5.3.0) '@ember-data/unpublished-test-infra': specifier: workspace:5.5.0-alpha.10 version: file:packages/unpublished-test-infra(@babel/core@7.23.0) @@ -1675,7 +1683,7 @@ importers: version: link:../../packages/legacy-compat '@ember-data/model': specifier: workspace:5.5.0-alpha.10 - version: file:packages/model(@babel/core@7.23.0)(@ember-data/legacy-compat@packages+legacy-compat)(@ember-data/store@packages+store)(@ember-data/tracking@packages+tracking)(@ember/string@3.1.1)(ember-inflector@4.0.2)(ember-source@5.3.0) + version: file:packages/model(@babel/core@7.23.0)(@ember-data/legacy-compat@packages+legacy-compat)(@ember-data/store@packages+store)(@ember-data/tracking@packages+tracking)(@ember/string@3.1.1)(ember-inflector@4.0.2) '@ember-data/private-build-infra': specifier: workspace:5.5.0-alpha.10 version: file:packages/private-build-infra @@ -1749,7 +1757,7 @@ importers: version: file:packages/legacy-compat(@babel/core@7.23.0)(@ember-data/graph@packages+graph)(@ember-data/json-api@5.5.0-alpha.10)(@ember-data/request@5.5.0-alpha.10) '@ember-data/model': specifier: workspace:5.5.0-alpha.10 - version: file:packages/model(@babel/core@7.23.0)(@ember-data/graph@packages+graph)(@ember-data/json-api@5.5.0-alpha.10)(@ember-data/legacy-compat@5.5.0-alpha.10)(@ember-data/store@5.5.0-alpha.10)(@ember-data/tracking@packages+tracking)(@ember/string@3.1.1)(ember-inflector@4.0.2)(ember-source@5.3.0) + version: file:packages/model(@babel/core@7.23.0)(@ember-data/graph@packages+graph)(@ember-data/json-api@5.5.0-alpha.10)(@ember-data/legacy-compat@5.5.0-alpha.10)(@ember-data/store@5.5.0-alpha.10)(@ember-data/tracking@packages+tracking)(@ember/string@3.1.1)(ember-inflector@4.0.2) '@ember-data/private-build-infra': specifier: workspace:5.5.0-alpha.10 version: file:packages/private-build-infra @@ -1764,7 +1772,7 @@ importers: version: file:packages/rest(@babel/core@7.23.0)(@ember-data/store@5.5.0-alpha.10)(@ember/string@3.1.1)(ember-inflector@4.0.2) '@ember-data/store': specifier: workspace:5.5.0-alpha.10 - version: file:packages/store(@babel/core@7.23.0)(@ember-data/tracking@packages+tracking)(@ember/string@3.1.1)(@glimmer/tracking@1.1.2)(ember-source@5.3.0) + version: file:packages/store(@babel/core@7.23.0)(@ember-data/tracking@packages+tracking)(@ember/string@3.1.1)(@glimmer/tracking@1.1.2) '@ember-data/tracking': specifier: workspace:5.5.0-alpha.10 version: link:../../packages/tracking @@ -1893,16 +1901,16 @@ importers: version: link:../../packages/legacy-compat '@ember-data/model': specifier: workspace:5.5.0-alpha.10 - version: file:packages/model(@babel/core@7.23.0)(@ember-data/legacy-compat@packages+legacy-compat)(@ember-data/store@5.5.0-alpha.10)(@ember-data/tracking@5.5.0-alpha.10)(@ember/string@3.1.1)(ember-inflector@4.0.2)(ember-source@5.3.0) + version: file:packages/model(@babel/core@7.23.0)(@ember-data/legacy-compat@packages+legacy-compat)(@ember-data/store@5.5.0-alpha.10)(@ember-data/tracking@5.5.0-alpha.10)(@ember/string@3.1.1)(ember-inflector@4.0.2) '@ember-data/serializer': specifier: workspace:5.5.0-alpha.10 version: file:packages/serializer(@babel/core@7.23.0)(@ember/string@3.1.1)(ember-inflector@4.0.2) '@ember-data/store': specifier: workspace:5.5.0-alpha.10 - version: file:packages/store(@babel/core@7.23.0)(@ember-data/tracking@5.5.0-alpha.10)(@ember/string@3.1.1)(@glimmer/tracking@1.1.2)(ember-source@5.3.0) + version: file:packages/store(@babel/core@7.23.0)(@ember-data/tracking@5.5.0-alpha.10)(@ember/string@3.1.1)(@glimmer/tracking@1.1.2) '@ember-data/tracking': specifier: workspace:5.5.0-alpha.10 - version: file:packages/tracking(@babel/core@7.23.0) + version: file:packages/tracking(@babel/core@7.23.0)(ember-source@5.3.0) '@ember-data/unpublished-test-infra': specifier: workspace:5.5.0-alpha.10 version: file:packages/unpublished-test-infra(@babel/core@7.23.0) @@ -2310,7 +2318,7 @@ importers: version: file:packages/legacy-compat(@babel/core@7.23.0)(@ember-data/graph@5.5.0-alpha.10)(@ember-data/json-api@5.5.0-alpha.10)(@ember-data/request@5.5.0-alpha.10) '@ember-data/model': specifier: workspace:5.5.0-alpha.10 - version: file:packages/model(@babel/core@7.23.0)(@ember-data/debug@5.5.0-alpha.10)(@ember-data/graph@5.5.0-alpha.10)(@ember-data/json-api@5.5.0-alpha.10)(@ember-data/legacy-compat@5.5.0-alpha.10)(@ember-data/store@5.5.0-alpha.10)(@ember-data/tracking@5.5.0-alpha.10)(@ember/string@3.1.1)(ember-inflector@4.0.2)(ember-source@5.3.0) + version: file:packages/model(@babel/core@7.23.0)(@ember-data/debug@5.5.0-alpha.10)(@ember-data/graph@5.5.0-alpha.10)(@ember-data/json-api@5.5.0-alpha.10)(@ember-data/legacy-compat@5.5.0-alpha.10)(@ember-data/store@5.5.0-alpha.10)(@ember-data/tracking@5.5.0-alpha.10)(@ember/string@3.1.1)(ember-inflector@4.0.2) '@ember-data/private-build-infra': specifier: workspace:5.5.0-alpha.10 version: file:packages/private-build-infra @@ -2322,10 +2330,10 @@ importers: version: file:packages/request-utils(@babel/core@7.23.0) '@ember-data/store': specifier: workspace:5.5.0-alpha.10 - version: file:packages/store(@babel/core@7.23.0)(@ember-data/tracking@5.5.0-alpha.10)(@ember/string@3.1.1)(@glimmer/tracking@1.1.2)(ember-source@5.3.0) + version: file:packages/store(@babel/core@7.23.0)(@ember-data/tracking@5.5.0-alpha.10)(@ember/string@3.1.1)(@glimmer/tracking@1.1.2) '@ember-data/tracking': specifier: workspace:5.5.0-alpha.10 - version: file:packages/tracking(@babel/core@7.23.0) + version: file:packages/tracking(@babel/core@7.23.0)(ember-source@5.3.0) '@ember-data/unpublished-test-infra': specifier: workspace:5.5.0-alpha.10 version: file:packages/unpublished-test-infra(@babel/core@7.23.0) @@ -2475,10 +2483,10 @@ importers: version: file:packages/request-utils(@babel/core@7.23.0) '@ember-data/store': specifier: workspace:5.5.0-alpha.10 - version: file:packages/store(@babel/core@7.23.0)(@ember-data/tracking@5.5.0-alpha.10)(@ember/string@3.1.1)(@glimmer/tracking@1.1.2)(ember-source@5.3.0) + version: file:packages/store(@babel/core@7.23.0)(@ember-data/tracking@5.5.0-alpha.10)(@ember/string@3.1.1)(@glimmer/tracking@1.1.2) '@ember-data/tracking': specifier: workspace:5.5.0-alpha.10 - version: file:packages/tracking(@babel/core@7.23.0) + version: file:packages/tracking(@babel/core@7.23.0)(ember-source@5.3.0) '@ember-data/unpublished-test-infra': specifier: workspace:5.5.0-alpha.10 version: file:packages/unpublished-test-infra(@babel/core@7.23.0) @@ -2616,7 +2624,7 @@ importers: version: file:packages/legacy-compat(@babel/core@7.23.0)(@ember-data/graph@packages+graph)(@ember-data/json-api@5.5.0-alpha.10)(@ember-data/request@5.5.0-alpha.10) '@ember-data/model': specifier: workspace:5.5.0-alpha.10 - version: file:packages/model(@babel/core@7.23.0)(@ember-data/debug@5.5.0-alpha.10)(@ember-data/legacy-compat@5.5.0-alpha.10)(@ember-data/store@5.5.0-alpha.10)(@ember-data/tracking@5.5.0-alpha.10)(@ember/string@3.1.1)(ember-inflector@4.0.2)(ember-source@5.3.0) + version: file:packages/model(@babel/core@7.23.0)(@ember-data/debug@5.5.0-alpha.10)(@ember-data/legacy-compat@5.5.0-alpha.10)(@ember-data/store@5.5.0-alpha.10)(@ember-data/tracking@5.5.0-alpha.10)(@ember/string@3.1.1)(ember-inflector@4.0.2) '@ember-data/request': specifier: workspace:5.5.0-alpha.10 version: file:packages/request(@babel/core@7.23.0) @@ -2625,10 +2633,10 @@ importers: version: file:packages/serializer(@babel/core@7.23.0)(@ember/string@3.1.1)(ember-inflector@4.0.2) '@ember-data/store': specifier: workspace:5.5.0-alpha.10 - version: file:packages/store(@babel/core@7.23.0)(@ember-data/tracking@5.5.0-alpha.10)(@ember/string@3.1.1)(@glimmer/tracking@1.1.2)(ember-source@5.3.0) + version: file:packages/store(@babel/core@7.23.0)(@ember-data/tracking@5.5.0-alpha.10)(@ember/string@3.1.1)(@glimmer/tracking@1.1.2) '@ember-data/tracking': specifier: workspace:5.5.0-alpha.10 - version: file:packages/tracking(@babel/core@7.23.0) + version: file:packages/tracking(@babel/core@7.23.0)(ember-source@5.3.0) '@ember-data/unpublished-test-infra': specifier: workspace:5.5.0-alpha.10 version: file:packages/unpublished-test-infra(@babel/core@7.23.0) @@ -2929,10 +2937,10 @@ importers: version: file:packages/serializer(@babel/core@7.23.0)(@ember/string@3.1.1)(ember-inflector@4.0.2) '@ember-data/store': specifier: workspace:5.5.0-alpha.10 - version: file:packages/store(@babel/core@7.23.0)(@ember-data/tracking@5.5.0-alpha.10)(@ember/string@3.1.1)(@glimmer/tracking@1.1.2)(ember-source@5.3.0) + version: file:packages/store(@babel/core@7.23.0)(@ember-data/tracking@5.5.0-alpha.10)(@ember/string@3.1.1)(@glimmer/tracking@1.1.2) '@ember-data/tracking': specifier: workspace:5.5.0-alpha.10 - version: file:packages/tracking(@babel/core@7.23.0) + version: file:packages/tracking(@babel/core@7.23.0)(ember-source@5.3.0) '@ember-data/unpublished-test-infra': specifier: workspace:5.5.0-alpha.10 version: file:packages/unpublished-test-infra(@babel/core@7.23.0) @@ -3123,7 +3131,7 @@ importers: version: file:packages/legacy-compat(@babel/core@7.23.0)(@ember-data/graph@5.5.0-alpha.10)(@ember-data/json-api@5.5.0-alpha.10)(@ember-data/request@5.5.0-alpha.10) '@ember-data/model': specifier: workspace:5.5.0-alpha.10 - version: file:packages/model(@babel/core@7.23.0)(@ember-data/debug@5.5.0-alpha.10)(@ember-data/graph@5.5.0-alpha.10)(@ember-data/json-api@5.5.0-alpha.10)(@ember-data/legacy-compat@5.5.0-alpha.10)(@ember-data/store@5.5.0-alpha.10)(@ember-data/tracking@5.5.0-alpha.10)(@ember/string@3.1.1)(ember-inflector@4.0.2)(ember-source@5.3.0) + version: file:packages/model(@babel/core@7.23.0)(@ember-data/debug@5.5.0-alpha.10)(@ember-data/graph@5.5.0-alpha.10)(@ember-data/json-api@5.5.0-alpha.10)(@ember-data/legacy-compat@5.5.0-alpha.10)(@ember-data/store@5.5.0-alpha.10)(@ember-data/tracking@5.5.0-alpha.10)(@ember/string@3.1.1)(ember-inflector@4.0.2) '@ember-data/private-build-infra': specifier: workspace:5.5.0-alpha.10 version: file:packages/private-build-infra @@ -3135,10 +3143,10 @@ importers: version: file:packages/request-utils(@babel/core@7.23.0) '@ember-data/store': specifier: workspace:5.5.0-alpha.10 - version: file:packages/store(@babel/core@7.23.0)(@ember-data/tracking@5.5.0-alpha.10)(@ember/string@3.1.1)(@glimmer/tracking@1.1.2)(ember-source@5.3.0) + version: file:packages/store(@babel/core@7.23.0)(@ember-data/tracking@5.5.0-alpha.10)(@ember/string@3.1.1)(@glimmer/tracking@1.1.2) '@ember-data/tracking': specifier: workspace:5.5.0-alpha.10 - version: file:packages/tracking(@babel/core@7.23.0) + version: file:packages/tracking(@babel/core@7.23.0)(ember-source@5.3.0) '@ember-data/unpublished-test-infra': specifier: workspace:5.5.0-alpha.10 version: file:packages/unpublished-test-infra(@babel/core@7.23.0) @@ -3444,10 +3452,10 @@ importers: version: link:../../packages/request-utils '@ember-data/store': specifier: workspace:5.5.0-alpha.10 - version: file:packages/store(@babel/core@7.23.0)(@ember-data/tracking@5.5.0-alpha.10)(@ember/string@3.1.1)(@glimmer/tracking@1.1.2)(ember-source@5.3.0) + version: file:packages/store(@babel/core@7.23.0)(@ember-data/tracking@5.5.0-alpha.10)(@ember/string@3.1.1)(@glimmer/tracking@1.1.2) '@ember-data/tracking': specifier: workspace:5.5.0-alpha.10 - version: file:packages/tracking(@babel/core@7.23.0) + version: file:packages/tracking(@babel/core@7.23.0)(ember-source@5.3.0) '@ember-data/unpublished-test-infra': specifier: workspace:5.5.0-alpha.10 version: link:../../packages/unpublished-test-infra @@ -3574,7 +3582,7 @@ importers: version: file:packages/legacy-compat(@babel/core@7.23.0)(@ember-data/graph@5.5.0-alpha.10)(@ember-data/json-api@5.5.0-alpha.10)(@ember-data/request@5.5.0-alpha.10) '@ember-data/model': specifier: workspace:5.5.0-alpha.10 - version: file:packages/model(@babel/core@7.23.0)(@ember-data/debug@5.5.0-alpha.10)(@ember-data/graph@5.5.0-alpha.10)(@ember-data/json-api@5.5.0-alpha.10)(@ember-data/legacy-compat@5.5.0-alpha.10)(@ember-data/store@5.5.0-alpha.10)(@ember-data/tracking@5.5.0-alpha.10)(@ember/string@3.1.1)(ember-inflector@4.0.2)(ember-source@5.3.0) + version: file:packages/model(@babel/core@7.23.0)(@ember-data/debug@5.5.0-alpha.10)(@ember-data/graph@5.5.0-alpha.10)(@ember-data/json-api@5.5.0-alpha.10)(@ember-data/legacy-compat@5.5.0-alpha.10)(@ember-data/store@5.5.0-alpha.10)(@ember-data/tracking@5.5.0-alpha.10)(@ember/string@3.1.1)(ember-inflector@4.0.2) '@ember-data/request': specifier: workspace:5.5.0-alpha.10 version: file:packages/request(@babel/core@7.23.0) @@ -3583,10 +3591,10 @@ importers: version: file:packages/request-utils(@babel/core@7.23.0) '@ember-data/store': specifier: workspace:5.5.0-alpha.10 - version: file:packages/store(@babel/core@7.23.0)(@ember-data/tracking@5.5.0-alpha.10)(@ember/string@3.1.1)(@glimmer/tracking@1.1.2)(ember-source@5.3.0) + version: file:packages/store(@babel/core@7.23.0)(@ember-data/tracking@5.5.0-alpha.10)(@ember/string@3.1.1)(@glimmer/tracking@1.1.2) '@ember-data/tracking': specifier: workspace:5.5.0-alpha.10 - version: file:packages/tracking(@babel/core@7.23.0) + version: file:packages/tracking(@babel/core@7.23.0)(ember-source@5.3.0) '@ember-data/unpublished-test-infra': specifier: workspace:5.5.0-alpha.10 version: file:packages/unpublished-test-infra(@babel/core@7.23.0) @@ -3762,6 +3770,15 @@ packages: semver: 6.3.1 dev: true + /@babel/generator@7.22.15: + resolution: {integrity: sha512-Zu9oWARBqeVOW0dZOjXc3JObrzuqothQ3y/n1kUtrjCoCPLkXUwMvOo/F/TCfoHMbWIFlWwpZtkZVb9ga4U2pA==} + engines: {node: '>=6.9.0'} + dependencies: + '@babel/types': 7.22.19 + '@jridgewell/gen-mapping': 0.3.3 + '@jridgewell/trace-mapping': 0.3.19 + jsesc: 2.5.2 + /@babel/generator@7.23.0: resolution: {integrity: sha512-lN85QRR+5IbYrMWM6Y4pE/noaQtg4pNiqeNGX60eqOfo6gtEj6uw/JagelB8vVztSd7R6M5n1+PQkDbHbBRU4g==} engines: {node: '>=6.9.0'} @@ -4017,6 +4034,13 @@ packages: chalk: 2.4.2 js-tokens: 4.0.0 + /@babel/parser@7.22.16: + resolution: {integrity: sha512-+gPfKv8UWeKKeJTUxe59+OobVcrYHETCsORl61EmSkmgymguYk/X5bp7GuUIXaFsc6y++v8ZxPsLSSuujqDphA==} + engines: {node: '>=6.0.0'} + hasBin: true + dependencies: + '@babel/types': 7.22.19 + /@babel/parser@7.23.0: resolution: {integrity: sha512-vvPKKdMemU85V9WE/l5wZEmImpCtLqbnTvqDS2U1fJ96KrxoW7KrXhNsNCblQlg8Ck4b85yxdTyelsMUgFUXiw==} engines: {node: '>=6.0.0'} @@ -5035,8 +5059,25 @@ packages: engines: {node: '>=6.9.0'} dependencies: '@babel/code-frame': 7.22.13 - '@babel/parser': 7.23.0 + '@babel/parser': 7.22.16 + '@babel/types': 7.22.19 + + /@babel/traverse@7.22.20: + resolution: {integrity: sha512-eU260mPZbU7mZ0N+X10pxXhQFMGTeLb9eFS0mxehS8HZp9o1uSnFeWQuG1UPrlxgA7QoUzFhOnilHDp0AXCyHw==} + engines: {node: '>=6.9.0'} + dependencies: + '@babel/code-frame': 7.22.13 + '@babel/generator': 7.22.15 + '@babel/helper-environment-visitor': 7.22.20 + '@babel/helper-function-name': 7.22.5 + '@babel/helper-hoist-variables': 7.22.5 + '@babel/helper-split-export-declaration': 7.22.6 + '@babel/parser': 7.22.16 '@babel/types': 7.22.19 + debug: 4.3.4(supports-color@8.1.1) + globals: 11.12.0 + transitivePeerDependencies: + - supports-color /@babel/traverse@7.23.0(supports-color@8.1.1): resolution: {integrity: sha512-t/QaEvyIoIkwzpiZ7aoSKK8kObQYeF7T2v+dazAYCb8SXtp58zEVkWW7zAnju8FNKNdr4ScAOEDmMItbyOmEYw==} @@ -10320,8 +10361,8 @@ packages: resolution: {integrity: sha512-89oVHVJwmLDvGvAUWgS87KpBoRhy3aZ6U0Ql6HOmU4TrPkyaa8pM0W81wj9cIwjYprcQtN9EwzZMHnq46+oUyw==} engines: {node: 8.* || 10.* || >= 12} dependencies: - '@babel/parser': 7.23.0 - '@babel/traverse': 7.23.0(supports-color@8.1.1) + '@babel/parser': 7.22.16 + '@babel/traverse': 7.22.20 recast: 0.18.10 transitivePeerDependencies: - supports-color @@ -17373,13 +17414,13 @@ packages: '@ember-data/graph': file:packages/graph(@babel/core@7.23.0)(@ember-data/store@5.5.0-alpha.10) '@ember-data/json-api': file:packages/json-api(@babel/core@7.23.0)(@ember-data/graph@5.5.0-alpha.10)(@ember-data/request-utils@5.5.0-alpha.10)(@ember-data/store@5.5.0-alpha.10)(ember-inflector@4.0.2) '@ember-data/legacy-compat': file:packages/legacy-compat(@babel/core@7.23.0)(@ember-data/graph@5.5.0-alpha.10)(@ember-data/json-api@5.5.0-alpha.10)(@ember-data/request@5.5.0-alpha.10) - '@ember-data/model': file:packages/model(@babel/core@7.23.0)(@ember-data/debug@5.5.0-alpha.10)(@ember-data/graph@5.5.0-alpha.10)(@ember-data/json-api@5.5.0-alpha.10)(@ember-data/legacy-compat@5.5.0-alpha.10)(@ember-data/store@5.5.0-alpha.10)(@ember-data/tracking@5.5.0-alpha.10)(@ember/string@3.1.1)(ember-inflector@4.0.2)(ember-source@5.3.0) + '@ember-data/model': file:packages/model(@babel/core@7.23.0)(@ember-data/debug@5.5.0-alpha.10)(@ember-data/graph@5.5.0-alpha.10)(@ember-data/json-api@5.5.0-alpha.10)(@ember-data/legacy-compat@5.5.0-alpha.10)(@ember-data/store@5.5.0-alpha.10)(@ember-data/tracking@5.5.0-alpha.10)(@ember/string@3.1.1)(ember-inflector@4.0.2) '@ember-data/private-build-infra': file:packages/private-build-infra '@ember-data/request': file:packages/request(@babel/core@7.23.0) '@ember-data/request-utils': file:packages/request-utils(@babel/core@7.23.0) '@ember-data/serializer': file:packages/serializer(@babel/core@7.23.0)(@ember/string@3.1.1)(ember-inflector@4.0.2) - '@ember-data/store': file:packages/store(@babel/core@7.23.0)(@ember-data/tracking@5.5.0-alpha.10)(@ember/string@3.1.1)(@glimmer/tracking@1.1.2)(ember-source@5.3.0) - '@ember-data/tracking': file:packages/tracking(@babel/core@7.23.0) + '@ember-data/store': file:packages/store(@babel/core@7.23.0)(@ember-data/tracking@5.5.0-alpha.10)(@ember/string@3.1.1)(@glimmer/tracking@1.1.2) + '@ember-data/tracking': file:packages/tracking(@babel/core@7.23.0)(ember-source@5.3.0) '@ember/edition-utils': 1.2.0 '@ember/string': 3.1.1(@babel/core@7.23.0) '@embroider/macros': 1.13.1(@babel/core@7.23.0) @@ -17409,7 +17450,7 @@ packages: '@ember/string': 3.1.1 ember-inflector: ^4.0.2 dependencies: - '@ember-data/store': file:packages/store(@babel/core@7.23.0)(@ember-data/tracking@packages+tracking)(@ember/string@3.1.1)(@glimmer/tracking@1.1.2)(ember-source@5.3.0) + '@ember-data/store': file:packages/store(@babel/core@7.23.0)(@ember-data/tracking@packages+tracking)(@ember/string@3.1.1)(@glimmer/tracking@1.1.2) '@ember/string': 3.1.1(@babel/core@7.23.0) ember-cli-babel: 8.1.0(@babel/core@7.23.0) ember-inflector: 4.0.2(@babel/core@7.23.0) @@ -17429,7 +17470,7 @@ packages: ember-inflector: ^4.0.2 dependencies: '@ember-data/private-build-infra': file:packages/private-build-infra - '@ember-data/store': file:packages/store(@babel/core@7.23.0)(@ember-data/tracking@5.5.0-alpha.10)(@ember/string@3.1.1)(@glimmer/tracking@1.1.2)(ember-source@5.3.0) + '@ember-data/store': file:packages/store(@babel/core@7.23.0)(@ember-data/tracking@5.5.0-alpha.10)(@ember/string@3.1.1)(@glimmer/tracking@1.1.2) '@ember/string': 3.1.1(@babel/core@7.23.0) '@embroider/macros': 1.13.1(@babel/core@7.23.0) ember-cli-babel: 8.1.0(@babel/core@7.23.0) @@ -17474,7 +17515,7 @@ packages: dependencies: '@babel/core': 7.23.0(supports-color@8.1.1) '@ember-data/private-build-infra': file:packages/private-build-infra - '@ember-data/store': file:packages/store(@babel/core@7.23.0)(@ember-data/tracking@5.5.0-alpha.10)(@ember/string@3.1.1)(@glimmer/tracking@1.1.2)(ember-source@5.3.0) + '@ember-data/store': file:packages/store(@babel/core@7.23.0)(@ember-data/tracking@5.5.0-alpha.10)(@ember/string@3.1.1)(@glimmer/tracking@1.1.2) '@ember/edition-utils': 1.2.0 '@ember/string': 3.1.1(@babel/core@7.23.0) '@embroider/macros': 1.13.1(@babel/core@7.23.0) @@ -17498,7 +17539,7 @@ packages: '@ember-data/store': workspace:5.5.0-alpha.10 dependencies: '@ember-data/private-build-infra': file:packages/private-build-infra - '@ember-data/store': file:packages/store(@babel/core@7.23.0)(@ember-data/tracking@5.5.0-alpha.10)(@ember/string@3.1.1)(@glimmer/tracking@1.1.2)(ember-source@5.3.0) + '@ember-data/store': file:packages/store(@babel/core@7.23.0)(@ember-data/tracking@5.5.0-alpha.10)(@ember/string@3.1.1)(@glimmer/tracking@1.1.2) '@ember/edition-utils': 1.2.0 '@embroider/macros': 1.13.1(@babel/core@7.23.0) ember-cli-babel: 8.1.0(@babel/core@7.23.0) @@ -17537,7 +17578,7 @@ packages: '@ember-data/graph': file:packages/graph(@babel/core@7.23.0)(@ember-data/store@5.5.0-alpha.10) '@ember-data/private-build-infra': file:packages/private-build-infra '@ember-data/request-utils': file:packages/request-utils(@babel/core@7.23.0) - '@ember-data/store': file:packages/store(@babel/core@7.23.0)(@ember-data/tracking@5.5.0-alpha.10)(@ember/string@3.1.1)(@glimmer/tracking@1.1.2)(ember-source@5.3.0) + '@ember-data/store': file:packages/store(@babel/core@7.23.0)(@ember-data/tracking@5.5.0-alpha.10)(@ember/string@3.1.1)(@glimmer/tracking@1.1.2) '@ember/edition-utils': 1.2.0 '@embroider/macros': 1.13.1(@babel/core@7.23.0) ember-cli-babel: 8.1.0(@babel/core@7.23.0) @@ -17561,7 +17602,7 @@ packages: '@ember-data/graph': file:packages/graph(@babel/core@7.23.0)(@ember-data/store@5.5.0-alpha.10) '@ember-data/private-build-infra': file:packages/private-build-infra '@ember-data/request-utils': link:packages/request-utils - '@ember-data/store': file:packages/store(@babel/core@7.23.0)(@ember-data/tracking@5.5.0-alpha.10)(@ember/string@3.1.1)(@glimmer/tracking@1.1.2)(ember-source@5.3.0) + '@ember-data/store': file:packages/store(@babel/core@7.23.0)(@ember-data/tracking@5.5.0-alpha.10)(@ember/string@3.1.1)(@glimmer/tracking@1.1.2) '@ember/edition-utils': 1.2.0 '@embroider/macros': 1.13.1(@babel/core@7.23.0) ember-cli-babel: 8.1.0(@babel/core@7.23.0) @@ -17586,7 +17627,7 @@ packages: '@ember-data/graph': link:packages/graph '@ember-data/private-build-infra': file:packages/private-build-infra '@ember-data/request-utils': file:packages/request-utils(@babel/core@7.23.0) - '@ember-data/store': file:packages/store(@babel/core@7.23.0)(@ember-data/tracking@packages+tracking)(@ember/string@3.1.1)(@glimmer/tracking@1.1.2)(ember-source@5.3.0) + '@ember-data/store': file:packages/store(@babel/core@7.23.0)(@ember-data/tracking@packages+tracking)(@ember/string@3.1.1)(@glimmer/tracking@1.1.2) '@ember/edition-utils': 1.2.0 '@embroider/macros': 1.13.1(@babel/core@7.23.0) ember-cli-babel: 8.1.0(@babel/core@7.23.0) @@ -17650,7 +17691,7 @@ packages: - supports-color dev: true - file:packages/model(@babel/core@7.23.0)(@ember-data/debug@5.5.0-alpha.10)(@ember-data/graph@5.5.0-alpha.10)(@ember-data/json-api@5.5.0-alpha.10)(@ember-data/legacy-compat@5.5.0-alpha.10)(@ember-data/store@5.5.0-alpha.10)(@ember-data/tracking@5.5.0-alpha.10)(@ember/string@3.1.1)(ember-inflector@4.0.2)(ember-source@5.3.0): + file:packages/model(@babel/core@7.23.0)(@ember-data/debug@5.5.0-alpha.10)(@ember-data/graph@5.5.0-alpha.10)(@ember-data/json-api@5.5.0-alpha.10)(@ember-data/legacy-compat@5.5.0-alpha.10)(@ember-data/store@5.5.0-alpha.10)(@ember-data/tracking@5.5.0-alpha.10)(@ember/string@3.1.1)(ember-inflector@4.0.2): resolution: {directory: packages/model, type: directory} id: file:packages/model name: '@ember-data/model' @@ -17677,12 +17718,11 @@ packages: '@ember-data/json-api': file:packages/json-api(@babel/core@7.23.0)(@ember-data/graph@5.5.0-alpha.10)(@ember-data/request-utils@5.5.0-alpha.10)(@ember-data/store@5.5.0-alpha.10)(ember-inflector@4.0.2) '@ember-data/legacy-compat': file:packages/legacy-compat(@babel/core@7.23.0)(@ember-data/graph@5.5.0-alpha.10)(@ember-data/json-api@5.5.0-alpha.10)(@ember-data/request@5.5.0-alpha.10) '@ember-data/private-build-infra': file:packages/private-build-infra - '@ember-data/store': file:packages/store(@babel/core@7.23.0)(@ember-data/tracking@5.5.0-alpha.10)(@ember/string@3.1.1)(@glimmer/tracking@1.1.2)(ember-source@5.3.0) - '@ember-data/tracking': file:packages/tracking(@babel/core@7.23.0) + '@ember-data/store': file:packages/store(@babel/core@7.23.0)(@ember-data/tracking@5.5.0-alpha.10)(@ember/string@3.1.1)(@glimmer/tracking@1.1.2) + '@ember-data/tracking': file:packages/tracking(@babel/core@7.23.0)(ember-source@5.3.0) '@ember/edition-utils': 1.2.0 '@ember/string': 3.1.1(@babel/core@7.23.0) '@embroider/macros': 1.13.1(@babel/core@7.23.0) - ember-cached-decorator-polyfill: 1.0.2(@babel/core@7.23.0)(ember-source@5.3.0) ember-cli-babel: 8.1.0(@babel/core@7.23.0) ember-cli-string-utils: 1.1.0 ember-cli-test-info: 1.0.0 @@ -17691,10 +17731,9 @@ packages: transitivePeerDependencies: - '@babel/core' - '@glint/template' - - ember-source - supports-color - file:packages/model(@babel/core@7.23.0)(@ember-data/debug@5.5.0-alpha.10)(@ember-data/legacy-compat@5.5.0-alpha.10)(@ember-data/store@5.5.0-alpha.10)(@ember-data/tracking@5.5.0-alpha.10)(@ember/string@3.1.1)(ember-inflector@4.0.2)(ember-source@5.3.0): + file:packages/model(@babel/core@7.23.0)(@ember-data/debug@5.5.0-alpha.10)(@ember-data/legacy-compat@5.5.0-alpha.10)(@ember-data/store@5.5.0-alpha.10)(@ember-data/tracking@5.5.0-alpha.10)(@ember/string@3.1.1)(ember-inflector@4.0.2): resolution: {directory: packages/model, type: directory} id: file:packages/model name: '@ember-data/model' @@ -17719,12 +17758,11 @@ packages: '@ember-data/debug': file:packages/debug(@ember-data/store@5.5.0-alpha.10)(@ember/string@3.1.1) '@ember-data/legacy-compat': file:packages/legacy-compat(@babel/core@7.23.0)(@ember-data/graph@packages+graph)(@ember-data/json-api@5.5.0-alpha.10)(@ember-data/request@5.5.0-alpha.10) '@ember-data/private-build-infra': file:packages/private-build-infra - '@ember-data/store': file:packages/store(@babel/core@7.23.0)(@ember-data/tracking@5.5.0-alpha.10)(@ember/string@3.1.1)(@glimmer/tracking@1.1.2)(ember-source@5.3.0) - '@ember-data/tracking': file:packages/tracking(@babel/core@7.23.0) + '@ember-data/store': file:packages/store(@babel/core@7.23.0)(@ember-data/tracking@5.5.0-alpha.10)(@ember/string@3.1.1)(@glimmer/tracking@1.1.2) + '@ember-data/tracking': file:packages/tracking(@babel/core@7.23.0)(ember-source@5.3.0) '@ember/edition-utils': 1.2.0 '@ember/string': 3.1.1(@babel/core@7.23.0) '@embroider/macros': 1.13.1(@babel/core@7.23.0) - ember-cached-decorator-polyfill: 1.0.2(@babel/core@7.23.0)(ember-source@5.3.0) ember-cli-babel: 8.1.0(@babel/core@7.23.0) ember-cli-string-utils: 1.1.0 ember-cli-test-info: 1.0.0 @@ -17733,11 +17771,10 @@ packages: transitivePeerDependencies: - '@babel/core' - '@glint/template' - - ember-source - supports-color dev: true - file:packages/model(@babel/core@7.23.0)(@ember-data/graph@packages+graph)(@ember-data/json-api@5.5.0-alpha.10)(@ember-data/legacy-compat@5.5.0-alpha.10)(@ember-data/store@5.5.0-alpha.10)(@ember-data/tracking@packages+tracking)(@ember/string@3.1.1)(ember-inflector@4.0.2)(ember-source@5.3.0): + file:packages/model(@babel/core@7.23.0)(@ember-data/graph@packages+graph)(@ember-data/json-api@5.5.0-alpha.10)(@ember-data/legacy-compat@5.5.0-alpha.10)(@ember-data/store@5.5.0-alpha.10)(@ember-data/tracking@packages+tracking)(@ember/string@3.1.1)(ember-inflector@4.0.2): resolution: {directory: packages/model, type: directory} id: file:packages/model name: '@ember-data/model' @@ -17763,12 +17800,11 @@ packages: '@ember-data/json-api': file:packages/json-api(@babel/core@7.23.0)(@ember-data/graph@packages+graph)(@ember-data/request-utils@5.5.0-alpha.10)(@ember-data/store@5.5.0-alpha.10)(ember-inflector@4.0.2) '@ember-data/legacy-compat': file:packages/legacy-compat(@babel/core@7.23.0)(@ember-data/graph@packages+graph)(@ember-data/json-api@5.5.0-alpha.10)(@ember-data/request@5.5.0-alpha.10) '@ember-data/private-build-infra': file:packages/private-build-infra - '@ember-data/store': file:packages/store(@babel/core@7.23.0)(@ember-data/tracking@packages+tracking)(@ember/string@3.1.1)(@glimmer/tracking@1.1.2)(ember-source@5.3.0) + '@ember-data/store': file:packages/store(@babel/core@7.23.0)(@ember-data/tracking@packages+tracking)(@ember/string@3.1.1)(@glimmer/tracking@1.1.2) '@ember-data/tracking': link:packages/tracking '@ember/edition-utils': 1.2.0 '@ember/string': 3.1.1(@babel/core@7.23.0) '@embroider/macros': 1.13.1(@babel/core@7.23.0) - ember-cached-decorator-polyfill: 1.0.2(@babel/core@7.23.0)(ember-source@5.3.0) ember-cli-babel: 8.1.0(@babel/core@7.23.0) ember-cli-string-utils: 1.1.0 ember-cli-test-info: 1.0.0 @@ -17777,11 +17813,10 @@ packages: transitivePeerDependencies: - '@babel/core' - '@glint/template' - - ember-source - supports-color dev: true - file:packages/model(@babel/core@7.23.0)(@ember-data/legacy-compat@packages+legacy-compat)(@ember-data/store@5.5.0-alpha.10)(@ember-data/tracking@5.5.0-alpha.10)(@ember/string@3.1.1)(ember-inflector@4.0.2)(ember-source@5.3.0): + file:packages/model(@babel/core@7.23.0)(@ember-data/legacy-compat@packages+legacy-compat)(@ember-data/store@5.5.0-alpha.10)(@ember-data/tracking@5.5.0-alpha.10)(@ember/string@3.1.1)(ember-inflector@4.0.2): resolution: {directory: packages/model, type: directory} id: file:packages/model name: '@ember-data/model' @@ -17805,12 +17840,11 @@ packages: dependencies: '@ember-data/legacy-compat': link:packages/legacy-compat '@ember-data/private-build-infra': file:packages/private-build-infra - '@ember-data/store': file:packages/store(@babel/core@7.23.0)(@ember-data/tracking@5.5.0-alpha.10)(@ember/string@3.1.1)(@glimmer/tracking@1.1.2)(ember-source@5.3.0) - '@ember-data/tracking': file:packages/tracking(@babel/core@7.23.0) + '@ember-data/store': file:packages/store(@babel/core@7.23.0)(@ember-data/tracking@5.5.0-alpha.10)(@ember/string@3.1.1)(@glimmer/tracking@1.1.2) + '@ember-data/tracking': file:packages/tracking(@babel/core@7.23.0)(ember-source@5.3.0) '@ember/edition-utils': 1.2.0 '@ember/string': 3.1.1(@babel/core@7.23.0) '@embroider/macros': 1.13.1(@babel/core@7.23.0) - ember-cached-decorator-polyfill: 1.0.2(@babel/core@7.23.0)(ember-source@5.3.0) ember-cli-babel: 8.1.0(@babel/core@7.23.0) ember-cli-string-utils: 1.1.0 ember-cli-test-info: 1.0.0 @@ -17819,11 +17853,10 @@ packages: transitivePeerDependencies: - '@babel/core' - '@glint/template' - - ember-source - supports-color dev: true - file:packages/model(@babel/core@7.23.0)(@ember-data/legacy-compat@packages+legacy-compat)(@ember-data/store@packages+store)(@ember-data/tracking@packages+tracking)(@ember/string@3.1.1)(ember-inflector@4.0.2)(ember-source@5.3.0): + file:packages/model(@babel/core@7.23.0)(@ember-data/legacy-compat@packages+legacy-compat)(@ember-data/store@packages+store)(@ember-data/tracking@packages+tracking)(@ember/string@3.1.1)(ember-inflector@4.0.2): resolution: {directory: packages/model, type: directory} id: file:packages/model name: '@ember-data/model' @@ -17852,7 +17885,6 @@ packages: '@ember/edition-utils': 1.2.0 '@ember/string': 3.1.1(@babel/core@7.23.0) '@embroider/macros': 1.13.1(@babel/core@7.23.0) - ember-cached-decorator-polyfill: 1.0.2(@babel/core@7.23.0)(ember-source@5.3.0) ember-cli-babel: 8.1.0(@babel/core@7.23.0) ember-cli-string-utils: 1.1.0 ember-cli-test-info: 1.0.0 @@ -17861,7 +17893,6 @@ packages: transitivePeerDependencies: - '@babel/core' - '@glint/template' - - ember-source - supports-color dev: true @@ -17932,7 +17963,7 @@ packages: '@ember/string': 3.1.1 ember-inflector: ^4.0.2 dependencies: - '@ember-data/store': file:packages/store(@babel/core@7.23.0)(@ember-data/tracking@packages+tracking)(@ember/string@3.1.1)(@glimmer/tracking@1.1.2)(ember-source@5.3.0) + '@ember-data/store': file:packages/store(@babel/core@7.23.0)(@ember-data/tracking@packages+tracking)(@ember/string@3.1.1)(@glimmer/tracking@1.1.2) '@ember/string': 3.1.1(@babel/core@7.23.0) ember-cli-babel: 8.1.0(@babel/core@7.23.0) ember-inflector: 4.0.2(@babel/core@7.23.0) @@ -17977,7 +18008,7 @@ packages: - '@glint/template' - supports-color - file:packages/store(@babel/core@7.23.0)(@ember-data/tracking@5.5.0-alpha.10)(@ember/string@3.1.1)(@glimmer/tracking@1.1.2)(ember-source@5.3.0): + file:packages/store(@babel/core@7.23.0)(@ember-data/tracking@5.5.0-alpha.10)(@ember/string@3.1.1)(@glimmer/tracking@1.1.2): resolution: {directory: packages/store, type: directory} id: file:packages/store name: '@ember-data/store' @@ -17988,20 +18019,18 @@ packages: '@glimmer/tracking': ^1.1.2 dependencies: '@ember-data/private-build-infra': file:packages/private-build-infra - '@ember-data/tracking': file:packages/tracking(@babel/core@7.23.0) + '@ember-data/tracking': file:packages/tracking(@babel/core@7.23.0)(ember-source@5.3.0) '@ember/string': 3.1.1(@babel/core@7.23.0) '@embroider/macros': 1.13.1(@babel/core@7.23.0) '@glimmer/tracking': 1.1.2 '@glimmer/validator': 0.84.3 - ember-cached-decorator-polyfill: 1.0.2(@babel/core@7.23.0)(ember-source@5.3.0) ember-cli-babel: 8.1.0(@babel/core@7.23.0) transitivePeerDependencies: - '@babel/core' - '@glint/template' - - ember-source - supports-color - file:packages/store(@babel/core@7.23.0)(@ember-data/tracking@packages+tracking)(@ember/string@3.1.1)(@glimmer/tracking@1.1.2)(ember-source@5.3.0): + file:packages/store(@babel/core@7.23.0)(@ember-data/tracking@packages+tracking)(@ember/string@3.1.1)(@glimmer/tracking@1.1.2): resolution: {directory: packages/store, type: directory} id: file:packages/store name: '@ember-data/store' @@ -18017,16 +18046,14 @@ packages: '@embroider/macros': 1.13.1(@babel/core@7.23.0) '@glimmer/tracking': 1.1.2 '@glimmer/validator': 0.84.3 - ember-cached-decorator-polyfill: 1.0.2(@babel/core@7.23.0)(ember-source@5.3.0) ember-cli-babel: 8.1.0(@babel/core@7.23.0) transitivePeerDependencies: - '@babel/core' - '@glint/template' - - ember-source - supports-color dev: true - file:packages/tracking(@babel/core@7.23.0): + file:packages/tracking(@babel/core@7.23.0)(ember-source@5.3.0): resolution: {directory: packages/tracking, type: directory} id: file:packages/tracking name: '@ember-data/tracking' @@ -18035,10 +18062,12 @@ packages: '@ember-data/private-build-infra': file:packages/private-build-infra '@embroider/macros': 1.13.1(@babel/core@7.23.0) '@glimmer/validator': 0.84.3 + ember-cached-decorator-polyfill: 1.0.2(@babel/core@7.23.0)(ember-source@5.3.0) ember-cli-babel: 8.1.0(@babel/core@7.23.0) transitivePeerDependencies: - '@babel/core' - '@glint/template' + - ember-source - supports-color file:packages/unpublished-test-infra(@babel/core@7.23.0): diff --git a/tests/docs/fixtures/expected.js b/tests/docs/fixtures/expected.js index e77f85c4d2a..86dd5dd55a7 100644 --- a/tests/docs/fixtures/expected.js +++ b/tests/docs/fixtures/expected.js @@ -69,7 +69,6 @@ module.exports = { '(private) @ember-data/model Errors#unknownProperty', '(private) @ember-data/model Model#_createSnapshot', '(private) @ember-data/model Model#_debugInfo', - '(private) @ember-data/model Model#_notifyProperties', '(private) @ember-data/model Model#create', '(private) @ember-data/model Model#currentState', '(private) @ember-data/model PromiseManyArray#forEach', diff --git a/tests/fastboot/types/fastboot-test-app/index.d.ts b/tests/fastboot/types/fastboot-test-app/index.d.ts deleted file mode 100644 index 74e16745404..00000000000 --- a/tests/fastboot/types/fastboot-test-app/index.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import Ember from 'ember'; - -declare global { - interface Array extends Ember.ArrayPrototypeExtensions {} - // interface Function extends Ember.FunctionPrototypeExtensions {} -} - -export {}; diff --git a/tests/main/tests/acceptance/relationships/tracking-record-state-test.js b/tests/main/tests/acceptance/relationships/tracking-record-state-test.js index 85edcab515b..fecd10e7483 100644 --- a/tests/main/tests/acceptance/relationships/tracking-record-state-test.js +++ b/tests/main/tests/acceptance/relationships/tracking-record-state-test.js @@ -2,6 +2,7 @@ import { action } from '@ember/object'; import { inject } from '@ember/service'; import { click, findAll, render } from '@ember/test-helpers'; import Component from '@glimmer/component'; +// eslint-disable-next-line no-restricted-imports import { tracked } from '@glimmer/tracking'; import { module, test } from 'qunit'; diff --git a/tests/main/tests/acceptance/tracking-create-record-test.js b/tests/main/tests/acceptance/tracking-create-record-test.js index ad52ff8c593..75dfbddf58f 100644 --- a/tests/main/tests/acceptance/tracking-create-record-test.js +++ b/tests/main/tests/acceptance/tracking-create-record-test.js @@ -1,6 +1,7 @@ import { inject as service } from '@ember/service'; import { render, settled } from '@ember/test-helpers'; import Component from '@glimmer/component'; +// eslint-disable-next-line no-restricted-imports import { cached, tracked } from '@glimmer/tracking'; import { module, test } from 'qunit'; diff --git a/tests/main/tests/end-user-dx/meaningful-backtracking-errors-test.js b/tests/main/tests/end-user-dx/meaningful-backtracking-errors-test.js index e24968a051b..e651acd10c0 100644 --- a/tests/main/tests/end-user-dx/meaningful-backtracking-errors-test.js +++ b/tests/main/tests/end-user-dx/meaningful-backtracking-errors-test.js @@ -40,7 +40,7 @@ module('DX | Meaningful Backtracking Errors', function (hooks) { error.message.includes( 'You attempted to update .length, but it had already been used previously in the same computation' ), - 'we have a meaningful error' + `we have a meaningful error: ${error.message}` ); return false; } diff --git a/tests/main/tests/helpers/create-tracking-context.js b/tests/main/tests/helpers/create-tracking-context.js index 86273ca9826..21b04279100 100644 --- a/tests/main/tests/helpers/create-tracking-context.js +++ b/tests/main/tests/helpers/create-tracking-context.js @@ -1,5 +1,6 @@ import { render, settled } from '@ember/test-helpers'; import Component from '@glimmer/component'; +// eslint-disable-next-line no-restricted-imports import { tracked } from '@glimmer/tracking'; import { hbs } from 'ember-cli-htmlbars'; diff --git a/tests/main/tests/unit/model/relationships/belongs-to-test.js b/tests/main/tests/unit/model/relationships/belongs-to-test.js index 2637b5b992d..278844f61e9 100644 --- a/tests/main/tests/unit/model/relationships/belongs-to-test.js +++ b/tests/main/tests/unit/model/relationships/belongs-to-test.js @@ -818,7 +818,7 @@ module('unit/model/relationships - belongsTo', function (hooks) { let store = this.owner.lookup('service:store'); - const theTag = store.push({ data: { type: 'tag', id: '1', attributes: { name: 'ember' } } }); + const theTag = store.push({ data: { type: 'tag', id: '1', attributes: { name: 'Amber' } } }); let person = store.createRecord('person', { tag: theTag }); const personTag = person.tag; assert.ok(personTag.then, 'tag should be an async relationship'); diff --git a/tests/main/tests/unit/model/relationships/has-many-test.js b/tests/main/tests/unit/model/relationships/has-many-test.js index a6986e134a7..0ebc2f0578b 100644 --- a/tests/main/tests/unit/model/relationships/has-many-test.js +++ b/tests/main/tests/unit/model/relationships/has-many-test.js @@ -1256,7 +1256,7 @@ module('unit/model/relationships - hasMany', function (hooks) { type: 'tag', id: '1', attributes: { - name: 'ember', + name: 'Amber', }, }, ], @@ -1265,7 +1265,7 @@ module('unit/model/relationships - hasMany', function (hooks) { await store.findRecord('person', '1').then((person) => { let tag = person.tags.at(0); - assert.strictEqual(tag.name, 'ember', 'precond - relationships work'); + assert.strictEqual(tag.name, 'Amber', 'precond - relationships work'); tag = store.createRecord('tag', { name: 'js' }); person.tags.push(tag); @@ -2152,7 +2152,7 @@ module('unit/model/relationships - hasMany', function (hooks) { type: 'tag', id: '1', attributes: { - name: 'ember', + name: 'Amber', }, }, { @@ -2216,7 +2216,7 @@ module('unit/model/relationships - hasMany', function (hooks) { type: 'tag', id: '1', attributes: { - name: 'ember', + name: 'Amber', }, }, ], @@ -2224,7 +2224,7 @@ module('unit/model/relationships - hasMany', function (hooks) { let tag = person.tags.at(0); - assert.strictEqual(tag.name, 'ember', 'precond - relationships work'); + assert.strictEqual(tag.name, 'Amber', 'precond - relationships work'); person.tags.splice(0, 1); diff --git a/tests/recommended-json-api/app/components/book-list.ts b/tests/recommended-json-api/app/components/book-list.ts index 7efd8ce24be..94aa2ee3021 100644 --- a/tests/recommended-json-api/app/components/book-list.ts +++ b/tests/recommended-json-api/app/components/book-list.ts @@ -1,5 +1,6 @@ import { service } from '@ember/service'; import Component from '@glimmer/component'; +// eslint-disable-next-line no-restricted-imports import { cached, tracked } from '@glimmer/tracking'; import { query } from '@ember-data/json-api/request'; diff --git a/tests/recommended-json-api/app/components/book-search.ts b/tests/recommended-json-api/app/components/book-search.ts index 8aab0aceac3..30bdd53eb7c 100644 --- a/tests/recommended-json-api/app/components/book-search.ts +++ b/tests/recommended-json-api/app/components/book-search.ts @@ -1,5 +1,6 @@ import { service } from '@ember/service'; import Component from '@glimmer/component'; +// eslint-disable-next-line no-restricted-imports import { cached, tracked } from '@glimmer/tracking'; import type Store from '@ember-data/store'; diff --git a/tests/recommended-json-api/app/components/infinite-books.ts b/tests/recommended-json-api/app/components/infinite-books.ts index 07da7e93729..a0dc764c0a5 100644 --- a/tests/recommended-json-api/app/components/infinite-books.ts +++ b/tests/recommended-json-api/app/components/infinite-books.ts @@ -1,5 +1,6 @@ import { service } from '@ember/service'; import Component from '@glimmer/component'; +// eslint-disable-next-line no-restricted-imports import { tracked } from '@glimmer/tracking'; import type Store from '@ember-data/store'; diff --git a/tests/recommended-json-api/app/utils/pagination-links.ts b/tests/recommended-json-api/app/utils/pagination-links.ts index d666d25a23d..94fbb0b6d4a 100644 --- a/tests/recommended-json-api/app/utils/pagination-links.ts +++ b/tests/recommended-json-api/app/utils/pagination-links.ts @@ -1,4 +1,5 @@ import { assert } from '@ember/debug'; +// eslint-disable-next-line no-restricted-imports import { tracked } from '@glimmer/tracking'; type ApiMeta = { diff --git a/tsconfig.json b/tsconfig.json index 60895b4e6cd..de95a0ec5cc 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -11,7 +11,6 @@ "packages/unpublished-test-infra/addon-test-support/qunit-asserts/assert-warning.ts", "packages/unpublished-test-infra/addon-test-support/qunit-asserts/assert-assertion.ts", "tests/fastboot/types/global.d.ts", - "tests/fastboot/types/fastboot-test-app/index.d.ts", "tests/fastboot/app/serializers/application.ts", "tests/fastboot/app/router.ts", "tests/fastboot/app/resolver.ts",