@warp-drive/schema-record 0.0.0-alpha.39 → 0.0.0-alpha.41
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/addon/record.js +176 -1
- package/addon/record.js.map +1 -1
- package/addon/schema.js +1 -1
- package/addon/schema.js.map +1 -1
- package/package.json +14 -14
- package/unstable-preview-types/index.d.ts +2 -1
- package/unstable-preview-types/managed-object.d.ts +26 -0
- package/unstable-preview-types/managed-object.d.ts.map +1 -0
- package/unstable-preview-types/record.d.ts.map +1 -1
- package/unstable-preview-types/schema.d.ts.map +1 -1
package/addon/record.js
CHANGED
|
@@ -1,9 +1,101 @@
|
|
|
1
1
|
import { assert } from '@ember/debug';
|
|
2
|
-
import { defineSignal, Signals, addToTransaction, entangleSignal, getSignal, peekSignal } from '@ember-data/tracking/-private';
|
|
2
|
+
import { createSignal, subscribe, defineSignal, Signals, addToTransaction, entangleSignal, getSignal, peekSignal } from '@ember-data/tracking/-private';
|
|
3
3
|
import { STRUCTURED } from '@warp-drive/core-types/request';
|
|
4
4
|
import { RecordStore } from '@warp-drive/core-types/symbols';
|
|
5
5
|
import { ARRAY_SIGNAL, ManagedArray } from "./managed-array";
|
|
6
6
|
import { macroCondition, getOwnConfig } from '@embroider/macros';
|
|
7
|
+
const SOURCE = Symbol('#source');
|
|
8
|
+
const OBJECT_SIGNAL = Symbol('#signal');
|
|
9
|
+
class ManagedObject {
|
|
10
|
+
constructor(store, schema, cache, field, data, address, key, owner) {
|
|
11
|
+
this[SOURCE] = void 0;
|
|
12
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
13
|
+
const self = this;
|
|
14
|
+
this[SOURCE] = {
|
|
15
|
+
...data
|
|
16
|
+
};
|
|
17
|
+
this[OBJECT_SIGNAL] = createSignal(this, 'length');
|
|
18
|
+
const _SIGNAL = this[OBJECT_SIGNAL];
|
|
19
|
+
// const boundFns = new Map<KeyType, ProxiedMethod>();
|
|
20
|
+
this.address = address;
|
|
21
|
+
this.key = key;
|
|
22
|
+
this.owner = owner;
|
|
23
|
+
const proxy = new Proxy(this[SOURCE], {
|
|
24
|
+
get(target, prop, receiver) {
|
|
25
|
+
if (prop === OBJECT_SIGNAL) {
|
|
26
|
+
return _SIGNAL;
|
|
27
|
+
}
|
|
28
|
+
if (prop === 'address') {
|
|
29
|
+
return self.address;
|
|
30
|
+
}
|
|
31
|
+
if (prop === 'key') {
|
|
32
|
+
return self.key;
|
|
33
|
+
}
|
|
34
|
+
if (prop === 'owner') {
|
|
35
|
+
return self.owner;
|
|
36
|
+
}
|
|
37
|
+
if (_SIGNAL.shouldReset) {
|
|
38
|
+
_SIGNAL.t = false;
|
|
39
|
+
_SIGNAL.shouldReset = false;
|
|
40
|
+
let newData = cache.getAttr(self.address, self.key);
|
|
41
|
+
if (newData && newData !== self[SOURCE]) {
|
|
42
|
+
if (field.type !== null) {
|
|
43
|
+
const transform = schema.transforms.get(field.type);
|
|
44
|
+
if (!transform) {
|
|
45
|
+
throw new Error(`No '${field.type}' transform defined for use by ${address.type}.${String(prop)}`);
|
|
46
|
+
}
|
|
47
|
+
newData = transform.hydrate(newData, field.options ?? null, self.owner);
|
|
48
|
+
}
|
|
49
|
+
self[SOURCE] = {
|
|
50
|
+
...newData
|
|
51
|
+
}; // Add type assertion for newData
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
if (prop in self[SOURCE]) {
|
|
55
|
+
{
|
|
56
|
+
subscribe(_SIGNAL);
|
|
57
|
+
}
|
|
58
|
+
return self[SOURCE][prop];
|
|
59
|
+
}
|
|
60
|
+
return Reflect.get(target, prop, receiver);
|
|
61
|
+
},
|
|
62
|
+
set(target, prop, value, receiver) {
|
|
63
|
+
if (prop === 'address') {
|
|
64
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
65
|
+
self.address = value;
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
if (prop === 'key') {
|
|
69
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
70
|
+
self.key = value;
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
73
|
+
if (prop === 'owner') {
|
|
74
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
75
|
+
self.owner = value;
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
const reflect = Reflect.set(target, prop, value, receiver);
|
|
79
|
+
if (reflect) {
|
|
80
|
+
if (field.type === null) {
|
|
81
|
+
cache.setAttr(self.address, self.key, self[SOURCE]);
|
|
82
|
+
_SIGNAL.shouldReset = true;
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
const transform = schema.transforms.get(field.type);
|
|
86
|
+
if (!transform) {
|
|
87
|
+
throw new Error(`No '${field.type}' transform defined for use by ${address.type}.${String(prop)}`);
|
|
88
|
+
}
|
|
89
|
+
const val = transform.serialize(self[SOURCE], field.options ?? null, self.owner);
|
|
90
|
+
cache.setAttr(self.address, self.key, val);
|
|
91
|
+
_SIGNAL.shouldReset = true;
|
|
92
|
+
}
|
|
93
|
+
return reflect;
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
return proxy;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
7
99
|
const Destroy = Symbol('Destroy');
|
|
8
100
|
const Identifier = Symbol('Identifier');
|
|
9
101
|
const Editable = Symbol('Editable');
|
|
@@ -13,6 +105,7 @@ const Legacy = Symbol('Legacy');
|
|
|
13
105
|
const IgnoredGlobalFields = new Set(['then', STRUCTURED]);
|
|
14
106
|
const RecordSymbols = new Set([Destroy, RecordStore, Identifier, Editable, Parent, Checkout, Legacy, Signals]);
|
|
15
107
|
const ManagedArrayMap = new Map();
|
|
108
|
+
const ManagedObjectMap = new Map();
|
|
16
109
|
function computeLocal(record, field, prop) {
|
|
17
110
|
let signal = peekSignal(record, prop);
|
|
18
111
|
if (!signal) {
|
|
@@ -27,6 +120,12 @@ function peekManagedArray(record, field) {
|
|
|
27
120
|
return managedArrayMapForRecord.get(field);
|
|
28
121
|
}
|
|
29
122
|
}
|
|
123
|
+
function peekManagedObject(record, field) {
|
|
124
|
+
const managedObjectMapForRecord = ManagedObjectMap.get(record);
|
|
125
|
+
if (managedObjectMapForRecord) {
|
|
126
|
+
return managedObjectMapForRecord.get(field);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
30
129
|
function computeField(schema, cache, record, identifier, field, prop) {
|
|
31
130
|
const rawValue = cache.getAttr(identifier, prop);
|
|
32
131
|
if (field.type === null) {
|
|
@@ -66,6 +165,37 @@ function computeArray(store, schema, cache, record, identifier, field, prop) {
|
|
|
66
165
|
}
|
|
67
166
|
return managedArray;
|
|
68
167
|
}
|
|
168
|
+
function computeObject(store, schema, cache, record, identifier, field, prop) {
|
|
169
|
+
const managedObjectMapForRecord = ManagedObjectMap.get(record);
|
|
170
|
+
let managedObject;
|
|
171
|
+
if (managedObjectMapForRecord) {
|
|
172
|
+
managedObject = managedObjectMapForRecord.get(field);
|
|
173
|
+
}
|
|
174
|
+
if (managedObject) {
|
|
175
|
+
return managedObject;
|
|
176
|
+
} else {
|
|
177
|
+
let rawValue = cache.getAttr(identifier, prop);
|
|
178
|
+
if (!rawValue) {
|
|
179
|
+
return null;
|
|
180
|
+
}
|
|
181
|
+
if (field.kind === 'object') {
|
|
182
|
+
if (field.type !== null) {
|
|
183
|
+
const transform = schema.transforms.get(field.type);
|
|
184
|
+
if (!transform) {
|
|
185
|
+
throw new Error(`No '${field.type}' transform defined for use by ${identifier.type}.${String(prop)}`);
|
|
186
|
+
}
|
|
187
|
+
rawValue = transform.hydrate(rawValue, field.options ?? null, record);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
managedObject = new ManagedObject(store, schema, cache, field, rawValue, identifier, prop, record);
|
|
191
|
+
if (!managedObjectMapForRecord) {
|
|
192
|
+
ManagedObjectMap.set(record, new Map([[field, managedObject]]));
|
|
193
|
+
} else {
|
|
194
|
+
managedObjectMapForRecord.set(field, managedObject);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
return managedObject;
|
|
198
|
+
}
|
|
69
199
|
function computeAttribute(cache, identifier, prop) {
|
|
70
200
|
return cache.getAttr(identifier, prop);
|
|
71
201
|
}
|
|
@@ -209,10 +339,21 @@ class SchemaRecord {
|
|
|
209
339
|
return computeResource(store, cache, target, identifier, field, prop);
|
|
210
340
|
case 'derived':
|
|
211
341
|
return computeDerivation(schema, receiver, identifier, field, prop);
|
|
342
|
+
case 'schema-array':
|
|
343
|
+
throw new Error(`Not Implemented`);
|
|
212
344
|
case 'array':
|
|
213
345
|
assert(`SchemaRecord.${field.name} is not available in legacy mode because it has type '${field.kind}'`, !target[Legacy]);
|
|
214
346
|
entangleSignal(signals, receiver, field.name);
|
|
215
347
|
return computeArray(store, schema, cache, target, identifier, field, prop);
|
|
348
|
+
case 'schema-object':
|
|
349
|
+
// validate any access off of schema, no transform to run
|
|
350
|
+
// use raw cache value as the object to manage
|
|
351
|
+
throw new Error(`Not Implemented`);
|
|
352
|
+
case 'object':
|
|
353
|
+
assert(`SchemaRecord.${field.name} is not available in legacy mode because it has type '${field.kind}'`, !target[Legacy]);
|
|
354
|
+
entangleSignal(signals, receiver, field.name);
|
|
355
|
+
// run transform, then use that value as the object to manage
|
|
356
|
+
return computeObject(store, schema, cache, target, identifier, field, prop);
|
|
216
357
|
default:
|
|
217
358
|
throw new Error(`Field '${String(prop)}' on '${identifier.type}' has the unknown kind '${field.kind}'`);
|
|
218
359
|
}
|
|
@@ -281,6 +422,40 @@ class SchemaRecord {
|
|
|
281
422
|
}
|
|
282
423
|
return true;
|
|
283
424
|
}
|
|
425
|
+
case 'object':
|
|
426
|
+
{
|
|
427
|
+
if (field.type === null) {
|
|
428
|
+
let newValue = value;
|
|
429
|
+
if (value !== null) {
|
|
430
|
+
newValue = {
|
|
431
|
+
...value
|
|
432
|
+
};
|
|
433
|
+
} else {
|
|
434
|
+
ManagedObjectMap.delete(target);
|
|
435
|
+
}
|
|
436
|
+
cache.setAttr(identifier, prop, newValue);
|
|
437
|
+
const peeked = peekManagedObject(self, field);
|
|
438
|
+
if (peeked) {
|
|
439
|
+
const objSignal = peeked[OBJECT_SIGNAL];
|
|
440
|
+
objSignal.shouldReset = true;
|
|
441
|
+
}
|
|
442
|
+
return true;
|
|
443
|
+
}
|
|
444
|
+
const transform = schema.transforms.get(field.type);
|
|
445
|
+
if (!transform) {
|
|
446
|
+
throw new Error(`No '${field.type}' transform defined for use by ${identifier.type}.${String(prop)}`);
|
|
447
|
+
}
|
|
448
|
+
const rawValue = transform.serialize({
|
|
449
|
+
...value
|
|
450
|
+
}, field.options ?? null, target);
|
|
451
|
+
cache.setAttr(identifier, prop, rawValue);
|
|
452
|
+
const peeked = peekManagedObject(self, field);
|
|
453
|
+
if (peeked) {
|
|
454
|
+
const objSignal = peeked[OBJECT_SIGNAL];
|
|
455
|
+
objSignal.shouldReset = true;
|
|
456
|
+
}
|
|
457
|
+
return true;
|
|
458
|
+
}
|
|
284
459
|
case 'derived':
|
|
285
460
|
{
|
|
286
461
|
throw new Error(`Cannot set ${String(prop)} on ${identifier.type} because it is derived`);
|
package/addon/record.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"record.js","sources":["../src/record.ts"],"sourcesContent":["import { assert } from '@ember/debug';\n\nimport { DEBUG } from '@ember-data/env';\nimport type { Future } from '@ember-data/request';\nimport type Store from '@ember-data/store';\nimport type { StoreRequestInput } from '@ember-data/store/-private/cache-handler';\nimport type { NotificationType } from '@ember-data/store/-private/managers/notification-manager';\nimport type { FieldSchema } from '@ember-data/store/-types/q/schema-service';\nimport {\n addToTransaction,\n defineSignal,\n entangleSignal,\n getSignal,\n peekSignal,\n type Signal,\n Signals,\n} from '@ember-data/tracking/-private';\nimport type { StableRecordIdentifier } from '@warp-drive/core-types';\nimport type { Cache } from '@warp-drive/core-types/cache';\nimport type { ResourceRelationship as SingleResourceRelationship } from '@warp-drive/core-types/cache/relationship';\nimport type { ArrayValue, Value } from '@warp-drive/core-types/json/raw';\nimport { STRUCTURED } from '@warp-drive/core-types/request';\nimport type { Link, Links } from '@warp-drive/core-types/spec/raw';\nimport { RecordStore } from '@warp-drive/core-types/symbols';\n\nimport { ARRAY_SIGNAL, ManagedArray } from './managed-array';\nimport type { SchemaService } from './schema';\n\nexport const Destroy = Symbol('Destroy');\nexport const Identifier = Symbol('Identifier');\nexport const Editable = Symbol('Editable');\nexport const Parent = Symbol('Parent');\nexport const Checkout = Symbol('Checkout');\nexport const Legacy = Symbol('Legacy');\n\nconst IgnoredGlobalFields = new Set(['then', STRUCTURED]);\nconst RecordSymbols = new Set([Destroy, RecordStore, Identifier, Editable, Parent, Checkout, Legacy, Signals]);\n\nconst ManagedArrayMap = new Map<SchemaRecord, Map<FieldSchema, ManagedArray>>();\n\nfunction computeLocal(record: typeof Proxy<SchemaRecord>, field: FieldSchema, 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 computeField(\n schema: SchemaService,\n cache: Cache,\n record: SchemaRecord,\n identifier: StableRecordIdentifier,\n field: FieldSchema,\n prop: string\n): unknown {\n const rawValue = cache.getAttr(identifier, prop);\n if (field.type === null) {\n return rawValue;\n }\n const transform = schema.transforms.get(field.type);\n if (!transform) {\n throw new Error(`No '${field.type}' transform defined for use by ${identifier.type}.${String(prop)}`);\n }\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: FieldSchema,\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 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: FieldSchema,\n prop: string\n): unknown {\n if (field.type === null) {\n throw new Error(`The schema for ${identifier.type}.${String(prop)} is missing the type of the derivation`);\n }\n\n const derivation = schema.derivations.get(field.type);\n if (!derivation) {\n throw new Error(`No '${field.type}' derivation defined for use by ${identifier.type}.${String(prop)}`);\n }\n return derivation(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): 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 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 symbol)) {\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 = fields.get(prop as string);\n if (!field) {\n if (IgnoredGlobalFields.has(prop as string | 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 '@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 '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 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 === null) {\n cache.setAttr(identifier, prop as string, value as Value);\n return true;\n }\n const transform = schema.transforms.get(field.type);\n\n if (!transform) {\n throw new Error(`No '${field.type}' transform defined for use by ${identifier.type}.${String(prop)}`);\n }\n\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 === null) {\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.transforms.get(field.type);\n if (!transform) {\n throw new Error(`No '${field.type}' transform defined for use by ${identifier.type}.${String(prop)}`);\n }\n\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 '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":["Destroy","Symbol","Identifier","Editable","Parent","Checkout","Legacy","IgnoredGlobalFields","Set","STRUCTURED","RecordSymbols","RecordStore","Signals","ManagedArrayMap","Map","computeLocal","record","field","prop","signal","peekSignal","getSignal","lastValue","options","defaultValue","peekManagedArray","managedArrayMapForRecord","get","computeField","schema","cache","identifier","rawValue","getAttr","type","transform","transforms","Error","String","hydrate","computeArray","store","managedArray","ManagedArray","set","computeAttribute","computeDerivation","derivation","derivations","ResourceRelationship","constructor","parent","name","getRelationship","lid","links","self","data","peekRecord","macroCondition","getOwnConfig","env","DEBUG","Object","freeze","assign","meta","fetch","url","getHref","related","method","request","defineSignal","prototype","link","href","computeResource","kind","SchemaRecord","Mode","IS_EDITABLE","fields","signals","___notifications","notifications","subscribe","_","key","addToTransaction","peeked","arrSignal","ARRAY_SIGNAL","shouldReset","Proxy","target","receiver","has","undefined","entangleSignal","id","assert","value","setAttr","serialize","slice","Array","isArray","delete","map","item","isDestroying","isDestroyed","unsubscribe","Promise","resolve"],"mappings":";;;;;;;MA4BaA,OAAO,GAAGC,MAAM,CAAC,SAAS,EAAC;MAC3BC,UAAU,GAAGD,MAAM,CAAC,YAAY,EAAC;MACjCE,QAAQ,GAAGF,MAAM,CAAC,UAAU,EAAC;MAC7BG,MAAM,GAAGH,MAAM,CAAC,QAAQ,E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G,KAAK,CAAE,CAAA,mBAAA,EAAqBpB,KAAK,CAAC6D,IAAK,EAAC,CAAC,CAAA;AACvD,SAAA;AACF,OAAA;AACF,KAAC,CAAC,CAAA;AACJ,GAAA;AAEA,EAAA,CAAC9E,OAAO,CAAU,GAAA;AAChB,IAAA,IAAI,IAAI,CAACM,MAAM,CAAC,EAAE;AAChB;MACA,IAAI,CAACyG,YAAY,GAAG,IAAI,CAAA;AACxB;MACA,IAAI,CAACC,WAAW,GAAG,IAAI,CAAA;AACzB,KAAA;IACA,IAAI,CAACrG,WAAW,CAAC,CAAC0E,aAAa,CAAC4B,WAAW,CAAC,IAAI,CAAC7B,gBAAgB,CAAC,CAAA;AACpE,GAAA;AACA,EAAA,CAAC/E,QAAQ,CAA2B,GAAA;AAClC,IAAA,OAAO6G,OAAO,CAACC,OAAO,CAAC,IAAI,CAAC,CAAA;AAC9B,GAAA;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"record.js","sources":["../src/managed-object.ts","../src/record.ts"],"sourcesContent":["import type Store from '@ember-data/store';\nimport type { FieldSchema } from '@ember-data/store/-types/q/schema-service';\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';\n\nimport type { SchemaRecord } from './record';\nimport type { SchemaService } from './schema';\n\nexport const SOURCE = Symbol('#source');\nexport const MUTATE = Symbol('#update');\nexport const OBJECT_SIGNAL = Symbol('#signal');\nexport const NOTIFY = Symbol('#notify');\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: FieldSchema,\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 !== null) {\n const transform = schema.transforms.get(field.type);\n if (!transform) {\n throw new Error(`No '${field.type}' transform defined for use by ${address.type}.${String(prop)}`);\n }\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 === null) {\n cache.setAttr(self.address, self.key, self[SOURCE] as Value);\n _SIGNAL.shouldReset = true;\n return true;\n }\n\n const transform = schema.transforms.get(field.type);\n if (!transform) {\n throw new Error(`No '${field.type}' transform defined for use by ${address.type}.${String(prop)}`);\n }\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 { assert } from '@ember/debug';\n\nimport { DEBUG } from '@ember-data/env';\nimport type { Future } from '@ember-data/request';\nimport type Store from '@ember-data/store';\nimport type { StoreRequestInput } from '@ember-data/store/-private/cache-handler';\nimport type { NotificationType } from '@ember-data/store/-private/managers/notification-manager';\nimport type { FieldSchema } from '@ember-data/store/-types/q/schema-service';\nimport {\n addToTransaction,\n defineSignal,\n entangleSignal,\n getSignal,\n peekSignal,\n type Signal,\n Signals,\n} from '@ember-data/tracking/-private';\nimport type { StableRecordIdentifier } from '@warp-drive/core-types';\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 { Link, Links } from '@warp-drive/core-types/spec/raw';\nimport { RecordStore } from '@warp-drive/core-types/symbols';\n\nimport { ARRAY_SIGNAL, ManagedArray } from './managed-array';\nimport { ManagedObject, OBJECT_SIGNAL } from './managed-object';\nimport type { SchemaService } from './schema';\n\nexport const Destroy = Symbol('Destroy');\nexport const Identifier = Symbol('Identifier');\nexport const Editable = Symbol('Editable');\nexport const Parent = Symbol('Parent');\nexport const Checkout = Symbol('Checkout');\nexport const Legacy = Symbol('Legacy');\n\nconst IgnoredGlobalFields = new Set(['then', STRUCTURED]);\nconst RecordSymbols = new Set([Destroy, RecordStore, Identifier, Editable, Parent, Checkout, Legacy, Signals]);\n\nconst ManagedArrayMap = new Map<SchemaRecord, Map<FieldSchema, ManagedArray>>();\nconst ManagedObjectMap = new Map<SchemaRecord, Map<FieldSchema, ManagedObject>>();\n\nfunction computeLocal(record: typeof Proxy<SchemaRecord>, field: FieldSchema, 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: FieldSchema,\n prop: string\n): unknown {\n const rawValue = cache.getAttr(identifier, prop);\n if (field.type === null) {\n return rawValue;\n }\n const transform = schema.transforms.get(field.type);\n if (!transform) {\n throw new Error(`No '${field.type}' transform defined for use by ${identifier.type}.${String(prop)}`);\n }\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: FieldSchema,\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: FieldSchema,\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 !== null) {\n const transform = schema.transforms.get(field.type);\n if (!transform) {\n throw new Error(`No '${field.type}' transform defined for use by ${identifier.type}.${String(prop)}`);\n }\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: FieldSchema,\n prop: string\n): unknown {\n if (field.type === null) {\n throw new Error(`The schema for ${identifier.type}.${String(prop)} is missing the type of the derivation`);\n }\n\n const derivation = schema.derivations.get(field.type);\n if (!derivation) {\n throw new Error(`No '${field.type}' derivation defined for use by ${identifier.type}.${String(prop)}`);\n }\n return derivation(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): 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 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 symbol)) {\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 = fields.get(prop as string);\n if (!field) {\n if (IgnoredGlobalFields.has(prop as string | 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 '@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 === null) {\n cache.setAttr(identifier, prop as string, value as Value);\n return true;\n }\n const transform = schema.transforms.get(field.type);\n\n if (!transform) {\n throw new Error(`No '${field.type}' transform defined for use by ${identifier.type}.${String(prop)}`);\n }\n\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 === null) {\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.transforms.get(field.type);\n if (!transform) {\n throw new Error(`No '${field.type}' transform defined for use by ${identifier.type}.${String(prop)}`);\n }\n\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 === null) {\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.transforms.get(field.type);\n if (!transform) {\n throw new Error(`No '${field.type}' transform defined for use by ${identifier.type}.${String(prop)}`);\n }\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":["SOURCE","Symbol","OBJECT_SIGNAL","ManagedObject","constructor","store","schema","cache","field","data","address","key","owner","self","createSignal","_SIGNAL","proxy","Proxy","get","target","prop","receiver","shouldReset","t","newData","getAttr","type","transform","transforms","Error","String","hydrate","options","subscribe","Reflect","set","value","reflect","setAttr","val","serialize","Destroy","Identifier","Editable","Parent","Checkout","Legacy","IgnoredGlobalFields","Set","STRUCTURED","RecordSymbols","RecordStore","Signals","ManagedArrayMap","Map","ManagedObjectMap","computeLocal","record","signal","peekSignal","getSignal","lastValue","defaultValue","peekManagedArray","managedArrayMapForRecord","peekManagedObject","managedObjectMapForRecord","computeField","identifier","rawValue","computeArray","managedArray","ManagedArray","computeObject","managedObject","kind","computeAttribute","computeDerivation","derivation","derivations","ResourceRelationship","parent","name","getRelationship","lid","links","peekRecord","macroCondition","getOwnConfig","env","DEBUG","Object","freeze","assign","meta","fetch","url","getHref","related","method","request","defineSignal","prototype","link","href","computeResource","SchemaRecord","Mode","IS_EDITABLE","fields","signals","___notifications","notifications","_","addToTransaction","peeked","arrSignal","ARRAY_SIGNAL","has","undefined","entangleSignal","id","assert","slice","Array","isArray","delete","map","item","newValue","objSignal","isDestroying","isDestroyed","unsubscribe","Promise","resolve"],"mappings":";;;;;;;AAWO,MAAMA,MAAM,GAAGC,MAAM,CAAC,SA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ACvD,SAAA;AACF,OAAA;AACF,KAAC,CAAC,CAAA;AACJ,GAAA;AAEA,EAAA,CAAClC,OAAO,CAAU,GAAA;AAChB,IAAA,IAAI,IAAI,CAACK,MAAM,CAAC,EAAE;AAChB;MACA,IAAI,CAACqF,YAAY,GAAG,IAAI,CAAA;AACxB;MACA,IAAI,CAACC,WAAW,GAAG,IAAI,CAAA;AACzB,KAAA;IACA,IAAI,CAACjF,WAAW,CAAC,CAAC6D,aAAa,CAACqB,WAAW,CAAC,IAAI,CAACtB,gBAAgB,CAAC,CAAA;AACpE,GAAA;AACA,EAAA,CAAClE,QAAQ,CAA2B,GAAA;AAClC,IAAA,OAAOyF,OAAO,CAACC,OAAO,CAAC,IAAI,CAAC,CAAA;AAC9B,GAAA;AACF;;;;"}
|
package/addon/schema.js
CHANGED
|
@@ -112,7 +112,7 @@ class SchemaService {
|
|
|
112
112
|
kind: field.kind === 'resource' ? 'belongsTo' : 'hasMany'
|
|
113
113
|
});
|
|
114
114
|
fieldSpec.relationships[field.name] = relSchema;
|
|
115
|
-
} else if (field.kind !== 'derived' && field.kind !== '@local' && field.kind !== 'array') {
|
|
115
|
+
} else if (field.kind !== 'derived' && field.kind !== '@local' && field.kind !== 'array' && field.kind !== 'object') {
|
|
116
116
|
throw new Error(`Unknown field kind ${field.kind}`);
|
|
117
117
|
}
|
|
118
118
|
});
|
package/addon/schema.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sources":["../src/-base-fields.ts","../src/schema.ts"],"sourcesContent":["import { assert } from '@ember/debug';\n\nimport { recordIdentifierFor } from '@ember-data/store';\nimport type { OpaqueRecordInstance } from '@ember-data/store/-types/q/record-instance';\nimport type { FieldSchema } from '@ember-data/store/-types/q/schema-service';\nimport type { StableRecordIdentifier } from '@warp-drive/core-types';\n\nimport { Identifier, type SchemaRecord } from './record';\nimport type { Derivation, SchemaService } from './schema';\n\nconst Support = new WeakMap<WeakKey, Record<string, unknown>>();\n\nexport const SchemaRecordFields: FieldSchema[] = [\n {\n type: '@constructor',\n name: 'constructor',\n kind: 'derived',\n },\n {\n name: 'id',\n kind: '@id',\n type: null,\n },\n {\n type: '@identity',\n name: '$type',\n kind: 'derived',\n options: { key: 'type' },\n },\n];\n\nconst _constructor: Derivation<OpaqueRecordInstance, unknown> = function (record) {\n let state = Support.get(record as WeakKey);\n if (!state) {\n state = {};\n Support.set(record as WeakKey, state);\n }\n\n return (state._constructor = state._constructor || {\n name: `SchemaRecord<${recordIdentifierFor(record).type}>`,\n get modelName() {\n throw new Error('Cannot access record.constructor.modelName on non-Legacy Schema Records.');\n },\n });\n};\n\nexport function withFields(fields: FieldSchema[]) {\n fields.push(...SchemaRecordFields);\n return fields;\n}\n\nexport function fromIdentity(record: SchemaRecord, options: null, key: string): asserts options;\nexport function fromIdentity(record: SchemaRecord, options: { key: 'lid' }, key: string): string;\nexport function fromIdentity(record: SchemaRecord, options: { key: 'type' }, key: string): string;\nexport function fromIdentity(record: SchemaRecord, options: { key: 'id' }, key: string): string | null;\nexport function fromIdentity(record: SchemaRecord, options: { key: '^' }, key: string): StableRecordIdentifier;\nexport function fromIdentity(\n record: SchemaRecord,\n options: { key: 'id' | 'lid' | 'type' | '^' } | null,\n key: string\n): StableRecordIdentifier | string | null {\n const identifier = record[Identifier];\n assert(`Cannot compute @identity for a record without an identifier`, identifier);\n assert(\n `Expected to receive a key to compute @identity, but got ${String(options)}`,\n options?.key && ['lid', 'id', 'type', '^'].includes(options.key)\n );\n\n return options.key === '^' ? identifier : identifier[options.key];\n}\n\nexport function registerDerivations(schema: SchemaService) {\n schema.registerDerivation(\n '@identity',\n fromIdentity as Derivation<SchemaRecord, StableRecordIdentifier | string | null>\n );\n schema.registerDerivation('@constructor', _constructor);\n}\n","import { assert } from '@ember/debug';\n\nimport type { FieldSchema } from '@ember-data/store/-types/q/schema-service';\nimport { createCache, getValue } from '@ember-data/tracking';\nimport { type Signal, Signals } from '@ember-data/tracking/-private';\nimport type { StableRecordIdentifier } from '@warp-drive/core-types';\nimport type { Value } from '@warp-drive/core-types/json/raw';\nimport type { AttributeSchema, RelationshipSchema } from '@warp-drive/core-types/schema';\n\nimport type { SchemaRecord } from './record';\n\nexport { withFields, registerDerivations } from './-base-fields';\n\n/**\n * The full schema for a resource\n *\n * @class FieldSpec\n * @internal\n */\ntype FieldSpec = {\n '@id': FieldSchema | null;\n /**\n * legacy schema service separated attribute\n * from relationship lookup\n * @internal\n */\n attributes: Record<string, AttributeSchema>;\n /**\n * legacy schema service separated attribute\n * from relationship lookup\n * @internal\n */\n relationships: Record<string, RelationshipSchema>;\n /**\n * new schema service is fields based\n * @internal\n */\n fields: Map<string, FieldSchema>;\n /**\n * legacy model mode support\n * @internal\n */\n legacy?: boolean;\n};\n\nexport type Transform<T extends Value = string, PT = unknown> = {\n serialize(value: PT, options: Record<string, unknown> | null, record: SchemaRecord): T;\n hydrate(value: T | undefined, options: Record<string, unknown> | null, record: SchemaRecord): PT;\n defaultValue?(options: Record<string, unknown> | null, identifier: StableRecordIdentifier): T;\n};\n\nexport type Derivation<R, T> = (record: R, options: Record<string, unknown> | null, prop: string) => T;\n\n/**\n * Wraps a derivation in a new function with Derivation signature but that looks\n * up the value in the cache before recomputing.\n *\n * @param record\n * @param options\n * @param prop\n */\nfunction makeCachedDerivation<R, T>(derivation: Derivation<R, T>): Derivation<R, T> {\n return (record: R, options: Record<string, unknown> | null, prop: string): T => {\n const signals = (record as { [Signals]: Map<string, Signal> })[Signals];\n let signal = signals.get(prop);\n if (!signal) {\n signal = createCache(() => {\n return derivation(record, options, prop);\n }) as unknown as Signal; // a total lie, for convenience of reusing the storage\n signals.set(prop, signal);\n }\n\n return getValue(signal as unknown as ReturnType<typeof createCache>) as T;\n };\n}\n\nexport class SchemaService {\n declare schemas: Map<string, FieldSpec>;\n declare transforms: Map<string, Transform<Value>>;\n declare derivations: Map<string, Derivation<unknown, unknown>>;\n\n constructor() {\n this.schemas = new Map();\n this.transforms = new Map();\n this.derivations = new Map();\n }\n\n registerTransform<T extends Value = string, PT = unknown>(type: string, transform: Transform<T, PT>): void {\n this.transforms.set(type, transform);\n }\n\n registerDerivation<R, T>(type: string, derivation: Derivation<R, T>): void {\n this.derivations.set(type, makeCachedDerivation(derivation) as Derivation<unknown, unknown>);\n }\n\n defineSchema(name: string, schema: { legacy?: boolean; fields: FieldSchema[] }): void {\n const { legacy, fields } = schema;\n const fieldSpec: FieldSpec = {\n '@id': null,\n attributes: {},\n relationships: {},\n fields: new Map(),\n legacy: legacy ?? false,\n };\n\n assert(\n `Only one field can be defined as @id, ${name} has more than one: ${fields\n .filter((f) => f.kind === '@id')\n .map((f) => f.name)\n .join(' ')}`,\n fields.filter((f) => f.kind === '@id').length <= 1\n );\n fields.forEach((field) => {\n fieldSpec.fields.set(field.name, field);\n\n if (field.kind === '@id') {\n fieldSpec['@id'] = field;\n } else if (field.kind === 'field') {\n // We don't add 'field' fields to attributes in order to allow simpler\n // migration between transformation behaviors\n // serializers and things which call attributesDefinitionFor will\n // only run on the things that are legacy attribute mode, while all fields\n // will have their serialize/hydrate logic managed by the cache and record\n //\n // This means that if you want to normalize fields pre-cache insertion\n // Or pre-api call you wil need to use the newer `schema.fields()` API\n // To opt-in to that ability (which note, is now an anti-pattern)\n //\n // const attr = Object.assign({}, field, { kind: 'attribute' }) as AttributeSchema;\n // fieldSpec.attributes[attr.name] = attr;\n } else if (field.kind === 'attribute') {\n fieldSpec.attributes[field.name] = field as AttributeSchema;\n } else if (field.kind === 'resource' || field.kind === 'collection') {\n const relSchema = Object.assign({}, field, {\n kind: field.kind === 'resource' ? 'belongsTo' : 'hasMany',\n }) as unknown as RelationshipSchema;\n fieldSpec.relationships[field.name] = relSchema;\n } else if (field.kind !== 'derived' && field.kind !== '@local' && field.kind !== 'array') {\n throw new Error(`Unknown field kind ${field.kind}`);\n }\n });\n\n this.schemas.set(name, fieldSpec);\n }\n\n fields({ type }: { type: string }): FieldSpec['fields'] {\n const schema = this.schemas.get(type);\n\n if (!schema) {\n throw new Error(`No schema defined for ${type}`);\n }\n\n return schema.fields;\n }\n\n attributesDefinitionFor({ type }: { type: string }): FieldSpec['attributes'] {\n const schema = this.schemas.get(type);\n\n if (!schema) {\n throw new Error(`No schema defined for ${type}`);\n }\n\n return schema.attributes;\n }\n\n relationshipsDefinitionFor({ type }: { type: string }): FieldSpec['relationships'] {\n const schema = this.schemas.get(type);\n\n if (!schema) {\n throw new Error(`No schema defined for ${type}`);\n }\n\n return schema.relationships;\n }\n\n doesTypeExist(type: string): boolean {\n return this.schemas.has(type);\n }\n}\n"],"names":["Support","WeakMap","SchemaRecordFields","type","name","kind","options","key","_constructor","record","state","get","set","recordIdentifierFor","modelName","Error","withFields","fields","push","fromIdentity","identifier","Identifier","assert","String","includes","registerDerivations","schema","registerDerivation","makeCachedDerivation","derivation","prop","signals","Signals","signal","createCache","getValue","SchemaService","constructor","schemas","Map","transforms","derivations","registerTransform","transform","defineSchema","legacy","fieldSpec","attributes","relationships","filter","f","map","join","length","forEach","field","relSchema","Object","assign","attributesDefinitionFor","relationshipsDefinitionFor","doesTypeExist","has"],"mappings":";;;;;;AAUA,MAAMA,OAAO,GAAG,IAAIC,OAAO,EAAoC,CAAA;AAExD,MAAMC,kBAAiC,GAAG,CAC/C;AACEC,EAAAA,IAAI,EAAE,cAAc;AACpBC,EAAAA,IAAI,EAAE,aAAa;AACnBC,EAAAA,IAAI,EAAE,SAAA;AACR,CAAC,EACD;AACED,EAAAA,IAAI,EAAE,IAAI;AACVC,EAAAA,IAAI,EAAE,KAAK;AACXF,EAAAA,IAAI,EAAE,IAAA;AACR,CAAC,EACD;AACEA,EAAAA,IAAI,EAAE,WAAW;AACjBC,EAAAA,IAAI,EAAE,OAAO;AACbC,EAAAA,IAAI,EAAE,SAAS;AACfC,EAAAA,OAAO,EAAE;AAAEC,IAAAA,GAAG,EAAE,MAAA;AAAO,GAAA;AACzB,CAAC,CACF,CAAA;AAED,MAAMC,YAAuD,GAAG,UAAUC,MAAM,EA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AAMuB,MAAM,GAAG,IAAI,CAACY,OAAO,CAAC3B,GAAG,CAACR,IAAI,CAAC,CAAA;IAErC,IAAI,CAACuB,MAAM,EAAE;AACX,MAAA,MAAM,IAAIX,KAAK,CAAE,CAAwBZ,sBAAAA,EAAAA,IAAK,EAAC,CAAC,CAAA;AAClD,KAAA;IAEA,OAAOuB,MAAM,CAACqB,UAAU,CAAA;AAC1B,GAAA;AAEAa,EAAAA,0BAA0BA,CAAC;AAAEzD,IAAAA,IAAAA;AAAuB,GAAC,EAA8B;IACjF,MAAMuB,MAAM,GAAG,IAAI,CAACY,OAAO,CAAC3B,GAAG,CAACR,IAAI,CAAC,CAAA;IAErC,IAAI,CAACuB,MAAM,EAAE;AACX,MAAA,MAAM,IAAIX,KAAK,CAAE,CAAwBZ,sBAAAA,EAAAA,IAAK,EAAC,CAAC,CAAA;AAClD,KAAA;IAEA,OAAOuB,MAAM,CAACsB,aAAa,CAAA;AAC7B,GAAA;EAEAa,aAAaA,CAAC1D,IAAY,EAAW;AACnC,IAAA,OAAO,IAAI,CAACmC,OAAO,CAACwB,GAAG,CAAC3D,IAAI,CAAC,CAAA;AAC/B,GAAA;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"schema.js","sources":["../src/-base-fields.ts","../src/schema.ts"],"sourcesContent":["import { assert } from '@ember/debug';\n\nimport { recordIdentifierFor } from '@ember-data/store';\nimport type { OpaqueRecordInstance } from '@ember-data/store/-types/q/record-instance';\nimport type { FieldSchema } from '@ember-data/store/-types/q/schema-service';\nimport type { StableRecordIdentifier } from '@warp-drive/core-types';\n\nimport { Identifier, type SchemaRecord } from './record';\nimport type { Derivation, SchemaService } from './schema';\n\nconst Support = new WeakMap<WeakKey, Record<string, unknown>>();\n\nexport const SchemaRecordFields: FieldSchema[] = [\n {\n type: '@constructor',\n name: 'constructor',\n kind: 'derived',\n },\n {\n name: 'id',\n kind: '@id',\n type: null,\n },\n {\n type: '@identity',\n name: '$type',\n kind: 'derived',\n options: { key: 'type' },\n },\n];\n\nconst _constructor: Derivation<OpaqueRecordInstance, unknown> = function (record) {\n let state = Support.get(record as WeakKey);\n if (!state) {\n state = {};\n Support.set(record as WeakKey, state);\n }\n\n return (state._constructor = state._constructor || {\n name: `SchemaRecord<${recordIdentifierFor(record).type}>`,\n get modelName() {\n throw new Error('Cannot access record.constructor.modelName on non-Legacy Schema Records.');\n },\n });\n};\n\nexport function withFields(fields: FieldSchema[]) {\n fields.push(...SchemaRecordFields);\n return fields;\n}\n\nexport function fromIdentity(record: SchemaRecord, options: null, key: string): asserts options;\nexport function fromIdentity(record: SchemaRecord, options: { key: 'lid' }, key: string): string;\nexport function fromIdentity(record: SchemaRecord, options: { key: 'type' }, key: string): string;\nexport function fromIdentity(record: SchemaRecord, options: { key: 'id' }, key: string): string | null;\nexport function fromIdentity(record: SchemaRecord, options: { key: '^' }, key: string): StableRecordIdentifier;\nexport function fromIdentity(\n record: SchemaRecord,\n options: { key: 'id' | 'lid' | 'type' | '^' } | null,\n key: string\n): StableRecordIdentifier | string | null {\n const identifier = record[Identifier];\n assert(`Cannot compute @identity for a record without an identifier`, identifier);\n assert(\n `Expected to receive a key to compute @identity, but got ${String(options)}`,\n options?.key && ['lid', 'id', 'type', '^'].includes(options.key)\n );\n\n return options.key === '^' ? identifier : identifier[options.key];\n}\n\nexport function registerDerivations(schema: SchemaService) {\n schema.registerDerivation(\n '@identity',\n fromIdentity as Derivation<SchemaRecord, StableRecordIdentifier | string | null>\n );\n schema.registerDerivation('@constructor', _constructor);\n}\n","import { assert } from '@ember/debug';\n\nimport type { FieldSchema } from '@ember-data/store/-types/q/schema-service';\nimport { createCache, getValue } from '@ember-data/tracking';\nimport { type Signal, Signals } from '@ember-data/tracking/-private';\nimport type { StableRecordIdentifier } from '@warp-drive/core-types';\nimport type { Value } from '@warp-drive/core-types/json/raw';\nimport type { AttributeSchema, RelationshipSchema } from '@warp-drive/core-types/schema';\n\nimport type { SchemaRecord } from './record';\n\nexport { withFields, registerDerivations } from './-base-fields';\n\n/**\n * The full schema for a resource\n *\n * @class FieldSpec\n * @internal\n */\ntype FieldSpec = {\n '@id': FieldSchema | null;\n /**\n * legacy schema service separated attribute\n * from relationship lookup\n * @internal\n */\n attributes: Record<string, AttributeSchema>;\n /**\n * legacy schema service separated attribute\n * from relationship lookup\n * @internal\n */\n relationships: Record<string, RelationshipSchema>;\n /**\n * new schema service is fields based\n * @internal\n */\n fields: Map<string, FieldSchema>;\n /**\n * legacy model mode support\n * @internal\n */\n legacy?: boolean;\n};\n\nexport type Transform<T extends Value = string, PT = unknown> = {\n serialize(value: PT, options: Record<string, unknown> | null, record: SchemaRecord): T;\n hydrate(value: T | undefined, options: Record<string, unknown> | null, record: SchemaRecord): PT;\n defaultValue?(options: Record<string, unknown> | null, identifier: StableRecordIdentifier): T;\n};\n\nexport type Derivation<R, T> = (record: R, options: Record<string, unknown> | null, prop: string) => T;\n\n/**\n * Wraps a derivation in a new function with Derivation signature but that looks\n * up the value in the cache before recomputing.\n *\n * @param record\n * @param options\n * @param prop\n */\nfunction makeCachedDerivation<R, T>(derivation: Derivation<R, T>): Derivation<R, T> {\n return (record: R, options: Record<string, unknown> | null, prop: string): T => {\n const signals = (record as { [Signals]: Map<string, Signal> })[Signals];\n let signal = signals.get(prop);\n if (!signal) {\n signal = createCache(() => {\n return derivation(record, options, prop);\n }) as unknown as Signal; // a total lie, for convenience of reusing the storage\n signals.set(prop, signal);\n }\n\n return getValue(signal as unknown as ReturnType<typeof createCache>) as T;\n };\n}\n\nexport class SchemaService {\n declare schemas: Map<string, FieldSpec>;\n declare transforms: Map<string, Transform<Value>>;\n declare derivations: Map<string, Derivation<unknown, unknown>>;\n\n constructor() {\n this.schemas = new Map();\n this.transforms = new Map();\n this.derivations = new Map();\n }\n\n registerTransform<T extends Value = string, PT = unknown>(type: string, transform: Transform<T, PT>): void {\n this.transforms.set(type, transform);\n }\n\n registerDerivation<R, T>(type: string, derivation: Derivation<R, T>): void {\n this.derivations.set(type, makeCachedDerivation(derivation) as Derivation<unknown, unknown>);\n }\n\n defineSchema(name: string, schema: { legacy?: boolean; fields: FieldSchema[] }): void {\n const { legacy, fields } = schema;\n const fieldSpec: FieldSpec = {\n '@id': null,\n attributes: {},\n relationships: {},\n fields: new Map(),\n legacy: legacy ?? false,\n };\n\n assert(\n `Only one field can be defined as @id, ${name} has more than one: ${fields\n .filter((f) => f.kind === '@id')\n .map((f) => f.name)\n .join(' ')}`,\n fields.filter((f) => f.kind === '@id').length <= 1\n );\n fields.forEach((field) => {\n fieldSpec.fields.set(field.name, field);\n\n if (field.kind === '@id') {\n fieldSpec['@id'] = field;\n } else if (field.kind === 'field') {\n // We don't add 'field' fields to attributes in order to allow simpler\n // migration between transformation behaviors\n // serializers and things which call attributesDefinitionFor will\n // only run on the things that are legacy attribute mode, while all fields\n // will have their serialize/hydrate logic managed by the cache and record\n //\n // This means that if you want to normalize fields pre-cache insertion\n // Or pre-api call you wil need to use the newer `schema.fields()` API\n // To opt-in to that ability (which note, is now an anti-pattern)\n //\n // const attr = Object.assign({}, field, { kind: 'attribute' }) as AttributeSchema;\n // fieldSpec.attributes[attr.name] = attr;\n } else if (field.kind === 'attribute') {\n fieldSpec.attributes[field.name] = field as AttributeSchema;\n } else if (field.kind === 'resource' || field.kind === 'collection') {\n const relSchema = Object.assign({}, field, {\n kind: field.kind === 'resource' ? 'belongsTo' : 'hasMany',\n }) as unknown as RelationshipSchema;\n fieldSpec.relationships[field.name] = relSchema;\n } else if (\n field.kind !== 'derived' &&\n field.kind !== '@local' &&\n field.kind !== 'array' &&\n field.kind !== 'object'\n ) {\n throw new Error(`Unknown field kind ${field.kind}`);\n }\n });\n\n this.schemas.set(name, fieldSpec);\n }\n\n fields({ type }: { type: string }): FieldSpec['fields'] {\n const schema = this.schemas.get(type);\n\n if (!schema) {\n throw new Error(`No schema defined for ${type}`);\n }\n\n return schema.fields;\n }\n\n attributesDefinitionFor({ type }: { type: string }): FieldSpec['attributes'] {\n const schema = this.schemas.get(type);\n\n if (!schema) {\n throw new Error(`No schema defined for ${type}`);\n }\n\n return schema.attributes;\n }\n\n relationshipsDefinitionFor({ type }: { type: string }): FieldSpec['relationships'] {\n const schema = this.schemas.get(type);\n\n if (!schema) {\n throw new Error(`No schema defined for ${type}`);\n }\n\n return schema.relationships;\n }\n\n doesTypeExist(type: string): boolean {\n return this.schemas.has(type);\n }\n}\n"],"names":["Support","WeakMap","SchemaRecordFields","type","name","kind","options","key","_constructor","record","state","get","set","recordIdentifierFor","modelName","Error","withFields","fields","push","fromIdentity","identifier","Identifier","assert","String","includes","registerDerivations","schema","registerDerivation","makeCachedDerivation","derivation","prop","signals","Signals","signal","createCache","getValue","SchemaService","constructor","schemas","Map","transforms","derivations","registerTransform","transform","defineSchema","legacy","fieldSpec","attributes","relationships","filter","f","map","join","length","forEach","field","relSchema","Object","assign","attributesDefinitionFor","relationshipsDefinitionFor","doesTypeExist","has"],"mappings":";;;;;;AAUA,MAAMA,OAAO,GAAG,IAAIC,OAAO,EAAoC,CAAA;AAExD,MAAMC,kBAAiC,GAAG,CAC/C;AACEC,EAAAA,IAAI,EAAE,cAAc;AACpBC,EAAAA,IAAI,EAAE,aAAa;AACnBC,EAAAA,IAAI,EAAE,SAAA;AACR,CAAC,EACD;AACED,EAAAA,IAAI,EAAE,IAAI;AACVC,EAAAA,IAAI,EAAE,KAAK;AACXF,EAAAA,IAAI,EAAE,IAAA;AACR,CAAC,EACD;AACEA,EAAAA,IAAI,EAAE,WAAW;AACjBC,EAAAA,IAAI,EAAE,OAAO;AACbC,EAAAA,IAAI,EAAE,SAAS;AACfC,EAAAA,OAAO,EAAE;AAAEC,IAAAA,GAAG,EAAE,MAAA;AAAO,GAAA;AACzB,CAAC,CACF,CAAA;AAED,MAAMC,YAAuD,GAAG,UAAUC,MAAM,EAAE;AAChF,EAAA,IAAIC,KAAK,GAAGV,OAAO,CAACW,GAAG,CAACF,MAAiB,CAAC,CAAA;EAC1C,IAAI,CAACC,KAAK,EAAE;IACVA,KAAK,G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ACuB,MAAM,EAAE;AACX,MAAA,MAAM,IAAIX,KAAK,CAAE,CAAwBZ,sBAAAA,EAAAA,IAAK,EAAC,CAAC,CAAA;AAClD,KAAA;IAEA,OAAOuB,MAAM,CAACqB,UAAU,CAAA;AAC1B,GAAA;AAEAa,EAAAA,0BAA0BA,CAAC;AAAEzD,IAAAA,IAAAA;AAAuB,GAAC,EAA8B;IACjF,MAAMuB,MAAM,GAAG,IAAI,CAACY,OAAO,CAAC3B,GAAG,CAACR,IAAI,CAAC,CAAA;IAErC,IAAI,CAACuB,MAAM,EAAE;AACX,MAAA,MAAM,IAAIX,KAAK,CAAE,CAAwBZ,sBAAAA,EAAAA,IAAK,EAAC,CAAC,CAAA;AAClD,KAAA;IAEA,OAAOuB,MAAM,CAACsB,aAAa,CAAA;AAC7B,GAAA;EAEAa,aAAaA,CAAC1D,IAAY,EAAW;AACnC,IAAA,OAAO,IAAI,CAACmC,OAAO,CAACwB,GAAG,CAAC3D,IAAI,CAAC,CAAA;AAC/B,GAAA;AACF;;;;"}
|
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.41",
|
|
4
4
|
"description": "Schema Driven Resource Presentation for WarpDrive and EmberData",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-addon"
|
|
@@ -34,9 +34,9 @@
|
|
|
34
34
|
"unstable-preview-types"
|
|
35
35
|
],
|
|
36
36
|
"peerDependencies": {
|
|
37
|
-
"@ember-data/store": "5.4.0-alpha.
|
|
38
|
-
"@warp-drive/core-types": "0.0.0-alpha.
|
|
39
|
-
"@ember-data/tracking": "5.4.0-alpha.
|
|
37
|
+
"@ember-data/store": "5.4.0-alpha.55",
|
|
38
|
+
"@warp-drive/core-types": "0.0.0-alpha.41",
|
|
39
|
+
"@ember-data/tracking": "5.4.0-alpha.55"
|
|
40
40
|
},
|
|
41
41
|
"dependenciesMeta": {
|
|
42
42
|
"@ember-data/private-build-infra": {
|
|
@@ -59,9 +59,9 @@
|
|
|
59
59
|
}
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@ember-data/private-build-infra": "5.4.0-alpha.
|
|
62
|
+
"@ember-data/private-build-infra": "5.4.0-alpha.55",
|
|
63
63
|
"@ember/edition-utils": "^1.2.0",
|
|
64
|
-
"@embroider/macros": "^1.15.
|
|
64
|
+
"@embroider/macros": "^1.15.1",
|
|
65
65
|
"ember-cli-babel": "^8.2.0"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
@@ -75,19 +75,19 @@
|
|
|
75
75
|
"@babel/preset-env": "^7.24.4",
|
|
76
76
|
"@babel/preset-typescript": "^7.24.1",
|
|
77
77
|
"@babel/runtime": "^7.24.4",
|
|
78
|
-
"@ember-data/request": "5.4.0-alpha.
|
|
79
|
-
"@ember-data/store": "5.4.0-alpha.
|
|
80
|
-
"@ember-data/tracking": "5.4.0-alpha.
|
|
81
|
-
"@embroider/addon-dev": "^4.
|
|
78
|
+
"@ember-data/request": "5.4.0-alpha.55",
|
|
79
|
+
"@ember-data/store": "5.4.0-alpha.55",
|
|
80
|
+
"@ember-data/tracking": "5.4.0-alpha.55",
|
|
81
|
+
"@embroider/addon-dev": "^4.3.1",
|
|
82
82
|
"@glimmer/component": "^1.1.2",
|
|
83
83
|
"@rollup/plugin-babel": "^6.0.4",
|
|
84
84
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
85
|
-
"@warp-drive/core-types": "0.0.0-alpha.
|
|
86
|
-
"@warp-drive/internal-config": "5.4.0-alpha.
|
|
85
|
+
"@warp-drive/core-types": "0.0.0-alpha.41",
|
|
86
|
+
"@warp-drive/internal-config": "5.4.0-alpha.55",
|
|
87
87
|
"ember-source": "~5.7.0",
|
|
88
88
|
"pnpm-sync-dependencies-meta-injected": "0.0.10",
|
|
89
|
-
"rollup": "^4.14.
|
|
90
|
-
"typescript": "^5.4.
|
|
89
|
+
"rollup": "^4.14.1",
|
|
90
|
+
"typescript": "^5.4.5",
|
|
91
91
|
"walk-sync": "^3.0.0",
|
|
92
92
|
"webpack": "^5.91.0",
|
|
93
93
|
"@ember/string": "^3.1.1"
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
/// <reference path="./managed-array.d.ts" />
|
|
2
1
|
/// <reference path="./-base-fields.d.ts" />
|
|
3
2
|
/// <reference path="./hooks.d.ts" />
|
|
3
|
+
/// <reference path="./managed-object.d.ts" />
|
|
4
4
|
/// <reference path="./schema.d.ts" />
|
|
5
|
+
/// <reference path="./managed-array.d.ts" />
|
|
5
6
|
/// <reference path="./record.d.ts" />
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
declare module '@warp-drive/schema-record/managed-object' {
|
|
2
|
+
import type Store from '@ember-data/store';
|
|
3
|
+
import type { FieldSchema } from '@ember-data/store/-types/q/schema-service';
|
|
4
|
+
import type { Signal } from '@ember-data/tracking/-private';
|
|
5
|
+
import type { StableRecordIdentifier } from '@warp-drive/core-types';
|
|
6
|
+
import type { Cache } from '@warp-drive/core-types/cache';
|
|
7
|
+
import type { SchemaRecord } from '@warp-drive/schema-record/record';
|
|
8
|
+
import type { SchemaService } from '@warp-drive/schema-record/schema';
|
|
9
|
+
export const SOURCE: unique symbol;
|
|
10
|
+
export const MUTATE: unique symbol;
|
|
11
|
+
export const OBJECT_SIGNAL: unique symbol;
|
|
12
|
+
export const NOTIFY: unique symbol;
|
|
13
|
+
export function notifyObject(obj: ManagedObject): void;
|
|
14
|
+
export interface ManagedObject {
|
|
15
|
+
[MUTATE]?(target: unknown[], receiver: typeof Proxy<unknown[]>, prop: string, args: unknown[], _SIGNAL: Signal): unknown;
|
|
16
|
+
}
|
|
17
|
+
export class ManagedObject {
|
|
18
|
+
[SOURCE]: object;
|
|
19
|
+
address: StableRecordIdentifier;
|
|
20
|
+
key: string;
|
|
21
|
+
owner: SchemaRecord;
|
|
22
|
+
[OBJECT_SIGNAL]: Signal;
|
|
23
|
+
constructor(store: Store, schema: SchemaService, cache: Cache, field: FieldSchema, data: object, address: StableRecordIdentifier, key: string, owner: SchemaRecord);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=managed-object.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"managed-object.d.ts","sourceRoot":"","sources":["../src/managed-object.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAC3C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2CAA2C,CAAC;AAC7E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AAE5D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAG1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,eAAO,MAAM,MAAM,eAAoB,CAAC;AACxC,eAAO,MAAM,MAAM,eAAoB,CAAC;AACxC,eAAO,MAAM,aAAa,eAAoB,CAAC;AAC/C,eAAO,MAAM,MAAM,eAAoB,CAAC;AAExC,wBAAgB,YAAY,CAAC,GAAG,EAAE,aAAa,QAE9C;AAID,MAAM,WAAW,aAAa;IAC5B,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,aAAa;IACxB,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACT,OAAO,EAAE,sBAAsB,CAAC;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,YAAY,CAAC;IACpB,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;gBAG9B,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,aAAa,EACrB,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,WAAW,EAClB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,sBAAsB,EAC/B,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,YAAY;CA6FtB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"record.d.ts","sourceRoot":"","sources":["../src/record.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAI3C,OAAO,EAML,KAAK,MAAM,EACX,OAAO,EACR,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAMrE,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"record.d.ts","sourceRoot":"","sources":["../src/record.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAI3C,OAAO,EAML,KAAK,MAAM,EACX,OAAO,EACR,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAMrE,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAM7D,eAAO,MAAM,OAAO,eAAoB,CAAC;AACzC,eAAO,MAAM,UAAU,eAAuB,CAAC;AAC/C,eAAO,MAAM,QAAQ,eAAqB,CAAC;AAC3C,eAAO,MAAM,MAAM,eAAmB,CAAC;AACvC,eAAO,MAAM,QAAQ,eAAqB,CAAC;AAC3C,eAAO,MAAM,MAAM,eAAmB,CAAC;AAmPvC,qBAAa,YAAY;IACf,CAAC,WAAW,CAAC,EAAE,KAAK,CAAC;IACrB,CAAC,UAAU,CAAC,EAAE,sBAAsB,CA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