jazz-tools 0.8.44 → 0.8.48
Sign up to get free protection for your applications and to get access to all the features.
- package/.turbo/turbo-build.log +16 -10
- package/CHANGELOG.md +21 -0
- package/dist/chunk-6OHBW32Q.js +2853 -0
- package/dist/chunk-6OHBW32Q.js.map +1 -0
- package/dist/index.native.js +63 -0
- package/dist/index.native.js.map +1 -0
- package/dist/index.web.js +61 -0
- package/dist/index.web.js.map +1 -0
- package/package.json +9 -12
- package/src/coValues/account.ts +29 -10
- package/src/coValues/coFeed.ts +4 -3
- package/src/coValues/coList.ts +8 -5
- package/src/coValues/coMap.ts +14 -5
- package/src/coValues/deepLoading.ts +6 -12
- package/src/coValues/extensions/imageDef.ts +3 -1
- package/src/coValues/group.ts +8 -11
- package/src/coValues/inbox.ts +377 -0
- package/src/coValues/interfaces.ts +9 -6
- package/src/coValues/profile.ts +11 -0
- package/src/coValues/registeredSchemas.ts +12 -0
- package/src/exports.ts +21 -15
- package/src/implementation/anonymousJazzAgent.ts +6 -0
- package/src/implementation/createContext.ts +8 -9
- package/src/implementation/refs.ts +1 -1
- package/src/implementation/subscriptionScope.ts +1 -1
- package/src/index.native.ts +0 -1
- package/src/internal.ts +1 -9
- package/src/tests/account.test.ts +2 -2
- package/src/tests/coFeed.test.ts +0 -9
- package/src/tests/coMap.test.ts +11 -8
- package/src/tests/groupsAndAccounts.test.ts +1 -63
- package/src/tests/inbox.test.ts +299 -0
- package/src/tests/schemaUnion.test.ts +1 -1
- package/src/tests/utils.ts +14 -0
- package/tsup.config.ts +13 -0
- package/dist/native/coValues/account.js +0 -221
- package/dist/native/coValues/account.js.map +0 -1
- package/dist/native/coValues/coFeed.js +0 -571
- package/dist/native/coValues/coFeed.js.map +0 -1
- package/dist/native/coValues/coList.js +0 -404
- package/dist/native/coValues/coList.js.map +0 -1
- package/dist/native/coValues/coMap.js +0 -537
- package/dist/native/coValues/coMap.js.map +0 -1
- package/dist/native/coValues/deepLoading.js +0 -63
- package/dist/native/coValues/deepLoading.js.map +0 -1
- package/dist/native/coValues/extensions/imageDef.js +0 -42
- package/dist/native/coValues/extensions/imageDef.js.map +0 -1
- package/dist/native/coValues/group.js +0 -136
- package/dist/native/coValues/group.js.map +0 -1
- package/dist/native/coValues/interfaces.js +0 -135
- package/dist/native/coValues/interfaces.js.map +0 -1
- package/dist/native/coValues/schemaUnion.js +0 -89
- package/dist/native/coValues/schemaUnion.js.map +0 -1
- package/dist/native/exports.js +0 -5
- package/dist/native/exports.js.map +0 -1
- package/dist/native/implementation/createContext.js +0 -157
- package/dist/native/implementation/createContext.js.map +0 -1
- package/dist/native/implementation/devtoolsFormatters.js +0 -95
- package/dist/native/implementation/devtoolsFormatters.js.map +0 -1
- package/dist/native/implementation/errors.js +0 -2
- package/dist/native/implementation/errors.js.map +0 -1
- package/dist/native/implementation/inspect.js +0 -2
- package/dist/native/implementation/inspect.js.map +0 -1
- package/dist/native/implementation/refs.js +0 -115
- package/dist/native/implementation/refs.js.map +0 -1
- package/dist/native/implementation/schema.js +0 -96
- package/dist/native/implementation/schema.js.map +0 -1
- package/dist/native/implementation/subscriptionScope.js +0 -91
- package/dist/native/implementation/subscriptionScope.js.map +0 -1
- package/dist/native/implementation/symbols.js +0 -4
- package/dist/native/implementation/symbols.js.map +0 -1
- package/dist/native/index.native.js +0 -3
- package/dist/native/index.native.js.map +0 -1
- package/dist/native/internal.js +0 -18
- package/dist/native/internal.js.map +0 -1
- package/dist/native/lib/cache.js +0 -13
- package/dist/native/lib/cache.js.map +0 -1
- package/dist/native/lib/cache.test.js +0 -52
- package/dist/native/lib/cache.test.js.map +0 -1
- package/dist/web/coValues/account.js +0 -221
- package/dist/web/coValues/account.js.map +0 -1
- package/dist/web/coValues/coFeed.js +0 -571
- package/dist/web/coValues/coFeed.js.map +0 -1
- package/dist/web/coValues/coList.js +0 -404
- package/dist/web/coValues/coList.js.map +0 -1
- package/dist/web/coValues/coMap.js +0 -537
- package/dist/web/coValues/coMap.js.map +0 -1
- package/dist/web/coValues/deepLoading.js +0 -63
- package/dist/web/coValues/deepLoading.js.map +0 -1
- package/dist/web/coValues/extensions/imageDef.js +0 -42
- package/dist/web/coValues/extensions/imageDef.js.map +0 -1
- package/dist/web/coValues/group.js +0 -136
- package/dist/web/coValues/group.js.map +0 -1
- package/dist/web/coValues/interfaces.js +0 -135
- package/dist/web/coValues/interfaces.js.map +0 -1
- package/dist/web/coValues/schemaUnion.js +0 -89
- package/dist/web/coValues/schemaUnion.js.map +0 -1
- package/dist/web/exports.js +0 -5
- package/dist/web/exports.js.map +0 -1
- package/dist/web/implementation/createContext.js +0 -157
- package/dist/web/implementation/createContext.js.map +0 -1
- package/dist/web/implementation/devtoolsFormatters.js +0 -95
- package/dist/web/implementation/devtoolsFormatters.js.map +0 -1
- package/dist/web/implementation/errors.js +0 -2
- package/dist/web/implementation/errors.js.map +0 -1
- package/dist/web/implementation/inspect.js +0 -2
- package/dist/web/implementation/inspect.js.map +0 -1
- package/dist/web/implementation/refs.js +0 -115
- package/dist/web/implementation/refs.js.map +0 -1
- package/dist/web/implementation/schema.js +0 -96
- package/dist/web/implementation/schema.js.map +0 -1
- package/dist/web/implementation/subscriptionScope.js +0 -91
- package/dist/web/implementation/subscriptionScope.js.map +0 -1
- package/dist/web/implementation/symbols.js +0 -4
- package/dist/web/implementation/symbols.js.map +0 -1
- package/dist/web/index.web.js +0 -3
- package/dist/web/index.web.js.map +0 -1
- package/dist/web/internal.js +0 -18
- package/dist/web/internal.js.map +0 -1
- package/dist/web/lib/cache.js +0 -13
- package/dist/web/lib/cache.js.map +0 -1
- package/dist/web/lib/cache.test.js +0 -52
- package/dist/web/lib/cache.test.js.map +0 -1
@@ -1,404 +0,0 @@
|
|
1
|
-
var _a;
|
2
|
-
import { RawAccount } from "cojson";
|
3
|
-
import { Account, AnonymousJazzAgent, Group, ItemsSym, Ref, SchemaInit, co, ensureCoValueLoaded, inspect, isRefEncoded, loadCoValue, makeRefs, subscribeToCoValue, subscribeToExistingCoValue, subscriptionsScopes, } from "../internal.js";
|
4
|
-
import { coValuesCache } from "../lib/cache.js";
|
5
|
-
/**
|
6
|
-
* CoLists are collaborative versions of plain arrays.
|
7
|
-
*
|
8
|
-
* @categoryDescription Content
|
9
|
-
* You can access items on a `CoList` as if they were normal items on a plain array, using `[]` notation, etc.
|
10
|
-
*
|
11
|
-
* Since `CoList` is a subclass of `Array`, you can use all the normal array methods like `push`, `pop`, `splice`, etc.
|
12
|
-
*
|
13
|
-
* ```ts
|
14
|
-
* colorList[0];
|
15
|
-
* colorList[3] = "yellow";
|
16
|
-
* colorList.push("Kawazaki Green");
|
17
|
-
* colorList.splice(1, 1);
|
18
|
-
* ```
|
19
|
-
*
|
20
|
-
* @category CoValues
|
21
|
-
*/
|
22
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
23
|
-
export class CoList extends Array {
|
24
|
-
/**
|
25
|
-
* Declare a `CoList` by subclassing `CoList.Of(...)` and passing the item schema using `co`.
|
26
|
-
*
|
27
|
-
* @example
|
28
|
-
* ```ts
|
29
|
-
* class ColorList extends CoList.Of(
|
30
|
-
* co.string
|
31
|
-
* ) {}
|
32
|
-
* class AnimalList extends CoList.Of(
|
33
|
-
* co.ref(Animal)
|
34
|
-
* ) {}
|
35
|
-
* ```
|
36
|
-
*
|
37
|
-
* @category Declaration
|
38
|
-
*/
|
39
|
-
static Of(item) {
|
40
|
-
var _b, _c;
|
41
|
-
// TODO: cache superclass for item class
|
42
|
-
return _c = class CoListOf extends _a {
|
43
|
-
constructor() {
|
44
|
-
super(...arguments);
|
45
|
-
this[_b] = item;
|
46
|
-
}
|
47
|
-
},
|
48
|
-
_b = co.items,
|
49
|
-
_c;
|
50
|
-
}
|
51
|
-
/**
|
52
|
-
* @ignore
|
53
|
-
* @deprecated Use UPPERCASE `CoList.Of` instead! */
|
54
|
-
static of(..._args) {
|
55
|
-
throw new Error("Can't use Array.of with CoLists");
|
56
|
-
}
|
57
|
-
/** @internal */
|
58
|
-
get _schema() {
|
59
|
-
return this.constructor._schema;
|
60
|
-
}
|
61
|
-
/** @category Collaboration */
|
62
|
-
get _owner() {
|
63
|
-
return this._raw.group instanceof RawAccount
|
64
|
-
? Account.fromRaw(this._raw.group)
|
65
|
-
: Group.fromRaw(this._raw.group);
|
66
|
-
}
|
67
|
-
/**
|
68
|
-
* If a `CoList`'s items are a `co.ref(...)`, you can use `coList._refs[i]` to access
|
69
|
-
* the `Ref` instead of the potentially loaded/null value.
|
70
|
-
*
|
71
|
-
* This allows you to always get the ID or load the value manually.
|
72
|
-
*
|
73
|
-
* @example
|
74
|
-
* ```ts
|
75
|
-
* animals._refs[0].id; // => ID<Animal>
|
76
|
-
* animals._refs[0].value;
|
77
|
-
* // => Animal | null
|
78
|
-
* const animal = await animals._refs[0].load();
|
79
|
-
* ```
|
80
|
-
*
|
81
|
-
* @category Content
|
82
|
-
**/
|
83
|
-
get _refs() {
|
84
|
-
return makeRefs((idx) => this._raw.get(idx), () => Array.from({ length: this._raw.entries().length }, (_, idx) => idx), this._loadedAs, (_idx) => this._schema[ItemsSym]);
|
85
|
-
}
|
86
|
-
get _edits() {
|
87
|
-
throw new Error("Not implemented");
|
88
|
-
}
|
89
|
-
get _loadedAs() {
|
90
|
-
const rawAccount = this._raw.core.node.account;
|
91
|
-
if (rawAccount instanceof RawAccount) {
|
92
|
-
return coValuesCache.get(rawAccount, () => Account.fromRaw(rawAccount));
|
93
|
-
}
|
94
|
-
return new AnonymousJazzAgent(this._raw.core.node);
|
95
|
-
}
|
96
|
-
static get [Symbol.species]() {
|
97
|
-
return Array;
|
98
|
-
}
|
99
|
-
constructor(options) {
|
100
|
-
super();
|
101
|
-
Object.defineProperty(this, "_instanceID", {
|
102
|
-
value: `instance-${Math.random().toString(36).slice(2)}`,
|
103
|
-
enumerable: false,
|
104
|
-
});
|
105
|
-
if (options && "fromRaw" in options) {
|
106
|
-
Object.defineProperties(this, {
|
107
|
-
id: {
|
108
|
-
value: options.fromRaw.id,
|
109
|
-
enumerable: false,
|
110
|
-
},
|
111
|
-
_raw: { value: options.fromRaw, enumerable: false },
|
112
|
-
});
|
113
|
-
}
|
114
|
-
return new Proxy(this, CoListProxyHandler);
|
115
|
-
}
|
116
|
-
/**
|
117
|
-
* Create a new CoList with the given initial values and owner.
|
118
|
-
*
|
119
|
-
* The owner (a Group or Account) determines access rights to the CoMap.
|
120
|
-
*
|
121
|
-
* The CoList will immediately be persisted and synced to connected peers.
|
122
|
-
*
|
123
|
-
* @example
|
124
|
-
* ```ts
|
125
|
-
* const colours = ColorList.create(
|
126
|
-
* ["red", "green", "blue"],
|
127
|
-
* { owner: me }
|
128
|
-
* );
|
129
|
-
* const animals = AnimalList.create(
|
130
|
-
* [cat, dog, fish],
|
131
|
-
* { owner: me }
|
132
|
-
* );
|
133
|
-
* ```
|
134
|
-
*
|
135
|
-
* @category Creation
|
136
|
-
**/
|
137
|
-
static create(items, options) {
|
138
|
-
const instance = new this({ init: items, owner: options.owner });
|
139
|
-
const raw = options.owner._raw.createList(toRawItems(items, instance._schema[ItemsSym]));
|
140
|
-
Object.defineProperties(instance, {
|
141
|
-
id: {
|
142
|
-
value: raw.id,
|
143
|
-
enumerable: false,
|
144
|
-
},
|
145
|
-
_raw: { value: raw, enumerable: false },
|
146
|
-
});
|
147
|
-
return instance;
|
148
|
-
}
|
149
|
-
push(...items) {
|
150
|
-
for (const item of toRawItems(items, this._schema[ItemsSym])) {
|
151
|
-
this._raw.append(item);
|
152
|
-
}
|
153
|
-
return this._raw.entries().length;
|
154
|
-
}
|
155
|
-
unshift(...items) {
|
156
|
-
for (const item of toRawItems(items, this._schema[ItemsSym])) {
|
157
|
-
this._raw.prepend(item);
|
158
|
-
}
|
159
|
-
return this._raw.entries().length;
|
160
|
-
}
|
161
|
-
pop() {
|
162
|
-
const last = this[this.length - 1];
|
163
|
-
this._raw.delete(this.length - 1);
|
164
|
-
return last;
|
165
|
-
}
|
166
|
-
shift() {
|
167
|
-
const first = this[0];
|
168
|
-
this._raw.delete(0);
|
169
|
-
return first;
|
170
|
-
}
|
171
|
-
splice(start, deleteCount, ...items) {
|
172
|
-
const deleted = this.slice(start, start + deleteCount);
|
173
|
-
for (let idxToDelete = start + deleteCount - 1; idxToDelete >= start; idxToDelete--) {
|
174
|
-
this._raw.delete(idxToDelete);
|
175
|
-
}
|
176
|
-
let appendAfter = Math.max(start - 1, 0);
|
177
|
-
for (const item of toRawItems(items, this._schema[ItemsSym])) {
|
178
|
-
console.log(this._raw.asArray(), appendAfter);
|
179
|
-
this._raw.append(item, appendAfter);
|
180
|
-
appendAfter++;
|
181
|
-
}
|
182
|
-
return deleted;
|
183
|
-
}
|
184
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
185
|
-
toJSON(_key, seenAbove) {
|
186
|
-
const itemDescriptor = this._schema[ItemsSym];
|
187
|
-
if (itemDescriptor === "json") {
|
188
|
-
return this._raw.asArray();
|
189
|
-
}
|
190
|
-
else if ("encoded" in itemDescriptor) {
|
191
|
-
return this._raw.asArray().map((e) => itemDescriptor.encoded.encode(e));
|
192
|
-
}
|
193
|
-
else if (isRefEncoded(itemDescriptor)) {
|
194
|
-
return this.map((item, idx) => seenAbove?.includes(item?.id)
|
195
|
-
? { _circular: item.id }
|
196
|
-
: item?.toJSON(idx + "", [
|
197
|
-
...(seenAbove || []),
|
198
|
-
this.id,
|
199
|
-
]));
|
200
|
-
}
|
201
|
-
else {
|
202
|
-
return [];
|
203
|
-
}
|
204
|
-
}
|
205
|
-
[inspect]() {
|
206
|
-
return this.toJSON();
|
207
|
-
}
|
208
|
-
/** @category Internals */
|
209
|
-
static fromRaw(raw) {
|
210
|
-
return new this({ fromRaw: raw });
|
211
|
-
}
|
212
|
-
/** @internal */
|
213
|
-
static schema(def) {
|
214
|
-
this._schema ||= {};
|
215
|
-
Object.assign(this._schema, def);
|
216
|
-
}
|
217
|
-
/**
|
218
|
-
* Load a `CoList` with a given ID, as a given account.
|
219
|
-
*
|
220
|
-
* `depth` specifies if item CoValue references should be loaded as well before resolving.
|
221
|
-
* The `DeeplyLoaded` return type guarantees that corresponding referenced CoValues are loaded to the specified depth.
|
222
|
-
*
|
223
|
-
* You can pass `[]` or for shallowly loading only this CoList, or `[itemDepth]` for recursively loading referenced CoValues.
|
224
|
-
*
|
225
|
-
* Check out the `load` methods on `CoMap`/`CoList`/`CoFeed`/`Group`/`Account` to see which depth structures are valid to nest.
|
226
|
-
*
|
227
|
-
* @example
|
228
|
-
* ```ts
|
229
|
-
* const animalsWithVets =
|
230
|
-
* await ListOfAnimals.load(
|
231
|
-
* "co_zdsMhHtfG6VNKt7RqPUPvUtN2Ax",
|
232
|
-
* me,
|
233
|
-
* [{ vet: {} }]
|
234
|
-
* );
|
235
|
-
* ```
|
236
|
-
*
|
237
|
-
* @category Subscription & Loading
|
238
|
-
*/
|
239
|
-
static load(id, as, depth) {
|
240
|
-
return loadCoValue(this, id, as, depth);
|
241
|
-
}
|
242
|
-
/**
|
243
|
-
* Load and subscribe to a `CoList` with a given ID, as a given account.
|
244
|
-
*
|
245
|
-
* Automatically also subscribes to updates to all referenced/nested CoValues as soon as they are accessed in the listener.
|
246
|
-
*
|
247
|
-
* `depth` specifies if item CoValue references should be loaded as well before calling `listener` for the first time.
|
248
|
-
* The `DeeplyLoaded` return type guarantees that corresponding referenced CoValues are loaded to the specified depth.
|
249
|
-
*
|
250
|
-
* You can pass `[]` or for shallowly loading only this CoList, or `[itemDepth]` for recursively loading referenced CoValues.
|
251
|
-
*
|
252
|
-
* Check out the `load` methods on `CoMap`/`CoList`/`CoFeed`/`Group`/`Account` to see which depth structures are valid to nest.
|
253
|
-
*
|
254
|
-
* Returns an unsubscribe function that you should call when you no longer need updates.
|
255
|
-
*
|
256
|
-
* Also see the `useCoState` hook to reactively subscribe to a CoValue in a React component.
|
257
|
-
*
|
258
|
-
* @example
|
259
|
-
* ```ts
|
260
|
-
* const unsub = ListOfAnimals.subscribe(
|
261
|
-
* "co_zdsMhHtfG6VNKt7RqPUPvUtN2Ax",
|
262
|
-
* me,
|
263
|
-
* { vet: {} },
|
264
|
-
* (animalsWithVets) => console.log(animalsWithVets)
|
265
|
-
* );
|
266
|
-
* ```
|
267
|
-
*
|
268
|
-
* @category Subscription & Loading
|
269
|
-
*/
|
270
|
-
static subscribe(id, as, depth, listener) {
|
271
|
-
return subscribeToCoValue(this, id, as, depth, listener);
|
272
|
-
}
|
273
|
-
/**
|
274
|
-
* Given an already loaded `CoList`, ensure that items are loaded to the specified depth.
|
275
|
-
*
|
276
|
-
* Works like `CoList.load()`, but you don't need to pass the ID or the account to load as again.
|
277
|
-
*
|
278
|
-
* @category Subscription & Loading
|
279
|
-
*/
|
280
|
-
ensureLoaded(depth) {
|
281
|
-
return ensureCoValueLoaded(this, depth);
|
282
|
-
}
|
283
|
-
/**
|
284
|
-
* Given an already loaded `CoList`, subscribe to updates to the `CoList` and ensure that items are loaded to the specified depth.
|
285
|
-
*
|
286
|
-
* Works like `CoList.subscribe()`, but you don't need to pass the ID or the account to load as again.
|
287
|
-
*
|
288
|
-
* Returns an unsubscribe function that you should call when you no longer need updates.
|
289
|
-
*
|
290
|
-
* @category Subscription & Loading
|
291
|
-
**/
|
292
|
-
subscribe(depth, listener) {
|
293
|
-
return subscribeToExistingCoValue(this, depth, listener);
|
294
|
-
}
|
295
|
-
/** @category Type Helpers */
|
296
|
-
castAs(cl) {
|
297
|
-
const casted = cl.fromRaw(this._raw);
|
298
|
-
const subscriptionScope = subscriptionsScopes.get(this);
|
299
|
-
if (subscriptionScope) {
|
300
|
-
subscriptionsScopes.set(casted, subscriptionScope);
|
301
|
-
}
|
302
|
-
return casted;
|
303
|
-
}
|
304
|
-
/**
|
305
|
-
* Wait for the `CoList` to be uploaded to the other peers.
|
306
|
-
*
|
307
|
-
* @category Subscription & Loading
|
308
|
-
*/
|
309
|
-
waitForSync(options) {
|
310
|
-
return this._raw.core.waitForSync(options);
|
311
|
-
}
|
312
|
-
}
|
313
|
-
_a = CoList;
|
314
|
-
(() => {
|
315
|
-
_a.prototype._type = "CoList";
|
316
|
-
})();
|
317
|
-
function toRawItems(items, itemDescriptor) {
|
318
|
-
const rawItems = itemDescriptor === "json"
|
319
|
-
? items
|
320
|
-
: "encoded" in itemDescriptor
|
321
|
-
? items?.map((e) => itemDescriptor.encoded.encode(e))
|
322
|
-
: isRefEncoded(itemDescriptor)
|
323
|
-
? items?.map((v) => v.id)
|
324
|
-
: (() => {
|
325
|
-
throw new Error("Invalid element descriptor");
|
326
|
-
})();
|
327
|
-
return rawItems;
|
328
|
-
}
|
329
|
-
const CoListProxyHandler = {
|
330
|
-
get(target, key, receiver) {
|
331
|
-
if (typeof key === "string" && !isNaN(+key)) {
|
332
|
-
const itemDescriptor = target._schema[ItemsSym];
|
333
|
-
const rawValue = target._raw.get(Number(key));
|
334
|
-
if (itemDescriptor === "json") {
|
335
|
-
return rawValue;
|
336
|
-
}
|
337
|
-
else if ("encoded" in itemDescriptor) {
|
338
|
-
return rawValue === undefined
|
339
|
-
? undefined
|
340
|
-
: itemDescriptor.encoded.decode(rawValue);
|
341
|
-
}
|
342
|
-
else if (isRefEncoded(itemDescriptor)) {
|
343
|
-
return rawValue === undefined
|
344
|
-
? undefined
|
345
|
-
: new Ref(rawValue, target._loadedAs, itemDescriptor).accessFrom(receiver, Number(key));
|
346
|
-
}
|
347
|
-
}
|
348
|
-
else if (key === "length") {
|
349
|
-
return target._raw.entries().length;
|
350
|
-
}
|
351
|
-
else {
|
352
|
-
return Reflect.get(target, key, receiver);
|
353
|
-
}
|
354
|
-
},
|
355
|
-
set(target, key, value, receiver) {
|
356
|
-
if (key === ItemsSym && typeof value === "object" && SchemaInit in value) {
|
357
|
-
target.constructor._schema ||= {};
|
358
|
-
target.constructor._schema[ItemsSym] =
|
359
|
-
value[SchemaInit];
|
360
|
-
return true;
|
361
|
-
}
|
362
|
-
if (typeof key === "string" && !isNaN(+key)) {
|
363
|
-
const itemDescriptor = target._schema[ItemsSym];
|
364
|
-
let rawValue;
|
365
|
-
if (itemDescriptor === "json") {
|
366
|
-
rawValue = value;
|
367
|
-
}
|
368
|
-
else if ("encoded" in itemDescriptor) {
|
369
|
-
rawValue = itemDescriptor.encoded.encode(value);
|
370
|
-
}
|
371
|
-
else if (isRefEncoded(itemDescriptor)) {
|
372
|
-
rawValue = value.id;
|
373
|
-
}
|
374
|
-
target._raw.replace(Number(key), rawValue);
|
375
|
-
return true;
|
376
|
-
}
|
377
|
-
else {
|
378
|
-
return Reflect.set(target, key, value, receiver);
|
379
|
-
}
|
380
|
-
},
|
381
|
-
defineProperty(target, key, descriptor) {
|
382
|
-
if (descriptor.value &&
|
383
|
-
key === ItemsSym &&
|
384
|
-
typeof descriptor.value === "object" &&
|
385
|
-
SchemaInit in descriptor.value) {
|
386
|
-
target.constructor._schema ||= {};
|
387
|
-
target.constructor._schema[ItemsSym] =
|
388
|
-
descriptor.value[SchemaInit];
|
389
|
-
return true;
|
390
|
-
}
|
391
|
-
else {
|
392
|
-
return Reflect.defineProperty(target, key, descriptor);
|
393
|
-
}
|
394
|
-
},
|
395
|
-
has(target, key) {
|
396
|
-
if (typeof key === "string" && !isNaN(+key)) {
|
397
|
-
return Number(key) < target._raw.entries().length;
|
398
|
-
}
|
399
|
-
else {
|
400
|
-
return Reflect.has(target, key);
|
401
|
-
}
|
402
|
-
},
|
403
|
-
};
|
404
|
-
//# sourceMappingURL=coList.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"coList.js","sourceRoot":"","sources":["../../../src/coValues/coList.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAapC,OAAO,EACL,OAAO,EACP,kBAAkB,EAClB,KAAK,EACL,QAAQ,EACR,GAAG,EACH,UAAU,EACV,EAAE,EACF,mBAAmB,EACnB,OAAO,EACP,YAAY,EACZ,WAAW,EACX,QAAQ,EACR,kBAAkB,EAClB,0BAA0B,EAC1B,mBAAmB,GACpB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD;;;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