@warp-drive/core 5.7.0-alpha.10 → 5.7.0-alpha.11
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/reactive/-private/fields/managed-array.d.ts +2 -3
- package/declarations/reactive/-private/fields/managed-object.d.ts +2 -6
- package/declarations/reactive/-private/record.d.ts +4 -17
- package/declarations/reactive/-private/symbols.d.ts +1 -6
- package/declarations/reactive/-private.d.ts +1 -1
- package/declarations/types/-private.d.ts +1 -1
- package/declarations/types/schema/fields.d.ts +29 -2
- package/dist/reactive/-private.js +1 -1
- package/dist/reactive.js +39 -44
- package/dist/{symbols-SIstXMLI.js → symbols-BoONANuz.js} +2 -7
- package/dist/types/-private.js +1 -1
- package/dist/types/schema/fields.js +4 -0
- package/package.json +3 -3
|
@@ -4,15 +4,14 @@ import type { StableRecordIdentifier } from "../../../types/identifier.js";
|
|
|
4
4
|
import type { ArrayField, SchemaArrayField } from "../../../types/schema/fields.js";
|
|
5
5
|
import type { KindContext } from "../default-mode.js";
|
|
6
6
|
import { ReactiveResource } from "../record.js";
|
|
7
|
-
import {
|
|
7
|
+
import { Context, SOURCE } from "../symbols.js";
|
|
8
8
|
export interface ManagedArray extends Omit<Array<unknown>, "[]"> {
|
|
9
9
|
[SOURCE]: unknown[];
|
|
10
10
|
identifier: StableRecordIdentifier;
|
|
11
11
|
path: string | string[];
|
|
12
12
|
owner: ReactiveResource;
|
|
13
13
|
[ARRAY_SIGNAL]: WarpDriveSignal;
|
|
14
|
-
[
|
|
15
|
-
[Legacy]: boolean;
|
|
14
|
+
[Context]: KindContext<SchemaArrayField | ArrayField>;
|
|
16
15
|
}
|
|
17
16
|
// eslint-disable-next-line @typescript-eslint/no-extraneous-class
|
|
18
17
|
export declare class ManagedArray {
|
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
import { OBJECT_SIGNAL, type WarpDriveSignal } from "../../../store/-private.js";
|
|
2
|
-
import type { StableRecordIdentifier } from "../../../types/identifier.js";
|
|
3
2
|
import type { ObjectField, SchemaObjectField } from "../../../types/schema/fields.js";
|
|
4
3
|
import type { KindContext } from "../default-mode.js";
|
|
5
4
|
import type { ReactiveResource } from "../record.js";
|
|
6
|
-
import {
|
|
5
|
+
import { Context, SOURCE } from "../symbols.js";
|
|
7
6
|
export declare function notifyObject(obj: ManagedObject): void;
|
|
8
7
|
// const ignoredGlobalFields = new Set<string>(['setInterval', 'nodeType', 'nodeName', 'length', 'document', STRUCTURED]);
|
|
9
8
|
export interface ManagedObject {
|
|
10
9
|
[SOURCE]: object;
|
|
11
|
-
[
|
|
12
|
-
[EmbeddedPath]: string[];
|
|
10
|
+
[Context]: KindContext<ObjectField>;
|
|
13
11
|
[OBJECT_SIGNAL]: WarpDriveSignal;
|
|
14
|
-
[Editable]: boolean;
|
|
15
|
-
[Legacy]: boolean;
|
|
16
12
|
}
|
|
17
13
|
// eslint-disable-next-line @typescript-eslint/no-extraneous-class
|
|
18
14
|
export declare class ManagedObject {
|
|
@@ -1,26 +1,13 @@
|
|
|
1
|
-
import type { Store } from "../../
|
|
2
|
-
import type { StableRecordIdentifier } from "../../types/identifier.js";
|
|
3
|
-
import type { SchemaArrayField, SchemaObjectField } from "../../types/schema/fields.js";
|
|
1
|
+
import type { Store } from "../../store/-private.js";
|
|
4
2
|
import { RecordStore } from "../../types/symbols.js";
|
|
5
3
|
import type { ObjectContext, ResourceContext } from "./default-mode.js";
|
|
6
|
-
import { Checkout,
|
|
7
|
-
export { Editable, Legacy, Checkout } from "./symbols.js";
|
|
4
|
+
import { Checkout, Context, Destroy } from "./symbols.js";
|
|
8
5
|
export interface ReactiveResource {
|
|
9
6
|
[Symbol.toStringTag]: `ReactiveResource<${string}>`;
|
|
10
7
|
/** @internal */
|
|
11
|
-
[
|
|
12
|
-
/** @internal */
|
|
13
|
-
[Identifier]: StableRecordIdentifier;
|
|
14
|
-
/** @internal */
|
|
15
|
-
[Parent]: StableRecordIdentifier;
|
|
16
|
-
/** @internal */
|
|
17
|
-
[EmbeddedField]: SchemaArrayField | SchemaObjectField | null;
|
|
8
|
+
[Context]: ObjectContext | ResourceContext;
|
|
18
9
|
/** @internal */
|
|
19
|
-
[
|
|
20
|
-
/** @internal */
|
|
21
|
-
[Editable]: boolean;
|
|
22
|
-
/** @internal */
|
|
23
|
-
[Legacy]: boolean;
|
|
10
|
+
[RecordStore]: Store;
|
|
24
11
|
/** @internal */
|
|
25
12
|
___notifications: object;
|
|
26
13
|
/** @internal */
|
|
@@ -27,10 +27,5 @@
|
|
|
27
27
|
export declare const SOURCE: "___(unique) Symbol(SOURCE)";
|
|
28
28
|
export declare const MUTATE: "___(unique) Symbol(MUTATE)";
|
|
29
29
|
export declare const Destroy: "___(unique) Symbol(Destroy)";
|
|
30
|
-
export declare const Identifier: "___(unique) Symbol(Identifier)";
|
|
31
|
-
export declare const Editable: "___(unique) Symbol(Editable)";
|
|
32
|
-
export declare const Parent: "___(unique) Symbol(Parent)";
|
|
33
30
|
export declare const Checkout: "___(unique) Symbol(Checkout)";
|
|
34
|
-
export declare const
|
|
35
|
-
export declare const EmbeddedPath: "___(unique) Symbol(EmbeddedPath)";
|
|
36
|
-
export declare const EmbeddedField: "___(unique) Symbol(EmbeddedField)";
|
|
31
|
+
export declare const Context: "___(unique) Symbol(Context)";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { Context } from "./-private/symbols.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
type UniversalTransientKey = "REQ_ID";
|
|
2
2
|
type UniversalKey = `(transient) ${UniversalTransientKey}` | "RequestMap" | "PromiseCache" | "RequestCache" | "SkipCache" | "EnableHydration" | "WarpDriveRuntimeConfig";
|
|
3
3
|
type TransientKey = "transactionRef" | "configuredGenerationMethod" | "configuredUpdateMethod" | "configuredForgetMethod" | "configuredResetMethod" | "configuredKeyInfoMethod" | "signalHooks";
|
|
4
|
-
type GlobalKey = `(transient) ${TransientKey}` | "AdapterError" | "InvalidError" | "TimeoutError" | "AbortError" | "UnauthorizedError" | "ForbiddenError" | "NotFoundError" | "ConflictError" | "ServerError" | "#{}" | "#[]" | "Signals" | "AvailableShims" | "FAKE_ARR" | "#source" | "#update" | "#notify" | "IS_COLLECTION" | "Touching" | "RequestPromise" | "SaveOp" | "LEGACY_SUPPORT" | "LegacySupport" | "Graphs" | "IS_FROZEN" | "IS_CACHE_HANDLER" | "CONFIG" | "DEBUG_MAP" | "IDENTIFIERS" | "DOCUMENTS" | "CacheForIdentifierCache" | "RecordCache" | "StoreMap" | "Store" | "$type" | "TransformName" | "RequestSignature" | "IS_FUTURE" | "DOC" | "ManagedArrayMap" | "ManagedObjectMap" | "Support" | "SOURCE" | "MUTATE" | "Destroy" | "
|
|
4
|
+
type GlobalKey = `(transient) ${TransientKey}` | "AdapterError" | "InvalidError" | "TimeoutError" | "AbortError" | "UnauthorizedError" | "ForbiddenError" | "NotFoundError" | "ConflictError" | "ServerError" | "#{}" | "#[]" | "Signals" | "AvailableShims" | "FAKE_ARR" | "#source" | "#update" | "#notify" | "IS_COLLECTION" | "Touching" | "RequestPromise" | "SaveOp" | "LEGACY_SUPPORT" | "LegacySupport" | "Graphs" | "IS_FROZEN" | "IS_CACHE_HANDLER" | "CONFIG" | "DEBUG_MAP" | "IDENTIFIERS" | "DOCUMENTS" | "CacheForIdentifierCache" | "RecordCache" | "StoreMap" | "Store" | "$type" | "TransformName" | "RequestSignature" | "IS_FUTURE" | "DOC" | "ManagedArrayMap" | "ManagedObjectMap" | "Support" | "SOURCE" | "MUTATE" | "Destroy" | "Checkout" | "Context";
|
|
5
5
|
type UniqueSymbol<T extends string> = `___(unique) Symbol(${T})`;
|
|
6
6
|
type UniqueSymbolOr<
|
|
7
7
|
T,
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import type { ObjectValue, PrimitiveValue, Value } from "../json/raw.js";
|
|
2
2
|
/**
|
|
3
|
+
* Options signature for Legacy Attributes.
|
|
4
|
+
*/
|
|
5
|
+
export interface AttrOptions {
|
|
6
|
+
/**
|
|
7
|
+
* A primitive value or a function which produces a value.
|
|
8
|
+
*/
|
|
9
|
+
defaultValue?: PrimitiveValue | (() => Value);
|
|
10
|
+
[key: string]: Value | (() => Value) | undefined;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
3
13
|
* A generic "field" that can be used to define
|
|
4
14
|
* primitive value fields.
|
|
5
15
|
*
|
|
@@ -52,7 +62,7 @@ export interface GenericField {
|
|
|
52
62
|
*/
|
|
53
63
|
sourceKey?: string;
|
|
54
64
|
/**
|
|
55
|
-
* the name of the
|
|
65
|
+
* the name of the {@link Transformation} to use, if any
|
|
56
66
|
*
|
|
57
67
|
* @public
|
|
58
68
|
*/
|
|
@@ -545,6 +555,15 @@ export interface SchemaObjectField {
|
|
|
545
555
|
* @public
|
|
546
556
|
*/
|
|
547
557
|
options?: {
|
|
558
|
+
/**
|
|
559
|
+
* If true, if no value for this field exists in the cache,
|
|
560
|
+
* an empty `{}` will be used as the source for a new SchemaObject
|
|
561
|
+
* of the associated schema type, as opposed to the field's
|
|
562
|
+
* value being `null`.
|
|
563
|
+
*
|
|
564
|
+
* If `polymorphic` is `true`, defaultValue will be considered `false`.
|
|
565
|
+
*/
|
|
566
|
+
defaultValue?: boolean;
|
|
548
567
|
/**
|
|
549
568
|
* ::: warning ⚠️ Dangerous Feature Ahead
|
|
550
569
|
* :::
|
|
@@ -754,6 +773,13 @@ export interface SchemaArrayField {
|
|
|
754
773
|
* @public
|
|
755
774
|
*/
|
|
756
775
|
options?: {
|
|
776
|
+
/**
|
|
777
|
+
* If true, if no value for this field exists in the cache,
|
|
778
|
+
* an empty `[]` will be used as the value of the field,
|
|
779
|
+
* as opposed to the field's value being `null`.
|
|
780
|
+
*
|
|
781
|
+
*/
|
|
782
|
+
defaultValue?: boolean;
|
|
757
783
|
/**
|
|
758
784
|
* ::: warning ⚠️ Dangerous Feature Ahead
|
|
759
785
|
* :::
|
|
@@ -1172,8 +1198,9 @@ export interface LegacyAttributeField {
|
|
|
1172
1198
|
* Must comply to the specific transform's options
|
|
1173
1199
|
* schema.
|
|
1174
1200
|
*
|
|
1201
|
+
* See {@link AttrOptions} for more info.
|
|
1175
1202
|
*/
|
|
1176
|
-
options?:
|
|
1203
|
+
options?: AttrOptions;
|
|
1177
1204
|
}
|
|
1178
1205
|
/**
|
|
1179
1206
|
* > [!CAUTION]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { C as Context } from "../symbols-BoONANuz.js";
|
package/dist/reactive.js
CHANGED
|
@@ -6,7 +6,7 @@ import { warn, deprecate } from '@ember/debug';
|
|
|
6
6
|
import './utils/string.js';
|
|
7
7
|
import { A as ARRAY_SIGNAL, O as OBJECT_SIGNAL, c as createMemo } from "./configure-B48bFHOl.js";
|
|
8
8
|
import { RecordStore, Type } from './types/symbols.js';
|
|
9
|
-
import { S as SOURCE,
|
|
9
|
+
import { S as SOURCE, C as Context, D as Destroy, a as Checkout } from "./symbols-BoONANuz.js";
|
|
10
10
|
import { getOrSetGlobal } from './types/-private.js';
|
|
11
11
|
import './index.js';
|
|
12
12
|
function getAliasField(context) {
|
|
@@ -74,8 +74,8 @@ class ManagedArray {
|
|
|
74
74
|
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
75
75
|
const self = this;
|
|
76
76
|
this[SOURCE] = data?.slice();
|
|
77
|
-
const IS_EDITABLE =
|
|
78
|
-
this[
|
|
77
|
+
const IS_EDITABLE = context.editable ?? false;
|
|
78
|
+
this[Context] = context;
|
|
79
79
|
const schema = context.store.schema;
|
|
80
80
|
const cache = context.store.cache;
|
|
81
81
|
const {
|
|
@@ -407,12 +407,16 @@ function getArrayField(context) {
|
|
|
407
407
|
const {
|
|
408
408
|
store,
|
|
409
409
|
resourceKey,
|
|
410
|
-
path
|
|
410
|
+
path,
|
|
411
|
+
field
|
|
411
412
|
} = context;
|
|
412
413
|
const {
|
|
413
414
|
cache
|
|
414
415
|
} = store;
|
|
415
|
-
|
|
416
|
+
let rawValue = context.editable ? cache.getAttr(resourceKey, path) : cache.getRemoteAttr(resourceKey, path);
|
|
417
|
+
if (!rawValue && field.kind === 'schema-array' && field.options?.defaultValue) {
|
|
418
|
+
rawValue = [];
|
|
419
|
+
}
|
|
416
420
|
if (!rawValue) {
|
|
417
421
|
return null;
|
|
418
422
|
}
|
|
@@ -579,9 +583,10 @@ function setGenericField(context) {
|
|
|
579
583
|
}
|
|
580
584
|
class ManyArrayManager {
|
|
581
585
|
constructor(record, editable) {
|
|
586
|
+
const context = record[Context];
|
|
582
587
|
this.record = record;
|
|
583
|
-
this.store =
|
|
584
|
-
this.identifier =
|
|
588
|
+
this.store = context.store;
|
|
589
|
+
this.identifier = context.resourceKey;
|
|
585
590
|
this.editable = editable;
|
|
586
591
|
}
|
|
587
592
|
_syncArray(array) {
|
|
@@ -809,7 +814,7 @@ function setLocalField(context) {
|
|
|
809
814
|
}
|
|
810
815
|
return true;
|
|
811
816
|
}
|
|
812
|
-
const ObjectSymbols = new Set([OBJECT_SIGNAL,
|
|
817
|
+
const ObjectSymbols = new Set([OBJECT_SIGNAL, Context, SOURCE]);
|
|
813
818
|
|
|
814
819
|
// const ignoredGlobalFields = new Set<string>(['setInterval', 'nodeType', 'nodeName', 'length', 'document', STRUCTURED]);
|
|
815
820
|
|
|
@@ -825,10 +830,7 @@ class ManagedObject {
|
|
|
825
830
|
this[SOURCE] = Object.assign({}, context.value);
|
|
826
831
|
const signals = withSignalStore(this);
|
|
827
832
|
const _SIGNAL = this[OBJECT_SIGNAL] = entangleSignal(signals, this, OBJECT_SIGNAL, undefined);
|
|
828
|
-
this[
|
|
829
|
-
this[Legacy] = context.legacy;
|
|
830
|
-
this[Parent] = context.resourceKey;
|
|
831
|
-
this[EmbeddedPath] = path;
|
|
833
|
+
this[Context] = context;
|
|
832
834
|
const identifier = context.resourceKey;
|
|
833
835
|
const {
|
|
834
836
|
cache,
|
|
@@ -1058,19 +1060,18 @@ class ResourceRelationship {
|
|
|
1058
1060
|
this.links = rawValue.links ?? {};
|
|
1059
1061
|
this.meta = rawValue.meta ?? {};
|
|
1060
1062
|
}
|
|
1061
|
-
this[
|
|
1062
|
-
this[Parent] = context.record;
|
|
1063
|
+
this[Context] = context;
|
|
1063
1064
|
}
|
|
1064
1065
|
fetch(options) {
|
|
1065
1066
|
const url = options?.url ?? getHref(this.links.related) ?? getHref(this.links.self) ?? null;
|
|
1066
1067
|
if (!url) {
|
|
1067
|
-
throw new Error(`Cannot ${options?.method ?? 'fetch'} ${this[
|
|
1068
|
+
throw new Error(`Cannot ${options?.method ?? 'fetch'} ${this[Context].resourceKey.type}.${String(this.name)} because it has no related link`);
|
|
1068
1069
|
}
|
|
1069
1070
|
const request = Object.assign({
|
|
1070
1071
|
url,
|
|
1071
1072
|
method: 'GET'
|
|
1072
1073
|
}, options);
|
|
1073
|
-
return this[
|
|
1074
|
+
return this[Context].store.request(request);
|
|
1074
1075
|
}
|
|
1075
1076
|
}
|
|
1076
1077
|
defineSignal(ResourceRelationship.prototype, 'data', null);
|
|
@@ -1121,12 +1122,16 @@ function getSchemaObjectField(context) {
|
|
|
1121
1122
|
const {
|
|
1122
1123
|
store,
|
|
1123
1124
|
resourceKey,
|
|
1124
|
-
path
|
|
1125
|
+
path,
|
|
1126
|
+
field
|
|
1125
1127
|
} = context;
|
|
1126
1128
|
const {
|
|
1127
1129
|
cache
|
|
1128
1130
|
} = store;
|
|
1129
|
-
|
|
1131
|
+
let rawValue = context.editable ? cache.getAttr(resourceKey, path) : cache.getRemoteAttr(resourceKey, path);
|
|
1132
|
+
if (!rawValue && !field.options?.polymorphic && field.options?.defaultValue) {
|
|
1133
|
+
rawValue = {};
|
|
1134
|
+
}
|
|
1130
1135
|
if (!rawValue) {
|
|
1131
1136
|
if (signal.value) {
|
|
1132
1137
|
const value = signal.value;
|
|
@@ -1138,9 +1143,6 @@ function getSchemaObjectField(context) {
|
|
|
1138
1143
|
}
|
|
1139
1144
|
return null;
|
|
1140
1145
|
}
|
|
1141
|
-
const {
|
|
1142
|
-
field
|
|
1143
|
-
} = context;
|
|
1144
1146
|
const {
|
|
1145
1147
|
schema
|
|
1146
1148
|
} = store;
|
|
@@ -1353,7 +1355,7 @@ const DefaultMode = {
|
|
|
1353
1355
|
}
|
|
1354
1356
|
};
|
|
1355
1357
|
const IgnoredGlobalFields = new Set(['length', 'nodeType', 'then', 'setInterval', 'document', STRUCTURED]);
|
|
1356
|
-
const symbolList = [Destroy, RecordStore,
|
|
1358
|
+
const symbolList = [Context, Destroy, RecordStore, Checkout];
|
|
1357
1359
|
const RecordSymbols = new Set(symbolList);
|
|
1358
1360
|
function isPathMatch(a, b) {
|
|
1359
1361
|
return a.length === b.length && a.every((v, i) => v === b[i]);
|
|
@@ -1384,15 +1386,8 @@ class ReactiveResource {
|
|
|
1384
1386
|
const embeddedField = context.field;
|
|
1385
1387
|
const embeddedPath = context.path;
|
|
1386
1388
|
const isEmbedded = context.field !== null;
|
|
1387
|
-
|
|
1388
|
-
if (isEmbedded) {
|
|
1389
|
-
this[Parent] = identifier;
|
|
1390
|
-
} else {
|
|
1391
|
-
this[Identifier] = identifier;
|
|
1392
|
-
}
|
|
1393
|
-
const IS_EDITABLE = this[Editable] = context.editable ?? false;
|
|
1389
|
+
const IS_EDITABLE = context.editable ?? false;
|
|
1394
1390
|
const schema = store.schema;
|
|
1395
|
-
this[Legacy] = context.legacy ?? false;
|
|
1396
1391
|
const objectType = isEmbedded ? context.value : identifier.type;
|
|
1397
1392
|
const ResourceSchema = schema.resource(isEmbedded ? {
|
|
1398
1393
|
type: objectType
|
|
@@ -1402,8 +1397,8 @@ class ReactiveResource {
|
|
|
1402
1397
|
|
|
1403
1398
|
// prettier-ignore
|
|
1404
1399
|
const extensions = !context.legacy ? null : isEmbedded ? schema.CAUTION_MEGA_DANGER_ZONE_objectExtensions(embeddedField, objectType) : schema.CAUTION_MEGA_DANGER_ZONE_resourceExtensions(identifier);
|
|
1405
|
-
this[
|
|
1406
|
-
this[
|
|
1400
|
+
this[Context] = context;
|
|
1401
|
+
this[RecordStore] = context.store;
|
|
1407
1402
|
const fields = isEmbedded ? schema.fields({
|
|
1408
1403
|
type: objectType
|
|
1409
1404
|
}) : schema.fields(identifier);
|
|
@@ -1874,26 +1869,25 @@ class ReactiveResource {
|
|
|
1874
1869
|
}
|
|
1875
1870
|
}
|
|
1876
1871
|
function _CHECKOUT(record) {
|
|
1872
|
+
const context = record[Context];
|
|
1873
|
+
|
|
1877
1874
|
// IF we are already the editable record, throw an error
|
|
1878
|
-
if (
|
|
1875
|
+
if (context.editable) {
|
|
1879
1876
|
throw new Error(`Cannot checkout an already editable record`);
|
|
1880
1877
|
}
|
|
1881
1878
|
const editable = Editables.get(record);
|
|
1882
1879
|
if (editable) {
|
|
1883
1880
|
return Promise.resolve(editable);
|
|
1884
1881
|
}
|
|
1885
|
-
const
|
|
1886
|
-
const embeddedPath = record[EmbeddedPath];
|
|
1887
|
-
const isEmbedded = embeddedType !== null && embeddedPath !== null;
|
|
1882
|
+
const isEmbedded = context.field !== null && context.path !== null;
|
|
1888
1883
|
if (isEmbedded) {
|
|
1889
1884
|
throw new Error(`Cannot checkout an embedded record (yet)`);
|
|
1890
1885
|
}
|
|
1891
|
-
const legacy = record[Legacy];
|
|
1892
1886
|
const editableRecord = new ReactiveResource({
|
|
1893
|
-
store:
|
|
1894
|
-
resourceKey:
|
|
1895
|
-
modeName: legacy ? 'legacy' : 'polaris',
|
|
1896
|
-
legacy: legacy,
|
|
1887
|
+
store: context.store,
|
|
1888
|
+
resourceKey: context.resourceKey,
|
|
1889
|
+
modeName: context.legacy ? 'legacy' : 'polaris',
|
|
1890
|
+
legacy: context.legacy,
|
|
1897
1891
|
editable: true,
|
|
1898
1892
|
path: null,
|
|
1899
1893
|
field: null,
|
|
@@ -1903,13 +1897,13 @@ function _CHECKOUT(record) {
|
|
|
1903
1897
|
return Promise.resolve(editableRecord);
|
|
1904
1898
|
}
|
|
1905
1899
|
function _DESTROY(record) {
|
|
1906
|
-
if (record[
|
|
1900
|
+
if (record[Context].legacy) {
|
|
1907
1901
|
// @ts-expect-error
|
|
1908
1902
|
record.isDestroying = true;
|
|
1909
1903
|
// @ts-expect-error
|
|
1910
1904
|
record.isDestroyed = true;
|
|
1911
1905
|
}
|
|
1912
|
-
record[
|
|
1906
|
+
record[Context].store.notifications.unsubscribe(record.___notifications);
|
|
1913
1907
|
|
|
1914
1908
|
// FIXME we need a way to also unsubscribe all SchemaObjects when the primary
|
|
1915
1909
|
// resource is destroyed.
|
|
@@ -2181,7 +2175,8 @@ function withDefaults(schema) {
|
|
|
2181
2175
|
* @public
|
|
2182
2176
|
*/
|
|
2183
2177
|
const fromIdentity = (record, options, key) => {
|
|
2184
|
-
const
|
|
2178
|
+
const context = record[Context];
|
|
2179
|
+
const identifier = context.resourceKey;
|
|
2185
2180
|
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
2186
2181
|
if (!test) {
|
|
2187
2182
|
throw new Error(`Cannot compute @identity for a record without an identifier`);
|
|
@@ -34,11 +34,6 @@ import { getOrSetGlobal } from './types/-private.js';
|
|
|
34
34
|
const SOURCE = getOrSetGlobal('SOURCE', Symbol('#source'));
|
|
35
35
|
getOrSetGlobal('MUTATE', Symbol('#update'));
|
|
36
36
|
const Destroy = getOrSetGlobal('Destroy', Symbol.dispose || Symbol.for('Dispose'));
|
|
37
|
-
const Identifier = getOrSetGlobal('Identifier', Symbol('Identifier'));
|
|
38
|
-
const Editable = getOrSetGlobal('Editable', Symbol('Editable'));
|
|
39
|
-
const Parent = getOrSetGlobal('Parent', Symbol('Parent'));
|
|
40
37
|
const Checkout = getOrSetGlobal('Checkout', Symbol('Checkout'));
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
const EmbeddedField = getOrSetGlobal('EmbeddedField', Symbol('EmbeddedField'));
|
|
44
|
-
export { Checkout as C, Destroy as D, Editable as E, Identifier as I, Legacy as L, Parent as P, SOURCE as S, EmbeddedPath as a, EmbeddedField as b };
|
|
38
|
+
const Context = getOrSetGlobal('Context', Symbol('Context'));
|
|
39
|
+
export { Context as C, Destroy as D, SOURCE as S, Checkout as a };
|
package/dist/types/-private.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { macroCondition, getGlobalConfig } from '@embroider/macros';
|
|
2
2
|
const name = "@warp-drive/core";
|
|
3
|
-
const version = "5.7.0-alpha.
|
|
3
|
+
const version = "5.7.0-alpha.11";
|
|
4
4
|
|
|
5
5
|
// in testing mode, we utilize globals to ensure only one copy exists of
|
|
6
6
|
// these maps, due to bugs in ember-auto-import
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@warp-drive/core",
|
|
3
|
-
"version": "5.7.0-alpha.
|
|
3
|
+
"version": "5.7.0-alpha.11",
|
|
4
4
|
"description": "Core package for WarpDrive | All the Universal Basics",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-addon"
|
|
@@ -37,13 +37,13 @@
|
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@embroider/macros": "^1.16.12",
|
|
40
|
-
"@warp-drive/build-config": "5.7.0-alpha.
|
|
40
|
+
"@warp-drive/build-config": "5.7.0-alpha.11"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@babel/core": "^7.26.10",
|
|
44
44
|
"@babel/plugin-transform-typescript": "^7.27.0",
|
|
45
45
|
"@babel/preset-typescript": "^7.27.0",
|
|
46
|
-
"@warp-drive/internal-config": "5.7.0-alpha.
|
|
46
|
+
"@warp-drive/internal-config": "5.7.0-alpha.11",
|
|
47
47
|
"decorator-transforms": "^2.3.0",
|
|
48
48
|
"ember-source": "~6.3.0",
|
|
49
49
|
"expect-type": "^1.2.1",
|