jazz-tools 0.7.0-alpha.9 → 0.7.3
Sign up to get free protection for your applications and to get access to all the features.
- package/.eslintrc.cjs +3 -10
- package/.prettierrc.js +9 -0
- package/.turbo/turbo-build.log +14 -15
- package/.turbo/turbo-lint.log +4 -0
- package/.turbo/turbo-test.log +140 -0
- package/CHANGELOG.md +331 -27
- package/LICENSE.txt +1 -1
- package/README.md +10 -2
- package/dist/coValues/account.js +86 -41
- package/dist/coValues/account.js.map +1 -1
- package/dist/coValues/coList.js +75 -48
- package/dist/coValues/coList.js.map +1 -1
- package/dist/coValues/coMap.js +167 -44
- package/dist/coValues/coMap.js.map +1 -1
- package/dist/coValues/coStream.js +192 -35
- package/dist/coValues/coStream.js.map +1 -1
- package/dist/coValues/deepLoading.js +60 -0
- package/dist/coValues/deepLoading.js.map +1 -0
- package/dist/coValues/extensions/imageDef.js +10 -7
- package/dist/coValues/extensions/imageDef.js.map +1 -1
- package/dist/coValues/group.js +73 -13
- package/dist/coValues/group.js.map +1 -1
- package/dist/coValues/interfaces.js +58 -35
- package/dist/coValues/interfaces.js.map +1 -1
- package/dist/implementation/devtoolsFormatters.js +114 -0
- package/dist/implementation/devtoolsFormatters.js.map +1 -0
- package/dist/implementation/refs.js +58 -18
- package/dist/implementation/refs.js.map +1 -1
- package/dist/implementation/schema.js +58 -0
- package/dist/implementation/schema.js.map +1 -0
- package/dist/implementation/subscriptionScope.js +19 -1
- package/dist/implementation/subscriptionScope.js.map +1 -1
- package/dist/implementation/symbols.js +5 -0
- package/dist/implementation/symbols.js.map +1 -0
- package/dist/index.js +4 -5
- package/dist/index.js.map +1 -1
- package/dist/internal.js +5 -2
- package/dist/internal.js.map +1 -1
- package/dist/tests/coList.test.js +51 -48
- package/dist/tests/coList.test.js.map +1 -1
- package/dist/tests/coMap.test.js +131 -74
- package/dist/tests/coMap.test.js.map +1 -1
- package/dist/tests/coStream.test.js +56 -41
- package/dist/tests/coStream.test.js.map +1 -1
- package/dist/tests/deepLoading.test.js +188 -0
- package/dist/tests/deepLoading.test.js.map +1 -0
- package/dist/tests/groupsAndAccounts.test.js +83 -0
- package/dist/tests/groupsAndAccounts.test.js.map +1 -0
- package/package.json +17 -9
- package/src/coValues/account.ts +186 -128
- package/src/coValues/coList.ts +156 -107
- package/src/coValues/coMap.ts +272 -148
- package/src/coValues/coStream.ts +388 -87
- package/src/coValues/deepLoading.ts +229 -0
- package/src/coValues/extensions/imageDef.ts +17 -13
- package/src/coValues/group.ts +166 -59
- package/src/coValues/interfaces.ts +189 -160
- package/src/implementation/devtoolsFormatters.ts +110 -0
- package/src/implementation/inspect.ts +1 -1
- package/src/implementation/refs.ts +80 -28
- package/src/implementation/schema.ts +141 -0
- package/src/implementation/subscriptionScope.ts +48 -12
- package/src/implementation/symbols.ts +11 -0
- package/src/index.ts +19 -8
- package/src/internal.ts +7 -3
- package/src/tests/coList.test.ts +77 -62
- package/src/tests/coMap.test.ts +201 -114
- package/src/tests/coStream.test.ts +113 -84
- package/src/tests/deepLoading.test.ts +304 -0
- package/src/tests/groupsAndAccounts.test.ts +91 -0
- package/dist/implementation/encoding.js +0 -26
- package/dist/implementation/encoding.js.map +0 -1
- package/src/implementation/encoding.ts +0 -105
@@ -1,7 +1,9 @@
|
|
1
1
|
var _a;
|
2
|
-
import { cojsonInternals } from "cojson";
|
3
|
-
import { ItemsSym, Account, CoValueBase, Ref, inspect,
|
4
|
-
import {
|
2
|
+
import { MAX_RECOMMENDED_TX_SIZE, cojsonInternals } from "cojson";
|
3
|
+
import { ItemsSym, Account, CoValueBase, Ref, inspect, co, InitValues, SchemaInit, isRefEncoded, loadCoValue, loadCoValueEf, subscribeToCoValue, subscribeToCoValueEf, ensureCoValueLoaded, subscribeToExistingCoValue, } from "../internal.js";
|
4
|
+
import { encodeSync, decodeSync } from "@effect/schema/Schema";
|
5
|
+
/** @category CoValues */
|
6
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
5
7
|
export class CoStream extends CoValueBase {
|
6
8
|
static Of(item) {
|
7
9
|
var _b, _c;
|
@@ -11,11 +13,11 @@ export class CoStream extends CoValueBase {
|
|
11
13
|
this[_b] = item;
|
12
14
|
}
|
13
15
|
},
|
14
|
-
_b =
|
16
|
+
_b = co.items,
|
15
17
|
_c;
|
16
18
|
}
|
17
|
-
get
|
18
|
-
return this.constructor.
|
19
|
+
get _schema() {
|
20
|
+
return this.constructor._schema;
|
19
21
|
}
|
20
22
|
get byMe() {
|
21
23
|
return this[this._loadedAs.id];
|
@@ -23,7 +25,7 @@ export class CoStream extends CoValueBase {
|
|
23
25
|
get inCurrentSession() {
|
24
26
|
return this.perSession[this._loadedAs.sessionID];
|
25
27
|
}
|
26
|
-
constructor(
|
28
|
+
constructor(options) {
|
27
29
|
super();
|
28
30
|
if ("fromRaw" in options) {
|
29
31
|
Object.defineProperties(this, {
|
@@ -36,35 +38,38 @@ export class CoStream extends CoValueBase {
|
|
36
38
|
}
|
37
39
|
else {
|
38
40
|
this[InitValues] = {
|
39
|
-
init,
|
41
|
+
init: options.init,
|
40
42
|
owner: options.owner,
|
41
43
|
};
|
42
44
|
}
|
43
45
|
return new Proxy(this, CoStreamProxyHandler);
|
44
46
|
}
|
47
|
+
static create(init, options) {
|
48
|
+
return new this({ init, owner: options.owner });
|
49
|
+
}
|
45
50
|
push(...items) {
|
46
51
|
for (const item of items) {
|
47
52
|
this.pushItem(item);
|
48
53
|
}
|
49
54
|
}
|
50
55
|
pushItem(item) {
|
51
|
-
const itemDescriptor = this.
|
56
|
+
const itemDescriptor = this._schema[ItemsSym];
|
52
57
|
if (itemDescriptor === "json") {
|
53
58
|
this._raw.push(item);
|
54
59
|
}
|
55
60
|
else if ("encoded" in itemDescriptor) {
|
56
|
-
this._raw.push(
|
61
|
+
this._raw.push(encodeSync(itemDescriptor.encoded)(item));
|
57
62
|
}
|
58
|
-
else if (
|
63
|
+
else if (isRefEncoded(itemDescriptor)) {
|
59
64
|
this._raw.push(item.id);
|
60
65
|
}
|
61
66
|
}
|
62
67
|
toJSON() {
|
63
|
-
const itemDescriptor = this.
|
68
|
+
const itemDescriptor = this._schema[ItemsSym];
|
64
69
|
const mapper = itemDescriptor === "json"
|
65
70
|
? (v) => v
|
66
71
|
: "encoded" in itemDescriptor
|
67
|
-
?
|
72
|
+
? encodeSync(itemDescriptor.encoded)
|
68
73
|
: (v) => v && v.id;
|
69
74
|
return {
|
70
75
|
id: this.id,
|
@@ -82,9 +87,33 @@ export class CoStream extends CoValueBase {
|
|
82
87
|
[inspect]() {
|
83
88
|
return this.toJSON();
|
84
89
|
}
|
85
|
-
static
|
86
|
-
this.
|
87
|
-
Object.assign(this.
|
90
|
+
static schema(def) {
|
91
|
+
this._schema || (this._schema = {});
|
92
|
+
Object.assign(this._schema, def);
|
93
|
+
}
|
94
|
+
/** @category Subscription & Loading */
|
95
|
+
static load(id, as, depth) {
|
96
|
+
return loadCoValue(this, id, as, depth);
|
97
|
+
}
|
98
|
+
/** @category Subscription & Loading */
|
99
|
+
static loadEf(id, depth) {
|
100
|
+
return loadCoValueEf(this, id, depth);
|
101
|
+
}
|
102
|
+
/** @category Subscription & Loading */
|
103
|
+
static subscribe(id, as, depth, listener) {
|
104
|
+
return subscribeToCoValue(this, id, as, depth, listener);
|
105
|
+
}
|
106
|
+
/** @category Subscription & Loading */
|
107
|
+
static subscribeEf(id, depth) {
|
108
|
+
return subscribeToCoValueEf(this, id, depth);
|
109
|
+
}
|
110
|
+
/** @category Subscription & Loading */
|
111
|
+
ensureLoaded(depth) {
|
112
|
+
return ensureCoValueLoaded(this, depth);
|
113
|
+
}
|
114
|
+
/** @category Subscription & Loading */
|
115
|
+
subscribe(depth, listener) {
|
116
|
+
return subscribeToExistingCoValue(this, depth, listener);
|
88
117
|
}
|
89
118
|
}
|
90
119
|
_a = CoStream;
|
@@ -98,21 +127,33 @@ function entryFromRawEntry(accessFrom, rawEntry, loadedAs, accountID, itemField)
|
|
98
127
|
return rawEntry.value;
|
99
128
|
}
|
100
129
|
else if ("encoded" in itemField) {
|
101
|
-
return
|
130
|
+
return decodeSync(itemField.encoded)(rawEntry.value);
|
131
|
+
}
|
132
|
+
else if (isRefEncoded(itemField)) {
|
133
|
+
return this.ref?.accessFrom(accessFrom, rawEntry.by +
|
134
|
+
rawEntry.tx.sessionID +
|
135
|
+
rawEntry.tx.txIndex +
|
136
|
+
".value");
|
102
137
|
}
|
103
|
-
else
|
104
|
-
|
138
|
+
else {
|
139
|
+
throw new Error("Invalid item field schema");
|
105
140
|
}
|
106
141
|
},
|
107
142
|
get ref() {
|
108
|
-
if (itemField !== "json" &&
|
143
|
+
if (itemField !== "json" && isRefEncoded(itemField)) {
|
109
144
|
const rawId = rawEntry.value;
|
110
145
|
return new Ref(rawId, loadedAs, itemField);
|
111
146
|
}
|
147
|
+
else {
|
148
|
+
return undefined;
|
149
|
+
}
|
112
150
|
},
|
113
151
|
get by() {
|
114
152
|
return (accountID &&
|
115
|
-
new Ref(accountID, loadedAs, { ref:
|
153
|
+
new Ref(accountID, loadedAs, { ref: Account, optional: false })?.accessFrom(accessFrom, rawEntry.by +
|
154
|
+
rawEntry.tx.sessionID +
|
155
|
+
rawEntry.tx.txIndex +
|
156
|
+
".by"));
|
116
157
|
},
|
117
158
|
madeAt: rawEntry.at,
|
118
159
|
tx: rawEntry.tx,
|
@@ -141,10 +182,25 @@ export const CoStreamProxyHandler = {
|
|
141
182
|
const rawEntry = target._raw.lastItemBy(key);
|
142
183
|
if (!rawEntry)
|
143
184
|
return;
|
144
|
-
|
185
|
+
const entry = entryFromRawEntry(receiver, rawEntry, target._loadedAs, key, target._schema[ItemsSym]);
|
186
|
+
Object.defineProperty(entry, "all", {
|
187
|
+
get: () => {
|
188
|
+
const allRawEntries = target._raw.itemsBy(key);
|
189
|
+
return (function* () {
|
190
|
+
while (true) {
|
191
|
+
const rawEntry = allRawEntries.next();
|
192
|
+
if (rawEntry.done)
|
193
|
+
return;
|
194
|
+
yield entryFromRawEntry(receiver, rawEntry.value, target._loadedAs, key, target._schema[ItemsSym]);
|
195
|
+
}
|
196
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
197
|
+
})();
|
198
|
+
},
|
199
|
+
});
|
200
|
+
return entry;
|
145
201
|
}
|
146
202
|
else if (key === "perSession") {
|
147
|
-
return new Proxy(
|
203
|
+
return new Proxy({}, CoStreamPerSessionProxyHandler(target, receiver));
|
148
204
|
}
|
149
205
|
else {
|
150
206
|
return Reflect.get(target, key, receiver);
|
@@ -155,8 +211,8 @@ export const CoStreamProxyHandler = {
|
|
155
211
|
if (key === ItemsSym &&
|
156
212
|
typeof value === "object" &&
|
157
213
|
SchemaInit in value) {
|
158
|
-
(_b = target.constructor).
|
159
|
-
target.constructor.
|
214
|
+
(_b = target.constructor)._schema || (_b._schema = {});
|
215
|
+
target.constructor._schema[ItemsSym] =
|
160
216
|
value[SchemaInit];
|
161
217
|
init(target);
|
162
218
|
return true;
|
@@ -171,8 +227,8 @@ export const CoStreamProxyHandler = {
|
|
171
227
|
key === ItemsSym &&
|
172
228
|
typeof descriptor.value === "object" &&
|
173
229
|
SchemaInit in descriptor.value) {
|
174
|
-
(_b = target.constructor).
|
175
|
-
target.constructor.
|
230
|
+
(_b = target.constructor)._schema || (_b._schema = {});
|
231
|
+
target.constructor._schema[ItemsSym] =
|
176
232
|
descriptor.value[SchemaInit];
|
177
233
|
init(target);
|
178
234
|
return true;
|
@@ -201,25 +257,58 @@ export const CoStreamProxyHandler = {
|
|
201
257
|
}
|
202
258
|
},
|
203
259
|
};
|
204
|
-
const CoStreamPerSessionProxyHandler = {
|
205
|
-
get(
|
260
|
+
const CoStreamPerSessionProxyHandler = (innerTarget, accessFrom) => ({
|
261
|
+
get(_target, key, receiver) {
|
206
262
|
if (typeof key === "string" && key.includes("session")) {
|
207
263
|
const sessionID = key;
|
208
|
-
const rawEntry =
|
264
|
+
const rawEntry = innerTarget._raw.lastItemIn(sessionID);
|
209
265
|
if (!rawEntry)
|
210
266
|
return;
|
211
267
|
const by = cojsonInternals.accountOrAgentIDfromSessionID(sessionID);
|
212
|
-
|
268
|
+
const entry = entryFromRawEntry(accessFrom, rawEntry, innerTarget._loadedAs, cojsonInternals.isAccountID(by)
|
213
269
|
? by
|
214
|
-
: undefined,
|
270
|
+
: undefined, innerTarget._schema[ItemsSym]);
|
271
|
+
Object.defineProperty(entry, "all", {
|
272
|
+
get: () => {
|
273
|
+
const allRawEntries = innerTarget._raw.itemsIn(sessionID);
|
274
|
+
return (function* () {
|
275
|
+
while (true) {
|
276
|
+
const rawEntry = allRawEntries.next();
|
277
|
+
if (rawEntry.done)
|
278
|
+
return;
|
279
|
+
yield entryFromRawEntry(accessFrom, rawEntry.value, innerTarget._loadedAs, cojsonInternals.isAccountID(by)
|
280
|
+
? by
|
281
|
+
: undefined, innerTarget._schema[ItemsSym]);
|
282
|
+
}
|
283
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
284
|
+
})();
|
285
|
+
},
|
286
|
+
});
|
287
|
+
return entry;
|
215
288
|
}
|
216
289
|
else {
|
217
|
-
return Reflect.get(
|
290
|
+
return Reflect.get(innerTarget, key, receiver);
|
218
291
|
}
|
219
292
|
},
|
220
|
-
|
293
|
+
ownKeys() {
|
294
|
+
return innerTarget._raw.sessions();
|
295
|
+
},
|
296
|
+
getOwnPropertyDescriptor(target, key) {
|
297
|
+
if (typeof key === "string" && key.startsWith("co_")) {
|
298
|
+
return {
|
299
|
+
configurable: true,
|
300
|
+
enumerable: true,
|
301
|
+
writable: false,
|
302
|
+
};
|
303
|
+
}
|
304
|
+
else {
|
305
|
+
return Reflect.getOwnPropertyDescriptor(target, key);
|
306
|
+
}
|
307
|
+
},
|
308
|
+
});
|
309
|
+
/** @category CoValues */
|
221
310
|
export class BinaryCoStream extends CoValueBase {
|
222
|
-
constructor(
|
311
|
+
constructor(options) {
|
223
312
|
super();
|
224
313
|
let raw;
|
225
314
|
if ("fromRaw" in options) {
|
@@ -234,9 +323,13 @@ export class BinaryCoStream extends CoValueBase {
|
|
234
323
|
value: raw.id,
|
235
324
|
enumerable: false,
|
236
325
|
},
|
326
|
+
_type: { value: "BinaryCoStream", enumerable: false },
|
237
327
|
_raw: { value: raw, enumerable: false },
|
238
328
|
});
|
239
329
|
}
|
330
|
+
static create(options) {
|
331
|
+
return new this(options);
|
332
|
+
}
|
240
333
|
getChunks(options) {
|
241
334
|
return this._raw.getBinaryChunks(options?.allowUnfinished);
|
242
335
|
}
|
@@ -249,6 +342,46 @@ export class BinaryCoStream extends CoValueBase {
|
|
249
342
|
end() {
|
250
343
|
this._raw.endBinaryStream();
|
251
344
|
}
|
345
|
+
toBlob(options) {
|
346
|
+
const chunks = this.getChunks({
|
347
|
+
allowUnfinished: options?.allowUnfinished,
|
348
|
+
});
|
349
|
+
if (!chunks) {
|
350
|
+
return undefined;
|
351
|
+
}
|
352
|
+
return new Blob(chunks.chunks, { type: chunks.mimeType });
|
353
|
+
}
|
354
|
+
static async loadAsBlob(id, as, options) {
|
355
|
+
const stream = await this.load(id, as, []);
|
356
|
+
return stream?.toBlob({
|
357
|
+
allowUnfinished: options?.allowUnfinished,
|
358
|
+
});
|
359
|
+
}
|
360
|
+
static async createFromBlob(blob, options) {
|
361
|
+
const stream = this.create({ owner: options.owner });
|
362
|
+
const start = Date.now();
|
363
|
+
const data = new Uint8Array(await blob.arrayBuffer());
|
364
|
+
stream.start({
|
365
|
+
mimeType: blob.type,
|
366
|
+
totalSizeBytes: blob.size,
|
367
|
+
fileName: blob instanceof File ? blob.name : undefined,
|
368
|
+
});
|
369
|
+
const chunkSize = MAX_RECOMMENDED_TX_SIZE;
|
370
|
+
let lastProgressUpdate = Date.now();
|
371
|
+
for (let idx = 0; idx < data.length; idx += chunkSize) {
|
372
|
+
stream.push(data.slice(idx, idx + chunkSize));
|
373
|
+
if (Date.now() - lastProgressUpdate > 100) {
|
374
|
+
options.onProgress?.(idx / data.length);
|
375
|
+
lastProgressUpdate = Date.now();
|
376
|
+
}
|
377
|
+
await new Promise((resolve) => setTimeout(resolve, 0));
|
378
|
+
}
|
379
|
+
stream.end();
|
380
|
+
const end = Date.now();
|
381
|
+
console.debug("Finished creating binary stream in", (end - start) / 1000, "s - Throughput in MB/s", (1000 * (blob.size / (end - start))) / (1024 * 1024));
|
382
|
+
options.onProgress?.(1);
|
383
|
+
return stream;
|
384
|
+
}
|
252
385
|
toJSON() {
|
253
386
|
return {
|
254
387
|
id: this.id,
|
@@ -259,5 +392,29 @@ export class BinaryCoStream extends CoValueBase {
|
|
259
392
|
[inspect]() {
|
260
393
|
return this.toJSON();
|
261
394
|
}
|
395
|
+
/** @category Subscription & Loading */
|
396
|
+
static load(id, as, depth) {
|
397
|
+
return loadCoValue(this, id, as, depth);
|
398
|
+
}
|
399
|
+
/** @category Subscription & Loading */
|
400
|
+
static loadEf(id, depth) {
|
401
|
+
return loadCoValueEf(this, id, depth);
|
402
|
+
}
|
403
|
+
/** @category Subscription & Loading */
|
404
|
+
static subscribe(id, as, depth, listener) {
|
405
|
+
return subscribeToCoValue(this, id, as, depth, listener);
|
406
|
+
}
|
407
|
+
/** @category Subscription & Loading */
|
408
|
+
static subscribeEf(id, depth) {
|
409
|
+
return subscribeToCoValueEf(this, id, depth);
|
410
|
+
}
|
411
|
+
/** @category Subscription & Loading */
|
412
|
+
ensureLoaded(depth) {
|
413
|
+
return ensureCoValueLoaded(this, depth);
|
414
|
+
}
|
415
|
+
/** @category Subscription & Loading */
|
416
|
+
subscribe(depth, listener) {
|
417
|
+
return subscribeToExistingCoValue(this, depth, listener);
|
418
|
+
}
|
262
419
|
}
|
263
420
|
//# sourceMappingURL=coStream.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"coStream.js","sourceRoot":"","sources":["../../src/coValues/coStream.ts"],"names":[],"mappings":";AAUA,OAAO,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAWzC,OAAO,EACH,QAAQ,EACR,OAAO,EACP,WAAW,EACX,GAAG,EACH,OAAO,EACP,GAAG,EACH,UAAU,EACV,UAAU,GACb,MAAM,gBAAgB,CAAC;AACxB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E,KAAK,CAAC,CAAC;IAC5C,CAAC;IAED,uCAAuC;IACvC,SAAS,CAEL,KAA0B,EAC1B,QAAiD;QAEjD,OAAO,0BAA0B,CAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;IAC7D,CAAC;CACJ"}
|
@@ -0,0 +1,60 @@
|
|
1
|
+
import { ItemsSym, } from "../internal.js";
|
2
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
3
|
+
export function fulfillsDepth(depth, value) {
|
4
|
+
if (value._type === "CoMap" ||
|
5
|
+
value._type === "Group" ||
|
6
|
+
value._type === "Account") {
|
7
|
+
if (Array.isArray(depth) && depth.length === 1) {
|
8
|
+
return Object.entries(value).every(([key, item]) => {
|
9
|
+
return value._refs[key]
|
10
|
+
? item && fulfillsDepth(depth[0], item)
|
11
|
+
: value._schema[ItemsSym].optional;
|
12
|
+
});
|
13
|
+
}
|
14
|
+
else {
|
15
|
+
for (const key of Object.keys(depth)) {
|
16
|
+
const map = value;
|
17
|
+
if (!map._refs[key] && map._schema[key].optional) {
|
18
|
+
continue;
|
19
|
+
}
|
20
|
+
if (!map[key]) {
|
21
|
+
return false;
|
22
|
+
}
|
23
|
+
if (!fulfillsDepth(depth[key], map[key])) {
|
24
|
+
return false;
|
25
|
+
}
|
26
|
+
}
|
27
|
+
return true;
|
28
|
+
}
|
29
|
+
}
|
30
|
+
else if (value._type === "CoList") {
|
31
|
+
if (depth.length === 0) {
|
32
|
+
return true;
|
33
|
+
}
|
34
|
+
else {
|
35
|
+
const itemDepth = depth[0];
|
36
|
+
return value.every((item, i) => value._refs[i]
|
37
|
+
? item && fulfillsDepth(itemDepth, item)
|
38
|
+
: value._schema[ItemsSym].optional);
|
39
|
+
}
|
40
|
+
}
|
41
|
+
else if (value._type === "CoStream") {
|
42
|
+
if (depth.length === 0) {
|
43
|
+
return true;
|
44
|
+
}
|
45
|
+
else {
|
46
|
+
const itemDepth = depth[0];
|
47
|
+
return Object.values(value.perSession).every((entry) => entry.ref
|
48
|
+
? entry.value && fulfillsDepth(itemDepth, entry.value)
|
49
|
+
: value._schema[ItemsSym].optional);
|
50
|
+
}
|
51
|
+
}
|
52
|
+
else if (value._type === "BinaryCoStream") {
|
53
|
+
return true;
|
54
|
+
}
|
55
|
+
else {
|
56
|
+
console.error(value);
|
57
|
+
throw new Error("Unexpected value type: " + value._type);
|
58
|
+
}
|
59
|
+
}
|
60
|
+
//# sourceMappingURL=deepLoading.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"deepLoading.js","sourceRoot":"","sources":["../../src/coValues/deepLoading.ts"],"names":[],"mappings":"AACA,OAAO,EAKH,QAAQ,GAIX,MAAM,gBAAgB,CAAC;AAIxB,8DAA8D;AAC9D,MAAM,UAAU,aAAa,CAAC,KAAU,EAAE,KAAc;IACpD,IACI,KAAK,CAAC,KAAK,KAAK,OAAO;QACvB,KAAK,CAAC,KAAK,KAAK,OAAO;QACvB,KAAK,CAAC,KAAK,KAAK,SAAS,EAC3B,CAAC;QACC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC7C,OAAO,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,EAAE;gBAC/C,OACI,KAGH,CAAC,KAAK,CAAC,GAAG,CAAC;oBACR,CAAC,CAAC,IAAI,IAAI,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC;oBACvC,CAAC,CAAG,KAAe,CAAC,OAAO,CACrB,QAAQ,CACc,CAAC,QAAQ,CAAC;YAC9C,CAAC,CAAC,CAAC;QACP,CAAC;aAAM,CAAC;YACJ,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;gBACnC,MAAM,GAAG,GAAG,KAIX,CAAC;gBACF,IAAI,CAA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,EAAE,CACN,KAAK,CAAC,GAAG;gBACL,CAAC,CAAC,KAAK,CAAC,KAAK,IAAI,aAAa,CAAC,SAAS,EAAE,KAAK,CAAC,KAAK,CAAC;gBACtD,CAAC,CACM,KAAkB,CAAC,OAAO,CACvB,QAAQ,CAEf,CAAC,QAAQ,CACvB,CAAC;QACN,CAAC;IACL,CAAC;SAAM,IAAI,KAAK,CAAC,KAAK,KAAK,gBAAgB,EAAE,CAAC;QAC1C,OAAO,IAAI,CAAC;IAChB,CAAC;SAAM,CAAC;QACJ,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACrB,MAAM,IAAI,KAAK,CAAC,yBAAyB,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;IAC7D,CAAC;AACL,CAAC"}
|
@@ -1,17 +1,20 @@
|
|
1
1
|
var _a;
|
2
|
-
import { BinaryCoStream, CoMap,
|
2
|
+
import { BinaryCoStream, CoMap, co, subscriptionsScopes, } from "../../internal.js";
|
3
|
+
/** @category Media */
|
3
4
|
export class ImageDefinition extends CoMap {
|
4
5
|
constructor() {
|
5
6
|
super(...arguments);
|
6
|
-
this.originalSize =
|
7
|
-
this.placeholderDataURL =
|
8
|
-
this[_a] =
|
7
|
+
this.originalSize = co.json();
|
8
|
+
this.placeholderDataURL = co.string;
|
9
|
+
this[_a] = co.ref(BinaryCoStream);
|
9
10
|
}
|
10
|
-
|
11
|
+
highestResAvailable(options) {
|
11
12
|
if (!subscriptionsScopes.get(this)) {
|
12
13
|
console.warn("highestResAvailable() only makes sense when used within a subscription.");
|
13
14
|
}
|
14
|
-
const resolutions = Object.keys(this).filter((key) => key.match(/^\d+x\d+$/)
|
15
|
+
const resolutions = Object.keys(this).filter((key) => key.match(/^\d+x\d+$/) &&
|
16
|
+
(options?.maxWidth === undefined ||
|
17
|
+
Number(key.split("x")[0]) <= options.maxWidth));
|
15
18
|
resolutions.sort((a, b) => {
|
16
19
|
const aWidth = Number(a.split("x")[0]);
|
17
20
|
const bWidth = Number(b.split("x")[0]);
|
@@ -35,5 +38,5 @@ export class ImageDefinition extends CoMap {
|
|
35
38
|
});
|
36
39
|
}
|
37
40
|
}
|
38
|
-
_a =
|
41
|
+
_a = co.items;
|
39
42
|
//# sourceMappingURL=imageDef.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"imageDef.js","sourceRoot":"","sources":["../../../src/coValues/extensions/imageDef.ts"],"names":[],"mappings":";AAAA,OAAO,EACH,cAAc,EACd,KAAK,EACL,
|
1
|
+
{"version":3,"file":"imageDef.js","sourceRoot":"","sources":["../../../src/coValues/extensions/imageDef.ts"],"names":[],"mappings":";AAAA,OAAO,EACH,cAAc,EACd,KAAK,EACL,EAAE,EACF,mBAAmB,GACtB,MAAM,mBAAmB,CAAC;AAE3B,sBAAsB;AACtB,MAAM,OAAO,eAAgB,SAAQ,KAAK;IAA1C;;QACI,iBAAY,GAAG,EAAE,CAAC,IAAI,EAAoB,CAAC;QAC3C,uBAAkB,GAAI,EAAE,CAAC,MAAM,CAAC;QAEhC,QAAU,GAAG,EAAE,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IA8CxC,CAAC;IA3CG,mBAAmB,CAAC,OAEnB;QACG,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YACjC,OAAO,CAAC,IAAI,CACR,yEAAyE,CAC5E,CAAC;QACN,CAAC;QAED,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,CACxC,CAAC,GAAG,EAAE,EAAE,CACJ,GAAG,CAAC,KAAK,CAAC,WAAW,CAAC;YACtB,CAAC,OAAO,EAAE,QAAQ,KAAK,SAAS;gBAC5B,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,CAC9B,CAAC;QAE7B,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;YACtB,MAAM,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YACvC,MAAM,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YACvC,OAAO,MAAM,GAAG,MAAM,CAAC;QAC3B,CAAC,CAAC,CAAC;QAEH,IAAI,0BAA6D,CAAC;QAElE,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE,CAAC;YACnC,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,EAAE,SAAS,EAAE,EAAE,CAAC;gBACpD,0BAA0B,GAAG,UAAU,CAAC;YAC5C,CAAC;iBAAM,CAAC;gBACJ,OAAO,CACH,0BAA0B,IAAI;oBAC1B,GAAG,EAAE,0BAA0B;oBAC/B,MAAM,EAAE,IAAI,CAAC,0BAA0B,CAAE;iBAC5C,CACJ,CAAC;YACN,CAAC;QACL,CAAC;QACD,OAAO,CACH,0BAA0B,IAAI;YAC1B,GAAG,EAAE,0BAA0B;YAC/B,MAAM,EAAE,IAAI,CAAC,0BAA0B,CAAE;SAC5C,CACJ,CAAC;IACN,CAAC;CACJ;KA9CI,EAAE,CAAC,KAAK"}
|
package/dist/coValues/group.js
CHANGED
@@ -1,33 +1,36 @@
|
|
1
1
|
var _a;
|
2
|
-
import { Account, CoMap, CoValueBase, Ref,
|
2
|
+
import { Account, CoMap, CoValueBase, Ref, co, isControlledAccount, AccountAndGroupProxyHandler, MembersSym, loadCoValue, loadCoValueEf, subscribeToCoValue, subscribeToCoValueEf, ensureCoValueLoaded, subscribeToExistingCoValue, } from "../internal.js";
|
3
|
+
/** @category Identity & Permissions */
|
3
4
|
export class Profile extends CoMap {
|
4
5
|
constructor() {
|
5
6
|
super(...arguments);
|
6
|
-
this.name =
|
7
|
+
this.name = co.string;
|
7
8
|
}
|
8
9
|
}
|
10
|
+
/** @category Identity & Permissions */
|
9
11
|
export class Group extends CoValueBase {
|
10
|
-
get
|
11
|
-
return this.constructor.
|
12
|
+
get _schema() {
|
13
|
+
return this.constructor._schema;
|
12
14
|
}
|
13
15
|
get _refs() {
|
14
16
|
const profileID = this._raw.get("profile");
|
15
17
|
const rootID = this._raw.get("root");
|
16
18
|
return {
|
17
19
|
profile: profileID &&
|
18
|
-
new Ref(profileID, this._loadedAs, this.
|
20
|
+
new Ref(profileID, this._loadedAs, this._schema.profile),
|
19
21
|
root: rootID &&
|
20
|
-
new Ref(rootID, this._loadedAs, this.
|
22
|
+
new Ref(rootID, this._loadedAs, this._schema.root),
|
21
23
|
};
|
22
24
|
}
|
23
|
-
constructor
|
25
|
+
/** @deprecated Don't use constructor directly, use .create */
|
26
|
+
constructor(options) {
|
24
27
|
super();
|
25
28
|
let raw;
|
26
29
|
if (options && "fromRaw" in options) {
|
27
30
|
raw = options.fromRaw;
|
28
31
|
}
|
29
32
|
else {
|
30
|
-
const initOwner = options
|
33
|
+
const initOwner = options.owner;
|
31
34
|
if (!initOwner)
|
32
35
|
throw new Error("No owner provided");
|
33
36
|
if (initOwner instanceof Account &&
|
@@ -48,11 +51,63 @@ export class Group extends CoValueBase {
|
|
48
51
|
});
|
49
52
|
return new Proxy(this, AccountAndGroupProxyHandler);
|
50
53
|
}
|
54
|
+
static create(options) {
|
55
|
+
return new this(options);
|
56
|
+
}
|
51
57
|
myRole() {
|
52
58
|
return this._raw.myRole();
|
53
59
|
}
|
54
60
|
addMember(member, role) {
|
55
61
|
this._raw.addMember(member === "everyone" ? member : member._raw, role);
|
62
|
+
return this;
|
63
|
+
}
|
64
|
+
get members() {
|
65
|
+
return this._raw
|
66
|
+
.keys()
|
67
|
+
.filter((key) => {
|
68
|
+
return key === "everyone" || key.startsWith("co_");
|
69
|
+
})
|
70
|
+
.map((id) => {
|
71
|
+
const role = this._raw.get(id);
|
72
|
+
const accountID = id === "everyone"
|
73
|
+
? undefined
|
74
|
+
: id;
|
75
|
+
const ref = accountID &&
|
76
|
+
new Ref(accountID, this._loadedAs, this._schema[MembersSym]);
|
77
|
+
const accessRef = () => ref?.accessFrom(this, "members." + id);
|
78
|
+
return {
|
79
|
+
id: id,
|
80
|
+
role,
|
81
|
+
ref,
|
82
|
+
get account() {
|
83
|
+
return accessRef();
|
84
|
+
},
|
85
|
+
};
|
86
|
+
});
|
87
|
+
}
|
88
|
+
/** @category Subscription & Loading */
|
89
|
+
static load(id, as, depth) {
|
90
|
+
return loadCoValue(this, id, as, depth);
|
91
|
+
}
|
92
|
+
/** @category Subscription & Loading */
|
93
|
+
static loadEf(id, depth) {
|
94
|
+
return loadCoValueEf(this, id, depth);
|
95
|
+
}
|
96
|
+
/** @category Subscription & Loading */
|
97
|
+
static subscribe(id, as, depth, listener) {
|
98
|
+
return subscribeToCoValue(this, id, as, depth, listener);
|
99
|
+
}
|
100
|
+
/** @category Subscription & Loading */
|
101
|
+
static subscribeEf(id, depth) {
|
102
|
+
return subscribeToCoValueEf(this, id, depth);
|
103
|
+
}
|
104
|
+
/** @category Subscription & Loading */
|
105
|
+
ensureLoaded(depth) {
|
106
|
+
return ensureCoValueLoaded(this, depth);
|
107
|
+
}
|
108
|
+
/** @category Subscription & Loading */
|
109
|
+
subscribe(depth, listener) {
|
110
|
+
return subscribeToExistingCoValue(this, depth, listener);
|
56
111
|
}
|
57
112
|
}
|
58
113
|
_a = Group;
|
@@ -60,12 +115,17 @@ _a = Group;
|
|
60
115
|
_a.prototype._type = "Group";
|
61
116
|
})();
|
62
117
|
(() => {
|
63
|
-
_a.
|
64
|
-
profile:
|
65
|
-
root:
|
118
|
+
_a._schema = {
|
119
|
+
profile: "json",
|
120
|
+
root: "json",
|
121
|
+
[MembersSym]: {
|
122
|
+
ref: () => Account,
|
123
|
+
optional: false,
|
124
|
+
},
|
125
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
66
126
|
};
|
67
|
-
Object.defineProperty(_a.prototype, "
|
68
|
-
get: () => _a.
|
127
|
+
Object.defineProperty(_a.prototype, "_schema", {
|
128
|
+
get: () => _a._schema,
|
69
129
|
});
|
70
130
|
})();
|
71
131
|
//# sourceMappingURL=group.js.map
|