jazz-tools 0.7.0-alpha.8 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. package/.eslintrc.cjs +3 -10
  2. package/.prettierrc.js +9 -0
  3. package/.turbo/turbo-build.log +3 -19
  4. package/.turbo/turbo-lint.log +4 -0
  5. package/.turbo/turbo-test.log +140 -0
  6. package/CHANGELOG.md +304 -0
  7. package/README.md +10 -2
  8. package/dist/coValues/account.js +59 -41
  9. package/dist/coValues/account.js.map +1 -1
  10. package/dist/coValues/coList.js +49 -46
  11. package/dist/coValues/coList.js.map +1 -1
  12. package/dist/coValues/coMap.js +143 -44
  13. package/dist/coValues/coMap.js.map +1 -1
  14. package/dist/coValues/coStream.js +144 -35
  15. package/dist/coValues/coStream.js.map +1 -1
  16. package/dist/coValues/deepLoading.js +60 -0
  17. package/dist/coValues/deepLoading.js.map +1 -0
  18. package/dist/coValues/extensions/imageDef.js +10 -7
  19. package/dist/coValues/extensions/imageDef.js.map +1 -1
  20. package/dist/coValues/group.js +49 -13
  21. package/dist/coValues/group.js.map +1 -1
  22. package/dist/coValues/interfaces.js +70 -31
  23. package/dist/coValues/interfaces.js.map +1 -1
  24. package/dist/implementation/devtoolsFormatters.js +114 -0
  25. package/dist/implementation/devtoolsFormatters.js.map +1 -0
  26. package/dist/implementation/refs.js +58 -18
  27. package/dist/implementation/refs.js.map +1 -1
  28. package/dist/implementation/schema.js +58 -0
  29. package/dist/implementation/schema.js.map +1 -0
  30. package/dist/implementation/subscriptionScope.js +19 -1
  31. package/dist/implementation/subscriptionScope.js.map +1 -1
  32. package/dist/implementation/symbols.js +5 -0
  33. package/dist/implementation/symbols.js.map +1 -0
  34. package/dist/index.js +3 -5
  35. package/dist/index.js.map +1 -1
  36. package/dist/internal.js +5 -2
  37. package/dist/internal.js.map +1 -1
  38. package/dist/tests/coList.test.js +51 -48
  39. package/dist/tests/coList.test.js.map +1 -1
  40. package/dist/tests/coMap.test.js +131 -73
  41. package/dist/tests/coMap.test.js.map +1 -1
  42. package/dist/tests/coStream.test.js +56 -41
  43. package/dist/tests/coStream.test.js.map +1 -1
  44. package/dist/tests/deepLoading.test.js +188 -0
  45. package/dist/tests/deepLoading.test.js.map +1 -0
  46. package/dist/tests/groupsAndAccounts.test.js +83 -0
  47. package/dist/tests/groupsAndAccounts.test.js.map +1 -0
  48. package/package.json +17 -9
  49. package/src/coValues/account.ts +113 -125
  50. package/src/coValues/coList.ts +87 -103
  51. package/src/coValues/coMap.ts +200 -147
  52. package/src/coValues/coStream.ts +264 -80
  53. package/src/coValues/deepLoading.ts +229 -0
  54. package/src/coValues/extensions/imageDef.ts +17 -13
  55. package/src/coValues/group.ts +92 -58
  56. package/src/coValues/interfaces.ts +215 -115
  57. package/src/implementation/devtoolsFormatters.ts +110 -0
  58. package/src/implementation/inspect.ts +1 -1
  59. package/src/implementation/refs.ts +80 -28
  60. package/src/implementation/schema.ts +138 -0
  61. package/src/implementation/subscriptionScope.ts +48 -12
  62. package/src/implementation/symbols.ts +11 -0
  63. package/src/index.ts +12 -8
  64. package/src/internal.ts +7 -3
  65. package/src/tests/coList.test.ts +77 -62
  66. package/src/tests/coMap.test.ts +201 -113
  67. package/src/tests/coStream.test.ts +113 -84
  68. package/src/tests/deepLoading.test.ts +301 -0
  69. package/src/tests/groupsAndAccounts.test.ts +91 -0
  70. package/dist/implementation/encoding.js +0 -26
  71. package/dist/implementation/encoding.js.map +0 -1
  72. 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, val, InitValues, SchemaInit, } from "../internal.js";
