@warp-drive/legacy 5.7.0-alpha.11 → 5.7.0-alpha.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/declarations/model/-private/attr.d.ts +1 -1
- package/declarations/model/-private/model.d.ts +2 -3
- package/dist/compat/builders.js +1 -1
- package/dist/{errors-BX5wowuz.js → errors-DK6DtmZN.js} +3 -3
- package/dist/model/-private.js +1 -1
- package/dist/model/migration-support.js +2 -2
- package/dist/model.js +10 -11
- package/dist/{schema-provider-Cbnf6sKm.js → schema-provider-DXczOefH.js} +11 -10
- package/dist/store.js +1 -1
- package/package.json +6 -6
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ArrayValue, ObjectValue, PrimitiveValue } from "@warp-drive/core/types/json/raw";
|
|
2
|
-
import type
|
|
2
|
+
import { type TransformName } from "@warp-drive/core/types/symbols";
|
|
3
3
|
import type { DecoratorPropertyDescriptor } from "./util.js";
|
|
4
4
|
/**
|
|
5
5
|
* Options provided to the attr decorator are
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import EmberObject from "@ember/object";
|
|
2
2
|
import type { Store } from "@warp-drive/core";
|
|
3
3
|
import type { ModelSchema, StableRecordIdentifier } from "@warp-drive/core/types";
|
|
4
|
-
import type {
|
|
4
|
+
import type { ChangedAttributesHash } from "@warp-drive/core/types/cache";
|
|
5
5
|
import type { LegacyAttributeField, LegacyRelationshipField } from "@warp-drive/core/types/schema/fields";
|
|
6
6
|
import { RecordStore } from "@warp-drive/core/types/symbols";
|
|
7
7
|
import type { Snapshot } from "../../compat/-private.js";
|
|
@@ -16,9 +16,8 @@ export type ModelCreateArgs = {
|
|
|
16
16
|
// TODO @deprecate consider deprecating accessing record properties during init which the below is necessary for
|
|
17
17
|
_secretInit: {
|
|
18
18
|
identifier: StableRecordIdentifier;
|
|
19
|
-
cache: Cache;
|
|
20
19
|
store: Store;
|
|
21
|
-
cb: (record: Model,
|
|
20
|
+
cb: (record: Model, identifier: StableRecordIdentifier, store: Store) => void;
|
|
22
21
|
};
|
|
23
22
|
};
|
|
24
23
|
export type StaticModel = typeof Model & {
|
package/dist/compat/builders.js
CHANGED
|
@@ -227,7 +227,7 @@ function resourceIsFullyDeleted(instanceCache, identifier) {
|
|
|
227
227
|
@return {SaveRecordRequestInput} request config
|
|
228
228
|
*/
|
|
229
229
|
function saveRecordBuilder(record, options = {}) {
|
|
230
|
-
const store = storeFor(record);
|
|
230
|
+
const store = storeFor(record, true);
|
|
231
231
|
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
232
232
|
if (!test) {
|
|
233
233
|
throw new Error(`Unable to initiate save for a record in a disconnected state`);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { memoized, defineSignal, defineNonEnumerableSignal, isStableIdentifier, recordIdentifierFor, storeFor,
|
|
1
|
+
import { memoized, defineSignal, defineNonEnumerableSignal, isStableIdentifier, recordIdentifierFor, storeFor, SOURCE, fastPush, RelatedCollection, notifyInternalSignal, ARRAY_SIGNAL } from '@warp-drive/core/store/-private';
|
|
2
2
|
import { getOrSetGlobal } from '@warp-drive/core/types/-private';
|
|
3
3
|
import { EnableHydration } from '@warp-drive/core/types/request';
|
|
4
4
|
import { u as upgradeStore } from "./-private-CKrP0ogQ.js";
|
|
@@ -1517,9 +1517,9 @@ function lookupLegacySupport(record) {
|
|
|
1517
1517
|
class LegacySupport {
|
|
1518
1518
|
constructor(record) {
|
|
1519
1519
|
this.record = record;
|
|
1520
|
-
this.store = storeFor(record);
|
|
1520
|
+
this.store = storeFor(record, false);
|
|
1521
1521
|
this.identifier = recordIdentifierFor(record);
|
|
1522
|
-
this.cache =
|
|
1522
|
+
this.cache = this.store.cache;
|
|
1523
1523
|
if (this.store._graph) {
|
|
1524
1524
|
this.graph = this.store._graph;
|
|
1525
1525
|
}
|
package/dist/model/-private.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { E as Errors, L as LEGACY_SUPPORT, P as PromiseBelongsTo, a as PromiseManyArray, l as lookupLegacySupport } from "../errors-
|
|
1
|
+
export { E as Errors, L as LEGACY_SUPPORT, P as PromiseBelongsTo, a as PromiseManyArray, l as lookupLegacySupport } from "../errors-DK6DtmZN.js";
|
|
2
2
|
export { RelatedCollection as ManyArray } from '@warp-drive/core/store/-private';
|
|
@@ -3,8 +3,8 @@ import { recordIdentifierFor } from '@warp-drive/core';
|
|
|
3
3
|
import { notifyInternalSignal, ARRAY_SIGNAL } from '@warp-drive/core/store/-private';
|
|
4
4
|
import { getOrSetGlobal } from '@warp-drive/core/types/-private';
|
|
5
5
|
import { Type } from '@warp-drive/core/types/symbols';
|
|
6
|
-
import { l as lookupLegacySupport, E as Errors } from "../errors-
|
|
7
|
-
import { b as buildSchema, u as unloadRecord, s as serialize, _ as _save, a as save, r as rollbackAttributes, c as _reload, d as reload, h as hasMany, e as _destroyRecord, f as destroyRecord, g as deleteRecord, R as RecordState, i as changedAttributes, j as belongsTo, k as createSnapshot } from "../schema-provider-
|
|
6
|
+
import { l as lookupLegacySupport, E as Errors } from "../errors-DK6DtmZN.js";
|
|
7
|
+
import { b as buildSchema, u as unloadRecord, s as serialize, _ as _save, a as save, r as rollbackAttributes, c as _reload, d as reload, h as hasMany, e as _destroyRecord, f as destroyRecord, g as deleteRecord, R as RecordState, i as changedAttributes, j as belongsTo, k as createSnapshot } from "../schema-provider-DXczOefH.js";
|
|
8
8
|
import { macroCondition, getGlobalConfig } from '@embroider/macros';
|
|
9
9
|
|
|
10
10
|
/**
|
package/dist/model.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { computed } from '@ember/object';
|
|
2
2
|
import { recordIdentifierFor } from '@warp-drive/core';
|
|
3
|
-
import {
|
|
3
|
+
import { RecordStore } from '@warp-drive/core/types/symbols';
|
|
4
4
|
import { i as isElementDescriptor, n as normalizeModelName } from "./util-Dul6TZts.js";
|
|
5
5
|
import { macroCondition, getGlobalConfig } from '@embroider/macros';
|
|
6
6
|
import { warn, deprecate } from '@ember/debug';
|
|
7
|
-
import {
|
|
8
|
-
import { l as lookupLegacySupport } from "./errors-BX5wowuz.js";
|
|
7
|
+
import { l as lookupLegacySupport } from "./errors-DK6DtmZN.js";
|
|
9
8
|
import { singularize, dasherize } from '@warp-drive/utilities/string';
|
|
10
|
-
import { l as getModelFactory } from "./schema-provider-
|
|
11
|
-
export { M as Model, b as buildSchema, M as default, m as restoreDeprecatedModelRequestBehaviors } from "./schema-provider-
|
|
9
|
+
import { l as getModelFactory } from "./schema-provider-DXczOefH.js";
|
|
10
|
+
export { M as Model, b as buildSchema, M as default, m as restoreDeprecatedModelRequestBehaviors } from "./schema-provider-DXczOefH.js";
|
|
12
11
|
import { setOwner, getOwner } from '@ember/application';
|
|
12
|
+
import { setRecordIdentifier, StoreMap } from '@warp-drive/core/store/-private';
|
|
13
13
|
function _attr(type, options) {
|
|
14
14
|
if (typeof type === 'object') {
|
|
15
15
|
options = type;
|
|
@@ -34,7 +34,8 @@ function _attr(type, options) {
|
|
|
34
34
|
if (this.isDestroyed || this.isDestroying) {
|
|
35
35
|
return;
|
|
36
36
|
}
|
|
37
|
-
|
|
37
|
+
const cache = this[RecordStore].cache;
|
|
38
|
+
return cache.getAttr(recordIdentifierFor(this), key);
|
|
38
39
|
},
|
|
39
40
|
set(key, value) {
|
|
40
41
|
if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
|
|
@@ -48,7 +49,7 @@ function _attr(type, options) {
|
|
|
48
49
|
throw new Error(`Attempted to set '${key}' on the deleted record ${identifier.type}:${identifier.id} (${identifier.lid})`);
|
|
49
50
|
}
|
|
50
51
|
})(!this.currentState.isDeleted) : {};
|
|
51
|
-
const cache =
|
|
52
|
+
const cache = this[RecordStore].cache;
|
|
52
53
|
const currentValue = cache.getAttr(identifier, key);
|
|
53
54
|
if (currentValue !== value) {
|
|
54
55
|
cache.setAttr(identifier, key, value);
|
|
@@ -667,14 +668,13 @@ function hasMany(type, options) {
|
|
|
667
668
|
}
|
|
668
669
|
function instantiateRecord(identifier, createRecordArgs) {
|
|
669
670
|
const type = identifier.type;
|
|
670
|
-
|
|
671
|
+
|
|
671
672
|
// TODO deprecate allowing unknown args setting
|
|
672
673
|
const createOptions = {
|
|
673
674
|
_createProps: createRecordArgs,
|
|
674
675
|
// TODO @deprecate consider deprecating accessing record properties during init which the below is necessary for
|
|
675
676
|
_secretInit: {
|
|
676
677
|
identifier,
|
|
677
|
-
cache,
|
|
678
678
|
store: this,
|
|
679
679
|
cb: secretInit
|
|
680
680
|
}
|
|
@@ -729,9 +729,8 @@ function modelFor(modelName) {
|
|
|
729
729
|
type
|
|
730
730
|
})) : {};
|
|
731
731
|
}
|
|
732
|
-
function secretInit(record,
|
|
732
|
+
function secretInit(record, identifier, store) {
|
|
733
733
|
setRecordIdentifier(record, identifier);
|
|
734
734
|
StoreMap.set(record, store);
|
|
735
|
-
setCacheFor(record, cache);
|
|
736
735
|
}
|
|
737
736
|
export { attr, belongsTo, hasMany, instantiateRecord, modelFor, teardownRecord };
|
|
@@ -2,9 +2,9 @@ import { getOwner } from '@ember/application';
|
|
|
2
2
|
import { deprecate } from '@ember/debug';
|
|
3
3
|
import EmberObject from '@ember/object';
|
|
4
4
|
import { recordIdentifierFor, storeFor } from '@warp-drive/core';
|
|
5
|
-
import {
|
|
5
|
+
import { notifyInternalSignal, peekInternalSignal, withSignalStore, ARRAY_SIGNAL, recordIdentifierFor as recordIdentifierFor$1, gate, memoized, defineSignal, coerceId, entangleSignal, defineGate } from '@warp-drive/core/store/-private';
|
|
6
6
|
import { RecordStore } from '@warp-drive/core/types/symbols';
|
|
7
|
-
import { l as lookupLegacySupport, L as LEGACY_SUPPORT, E as Errors } from "./errors-
|
|
7
|
+
import { l as lookupLegacySupport, L as LEGACY_SUPPORT, E as Errors } from "./errors-DK6DtmZN.js";
|
|
8
8
|
import { u as upgradeStore, F as FetchManager } from "./-private-CKrP0ogQ.js";
|
|
9
9
|
import { macroCondition, getGlobalConfig } from '@embroider/macros';
|
|
10
10
|
import { cacheFor } from '@ember/object/internals';
|
|
@@ -17,8 +17,9 @@ function rollbackAttributes() {
|
|
|
17
17
|
const {
|
|
18
18
|
isNew
|
|
19
19
|
} = currentState;
|
|
20
|
-
this[RecordStore]
|
|
21
|
-
|
|
20
|
+
const store = this[RecordStore];
|
|
21
|
+
store._join(() => {
|
|
22
|
+
store.cache.rollbackAttrs(recordIdentifierFor(this));
|
|
22
23
|
this.errors.clear();
|
|
23
24
|
currentState.cleanErrorRequests();
|
|
24
25
|
if (isNew) {
|
|
@@ -84,7 +85,7 @@ function _reload(options = {}) {
|
|
|
84
85
|
return promise;
|
|
85
86
|
}
|
|
86
87
|
function changedAttributes() {
|
|
87
|
-
return
|
|
88
|
+
return this[RecordStore].cache.changedAttrs(recordIdentifierFor(this));
|
|
88
89
|
}
|
|
89
90
|
function serialize(options) {
|
|
90
91
|
upgradeStore(this[RecordStore]);
|
|
@@ -291,7 +292,7 @@ root
|
|
|
291
292
|
*/
|
|
292
293
|
class RecordState {
|
|
293
294
|
constructor(record) {
|
|
294
|
-
const store = storeFor(record);
|
|
295
|
+
const store = storeFor(record, false);
|
|
295
296
|
const identity = recordIdentifierFor$1(record);
|
|
296
297
|
this.identifier = identity;
|
|
297
298
|
this.record = record;
|
|
@@ -382,7 +383,7 @@ class RecordState {
|
|
|
382
383
|
|
|
383
384
|
/** @internal */
|
|
384
385
|
destroy() {
|
|
385
|
-
storeFor(this.record).notifications.unsubscribe(this.handler);
|
|
386
|
+
storeFor(this.record, false).notifications.unsubscribe(this.handler);
|
|
386
387
|
}
|
|
387
388
|
|
|
388
389
|
/** @internal */
|
|
@@ -719,7 +720,7 @@ class Model extends EmberObject {
|
|
|
719
720
|
super.init(options);
|
|
720
721
|
this[RecordStore] = store;
|
|
721
722
|
const identity = _secretInit.identifier;
|
|
722
|
-
_secretInit.cb(this,
|
|
723
|
+
_secretInit.cb(this, identity, _secretInit.store);
|
|
723
724
|
this.___recordState = macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? new RecordState(this) : null;
|
|
724
725
|
this.setProperties(createProps);
|
|
725
726
|
const notifications = store.notifications;
|
|
@@ -733,7 +734,7 @@ class Model extends EmberObject {
|
|
|
733
734
|
destroy() {
|
|
734
735
|
const identifier = recordIdentifierFor(this);
|
|
735
736
|
this.___recordState?.destroy();
|
|
736
|
-
const store = storeFor(this);
|
|
737
|
+
const store = storeFor(this, false);
|
|
737
738
|
store.notifications.unsubscribe(this.___private_notifications);
|
|
738
739
|
LEGACY_SUPPORT.get(this)?.destroy();
|
|
739
740
|
LEGACY_SUPPORT.delete(this);
|
|
@@ -1212,7 +1213,7 @@ class Model extends EmberObject {
|
|
|
1212
1213
|
return this.constructor.relationshipsByName.get(name);
|
|
1213
1214
|
}
|
|
1214
1215
|
inverseFor(name) {
|
|
1215
|
-
return this.constructor.inverseFor(name, storeFor(this));
|
|
1216
|
+
return this.constructor.inverseFor(name, storeFor(this, false));
|
|
1216
1217
|
}
|
|
1217
1218
|
eachAttribute(callback, binding) {
|
|
1218
1219
|
this.constructor.eachAttribute(callback, binding);
|
package/dist/store.js
CHANGED
|
@@ -582,7 +582,7 @@ function restoreDeprecatedStoreBehaviors(StoreKlass) {
|
|
|
582
582
|
if (!test) {
|
|
583
583
|
throw new Error(`Unable to initiate save for a record in a disconnected state`);
|
|
584
584
|
}
|
|
585
|
-
})(storeFor(record)) : {};
|
|
585
|
+
})(storeFor(record, true)) : {};
|
|
586
586
|
const identifier = recordIdentifierFor(record);
|
|
587
587
|
const cache = this.cache;
|
|
588
588
|
if (!identifier) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@warp-drive/legacy",
|
|
3
|
-
"version": "5.7.0-alpha.
|
|
3
|
+
"version": "5.7.0-alpha.12",
|
|
4
4
|
"description": "Decommissioned Packages for WarpDrive | Things your app might still want to maintain use of for a little longer.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-addon"
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
}
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
|
-
"@warp-drive/core": "5.7.0-alpha.
|
|
36
|
-
"@warp-drive/utilities": "5.7.0-alpha.
|
|
35
|
+
"@warp-drive/core": "5.7.0-alpha.12",
|
|
36
|
+
"@warp-drive/utilities": "5.7.0-alpha.12"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@embroider/macros": "^1.16.12"
|
|
@@ -43,9 +43,9 @@
|
|
|
43
43
|
"@babel/plugin-transform-typescript": "^7.27.0",
|
|
44
44
|
"@babel/preset-typescript": "^7.27.0",
|
|
45
45
|
"@types/jquery": "^3.5.32",
|
|
46
|
-
"@warp-drive/internal-config": "5.7.0-alpha.
|
|
47
|
-
"@warp-drive/core": "5.7.0-alpha.
|
|
48
|
-
"@warp-drive/utilities": "5.7.0-alpha.
|
|
46
|
+
"@warp-drive/internal-config": "5.7.0-alpha.12",
|
|
47
|
+
"@warp-drive/core": "5.7.0-alpha.12",
|
|
48
|
+
"@warp-drive/utilities": "5.7.0-alpha.12",
|
|
49
49
|
"ember-source": "~6.3.0",
|
|
50
50
|
"decorator-transforms": "^2.3.0",
|
|
51
51
|
"expect-type": "^1.2.1",
|