jazz-tools 0.8.2 → 0.8.3
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +7 -0
- package/dist/native/coValues/account.js.map +1 -0
- package/dist/native/coValues/coList.js.map +1 -0
- package/dist/native/coValues/coMap.js.map +1 -0
- package/dist/{coValues → native/coValues}/coStream.js +1 -0
- package/dist/native/coValues/coStream.js.map +1 -0
- package/dist/native/coValues/deepLoading.js.map +1 -0
- package/dist/native/coValues/extensions/imageDef.js.map +1 -0
- package/dist/native/coValues/group.js.map +1 -0
- package/dist/native/coValues/interfaces.js.map +1 -0
- package/dist/{implementation → native/implementation}/createContext.js +8 -1
- package/dist/native/implementation/createContext.js.map +1 -0
- package/dist/native/implementation/devtoolsFormatters.js.map +1 -0
- package/dist/{implementation → native/implementation}/errors.js.map +1 -1
- package/dist/native/implementation/inspect.js.map +1 -0
- package/dist/native/implementation/refs.js.map +1 -0
- package/dist/native/implementation/schema.js.map +1 -0
- package/dist/native/implementation/subscriptionScope.js.map +1 -0
- package/dist/native/implementation/symbols.js.map +1 -0
- package/dist/native/index.native.js +12 -0
- package/dist/native/index.native.js.map +1 -0
- package/dist/native/internal.js.map +1 -0
- package/dist/web/coValues/account.js +208 -0
- package/dist/web/coValues/account.js.map +1 -0
- package/dist/web/coValues/coList.js +395 -0
- package/dist/web/coValues/coList.js.map +1 -0
- package/dist/web/coValues/coMap.js +501 -0
- package/dist/web/coValues/coMap.js.map +1 -0
- package/dist/web/coValues/coStream.js +413 -0
- package/dist/web/coValues/coStream.js.map +1 -0
- package/dist/web/coValues/deepLoading.js +60 -0
- package/dist/web/coValues/deepLoading.js.map +1 -0
- package/dist/web/coValues/extensions/imageDef.js +37 -0
- package/dist/web/coValues/extensions/imageDef.js.map +1 -0
- package/dist/web/coValues/group.js +120 -0
- package/dist/web/coValues/group.js.map +1 -0
- package/dist/web/coValues/interfaces.js +109 -0
- package/dist/web/coValues/interfaces.js.map +1 -0
- package/dist/web/implementation/createContext.js +151 -0
- package/dist/web/implementation/createContext.js.map +1 -0
- package/dist/web/implementation/devtoolsFormatters.js +115 -0
- package/dist/web/implementation/devtoolsFormatters.js.map +1 -0
- package/dist/web/implementation/errors.js +2 -0
- package/dist/web/implementation/errors.js.map +1 -0
- package/dist/web/implementation/inspect.js +2 -0
- package/dist/web/implementation/inspect.js.map +1 -0
- package/dist/web/implementation/refs.js +127 -0
- package/dist/web/implementation/refs.js.map +1 -0
- package/dist/web/implementation/schema.js +91 -0
- package/dist/web/implementation/schema.js.map +1 -0
- package/dist/web/implementation/subscriptionScope.js +97 -0
- package/dist/web/implementation/subscriptionScope.js.map +1 -0
- package/dist/web/implementation/symbols.js +4 -0
- package/dist/web/implementation/symbols.js.map +1 -0
- package/dist/{index.js → web/index.web.js} +3 -3
- package/dist/{index.js.map → web/index.web.js.map} +1 -1
- package/dist/web/internal.js +17 -0
- package/dist/web/internal.js.map +1 -0
- package/package.json +25 -7
- package/src/coValues/account.ts +4 -1
- package/src/coValues/coStream.ts +26 -4
- package/src/coValues/group.ts +4 -1
- package/src/implementation/createContext.ts +12 -10
- package/src/{index.ts → index.native.ts} +2 -3
- package/src/index.web.ts +36 -0
- package/src/tests/coList.test.ts +2 -2
- package/src/tests/coMap.test.ts +11 -9
- package/src/tests/coStream.test.ts +2 -2
- package/src/tests/deepLoading.test.ts +2 -2
- package/src/tests/groupsAndAccounts.test.ts +1 -1
- package/tsconfig.json +5 -4
- package/tsconfig.native.json +11 -0
- package/tsconfig.web.json +11 -0
- package/dist/coValues/account.js.map +0 -1
- package/dist/coValues/coList.js.map +0 -1
- package/dist/coValues/coMap.js.map +0 -1
- package/dist/coValues/coStream.js.map +0 -1
- package/dist/coValues/deepLoading.js.map +0 -1
- package/dist/coValues/extensions/imageDef.js.map +0 -1
- package/dist/coValues/group.js.map +0 -1
- package/dist/coValues/interfaces.js.map +0 -1
- package/dist/implementation/createContext.js.map +0 -1
- package/dist/implementation/devtoolsFormatters.js.map +0 -1
- package/dist/implementation/inspect.js.map +0 -1
- package/dist/implementation/refs.js.map +0 -1
- package/dist/implementation/schema.js.map +0 -1
- package/dist/implementation/subscriptionScope.js.map +0 -1
- package/dist/implementation/symbols.js.map +0 -1
- package/dist/internal.js.map +0 -1
- package/dist/tests/coList.test.js +0 -221
- package/dist/tests/coList.test.js.map +0 -1
- package/dist/tests/coMap.test.js +0 -615
- package/dist/tests/coMap.test.js.map +0 -1
- package/dist/tests/coStream.test.js +0 -324
- package/dist/tests/coStream.test.js.map +0 -1
- package/dist/tests/deepLoading.test.js +0 -175
- package/dist/tests/deepLoading.test.js.map +0 -1
- package/dist/tests/groupsAndAccounts.test.js +0 -69
- package/dist/tests/groupsAndAccounts.test.js.map +0 -1
- /package/dist/{coValues → native/coValues}/account.js +0 -0
- /package/dist/{coValues → native/coValues}/coList.js +0 -0
- /package/dist/{coValues → native/coValues}/coMap.js +0 -0
- /package/dist/{coValues → native/coValues}/deepLoading.js +0 -0
- /package/dist/{coValues → native/coValues}/extensions/imageDef.js +0 -0
- /package/dist/{coValues → native/coValues}/group.js +0 -0
- /package/dist/{coValues → native/coValues}/interfaces.js +0 -0
- /package/dist/{implementation → native/implementation}/devtoolsFormatters.js +0 -0
- /package/dist/{implementation → native/implementation}/errors.js +0 -0
- /package/dist/{implementation → native/implementation}/inspect.js +0 -0
- /package/dist/{implementation → native/implementation}/refs.js +0 -0
- /package/dist/{implementation → native/implementation}/schema.js +0 -0
- /package/dist/{implementation → native/implementation}/subscriptionScope.js +0 -0
- /package/dist/{implementation → native/implementation}/symbols.js +0 -0
- /package/dist/{internal.js → native/internal.js} +0 -0
@@ -0,0 +1,501 @@
|
|
1
|
+
import { cojsonInternals, } from "cojson";
|
2
|
+
import { Account, CoValueBase, Ref, SchemaInit, inspect, makeRefs, subscriptionsScopes, ItemsSym, isRefEncoded, loadCoValue, subscribeToCoValue, ensureCoValueLoaded, subscribeToExistingCoValue, } from "../internal.js";
|
3
|
+
/**
|
4
|
+
* CoMaps are collaborative versions of plain objects, mapping string-like keys to values.
|
5
|
+
*
|
6
|
+
* @categoryDescription Declaration
|
7
|
+
* Declare your own CoMap schemas by subclassing `CoMap` and assigning field schemas with `co`.
|
8
|
+
*
|
9
|
+
* Optional `co.ref(...)` fields must be marked with `{ optional: true }`.
|
10
|
+
*
|
11
|
+
* ```ts
|
12
|
+
* import { co, CoMap } from "jazz-tools";
|
13
|
+
*
|
14
|
+
* class Person extends CoMap {
|
15
|
+
* name = co.string;
|
16
|
+
* age = co.number;
|
17
|
+
* pet = co.ref(Animal);
|
18
|
+
* car = co.ref(Car, { optional: true });
|
19
|
+
* }
|
20
|
+
* ```
|
21
|
+
*
|
22
|
+
* @categoryDescription Content
|
23
|
+
* You can access properties you declare on a `CoMap` (using `co`) as if they were normal properties on a plain object, using dot notation, `Object.keys()`, etc.
|
24
|
+
*
|
25
|
+
* ```ts
|
26
|
+
* person.name;
|
27
|
+
* person["age"];
|
28
|
+
* person.age = 42;
|
29
|
+
* person.pet?.name;
|
30
|
+
* Object.keys(person);
|
31
|
+
* // => ["name", "age", "pet"]
|
32
|
+
* ```
|
33
|
+
*
|
34
|
+
* @category CoValues
|
35
|
+
* */
|
36
|
+
export class CoMap extends CoValueBase {
|
37
|
+
static {
|
38
|
+
this.prototype._type = "CoMap";
|
39
|
+
}
|
40
|
+
/** @internal */
|
41
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
42
|
+
static _schema;
|
43
|
+
/** @internal */
|
44
|
+
get _schema() {
|
45
|
+
return this.constructor._schema;
|
46
|
+
}
|
47
|
+
/**
|
48
|
+
* If property `prop` is a `co.ref(...)`, you can use `coMaps._refs.prop` to access
|
49
|
+
* the `Ref` instead of the potentially loaded/null value.
|
50
|
+
*
|
51
|
+
* This allows you to always get the ID or load the value manually.
|
52
|
+
*
|
53
|
+
* @example
|
54
|
+
* ```ts
|
55
|
+
* person._refs.pet.id; // => ID<Animal>
|
56
|
+
* person._refs.pet.value;
|
57
|
+
* // => Animal | null
|
58
|
+
* const pet = await person._refs.pet.load();
|
59
|
+
* ```
|
60
|
+
*
|
61
|
+
* @category Content
|
62
|
+
**/
|
63
|
+
get _refs() {
|
64
|
+
return makeRefs((key) => this._raw.get(key), () => {
|
65
|
+
const keys = this._raw.keys().filter((key) => {
|
66
|
+
const schema = this._schema[key] ||
|
67
|
+
this._schema[ItemsSym];
|
68
|
+
return schema && schema !== "json" && isRefEncoded(schema);
|
69
|
+
});
|
70
|
+
return keys;
|
71
|
+
}, this._loadedAs, (key) => (this._schema[key] ||
|
72
|
+
this._schema[ItemsSym]));
|
73
|
+
}
|
74
|
+
/** @category Collaboration */
|
75
|
+
get _edits() {
|
76
|
+
return new Proxy(this, {
|
77
|
+
get(target, key) {
|
78
|
+
const rawEdit = target._raw.lastEditAt(key);
|
79
|
+
if (!rawEdit)
|
80
|
+
return undefined;
|
81
|
+
const descriptor = target._schema[key];
|
82
|
+
return {
|
83
|
+
value: descriptor === "json"
|
84
|
+
? rawEdit.value
|
85
|
+
: "encoded" in descriptor
|
86
|
+
? descriptor.encoded.encode(rawEdit.value)
|
87
|
+
: new Ref(rawEdit.value, target._loadedAs, descriptor).accessFrom(target, "_edits." + key.toString() + ".value"),
|
88
|
+
ref: descriptor !== "json" && isRefEncoded(descriptor)
|
89
|
+
? new Ref(rawEdit.value, target._loadedAs, descriptor)
|
90
|
+
: undefined,
|
91
|
+
by: rawEdit.by &&
|
92
|
+
new Ref(rawEdit.by, target._loadedAs, {
|
93
|
+
ref: Account,
|
94
|
+
optional: false,
|
95
|
+
}).accessFrom(target, "_edits." + key.toString() + ".by"),
|
96
|
+
madeAt: rawEdit.at,
|
97
|
+
};
|
98
|
+
},
|
99
|
+
});
|
100
|
+
}
|
101
|
+
/** @internal */
|
102
|
+
constructor(
|
103
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
104
|
+
options) {
|
105
|
+
super();
|
106
|
+
if (options) {
|
107
|
+
if ("fromRaw" in options) {
|
108
|
+
Object.defineProperties(this, {
|
109
|
+
id: {
|
110
|
+
value: options.fromRaw.id,
|
111
|
+
enumerable: false,
|
112
|
+
},
|
113
|
+
_raw: { value: options.fromRaw, enumerable: false },
|
114
|
+
});
|
115
|
+
}
|
116
|
+
else {
|
117
|
+
throw new Error("Invalid CoMap constructor arguments");
|
118
|
+
}
|
119
|
+
}
|
120
|
+
return new Proxy(this, CoMapProxyHandler);
|
121
|
+
}
|
122
|
+
/**
|
123
|
+
* Create a new CoMap with the given initial values and owner.
|
124
|
+
*
|
125
|
+
* The owner (a Group or Account) determines access rights to the CoMap.
|
126
|
+
*
|
127
|
+
* The CoMap will immediately be persisted and synced to connected peers.
|
128
|
+
*
|
129
|
+
* @example
|
130
|
+
* ```ts
|
131
|
+
* const person = Person.create({
|
132
|
+
* name: "Alice",
|
133
|
+
* age: 42,
|
134
|
+
* pet: cat,
|
135
|
+
* }, { owner: friendGroup });
|
136
|
+
* ```
|
137
|
+
*
|
138
|
+
* @category Creation
|
139
|
+
**/
|
140
|
+
static create(init, options) {
|
141
|
+
const instance = new this();
|
142
|
+
const raw = instance.rawFromInit(init, options.owner, options.unique === undefined
|
143
|
+
? undefined
|
144
|
+
: { uniqueness: options.unique });
|
145
|
+
Object.defineProperties(instance, {
|
146
|
+
id: {
|
147
|
+
value: raw.id,
|
148
|
+
enumerable: false,
|
149
|
+
},
|
150
|
+
_raw: { value: raw, enumerable: false },
|
151
|
+
});
|
152
|
+
return instance;
|
153
|
+
}
|
154
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
155
|
+
toJSON(_key, seenAbove) {
|
156
|
+
const jsonedFields = this._raw.keys().map((key) => {
|
157
|
+
const tKey = key;
|
158
|
+
const descriptor = (this._schema[tKey] ||
|
159
|
+
this._schema[ItemsSym]);
|
160
|
+
if (descriptor == "json" || "encode" in descriptor) {
|
161
|
+
return [key, this._raw.get(key)];
|
162
|
+
}
|
163
|
+
else if (isRefEncoded(descriptor)) {
|
164
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
165
|
+
if (seenAbove?.includes(this[tKey]?.id)) {
|
166
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
167
|
+
return [key, { _circular: this[tKey]?.id }];
|
168
|
+
}
|
169
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
170
|
+
const jsonedRef = this[tKey]?.toJSON(tKey, [
|
171
|
+
...(seenAbove || []),
|
172
|
+
this.id,
|
173
|
+
]);
|
174
|
+
return [key, jsonedRef];
|
175
|
+
}
|
176
|
+
else {
|
177
|
+
return [key, undefined];
|
178
|
+
}
|
179
|
+
});
|
180
|
+
return {
|
181
|
+
id: this.id,
|
182
|
+
_type: this._type,
|
183
|
+
...Object.fromEntries(jsonedFields),
|
184
|
+
};
|
185
|
+
}
|
186
|
+
[inspect]() {
|
187
|
+
return this.toJSON();
|
188
|
+
}
|
189
|
+
/** @internal */
|
190
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
191
|
+
rawFromInit(init, owner, uniqueness) {
|
192
|
+
const rawOwner = owner._raw;
|
193
|
+
const rawInit = {};
|
194
|
+
if (init)
|
195
|
+
for (const key of Object.keys(init)) {
|
196
|
+
const initValue = init[key];
|
197
|
+
const descriptor = (this._schema[key] || this._schema[ItemsSym]);
|
198
|
+
if (!descriptor) {
|
199
|
+
continue;
|
200
|
+
}
|
201
|
+
if (descriptor === "json") {
|
202
|
+
rawInit[key] = initValue;
|
203
|
+
}
|
204
|
+
else if (isRefEncoded(descriptor)) {
|
205
|
+
if (initValue) {
|
206
|
+
rawInit[key] = initValue.id;
|
207
|
+
}
|
208
|
+
}
|
209
|
+
else if ("encoded" in descriptor) {
|
210
|
+
rawInit[key] = descriptor.encoded.encode(
|
211
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
212
|
+
initValue);
|
213
|
+
}
|
214
|
+
}
|
215
|
+
return rawOwner.createMap(rawInit, null, "private", uniqueness);
|
216
|
+
}
|
217
|
+
/**
|
218
|
+
* Declare a Record-like CoMap schema, by extending `CoMap.Record(...)` and passing the value schema using `co`. Keys are always `string`.
|
219
|
+
*
|
220
|
+
* @example
|
221
|
+
* ```ts
|
222
|
+
* import { co, CoMap } from "jazz-tools";
|
223
|
+
*
|
224
|
+
* class ColorToFruitMap extends CoMap.Record(
|
225
|
+
* co.ref(Fruit)
|
226
|
+
* ) {}
|
227
|
+
*
|
228
|
+
* // assume we have map: ColorToFruitMap
|
229
|
+
* // and strawberry: Fruit
|
230
|
+
* map["red"] = strawberry;
|
231
|
+
* ```
|
232
|
+
*
|
233
|
+
* @category Declaration
|
234
|
+
*/
|
235
|
+
static Record(value) {
|
236
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging
|
237
|
+
class RecordLikeCoMap extends CoMap {
|
238
|
+
[ItemsSym] = value;
|
239
|
+
}
|
240
|
+
return RecordLikeCoMap;
|
241
|
+
}
|
242
|
+
/**
|
243
|
+
* Load a `CoMap` with a given ID, as a given account.
|
244
|
+
*
|
245
|
+
* `depth` specifies which (if any) fields that reference other CoValues to load as well before resolving.
|
246
|
+
* The `DeeplyLoaded` return type guarantees that corresponding referenced CoValues are loaded to the specified depth.
|
247
|
+
*
|
248
|
+
* You can pass `[]` or `{}` for shallowly loading only this CoMap, or `{ fieldA: depthA, fieldB: depthB }` for recursively loading referenced CoValues.
|
249
|
+
*
|
250
|
+
* Check out the `load` methods on `CoMap`/`CoList`/`CoStream`/`Group`/`Account` to see which depth structures are valid to nest.
|
251
|
+
*
|
252
|
+
* @example
|
253
|
+
* ```ts
|
254
|
+
* const person = await Person.load(
|
255
|
+
* "co_zdsMhHtfG6VNKt7RqPUPvUtN2Ax",
|
256
|
+
* me,
|
257
|
+
* { pet: {} }
|
258
|
+
* );
|
259
|
+
* ```
|
260
|
+
*
|
261
|
+
* @category Subscription & Loading
|
262
|
+
*/
|
263
|
+
static load(id, as, depth) {
|
264
|
+
return loadCoValue(this, id, as, depth);
|
265
|
+
}
|
266
|
+
/**
|
267
|
+
* Load and subscribe to a `CoMap` with a given ID, as a given account.
|
268
|
+
*
|
269
|
+
* Automatically also subscribes to updates to all referenced/nested CoValues as soon as they are accessed in the listener.
|
270
|
+
*
|
271
|
+
* `depth` specifies which (if any) fields that reference other CoValues to load as well before calling `listener` for the first time.
|
272
|
+
* The `DeeplyLoaded` return type guarantees that corresponding referenced CoValues are loaded to the specified depth.
|
273
|
+
*
|
274
|
+
* You can pass `[]` or `{}` for shallowly loading only this CoMap, or `{ fieldA: depthA, fieldB: depthB }` for recursively loading referenced CoValues.
|
275
|
+
*
|
276
|
+
* Check out the `load` methods on `CoMap`/`CoList`/`CoStream`/`Group`/`Account` to see which depth structures are valid to nest.
|
277
|
+
*
|
278
|
+
* Returns an unsubscribe function that you should call when you no longer need updates.
|
279
|
+
*
|
280
|
+
* Also see the `useCoState` hook to reactively subscribe to a CoValue in a React component.
|
281
|
+
*
|
282
|
+
* @example
|
283
|
+
* ```ts
|
284
|
+
* const unsub = Person.subscribe(
|
285
|
+
* "co_zdsMhHtfG6VNKt7RqPUPvUtN2Ax",
|
286
|
+
* me,
|
287
|
+
* { pet: {} },
|
288
|
+
* (person) => console.log(person)
|
289
|
+
* );
|
290
|
+
* ```
|
291
|
+
*
|
292
|
+
* @category Subscription & Loading
|
293
|
+
*/
|
294
|
+
static subscribe(id, as, depth, listener) {
|
295
|
+
return subscribeToCoValue(this, id, as, depth, listener);
|
296
|
+
}
|
297
|
+
static findUnique(unique, ownerID, as) {
|
298
|
+
const header = {
|
299
|
+
type: "comap",
|
300
|
+
ruleset: {
|
301
|
+
type: "ownedByGroup",
|
302
|
+
group: ownerID,
|
303
|
+
},
|
304
|
+
meta: null,
|
305
|
+
uniqueness: unique,
|
306
|
+
};
|
307
|
+
const crypto = as._type === "Anonymous" ? as.node.crypto : as._raw.core.crypto;
|
308
|
+
return cojsonInternals.idforHeader(header, crypto);
|
309
|
+
}
|
310
|
+
/**
|
311
|
+
* Given an already loaded `CoMap`, ensure that the specified fields are loaded to the specified depth.
|
312
|
+
*
|
313
|
+
* Works like `CoMap.load()`, but you don't need to pass the ID or the account to load as again.
|
314
|
+
*
|
315
|
+
* @category Subscription & Loading
|
316
|
+
*/
|
317
|
+
ensureLoaded(depth) {
|
318
|
+
return ensureCoValueLoaded(this, depth);
|
319
|
+
}
|
320
|
+
/**
|
321
|
+
* Given an already loaded `CoMap`, subscribe to updates to the `CoMap` and ensure that the specified fields are loaded to the specified depth.
|
322
|
+
*
|
323
|
+
* Works like `CoMap.subscribe()`, but you don't need to pass the ID or the account to load as again.
|
324
|
+
*
|
325
|
+
* Returns an unsubscribe function that you should call when you no longer need updates.
|
326
|
+
*
|
327
|
+
* @category Subscription & Loading
|
328
|
+
**/
|
329
|
+
subscribe(depth, listener) {
|
330
|
+
return subscribeToExistingCoValue(this, depth, listener);
|
331
|
+
}
|
332
|
+
applyDiff(newValues) {
|
333
|
+
for (const key in newValues) {
|
334
|
+
if (Object.prototype.hasOwnProperty.call(newValues, key)) {
|
335
|
+
const tKey = key;
|
336
|
+
const descriptor = (this._schema[tKey] ||
|
337
|
+
this._schema[ItemsSym]);
|
338
|
+
if (tKey in this._schema) {
|
339
|
+
const newValue = newValues[tKey];
|
340
|
+
const currentValue = this[tKey];
|
341
|
+
if (descriptor === "json" || "encoded" in descriptor) {
|
342
|
+
if (currentValue !== newValue) {
|
343
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
344
|
+
this[tKey] = newValue;
|
345
|
+
}
|
346
|
+
}
|
347
|
+
else if (isRefEncoded(descriptor)) {
|
348
|
+
const currentId = currentValue
|
349
|
+
?.id;
|
350
|
+
const newId = newValue?.id;
|
351
|
+
if (currentId !== newId) {
|
352
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
353
|
+
this[tKey] = newValue;
|
354
|
+
}
|
355
|
+
}
|
356
|
+
}
|
357
|
+
}
|
358
|
+
}
|
359
|
+
return this;
|
360
|
+
}
|
361
|
+
}
|
362
|
+
// TODO: cache handlers per descriptor for performance?
|
363
|
+
const CoMapProxyHandler = {
|
364
|
+
get(target, key, receiver) {
|
365
|
+
if (key === "_schema") {
|
366
|
+
return Reflect.get(target, key);
|
367
|
+
}
|
368
|
+
else if (key in target) {
|
369
|
+
return Reflect.get(target, key, receiver);
|
370
|
+
}
|
371
|
+
else {
|
372
|
+
const descriptor = (target._schema[key] ||
|
373
|
+
target._schema[ItemsSym]);
|
374
|
+
if (descriptor && typeof key === "string") {
|
375
|
+
const raw = target._raw.get(key);
|
376
|
+
if (descriptor === "json") {
|
377
|
+
return raw;
|
378
|
+
}
|
379
|
+
else if ("encoded" in descriptor) {
|
380
|
+
return raw === undefined
|
381
|
+
? undefined
|
382
|
+
: descriptor.encoded.decode(raw);
|
383
|
+
}
|
384
|
+
else if (isRefEncoded(descriptor)) {
|
385
|
+
return raw === undefined
|
386
|
+
? undefined
|
387
|
+
: new Ref(raw, target._loadedAs, descriptor).accessFrom(receiver, key);
|
388
|
+
}
|
389
|
+
}
|
390
|
+
else {
|
391
|
+
return undefined;
|
392
|
+
}
|
393
|
+
}
|
394
|
+
},
|
395
|
+
set(target, key, value, receiver) {
|
396
|
+
if ((typeof key === "string" || ItemsSym) &&
|
397
|
+
typeof value === "object" &&
|
398
|
+
value !== null &&
|
399
|
+
SchemaInit in value) {
|
400
|
+
target.constructor._schema ||= {};
|
401
|
+
target.constructor._schema[key] =
|
402
|
+
value[SchemaInit];
|
403
|
+
return true;
|
404
|
+
}
|
405
|
+
const descriptor = (target._schema[key] ||
|
406
|
+
target._schema[ItemsSym]);
|
407
|
+
if (descriptor && typeof key === "string") {
|
408
|
+
if (descriptor === "json") {
|
409
|
+
target._raw.set(key, value);
|
410
|
+
}
|
411
|
+
else if ("encoded" in descriptor) {
|
412
|
+
target._raw.set(key, descriptor.encoded.encode(value));
|
413
|
+
}
|
414
|
+
else if (isRefEncoded(descriptor)) {
|
415
|
+
if (value === null) {
|
416
|
+
if (descriptor.optional) {
|
417
|
+
target._raw.set(key, null);
|
418
|
+
}
|
419
|
+
else {
|
420
|
+
throw new Error(`Cannot set required reference ${key} to null`);
|
421
|
+
}
|
422
|
+
}
|
423
|
+
else {
|
424
|
+
target._raw.set(key, value.id);
|
425
|
+
subscriptionsScopes
|
426
|
+
.get(target)
|
427
|
+
?.onRefAccessedOrSet(target.id, value.id);
|
428
|
+
}
|
429
|
+
}
|
430
|
+
return true;
|
431
|
+
}
|
432
|
+
else {
|
433
|
+
return Reflect.set(target, key, value, receiver);
|
434
|
+
}
|
435
|
+
},
|
436
|
+
defineProperty(target, key, attributes) {
|
437
|
+
if ("value" in attributes &&
|
438
|
+
typeof attributes.value === "object" &&
|
439
|
+
SchemaInit in attributes.value) {
|
440
|
+
target.constructor._schema ||= {};
|
441
|
+
target.constructor._schema[key] =
|
442
|
+
attributes.value[SchemaInit];
|
443
|
+
return true;
|
444
|
+
}
|
445
|
+
else {
|
446
|
+
return Reflect.defineProperty(target, key, attributes);
|
447
|
+
}
|
448
|
+
},
|
449
|
+
ownKeys(target) {
|
450
|
+
const keys = Reflect.ownKeys(target).filter((k) => k !== ItemsSym);
|
451
|
+
// for (const key of Reflect.ownKeys(target._schema)) {
|
452
|
+
// if (key !== ItemsSym && !keys.includes(key)) {
|
453
|
+
// keys.push(key);
|
454
|
+
// }
|
455
|
+
// }
|
456
|
+
for (const key of target._raw.keys()) {
|
457
|
+
if (!keys.includes(key)) {
|
458
|
+
keys.push(key);
|
459
|
+
}
|
460
|
+
}
|
461
|
+
return keys;
|
462
|
+
},
|
463
|
+
getOwnPropertyDescriptor(target, key) {
|
464
|
+
if (key in target) {
|
465
|
+
return Reflect.getOwnPropertyDescriptor(target, key);
|
466
|
+
}
|
467
|
+
else {
|
468
|
+
const descriptor = (target._schema[key] ||
|
469
|
+
target._schema[ItemsSym]);
|
470
|
+
if (descriptor || key in target._raw.ops) {
|
471
|
+
return {
|
472
|
+
enumerable: true,
|
473
|
+
configurable: true,
|
474
|
+
writable: true,
|
475
|
+
};
|
476
|
+
}
|
477
|
+
}
|
478
|
+
},
|
479
|
+
has(target, key) {
|
480
|
+
const descriptor = (target._schema?.[key] ||
|
481
|
+
target._schema?.[ItemsSym]);
|
482
|
+
if (target._raw && typeof key === "string" && descriptor) {
|
483
|
+
return target._raw.get(key) !== undefined;
|
484
|
+
}
|
485
|
+
else {
|
486
|
+
return Reflect.has(target, key);
|
487
|
+
}
|
488
|
+
},
|
489
|
+
deleteProperty(target, key) {
|
490
|
+
const descriptor = (target._schema[key] ||
|
491
|
+
target._schema[ItemsSym]);
|
492
|
+
if (typeof key === "string" && descriptor) {
|
493
|
+
target._raw.delete(key);
|
494
|
+
return true;
|
495
|
+
}
|
496
|
+
else {
|
497
|
+
return Reflect.deleteProperty(target, key);
|
498
|
+
}
|
499
|
+
},
|
500
|
+
};
|
501
|
+
//# sourceMappingURL=coMap.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"coMap.js","sourceRoot":"","sources":["../../../src/coValues/coMap.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,eAAe,GAIlB,MAAM,QAAQ,CAAC;AAehB,OAAO,EACH,OAAO,EACP,WAAW,EACX,GAAG,EACH,UAAU,EACV,OAAO,EACP,QAAQ,EACR,mBAAmB,EACnB,QAAQ,EACR,YAAY,EACZ,WAAW,EACX,kBAAkB,EAClB,mBAAmB,EACnB,0BAA0B,GAC7B,MAAM,gBAAgB,CAAC;AAexB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAgCM;AACN,MAAM,OAAO,KAAM,SAAQ,WAAW;IAOlC;QACI,IAAI,CAAC,SAAS,CAAC,KAAK,GAAG,OAAO,CAAC;IACnC,CAAC;IAID,gBAAgB;IAChB,8DAA8D;IAC9D,MAAM,CAAC,OAAO,CAAM;IACpB,gBAAgB;IAChB,IAAI,OAAO;QACP,OAAQ,IAAI,CAAC,WAA4B,CAAC,OAEf,CAAC;IAChC,CAAC;IAED;;;;;;;;;;;;;;;QAeI;IACJ,IAAI,KAAK;QAGL,OAAO,QAAQ,CACX,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,C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