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.
Files changed (114) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/native/coValues/account.js.map +1 -0
  3. package/dist/native/coValues/coList.js.map +1 -0
  4. package/dist/native/coValues/coMap.js.map +1 -0
  5. package/dist/{coValues → native/coValues}/coStream.js +1 -0
  6. package/dist/native/coValues/coStream.js.map +1 -0
  7. package/dist/native/coValues/deepLoading.js.map +1 -0
  8. package/dist/native/coValues/extensions/imageDef.js.map +1 -0
  9. package/dist/native/coValues/group.js.map +1 -0
  10. package/dist/native/coValues/interfaces.js.map +1 -0
  11. package/dist/{implementation → native/implementation}/createContext.js +8 -1
  12. package/dist/native/implementation/createContext.js.map +1 -0
  13. package/dist/native/implementation/devtoolsFormatters.js.map +1 -0
  14. package/dist/{implementation → native/implementation}/errors.js.map +1 -1
  15. package/dist/native/implementation/inspect.js.map +1 -0
  16. package/dist/native/implementation/refs.js.map +1 -0
  17. package/dist/native/implementation/schema.js.map +1 -0
  18. package/dist/native/implementation/subscriptionScope.js.map +1 -0
  19. package/dist/native/implementation/symbols.js.map +1 -0
  20. package/dist/native/index.native.js +12 -0
  21. package/dist/native/index.native.js.map +1 -0
  22. package/dist/native/internal.js.map +1 -0
  23. package/dist/web/coValues/account.js +208 -0
  24. package/dist/web/coValues/account.js.map +1 -0
  25. package/dist/web/coValues/coList.js +395 -0
  26. package/dist/web/coValues/coList.js.map +1 -0
  27. package/dist/web/coValues/coMap.js +501 -0
  28. package/dist/web/coValues/coMap.js.map +1 -0
  29. package/dist/web/coValues/coStream.js +413 -0
  30. package/dist/web/coValues/coStream.js.map +1 -0
  31. package/dist/web/coValues/deepLoading.js +60 -0
  32. package/dist/web/coValues/deepLoading.js.map +1 -0
  33. package/dist/web/coValues/extensions/imageDef.js +37 -0
  34. package/dist/web/coValues/extensions/imageDef.js.map +1 -0
  35. package/dist/web/coValues/group.js +120 -0
  36. package/dist/web/coValues/group.js.map +1 -0
  37. package/dist/web/coValues/interfaces.js +109 -0
  38. package/dist/web/coValues/interfaces.js.map +1 -0
  39. package/dist/web/implementation/createContext.js +151 -0
  40. package/dist/web/implementation/createContext.js.map +1 -0
  41. package/dist/web/implementation/devtoolsFormatters.js +115 -0
  42. package/dist/web/implementation/devtoolsFormatters.js.map +1 -0
  43. package/dist/web/implementation/errors.js +2 -0
  44. package/dist/web/implementation/errors.js.map +1 -0
  45. package/dist/web/implementation/inspect.js +2 -0
  46. package/dist/web/implementation/inspect.js.map +1 -0
  47. package/dist/web/implementation/refs.js +127 -0
  48. package/dist/web/implementation/refs.js.map +1 -0
  49. package/dist/web/implementation/schema.js +91 -0
  50. package/dist/web/implementation/schema.js.map +1 -0
  51. package/dist/web/implementation/subscriptionScope.js +97 -0
  52. package/dist/web/implementation/subscriptionScope.js.map +1 -0
  53. package/dist/web/implementation/symbols.js +4 -0
  54. package/dist/web/implementation/symbols.js.map +1 -0
  55. package/dist/{index.js → web/index.web.js} +3 -3
  56. package/dist/{index.js.map → web/index.web.js.map} +1 -1
  57. package/dist/web/internal.js +17 -0
  58. package/dist/web/internal.js.map +1 -0
  59. package/package.json +25 -7
  60. package/src/coValues/account.ts +4 -1
  61. package/src/coValues/coStream.ts +26 -4
  62. package/src/coValues/group.ts +4 -1
  63. package/src/implementation/createContext.ts +12 -10
  64. package/src/{index.ts → index.native.ts} +2 -3
  65. package/src/index.web.ts +36 -0
  66. package/src/tests/coList.test.ts +2 -2
  67. package/src/tests/coMap.test.ts +11 -9
  68. package/src/tests/coStream.test.ts +2 -2
  69. package/src/tests/deepLoading.test.ts +2 -2
  70. package/src/tests/groupsAndAccounts.test.ts +1 -1
  71. package/tsconfig.json +5 -4
  72. package/tsconfig.native.json +11 -0
  73. package/tsconfig.web.json +11 -0
  74. package/dist/coValues/account.js.map +0 -1
  75. package/dist/coValues/coList.js.map +0 -1
  76. package/dist/coValues/coMap.js.map +0 -1
  77. package/dist/coValues/coStream.js.map +0 -1
  78. package/dist/coValues/deepLoading.js.map +0 -1
  79. package/dist/coValues/extensions/imageDef.js.map +0 -1
  80. package/dist/coValues/group.js.map +0 -1
  81. package/dist/coValues/interfaces.js.map +0 -1
  82. package/dist/implementation/createContext.js.map +0 -1
  83. package/dist/implementation/devtoolsFormatters.js.map +0 -1
  84. package/dist/implementation/inspect.js.map +0 -1
  85. package/dist/implementation/refs.js.map +0 -1
  86. package/dist/implementation/schema.js.map +0 -1
  87. package/dist/implementation/subscriptionScope.js.map +0 -1
  88. package/dist/implementation/symbols.js.map +0 -1
  89. package/dist/internal.js.map +0 -1
  90. package/dist/tests/coList.test.js +0 -221
  91. package/dist/tests/coList.test.js.map +0 -1
  92. package/dist/tests/coMap.test.js +0 -615
  93. package/dist/tests/coMap.test.js.map +0 -1
  94. package/dist/tests/coStream.test.js +0 -324
  95. package/dist/tests/coStream.test.js.map +0 -1
  96. package/dist/tests/deepLoading.test.js +0 -175
  97. package/dist/tests/deepLoading.test.js.map +0 -1
  98. package/dist/tests/groupsAndAccounts.test.js +0 -69
  99. package/dist/tests/groupsAndAccounts.test.js.map +0 -1
  100. /package/dist/{coValues → native/coValues}/account.js +0 -0
  101. /package/dist/{coValues → native/coValues}/coList.js +0 -0
  102. /package/dist/{coValues → native/coValues}/coMap.js +0 -0
  103. /package/dist/{coValues → native/coValues}/deepLoading.js +0 -0
  104. /package/dist/{coValues → native/coValues}/extensions/imageDef.js +0 -0
  105. /package/dist/{coValues → native/coValues}/group.js +0 -0
  106. /package/dist/{coValues → native/coValues}/interfaces.js +0 -0
  107. /package/dist/{implementation → native/implementation}/devtoolsFormatters.js +0 -0
  108. /package/dist/{implementation → native/implementation}/errors.js +0 -0
  109. /package/dist/{implementation → native/implementation}/inspect.js +0 -0
  110. /package/dist/{implementation → native/implementation}/refs.js +0 -0
  111. /package/dist/{implementation → native/implementation}/schema.js +0 -0
  112. /package/dist/{implementation → native/implementation}/subscriptionScope.js +0 -0
  113. /package/dist/{implementation → native/implementation}/symbols.js +0 -0
  114. /package/dist/{internal.js → native/internal.js} +0 -0