4
- import { Schema } from "@effect/schema";
2
+ import { MAX_RECOMMENDED_TX_SIZE, cojsonInternals } from "cojson";
3
+ import { ItemsSym, Account, CoValueBase, Ref, inspect, co, InitValues, SchemaInit, isRefEncoded, } 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 = val.items,
16
+ _b = co.items,
15
17
  _c;
16
18
  }
17
- get _encoding() {
18
- return this.constructor._encoding;
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(init, options) {
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._encoding[ItemsSym];
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(Schema.encodeSync(itemDescriptor.encoded)(item));
61
+ this._raw.push(encodeSync(itemDescriptor.encoded)(item));
57
62
  }
58
- else if ("ref" in itemDescriptor) {
63
+ else if (isRefEncoded(itemDescriptor)) {
59
64
  this._raw.push(item.id);
60
65
  }
61
66
  }
62
67
  toJSON() {
63
- const itemDescriptor = this._encoding[ItemsSym];
68
+ const itemDescriptor = this._schema[ItemsSym];
64
69
  const mapper = itemDescriptor === "json"
65
70
  ? (v) => v
66
71
  : "encoded" in itemDescriptor
67
- ? Schema.encodeSync(itemDescriptor.encoded)
72
+ ? encodeSync(itemDescriptor.encoded)
68
73
  : (v) => v && v.id;
69
74
  return {
70
75
  id: this.id,
@@ -82,9 +87,9 @@ export class CoStream extends CoValueBase {
82
87
  [inspect]() {
83
88
  return this.toJSON();
84
89
  }
85
- static encoding(def) {
86
- this._encoding || (this._encoding = {});
87
- Object.assign(this._encoding, def);
90
+ static schema(def) {
91
+ this._schema || (this._schema = {});
92
+ Object.assign(this._schema, def);
88
93
  }
89
94
  }
90
95
  _a = CoStream;
@@ -98,21 +103,33 @@ function entryFromRawEntry(accessFrom, rawEntry, loadedAs, accountID, itemField)
98
103
  return rawEntry.value;
99
104
  }
100
105
  else if ("encoded" in itemField) {
101
- return Schema.decodeSync(itemField.encoded)(rawEntry.value);
106
+ return decodeSync(itemField.encoded)(rawEntry.value);
107
+ }
108
+ else if (isRefEncoded(itemField)) {
109
+ return this.ref?.accessFrom(accessFrom, rawEntry.by +
110
+ rawEntry.tx.sessionID +
111
+ rawEntry.tx.txIndex +
112
+ ".value");
102
113
  }
103
- else if ("ref" in itemField) {
104
- return this.ref?.accessFrom(accessFrom);
114
+ else {
115
+ throw new Error("Invalid item field schema");
105
116
  }
106
117
  },
107
118
  get ref() {
108
- if (itemField !== "json" && "ref" in itemField) {
119
+ if (itemField !== "json" && isRefEncoded(itemField)) {
109
120
  const rawId = rawEntry.value;
110
121
  return new Ref(rawId, loadedAs, itemField);
111
122
  }
123
+ else {
124
+ return undefined;
125
+ }
112
126
  },
113
127
  get by() {
114
128
  return (accountID &&
115
- new Ref(accountID, loadedAs, { ref: () => Account })?.accessFrom(accessFrom));
129
+ new Ref(accountID, loadedAs, { ref: Account, optional: false })?.accessFrom(accessFrom, rawEntry.by +
130
+ rawEntry.tx.sessionID +
131
+ rawEntry.tx.txIndex +
132
+ ".by"));
116
133
  },
117
134
  madeAt: rawEntry.at,
118
135
  tx: rawEntry.tx,
@@ -141,10 +158,25 @@ export const CoStreamProxyHandler = {
141
158
  const rawEntry = target._raw.lastItemBy(key);
142
159
  if (!rawEntry)
143
160
  return;
144
- return entryFromRawEntry(receiver, rawEntry, target._loadedAs, key, target._encoding[ItemsSym]);
161
+ const entry = entryFromRawEntry(receiver, rawEntry, target._loadedAs, key, target._schema[ItemsSym]);
162
+ Object.defineProperty(entry, "all", {
163
+ get: () => {
164
+ const allRawEntries = target._raw.itemsBy(key);
165
+ return (function* () {
166
+ while (true) {
167
+ const rawEntry = allRawEntries.next();
168
+ if (rawEntry.done)
169
+ return;
170
+ yield entryFromRawEntry(receiver, rawEntry.value, target._loadedAs, key, target._schema[ItemsSym]);
171
+ }
172
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
173
+ })();
174
+ },
175
+ });
176
+ return entry;
145
177
  }
146
178
  else if (key === "perSession") {
147
- return new Proxy(receiver, CoStreamPerSessionProxyHandler);
179
+ return new Proxy({}, CoStreamPerSessionProxyHandler(target, receiver));
148
180
  }
149
181
  else {
150
182
  return Reflect.get(target, key, receiver);
@@ -155,8 +187,8 @@ export const CoStreamProxyHandler = {
155
187
  if (key === ItemsSym &&
156
188
  typeof value === "object" &&
157
189
  SchemaInit in value) {
158
- (_b = target.constructor)._encoding || (_b._encoding = {});
159
- target.constructor._encoding[ItemsSym] =
190
+ (_b = target.constructor)._schema || (_b._schema = {});
191
+ target.constructor._schema[ItemsSym] =
160
192
  value[SchemaInit];
161
193
  init(target);
162
194
  return true;
@@ -171,8 +203,8 @@ export const CoStreamProxyHandler = {
171
203
  key === ItemsSym &&
172
204
  typeof descriptor.value === "object" &&
173
205
  SchemaInit in descriptor.value) {
174
- (_b = target.constructor)._encoding || (_b._encoding = {});
175
- target.constructor._encoding[ItemsSym] =
206
+ (_b = target.constructor)._schema || (_b._schema = {});
207
+ target.constructor._schema[ItemsSym] =
176
208
  descriptor.value[SchemaInit];
177
209
  init(target);
178
210
  return true;
@@ -201,25 +233,58 @@ export const CoStreamProxyHandler = {
201
233
  }
202
234
  },
203
235
  };
204
- const CoStreamPerSessionProxyHandler = {
205
- get(target, key, receiver) {
236
+ const CoStreamPerSessionProxyHandler = (innerTarget, accessFrom) => ({
237
+ get(_target, key, receiver) {
206
238
  if (typeof key === "string" && key.includes("session")) {
207
239
  const sessionID = key;
208
- const rawEntry = target._raw.lastItemIn(sessionID);
240
+ const rawEntry = innerTarget._raw.lastItemIn(sessionID);
209
241
  if (!rawEntry)
210
242
  return;
211
243
  const by = cojsonInternals.accountOrAgentIDfromSessionID(sessionID);
212
- return entryFromRawEntry(target, rawEntry, target._loadedAs, cojsonInternals.isAccountID(by)
244
+ const entry = entryFromRawEntry(accessFrom, rawEntry, innerTarget._loadedAs, cojsonInternals.isAccountID(by)
213
245
  ? by
214
- : undefined, target._encoding[ItemsSym]);
246
+ : undefined, innerTarget._schema[ItemsSym]);
247
+ Object.defineProperty(entry, "all", {
248
+ get: () => {
249
+ const allRawEntries = innerTarget._raw.itemsIn(sessionID);
250
+ return (function* () {
251
+ while (true) {
252
+ const rawEntry = allRawEntries.next();
253
+ if (rawEntry.done)
254
+ return;
255
+ yield entryFromRawEntry(accessFrom, rawEntry.value, innerTarget._loadedAs, cojsonInternals.isAccountID(by)
256
+ ? by
257
+ : undefined, innerTarget._schema[ItemsSym]);
258
+ }
259
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
260
+ })();
261
+ },
262
+ });
263
+ return entry;
215
264
  }
216
265
  else {
217
- return Reflect.get(target, key, receiver);
266
+ return Reflect.get(innerTarget, key, receiver);
218
267
  }
219
268
  },
220
- };
269
+ ownKeys() {
270
+ return innerTarget._raw.sessions();
271
+ },
272
+ getOwnPropertyDescriptor(target, key) {
273
+ if (typeof key === "string" && key.startsWith("co_")) {
274
+ return {
275
+ configurable: true,
276
+ enumerable: true,
277
+ writable: false,
278
+ };
279
+ }
280
+ else {
281
+ return Reflect.getOwnPropertyDescriptor(target, key);
282
+ }
283
+ },
284
+ });
285
+ /** @category CoValues */
221
286
  export class BinaryCoStream extends CoValueBase {
222
- constructor(init, options) {
287
+ constructor(options) {
223
288
  super();
224
289
  let raw;
225
290
  if ("fromRaw" in options) {
@@ -234,9 +299,13 @@ export class BinaryCoStream extends CoValueBase {
234
299
  value: raw.id,
235
300
  enumerable: false,
236
301
  },
302
+ _type: { value: "BinaryCoStream", enumerable: false },
237
303
  _raw: { value: raw, enumerable: false },
238
304
  });
239
305
  }
306
+ static create(options) {
307
+ return new this(options);
308
+ }
240
309
  getChunks(options) {
241
310
  return this._raw.getBinaryChunks(options?.allowUnfinished);
242
311
  }
@@ -249,6 +318,46 @@ export class BinaryCoStream extends CoValueBase {
249
318
  end() {
250
319
  this._raw.endBinaryStream();
251
320
  }
321
+ toBlob(options) {
322
+ const chunks = this.getChunks({
323
+ allowUnfinished: options?.allowUnfinished,
324
+ });
325
+ if (!chunks) {
326
+ return undefined;
327
+ }
328
+ return new Blob(chunks.chunks, { type: chunks.mimeType });
329
+ }
330
+ static async loadAsBlob(id, as, options) {
331
+ const stream = await this.load(id, as, []);
332
+ return stream?.toBlob({
333
+ allowUnfinished: options?.allowUnfinished,
334
+ });
335
+ }
336
+ static async createFromBlob(blob, options) {
337
+ const stream = this.create({ owner: options.owner });
338
+ const start = Date.now();
339
+ const data = new Uint8Array(await blob.arrayBuffer());
340
+ stream.start({
341
+ mimeType: blob.type,
342
+ totalSizeBytes: blob.size,
343
+ fileName: blob instanceof File ? blob.name : undefined,
344
+ });
345
+ const chunkSize = MAX_RECOMMENDED_TX_SIZE;
346
+ let lastProgressUpdate = Date.now();
347
+ for (let idx = 0; idx < data.length; idx += chunkSize) {
348
+ stream.push(data.slice(idx, idx + chunkSize));
349
+ if (Date.now() - lastProgressUpdate > 100) {
350
+ options.onProgress?.(idx / data.length);
351
+ lastProgressUpdate = Date.now();
352
+ }
353
+ await new Promise((resolve) => setTimeout(resolve, 0));
354
+ }
355
+ stream.end();
356
+ const end = Date.now();
357
+ console.debug("Finished creating binary stream in", (end - start) / 1000, "s - Throughput in MB/s", (1000 * (blob.size / (end - start))) / (1024 * 1024));
358
+ options.onProgress?.(1);
359
+ return stream;
360
+ }
252
361
  toJSON() {
253
362
  return {
254
363
  id: this.id,
@@ -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,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAUxC,MAAM,OAAO,QACT,SAAQ,WAAW;IAGnB,MAAM,CAAC,EAAE,CACL,IAAuB;;QAEvB,YAAO,MAAM,UAAW,SAAQ,EAAc;gBAAvC;;oBACH,QAAW,GAAG,IAAI,CAAC;gBACvB,CAAC;aAAA;iBADI,GAAG,CAAC,KAAK;eACZ;IACN,CAAC;IAYD,IAAI,SAAS;QAGT,OAAQ,IAAI,CAAC,WAA+B,CAAC,SAAS,CAAC;IAC3D,CAAC;IAID,IAAI,IAAI;QACJ,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;IACnC,CAAC;IAID,IAAI,gBAAgB;QAChB,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;IACrD,CAAC;IASD,YACI,IAAwB,EACxB,OAA8D;QAE9D,KAAK,EAAE,CAAC;QAER,IAAI,SAAS,IAAI,OAAO,EAAE,CAAC;YACvB,MAAM,CAAC,gBAAgB,CAAC,IAAI,EAAE;gBAC1B,EAAE,EAAE;oBACA,KAAK,EAAE,OAAO,CAAC,OAAO,CAAC,EAAE;oBACzB,UAAU,EAAE,KAAK;iBACpB;gBACD,IAAI,EAAE,EAAE,KAAK,EAAE,OAAO,CAAC,OAAO,EA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escript-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,OAA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, } from "../../internal.js";
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 = val.json();
7
- this.placeholderDataURL = val.string;
8
- this[_a] = val.ref(() => BinaryCoStream);
7
+ this.originalSize = co.json();
8
+ this.placeholderDataURL = co.string;
9
+ this[_a] = co.ref(BinaryCoStream);
9
10
  }
10
- get highestResAvailable() {
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 = val.items;
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,GAAG,EACH,mBAAmB,GACtB,MAAM,mBAAmB,CAAC;AAE3B,MAAM,OAAO,eAAgB,SAAQ,KAAsB;IAA3D;;QACI,iBAAY,GAAG,GAAG,CAAC,IAAI,EAAoB,CAAC;QAC5C,uBAAkB,GAAI,GAAG,CAAC,MAAM,CAAC;QAEjC,QAAW,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,cAAc,CAAC,CAAC;IA2ChD,CAAC;IAxCG,IAAI,mBAAmB;QAGnB,IAAI,CAAC,mBAAm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,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"}
@@ -1,33 +1,36 @@
1
1
  var _a;
2
- import { Account, CoMap, CoValueBase, Ref, val, isControlledAccount, AccountAndGroupProxyHandler, } from "../internal.js";
2
+ import { Account, CoMap, CoValueBase, Ref, co, isControlledAccount, AccountAndGroupProxyHandler, MembersSym, } from "../internal.js";
3
+ /** @category Identity & Permissions */
3
4
  export class Profile extends CoMap {
4
5
  constructor() {
5
6
  super(...arguments);
6
- this.name = val.string;
7
+ this.name = co.string;
7
8
  }
8
9
  }
10
+ /** @category Identity & Permissions */
9
11
  export class Group extends CoValueBase {
10
- get _encoding() {
11
- return this.constructor._encoding;
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._encoding.profile),
20
+ new Ref(profileID, this._loadedAs, this._schema.profile),
19
21
  root: rootID &&
20
- new Ref(rootID, this._loadedAs, this._encoding.root),
22
+ new Ref(rootID, this._loadedAs, this._schema.root),
21
23
  };
22
24
  }
23
- constructor(init, options) {
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?.owner || init?.owner;
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,39 @@ 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
+ });
56
87
  }
57
88
  }
58
89
  _a = Group;
@@ -60,12 +91,17 @@ _a = Group;
60
91
  _a.prototype._type = "Group";
61
92
  })();
62
93
  (() => {
63
- _a._encoding = {
64
- profile: { json: true },
65
- root: { json: true },
94
+ _a._schema = {
95
+ profile: "json",
96
+ root: "json",
97
+ [MembersSym]: {
98
+ ref: () => Account,
99
+ optional: false,
100
+ },
101
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
66
102
  };
67
- Object.defineProperty(_a.prototype, "_encoding", {
68
- get: () => _a._encoding,
103
+ Object.defineProperty(_a.prototype, "_schema", {
104
+ get: () => _a._schema,
69
105
  });
70
106
  })();
71
107
  //# sourceMappingURL=group.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"group.js","sourceRoot":"","sources":["../../src/coValues/group.ts"],"names":[],"mappings":";AAEA,OAAO,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