jazz-tools 0.7.0-alpha.31 → 0.7.0-alpha.32

Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
1
- {"version":3,"file":"group.js","sourceRoot":"","sources":["../../src/coValues/group.ts"],"names":[],"mappings":";AAQA,OAAO,EACH,OAAO,EACP,KAAK,EACL,WAAW,EACX,GAAG,EACH,EAAE,EACF,mBAAmB,EACnB,2BAA2B,EAC3B,UAAU,GACb,MAAM,gBAAgB,CAAC;AAExB,MAAM,OAAO,OAAQ,SAAQ,KAAK;IAAlC;;QACI,SAAI,GAAG,EAAE,CAAC,MAAM,CAAC;IACrB,CAAC;CAAA;AAED,MAAM,OAAO,KAAM,SAAQ,WAAW;IASlC,IAAI,OAAO;QAKP,OAAQ,IAAI,CAAC,WAA4B,CAAC,OAAO,CAAC;IACtD,CAAC;IAgBD,IAAI,KAAK;QACL,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,CAE1B,CAAC;QAChB,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAEpB,CAAC;QAChB,OAAO;YACH,OAAO,EACH,SAAS;gBACR,IAAI,GAAG,CACJ,SAAS,EACT,IAAI,CAAC,SAAS,EACd,IAAI,CAAC,OAAO,CAAC,OAEZ,CAGO;YAChB,IAAI,EACA,MAAM;gBACL,IAAI,GAAG,CACJ,MAAM,EACN,IAAI,CAAC,SAAS,EACd,IAAI,CAAC,OAAO,CAAC,IAA6C,CAGlD;SACnB,CAAC;IACN,CAAC;IAED,8DAA8D;IAC9D,YAAY,OAA2D;QACnE,KAAK,EAAE,CAAC;QACR,IAAI,GAAa,CAAC;QAElB,IAAI,OAAO,IAAI,SAAS,IAAI,OAAO,EAAE,CAAC;YAClC,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC;QAC1B,CAAC;aAAM,CAAC;YACJ,MAAM,SAAS,GAAG,OAAO,CAAC,KAAK,CAAC;YAChC,IAAI,CAAC,SAAS;gBAAE,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,MAAM,SAAS,GAAG,GAAG,EAAE,CAAC,GAAG,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC;YAE9C,OAAO;gBACH,EAAE,EAAE,EAAgD;gBACpD,IAAI;gBACJ,GAAG;gBACH,IAAI,OAAO;oBACP,OAAO,SAAS,EAAE,CAAC;gBACvB,CAAC;aACJ,CAAC;QACN,CAAC,CAAC,CAAC;IACX,CAAC;CACJ;;AA/IG;IACI,GAAK,SAAS,CAAC,KAAK,GAAG,OAAO,CAAC;AACnC,CAAC,GAAA,CAAA;AAWD;IACI,GAAK,OAAO,GAAG;QACX,OAAO,EAAE,MAAuB;QAChC,IAAI,EAAE,MAAuB;QAC7B,CAAC,UAAU,CAAC,EAAE,GAAG,EAAE,CAAC,OAAwB;KACxC,CAAC;IACT,MAAM,CAAC,cAAc,CAAC,GAAK,SAAS,EAAE,SAAS,EAAE;QAC7C,GAAG,EAAE,GAAG,EAAE,CAAC,GAAK,OAAO;KAC1B,CAAC,CAAC;AACP,CAAC,GAAA,CAAA"}
@@ -7,6 +7,7 @@ export function isCoValue(value) {
7
7
  export function isCoValueClass(value) {
8
8
  return typeof value === "function" && value.fromRaw !== undefined;
9
9
  }
10
+ /** @internal */
10
11
  export class CoValueBase {
11
12
  get _owner() {
12
13
  const owner = this._raw.group instanceof RawAccount
@@ -24,22 +25,27 @@ export class CoValueBase {
24
25
  return Account.fromNode(this._raw.core.node);
25
26
  }
26
27
  constructor(..._args) { }
28
+ /** @category Internals */
27
29
  static fromRaw(raw) {
28
30
  return new this({ fromRaw: raw });
29
31
  }
32
+ /** @category Subscription & Loading */
30
33
  static loadEf(id) {
31
34
  return Effect.gen(this, function* (_) {
32
35
  const account = yield* _(AccountCtx);
33
36
  return yield* _(new Ref(id, account, this).loadEf());
34
37
  });
35
38
  }
39
+ /** @category Subscription & Loading */
36
40
  static load(id, options) {
37
41
  return new Ref(id, options.as, this).load(options?.onProgress && { onProgress: options.onProgress });
38
42
  }
43
+ /** @category Subscription & Loading */
39
44
  static subscribe(id, options, onUpdate) {
40
45
  void Effect.runPromise(Effect.provideService(this.subscribeEf(id).pipe(Stream.run(Sink.forEach((update) => Effect.sync(() => onUpdate(update))))), AccountCtx, options.as));
41
46
  return function unsubscribe() { };
42
47
  }
48
+ /** @category Subscription & Loading */
43
49
  static subscribeEf(id) {
44
50
  return Stream.fromEffect(this.loadEf(id)).pipe(Stream.flatMap((value) => Stream.asyncScoped((emit) => Effect.gen(this, function* (_) {
45
51
  const subscription = new SubscriptionScope(value, this, (update) => {
@@ -48,9 +54,11 @@ export class CoValueBase {
48
54
  yield* _(Effect.addFinalizer(() => Effect.sync(() => subscription.unsubscribeAll())));
49
55
  }))));
50
56
  }
57
+ /** @category Subscription & Loading */
51
58
  subscribe(listener) {
52
59
  return this.constructor.subscribe(this.id, { as: this._loadedAs }, listener);
53
60
  }
61
+ /** @category Subscription & Loading */
54
62
  subscribeEf() {
55
63
  return Stream.provideService(this.constructor.subscribeEf(this.id), AccountCtx, this._loadedAs);
56
64
  }
@@ -64,6 +72,7 @@ export class CoValueBase {
64
72
  [inspect]() {
65
73
  return this.toJSON();
66
74
  }
75
+ /** @category Type Helpers*/
67
76
  as(otherSchema) {
68
77
  const cast = otherSchema.fromRaw(this._raw);
69
78
  const subScope = subscriptionsScopes.get(this);
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../src/coValues/interfaces.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAE9C,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEpC,OAAO,EACH,OAAO,EACP,UAAU,EACV,KAAK,EACL,iBAAiB,EACjB,GAAG,EACH,OAAO,EACP,mBAAmB,GACtB,MAAM,gBAAgB,CAAC;AAkExB,MAAM,UAAU,SAAS,CAAC,KAAU;IAChC,OAAO,KAAK,IAAI,KAAK,CAAC,KAAK,KAAK,SAAS,CAAC;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AAyB,WAAc;QACrC,MAAM,IAAI,GAAG,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAoB,CAAC;QAC/D,MAAM,QAAQ,GAAG,mBAAmB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAC/C,IAAI,QAAQ,EAAE,CAAC;YACX,mBAAmB,CAAC,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QAC5C,CAAC;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ"}
@@ -1,4 +1,5 @@
1
1
  import { isCoValueClass } from "../internal.js";
2
+ /** @category Schema definition */
2
3
  export const co = {
3
4
  string: {
4
5
  [SchemaInit]: "json",
@@ -12,7 +13,7 @@ export const co = {
12
13
  null: {
13
14
  [SchemaInit]: "json",
14
15
  },
15
- literal: (_lit) => {
16
+ literal: (..._lit) => {
16
17
  return { [SchemaInit]: "json" };
17
18
  },
18
19
  json: () => {
@@ -37,6 +38,7 @@ export function instantiateRefEncoded(schema, raw) {
37
38
  }
38
39
  import { Date } from "@effect/schema/Schema";
39
40
  import { SchemaInit, ItemsSym, MembersSym } from "./symbols.js";
41
+ /** @category Schema definition */
40
42
  export const Encoders = {
41
43
  Date,
42
44
  };
@@ -1 +1 @@
1
- {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/implementation/schema.ts"],"names":[],"mappings":"AACA,OAAO,EAAmC,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAYjF,MAAM,CAAC,MAAM,EAAE,GAAG;IACd,MAAM,EAAE;QACJ,CAAC,UAAU,CAAC,EAAE,MAAuB;KACf;IAC1B,MAAM,EAAE;QACJ,CAAC,UAAU,CAAC,EAAE,MAAuB;KACf;IAC1B,OAAO,EAAE;QACL,CAAC,UAAU,CAAC,EAAE,MAAuB;KACd;IAC3B,IAAI,EAAE;QACF,CAAC,UAAU,CAAC,EAAE,MAAuB;KACjB;IACxB,OAAO,EAAE,CAAsC,IAAO,EAAS,EAAE;QAC7D,OAAO,EAAE,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AI,CAAC,IAAI,CAAC,IAAI;iBAC9B,eAAe,CAAC,eAAe,CAAC;iBAChC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE;gBACX,IACI,YAAY,CAAC,KAAK,KAAK,SAAS;oBAChC,YAAY,CAAC,gBAAgB,EAC/B,CAAC;oBACC,OAAO;gBACX,CAAC;gBACD,IAAI,IAAI,KAAK,aAAa,EAAE,CAAC;oBACzB,MAAM,KAAK,GAAG;wBACV,KAAK,EAAE,QAAiB;wBACxB,QAAQ,EAAE,GAAG,EAAE,GAAE,CAAC,EAAE,cAAc;qBACrC,CAAC;oBACF,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC;oBAEzC,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,SAAS,EAAE,EAAE;wBAC1C,sFAAsF;wBACtF,IAAI,CAAC,SAAS;4BAAE,OAAO;wBACvB,IAAI,CAAC,cAAc,EAAE,CAAC;oBAC1B,CAAC,CAAC,CAAC;oBAEH,KAAK,CAAC,QAAQ,GAAG,QAAQ,CAAC;gBAC9B,CAAC;YACL,CAAC,CAAC,CAAC;QACX,CAAC;IACL,CAAC;IAED,cAAc;QACV,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;YACxC,IAAI,KAAK,CAAC,KAAK,KAAK,QAAQ,EAAE,CAAC;gBAC3B,KAAK,CAAC,QAAQ,EAAE,CAAC;YACrB,CAAC;iBAAM,CAAC;gBACJ,KAAK,CAAC,gBAAgB,GAAG,IAAI,CAAC;YAClC,CAAC;QACL,CAAC;QACD,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;IACzB,CAAC;CACJ"}
package/package.json CHANGED
@@ -1,20 +1,26 @@
1
1
  {
2
2
  "name": "jazz-tools",
3
- "module": "dist/index.js",
4
- "main": "dist/index.js",
5
- "types": "src/index.ts",
3
+ "module": "./dist/index.js",
4
+ "main": "./dist/index.js",
5
+ "types": "./src/index.ts",
6
+ "bin": "./dist/cli/index.js",
6
7
  "type": "module",
7
8
  "license": "MIT",
8
- "version": "0.7.0-alpha.31",
9
+ "version": "0.7.0-alpha.32",
9
10
  "dependencies": {
10
- "@effect/schema": "^0.66.6",
11
+ "@effect/cli": "^0.36.21",
12
+ "@effect/platform-node": "^0.49.2",
13
+ "@effect/schema": "^0.66.16",
14
+ "effect": "^3.1.3",
11
15
  "fast-check": "^3.17.2",
12
- "effect": "^3.0",
13
- "cojson": "0.7.0-alpha.29"
16
+ "ws": "^8.14.2",
17
+ "cojson": "0.7.0-alpha.29",
18
+ "cojson-transport-nodejs-ws": "0.7.0-alpha.29"
14
19
  },
15
20
  "devDependencies": {
16
21
  "typescript": "^5.3.3",
17
- "vitest": "^0.34.6"
22
+ "vitest": "^0.34.6",
23
+ "@types/ws": "^8.5.5"
18
24
  },
19
25
  "madge": {
20
26
  "detectiveOptions": {
@@ -0,0 +1,69 @@
1
+ #!/usr/bin/env node
2
+ import { Command, Options } from "@effect/cli";
3
+ import { NodeContext, NodeRuntime } from "@effect/platform-node";
4
+ import { Console, Effect } from "effect";
5
+ import {
6
+ websocketReadableStream,
7
+ websocketWritableStream,
8
+ } from "cojson-transport-nodejs-ws";
9
+ import { WebSocket } from "ws";
10
+ import { Account, jazzReady } from "../index.js";
11
+ import { webcrypto } from "node:crypto";
12
+
13
+ const jazzTools = Command.make("jazz-tools");
14
+
15
+ if (!("crypto" in globalThis)) {
16
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
17
+ (globalThis as any).crypto = webcrypto;
18
+ }
19
+
20
+ const name = Options.text("name").pipe(Options.withAlias("n"));
21
+ const peer = Options.text("peer")
22
+ .pipe(Options.withAlias("p"))
23
+ .pipe(Options.withDefault("wss://mesh.jazz.tools"));
24
+ const accountCreate = Command.make(
25
+ "create",
26
+ { name, peer },
27
+ ({ name, peer }) => {
28
+ return Effect.gen(function* () {
29
+ const ws = new WebSocket(peer);
30
+
31
+ const account = yield* Effect.promise(() =>
32
+ jazzReady.then(() =>
33
+ Account.create({
34
+ creationProps: { name },
35
+ peersToLoadFrom: [
36
+ {
37
+ id: "upstream",
38
+ role: "server",
39
+ incoming: websocketReadableStream(ws),
40
+ outgoing: websocketWritableStream(ws),
41
+ },
42
+ ],
43
+ })
44
+ )
45
+ );
46
+
47
+ yield* Console.log(`# Credentials for Jazz account "${name}":
48
+ JAZZ_WORKER_ACCOUNT=${account.id}
49
+ JAZZ_WORKER_SECRET=${account._raw.agentSecret}
50
+ `);
51
+ });
52
+ }
53
+ );
54
+
55
+ const accountBase = Command.make("account");
56
+
57
+ const account = accountBase.pipe(Command.withSubcommands([accountCreate]));
58
+
59
+ const command = jazzTools.pipe(Command.withSubcommands([account]));
60
+
61
+ const cli = Command.run(command, {
62
+ name: "Jazz CLI Tools",
63
+ version: "v0.7.0",
64
+ });
65
+
66
+ Effect.suspend(() => cli(process.argv)).pipe(
67
+ Effect.provide(NodeContext.layer),
68
+ NodeRuntime.runMain
69
+ );
@@ -18,7 +18,7 @@ import type {
18
18
  Schema,
19
19
  ID,
20
20
  RefEncoded,
21
- SubclassedConstructor,
21
+ ClassOf,
22
22
  UnavailableError,
23
23
  } from "../internal.js";
24
24
  import {
@@ -33,6 +33,7 @@ import {
33
33
  } from "../internal.js";
34
34
  import type { Stream } from "effect/Stream";
35
35
 
36
+ /** @category Identity & Permissions */
36
37
  export class Account
37
38
  extends CoValueBase
38
39
  implements CoValue<"Account", RawAccount | RawControlledAccount>
@@ -164,7 +165,7 @@ export class Account
164
165
  }) as any;
165
166
 
166
167
  static async create<A extends Account>(
167
- this: SubclassedConstructor<A> & typeof Account,
168
+ this: ClassOf<A> & typeof Account,
168
169
  options: {
169
170
  creationProps: { name: string };
170
171
  initialAgentSecret?: AgentSecret;
@@ -186,7 +187,7 @@ export class Account
186
187
  }
187
188
 
188
189
  static async become<A extends Account>(
189
- this: SubclassedConstructor<A> & typeof Account,
190
+ this: ClassOf<A> & typeof Account,
190
191
  options: {
191
192
  accountID: ID<Account>;
192
193
  accountSecret: AgentSecret;
@@ -212,7 +213,7 @@ export class Account
212
213
  }
213
214
 
214
215
  static fromNode<A extends Account>(
215
- this: SubclassedConstructor<A>,
216
+ this: ClassOf<A>,
216
217
  node: LocalNode
217
218
  ): A & Me {
218
219
  return new this({
@@ -301,6 +302,7 @@ export const AccountAndGroupProxyHandler: ProxyHandler<Account | Group> = {
301
302
  },
302
303
  };
303
304
 
305
+ /** @category Identity & Permissions */
304
306
  export interface Me {
305
307
  id: ID<any>;
306
308
  isMe: true;
@@ -311,11 +313,13 @@ export interface Me {
311
313
  acceptInvite: (...args: any[]) => any;
312
314
  }
313
315
 
316
+ /** @category Identity & Permissions */
314
317
  export class AccountCtx extends Context.Tag("Account")<
315
318
  AccountCtx,
316
319
  Account & Me
317
320
  >() {}
318
321
 
322
+ /** @category Identity & Permissions */
319
323
  export function isControlledAccount(account: Account): account is Account & Me {
320
324
  return account.isMe;
321
325
  }
@@ -8,7 +8,7 @@ import type {
8
8
  SchemaFor,
9
9
  ID,
10
10
  RefEncoded,
11
- SubclassedConstructor,
11
+ ClassOf,
12
12
  UnavailableError,
13
13
  IfCo,
14
14
  UnCo,
@@ -28,6 +28,7 @@ import {
28
28
  } from "../internal.js";
29
29
  import { encodeSync, decodeSync } from "@effect/schema/Schema";
30
30
 
31
+ /** @category CoValues */
31
32
  export class CoList<Item = any>
32
33
  extends Array<Item>
33
34
  implements CoValue<"CoList", RawCoList>
@@ -66,6 +67,7 @@ export class CoList<Item = any>
66
67
  : Group.fromRaw(this._raw.group);
67
68
  }
68
69
 
70
+ /** @category Content */
69
71
  get _refs(): {
70
72
  [idx: number]: NonNullable<Item> extends CoValue
71
73
  ? Ref<NonNullable<Item>>
@@ -135,7 +137,7 @@ export class CoList<Item = any>
135
137
  }
136
138
 
137
139
  static create<L extends CoList>(
138
- this: SubclassedConstructor<L>,
140
+ this: ClassOf<L>,
139
141
  items: UnCo<L[number]>[],
140
142
  options: {owner: Account | Group}
141
143
  ) {
@@ -240,29 +242,29 @@ export class CoList<Item = any>
240
242
  }
241
243
 
242
244
  static fromRaw<V extends CoList>(
243
- this: SubclassedConstructor<V> & typeof CoList,
245
+ this: ClassOf<V> & typeof CoList,
244
246
  raw: RawCoList
245
247
  ) {
246
248
  return new this({ fromRaw: raw });
247
249
  }
248
250
 
249
251
  static loadEf = CoValueBase.loadEf as unknown as <V extends CoValue>(
250
- this: SubclassedConstructor<V>,
252
+ this: ClassOf<V>,
251
253
  id: ID<V>
252
254
  ) => Effect.Effect<V, UnavailableError, AccountCtx>;
253
255
  static load = CoValueBase.load as unknown as <V extends CoValue>(
254
- this: SubclassedConstructor<V>,
256
+ this: ClassOf<V>,
255
257
  id: ID<V>,
256
258
  options: { as: Account | Group }
257
259
  ) => Promise<V | undefined>;
258
260
  static subscribeEf = CoValueBase.subscribeEf as unknown as <
259
261
  V extends CoValue,
260
262
  >(
261
- this: SubclassedConstructor<V>,
263
+ this: ClassOf<V>,
262
264
  id: ID<V>
263
265
  ) => Stream.Stream<V, UnavailableError, AccountCtx>;
264
266
  static subscribe = CoValueBase.subscribe as unknown as <V extends CoValue>(
265
- this: SubclassedConstructor<V>,
267
+ this: ClassOf<V>,
266
268
  id: ID<V>,
267
269
  options: { as: Account | Group },
268
270
  onUpdate: (value: V) => void
@@ -9,7 +9,7 @@ import type {
9
9
  RefEncoded,
10
10
  IfCo,
11
11
  RefIfCoValue,
12
- SubclassedConstructor,
12
+ ClassOf,
13
13
  } from "../internal.js";
14
14
  import {
15
15
  Account,
@@ -36,21 +36,72 @@ type InitValuesFor<C extends CoMap> = {
36
36
  owner: Account | Group;
37
37
  };
38
38
 
39
+ /**
40
+ * CoMaps are collaborative versions of plain objects, mapping string-like keys to values.
41
+ *
42
+ * @categoryDescription Declaration
43
+ * Declare your own CoMap schemas by subclassing `CoMap` and assigning field schemas with `co`.
44
+ *
45
+ * ```ts
46
+ * import { co, CoMap } from "jazz-tools";
47
+ *
48
+ * class Person extends CoMap {
49
+ * name = co.string;
50
+ * age = co.number;
51
+ * pet = co.ref(Animal);
52
+ * }
53
+ * ```
54
+ *
55
+ * @categoryDescription Content
56
+ * You can access properties you declare on a `CoMap` (using `co`) as if they were normal properties on a plain object, using dot notation, `Object.keys()`, etc.
57
+ *
58
+ * ```ts
59
+ * person.name;
60
+ * person["age"];
61
+ * person.age = 42;
62
+ * person.pet?.name;
63
+ * Object.keys(person);
64
+ * // => ["name", "age", "pet"]
65
+ * ```
66
+ *
67
+ * @category CoValues
68
+ * */
39
69
  export class CoMap extends CoValueBase implements CoValue<"CoMap", RawCoMap> {
70
+ /**
71
+ * The ID of this `CoMap`
72
+ * @category Content */
40
73
  declare id: ID<this>;
74
+ /** @category Type Helpers */
41
75
  declare _type: "CoMap";
42
76
  static {
43
77
  this.prototype._type = "CoMap";
44
78
  }
79
+ /** @category Internals */
45
80
  declare _raw: RawCoMap;
46
81
 
82
+ /** @internal */
47
83
  static _schema: any;
84
+ /** @internal */
48
85
  get _schema() {
49
86
  return (this.constructor as typeof CoMap)._schema as {
50
87
  [key: string]: Schema;
51
88
  } & { [ItemsSym]?: Schema };
52
89
  }
53
90
 
91
+ /**
92
+ * If property `prop` is a `co.ref(...)`, you can use `coMaps._refs.prop` to access
93
+ * the `Ref` instead of the potentially loaded/null value.
94
+ * This allows you to always get the ID or load the value manually.
95
+ *
96
+ * @example
97
+ * ```ts
98
+ * person._refs.pet.id; // => ID<Animal>
99
+ * person._refs.pet.value;
100
+ * // => Animal | undefined
101
+ * const pet = await person._refs.pet.load();
102
+ * ```
103
+ *
104
+ * @category Content */
54
105
  get _refs(): {
55
106
  [Key in CoKeys<this>]: IfCo<this[Key], RefIfCoValue<this[Key]>>;
56
107
  } {
@@ -73,6 +124,7 @@ export class CoMap extends CoValueBase implements CoValue<"CoMap", RawCoMap> {
73
124
  ) as any;
74
125
  }
75
126
 
127
+ /** @category Collaboration */
76
128
  get _edits() {
77
129
  return new Proxy(this, {
78
130
  get(target, key) {
@@ -117,12 +169,15 @@ export class CoMap extends CoValueBase implements CoValue<"CoMap", RawCoMap> {
117
169
  };
118
170
  }
119
171
 
172
+ /** @internal */
120
173
  get _loadedAs() {
121
174
  return Account.fromNode(this._raw.core.node);
122
175
  }
123
176
 
177
+ /** @internal */
124
178
  [InitValues]?: any;
125
179
 
180
+ /** @internal */
126
181
  constructor(
127
182
  options: { fromRaw: RawCoMap } | { init: any; owner: Account | Group }
128
183
  ) {
@@ -148,8 +203,9 @@ export class CoMap extends CoValueBase implements CoValue<"CoMap", RawCoMap> {
148
203
  return new Proxy(this, CoMapProxyHandler as ProxyHandler<this>);
149
204
  }
150
205
 
206
+ /** @category Creation */
151
207
  static create<M extends CoMap>(
152
- this: SubclassedConstructor<M>,
208
+ this: ClassOf<M>,
153
209
  init: Simplify<CoMapInit<M>>,
154
210
  options: { owner: Account | Group }
155
211
  ) {
@@ -183,6 +239,7 @@ export class CoMap extends CoValueBase implements CoValue<"CoMap", RawCoMap> {
183
239
  return this.toJSON();
184
240
  }
185
241
 
242
+ /** @internal */
186
243
  rawFromInit<Fields extends object = Record<string, any>>(
187
244
  init: Simplify<CoMapInit<Fields>> | undefined,
188
245
  owner: Account | Group
@@ -217,6 +274,7 @@ export class CoMap extends CoValueBase implements CoValue<"CoMap", RawCoMap> {
217
274
  return rawOwner.createMap(rawInit);
218
275
  }
219
276
 
277
+ /** @category Declaration */
220
278
  static Record<Value>(value: IfCo<Value, Value>) {
221
279
  // eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging
222
280
  class RecordLikeCoMap extends CoMap {
@@ -8,7 +8,7 @@ import type {
8
8
  RawCoStream,
9
9
  SessionID,
10
10
  } from "cojson";
11
- import { cojsonInternals } from "cojson";
11
+ import { MAX_RECOMMENDED_TX_SIZE, cojsonInternals } from "cojson";
12
12
  import type {
13
13
  CoValue,
14
14
  Schema,
@@ -17,7 +17,7 @@ import type {
17
17
  ID,
18
18
  Me,
19
19
  IfCo,
20
- SubclassedConstructor,
20
+ ClassOf,
21
21
  UnCo,
22
22
  } from "../internal.js";
23
23
  import {
@@ -45,6 +45,7 @@ export type SingleCoStreamEntry<Item> = {
45
45
  tx: CojsonInternalTypes.TransactionID;
46
46
  };
47
47
 
48
+ /** @category CoValues */
48
49
  export class CoStream<Item = any>
49
50
  extends CoValueBase
50
51
  implements CoValue<"CoStream", RawCoStream>
@@ -111,7 +112,7 @@ export class CoStream<Item = any>
111
112
  }
112
113
 
113
114
  static create<S extends CoStream>(
114
- this: SubclassedConstructor<S>,
115
+ this: ClassOf<S>,
115
116
  init: S extends CoStream<infer Item> ? UnCo<Item>[] : never,
116
117
  options: { owner: Account | Group }
117
118
  ) {
@@ -420,6 +421,7 @@ const CoStreamPerSessionProxyHandler = (
420
421
  },
421
422
  });
422
423
 
424
+ /** @category CoValues */
423
425
  export class BinaryCoStream
424
426
  extends CoValueBase
425
427
  implements CoValue<"BinaryCoStream", RawBinaryCoStream>
@@ -458,7 +460,7 @@ export class BinaryCoStream
458
460
  }
459
461
 
460
462
  static create<S extends BinaryCoStream>(
461
- this: SubclassedConstructor<S>,
463
+ this: ClassOf<S>,
462
464
  options: { owner: Account | Group }
463
465
  ) {
464
466
  return new this(options);
@@ -484,6 +486,81 @@ export class BinaryCoStream
484
486
  this._raw.endBinaryStream();
485
487
  }
486
488
 
489
+ toBlob(options?: { allowUnfinished?: boolean }): Blob | undefined {
490
+ const chunks = this.getChunks({
491
+ allowUnfinished: options?.allowUnfinished,
492
+ });
493
+
494
+ if (!chunks) {
495
+ return undefined;
496
+ }
497
+
498
+ return new Blob(chunks.chunks, { type: chunks.mimeType });
499
+ }
500
+
501
+ static async loadAsBlob(
502
+ id: ID<BinaryCoStream>,
503
+ options: {
504
+ as: Account & Me;
505
+ allowUnfinished?: boolean;
506
+ onProgress?: (progress: number) => void;
507
+ }
508
+ ): Promise<Blob | undefined> {
509
+ const stream = await this.load(id, {
510
+ as: options.as,
511
+ onProgress: options.onProgress,
512
+ });
513
+
514
+ return stream?.toBlob({
515
+ allowUnfinished: options.allowUnfinished,
516
+ });
517
+ }
518
+
519
+ static async createFromBlob(
520
+ blob: Blob | File,
521
+ options: {
522
+ owner: Group | Account;
523
+ onProgress?: (progress: number) => void;
524
+ }
525
+ ): Promise<BinaryCoStream> {
526
+ const stream = this.create({ owner: options.owner });
527
+
528
+ const start = Date.now();
529
+
530
+ const data = new Uint8Array(await blob.arrayBuffer());
531
+ stream.start({
532
+ mimeType: blob.type,
533
+ totalSizeBytes: blob.size,
534
+ fileName: blob instanceof File ? blob.name : undefined,
535
+ });
536
+ const chunkSize = MAX_RECOMMENDED_TX_SIZE;
537
+
538
+ let lastProgressUpdate = Date.now();
539
+
540
+ for (let idx = 0; idx < data.length; idx += chunkSize) {
541
+ stream.push(data.slice(idx, idx + chunkSize));
542
+
543
+ if (Date.now() - lastProgressUpdate > 100) {
544
+ options.onProgress?.(idx / data.length);
545
+ lastProgressUpdate = Date.now();
546
+ }
547
+
548
+ await new Promise((resolve) => setTimeout(resolve, 0));
549
+ }
550
+ stream.end();
551
+ const end = Date.now();
552
+
553
+ console.debug(
554
+ "Finished creating binary stream in",
555
+ (end - start) / 1000,
556
+ "s - Throughput in MB/s",
557
+ (1000 * (blob.size / (end - start))) / (1024 * 1024)
558
+ );
559
+ options.onProgress?.(1);
560
+
561
+ return stream;
562
+ }
563
+
487
564
  toJSON() {
488
565
  return {
489
566
  id: this.id,
@@ -5,6 +5,7 @@ import {
5
5
  subscriptionsScopes,
6
6
  } from "../../internal.js";
7
7
 
8
+ /** @category Media */
8
9
  export class ImageDefinition extends CoMap {
9
10
  originalSize = co.json<[number, number]>();
10
11
  placeholderDataURL? = co.string;