@@ -0,0 +1,413 @@
1
+ import { MAX_RECOMMENDED_TX_SIZE, cojsonInternals } from "cojson";
2
+ import { ItemsSym, Account, CoValueBase, Ref, inspect, co, SchemaInit, isRefEncoded, loadCoValue, subscribeToCoValue, ensureCoValueLoaded, subscribeToExistingCoValue, } from "../internal.js";
3
+ /** @category CoValues */
4
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
5
+ export class CoStream extends CoValueBase {
6
+ static Of(item) {
7
+ return class CoStreamOf extends CoStream {
8
+ [co.items] = item;
9
+ };
10
+ }
11
+ static {
12
+ this.prototype._type = "CoStream";
13
+ }
14
+ /** @internal This is only a marker type and doesn't exist at runtime */
15
+ [ItemsSym];
16
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
17
+ static _schema;
18
+ get _schema() {
19
+ return this.constructor._schema;
20
+ }
21
+ get byMe() {
22
+ if (this._loadedAs._type === "Account") {
23
+ return this[this._loadedAs.id];
24
+ }
25
+ else {
26
+ return undefined;
27
+ }
28
+ }
29
+ perSession;
30
+ get inCurrentSession() {
31
+ if (this._loadedAs._type === "Account") {
32
+ return this.perSession[this._loadedAs.sessionID];
33
+ }
34
+ else {
35
+ return undefined;
36
+ }
37
+ }
38
+ constructor(options) {
39
+ super();
40
+ if (options && "fromRaw" in options) {
41
+ Object.defineProperties(this, {
42
+ id: {
43
+ value: options.fromRaw.id,
44
+ enumerable: false,
45
+ },
46
+ _raw: { value: options.fromRaw, enumerable: false },
47
+ });
48
+ }
49
+ return new Proxy(this, CoStreamProxyHandler);
50
+ }
51
+ static create(init, options) {
52
+ const instance = new this({ init, owner: options.owner });
53
+ const raw = options.owner._raw.createStream();
54
+ Object.defineProperties(instance, {
55
+ id: {
56
+ value: raw.id,
57
+ enumerable: false,
58
+ },
59
+ _raw: { value: raw, enumerable: false },
60
+ });
61
+ if (init) {
62
+ instance.push(...init);
63
+ }
64
+ return instance;
65
+ }
66
+ push(...items) {
67
+ for (const item of items) {
68
+ this.pushItem(item);
69
+ }
70
+ }
71
+ pushItem(item) {
72
+ const itemDescriptor = this._schema[ItemsSym];
73
+ if (itemDescriptor === "json") {
74
+ this._raw.push(item);
75
+ }
76
+ else if ("encoded" in itemDescriptor) {
77
+ this._raw.push(itemDescriptor.encoded.encode(item));
78
+ }
79
+ else if (isRefEncoded(itemDescriptor)) {
80
+ this._raw.push(item.id);
81
+ }
82
+ }
83
+ toJSON() {
84
+ const itemDescriptor = this._schema[ItemsSym];
85
+ const mapper = itemDescriptor === "json"
86
+ ? (v) => v
87
+ : "encoded" in itemDescriptor
88
+ ? itemDescriptor.encoded.encode
89
+ : (v) => v && v.id;
90
+ return {
91
+ id: this.id,
92
+ _type: this._type,
93
+ ...Object.fromEntries(Object.entries(this).map(([account, entry]) => [
94
+ account,
95
+ mapper(entry.value),
96
+ ])),
97
+ in: Object.fromEntries(Object.entries(this.perSession).map(([session, entry]) => [
98
+ session,
99
+ mapper(entry.value),
100
+ ])),
101
+ };
102
+ }
103
+ [inspect]() {
104
+ return this.toJSON();
105
+ }
106
+ static schema(def) {
107
+ this._schema ||= {};
108
+ Object.assign(this._schema, def);
109
+ }
110
+ /** @category Subscription & Loading */
111
+ static load(id, as, depth) {
112
+ return loadCoValue(this, id, as, depth);
113
+ }
114
+ /** @category Subscription & Loading */
115
+ static subscribe(id, as, depth, listener) {
116
+ return subscribeToCoValue(this, id, as, depth, listener);
117
+ }
118
+ /** @category Subscription & Loading */
119
+ ensureLoaded(depth) {
120
+ return ensureCoValueLoaded(this, depth);
121
+ }
122
+ /** @category Subscription & Loading */
123
+ subscribe(depth, listener) {
124
+ return subscribeToExistingCoValue(this, depth, listener);
125
+ }
126
+ }
127
+ function entryFromRawEntry(accessFrom, rawEntry, loadedAs, accountID, itemField) {
128
+ return {
129
+ get value() {
130
+ if (itemField === "json") {
131
+ return rawEntry.value;
132
+ }
133
+ else if ("encoded" in itemField) {
134
+ return itemField.encoded.decode(rawEntry.value);
135
+ }
136
+ else if (isRefEncoded(itemField)) {
137
+ return this.ref?.accessFrom(accessFrom, rawEntry.by +
138
+ rawEntry.tx.sessionID +
139
+ rawEntry.tx.txIndex +
140
+ ".value");
141
+ }
142
+ else {
143
+ throw new Error("Invalid item field schema");
144
+ }
145
+ },
146
+ get ref() {
147
+ if (itemField !== "json" && isRefEncoded(itemField)) {
148
+ const rawId = rawEntry.value;
149
+ return new Ref(rawId, loadedAs, itemField);
150
+ }
151
+ else {
152
+ return undefined;
153
+ }
154
+ },
155
+ get by() {
156
+ return (accountID &&
157
+ new Ref(accountID, loadedAs, { ref: Account, optional: false })?.accessFrom(accessFrom, rawEntry.by +
158
+ rawEntry.tx.sessionID +
159
+ rawEntry.tx.txIndex +
160
+ ".by"));
161
+ },
162
+ madeAt: rawEntry.at,
163
+ tx: rawEntry.tx,
164
+ };
165
+ }
166
+ export const CoStreamProxyHandler = {
167
+ get(target, key, receiver) {
168
+ if (typeof key === "string" && key.startsWith("co_")) {
169
+ const rawEntry = target._raw.lastItemBy(key);
170
+ if (!rawEntry)
171
+ return;
172
+ const entry = entryFromRawEntry(receiver, rawEntry, target._loadedAs, key, target._schema[ItemsSym]);
173
+ Object.defineProperty(entry, "all", {
174
+ get: () => {
175
+ const allRawEntries = target._raw.itemsBy(key);
176
+ return (function* () {
177
+ while (true) {
178
+ const rawEntry = allRawEntries.next();
179
+ if (rawEntry.done)
180
+ return;
181
+ yield entryFromRawEntry(receiver, rawEntry.value, target._loadedAs, key, target._schema[ItemsSym]);
182
+ }
183
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
184
+ })();
185
+ },
186
+ });
187
+ return entry;
188
+ }
189
+ else if (key === "perSession") {
190
+ return new Proxy({}, CoStreamPerSessionProxyHandler(target, receiver));
191
+ }
192
+ else {
193
+ return Reflect.get(target, key, receiver);
194
+ }
195
+ },
196
+ set(target, key, value, receiver) {
197
+ if (key === ItemsSym &&
198
+ typeof value === "object" &&
199
+ SchemaInit in value) {
200
+ target.constructor._schema ||= {};
201
+ target.constructor._schema[ItemsSym] =
202
+ value[SchemaInit];
203
+ return true;
204
+ }
205
+ else {
206
+ return Reflect.set(target, key, value, receiver);
207
+ }
208
+ },
209
+ defineProperty(target, key, descriptor) {
210
+ if (descriptor.value &&
211
+ key === ItemsSym &&
212
+ typeof descriptor.value === "object" &&
213
+ SchemaInit in descriptor.value) {
214
+ target.constructor._schema ||= {};
215
+ target.constructor._schema[ItemsSym] =
216
+ descriptor.value[SchemaInit];
217
+ return true;
218
+ }
219
+ else {
220
+ return Reflect.defineProperty(target, key, descriptor);
221
+ }
222
+ },
223
+ ownKeys(target) {
224
+ const keys = Reflect.ownKeys(target);
225
+ for (const accountID of target._raw.accounts()) {
226
+ keys.push(accountID);
227
+ }
228
+ return keys;
229
+ },
230
+ getOwnPropertyDescriptor(target, key) {
231
+ if (typeof key === "string" && key.startsWith("co_")) {
232
+ return {
233
+ configurable: true,
234
+ enumerable: true,
235
+ writable: false,
236
+ };
237
+ }
238
+ else {
239
+ return Reflect.getOwnPropertyDescriptor(target, key);
240
+ }
241
+ },
242
+ };
243
+ const CoStreamPerSessionProxyHandler = (innerTarget, accessFrom) => ({
244
+ get(_target, key, receiver) {
245
+ if (typeof key === "string" && key.includes("session")) {
246
+ const sessionID = key;
247
+ const rawEntry = innerTarget._raw.lastItemIn(sessionID);
248
+ if (!rawEntry)
249
+ return;
250
+ const by = cojsonInternals.accountOrAgentIDfromSessionID(sessionID);
251
+ const entry = entryFromRawEntry(accessFrom, rawEntry, innerTarget._loadedAs, cojsonInternals.isAccountID(by)
252
+ ? by
253
+ : undefined, innerTarget._schema[ItemsSym]);
254
+ Object.defineProperty(entry, "all", {
255
+ get: () => {
256
+ const allRawEntries = innerTarget._raw.itemsIn(sessionID);
257
+ return (function* () {
258
+ while (true) {
259
+ const rawEntry = allRawEntries.next();
260
+ if (rawEntry.done)
261
+ return;
262
+ yield entryFromRawEntry(accessFrom, rawEntry.value, innerTarget._loadedAs, cojsonInternals.isAccountID(by)
263
+ ? by
264
+ : undefined, innerTarget._schema[ItemsSym]);
265
+ }
266
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
267
+ })();
268
+ },
269
+ });
270
+ return entry;
271
+ }
272
+ else {
273
+ return Reflect.get(innerTarget, key, receiver);
274
+ }
275
+ },
276
+ ownKeys() {
277
+ return innerTarget._raw.sessions();
278
+ },
279
+ getOwnPropertyDescriptor(target, key) {
280
+ if (typeof key === "string" && key.startsWith("co_")) {
281
+ return {
282
+ configurable: true,
283
+ enumerable: true,
284
+ writable: false,
285
+ };
286
+ }
287
+ else {
288
+ return Reflect.getOwnPropertyDescriptor(target, key);
289
+ }
290
+ },
291
+ });
292
+ /** @category CoValues */
293
+ export class BinaryCoStream extends CoValueBase {
294
+ constructor(options) {
295
+ super();
296
+ let raw;
297
+ if ("fromRaw" in options) {
298
+ raw = options.fromRaw;
299
+ }
300
+ else {
301
+ const rawOwner = options.owner._raw;
302
+ raw = rawOwner.createBinaryStream();
303
+ }
304
+ Object.defineProperties(this, {
305
+ id: {
306
+ value: raw.id,
307
+ enumerable: false,
308
+ },
309
+ _type: { value: "BinaryCoStream", enumerable: false },
310
+ _raw: { value: raw, enumerable: false },
311
+ });
312
+ }
313
+ static create(options) {
314
+ return new this(options);
315
+ }
316
+ getChunks(options) {
317
+ return this._raw.getBinaryChunks(options?.allowUnfinished);
318
+ }
319
+ isBinaryStreamEnded() {
320
+ return this._raw.isBinaryStreamEnded();
321
+ }
322
+ start(options) {
323
+ this._raw.startBinaryStream(options);
324
+ }
325
+ push(data) {
326
+ this._raw.pushBinaryStreamChunk(data);
327
+ }
328
+ end() {
329
+ this._raw.endBinaryStream();
330
+ }
331
+ toBlob(options) {
332
+ const chunks = this.getChunks({
333
+ allowUnfinished: options?.allowUnfinished,
334
+ });
335
+ if (!chunks) {
336
+ return undefined;
337
+ }
338
+ // @ts-ignore
339
+ return new Blob(chunks.chunks, { type: chunks.mimeType });
340
+ }
341
+ static async loadAsBlob(id, as, options) {
342
+ let stream = await this.load(id, as, []);
343
+ /**
344
+ * If the user hasn't requested an incomplete blob and the
345
+ * stream isn't complete wait for the stream download before progressing
346
+ */
347
+ if (!options?.allowUnfinished && !stream?.isBinaryStreamEnded()) {
348
+ stream = await new Promise((resolve) => {
349
+ const unsubscribe = subscribeToCoValue(this, id, as, [], (value) => {
350
+ if (value.isBinaryStreamEnded()) {
351
+ unsubscribe();
352
+ resolve(value);
353
+ }
354
+ });
355
+ });
356
+ }
357
+ return stream?.toBlob({
358
+ allowUnfinished: options?.allowUnfinished,
359
+ });
360
+ }
361
+ static async createFromBlob(blob, options) {
362
+ const stream = this.create({ owner: options.owner });
363
+ const start = Date.now();
364
+ const data = new Uint8Array(await blob.arrayBuffer());
365
+ stream.start({
366
+ mimeType: blob.type,
367
+ totalSizeBytes: blob.size,
368
+ fileName: blob instanceof File ? blob.name : undefined,
369
+ });
370
+ const chunkSize = MAX_RECOMMENDED_TX_SIZE;
371
+ let lastProgressUpdate = Date.now();
372
+ for (let idx = 0; idx < data.length; idx += chunkSize) {
373
+ stream.push(data.slice(idx, idx + chunkSize));
374
+ if (Date.now() - lastProgressUpdate > 100) {
375
+ options.onProgress?.(idx / data.length);
376
+ lastProgressUpdate = Date.now();
377
+ }
378
+ await new Promise((resolve) => setTimeout(resolve, 0));
379
+ }
380
+ stream.end();
381
+ const end = Date.now();
382
+ console.debug("Finished creating binary stream in", (end - start) / 1000, "s - Throughput in MB/s", (1000 * (blob.size / (end - start))) / (1024 * 1024));
383
+ options.onProgress?.(1);
384
+ return stream;
385
+ }
386
+ toJSON() {
387
+ return {
388
+ id: this.id,
389
+ _type: this._type,
390
+ ...this.getChunks(),
391
+ };
392
+ }
393
+ [inspect]() {
394
+ return this.toJSON();
395
+ }
396
+ /** @category Subscription & Loading */
397
+ static load(id, as, depth) {
398
+ return loadCoValue(this, id, as, depth);
399
+ }
400
+ /** @category Subscription & Loading */
401
+ static subscribe(id, as, depth, listener) {
402
+ return subscribeToCoValue(this, id, as, depth, listener);
403
+ }
404
+ /** @category Subscription & Loading */
405
+ ensureLoaded(depth) {
406
+ return ensureCoValueLoaded(this, depth);
407
+ }
408
+ /** @category Subscription & Loading */
409
+ subscribe(depth, listener) {
410
+ return subscribeToExistingCoValue(this, depth, listener);
411
+ }
412
+ }
413
+ //# sourceMappingURL=coStream.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coStream.js","sourceRoot":"","sources":["../../../src/coValues/coStream.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,uBAAuB,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAclE,OAAO,EACH,QAAQ,EACR,OAAO,EACP,WAAW,EACX,GAAG,EACH,OAAO,EACP,EAAE,EACF,UAAU,EACV,YAAY,EACZ,WAAW,EACX,kBAAkB,EAClB,mBAAmB,EACnB,0BAA0B,GAC7B,MAAM,gBAAgB,CAAC;AAcxB,yBAAyB;AACzB,8DAA8D;AAC9D,MAAM,OAAO,QAAqB,SAAQ,WAAW;IACjD,MAAM,CAAC,EAAE,CAAO,IAAsB;QAClC,OAAO,MAAM,UAAW,SAAQ,QAAc;YAC1C,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;SACrB,CAAC;IACN,CAAC;IAID;QACI,IAAI,CAAC,SAAS,CAAC,KAAK,GAAG,UAAU,CAAC;IACtC,CAAC;IAGD,wEAAwE;IACxE,CAAC,QAAQ,CAAC,CAAQ;IAClB,8DAA8D;IAC9D,MAAM,CAAC,OAAO,CAAM;IACpB,IAAI,OAAO;QAGP,OAAQ,IAAI,CAAC,WAA+B,CAAC,OAAO,CAAC;IACzD,CAAC;IAID,IAAI,IAAI;QACJ,IAAI,IAAI,CAAC,SAAS,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;YACrC,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;QACnC,CAAC;aAAM,CAAC;YACJ,OAAO,SAAS,CAAC;QACrB,CAAC;IACL,CAAC;IACD,UAAU,CAER;IACF,I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AAC,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,CACvD,CAAC;QACF,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,CAAC;QAExB,OAAO,MAAM,CAAC;IAClB,CAAC;IAED,MAAM;QASF,OAAO;YACH,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,GAAG,IAAI,CAAC,SAAS,EAAE;SACtB,CAAC;IACN,CAAC;IAED,CAAC,OAAO,CAAC;QACL,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC;IACzB,CAAC;IAED,uCAAuC;IACvC,MAAM,CAAC,IAAI,CAEP,EAAS,EACT,EAAW,EACX,KAA0B;QAE1B,OAAO,WAAW,CAAC,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;IAC5C,CAAC;IAED,uCAAuC;IACvC,MAAM,CAAC,SAAS,CAEZ,EAAS,EACT,EAAW,EACX,KAA0B,EAC1B,QAAiD;QAEjD,OAAO,kBAAkB,CAAW,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;IACvE,CAAC;IAED,uCAAuC;IACvC,YAAY,CAER,KAA0B;QAE1B,OAAO,mBAAmB,CAAC,IAAI,EAAE,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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CAAC,EAAE,EAAE,CACtC,KAAgB,CAAC,KAAK,CAAC,CAAC,CAAC;gBACtB,CAAC,CAAC,IAAI,IAAI,aAAa,CAAC,SAAS,EAAE,IAAI,CAAC;gBACxC,CAAC,CACM,KAAgB,CAAC,OAAO,CACrB,QAAQ,CAEf,CAAC,QAAQ,CACnB,CAAC;QACN,CAAC;IACL,CAAC;SAAM,IAAI,KAAK,CAAC,KAAK,KAAK,UAAU,EAAE,CAAC;QACpC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACrB,OAAO,IAAI,CAAC;QAChB,CAAC;aAAM,CAAC;YACJ,MAAM,SAAS,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;YAC3B,OAAO,MAAM,CAAC,MAAM,CAAE,KAAkB,CAAC,UAAU,CAAC,CAAC,KAAK,CACtD,CAAC,KAAK,EAAE,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"}
@@ -0,0 +1,37 @@
1
+ import { BinaryCoStream, CoMap, co, subscriptionsScopes, } from "../../internal.js";
2
+ /** @category Media */
3
+ export class ImageDefinition extends CoMap {
4
+ originalSize = co.json();
5
+ placeholderDataURL = co.string;
6
+ [co.items] = co.ref(BinaryCoStream);
7
+ highestResAvailable(options) {
8
+ if (!subscriptionsScopes.get(this)) {
9
+ console.warn("highestResAvailable() only makes sense when used within a subscription.");
10
+ }
11
+ const resolutions = Object.keys(this).filter((key) => key.match(/^\d+x\d+$/) &&
12
+ (options?.maxWidth === undefined ||
13
+ Number(key.split("x")[0]) <= options.maxWidth));
14
+ resolutions.sort((a, b) => {
15
+ const aWidth = Number(a.split("x")[0]);
16
+ const bWidth = Number(b.split("x")[0]);
17
+ return aWidth - bWidth;
18
+ });
19
+ let highestAvailableResolution;
20
+ for (const resolution of resolutions) {
21
+ if (this[resolution] && this[resolution]?.getChunks()) {
22
+ highestAvailableResolution = resolution;
23
+ }
24
+ else {
25
+ return (highestAvailableResolution && {
26
+ res: highestAvailableResolution,
27
+ stream: this[highestAvailableResolution],
28
+ });
29
+ }
30
+ }
31
+ return (highestAvailableResolution && {
32
+ res: highestAvailableResolution,
33
+ stream: this[highestAvailableResolution],
34
+ });
35
+ }
36
+ }
37
+ //# sourceMappingURL=imageDef.js.map
@@ -0,0 +1 @@
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;IACtC,YAAY,GAAG,EAAE,CAAC,IAAI,EAAoB,CAAC;IAC3C,kBAAkB,GAAI,EAAE,CAAC,MAAM,CAAC;IAEhC,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAGpC,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,CA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eToExistingCoValue, } from "../internal.js";
2
+ /** @category Identity & Permissions */
3
+ export class Profile extends CoMap {
4
+ name = co.string;
5
+ }
6
+ /** @category Identity & Permissions */
7
+ export class Group extends CoValueBase {
8
+ static {
9
+ this.prototype._type = "Group";
10
+ }
11
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
12
+ static _schema;
13
+ get _schema() {
14
+ return this.constructor._schema;
15
+ }
16
+ static {
17
+ this._schema = {
18
+ profile: "json",
19
+ root: "json",
20
+ [MembersSym]: {
21
+ ref: () => Account,
22
+ optional: false,
23
+ },
24
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
25
+ };
26
+ Object.defineProperty(this.prototype, "_schema", {
27
+ get: () => this._schema,
28
+ });
29
+ }
30
+ get _refs() {
31
+ const profileID = this._raw.get("profile");
32
+ const rootID = this._raw.get("root");
33
+ return {
34
+ profile: profileID &&
35
+ new Ref(profileID, this._loadedAs, this._schema.profile),
36
+ root: rootID &&
37
+ new Ref(rootID, this._loadedAs, this._schema.root),
38
+ };
39
+ }
40
+ /** @deprecated Don't use constructor directly, use .create */
41
+ constructor(options) {
42
+ super();
43
+ let raw;
44
+ if (options && "fromRaw" in options) {
45
+ raw = options.fromRaw;
46
+ }
47
+ else {
48
+ const initOwner = options.owner;
49
+ if (!initOwner)
50
+ throw new Error("No owner provided");
51
+ if (initOwner._type === "Account" &&
52
+ isControlledAccount(initOwner)) {
53
+ const rawOwner = initOwner._raw;
54
+ raw = rawOwner.createGroup();
55
+ }
56
+ else {
57
+ throw new Error("Can only construct group as a controlled account");
58
+ }
59
+ }
60
+ Object.defineProperties(this, {
61
+ id: {
62
+ value: raw.id,
63
+ enumerable: false,
64
+ },
65
+ _raw: { value: raw, enumerable: false },
66
+ });
67
+ return new Proxy(this, AccountAndGroupProxyHandler);
68
+ }
69
+ static create(options) {
70
+ return new this(options);
71
+ }
72
+ myRole() {
73
+ return this._raw.myRole();
74
+ }
75
+ addMember(member, role) {
76
+ this._raw.addMember(member === "everyone" ? member : member._raw, role);
77
+ return this;
78
+ }
79
+ get members() {
80
+ return this._raw
81
+ .keys()
82
+ .filter((key) => {
83
+ return key === "everyone" || key.startsWith("co_");
84
+ })
85
+ .map((id) => {
86
+ const role = this._raw.get(id);
87
+ const accountID = id === "everyone"
88
+ ? undefined
89
+ : id;
90
+ const ref = accountID &&
91
+ new Ref(accountID, this._loadedAs, this._schema[MembersSym]);
92
+ const accessRef = () => ref?.accessFrom(this, "members." + id);
93
+ return {
94
+ id: id,
95
+ role,
96
+ ref,
97
+ get account() {
98
+ return accessRef();
99
+ },
100
+ };
101
+ });
102
+ }
103
+ /** @category Subscription & Loading */
104
+ static load(id, as, depth) {
105
+ return loadCoValue(this, id, as, depth);
106
+ }
107
+ /** @category Subscription & Loading */
108
+ static subscribe(id, as, depth, listener) {
109
+ return subscribeToCoValue(this, id, as, depth, listener);
110
+ }
111
+ /** @category Subscription & Loading */
112
+ ensureLoaded(depth) {
113
+ return ensureCoValueLoaded(this, depth);
114
+ }
115
+ /** @category Subscription & Loading */
116
+ subscribe(depth, listener) {
117
+ return subscribeToExistingCoValue(this, depth, listener);
118
+ }
119
+ }
120
+ //# sourceMappingURL=group.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"group.js","sourceRoot":"","sources":["../../../src/coValues/group.ts"],"names":[],"mappings":"AAUA,OAAO,EACH,OAAO,EACP,KAAK,EACL,WAAW,EACX,GAAG,EACH,EAAE,EACF,mBAAmB,EACnB,2BAA2B,EAC3B,UAAU,EACV,WAAW,EACX,kBAAkB,EAClB,mBAAmB,EACnB,0BAA0B,GAC7B,MAAM,gBAAgB,CAAC;AAExB,uCAAuC;AACvC,MAAM,OAAO,OAAQ,SAAQ,KAAK;IAC9B,IAAI,GAAG,EAAE,CAAC,MAAM,CAAC;CACpB;AAED,uCAAuC;AACvC,MAAM,OAAO,KAAM,SAAQ,WAAW;IAGlC;QACI,IAAI,CAAC,SAAS,CAAC,KAAK,GAAG,OAAO,CAAC;IACnC,CAAC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