@warp-drive/schema-record 0.0.0-alpha.57 → 0.0.0-alpha.59
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/dist/hooks.js +2 -2
- package/dist/record.js +234 -46
- package/dist/record.js.map +1 -1
- package/dist/schema.js +1 -1
- package/dist/{symbols-CAUfvZjq.js → symbols-DqoS4ybV.js} +3 -1
- package/dist/{symbols-CAUfvZjq.js.map → symbols-DqoS4ybV.js.map} +1 -1
- package/package.json +17 -13
- package/unstable-preview-types/managed-array.d.ts +4 -4
- package/unstable-preview-types/managed-array.d.ts.map +1 -1
- package/unstable-preview-types/record.d.ts +6 -2
- package/unstable-preview-types/record.d.ts.map +1 -1
- package/unstable-preview-types/symbols.d.ts +2 -0
- package/unstable-preview-types/symbols.d.ts.map +1 -1
package/dist/hooks.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { SchemaRecord } from "./record";
|
|
2
|
-
import { E as Editable, L as Legacy, D as Destroy } from "./symbols-
|
|
1
|
+
import { SchemaRecord } from "./record.js";
|
|
2
|
+
import { E as Editable, L as Legacy, D as Destroy } from "./symbols-DqoS4ybV.js";
|
|
3
3
|
function instantiateRecord(store, identifier, createArgs) {
|
|
4
4
|
const schema = store.schema;
|
|
5
5
|
const isLegacy = schema.resource(identifier)?.legacy ?? false;
|
package/dist/record.js
CHANGED
|
@@ -2,7 +2,7 @@ import { createSignal, subscribe, defineSignal, Signals, addToTransaction, entan
|
|
|
2
2
|
import { getOrSetGlobal } from '@warp-drive/core-types/-private';
|
|
3
3
|
import { STRUCTURED } from '@warp-drive/core-types/request';
|
|
4
4
|
import { RecordStore } from '@warp-drive/core-types/symbols';
|
|
5
|
-
import { S as SOURCE, A as ARRAY_SIGNAL,
|
|
5
|
+
import { S as SOURCE, A as ARRAY_SIGNAL, I as Identifier, E as Editable, L as Legacy, O as OBJECT_SIGNAL, D as Destroy, P as Parent, C as Checkout, a as EmbeddedPath, b as EmbeddedType } from "./symbols-DqoS4ybV.js";
|
|
6
6
|
import { macroCondition, getGlobalConfig } from '@embroider/macros';
|
|
7
7
|
const ARRAY_GETTER_METHODS = new Set([Symbol.iterator, 'concat', 'entries', 'every', 'fill', 'filter', 'find', 'findIndex', 'flat', 'flatMap', 'forEach', 'includes', 'indexOf', 'join', 'keys', 'lastIndexOf', 'map', 'reduce', 'reduceRight', 'slice', 'some', 'values']);
|
|
8
8
|
// const ARRAY_SETTER_METHODS = new Set<KeyType>(['push', 'pop', 'unshift', 'shift', 'splice', 'sort']);
|
|
@@ -48,7 +48,7 @@ function safeForEach(instance, arr, store, callback, target) {
|
|
|
48
48
|
}
|
|
49
49
|
class ManagedArray {
|
|
50
50
|
[SOURCE];
|
|
51
|
-
constructor(store, schema, cache, field, data, address,
|
|
51
|
+
constructor(store, schema, cache, field, data, address, path, owner, isSchemaArray) {
|
|
52
52
|
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
53
53
|
const self = this;
|
|
54
54
|
this[SOURCE] = data?.slice();
|
|
@@ -56,9 +56,19 @@ class ManagedArray {
|
|
|
56
56
|
const _SIGNAL = this[ARRAY_SIGNAL];
|
|
57
57
|
const boundFns = new Map();
|
|
58
58
|
this.address = address;
|
|
59
|
-
this.
|
|
59
|
+
this.path = path;
|
|
60
60
|
this.owner = owner;
|
|
61
61
|
let transaction = false;
|
|
62
|
+
const mode = field.options?.key ?? '@identity';
|
|
63
|
+
const RefStorage = mode === '@identity' ? WeakMap :
|
|
64
|
+
// CAUTION CAUTION CAUTION
|
|
65
|
+
// this is a pile of lies
|
|
66
|
+
// the Map is Map<string, WeakRef<SchemaRecord>>
|
|
67
|
+
// but TS does not understand how to juggle modes like this
|
|
68
|
+
// internal to a method like ours without us duplicating the code
|
|
69
|
+
// into two separate methods.
|
|
70
|
+
Map;
|
|
71
|
+
const ManagedRecordRefs = isSchemaArray ? new RefStorage() : null;
|
|
62
72
|
const proxy = new Proxy(this[SOURCE], {
|
|
63
73
|
get(target, prop, receiver) {
|
|
64
74
|
if (prop === ARRAY_SIGNAL) {
|
|
@@ -67,9 +77,6 @@ class ManagedArray {
|
|
|
67
77
|
if (prop === 'address') {
|
|
68
78
|
return self.address;
|
|
69
79
|
}
|
|
70
|
-
if (prop === 'key') {
|
|
71
|
-
return self.key;
|
|
72
|
-
}
|
|
73
80
|
if (prop === 'owner') {
|
|
74
81
|
return self.owner;
|
|
75
82
|
}
|
|
@@ -77,14 +84,82 @@ class ManagedArray {
|
|
|
77
84
|
if (_SIGNAL.shouldReset && (index !== null || SYNC_PROPS.has(prop) || isArrayGetter(prop))) {
|
|
78
85
|
_SIGNAL.t = false;
|
|
79
86
|
_SIGNAL.shouldReset = false;
|
|
80
|
-
const newData = cache.getAttr(
|
|
87
|
+
const newData = cache.getAttr(address, path);
|
|
81
88
|
if (newData && newData !== self[SOURCE]) {
|
|
82
89
|
self[SOURCE].length = 0;
|
|
83
90
|
self[SOURCE].push(...newData);
|
|
84
91
|
}
|
|
85
92
|
}
|
|
86
93
|
if (index !== null) {
|
|
87
|
-
|
|
94
|
+
let val;
|
|
95
|
+
if (mode === '@hash') {
|
|
96
|
+
val = target[index];
|
|
97
|
+
const hashField = schema.resource({
|
|
98
|
+
type: field.type
|
|
99
|
+
}).identity;
|
|
100
|
+
const hashFn = schema.hashFn(hashField);
|
|
101
|
+
val = hashFn(val, null, null);
|
|
102
|
+
} else {
|
|
103
|
+
// if mode is not @identity or @index, then access the key path.
|
|
104
|
+
// we should assert that `mode` is a string
|
|
105
|
+
// it should read directly from the cache value for that field (e.g. no derivation, no transformation)
|
|
106
|
+
// and, we likely should lookup the associated field and throw an error IF
|
|
107
|
+
// the given field does not exist OR
|
|
108
|
+
// the field is anything other than a GenericField or LegacyAttributeField.
|
|
109
|
+
if (mode !== '@identity' && mode !== '@index') {
|
|
110
|
+
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
111
|
+
if (!test) {
|
|
112
|
+
throw new Error('mode must be a string');
|
|
113
|
+
}
|
|
114
|
+
})(typeof mode === 'string') : {};
|
|
115
|
+
const modeField = schema.resource({
|
|
116
|
+
type: field.type
|
|
117
|
+
}).fields.find(f => f.name === mode);
|
|
118
|
+
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
119
|
+
if (!test) {
|
|
120
|
+
throw new Error('field must exist in schema');
|
|
121
|
+
}
|
|
122
|
+
})(modeField) : {};
|
|
123
|
+
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
124
|
+
if (!test) {
|
|
125
|
+
throw new Error('field must be a GenericField or LegacyAttributeField');
|
|
126
|
+
}
|
|
127
|
+
})(modeField.kind === 'field' || modeField.kind === 'attribute') : {};
|
|
128
|
+
}
|
|
129
|
+
val = mode === '@identity' ? target[index] : mode === '@index' ? '@index' : target[index][mode];
|
|
130
|
+
}
|
|
131
|
+
if (isSchemaArray) {
|
|
132
|
+
if (!transaction) {
|
|
133
|
+
subscribe(_SIGNAL);
|
|
134
|
+
}
|
|
135
|
+
if (val) {
|
|
136
|
+
const recordRef = ManagedRecordRefs.get(val);
|
|
137
|
+
let record = recordRef?.deref();
|
|
138
|
+
if (!record) {
|
|
139
|
+
const recordPath = path.slice();
|
|
140
|
+
// this is a dirty lie since path is string[] but really we
|
|
141
|
+
// should change the types for paths to `Array<string | number>`
|
|
142
|
+
// TODO we should allow the schema for the field to define a "key"
|
|
143
|
+
// for stability. Default should be `@identity` which means that
|
|
144
|
+
// same object reference from cache should result in same SchemaRecord
|
|
145
|
+
// embedded object.
|
|
146
|
+
recordPath.push(index);
|
|
147
|
+
record = new SchemaRecord(store, self.owner[Identifier], {
|
|
148
|
+
[Editable]: self.owner[Editable],
|
|
149
|
+
[Legacy]: self.owner[Legacy]
|
|
150
|
+
}, true, field.type, recordPath);
|
|
151
|
+
// if mode is not @identity or @index, then access the key path now
|
|
152
|
+
// to determine the key value.
|
|
153
|
+
// chris says we can implement this as a special kind `@hash` which
|
|
154
|
+
// would be a function that only has access to the cache value and not
|
|
155
|
+
// the record itself, so derivation is possible but intentionally limited
|
|
156
|
+
// and non-reactive?
|
|
157
|
+
ManagedRecordRefs.set(val, new WeakRef(record));
|
|
158
|
+
}
|
|
159
|
+
return record;
|
|
160
|
+
}
|
|
161
|
+
return val;
|
|
162
|
+
}
|
|
88
163
|
if (!transaction) {
|
|
89
164
|
subscribe(_SIGNAL);
|
|
90
165
|
}
|
|
@@ -128,11 +203,6 @@ class ManagedArray {
|
|
|
128
203
|
self.address = value;
|
|
129
204
|
return true;
|
|
130
205
|
}
|
|
131
|
-
if (prop === 'key') {
|
|
132
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
133
|
-
self.key = value;
|
|
134
|
-
return true;
|
|
135
|
-
}
|
|
136
206
|
if (prop === 'owner') {
|
|
137
207
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
138
208
|
self.owner = value;
|
|
@@ -141,13 +211,19 @@ class ManagedArray {
|
|
|
141
211
|
const reflect = Reflect.set(target, prop, value, receiver);
|
|
142
212
|
if (reflect) {
|
|
143
213
|
if (!field.type) {
|
|
144
|
-
cache.setAttr(
|
|
214
|
+
cache.setAttr(address, path, self[SOURCE]);
|
|
145
215
|
_SIGNAL.shouldReset = true;
|
|
146
216
|
return true;
|
|
147
217
|
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
218
|
+
let rawValue = self[SOURCE];
|
|
219
|
+
if (!isSchemaArray) {
|
|
220
|
+
const transform = schema.transformation(field);
|
|
221
|
+
if (!transform) {
|
|
222
|
+
throw new Error(`No '${field.type}' transform defined for use by ${address.type}.${String(prop)}`);
|
|
223
|
+
}
|
|
224
|
+
rawValue = self[SOURCE].map(item => transform.serialize(item, field.options ?? null, self.owner));
|
|
225
|
+
}
|
|
226
|
+
cache.setAttr(address, path, rawValue);
|
|
151
227
|
_SIGNAL.shouldReset = true;
|
|
152
228
|
}
|
|
153
229
|
return reflect;
|
|
@@ -240,8 +316,8 @@ class ManagedObject {
|
|
|
240
316
|
return proxy;
|
|
241
317
|
}
|
|
242
318
|
}
|
|
243
|
-
const IgnoredGlobalFields = new Set(['then', STRUCTURED]);
|
|
244
|
-
const symbolList = [Destroy, RecordStore, Identifier, Editable, Parent, Checkout, Legacy, Signals];
|
|
319
|
+
const IgnoredGlobalFields = new Set(['length', 'nodeType', 'then', 'setInterval', STRUCTURED]);
|
|
320
|
+
const symbolList = [Destroy, RecordStore, Identifier, Editable, Parent, Checkout, Legacy, Signals, EmbeddedPath, EmbeddedType];
|
|
245
321
|
const RecordSymbols = new Set(symbolList);
|
|
246
322
|
const ManagedArrayMap = getOrSetGlobal('ManagedArrayMap', new Map());
|
|
247
323
|
const ManagedObjectMap = getOrSetGlobal('ManagedObjectMap', new Map());
|
|
@@ -273,7 +349,7 @@ function computeField(schema, cache, record, identifier, field, prop) {
|
|
|
273
349
|
const transform = schema.transformation(field);
|
|
274
350
|
return transform.hydrate(rawValue, field.options ?? null, record);
|
|
275
351
|
}
|
|
276
|
-
function computeArray(store, schema, cache, record, identifier, field,
|
|
352
|
+
function computeArray(store, schema, cache, record, identifier, field, path, isSchemaArray = false) {
|
|
277
353
|
// the thing we hand out needs to know its owner and path in a private manner
|
|
278
354
|
// its "address" is the parent identifier (identifier) + field name (field.name)
|
|
279
355
|
// in the nested object case field name here is the full dot path from root resource to this value
|
|
@@ -288,11 +364,11 @@ function computeArray(store, schema, cache, record, identifier, field, prop) {
|
|
|
288
364
|
if (managedArray) {
|
|
289
365
|
return managedArray;
|
|
290
366
|
} else {
|
|
291
|
-
const rawValue = cache.getAttr(identifier,
|
|
367
|
+
const rawValue = cache.getAttr(identifier, path);
|
|
292
368
|
if (!rawValue) {
|
|
293
369
|
return null;
|
|
294
370
|
}
|
|
295
|
-
managedArray = new ManagedArray(store, schema, cache, field, rawValue, identifier,
|
|
371
|
+
managedArray = new ManagedArray(store, schema, cache, field, rawValue, identifier, path, record, isSchemaArray);
|
|
296
372
|
if (!managedArrayMapForRecord) {
|
|
297
373
|
ManagedArrayMap.set(record, new Map([[field, managedArray]]));
|
|
298
374
|
} else {
|
|
@@ -373,6 +449,9 @@ class ResourceRelationship {
|
|
|
373
449
|
defineSignal(ResourceRelationship.prototype, 'data');
|
|
374
450
|
defineSignal(ResourceRelationship.prototype, 'links');
|
|
375
451
|
defineSignal(ResourceRelationship.prototype, 'meta');
|
|
452
|
+
function isPathMatch(a, b) {
|
|
453
|
+
return a.length === b.length && a.every((v, i) => v === b[i]);
|
|
454
|
+
}
|
|
376
455
|
function getHref(link) {
|
|
377
456
|
if (!link) {
|
|
378
457
|
return null;
|
|
@@ -389,34 +468,70 @@ function computeResource(store, cache, parent, identifier, field, prop) {
|
|
|
389
468
|
return new ResourceRelationship(store, cache, parent, identifier, field, prop);
|
|
390
469
|
}
|
|
391
470
|
class SchemaRecord {
|
|
392
|
-
constructor(store, identifier, Mode) {
|
|
471
|
+
constructor(store, identifier, Mode, isEmbedded = false, embeddedType = null, embeddedPath = null) {
|
|
393
472
|
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
394
473
|
const self = this;
|
|
395
474
|
this[RecordStore] = store;
|
|
396
|
-
|
|
475
|
+
if (isEmbedded) {
|
|
476
|
+
this[Parent] = identifier;
|
|
477
|
+
} else {
|
|
478
|
+
this[Identifier] = identifier;
|
|
479
|
+
}
|
|
397
480
|
const IS_EDITABLE = this[Editable] = Mode[Editable] ?? false;
|
|
398
481
|
this[Legacy] = Mode[Legacy] ?? false;
|
|
399
482
|
const schema = store.schema;
|
|
400
483
|
const cache = store.cache;
|
|
401
484
|
const identityField = schema.resource(identifier).identity;
|
|
402
|
-
|
|
485
|
+
this[EmbeddedType] = embeddedType;
|
|
486
|
+
this[EmbeddedPath] = embeddedPath;
|
|
487
|
+
let fields;
|
|
488
|
+
if (isEmbedded) {
|
|
489
|
+
fields = schema.fields({
|
|
490
|
+
type: embeddedType
|
|
491
|
+
});
|
|
492
|
+
} else {
|
|
493
|
+
fields = schema.fields(identifier);
|
|
494
|
+
}
|
|
403
495
|
const signals = new Map();
|
|
404
496
|
this[Signals] = signals;
|
|
497
|
+
// what signal do we need for embedded record?
|
|
405
498
|
this.___notifications = store.notifications.subscribe(identifier, (_, type, key) => {
|
|
406
499
|
switch (type) {
|
|
407
500
|
case 'attributes':
|
|
408
501
|
if (key) {
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
502
|
+
if (Array.isArray(key)) {
|
|
503
|
+
if (!isEmbedded) return; // deep paths will be handled by embedded records
|
|
504
|
+
// TODO we should have the notification manager
|
|
505
|
+
// ensure it is safe for each callback to mutate this array
|
|
506
|
+
if (isPathMatch(embeddedPath, key)) {
|
|
507
|
+
// handle the notification
|
|
508
|
+
// TODO we should likely handle this notification here
|
|
509
|
+
// also we should add a LOGGING flag
|
|
510
|
+
// eslint-disable-next-line no-console
|
|
511
|
+
console.warn(`Notification unhandled for ${key.join(',')} on ${identifier.type}`, self);
|
|
512
|
+
return;
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
// TODO we should add a LOGGING flag
|
|
516
|
+
// console.log(`Deep notification skipped for ${key.join('.')} on ${identifier.type}`, self);
|
|
517
|
+
// deep notify the key path
|
|
518
|
+
} else {
|
|
519
|
+
if (isEmbedded) return; // base paths never apply to embedded records
|
|
520
|
+
|
|
521
|
+
// TODO determine what LOGGING flag to wrap this in if any
|
|
522
|
+
// console.log(`Notification for ${key} on ${identifier.type}`, self);
|
|
523
|
+
const signal = signals.get(key);
|
|
524
|
+
if (signal) {
|
|
525
|
+
addToTransaction(signal);
|
|
526
|
+
}
|
|
527
|
+
const field = fields.get(key);
|
|
528
|
+
if (field?.kind === 'array' || field?.kind === 'schema-array') {
|
|
529
|
+
const peeked = peekManagedArray(self, field);
|
|
530
|
+
if (peeked) {
|
|
531
|
+
const arrSignal = peeked[ARRAY_SIGNAL];
|
|
532
|
+
arrSignal.shouldReset = true;
|
|
533
|
+
addToTransaction(arrSignal);
|
|
534
|
+
}
|
|
420
535
|
}
|
|
421
536
|
}
|
|
422
537
|
}
|
|
@@ -424,10 +539,54 @@ class SchemaRecord {
|
|
|
424
539
|
}
|
|
425
540
|
});
|
|
426
541
|
return new Proxy(this, {
|
|
542
|
+
ownKeys() {
|
|
543
|
+
return Array.from(fields.keys());
|
|
544
|
+
},
|
|
545
|
+
has(target, prop) {
|
|
546
|
+
return fields.has(prop);
|
|
547
|
+
},
|
|
548
|
+
getOwnPropertyDescriptor(target, prop) {
|
|
549
|
+
if (!fields.has(prop)) {
|
|
550
|
+
throw new Error(`No field named ${String(prop)} on ${identifier.type}`);
|
|
551
|
+
}
|
|
552
|
+
const schemaForField = fields.get(prop);
|
|
553
|
+
switch (schemaForField.kind) {
|
|
554
|
+
case 'derived':
|
|
555
|
+
return {
|
|
556
|
+
writable: false,
|
|
557
|
+
enumerable: true,
|
|
558
|
+
configurable: true
|
|
559
|
+
};
|
|
560
|
+
case '@local':
|
|
561
|
+
case 'field':
|
|
562
|
+
case 'attribute':
|
|
563
|
+
case 'resource':
|
|
564
|
+
case 'schema-array':
|
|
565
|
+
case 'array':
|
|
566
|
+
case 'schema-object':
|
|
567
|
+
case 'object':
|
|
568
|
+
return {
|
|
569
|
+
writable: IS_EDITABLE,
|
|
570
|
+
enumerable: true,
|
|
571
|
+
configurable: true
|
|
572
|
+
};
|
|
573
|
+
}
|
|
574
|
+
},
|
|
427
575
|
get(target, prop, receiver) {
|
|
428
576
|
if (RecordSymbols.has(prop)) {
|
|
429
577
|
return target[prop];
|
|
430
578
|
}
|
|
579
|
+
if (prop === Symbol.toStringTag) {
|
|
580
|
+
return `SchemaRecord<${identifier.type}:${identifier.id} (${identifier.lid})>`;
|
|
581
|
+
}
|
|
582
|
+
if (prop === 'toString') {
|
|
583
|
+
return function () {
|
|
584
|
+
return `SchemaRecord<${identifier.type}:${identifier.id} (${identifier.lid})>`;
|
|
585
|
+
};
|
|
586
|
+
}
|
|
587
|
+
if (prop === Symbol.toPrimitive) {
|
|
588
|
+
return null;
|
|
589
|
+
}
|
|
431
590
|
if (prop === '___notifications') {
|
|
432
591
|
return target.___notifications;
|
|
433
592
|
}
|
|
@@ -436,11 +595,20 @@ class SchemaRecord {
|
|
|
436
595
|
// for its own usage.
|
|
437
596
|
// _, @, $, *
|
|
438
597
|
|
|
598
|
+
const propArray = isEmbedded ? embeddedPath.slice() : [];
|
|
599
|
+
propArray.push(prop);
|
|
439
600
|
const field = prop === identityField?.name ? identityField : fields.get(prop);
|
|
440
601
|
if (!field) {
|
|
441
602
|
if (IgnoredGlobalFields.has(prop)) {
|
|
442
603
|
return undefined;
|
|
443
604
|
}
|
|
605
|
+
if (prop === 'constructor') {
|
|
606
|
+
return SchemaRecord;
|
|
607
|
+
}
|
|
608
|
+
// too many things check for random symbols
|
|
609
|
+
if (typeof prop === 'symbol') {
|
|
610
|
+
return undefined;
|
|
611
|
+
}
|
|
444
612
|
throw new Error(`No field named ${String(prop)} on ${identifier.type}`);
|
|
445
613
|
}
|
|
446
614
|
switch (field.kind) {
|
|
@@ -463,7 +631,7 @@ class SchemaRecord {
|
|
|
463
631
|
}
|
|
464
632
|
})(!target[Legacy]) : {};
|
|
465
633
|
entangleSignal(signals, receiver, field.name);
|
|
466
|
-
return computeField(schema, cache, target, identifier, field,
|
|
634
|
+
return computeField(schema, cache, target, identifier, field, propArray);
|
|
467
635
|
case 'attribute':
|
|
468
636
|
entangleSignal(signals, receiver, field.name);
|
|
469
637
|
return computeAttribute(cache, identifier, prop);
|
|
@@ -478,7 +646,8 @@ class SchemaRecord {
|
|
|
478
646
|
case 'derived':
|
|
479
647
|
return computeDerivation(schema, receiver, identifier, field, prop);
|
|
480
648
|
case 'schema-array':
|
|
481
|
-
|
|
649
|
+
entangleSignal(signals, receiver, field.name);
|
|
650
|
+
return computeArray(store, schema, cache, target, identifier, field, propArray, true);
|
|
482
651
|
case 'array':
|
|
483
652
|
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
484
653
|
if (!test) {
|
|
@@ -486,7 +655,7 @@ class SchemaRecord {
|
|
|
486
655
|
}
|
|
487
656
|
})(!target[Legacy]) : {};
|
|
488
657
|
entangleSignal(signals, receiver, field.name);
|
|
489
|
-
return computeArray(store, schema, cache, target, identifier, field,
|
|
658
|
+
return computeArray(store, schema, cache, target, identifier, field, propArray);
|
|
490
659
|
case 'schema-object':
|
|
491
660
|
// validate any access off of schema, no transform to run
|
|
492
661
|
// use raw cache value as the object to manage
|
|
@@ -508,6 +677,8 @@ class SchemaRecord {
|
|
|
508
677
|
if (!IS_EDITABLE) {
|
|
509
678
|
throw new Error(`Cannot set ${String(prop)} on ${identifier.type} because the record is not editable`);
|
|
510
679
|
}
|
|
680
|
+
const propArray = isEmbedded ? embeddedPath.slice() : [];
|
|
681
|
+
propArray.push(prop);
|
|
511
682
|
const field = fields.get(prop);
|
|
512
683
|
if (!field) {
|
|
513
684
|
throw new Error(`There is no field named ${String(prop)} on ${identifier.type}`);
|
|
@@ -525,23 +696,23 @@ class SchemaRecord {
|
|
|
525
696
|
case 'field':
|
|
526
697
|
{
|
|
527
698
|
if (!field.type) {
|
|
528
|
-
cache.setAttr(identifier,
|
|
699
|
+
cache.setAttr(identifier, propArray, value);
|
|
529
700
|
return true;
|
|
530
701
|
}
|
|
531
702
|
const transform = schema.transformation(field);
|
|
532
703
|
const rawValue = transform.serialize(value, field.options ?? null, target);
|
|
533
|
-
cache.setAttr(identifier,
|
|
704
|
+
cache.setAttr(identifier, propArray, rawValue);
|
|
534
705
|
return true;
|
|
535
706
|
}
|
|
536
707
|
case 'attribute':
|
|
537
708
|
{
|
|
538
|
-
cache.setAttr(identifier,
|
|
709
|
+
cache.setAttr(identifier, propArray, value);
|
|
539
710
|
return true;
|
|
540
711
|
}
|
|
541
712
|
case 'array':
|
|
542
713
|
{
|
|
543
714
|
if (!field.type) {
|
|
544
|
-
cache.setAttr(identifier,
|
|
715
|
+
cache.setAttr(identifier, propArray, value?.slice());
|
|
545
716
|
const peeked = peekManagedArray(self, field);
|
|
546
717
|
if (peeked) {
|
|
547
718
|
const arrSignal = peeked[ARRAY_SIGNAL];
|
|
@@ -554,7 +725,7 @@ class SchemaRecord {
|
|
|
554
725
|
}
|
|
555
726
|
const transform = schema.transformation(field);
|
|
556
727
|
const rawValue = value.map(item => transform.serialize(item, field.options ?? null, target));
|
|
557
|
-
cache.setAttr(identifier,
|
|
728
|
+
cache.setAttr(identifier, propArray, rawValue);
|
|
558
729
|
const peeked = peekManagedArray(self, field);
|
|
559
730
|
if (peeked) {
|
|
560
731
|
const arrSignal = peeked[ARRAY_SIGNAL];
|
|
@@ -562,6 +733,23 @@ class SchemaRecord {
|
|
|
562
733
|
}
|
|
563
734
|
return true;
|
|
564
735
|
}
|
|
736
|
+
case 'schema-array':
|
|
737
|
+
{
|
|
738
|
+
const arrayValue = value?.slice();
|
|
739
|
+
if (!Array.isArray(arrayValue)) {
|
|
740
|
+
ManagedArrayMap.delete(target);
|
|
741
|
+
}
|
|
742
|
+
cache.setAttr(identifier, propArray, arrayValue);
|
|
743
|
+
const peeked = peekManagedArray(self, field);
|
|
744
|
+
if (peeked) {
|
|
745
|
+
const arrSignal = peeked[ARRAY_SIGNAL];
|
|
746
|
+
arrSignal.shouldReset = true;
|
|
747
|
+
}
|
|
748
|
+
if (!Array.isArray(value)) {
|
|
749
|
+
ManagedArrayMap.delete(target);
|
|
750
|
+
}
|
|
751
|
+
return true;
|
|
752
|
+
}
|
|
565
753
|
case 'object':
|
|
566
754
|
{
|
|
567
755
|
if (!field.type) {
|
|
@@ -573,7 +761,7 @@ class SchemaRecord {
|
|
|
573
761
|
} else {
|
|
574
762
|
ManagedObjectMap.delete(target);
|
|
575
763
|
}
|
|
576
|
-
cache.setAttr(identifier,
|
|
764
|
+
cache.setAttr(identifier, propArray, newValue);
|
|
577
765
|
const peeked = peekManagedObject(self, field);
|
|
578
766
|
if (peeked) {
|
|
579
767
|
const objSignal = peeked[OBJECT_SIGNAL];
|
|
@@ -585,7 +773,7 @@ class SchemaRecord {
|
|
|
585
773
|
const rawValue = transform.serialize({
|
|
586
774
|
...value
|
|
587
775
|
}, field.options ?? null, target);
|
|
588
|
-
cache.setAttr(identifier,
|
|
776
|
+
cache.setAttr(identifier, propArray, rawValue);
|
|
589
777
|
const peeked = peekManagedObject(self, field);
|
|
590
778
|
if (peeked) {
|
|
591
779
|
const objSignal = peeked[OBJECT_SIGNAL];
|
package/dist/record.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"record.js","sources":["../src/managed-array.ts","../src/managed-object.ts","../src/record.ts"],"sourcesContent":["import type Store from '@ember-data/store';\nimport type { Signal } from '@ember-data/tracking/-private';\nimport { addToTransaction, createSignal, subscribe } from '@ember-data/tracking/-private';\nimport { assert } from '@warp-drive/build-config/macros';\nimport type { StableRecordIdentifier } from '@warp-drive/core-types';\nimport type { Cache } from '@warp-drive/core-types/cache';\nimport type { ArrayValue, Value } from '@warp-drive/core-types/json/raw';\nimport type { OpaqueRecordInstance } from '@warp-drive/core-types/record';\nimport type { ArrayField } from '@warp-drive/core-types/schema/fields';\n\nimport type { SchemaRecord } from './record';\nimport type { SchemaService } from './schema';\nimport { ARRAY_SIGNAL, MUTATE, SOURCE } from './symbols';\n\nexport function notifyArray(arr: ManagedArray) {\n addToTransaction(arr[ARRAY_SIGNAL]);\n}\n\ntype KeyType = string | symbol | number;\nconst ARRAY_GETTER_METHODS = new Set<KeyType>([\n Symbol.iterator,\n 'concat',\n 'entries',\n 'every',\n 'fill',\n 'filter',\n 'find',\n 'findIndex',\n 'flat',\n 'flatMap',\n 'forEach',\n 'includes',\n 'indexOf',\n 'join',\n 'keys',\n 'lastIndexOf',\n 'map',\n 'reduce',\n 'reduceRight',\n 'slice',\n 'some',\n 'values',\n]);\n// const ARRAY_SETTER_METHODS = new Set<KeyType>(['push', 'pop', 'unshift', 'shift', 'splice', 'sort']);\nconst SYNC_PROPS = new Set<KeyType>(['[]', 'length']);\nfunction isArrayGetter<T>(prop: KeyType): prop is keyof Array<T> {\n return ARRAY_GETTER_METHODS.has(prop);\n}\n// function isArraySetter<T>(prop: KeyType): prop is keyof Array<T> {\n// return ARRAY_SETTER_METHODS.has(prop);\n// }\n// function isSelfProp<T extends object>(self: T, prop: KeyType): prop is keyof T {\n// return prop in self;\n// }\n\nfunction convertToInt(prop: KeyType): number | null {\n if (typeof prop === 'symbol') return null;\n\n const num = Number(prop);\n\n if (isNaN(num)) return null;\n\n return num % 1 === 0 ? num : null;\n}\n\ntype ProxiedMethod = (...args: unknown[]) => unknown;\n\ntype ForEachCB = (record: OpaqueRecordInstance, index: number, context: typeof Proxy<unknown[]>) => void;\nfunction safeForEach(\n instance: typeof Proxy<unknown[]>,\n arr: unknown[],\n store: Store,\n callback: ForEachCB,\n target: unknown\n) {\n if (target === undefined) {\n target = null;\n }\n // clone to prevent mutation\n arr = arr.slice();\n assert('`forEach` expects a function as first argument.', typeof callback === 'function');\n\n // because we retrieveLatest above we need not worry if array is mutated during iteration\n // by unloadRecord/rollbackAttributes\n // push/add/removeObject may still be problematic\n // but this is a more traditionally expected forEach bug.\n const length = arr.length; // we need to access length to ensure we are consumed\n\n for (let index = 0; index < length; index++) {\n callback.call(target, arr[index], index, instance);\n }\n\n return instance;\n}\n\nexport interface ManagedArray extends Omit<Array<unknown>, '[]'> {\n [MUTATE]?(\n target: unknown[],\n receiver: typeof Proxy<unknown[]>,\n prop: string,\n args: unknown[],\n _SIGNAL: Signal\n ): unknown;\n}\n\nexport class ManagedArray {\n [SOURCE]: unknown[];\n declare address: StableRecordIdentifier;\n declare key: string;\n declare owner: SchemaRecord;\n declare [ARRAY_SIGNAL]: Signal;\n\n constructor(\n store: Store,\n schema: SchemaService,\n cache: Cache,\n field: ArrayField,\n data: unknown[],\n address: StableRecordIdentifier,\n key: string,\n owner: SchemaRecord\n ) {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const self = this;\n this[SOURCE] = data?.slice();\n this[ARRAY_SIGNAL] = createSignal(this, 'length');\n const _SIGNAL = this[ARRAY_SIGNAL];\n const boundFns = new Map<KeyType, ProxiedMethod>();\n this.address = address;\n this.key = key;\n this.owner = owner;\n let transaction = false;\n\n const proxy = new Proxy(this[SOURCE], {\n get<R extends typeof Proxy<unknown[]>>(target: unknown[], prop: keyof R, receiver: R) {\n if (prop === ARRAY_SIGNAL) {\n return _SIGNAL;\n }\n if (prop === 'address') {\n return self.address;\n }\n if (prop === 'key') {\n return self.key;\n }\n if (prop === 'owner') {\n return self.owner;\n }\n\n const index = convertToInt(prop);\n if (_SIGNAL.shouldReset && (index !== null || SYNC_PROPS.has(prop) || isArrayGetter(prop))) {\n _SIGNAL.t = false;\n _SIGNAL.shouldReset = false;\n const newData = cache.getAttr(self.address, self.key);\n if (newData && newData !== self[SOURCE]) {\n self[SOURCE].length = 0;\n self[SOURCE].push(...(newData as ArrayValue));\n }\n }\n\n if (index !== null) {\n const val = target[index];\n if (!transaction) {\n subscribe(_SIGNAL);\n }\n if (field.type) {\n const transform = schema.transformation(field);\n return transform.hydrate(val as Value, field.options ?? null, self.owner);\n }\n return val;\n }\n\n if (isArrayGetter(prop)) {\n let fn = boundFns.get(prop);\n\n if (fn === undefined) {\n if (prop === 'forEach') {\n fn = function () {\n subscribe(_SIGNAL);\n transaction = true;\n const result = safeForEach(receiver, target, store, arguments[0] as ForEachCB, arguments[1]);\n transaction = false;\n return result;\n };\n } else {\n fn = function () {\n subscribe(_SIGNAL);\n // array functions must run through Reflect to work properly\n // binding via other means will not work.\n transaction = true;\n const result = Reflect.apply(target[prop] as ProxiedMethod, receiver, arguments) as unknown;\n transaction = false;\n return result;\n };\n }\n boundFns.set(prop, fn);\n }\n return fn;\n }\n\n return Reflect.get(target, prop, receiver);\n },\n set(target, prop: KeyType, value, receiver) {\n if (prop === 'address') {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n self.address = value;\n return true;\n }\n if (prop === 'key') {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n self.key = value;\n return true;\n }\n if (prop === 'owner') {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n self.owner = value;\n return true;\n }\n const reflect = Reflect.set(target, prop, value, receiver);\n\n if (reflect) {\n if (!field.type) {\n cache.setAttr(self.address, self.key, self[SOURCE] as Value);\n _SIGNAL.shouldReset = true;\n return true;\n }\n\n const transform = schema.transformation(field);\n const rawValue = (self[SOURCE] as ArrayValue).map((item) =>\n transform.serialize(item, field.options ?? null, self.owner)\n );\n cache.setAttr(self.address, self.key, rawValue as Value);\n _SIGNAL.shouldReset = true;\n }\n return reflect;\n },\n }) as ManagedArray;\n\n return proxy;\n }\n}\n","import type Store from '@ember-data/store';\nimport type { Signal } from '@ember-data/tracking/-private';\nimport { addToTransaction, createSignal, subscribe } from '@ember-data/tracking/-private';\nimport type { StableRecordIdentifier } from '@warp-drive/core-types';\nimport type { Cache } from '@warp-drive/core-types/cache';\nimport type { ObjectValue, Value } from '@warp-drive/core-types/json/raw';\nimport type { ObjectField } from '@warp-drive/core-types/schema/fields';\n\nimport type { SchemaRecord } from './record';\nimport type { SchemaService } from './schema';\nimport { MUTATE, OBJECT_SIGNAL, SOURCE } from './symbols';\n\nexport function notifyObject(obj: ManagedObject) {\n addToTransaction(obj[OBJECT_SIGNAL]);\n}\n\ntype KeyType = string | symbol | number;\n\nexport interface ManagedObject {\n [MUTATE]?(\n target: unknown[],\n receiver: typeof Proxy<unknown[]>,\n prop: string,\n args: unknown[],\n _SIGNAL: Signal\n ): unknown;\n}\n\nexport class ManagedObject {\n [SOURCE]: object;\n declare address: StableRecordIdentifier;\n declare key: string;\n declare owner: SchemaRecord;\n declare [OBJECT_SIGNAL]: Signal;\n\n constructor(\n store: Store,\n schema: SchemaService,\n cache: Cache,\n field: ObjectField,\n data: object,\n address: StableRecordIdentifier,\n key: string,\n owner: SchemaRecord\n ) {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const self = this;\n this[SOURCE] = { ...data };\n this[OBJECT_SIGNAL] = createSignal(this, 'length');\n const _SIGNAL = this[OBJECT_SIGNAL];\n // const boundFns = new Map<KeyType, ProxiedMethod>();\n this.address = address;\n this.key = key;\n this.owner = owner;\n const transaction = false;\n\n const proxy = new Proxy(this[SOURCE], {\n get<R extends typeof Proxy<object>>(target: object, prop: keyof R, receiver: R) {\n if (prop === OBJECT_SIGNAL) {\n return _SIGNAL;\n }\n if (prop === 'address') {\n return self.address;\n }\n if (prop === 'key') {\n return self.key;\n }\n if (prop === 'owner') {\n return self.owner;\n }\n\n if (_SIGNAL.shouldReset) {\n _SIGNAL.t = false;\n _SIGNAL.shouldReset = false;\n let newData = cache.getAttr(self.address, self.key);\n if (newData && newData !== self[SOURCE]) {\n if (field.type) {\n const transform = schema.transformation(field);\n newData = transform.hydrate(newData as ObjectValue, field.options ?? null, self.owner) as ObjectValue;\n }\n self[SOURCE] = { ...(newData as ObjectValue) }; // Add type assertion for newData\n }\n }\n\n if (prop in self[SOURCE]) {\n if (!transaction) {\n subscribe(_SIGNAL);\n }\n\n return (self[SOURCE] as R)[prop];\n }\n return Reflect.get(target, prop, receiver) as R;\n },\n\n set(target, prop: KeyType, value, receiver) {\n if (prop === 'address') {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n self.address = value;\n return true;\n }\n if (prop === 'key') {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n self.key = value;\n return true;\n }\n if (prop === 'owner') {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n self.owner = value;\n return true;\n }\n const reflect = Reflect.set(target, prop, value, receiver);\n\n if (reflect) {\n if (!field.type) {\n cache.setAttr(self.address, self.key, self[SOURCE] as Value);\n _SIGNAL.shouldReset = true;\n return true;\n }\n\n const transform = schema.transformation(field);\n const val = transform.serialize(self[SOURCE], field.options ?? null, self.owner);\n cache.setAttr(self.address, self.key, val);\n _SIGNAL.shouldReset = true;\n }\n return reflect;\n },\n }) as ManagedObject;\n\n return proxy;\n }\n}\n","import type { Future } from '@ember-data/request';\nimport type Store from '@ember-data/store';\nimport type { NotificationType, StoreRequestInput } from '@ember-data/store';\nimport {\n addToTransaction,\n defineSignal,\n entangleSignal,\n getSignal,\n peekSignal,\n type Signal,\n Signals,\n} from '@ember-data/tracking/-private';\nimport { DEBUG } from '@warp-drive/build-config/env';\nimport { assert } from '@warp-drive/build-config/macros';\nimport type { StableRecordIdentifier } from '@warp-drive/core-types';\nimport { getOrSetGlobal } from '@warp-drive/core-types/-private';\nimport type { Cache } from '@warp-drive/core-types/cache';\nimport type { ResourceRelationship as SingleResourceRelationship } from '@warp-drive/core-types/cache/relationship';\nimport type { ArrayValue, ObjectValue, Value } from '@warp-drive/core-types/json/raw';\nimport { STRUCTURED } from '@warp-drive/core-types/request';\nimport type {\n ArrayField,\n DerivedField,\n FieldSchema,\n GenericField,\n LocalField,\n ObjectField,\n} from '@warp-drive/core-types/schema/fields';\nimport type { Link, Links } from '@warp-drive/core-types/spec/json-api-raw';\nimport { RecordStore } from '@warp-drive/core-types/symbols';\n\nimport { ManagedArray } from './managed-array';\nimport { ManagedObject } from './managed-object';\nimport type { SchemaService } from './schema';\nimport { ARRAY_SIGNAL, Checkout, Destroy, Editable, Identifier, Legacy, OBJECT_SIGNAL, Parent } from './symbols';\n\nexport { Editable, Legacy } from './symbols';\nconst IgnoredGlobalFields = new Set<string>(['then', STRUCTURED]);\nconst symbolList = [Destroy, RecordStore, Identifier, Editable, Parent, Checkout, Legacy, Signals];\nconst RecordSymbols = new Set(symbolList);\n\ntype RecordSymbol = (typeof symbolList)[number];\n\nconst ManagedArrayMap = getOrSetGlobal('ManagedArrayMap', new Map<SchemaRecord, Map<FieldSchema, ManagedArray>>());\nconst ManagedObjectMap = getOrSetGlobal('ManagedObjectMap', new Map<SchemaRecord, Map<FieldSchema, ManagedObject>>());\n\nfunction computeLocal(record: typeof Proxy<SchemaRecord>, field: LocalField, prop: string): unknown {\n let signal = peekSignal(record, prop);\n\n if (!signal) {\n signal = getSignal(record, prop, false);\n signal.lastValue = field.options?.defaultValue ?? null;\n }\n\n return signal.lastValue;\n}\n\nfunction peekManagedArray(record: SchemaRecord, field: FieldSchema): ManagedArray | undefined {\n const managedArrayMapForRecord = ManagedArrayMap.get(record);\n if (managedArrayMapForRecord) {\n return managedArrayMapForRecord.get(field);\n }\n}\n\nfunction peekManagedObject(record: SchemaRecord, field: FieldSchema): ManagedObject | undefined {\n const managedObjectMapForRecord = ManagedObjectMap.get(record);\n if (managedObjectMapForRecord) {\n return managedObjectMapForRecord.get(field);\n }\n}\n\nfunction computeField(\n schema: SchemaService,\n cache: Cache,\n record: SchemaRecord,\n identifier: StableRecordIdentifier,\n field: GenericField,\n prop: string\n): unknown {\n const rawValue = cache.getAttr(identifier, prop);\n if (!field.type) {\n return rawValue;\n }\n const transform = schema.transformation(field);\n return transform.hydrate(rawValue, field.options ?? null, record);\n}\n\nfunction computeArray(\n store: Store,\n schema: SchemaService,\n cache: Cache,\n record: SchemaRecord,\n identifier: StableRecordIdentifier,\n field: ArrayField,\n prop: string\n) {\n // the thing we hand out needs to know its owner and path in a private manner\n // its \"address\" is the parent identifier (identifier) + field name (field.name)\n // in the nested object case field name here is the full dot path from root resource to this value\n // its \"key\" is the field on the parent record\n // its \"owner\" is the parent record\n\n const managedArrayMapForRecord = ManagedArrayMap.get(record);\n let managedArray;\n if (managedArrayMapForRecord) {\n managedArray = managedArrayMapForRecord.get(field);\n }\n if (managedArray) {\n return managedArray;\n } else {\n const rawValue = cache.getAttr(identifier, prop) as unknown[];\n if (!rawValue) {\n return null;\n }\n managedArray = new ManagedArray(store, schema, cache, field, rawValue, identifier, prop, record);\n if (!managedArrayMapForRecord) {\n ManagedArrayMap.set(record, new Map([[field, managedArray]]));\n } else {\n managedArrayMapForRecord.set(field, managedArray);\n }\n }\n return managedArray;\n}\n\nfunction computeObject(\n store: Store,\n schema: SchemaService,\n cache: Cache,\n record: SchemaRecord,\n identifier: StableRecordIdentifier,\n field: ObjectField,\n prop: string\n) {\n const managedObjectMapForRecord = ManagedObjectMap.get(record);\n let managedObject;\n if (managedObjectMapForRecord) {\n managedObject = managedObjectMapForRecord.get(field);\n }\n if (managedObject) {\n return managedObject;\n } else {\n let rawValue = cache.getAttr(identifier, prop) as object;\n if (!rawValue) {\n return null;\n }\n if (field.kind === 'object') {\n if (field.type) {\n const transform = schema.transformation(field);\n rawValue = transform.hydrate(rawValue as ObjectValue, field.options ?? null, record) as object;\n }\n }\n managedObject = new ManagedObject(store, schema, cache, field, rawValue, identifier, prop, record);\n if (!managedObjectMapForRecord) {\n ManagedObjectMap.set(record, new Map([[field, managedObject]]));\n } else {\n managedObjectMapForRecord.set(field, managedObject);\n }\n }\n return managedObject;\n}\n\nfunction computeAttribute(cache: Cache, identifier: StableRecordIdentifier, prop: string): unknown {\n return cache.getAttr(identifier, prop);\n}\n\nfunction computeDerivation(\n schema: SchemaService,\n record: SchemaRecord,\n identifier: StableRecordIdentifier,\n field: DerivedField,\n prop: string\n): unknown {\n return schema.derivation(field)(record, field.options ?? null, prop);\n}\n\n// TODO probably this should just be a Document\n// but its separate until we work out the lid situation\nclass ResourceRelationship<T extends SchemaRecord = SchemaRecord> {\n declare lid: string;\n declare [Parent]: SchemaRecord;\n declare [RecordStore]: Store;\n declare name: string;\n\n declare data: T | null;\n declare links: Links;\n declare meta: Record<string, unknown>;\n\n constructor(\n store: Store,\n cache: Cache,\n parent: SchemaRecord,\n identifier: StableRecordIdentifier,\n field: FieldSchema,\n name: string\n ) {\n const rawValue = cache.getRelationship(identifier, name) as SingleResourceRelationship;\n\n // TODO setup true lids for relationship documents\n // @ts-expect-error we need to give relationship documents a lid\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n this.lid = rawValue.lid ?? rawValue.links?.self ?? `relationship:${identifier.lid}.${name}`;\n this.data = rawValue.data ? store.peekRecord<T>(rawValue.data) : null;\n this.name = name;\n\n if (DEBUG) {\n this.links = Object.freeze(Object.assign({}, rawValue.links));\n this.meta = Object.freeze(Object.assign({}, rawValue.meta));\n } else {\n this.links = rawValue.links ?? {};\n this.meta = rawValue.meta ?? {};\n }\n\n this[RecordStore] = store;\n this[Parent] = parent;\n }\n\n fetch(options?: StoreRequestInput<T, T>): Future<T> {\n const url = options?.url ?? getHref(this.links.related) ?? getHref(this.links.self) ?? null;\n\n if (!url) {\n throw new Error(\n `Cannot ${options?.method ?? 'fetch'} ${this[Parent][Identifier].type}.${String(\n this.name\n )} because it has no related link`\n );\n }\n const request = Object.assign(\n {\n url,\n method: 'GET',\n },\n options\n );\n\n return this[RecordStore].request<T>(request);\n }\n}\n\ndefineSignal(ResourceRelationship.prototype, 'data');\ndefineSignal(ResourceRelationship.prototype, 'links');\ndefineSignal(ResourceRelationship.prototype, 'meta');\n\nfunction getHref(link?: Link | null): string | null {\n if (!link) {\n return null;\n }\n if (typeof link === 'string') {\n return link;\n }\n return link.href;\n}\n\nfunction computeResource<T extends SchemaRecord>(\n store: Store,\n cache: Cache,\n parent: SchemaRecord,\n identifier: StableRecordIdentifier,\n field: FieldSchema,\n prop: string\n): ResourceRelationship<T> {\n if (field.kind !== 'resource') {\n throw new Error(`The schema for ${identifier.type}.${String(prop)} is not a resource relationship`);\n }\n\n return new ResourceRelationship<T>(store, cache, parent, identifier, field, prop);\n}\n\nexport class SchemaRecord {\n declare [RecordStore]: Store;\n declare [Identifier]: StableRecordIdentifier;\n declare [Editable]: boolean;\n declare [Legacy]: boolean;\n declare [Signals]: Map<string, Signal>;\n declare ___notifications: object;\n\n constructor(store: Store, identifier: StableRecordIdentifier, Mode: { [Editable]: boolean; [Legacy]: boolean }) {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const self = this;\n this[RecordStore] = store;\n this[Identifier] = identifier;\n const IS_EDITABLE = (this[Editable] = Mode[Editable] ?? false);\n this[Legacy] = Mode[Legacy] ?? false;\n\n const schema = store.schema as unknown as SchemaService;\n const cache = store.cache;\n const identityField = schema.resource(identifier).identity;\n const fields = schema.fields(identifier);\n\n const signals: Map<string, Signal> = new Map();\n this[Signals] = signals;\n this.___notifications = store.notifications.subscribe(\n identifier,\n (_: StableRecordIdentifier, type: NotificationType, key?: string) => {\n switch (type) {\n case 'attributes':\n if (key) {\n const signal = signals.get(key);\n if (signal) {\n addToTransaction(signal);\n }\n const field = fields.get(key);\n if (field?.kind === 'array') {\n const peeked = peekManagedArray(self, field);\n if (peeked) {\n const arrSignal = peeked[ARRAY_SIGNAL];\n arrSignal.shouldReset = true;\n addToTransaction(arrSignal);\n }\n }\n }\n break;\n }\n }\n );\n\n return new Proxy(this, {\n get(target: SchemaRecord, prop: string | number | symbol, receiver: typeof Proxy<SchemaRecord>) {\n if (RecordSymbols.has(prop as RecordSymbol)) {\n return target[prop as keyof SchemaRecord];\n }\n\n if (prop === '___notifications') {\n return target.___notifications;\n }\n\n // SchemaRecord reserves use of keys that begin with these characters\n // for its own usage.\n // _, @, $, *\n\n const field = prop === identityField?.name ? identityField : fields.get(prop as string);\n if (!field) {\n if (IgnoredGlobalFields.has(prop as string)) {\n return undefined;\n }\n throw new Error(`No field named ${String(prop)} on ${identifier.type}`);\n }\n\n switch (field.kind) {\n case '@id':\n entangleSignal(signals, receiver, '@identity');\n return identifier.id;\n case '@hash':\n // TODO pass actual cache value not {}\n return schema.hashFn(field)({}, field.options ?? null, field.name ?? null);\n case '@local': {\n const lastValue = computeLocal(receiver, field, prop as string);\n entangleSignal(signals, receiver, prop as string);\n return lastValue;\n }\n case 'field':\n assert(\n `SchemaRecord.${field.name} is not available in legacy mode because it has type '${field.kind}'`,\n !target[Legacy]\n );\n entangleSignal(signals, receiver, field.name);\n return computeField(schema, cache, target, identifier, field, prop as string);\n case 'attribute':\n entangleSignal(signals, receiver, field.name);\n return computeAttribute(cache, identifier, prop as string);\n case 'resource':\n assert(\n `SchemaRecord.${field.name} is not available in legacy mode because it has type '${field.kind}'`,\n !target[Legacy]\n );\n entangleSignal(signals, receiver, field.name);\n return computeResource(store, cache, target, identifier, field, prop as string);\n case 'derived':\n return computeDerivation(schema, receiver as unknown as SchemaRecord, identifier, field, prop as string);\n case 'schema-array':\n throw new Error(`Not Implemented`);\n case 'array':\n assert(\n `SchemaRecord.${field.name} is not available in legacy mode because it has type '${field.kind}'`,\n !target[Legacy]\n );\n entangleSignal(signals, receiver, field.name);\n return computeArray(store, schema, cache, target, identifier, field, prop as string);\n case 'schema-object':\n // validate any access off of schema, no transform to run\n // use raw cache value as the object to manage\n throw new Error(`Not Implemented`);\n case 'object':\n assert(\n `SchemaRecord.${field.name} is not available in legacy mode because it has type '${field.kind}'`,\n !target[Legacy]\n );\n entangleSignal(signals, receiver, field.name);\n // run transform, then use that value as the object to manage\n return computeObject(store, schema, cache, target, identifier, field, prop as string);\n default:\n throw new Error(`Field '${String(prop)}' on '${identifier.type}' has the unknown kind '${field.kind}'`);\n }\n },\n set(target: SchemaRecord, prop: string | number | symbol, value: unknown, receiver: typeof Proxy<SchemaRecord>) {\n if (!IS_EDITABLE) {\n throw new Error(`Cannot set ${String(prop)} on ${identifier.type} because the record is not editable`);\n }\n\n const field = fields.get(prop as string);\n if (!field) {\n throw new Error(`There is no field named ${String(prop)} on ${identifier.type}`);\n }\n\n switch (field.kind) {\n case '@local': {\n const signal = getSignal(receiver, prop as string, true);\n if (signal.lastValue !== value) {\n signal.lastValue = value;\n addToTransaction(signal);\n }\n return true;\n }\n case 'field': {\n if (!field.type) {\n cache.setAttr(identifier, prop as string, value as Value);\n return true;\n }\n const transform = schema.transformation(field);\n const rawValue = transform.serialize(value, field.options ?? null, target);\n cache.setAttr(identifier, prop as string, rawValue);\n return true;\n }\n case 'attribute': {\n cache.setAttr(identifier, prop as string, value as Value);\n return true;\n }\n case 'array': {\n if (!field.type) {\n cache.setAttr(identifier, prop as string, (value as ArrayValue)?.slice());\n const peeked = peekManagedArray(self, field);\n if (peeked) {\n const arrSignal = peeked[ARRAY_SIGNAL];\n arrSignal.shouldReset = true;\n }\n if (!Array.isArray(value)) {\n ManagedArrayMap.delete(target);\n }\n return true;\n }\n\n const transform = schema.transformation(field);\n const rawValue = (value as ArrayValue).map((item) =>\n transform.serialize(item, field.options ?? null, target)\n );\n cache.setAttr(identifier, prop as string, rawValue);\n const peeked = peekManagedArray(self, field);\n if (peeked) {\n const arrSignal = peeked[ARRAY_SIGNAL];\n arrSignal.shouldReset = true;\n }\n return true;\n }\n case 'object': {\n if (!field.type) {\n let newValue = value;\n if (value !== null) {\n newValue = { ...(value as ObjectValue) };\n } else {\n ManagedObjectMap.delete(target);\n }\n\n cache.setAttr(identifier, prop as string, newValue as Value);\n\n const peeked = peekManagedObject(self, field);\n if (peeked) {\n const objSignal = peeked[OBJECT_SIGNAL];\n objSignal.shouldReset = true;\n }\n return true;\n }\n const transform = schema.transformation(field);\n const rawValue = transform.serialize({ ...(value as ObjectValue) }, field.options ?? null, target);\n\n cache.setAttr(identifier, prop as string, rawValue);\n const peeked = peekManagedObject(self, field);\n if (peeked) {\n const objSignal = peeked[OBJECT_SIGNAL];\n objSignal.shouldReset = true;\n }\n return true;\n }\n case 'derived': {\n throw new Error(`Cannot set ${String(prop)} on ${identifier.type} because it is derived`);\n }\n default:\n throw new Error(`Unknown field kind ${field.kind}`);\n }\n },\n });\n }\n\n [Destroy](): void {\n if (this[Legacy]) {\n // @ts-expect-error\n this.isDestroying = true;\n // @ts-expect-error\n this.isDestroyed = true;\n }\n this[RecordStore].notifications.unsubscribe(this.___notifications);\n }\n [Checkout](): Promise<SchemaRecord> {\n return Promise.resolve(this);\n }\n}\n"],"names":["ARRAY_GETTER_METHODS","Set","Symbol","iterator","SYNC_PROPS","isArrayGetter","prop","has","convertToInt","num","Number","isNaN","safeForEach","instance","arr","store","callback","target","undefined","slice","macroCondition","getGlobalConfig","WarpDrive","env","DEBUG","test","Error","length","index","call","ManagedArray","SOURCE","constructor","schema","cache","field","data","address","key","owner","self","ARRAY_SIGNAL","createSignal","_SIGNAL","boundFns","Map","transaction","proxy","Proxy","get","receiver","shouldReset","t","newData","getAttr","push","val","subscribe","type","transform","transformation","hydrate","options","fn","result","arguments","Reflect","apply","set","value","reflect","setAttr","rawValue","map","item","serialize","ManagedObject","OBJECT_SIGNAL","IgnoredGlobalFields","STRUCTURED","symbolList","Destroy","RecordStore","Identifier","Editable","Parent","Checkout","Legacy","Signals","RecordSymbols","ManagedArrayMap","getOrSetGlobal","ManagedObjectMap","computeLocal","record","signal","peekSignal","getSignal","lastValue","defaultValue","peekManagedArray","managedArrayMapForRecord","peekManagedObject","managedObjectMapForRecord","computeField","identifier","computeArray","managedArray","computeObject","managedObject","kind","computeAttribute","computeDerivation","derivation","ResourceRelationship","parent","name","getRelationship","lid","links","peekRecord","Object","freeze","assign","meta","fetch","url","getHref","related","method","String","request","defineSignal","prototype","link","href","computeResource","SchemaRecord","Mode","IS_EDITABLE","identityField","resource","identity","fields","signals","___notifications","notifications","_","addToTransaction","peeked","arrSignal","entangleSignal","id","hashFn","Array","isArray","delete","newValue","objSignal","isDestroying","isDestroyed","unsubscribe","Promise","resolve"],"mappings":";;;;;;;AAmBA,MAAMA,oBAAoB,GAAG,IAAIC,GAAG,CAAU,CAC5CC,MAAM,CAACC,QAAQ,EACf,QAAQ,EACR,SAAS,EACT,OAAO,EACP,MAAM,EACN,QAAQ,EACR,MAAM,EACN,WAAW,EACX,MAAM,EACN,SAAS,EACT,SAAS,EACT,UAAU,EACV,SAAS,EACT,MAAM,EACN,MAAM,EACN,aAAa,EACb,KAAK,EACL,QAAQ,EACR,aAAa,EACb,OAAO,EACP,MAAM,EACN,QAAQ,CACT,CAAC,CAAA;AACF;AACA,MAAMC,UAAU,GAAG,IAAIH,GAAG,CAAU,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAA;AACrD,SAASI,aAAaA,CAAIC,IAAa,EAA0B;AAC/D,EAAA,OAAON,oBAAoB,CAACO,GAAG,CAACD,IAAI,CAAC,CAAA;AACvC,CAAA;AACA;AACA;AACA;AACA;AACA;AACA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AAEA,EAAA,CAAC7B,OAAO,CAAU,GAAA;AAChB,IAAA,IAAI,IAAI,CAACM,MAAM,CAAC,EAAE;AAChB;MACA,IAAI,CAACwE,YAAY,GAAG,IAAI,CAAA;AACxB;MACA,IAAI,CAACC,WAAW,GAAG,IAAI,CAAA;AACzB,KAAA;IACA,IAAI,CAAC9E,WAAW,CAAC,CAACgE,aAAa,CAACe,WAAW,CAAC,IAAI,CAAChB,gBAAgB,CAAC,CAAA;AACpE,GAAA;AACA,EAAA,CAAC3D,QAAQ,CAA2B,GAAA;AAClC,IAAA,OAAO4E,OAAO,CAACC,OAAO,CAAC,IAAI,CAAC,CAAA;AAC9B,GAAA;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"record.js","sources":["../src/managed-array.ts","../src/managed-object.ts","../src/record.ts"],"sourcesContent":["import type Store from '@ember-data/store';\nimport type { Signal } from '@ember-data/tracking/-private';\nimport { addToTransaction, createSignal, subscribe } from '@ember-data/tracking/-private';\nimport { assert } from '@warp-drive/build-config/macros';\nimport type { StableRecordIdentifier } from '@warp-drive/core-types';\nimport type { Cache } from '@warp-drive/core-types/cache';\nimport type { ArrayValue, ObjectValue, Value } from '@warp-drive/core-types/json/raw';\nimport type { OpaqueRecordInstance } from '@warp-drive/core-types/record';\nimport type { ArrayField, HashField, SchemaArrayField } from '@warp-drive/core-types/schema/fields';\n\nimport { SchemaRecord } from './record';\nimport type { SchemaService } from './schema';\nimport { ARRAY_SIGNAL, Editable, Identifier, Legacy, MUTATE, SOURCE } from './symbols';\n\nexport function notifyArray(arr: ManagedArray) {\n addToTransaction(arr[ARRAY_SIGNAL]);\n}\n\ntype KeyType = string | symbol | number;\nconst ARRAY_GETTER_METHODS = new Set<KeyType>([\n Symbol.iterator,\n 'concat',\n 'entries',\n 'every',\n 'fill',\n 'filter',\n 'find',\n 'findIndex',\n 'flat',\n 'flatMap',\n 'forEach',\n 'includes',\n 'indexOf',\n 'join',\n 'keys',\n 'lastIndexOf',\n 'map',\n 'reduce',\n 'reduceRight',\n 'slice',\n 'some',\n 'values',\n]);\n// const ARRAY_SETTER_METHODS = new Set<KeyType>(['push', 'pop', 'unshift', 'shift', 'splice', 'sort']);\nconst SYNC_PROPS = new Set<KeyType>(['[]', 'length']);\nfunction isArrayGetter<T>(prop: KeyType): prop is keyof Array<T> {\n return ARRAY_GETTER_METHODS.has(prop);\n}\n// function isArraySetter<T>(prop: KeyType): prop is keyof Array<T> {\n// return ARRAY_SETTER_METHODS.has(prop);\n// }\n// function isSelfProp<T extends object>(self: T, prop: KeyType): prop is keyof T {\n// return prop in self;\n// }\n\nfunction convertToInt(prop: KeyType): number | null {\n if (typeof prop === 'symbol') return null;\n\n const num = Number(prop);\n\n if (isNaN(num)) return null;\n\n return num % 1 === 0 ? num : null;\n}\n\ntype ProxiedMethod = (...args: unknown[]) => unknown;\n\ntype ForEachCB = (record: OpaqueRecordInstance, index: number, context: typeof Proxy<unknown[]>) => void;\nfunction safeForEach(\n instance: typeof Proxy<unknown[]>,\n arr: unknown[],\n store: Store,\n callback: ForEachCB,\n target: unknown\n) {\n if (target === undefined) {\n target = null;\n }\n // clone to prevent mutation\n arr = arr.slice();\n assert('`forEach` expects a function as first argument.', typeof callback === 'function');\n\n // because we retrieveLatest above we need not worry if array is mutated during iteration\n // by unloadRecord/rollbackAttributes\n // push/add/removeObject may still be problematic\n // but this is a more traditionally expected forEach bug.\n const length = arr.length; // we need to access length to ensure we are consumed\n\n for (let index = 0; index < length; index++) {\n callback.call(target, arr[index], index, instance);\n }\n\n return instance;\n}\n\nexport interface ManagedArray extends Omit<Array<unknown>, '[]'> {\n [MUTATE]?(\n target: unknown[],\n receiver: typeof Proxy<unknown[]>,\n prop: string,\n args: unknown[],\n _SIGNAL: Signal\n ): unknown;\n}\n\nexport class ManagedArray {\n [SOURCE]: unknown[];\n declare address: StableRecordIdentifier;\n declare path: string[];\n declare owner: SchemaRecord;\n declare [ARRAY_SIGNAL]: Signal;\n\n constructor(\n store: Store,\n schema: SchemaService,\n cache: Cache,\n field: ArrayField | SchemaArrayField,\n data: unknown[],\n address: StableRecordIdentifier,\n path: string[],\n owner: SchemaRecord,\n isSchemaArray: boolean\n ) {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const self = this;\n this[SOURCE] = data?.slice();\n this[ARRAY_SIGNAL] = createSignal(this, 'length');\n const _SIGNAL = this[ARRAY_SIGNAL];\n const boundFns = new Map<KeyType, ProxiedMethod>();\n this.address = address;\n this.path = path;\n this.owner = owner;\n let transaction = false;\n type StorageKlass = typeof WeakMap<object, WeakRef<SchemaRecord>>;\n const mode = (field as SchemaArrayField).options?.key ?? '@identity';\n const RefStorage: StorageKlass =\n mode === '@identity'\n ? (WeakMap as unknown as StorageKlass)\n : // CAUTION CAUTION CAUTION\n // this is a pile of lies\n // the Map is Map<string, WeakRef<SchemaRecord>>\n // but TS does not understand how to juggle modes like this\n // internal to a method like ours without us duplicating the code\n // into two separate methods.\n Map<object, WeakRef<SchemaRecord>>;\n const ManagedRecordRefs = isSchemaArray ? new RefStorage() : null;\n const proxy = new Proxy(this[SOURCE], {\n get<R extends typeof Proxy<unknown[]>>(target: unknown[], prop: keyof R, receiver: R) {\n if (prop === ARRAY_SIGNAL) {\n return _SIGNAL;\n }\n if (prop === 'address') {\n return self.address;\n }\n if (prop === 'owner') {\n return self.owner;\n }\n\n const index = convertToInt(prop);\n if (_SIGNAL.shouldReset && (index !== null || SYNC_PROPS.has(prop) || isArrayGetter(prop))) {\n _SIGNAL.t = false;\n _SIGNAL.shouldReset = false;\n const newData = cache.getAttr(address, path);\n if (newData && newData !== self[SOURCE]) {\n self[SOURCE].length = 0;\n self[SOURCE].push(...(newData as ArrayValue));\n }\n }\n\n if (index !== null) {\n let val;\n if (mode === '@hash') {\n val = target[index];\n const hashField = schema.resource({ type: field.type! }).identity as HashField;\n const hashFn = schema.hashFn(hashField);\n val = hashFn(val as object, null, null);\n } else {\n // if mode is not @identity or @index, then access the key path.\n // we should assert that `mode` is a string\n // it should read directly from the cache value for that field (e.g. no derivation, no transformation)\n // and, we likely should lookup the associated field and throw an error IF\n // the given field does not exist OR\n // the field is anything other than a GenericField or LegacyAttributeField.\n if (mode !== '@identity' && mode !== '@index') {\n assert('mode must be a string', typeof mode === 'string');\n const modeField = schema.resource({ type: field.type! }).fields.find((f) => f.name === mode);\n assert('field must exist in schema', modeField);\n assert(\n 'field must be a GenericField or LegacyAttributeField',\n modeField.kind === 'field' || modeField.kind === 'attribute'\n );\n }\n val =\n mode === '@identity'\n ? target[index]\n : mode === '@index'\n ? '@index'\n : (target[index] as ObjectValue)[mode];\n }\n\n if (isSchemaArray) {\n if (!transaction) {\n subscribe(_SIGNAL);\n }\n\n if (val) {\n const recordRef = ManagedRecordRefs!.get(val);\n let record = recordRef?.deref();\n\n if (!record) {\n const recordPath = path.slice();\n // this is a dirty lie since path is string[] but really we\n // should change the types for paths to `Array<string | number>`\n // TODO we should allow the schema for the field to define a \"key\"\n // for stability. Default should be `@identity` which means that\n // same object reference from cache should result in same SchemaRecord\n // embedded object.\n recordPath.push(index as unknown as string);\n record = new SchemaRecord(\n store,\n self.owner[Identifier],\n { [Editable]: self.owner[Editable], [Legacy]: self.owner[Legacy] },\n true,\n field.type,\n recordPath\n );\n // if mode is not @identity or @index, then access the key path now\n // to determine the key value.\n // chris says we can implement this as a special kind `@hash` which\n // would be a function that only has access to the cache value and not\n // the record itself, so derivation is possible but intentionally limited\n // and non-reactive?\n ManagedRecordRefs!.set(val, new WeakRef(record));\n } else {\n // TODO update embeddedPath if required\n }\n return record;\n }\n\n return val;\n }\n\n if (!transaction) {\n subscribe(_SIGNAL);\n }\n if (field.type) {\n const transform = schema.transformation(field);\n return transform.hydrate(val as Value, field.options ?? null, self.owner);\n }\n return val;\n }\n\n if (isArrayGetter(prop)) {\n let fn = boundFns.get(prop);\n\n if (fn === undefined) {\n if (prop === 'forEach') {\n fn = function () {\n subscribe(_SIGNAL);\n transaction = true;\n const result = safeForEach(receiver, target, store, arguments[0] as ForEachCB, arguments[1]);\n transaction = false;\n return result;\n };\n } else {\n fn = function () {\n subscribe(_SIGNAL);\n // array functions must run through Reflect to work properly\n // binding via other means will not work.\n transaction = true;\n const result = Reflect.apply(target[prop] as ProxiedMethod, receiver, arguments) as unknown;\n transaction = false;\n return result;\n };\n }\n boundFns.set(prop, fn);\n }\n return fn;\n }\n\n return Reflect.get(target, prop, receiver);\n },\n set(target, prop: KeyType, value, receiver) {\n if (prop === 'address') {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n self.address = value;\n return true;\n }\n if (prop === 'owner') {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n self.owner = value;\n return true;\n }\n const reflect = Reflect.set(target, prop, value, receiver);\n\n if (reflect) {\n if (!field.type) {\n cache.setAttr(address, path, self[SOURCE] as Value);\n _SIGNAL.shouldReset = true;\n return true;\n }\n\n let rawValue = self[SOURCE] as ArrayValue;\n if (!isSchemaArray) {\n const transform = schema.transformation(field);\n if (!transform) {\n throw new Error(`No '${field.type}' transform defined for use by ${address.type}.${String(prop)}`);\n }\n rawValue = (self[SOURCE] as ArrayValue).map((item) =>\n transform.serialize(item, field.options ?? null, self.owner)\n );\n }\n cache.setAttr(address, path, rawValue as Value);\n _SIGNAL.shouldReset = true;\n }\n return reflect;\n },\n }) as ManagedArray;\n\n return proxy;\n }\n}\n","import type Store from '@ember-data/store';\nimport type { Signal } from '@ember-data/tracking/-private';\nimport { addToTransaction, createSignal, subscribe } from '@ember-data/tracking/-private';\nimport type { StableRecordIdentifier } from '@warp-drive/core-types';\nimport type { Cache } from '@warp-drive/core-types/cache';\nimport type { ObjectValue, Value } from '@warp-drive/core-types/json/raw';\nimport type { ObjectField } from '@warp-drive/core-types/schema/fields';\n\nimport type { SchemaRecord } from './record';\nimport type { SchemaService } from './schema';\nimport { MUTATE, OBJECT_SIGNAL, SOURCE } from './symbols';\n\nexport function notifyObject(obj: ManagedObject) {\n addToTransaction(obj[OBJECT_SIGNAL]);\n}\n\ntype KeyType = string | symbol | number;\n\nexport interface ManagedObject {\n [MUTATE]?(\n target: unknown[],\n receiver: typeof Proxy<unknown[]>,\n prop: string,\n args: unknown[],\n _SIGNAL: Signal\n ): unknown;\n}\n\nexport class ManagedObject {\n [SOURCE]: object;\n declare address: StableRecordIdentifier;\n declare key: string;\n declare owner: SchemaRecord;\n declare [OBJECT_SIGNAL]: Signal;\n\n constructor(\n store: Store,\n schema: SchemaService,\n cache: Cache,\n field: ObjectField,\n data: object,\n address: StableRecordIdentifier,\n key: string,\n owner: SchemaRecord\n ) {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const self = this;\n this[SOURCE] = { ...data };\n this[OBJECT_SIGNAL] = createSignal(this, 'length');\n const _SIGNAL = this[OBJECT_SIGNAL];\n // const boundFns = new Map<KeyType, ProxiedMethod>();\n this.address = address;\n this.key = key;\n this.owner = owner;\n const transaction = false;\n\n const proxy = new Proxy(this[SOURCE], {\n get<R extends typeof Proxy<object>>(target: object, prop: keyof R, receiver: R) {\n if (prop === OBJECT_SIGNAL) {\n return _SIGNAL;\n }\n if (prop === 'address') {\n return self.address;\n }\n if (prop === 'key') {\n return self.key;\n }\n if (prop === 'owner') {\n return self.owner;\n }\n\n if (_SIGNAL.shouldReset) {\n _SIGNAL.t = false;\n _SIGNAL.shouldReset = false;\n let newData = cache.getAttr(self.address, self.key);\n if (newData && newData !== self[SOURCE]) {\n if (field.type) {\n const transform = schema.transformation(field);\n newData = transform.hydrate(newData as ObjectValue, field.options ?? null, self.owner) as ObjectValue;\n }\n self[SOURCE] = { ...(newData as ObjectValue) }; // Add type assertion for newData\n }\n }\n\n if (prop in self[SOURCE]) {\n if (!transaction) {\n subscribe(_SIGNAL);\n }\n\n return (self[SOURCE] as R)[prop];\n }\n return Reflect.get(target, prop, receiver) as R;\n },\n\n set(target, prop: KeyType, value, receiver) {\n if (prop === 'address') {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n self.address = value;\n return true;\n }\n if (prop === 'key') {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n self.key = value;\n return true;\n }\n if (prop === 'owner') {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n self.owner = value;\n return true;\n }\n const reflect = Reflect.set(target, prop, value, receiver);\n\n if (reflect) {\n if (!field.type) {\n cache.setAttr(self.address, self.key, self[SOURCE] as Value);\n _SIGNAL.shouldReset = true;\n return true;\n }\n\n const transform = schema.transformation(field);\n const val = transform.serialize(self[SOURCE], field.options ?? null, self.owner);\n cache.setAttr(self.address, self.key, val);\n _SIGNAL.shouldReset = true;\n }\n return reflect;\n },\n }) as ManagedObject;\n\n return proxy;\n }\n}\n","import type { Future } from '@ember-data/request';\nimport type Store from '@ember-data/store';\nimport type { NotificationType, StoreRequestInput } from '@ember-data/store';\nimport {\n addToTransaction,\n defineSignal,\n entangleSignal,\n getSignal,\n peekSignal,\n type Signal,\n Signals,\n} from '@ember-data/tracking/-private';\nimport { DEBUG } from '@warp-drive/build-config/env';\nimport { assert } from '@warp-drive/build-config/macros';\nimport type { StableRecordIdentifier } from '@warp-drive/core-types';\nimport { getOrSetGlobal } from '@warp-drive/core-types/-private';\nimport type { Cache } from '@warp-drive/core-types/cache';\nimport type { ResourceRelationship as SingleResourceRelationship } from '@warp-drive/core-types/cache/relationship';\nimport type { ArrayValue, ObjectValue, Value } from '@warp-drive/core-types/json/raw';\nimport { STRUCTURED } from '@warp-drive/core-types/request';\nimport type {\n ArrayField,\n DerivedField,\n FieldSchema,\n GenericField,\n LocalField,\n ObjectField,\n SchemaArrayField,\n} from '@warp-drive/core-types/schema/fields';\nimport type { Link, Links } from '@warp-drive/core-types/spec/json-api-raw';\nimport { RecordStore } from '@warp-drive/core-types/symbols';\n\nimport { ManagedArray } from './managed-array';\nimport { ManagedObject } from './managed-object';\nimport type { SchemaService } from './schema';\nimport {\n ARRAY_SIGNAL,\n Checkout,\n Destroy,\n Editable,\n EmbeddedPath,\n EmbeddedType,\n Identifier,\n Legacy,\n OBJECT_SIGNAL,\n Parent,\n} from './symbols';\n\nexport { Editable, Legacy } from './symbols';\nconst IgnoredGlobalFields = new Set<string>(['length', 'nodeType', 'then', 'setInterval', STRUCTURED]);\nconst symbolList = [\n Destroy,\n RecordStore,\n Identifier,\n Editable,\n Parent,\n Checkout,\n Legacy,\n Signals,\n EmbeddedPath,\n EmbeddedType,\n];\nconst RecordSymbols = new Set(symbolList);\n\ntype RecordSymbol = (typeof symbolList)[number];\n\nconst ManagedArrayMap = getOrSetGlobal('ManagedArrayMap', new Map<SchemaRecord, Map<FieldSchema, ManagedArray>>());\nconst ManagedObjectMap = getOrSetGlobal('ManagedObjectMap', new Map<SchemaRecord, Map<FieldSchema, ManagedObject>>());\n\nfunction computeLocal(record: typeof Proxy<SchemaRecord>, field: LocalField, prop: string): unknown {\n let signal = peekSignal(record, prop);\n\n if (!signal) {\n signal = getSignal(record, prop, false);\n signal.lastValue = field.options?.defaultValue ?? null;\n }\n\n return signal.lastValue;\n}\n\nfunction peekManagedArray(record: SchemaRecord, field: FieldSchema): ManagedArray | undefined {\n const managedArrayMapForRecord = ManagedArrayMap.get(record);\n if (managedArrayMapForRecord) {\n return managedArrayMapForRecord.get(field);\n }\n}\n\nfunction peekManagedObject(record: SchemaRecord, field: FieldSchema): ManagedObject | undefined {\n const managedObjectMapForRecord = ManagedObjectMap.get(record);\n if (managedObjectMapForRecord) {\n return managedObjectMapForRecord.get(field);\n }\n}\n\nfunction computeField(\n schema: SchemaService,\n cache: Cache,\n record: SchemaRecord,\n identifier: StableRecordIdentifier,\n field: GenericField,\n prop: string | string[]\n): unknown {\n const rawValue = cache.getAttr(identifier, prop);\n if (!field.type) {\n return rawValue;\n }\n const transform = schema.transformation(field);\n return transform.hydrate(rawValue, field.options ?? null, record);\n}\n\nfunction computeArray(\n store: Store,\n schema: SchemaService,\n cache: Cache,\n record: SchemaRecord,\n identifier: StableRecordIdentifier,\n field: ArrayField | SchemaArrayField,\n path: string[],\n isSchemaArray = false\n) {\n // the thing we hand out needs to know its owner and path in a private manner\n // its \"address\" is the parent identifier (identifier) + field name (field.name)\n // in the nested object case field name here is the full dot path from root resource to this value\n // its \"key\" is the field on the parent record\n // its \"owner\" is the parent record\n\n const managedArrayMapForRecord = ManagedArrayMap.get(record);\n let managedArray;\n if (managedArrayMapForRecord) {\n managedArray = managedArrayMapForRecord.get(field);\n }\n if (managedArray) {\n return managedArray;\n } else {\n const rawValue = cache.getAttr(identifier, path) as unknown[];\n if (!rawValue) {\n return null;\n }\n managedArray = new ManagedArray(store, schema, cache, field, rawValue, identifier, path, record, isSchemaArray);\n if (!managedArrayMapForRecord) {\n ManagedArrayMap.set(record, new Map([[field, managedArray]]));\n } else {\n managedArrayMapForRecord.set(field, managedArray);\n }\n }\n return managedArray;\n}\n\nfunction computeObject(\n store: Store,\n schema: SchemaService,\n cache: Cache,\n record: SchemaRecord,\n identifier: StableRecordIdentifier,\n field: ObjectField,\n prop: string\n) {\n const managedObjectMapForRecord = ManagedObjectMap.get(record);\n let managedObject;\n if (managedObjectMapForRecord) {\n managedObject = managedObjectMapForRecord.get(field);\n }\n if (managedObject) {\n return managedObject;\n } else {\n let rawValue = cache.getAttr(identifier, prop) as object;\n if (!rawValue) {\n return null;\n }\n if (field.kind === 'object') {\n if (field.type) {\n const transform = schema.transformation(field);\n rawValue = transform.hydrate(rawValue as ObjectValue, field.options ?? null, record) as object;\n }\n }\n managedObject = new ManagedObject(store, schema, cache, field, rawValue, identifier, prop, record);\n if (!managedObjectMapForRecord) {\n ManagedObjectMap.set(record, new Map([[field, managedObject]]));\n } else {\n managedObjectMapForRecord.set(field, managedObject);\n }\n }\n return managedObject;\n}\n\nfunction computeAttribute(cache: Cache, identifier: StableRecordIdentifier, prop: string): unknown {\n return cache.getAttr(identifier, prop);\n}\n\nfunction computeDerivation(\n schema: SchemaService,\n record: SchemaRecord,\n identifier: StableRecordIdentifier,\n field: DerivedField,\n prop: string\n): unknown {\n return schema.derivation(field)(record, field.options ?? null, prop);\n}\n\n// TODO probably this should just be a Document\n// but its separate until we work out the lid situation\nclass ResourceRelationship<T extends SchemaRecord = SchemaRecord> {\n declare lid: string;\n declare [Parent]: SchemaRecord;\n declare [RecordStore]: Store;\n declare name: string;\n\n declare data: T | null;\n declare links: Links;\n declare meta: Record<string, unknown>;\n\n constructor(\n store: Store,\n cache: Cache,\n parent: SchemaRecord,\n identifier: StableRecordIdentifier,\n field: FieldSchema,\n name: string\n ) {\n const rawValue = cache.getRelationship(identifier, name) as SingleResourceRelationship;\n\n // TODO setup true lids for relationship documents\n // @ts-expect-error we need to give relationship documents a lid\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n this.lid = rawValue.lid ?? rawValue.links?.self ?? `relationship:${identifier.lid}.${name}`;\n this.data = rawValue.data ? store.peekRecord<T>(rawValue.data) : null;\n this.name = name;\n\n if (DEBUG) {\n this.links = Object.freeze(Object.assign({}, rawValue.links));\n this.meta = Object.freeze(Object.assign({}, rawValue.meta));\n } else {\n this.links = rawValue.links ?? {};\n this.meta = rawValue.meta ?? {};\n }\n\n this[RecordStore] = store;\n this[Parent] = parent;\n }\n\n fetch(options?: StoreRequestInput<T, T>): Future<T> {\n const url = options?.url ?? getHref(this.links.related) ?? getHref(this.links.self) ?? null;\n\n if (!url) {\n throw new Error(\n `Cannot ${options?.method ?? 'fetch'} ${this[Parent][Identifier].type}.${String(\n this.name\n )} because it has no related link`\n );\n }\n const request = Object.assign(\n {\n url,\n method: 'GET',\n },\n options\n );\n\n return this[RecordStore].request<T>(request);\n }\n}\n\ndefineSignal(ResourceRelationship.prototype, 'data');\ndefineSignal(ResourceRelationship.prototype, 'links');\ndefineSignal(ResourceRelationship.prototype, 'meta');\n\nfunction isPathMatch(a: string[], b: string[]) {\n return a.length === b.length && a.every((v, i) => v === b[i]);\n}\n\nfunction getHref(link?: Link | null): string | null {\n if (!link) {\n return null;\n }\n if (typeof link === 'string') {\n return link;\n }\n return link.href;\n}\n\nfunction computeResource<T extends SchemaRecord>(\n store: Store,\n cache: Cache,\n parent: SchemaRecord,\n identifier: StableRecordIdentifier,\n field: FieldSchema,\n prop: string\n): ResourceRelationship<T> {\n if (field.kind !== 'resource') {\n throw new Error(`The schema for ${identifier.type}.${String(prop)} is not a resource relationship`);\n }\n\n return new ResourceRelationship<T>(store, cache, parent, identifier, field, prop);\n}\n\nexport class SchemaRecord {\n declare [RecordStore]: Store;\n declare [Identifier]: StableRecordIdentifier;\n declare [Parent]: StableRecordIdentifier;\n declare [EmbeddedType]: string | null;\n declare [EmbeddedPath]: string[] | null;\n declare [Editable]: boolean;\n declare [Legacy]: boolean;\n declare [Signals]: Map<string, Signal>;\n declare [Symbol.toStringTag]: `SchemaRecord<${string}>`;\n declare ___notifications: object;\n\n constructor(\n store: Store,\n identifier: StableRecordIdentifier,\n Mode: { [Editable]: boolean; [Legacy]: boolean },\n isEmbedded = false,\n embeddedType: string | null = null,\n embeddedPath: string[] | null = null\n ) {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const self = this;\n this[RecordStore] = store;\n if (isEmbedded) {\n this[Parent] = identifier;\n } else {\n this[Identifier] = identifier;\n }\n const IS_EDITABLE = (this[Editable] = Mode[Editable] ?? false);\n this[Legacy] = Mode[Legacy] ?? false;\n\n const schema = store.schema as unknown as SchemaService;\n const cache = store.cache;\n const identityField = schema.resource(identifier).identity;\n\n this[EmbeddedType] = embeddedType;\n this[EmbeddedPath] = embeddedPath;\n\n let fields: Map<string, FieldSchema>;\n if (isEmbedded) {\n fields = schema.fields({ type: embeddedType as string });\n } else {\n fields = schema.fields(identifier);\n }\n\n const signals: Map<string, Signal> = new Map();\n this[Signals] = signals;\n // what signal do we need for embedded record?\n this.___notifications = store.notifications.subscribe(\n identifier,\n (_: StableRecordIdentifier, type: NotificationType, key?: string | string[]) => {\n switch (type) {\n case 'attributes':\n if (key) {\n if (Array.isArray(key)) {\n if (!isEmbedded) return; // deep paths will be handled by embedded records\n // TODO we should have the notification manager\n // ensure it is safe for each callback to mutate this array\n if (isPathMatch(embeddedPath!, key)) {\n // handle the notification\n // TODO we should likely handle this notification here\n // also we should add a LOGGING flag\n // eslint-disable-next-line no-console\n console.warn(`Notification unhandled for ${key.join(',')} on ${identifier.type}`, self);\n return;\n }\n\n // TODO we should add a LOGGING flag\n // console.log(`Deep notification skipped for ${key.join('.')} on ${identifier.type}`, self);\n // deep notify the key path\n } else {\n if (isEmbedded) return; // base paths never apply to embedded records\n\n // TODO determine what LOGGING flag to wrap this in if any\n // console.log(`Notification for ${key} on ${identifier.type}`, self);\n const signal = signals.get(key);\n if (signal) {\n addToTransaction(signal);\n }\n const field = fields.get(key);\n if (field?.kind === 'array' || field?.kind === 'schema-array') {\n const peeked = peekManagedArray(self, field);\n if (peeked) {\n const arrSignal = peeked[ARRAY_SIGNAL];\n arrSignal.shouldReset = true;\n addToTransaction(arrSignal);\n }\n }\n }\n }\n break;\n }\n }\n );\n\n return new Proxy(this, {\n ownKeys() {\n return Array.from(fields.keys());\n },\n\n has(target: SchemaRecord, prop: string | number | symbol) {\n return fields.has(prop as string);\n },\n\n getOwnPropertyDescriptor(target, prop) {\n if (!fields.has(prop as string)) {\n throw new Error(`No field named ${String(prop)} on ${identifier.type}`);\n }\n const schemaForField = fields.get(prop as string)!;\n switch (schemaForField.kind) {\n case 'derived':\n return {\n writable: false,\n enumerable: true,\n configurable: true,\n };\n case '@local':\n case 'field':\n case 'attribute':\n case 'resource':\n case 'schema-array':\n case 'array':\n case 'schema-object':\n case 'object':\n return {\n writable: IS_EDITABLE,\n enumerable: true,\n configurable: true,\n };\n }\n },\n\n get(target: SchemaRecord, prop: string | number | symbol, receiver: typeof Proxy<SchemaRecord>) {\n if (RecordSymbols.has(prop as RecordSymbol)) {\n return target[prop as keyof SchemaRecord];\n }\n\n if (prop === Symbol.toStringTag) {\n return `SchemaRecord<${identifier.type}:${identifier.id} (${identifier.lid})>`;\n }\n\n if (prop === 'toString') {\n return function () {\n return `SchemaRecord<${identifier.type}:${identifier.id} (${identifier.lid})>`;\n };\n }\n\n if (prop === Symbol.toPrimitive) {\n return null;\n }\n\n if (prop === '___notifications') {\n return target.___notifications;\n }\n\n // SchemaRecord reserves use of keys that begin with these characters\n // for its own usage.\n // _, @, $, *\n\n const propArray = isEmbedded ? embeddedPath!.slice() : [];\n propArray.push(prop as string);\n\n const field = prop === identityField?.name ? identityField : fields.get(prop as string);\n if (!field) {\n if (IgnoredGlobalFields.has(prop as string)) {\n return undefined;\n }\n if (prop === 'constructor') {\n return SchemaRecord;\n }\n // too many things check for random symbols\n if (typeof prop === 'symbol') {\n return undefined;\n }\n throw new Error(`No field named ${String(prop)} on ${identifier.type}`);\n }\n\n switch (field.kind) {\n case '@id':\n entangleSignal(signals, receiver, '@identity');\n return identifier.id;\n case '@hash':\n // TODO pass actual cache value not {}\n return schema.hashFn(field)({}, field.options ?? null, field.name ?? null);\n case '@local': {\n const lastValue = computeLocal(receiver, field, prop as string);\n entangleSignal(signals, receiver, prop as string);\n return lastValue;\n }\n case 'field':\n assert(\n `SchemaRecord.${field.name} is not available in legacy mode because it has type '${field.kind}'`,\n !target[Legacy]\n );\n entangleSignal(signals, receiver, field.name);\n return computeField(schema, cache, target, identifier, field, propArray);\n case 'attribute':\n entangleSignal(signals, receiver, field.name);\n return computeAttribute(cache, identifier, prop as string);\n case 'resource':\n assert(\n `SchemaRecord.${field.name} is not available in legacy mode because it has type '${field.kind}'`,\n !target[Legacy]\n );\n entangleSignal(signals, receiver, field.name);\n return computeResource(store, cache, target, identifier, field, prop as string);\n case 'derived':\n return computeDerivation(schema, receiver as unknown as SchemaRecord, identifier, field, prop as string);\n case 'schema-array':\n entangleSignal(signals, receiver, field.name);\n return computeArray(store, schema, cache, target, identifier, field, propArray, true);\n case 'array':\n assert(\n `SchemaRecord.${field.name} is not available in legacy mode because it has type '${field.kind}'`,\n !target[Legacy]\n );\n entangleSignal(signals, receiver, field.name);\n return computeArray(store, schema, cache, target, identifier, field, propArray);\n case 'schema-object':\n // validate any access off of schema, no transform to run\n // use raw cache value as the object to manage\n throw new Error(`Not Implemented`);\n case 'object':\n assert(\n `SchemaRecord.${field.name} is not available in legacy mode because it has type '${field.kind}'`,\n !target[Legacy]\n );\n entangleSignal(signals, receiver, field.name);\n // run transform, then use that value as the object to manage\n return computeObject(store, schema, cache, target, identifier, field, prop as string);\n default:\n throw new Error(`Field '${String(prop)}' on '${identifier.type}' has the unknown kind '${field.kind}'`);\n }\n },\n set(target: SchemaRecord, prop: string | number | symbol, value: unknown, receiver: typeof Proxy<SchemaRecord>) {\n if (!IS_EDITABLE) {\n throw new Error(`Cannot set ${String(prop)} on ${identifier.type} because the record is not editable`);\n }\n\n const propArray = isEmbedded ? embeddedPath!.slice() : [];\n propArray.push(prop as string);\n\n const field = fields.get(prop as string);\n if (!field) {\n throw new Error(`There is no field named ${String(prop)} on ${identifier.type}`);\n }\n\n switch (field.kind) {\n case '@local': {\n const signal = getSignal(receiver, prop as string, true);\n if (signal.lastValue !== value) {\n signal.lastValue = value;\n addToTransaction(signal);\n }\n return true;\n }\n case 'field': {\n if (!field.type) {\n cache.setAttr(identifier, propArray, value as Value);\n return true;\n }\n const transform = schema.transformation(field);\n const rawValue = transform.serialize(value, field.options ?? null, target);\n cache.setAttr(identifier, propArray, rawValue);\n return true;\n }\n case 'attribute': {\n cache.setAttr(identifier, propArray, value as Value);\n return true;\n }\n case 'array': {\n if (!field.type) {\n cache.setAttr(identifier, propArray, (value as ArrayValue)?.slice());\n const peeked = peekManagedArray(self, field);\n if (peeked) {\n const arrSignal = peeked[ARRAY_SIGNAL];\n arrSignal.shouldReset = true;\n }\n if (!Array.isArray(value)) {\n ManagedArrayMap.delete(target);\n }\n return true;\n }\n\n const transform = schema.transformation(field);\n const rawValue = (value as ArrayValue).map((item) =>\n transform.serialize(item, field.options ?? null, target)\n );\n cache.setAttr(identifier, propArray, rawValue);\n const peeked = peekManagedArray(self, field);\n if (peeked) {\n const arrSignal = peeked[ARRAY_SIGNAL];\n arrSignal.shouldReset = true;\n }\n return true;\n }\n case 'schema-array': {\n const arrayValue = (value as ArrayValue)?.slice();\n if (!Array.isArray(arrayValue)) {\n ManagedArrayMap.delete(target);\n }\n cache.setAttr(identifier, propArray, arrayValue);\n const peeked = peekManagedArray(self, field);\n if (peeked) {\n const arrSignal = peeked[ARRAY_SIGNAL];\n arrSignal.shouldReset = true;\n }\n if (!Array.isArray(value)) {\n ManagedArrayMap.delete(target);\n }\n return true;\n }\n case 'object': {\n if (!field.type) {\n let newValue = value;\n if (value !== null) {\n newValue = { ...(value as ObjectValue) };\n } else {\n ManagedObjectMap.delete(target);\n }\n\n cache.setAttr(identifier, propArray, newValue as Value);\n\n const peeked = peekManagedObject(self, field);\n if (peeked) {\n const objSignal = peeked[OBJECT_SIGNAL];\n objSignal.shouldReset = true;\n }\n return true;\n }\n const transform = schema.transformation(field);\n const rawValue = transform.serialize({ ...(value as ObjectValue) }, field.options ?? null, target);\n\n cache.setAttr(identifier, propArray, rawValue);\n const peeked = peekManagedObject(self, field);\n if (peeked) {\n const objSignal = peeked[OBJECT_SIGNAL];\n objSignal.shouldReset = true;\n }\n return true;\n }\n case 'derived': {\n throw new Error(`Cannot set ${String(prop)} on ${identifier.type} because it is derived`);\n }\n default:\n throw new Error(`Unknown field kind ${field.kind}`);\n }\n },\n });\n }\n\n [Destroy](): void {\n if (this[Legacy]) {\n // @ts-expect-error\n this.isDestroying = true;\n // @ts-expect-error\n this.isDestroyed = true;\n }\n this[RecordStore].notifications.unsubscribe(this.___notifications);\n }\n [Checkout](): Promise<SchemaRecord> {\n return Promise.resolve(this);\n }\n}\n"],"names":["ARRAY_GETTER_METHODS","Set","Symbol","iterator","SYNC_PROPS","isArrayGetter","prop","has","convertToInt","num","Number","isNaN","safeForEach","instance","arr","store","callback","target","undefined","slice","macroCondition","getGlobalConfig","WarpDrive","env","DEBUG","test","Error","length","index","call","ManagedArray","SOURCE","constructor","schema","cache","field","data","address","path","owner","isSchemaArray","self","ARRAY_SIGNAL","createSignal","_SIGNAL","boundFns","Map","transaction","mode","options","key","RefStorage","WeakMap","ManagedRecordRefs","proxy","Proxy","get","receiver","shouldReset","t","newData","getAttr","push","val","hashField","resource","type","identity","hashFn","modeField","fields","find","f","name","kind","subscribe","recordRef","record","deref","recordPath","SchemaRecord","Identifier","Editable","Legacy","set","WeakRef","transform","transformation","hydrate","fn","result","arguments","Reflect","apply","value","reflect","setAttr","rawValue","String","map","item","serialize","ManagedObject","OBJECT_SIGNAL","IgnoredGlobalFields","STRUCTURED","symbolList","Destroy","RecordStore","Parent","Checkout","Signals","EmbeddedPath","EmbeddedType","RecordSymbols","ManagedArrayMap","getOrSetGlobal","ManagedObjectMap","computeLocal","signal","peekSignal","getSignal","lastValue","defaultValue","peekManagedArray","managedArrayMapForRecord","peekManagedObject","managedObjectMapForRecord","computeField","identifier","computeArray","managedArray","computeObject","managedObject","computeAttribute","computeDerivation","derivation","ResourceRelationship","parent","getRelationship","lid","links","peekRecord","Object","freeze","assign","meta","fetch","url","getHref","related","method","request","defineSignal","prototype","isPathMatch","a","b","every","v","i","link","href","computeResource","Mode","isEmbedded","embeddedType","embeddedPath","IS_EDITABLE","identityField","signals","___notifications","notifications","_","Array","isArray","console","warn","join","addToTransaction","peeked","arrSignal","ownKeys","from","keys","getOwnPropertyDescriptor","schemaForField","writable","enumerable","configurable","toStringTag","id","toPrimitive","propArray","entangleSignal","delete","arrayValue","newValue","objSignal","isDestroying","isDestroyed","unsubscribe","Promise","resolve"],"mappings":";;;;;;;AAmBA,MAAMA,oBAAoB,GAAG,IAAIC,GAAG,CAAU,CAC5CC,MAAM,CAACC,QAAQ,EACf,QAAQ,EACR,SAAS,EACT,OAAO,EACP,MAAM,EACN,QAAQ,EACR,MAAM,EACN,WAAW,EACX,MAAM,EACN,SAAS,EACT,SAAS,EACT,UAAU,EACV,SAAS,EACT,MAAM,EACN,MAAM,EACN,aAAa,EACb,KAAK,EACL,QAAQ,EACR,aAAa,EACb,OAAO,EACP,MAAM,EACN,QAAQ,CACT,CAAC,CAAA;AACF;AACA,MAAMC,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C,CAAA;gBACvC+F,SAAS,CAAC5I,WAAW,GAAG,IAAI,CAAA;AAC9B,eAAA;AACA,cAAA,OAAO,IAAI,CAAA;AACb,aAAA;AACA,UAAA,KAAK,SAAS;AAAE,YAAA;AACd,cAAA,MAAM,IAAIhC,KAAK,CAAE,CAAA,WAAA,EAAawE,MAAM,CAAC5F,IAAI,CAAE,CAAM2H,IAAAA,EAAAA,UAAU,CAAC/D,IAAK,wBAAuB,CAAC,CAAA;AAC3F,aAAA;AACA,UAAA;YACE,MAAM,IAAIxC,KAAK,CAAE,CAAA,mBAAA,EAAqBS,KAAK,CAACuC,IAAK,EAAC,CAAC,CAAA;AACvD,SAAA;AACF,OAAA;AACF,KAAC,CAAC,CAAA;AACJ,GAAA;AAEA,EAAA,CAACiC,OAAO,CAAU,GAAA;AAChB,IAAA,IAAI,IAAI,CAACxB,MAAM,CAAC,EAAE;AAChB;MACA,IAAI,CAACoH,YAAY,GAAG,IAAI,CAAA;AACxB;MACA,IAAI,CAACC,WAAW,GAAG,IAAI,CAAA;AACzB,KAAA;IACA,IAAI,CAAC5F,WAAW,CAAC,CAACgE,aAAa,CAAC6B,WAAW,CAAC,IAAI,CAAC9B,gBAAgB,CAAC,CAAA;AACpE,GAAA;AACA,EAAA,CAAC7D,QAAQ,CAA2B,GAAA;AAClC,IAAA,OAAO4F,OAAO,CAACC,OAAO,CAAC,IAAI,CAAC,CAAA;AAC9B,GAAA;AACF;;;;"}
|
package/dist/schema.js
CHANGED
|
@@ -4,7 +4,7 @@ import { createCache, getValue } from '@ember-data/tracking';
|
|
|
4
4
|
import { Signals } from '@ember-data/tracking/-private';
|
|
5
5
|
import { getOrSetGlobal } from '@warp-drive/core-types/-private';
|
|
6
6
|
import { Type } from '@warp-drive/core-types/symbols';
|
|
7
|
-
import { I as Identifier } from "./symbols-
|
|
7
|
+
import { I as Identifier } from "./symbols-DqoS4ybV.js";
|
|
8
8
|
import { macroCondition, getGlobalConfig } from '@embroider/macros';
|
|
9
9
|
const Support = getOrSetGlobal('Support', new WeakMap());
|
|
10
10
|
const SchemaRecordFields = [{
|
|
@@ -42,4 +42,6 @@ const Editable = getOrSetGlobal('Editable', Symbol('Editable'));
|
|
|
42
42
|
const Parent = getOrSetGlobal('Parent', Symbol('Parent'));
|
|
43
43
|
const Checkout = getOrSetGlobal('Checkout', Symbol('Checkout'));
|
|
44
44
|
const Legacy = getOrSetGlobal('Legacy', Symbol('Legacy'));
|
|
45
|
-
|
|
45
|
+
const EmbeddedPath = getOrSetGlobal('EmbeddedPath', Symbol('EmbeddedPath'));
|
|
46
|
+
const EmbeddedType = getOrSetGlobal('EmbeddedType', Symbol('EmbeddedType'));
|
|
47
|
+
export { ARRAY_SIGNAL as A, Checkout as C, Destroy as D, Editable as E, Identifier as I, Legacy as L, OBJECT_SIGNAL as O, Parent as P, SOURCE as S, EmbeddedPath as a, EmbeddedType as b };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"symbols-
|
|
1
|
+
{"version":3,"file":"symbols-DqoS4ybV.js","sources":["../src/symbols.ts"],"sourcesContent":["///////////////////\n///// WARNING /////\n///////////////////\n\nimport { getOrSetGlobal } from '@warp-drive/core-types/-private';\n\n// Great, got your attention with that warning didn't we?\n// Good. Here's the deal: typescript treats symbols as unique types.\n// If by accident a module creating a symbol is processed more than\n// once, the symbol will be different in each processing. This will\n// cause a type error.\n// It could also cause a runtime error if the symbol is used innapropriately.\n// However, this case is extremely hard to hit and would require other things\n// to go wrong first.\n//\n// So, why do the warning? And why do we lie about the types of the symbols?\n//\n// Because we intentionally create multiple copies of them within the types\n// at build time. This is because we rollup our d.ts files in order to give\n// our consumers a better experience.\n//\n// However, no tool today supports rolling up d.ts files with multiple entry\n// points correctly. The tool we use currently (vite-plugin-dts) uses @microsoft/api-extractor\n// which creates a fully unique stand-alone types file per-entry-point. Thus\n// every entry point that uses one of these symbols somewhere will have accidentally\n// created a new symbol type.\n//\n// This cast allows us to rollup these types using this tool while not encountering\n// the unique symbol type issue.\n//\n// Note that none of these symbols are part of the public API, these are used for\n// debugging DX and as a safe way to provide an intimate contract on public objects.\n\nexport const SOURCE = getOrSetGlobal('SOURCE', Symbol('#source'));\nexport const MUTATE = getOrSetGlobal('MUTATE', Symbol('#update'));\nexport const ARRAY_SIGNAL = getOrSetGlobal('ARRAY_SIGNAL', Symbol('#array-signal'));\nexport const OBJECT_SIGNAL = getOrSetGlobal('OBJECT_SIGNAL', Symbol('#object-signal'));\nexport const NOTIFY = getOrSetGlobal('NOTIFY', Symbol('#notify'));\n\nexport const Destroy = getOrSetGlobal('Destroy', Symbol('Destroy'));\nexport const Identifier = getOrSetGlobal('Identifier', Symbol('Identifier'));\nexport const Editable = getOrSetGlobal('Editable', Symbol('Editable'));\nexport const Parent = getOrSetGlobal('Parent', Symbol('Parent'));\nexport const Checkout = getOrSetGlobal('Checkout', Symbol('Checkout'));\nexport const Legacy = getOrSetGlobal('Legacy', Symbol('Legacy'));\n\nexport const EmbeddedPath = getOrSetGlobal('EmbeddedPath', Symbol('EmbeddedPath'));\nexport const EmbeddedType = getOrSetGlobal('EmbeddedType', Symbol('EmbeddedType'));\n"],"names":["SOURCE","getOrSetGlobal","Symbol","ARRAY_SIGNAL","OBJECT_SIGNAL","Destroy","Identifier","Editable","Parent","Checkout","Legacy","EmbeddedPath","EmbeddedType"],"mappings":";;AAAA;AACA;AACA;;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO,MAAMA,MAAM,GAAGC,cAAc,CAAC,QAAQ,EAAEC,MAAM,CAAC,SAAS,CAAC,EAAC;AAC3CD,cAAc,CAAC,QAAQ,EAAEC,MAAM,CAAC,SAAS,CAAC,EAAC;AAC1D,MAAMC,YAAY,GAAGF,cAAc,CAAC,cAAc,EAAEC,MAAM,CAAC,eAAe,CAAC,EAAC;AAC5E,MAAME,aAAa,GAAGH,cAAc,CAAC,eAAe,EAAEC,MAAM,CAAC,gBAAgB,CAAC,EAAC;AAChED,cAAc,CAAC,QAAQ,EAAEC,MAAM,CAAC,SAAS,CAAC,EAAC;AAE1D,MAAMG,OAAO,GAAGJ,cAAc,CAAC,SAAS,EAAEC,MAAM,CAAC,SAAS,CAAC,EAAC;AAC5D,MAAMI,UAAU,GAAGL,cAAc,CAAC,YAAY,EAAEC,MAAM,CAAC,YAAY,CAAC,EAAC;AACrE,MAAMK,QAAQ,GAAGN,cAAc,CAAC,UAAU,EAAEC,MAAM,CAAC,UAAU,CAAC,EAAC;AAC/D,MAAMM,MAAM,GAAGP,cAAc,CAAC,QAAQ,EAAEC,MAAM,CAAC,QAAQ,CAAC,EAAC;AACzD,MAAMO,QAAQ,GAAGR,cAAc,CAAC,UAAU,EAAEC,MAAM,CAAC,UAAU,CAAC,EAAC;AAC/D,MAAMQ,MAAM,GAAGT,cAAc,CAAC,QAAQ,EAAEC,MAAM,CAAC,QAAQ,CAAC,EAAC;AAEzD,MAAMS,YAAY,GAAGV,cAAc,CAAC,cAAc,EAAEC,MAAM,CAAC,cAAc,CAAC,EAAC;AAC3E,MAAMU,YAAY,GAAGX,cAAc,CAAC,cAAc,EAAEC,MAAM,CAAC,cAAc,CAAC;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@warp-drive/schema-record",
|
|
3
|
-
"version": "0.0.0-alpha.
|
|
3
|
+
"version": "0.0.0-alpha.59",
|
|
4
4
|
"description": "Schema Driven Resource Presentation for WarpDrive and EmberData",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-addon"
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"ember-addon": {
|
|
21
21
|
"main": "addon-main.cjs",
|
|
22
22
|
"type": "addon",
|
|
23
|
-
"version":
|
|
23
|
+
"version": 2
|
|
24
24
|
},
|
|
25
25
|
"files": [
|
|
26
26
|
"addon-main.cjs",
|
|
@@ -31,11 +31,16 @@
|
|
|
31
31
|
"NCC-1701-a-blue.svg",
|
|
32
32
|
"unstable-preview-types"
|
|
33
33
|
],
|
|
34
|
+
"exports": {
|
|
35
|
+
"./*": {
|
|
36
|
+
"default": "./dist/*.js"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
34
39
|
"peerDependencies": {
|
|
35
|
-
"@ember-data/request": "5.4.0-alpha.
|
|
36
|
-
"@ember-data/store": "5.4.0-alpha.
|
|
37
|
-
"@ember-data/tracking": "5.4.0-alpha.
|
|
38
|
-
"@warp-drive/core-types": "0.0.0-alpha.
|
|
40
|
+
"@ember-data/request": "5.4.0-alpha.73",
|
|
41
|
+
"@ember-data/store": "5.4.0-alpha.73",
|
|
42
|
+
"@ember-data/tracking": "5.4.0-alpha.73",
|
|
43
|
+
"@warp-drive/core-types": "0.0.0-alpha.59"
|
|
39
44
|
},
|
|
40
45
|
"dependenciesMeta": {
|
|
41
46
|
"@ember-data/request": {
|
|
@@ -60,21 +65,20 @@
|
|
|
60
65
|
"dependencies": {
|
|
61
66
|
"@ember/edition-utils": "^1.2.0",
|
|
62
67
|
"@embroider/macros": "^1.16.1",
|
|
63
|
-
"@warp-drive/build-config": "0.0.0-alpha.
|
|
64
|
-
"ember-cli-babel": "^8.2.0"
|
|
68
|
+
"@warp-drive/build-config": "0.0.0-alpha.10"
|
|
65
69
|
},
|
|
66
70
|
"devDependencies": {
|
|
67
71
|
"@babel/core": "^7.24.5",
|
|
68
72
|
"@babel/plugin-transform-typescript": "^7.24.5",
|
|
69
73
|
"@babel/preset-env": "^7.24.5",
|
|
70
74
|
"@babel/preset-typescript": "^7.24.1",
|
|
71
|
-
"@ember-data/request": "5.4.0-alpha.
|
|
72
|
-
"@ember-data/store": "5.4.0-alpha.
|
|
73
|
-
"@ember-data/tracking": "5.4.0-alpha.
|
|
75
|
+
"@ember-data/request": "5.4.0-alpha.73",
|
|
76
|
+
"@ember-data/store": "5.4.0-alpha.73",
|
|
77
|
+
"@ember-data/tracking": "5.4.0-alpha.73",
|
|
74
78
|
"@ember/string": "^3.1.1",
|
|
75
79
|
"@glimmer/component": "^1.1.2",
|
|
76
|
-
"@warp-drive/core-types": "0.0.0-alpha.
|
|
77
|
-
"@warp-drive/internal-config": "5.4.0-alpha.
|
|
80
|
+
"@warp-drive/core-types": "0.0.0-alpha.59",
|
|
81
|
+
"@warp-drive/internal-config": "5.4.0-alpha.73",
|
|
78
82
|
"ember-source": "~5.8.0",
|
|
79
83
|
"pnpm-sync-dependencies-meta-injected": "0.0.14",
|
|
80
84
|
"typescript": "^5.4.5",
|
|
@@ -3,8 +3,8 @@ declare module '@warp-drive/schema-record/managed-array' {
|
|
|
3
3
|
import type { Signal } from '@ember-data/tracking/-private';
|
|
4
4
|
import type { StableRecordIdentifier } from '@warp-drive/core-types';
|
|
5
5
|
import type { Cache } from '@warp-drive/core-types/cache';
|
|
6
|
-
import type { ArrayField } from '@warp-drive/core-types/schema/fields';
|
|
7
|
-
import
|
|
6
|
+
import type { ArrayField, SchemaArrayField } from '@warp-drive/core-types/schema/fields';
|
|
7
|
+
import { SchemaRecord } from '@warp-drive/schema-record/record';
|
|
8
8
|
import type { SchemaService } from '@warp-drive/schema-record/schema';
|
|
9
9
|
import { ARRAY_SIGNAL, MUTATE, SOURCE } from '@warp-drive/schema-record/symbols';
|
|
10
10
|
export function notifyArray(arr: ManagedArray): void;
|
|
@@ -14,10 +14,10 @@ declare module '@warp-drive/schema-record/managed-array' {
|
|
|
14
14
|
export class ManagedArray {
|
|
15
15
|
[SOURCE]: unknown[];
|
|
16
16
|
address: StableRecordIdentifier;
|
|
17
|
-
|
|
17
|
+
path: string[];
|
|
18
18
|
owner: SchemaRecord;
|
|
19
19
|
[ARRAY_SIGNAL]: Signal;
|
|
20
|
-
constructor(store: Store, schema: SchemaService, cache: Cache, field: ArrayField, data: unknown[], address: StableRecordIdentifier,
|
|
20
|
+
constructor(store: Store, schema: SchemaService, cache: Cache, field: ArrayField | SchemaArrayField, data: unknown[], address: StableRecordIdentifier, path: string[], owner: SchemaRecord, isSchemaArray: boolean);
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
//# sourceMappingURL=managed-array.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"managed-array.d.ts","sourceRoot":"","sources":["../src/managed-array.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAC3C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AAG5D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAG1D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;
|
|
1
|
+
{"version":3,"file":"managed-array.d.ts","sourceRoot":"","sources":["../src/managed-array.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAC3C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AAG5D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAG1D,OAAO,KAAK,EAAE,UAAU,EAAa,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAEpG,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAgC,MAAM,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEvF,wBAAgB,WAAW,CAAC,GAAG,EAAE,YAAY,QAE5C;AA+ED,MAAM,WAAW,YAAa,SAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC;IAC9D,CAAC,MAAM,CAAC,CAAC,CACP,MAAM,EAAE,OAAO,EAAE,EACjB,QAAQ,EAAE,OAAO,KAAK,CAAC,OAAO,EAAE,CAAC,EACjC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,OAAO,EAAE,EACf,OAAO,EAAE,MAAM,GACd,OAAO,CAAC;CACZ;AAED,qBAAa,YAAY;IACvB,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,CAAC;IACZ,OAAO,EAAE,sBAAsB,CAAC;IAChC,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,KAAK,EAAE,YAAY,CAAC;IACpB,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;gBAG7B,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,aAAa,EACrB,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,UAAU,GAAG,gBAAgB,EACpC,IAAI,EAAE,OAAO,EAAE,EACf,OAAO,EAAE,sBAAsB,EAC/B,IAAI,EAAE,MAAM,EAAE,EACd,KAAK,EAAE,YAAY,EACnB,aAAa,EAAE,OAAO;CAwMzB"}
|
|
@@ -3,19 +3,23 @@ declare module '@warp-drive/schema-record/record' {
|
|
|
3
3
|
import { type Signal, Signals } from '@ember-data/tracking/-private';
|
|
4
4
|
import type { StableRecordIdentifier } from '@warp-drive/core-types';
|
|
5
5
|
import { RecordStore } from '@warp-drive/core-types/symbols';
|
|
6
|
-
import { Checkout, Destroy, Editable, Identifier, Legacy } from '@warp-drive/schema-record/symbols';
|
|
6
|
+
import { Checkout, Destroy, Editable, EmbeddedPath, EmbeddedType, Identifier, Legacy, Parent } from '@warp-drive/schema-record/symbols';
|
|
7
7
|
export { Editable, Legacy } from '@warp-drive/schema-record/symbols';
|
|
8
8
|
export class SchemaRecord {
|
|
9
9
|
[RecordStore]: Store;
|
|
10
10
|
[Identifier]: StableRecordIdentifier;
|
|
11
|
+
[Parent]: StableRecordIdentifier;
|
|
12
|
+
[EmbeddedType]: string | null;
|
|
13
|
+
[EmbeddedPath]: string[] | null;
|
|
11
14
|
[Editable]: boolean;
|
|
12
15
|
[Legacy]: boolean;
|
|
13
16
|
[Signals]: Map<string, Signal>;
|
|
17
|
+
[Symbol.toStringTag]: `SchemaRecord<${string}>`;
|
|
14
18
|
___notifications: object;
|
|
15
19
|
constructor(store: Store, identifier: StableRecordIdentifier, Mode: {
|
|
16
20
|
[Editable]: boolean;
|
|
17
21
|
[Legacy]: boolean;
|
|
18
|
-
});
|
|
22
|
+
}, isEmbedded?: boolean, embeddedType?: string | null, embeddedPath?: string[] | null);
|
|
19
23
|
[Destroy](): void;
|
|
20
24
|
[Checkout](): Promise<SchemaRecord>;
|
|
21
25
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"record.d.ts","sourceRoot":"","sources":["../src/record.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAE3C,OAAO,EAML,KAAK,MAAM,EACX,OAAO,EACR,MAAM,+BAA+B,CAAC;AAGvC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"record.d.ts","sourceRoot":"","sources":["../src/record.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAE3C,OAAO,EAML,KAAK,MAAM,EACX,OAAO,EACR,MAAM,+BAA+B,CAAC;AAGvC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAgBrE,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAK7D,OAAO,EAEL,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,MAAM,EAEN,MAAM,EACP,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAuP7C,qBAAa,YAAY;IACf,CAAC,WAAW,CAAC,EAAE,KAAK,CAAC;IACrB,CAAC,UAAU,CAAC,EAAE,sBAAsB,CAAC;IACrC,CAAC,MAAM,CAAC,EAAE,sBAAsB,CAAC;IACjC,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,CAAC,YAAY,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAChC,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACpB,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAClB,CAAC,OAAO,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,gBAAgB,MAAM,GAAG,CAAC;IAChD,gBAAgB,EAAE,MAAM,CAAC;gBAG/B,KAAK,EAAE,KAAK,EACZ,UAAU,EAAE,sBAAsB,EAClC,IAAI,EAAE;QAAE,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;QAAC,CAAC,MAAM,CAAC,EAAE,OAAO,CAAA;KAAE,EAChD,UAAU,UAAQ,EAClB,YAAY,GAAE,MAAM,GAAG,IAAW,EAClC,YAAY,GAAE,MAAM,EAAE,GAAG,IAAW;IA6UtC,CAAC,OAAO,CAAC,IAAI,IAAI;IASjB,CAAC,QAAQ,CAAC,IAAI,OAAO,CAAC,YAAY,CAAC;CAGpC"}
|
|
@@ -10,5 +10,7 @@ declare module '@warp-drive/schema-record/symbols' {
|
|
|
10
10
|
export const Parent: "___(unique) Symbol(Parent)";
|
|
11
11
|
export const Checkout: "___(unique) Symbol(Checkout)";
|
|
12
12
|
export const Legacy: "___(unique) Symbol(Legacy)";
|
|
13
|
+
export const EmbeddedPath: "___(unique) Symbol(EmbeddedPath)";
|
|
14
|
+
export const EmbeddedType: "___(unique) Symbol(EmbeddedType)";
|
|
13
15
|
}
|
|
14
16
|
//# sourceMappingURL=symbols.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"symbols.d.ts","sourceRoot":"","sources":["../src/symbols.ts"],"names":[],"mappings":"AAiCA,eAAO,MAAM,MAAM,8BAA8C,CAAC;AAClE,eAAO,MAAM,MAAM,8BAA8C,CAAC;AAClE,eAAO,MAAM,YAAY,oCAA0D,CAAC;AACpF,eAAO,MAAM,aAAa,qCAA4D,CAAC;AACvF,eAAO,MAAM,MAAM,8BAA8C,CAAC;AAElE,eAAO,MAAM,OAAO,+BAA+C,CAAC;AACpE,eAAO,MAAM,UAAU,kCAAqD,CAAC;AAC7E,eAAO,MAAM,QAAQ,gCAAiD,CAAC;AACvE,eAAO,MAAM,MAAM,8BAA6C,CAAC;AACjE,eAAO,MAAM,QAAQ,gCAAiD,CAAC;AACvE,eAAO,MAAM,MAAM,8BAA6C,CAAC"}
|
|
1
|
+
{"version":3,"file":"symbols.d.ts","sourceRoot":"","sources":["../src/symbols.ts"],"names":[],"mappings":"AAiCA,eAAO,MAAM,MAAM,8BAA8C,CAAC;AAClE,eAAO,MAAM,MAAM,8BAA8C,CAAC;AAClE,eAAO,MAAM,YAAY,oCAA0D,CAAC;AACpF,eAAO,MAAM,aAAa,qCAA4D,CAAC;AACvF,eAAO,MAAM,MAAM,8BAA8C,CAAC;AAElE,eAAO,MAAM,OAAO,+BAA+C,CAAC;AACpE,eAAO,MAAM,UAAU,kCAAqD,CAAC;AAC7E,eAAO,MAAM,QAAQ,gCAAiD,CAAC;AACvE,eAAO,MAAM,MAAM,8BAA6C,CAAC;AACjE,eAAO,MAAM,QAAQ,gCAAiD,CAAC;AACvE,eAAO,MAAM,MAAM,8BAA6C,CAAC;AAEjE,eAAO,MAAM,YAAY,oCAAyD,CAAC;AACnF,eAAO,MAAM,YAAY,oCAAyD,CAAC"}
|