jazz-tools 0.15.16 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.svelte-kit/__package__/jazz.class.svelte.d.ts +2 -2
- package/.svelte-kit/__package__/jazz.class.svelte.d.ts.map +1 -1
- package/.svelte-kit/__package__/jazz.class.svelte.js +5 -5
- package/.svelte-kit/__package__/jazz.svelte.d.ts +2 -2
- package/.svelte-kit/__package__/jazz.svelte.d.ts.map +1 -1
- package/.turbo/turbo-build.log +46 -46
- package/CHANGELOG.md +25 -0
- package/dist/browser/index.d.ts +2 -2
- package/dist/browser/index.d.ts.map +1 -1
- package/dist/browser/index.js.map +1 -1
- package/dist/browser-media-images/index.d.ts +3 -1
- package/dist/browser-media-images/index.d.ts.map +1 -1
- package/dist/browser-media-images/index.js.map +1 -1
- package/dist/{chunk-OSVAAVWQ.js → chunk-MLCNE3TL.js} +594 -598
- package/dist/chunk-MLCNE3TL.js.map +1 -0
- package/dist/index.js +8 -10
- package/dist/index.js.map +1 -1
- package/dist/react/hooks.d.ts +2 -2
- package/dist/react/hooks.d.ts.map +1 -1
- package/dist/react/index.js.map +1 -1
- package/dist/react-core/hooks.d.ts +2 -2
- package/dist/react-core/hooks.d.ts.map +1 -1
- package/dist/react-core/index.js +3 -3
- package/dist/react-core/index.js.map +1 -1
- package/dist/react-native-core/hooks.d.ts +2 -2
- package/dist/react-native-core/hooks.d.ts.map +1 -1
- package/dist/react-native-core/index.js.map +1 -1
- package/dist/svelte/jazz.class.svelte.d.ts +2 -2
- package/dist/svelte/jazz.class.svelte.d.ts.map +1 -1
- package/dist/svelte/jazz.class.svelte.js +5 -5
- package/dist/svelte/jazz.svelte.d.ts +2 -2
- package/dist/svelte/jazz.svelte.d.ts.map +1 -1
- package/dist/testing.js +3 -3
- package/dist/testing.js.map +1 -1
- package/dist/tools/coValues/CoValueBase.d.ts +3 -13
- package/dist/tools/coValues/CoValueBase.d.ts.map +1 -1
- package/dist/tools/coValues/account.d.ts +2 -2
- package/dist/tools/coValues/account.d.ts.map +1 -1
- package/dist/tools/coValues/coFeed.d.ts.map +1 -1
- package/dist/tools/coValues/coList.d.ts.map +1 -1
- package/dist/tools/coValues/coMap.d.ts +5 -18
- package/dist/tools/coValues/coMap.d.ts.map +1 -1
- package/dist/tools/coValues/deepLoading.d.ts +4 -1
- package/dist/tools/coValues/deepLoading.d.ts.map +1 -1
- package/dist/tools/coValues/extensions/imageDef.d.ts +4 -7
- package/dist/tools/coValues/extensions/imageDef.d.ts.map +1 -1
- package/dist/tools/coValues/inbox.d.ts +2 -2
- package/dist/tools/coValues/inbox.d.ts.map +1 -1
- package/dist/tools/coValues/interfaces.d.ts +2 -17
- package/dist/tools/coValues/interfaces.d.ts.map +1 -1
- package/dist/tools/coValues/request.d.ts +2 -2
- package/dist/tools/coValues/request.d.ts.map +1 -1
- package/dist/tools/coValues/schemaUnion.d.ts +5 -1
- package/dist/tools/coValues/schemaUnion.d.ts.map +1 -1
- package/dist/tools/exports.d.ts +3 -3
- package/dist/tools/exports.d.ts.map +1 -1
- package/dist/tools/implementation/createContext.d.ts +4 -4
- package/dist/tools/implementation/createContext.d.ts.map +1 -1
- package/dist/tools/implementation/invites.d.ts +2 -2
- package/dist/tools/implementation/invites.d.ts.map +1 -1
- package/dist/tools/implementation/schemaUtils.d.ts +8 -0
- package/dist/tools/implementation/schemaUtils.d.ts.map +1 -0
- package/dist/tools/implementation/zodSchema/coExport.d.ts +11 -1
- package/dist/tools/implementation/zodSchema/coExport.d.ts.map +1 -1
- package/dist/tools/implementation/zodSchema/runtimeConverters/coValueSchemaTransformation.d.ts +22 -0
- package/dist/tools/implementation/zodSchema/runtimeConverters/coValueSchemaTransformation.d.ts.map +1 -0
- package/dist/tools/implementation/zodSchema/runtimeConverters/schemaFieldToCoFieldDef.d.ts +10 -0
- package/dist/tools/implementation/zodSchema/runtimeConverters/schemaFieldToCoFieldDef.d.ts.map +1 -0
- package/dist/tools/implementation/zodSchema/schemaTypes/AccountSchema.d.ts +11 -11
- package/dist/tools/implementation/zodSchema/schemaTypes/AccountSchema.d.ts.map +1 -1
- package/dist/tools/implementation/zodSchema/schemaTypes/CoDiscriminatedUnionSchema.d.ts +34 -24
- package/dist/tools/implementation/zodSchema/schemaTypes/CoDiscriminatedUnionSchema.d.ts.map +1 -1
- package/dist/tools/implementation/zodSchema/schemaTypes/CoFeedSchema.d.ts +16 -14
- package/dist/tools/implementation/zodSchema/schemaTypes/CoFeedSchema.d.ts.map +1 -1
- package/dist/tools/implementation/zodSchema/schemaTypes/CoListSchema.d.ts +23 -17
- package/dist/tools/implementation/zodSchema/schemaTypes/CoListSchema.d.ts.map +1 -1
- package/dist/tools/implementation/zodSchema/schemaTypes/CoMapSchema.d.ts +24 -16
- package/dist/tools/implementation/zodSchema/schemaTypes/CoMapSchema.d.ts.map +1 -1
- package/dist/tools/implementation/zodSchema/schemaTypes/CoOptionalSchema.d.ts +20 -9
- package/dist/tools/implementation/zodSchema/schemaTypes/CoOptionalSchema.d.ts.map +1 -1
- package/dist/tools/implementation/zodSchema/schemaTypes/CoRecordSchema.d.ts +18 -12
- package/dist/tools/implementation/zodSchema/schemaTypes/CoRecordSchema.d.ts.map +1 -1
- package/dist/tools/implementation/zodSchema/schemaTypes/CoValueSchema.d.ts +18 -0
- package/dist/tools/implementation/zodSchema/schemaTypes/CoValueSchema.d.ts.map +1 -0
- package/dist/tools/implementation/zodSchema/schemaTypes/FileStreamSchema.d.ts +14 -9
- package/dist/tools/implementation/zodSchema/schemaTypes/FileStreamSchema.d.ts.map +1 -1
- package/dist/tools/implementation/zodSchema/schemaTypes/PlainTextSchema.d.ts +14 -9
- package/dist/tools/implementation/zodSchema/schemaTypes/PlainTextSchema.d.ts.map +1 -1
- package/dist/tools/implementation/zodSchema/schemaTypes/RichTextSchema.d.ts +14 -9
- package/dist/tools/implementation/zodSchema/schemaTypes/RichTextSchema.d.ts.map +1 -1
- package/dist/tools/implementation/zodSchema/typeConverters/InstanceOfSchema.d.ts +15 -13
- package/dist/tools/implementation/zodSchema/typeConverters/InstanceOfSchema.d.ts.map +1 -1
- package/dist/tools/implementation/zodSchema/typeConverters/InstanceOfSchemaCoValuesNullable.d.ts +12 -15
- package/dist/tools/implementation/zodSchema/typeConverters/InstanceOfSchemaCoValuesNullable.d.ts.map +1 -1
- package/dist/tools/implementation/zodSchema/typeConverters/InstanceOrPrimitiveOfSchema.d.ts +17 -20
- package/dist/tools/implementation/zodSchema/typeConverters/InstanceOrPrimitiveOfSchema.d.ts.map +1 -1
- package/dist/tools/implementation/zodSchema/typeConverters/InstanceOrPrimitiveOfSchemaCoValuesNullable.d.ts +17 -20
- package/dist/tools/implementation/zodSchema/typeConverters/InstanceOrPrimitiveOfSchemaCoValuesNullable.d.ts.map +1 -1
- package/dist/tools/implementation/zodSchema/unionUtils.d.ts +3 -5
- package/dist/tools/implementation/zodSchema/unionUtils.d.ts.map +1 -1
- package/dist/tools/implementation/zodSchema/zodCo.d.ts +10 -8
- package/dist/tools/implementation/zodSchema/zodCo.d.ts.map +1 -1
- package/dist/tools/implementation/zodSchema/zodReExport.d.ts +4 -8
- package/dist/tools/implementation/zodSchema/zodReExport.d.ts.map +1 -1
- package/dist/tools/implementation/zodSchema/zodSchema.d.ts +21 -30
- package/dist/tools/implementation/zodSchema/zodSchema.d.ts.map +1 -1
- package/dist/tools/internal.d.ts +3 -2
- package/dist/tools/internal.d.ts.map +1 -1
- package/dist/tools/lib/utilityTypes.d.ts +10 -0
- package/dist/tools/lib/utilityTypes.d.ts.map +1 -0
- package/dist/tools/subscribe/utils.d.ts.map +1 -1
- package/dist/tools/testing.d.ts +2 -2
- package/dist/tools/testing.d.ts.map +1 -1
- package/dist/worker/index.d.ts.map +1 -1
- package/dist/worker/index.js +2 -2
- package/dist/worker/index.js.map +1 -1
- package/package.json +5 -5
- package/src/browser/index.ts +2 -4
- package/src/browser-media-images/index.ts +1 -1
- package/src/react/hooks.tsx +2 -2
- package/src/react-core/hooks.ts +6 -6
- package/src/react-core/tests/useAccount.test.ts +2 -2
- package/src/react-core/tests/useCoState.test.ts +3 -2
- package/src/react-native-core/hooks.tsx +2 -2
- package/src/svelte/jazz.class.svelte.ts +10 -7
- package/src/svelte/jazz.svelte.ts +2 -2
- package/src/tools/coValues/CoValueBase.ts +8 -20
- package/src/tools/coValues/account.ts +18 -14
- package/src/tools/coValues/coFeed.ts +0 -4
- package/src/tools/coValues/coList.ts +7 -9
- package/src/tools/coValues/coMap.ts +1 -6
- package/src/tools/coValues/coPlainText.ts +4 -4
- package/src/tools/coValues/deepLoading.ts +4 -1
- package/src/tools/coValues/extensions/imageDef.ts +3 -3
- package/src/tools/coValues/inbox.ts +4 -4
- package/src/tools/coValues/interfaces.ts +4 -71
- package/src/tools/coValues/request.ts +15 -13
- package/src/tools/coValues/schemaUnion.ts +8 -4
- package/src/tools/exports.ts +3 -14
- package/src/tools/implementation/createContext.ts +9 -9
- package/src/tools/implementation/invites.ts +2 -2
- package/src/tools/implementation/schemaUtils.ts +18 -0
- package/src/tools/implementation/zodSchema/coExport.ts +14 -0
- package/src/tools/implementation/zodSchema/runtimeConverters/coValueSchemaTransformation.ts +156 -0
- package/src/tools/implementation/zodSchema/runtimeConverters/schemaFieldToCoFieldDef.ts +133 -0
- package/src/tools/implementation/zodSchema/schemaTypes/AccountSchema.ts +36 -17
- package/src/tools/implementation/zodSchema/schemaTypes/CoDiscriminatedUnionSchema.ts +101 -52
- package/src/tools/implementation/zodSchema/schemaTypes/CoFeedSchema.ts +54 -50
- package/src/tools/implementation/zodSchema/schemaTypes/CoListSchema.ts +54 -46
- package/src/tools/implementation/zodSchema/schemaTypes/CoMapSchema.ts +187 -137
- package/src/tools/implementation/zodSchema/schemaTypes/CoOptionalSchema.ts +29 -27
- package/src/tools/implementation/zodSchema/schemaTypes/CoRecordSchema.ts +28 -18
- package/src/tools/implementation/zodSchema/schemaTypes/CoValueSchema.ts +18 -0
- package/src/tools/implementation/zodSchema/schemaTypes/FileStreamSchema.ts +45 -36
- package/src/tools/implementation/zodSchema/schemaTypes/PlainTextSchema.ts +47 -35
- package/src/tools/implementation/zodSchema/schemaTypes/RichTextSchema.ts +43 -30
- package/src/tools/implementation/zodSchema/typeConverters/InstanceOfSchema.ts +28 -23
- package/src/tools/implementation/zodSchema/typeConverters/InstanceOfSchemaCoValuesNullable.ts +28 -25
- package/src/tools/implementation/zodSchema/typeConverters/InstanceOrPrimitiveOfSchema.ts +86 -78
- package/src/tools/implementation/zodSchema/typeConverters/InstanceOrPrimitiveOfSchemaCoValuesNullable.ts +91 -82
- package/src/tools/implementation/zodSchema/unionUtils.ts +47 -51
- package/src/tools/implementation/zodSchema/zodCo.ts +42 -75
- package/src/tools/implementation/zodSchema/zodReExport.ts +44 -24
- package/src/tools/implementation/zodSchema/zodSchema.ts +64 -102
- package/src/tools/internal.ts +3 -2
- package/src/tools/lib/utilityTypes.ts +7 -0
- package/src/tools/subscribe/utils.ts +4 -2
- package/src/tools/testing.ts +4 -4
- package/src/tools/tests/ContextManager.test.ts +8 -9
- package/src/tools/tests/account.test.ts +65 -3
- package/src/tools/tests/coDiscriminatedUnion.test-d.ts +38 -0
- package/src/tools/tests/coDiscriminatedUnion.test.ts +219 -1
- package/src/tools/tests/coFeed.test-d.ts +4 -3
- package/src/tools/tests/coList.test-d.ts +32 -3
- package/src/tools/tests/coList.test.ts +20 -2
- package/src/tools/tests/coMap.record.test-d.ts +31 -3
- package/src/tools/tests/coMap.record.test.ts +9 -9
- package/src/tools/tests/coMap.test-d.ts +8 -8
- package/src/tools/tests/coMap.test.ts +19 -5
- package/src/tools/tests/coOptional.test.ts +63 -1
- package/src/tools/tests/createContext.test.ts +7 -9
- package/src/tools/tests/deepLoading.test.ts +4 -10
- package/src/tools/tests/exportImport.test.ts +2 -2
- package/src/tools/tests/groupsAndAccounts.test.ts +5 -4
- package/src/tools/tests/inbox.test.ts +3 -2
- package/src/tools/tests/load.test.ts +3 -29
- package/src/tools/tests/schemaUnion.test.ts +2 -2
- package/src/tools/tests/subscribe.test.ts +22 -114
- package/src/tools/tests/testing.test.ts +6 -6
- package/src/tools/tests/zod.test-d.ts +27 -0
- package/src/tools/tests/zod.test.ts +50 -45
- package/src/worker/index.ts +0 -1
- package/dist/chunk-OSVAAVWQ.js.map +0 -1
- package/dist/tools/implementation/zodSchema/runtimeConverters/zodFieldToCoFieldDef.d.ts +0 -12
- package/dist/tools/implementation/zodSchema/runtimeConverters/zodFieldToCoFieldDef.d.ts.map +0 -1
- package/dist/tools/implementation/zodSchema/runtimeConverters/zodSchemaToCoSchema.d.ts +0 -9
- package/dist/tools/implementation/zodSchema/runtimeConverters/zodSchemaToCoSchema.d.ts.map +0 -1
- package/src/tools/implementation/zodSchema/runtimeConverters/zodFieldToCoFieldDef.ts +0 -172
- package/src/tools/implementation/zodSchema/runtimeConverters/zodSchemaToCoSchema.ts +0 -218
@@ -14,7 +14,7 @@ import {
|
|
14
14
|
Resolved,
|
15
15
|
SubscribeListenerOptions,
|
16
16
|
SubscribeRestArgs,
|
17
|
-
|
17
|
+
coValueClassFromCoValueClassOrSchema,
|
18
18
|
parseCoValueCreateOptions,
|
19
19
|
} from "../internal.js";
|
20
20
|
import {
|
@@ -47,9 +47,9 @@ export class CoPlainText extends String implements CoValue {
|
|
47
47
|
|
48
48
|
if (agent instanceof ControlledAccount) {
|
49
49
|
return coValuesCache.get(agent.account, () =>
|
50
|
-
|
51
|
-
|
52
|
-
),
|
50
|
+
coValueClassFromCoValueClassOrSchema(
|
51
|
+
RegisteredSchemas["Account"],
|
52
|
+
).fromRaw(agent.account),
|
53
53
|
);
|
54
54
|
}
|
55
55
|
|
@@ -5,7 +5,10 @@ import { CoFeedEntry } from "./coFeed.js";
|
|
5
5
|
import { type CoKeys } from "./coMap.js";
|
6
6
|
import { type CoValue, type ID } from "./interfaces.js";
|
7
7
|
|
8
|
-
|
8
|
+
/**
|
9
|
+
* Similar to {@link NonNullable}, but removes only `null` and preserves `undefined`.
|
10
|
+
*/
|
11
|
+
export type NotNull<T> = Exclude<T, null>;
|
9
12
|
|
10
13
|
/**
|
11
14
|
* Used to check if T is a union type.
|
@@ -8,9 +8,9 @@ const ImageDefinitionBase = coMapDefiner({
|
|
8
8
|
}).catchall(coFileStreamDefiner());
|
9
9
|
|
10
10
|
/** @category Media */
|
11
|
-
export const ImageDefinition =
|
11
|
+
export const ImageDefinition = Object.assign({}, ImageDefinitionBase, {
|
12
12
|
highestResAvailable(
|
13
|
-
imageDef:
|
13
|
+
imageDef: ImageDefinition,
|
14
14
|
options?: {
|
15
15
|
maxWidth?: number;
|
16
16
|
targetWidth?: number;
|
@@ -56,5 +56,5 @@ export const ImageDefinition = ImageDefinitionBase.withHelpers((Self) => ({
|
|
56
56
|
}
|
57
57
|
);
|
58
58
|
},
|
59
|
-
})
|
59
|
+
});
|
60
60
|
export type ImageDefinition = Loaded<typeof ImageDefinition>;
|
@@ -3,11 +3,11 @@ import { CoStreamItem, RawCoStream } from "cojson";
|
|
3
3
|
import {
|
4
4
|
type Account,
|
5
5
|
CoValue,
|
6
|
-
|
6
|
+
CoValueClassOrSchema,
|
7
7
|
ID,
|
8
8
|
InstanceOfSchema,
|
9
9
|
activeAccountContext,
|
10
|
-
|
10
|
+
coValueClassFromCoValueClassOrSchema,
|
11
11
|
loadCoValue,
|
12
12
|
} from "../internal.js";
|
13
13
|
import { isCoValueId } from "../lib/id.js";
|
@@ -109,7 +109,7 @@ export class Inbox {
|
|
109
109
|
this.failed = failed;
|
110
110
|
}
|
111
111
|
|
112
|
-
subscribe<M extends
|
112
|
+
subscribe<M extends CoValueClassOrSchema, O extends CoValue | undefined>(
|
113
113
|
Schema: M,
|
114
114
|
callback: (
|
115
115
|
message: InstanceOfSchema<M>,
|
@@ -172,7 +172,7 @@ export class Inbox {
|
|
172
172
|
}
|
173
173
|
|
174
174
|
return loadCoValue(
|
175
|
-
|
175
|
+
coValueClassFromCoValueClassOrSchema(Schema),
|
176
176
|
message.get("payload")!,
|
177
177
|
{
|
178
178
|
loadAs: account,
|
@@ -1,5 +1,4 @@
|
|
1
1
|
import {
|
2
|
-
CoValueCore,
|
3
2
|
type CoValueUniqueness,
|
4
3
|
type CojsonInternalTypes,
|
5
4
|
type RawCoValue,
|
@@ -9,7 +8,7 @@ import { AvailableCoValueCore } from "cojson/dist/coValueCore/coValueCore.js";
|
|
9
8
|
import {
|
10
9
|
Account,
|
11
10
|
AnonymousJazzAgent,
|
12
|
-
|
11
|
+
CoValueClassOrSchema,
|
13
12
|
type Group,
|
14
13
|
Loaded,
|
15
14
|
RefsToResolve,
|
@@ -21,8 +20,7 @@ import {
|
|
21
20
|
SubscriptionScope,
|
22
21
|
type SubscriptionValue,
|
23
22
|
activeAccountContext,
|
24
|
-
|
25
|
-
getSubscriptionScope,
|
23
|
+
coValueClassFromCoValueClassOrSchema,
|
26
24
|
inspect,
|
27
25
|
} from "../internal.js";
|
28
26
|
|
@@ -312,71 +310,6 @@ export function subscribeToCoValue<
|
|
312
310
|
return unsubscribe;
|
313
311
|
}
|
314
312
|
|
315
|
-
/**
|
316
|
-
* @deprecated Used for the React integration in the past, but we moved to use SubscriptionScope directly.
|
317
|
-
*
|
318
|
-
* Going to be removed in the next minor version.
|
319
|
-
*/
|
320
|
-
export function createCoValueObservable<
|
321
|
-
S extends CoValueOrZodSchema,
|
322
|
-
const R extends ResolveQuery<S>,
|
323
|
-
>(initialValue: undefined | null = undefined) {
|
324
|
-
let currentValue: Loaded<S, R> | undefined | null = initialValue;
|
325
|
-
let subscriberCount = 0;
|
326
|
-
|
327
|
-
function subscribe(
|
328
|
-
cls: S,
|
329
|
-
id: string,
|
330
|
-
options: {
|
331
|
-
loadAs: Account | AnonymousJazzAgent;
|
332
|
-
resolve?: ResolveQueryStrict<S, R>;
|
333
|
-
onUnavailable?: () => void;
|
334
|
-
onUnauthorized?: () => void;
|
335
|
-
syncResolution?: boolean;
|
336
|
-
},
|
337
|
-
listener: () => void,
|
338
|
-
) {
|
339
|
-
subscriberCount++;
|
340
|
-
|
341
|
-
const unsubscribe = subscribeToCoValue(
|
342
|
-
anySchemaToCoSchema(cls),
|
343
|
-
id,
|
344
|
-
{
|
345
|
-
loadAs: options.loadAs,
|
346
|
-
resolve: options.resolve as any,
|
347
|
-
onUnavailable: () => {
|
348
|
-
currentValue = null;
|
349
|
-
options.onUnavailable?.();
|
350
|
-
},
|
351
|
-
onUnauthorized: () => {
|
352
|
-
currentValue = null;
|
353
|
-
options.onUnauthorized?.();
|
354
|
-
},
|
355
|
-
syncResolution: options.syncResolution,
|
356
|
-
},
|
357
|
-
(value) => {
|
358
|
-
currentValue = value as Loaded<S, R>;
|
359
|
-
listener();
|
360
|
-
},
|
361
|
-
);
|
362
|
-
|
363
|
-
return () => {
|
364
|
-
unsubscribe();
|
365
|
-
subscriberCount--;
|
366
|
-
if (subscriberCount === 0) {
|
367
|
-
currentValue = undefined;
|
368
|
-
}
|
369
|
-
};
|
370
|
-
}
|
371
|
-
|
372
|
-
const observable = {
|
373
|
-
getCurrentValue: () => currentValue,
|
374
|
-
subscribe,
|
375
|
-
};
|
376
|
-
|
377
|
-
return observable;
|
378
|
-
}
|
379
|
-
|
380
313
|
export function subscribeToExistingCoValue<
|
381
314
|
V extends CoValue,
|
382
315
|
const R extends RefsToResolve<V>,
|
@@ -515,7 +448,7 @@ export function parseGroupCreateOptions(
|
|
515
448
|
* ```
|
516
449
|
*/
|
517
450
|
export async function exportCoValue<
|
518
|
-
S extends
|
451
|
+
S extends CoValueClassOrSchema,
|
519
452
|
const R extends ResolveQuery<S>,
|
520
453
|
>(
|
521
454
|
cls: S,
|
@@ -537,7 +470,7 @@ export async function exportCoValue<
|
|
537
470
|
resolve as any,
|
538
471
|
id,
|
539
472
|
{
|
540
|
-
ref:
|
473
|
+
ref: coValueClassFromCoValueClassOrSchema(cls),
|
541
474
|
optional: false,
|
542
475
|
},
|
543
476
|
options.skipRetry,
|
@@ -8,19 +8,19 @@ import {
|
|
8
8
|
} from "cojson";
|
9
9
|
import z from "zod/v4";
|
10
10
|
import {
|
11
|
-
|
12
|
-
AnyCoSchema,
|
11
|
+
AnyZodOrCoValueSchema,
|
13
12
|
CoMap,
|
14
13
|
CoMapInitZod,
|
15
14
|
CoMapSchema,
|
16
15
|
CoValueClass,
|
16
|
+
CoreCoMapSchema,
|
17
17
|
Group,
|
18
18
|
Loaded,
|
19
19
|
ResolveQuery,
|
20
20
|
ResolveQueryStrict,
|
21
21
|
Simplify,
|
22
|
-
anySchemaToCoSchema,
|
23
22
|
coMapDefiner,
|
23
|
+
coValueClassFromCoValueClassOrSchema,
|
24
24
|
exportCoValue,
|
25
25
|
importContentPieces,
|
26
26
|
loadCoValue,
|
@@ -28,7 +28,7 @@ import {
|
|
28
28
|
import { isCoValueId } from "../lib/id.js";
|
29
29
|
import { Account } from "./account.js";
|
30
30
|
|
31
|
-
type MessageShape = Record<string,
|
31
|
+
type MessageShape = Record<string, AnyZodOrCoValueSchema>;
|
32
32
|
|
33
33
|
type RequestSchemaDefinition<
|
34
34
|
S extends MessageShape,
|
@@ -97,7 +97,7 @@ type MessageValuePayload<T extends MessageShape> =
|
|
97
97
|
| AsNullablePayload<T>;
|
98
98
|
|
99
99
|
function createMessageEnvelope<S extends MessageShape>(
|
100
|
-
schema:
|
100
|
+
schema: CoreCoMapSchema,
|
101
101
|
value: MessageValuePayload<S>,
|
102
102
|
owner: Account,
|
103
103
|
sharedWith: Account | Group,
|
@@ -111,7 +111,7 @@ function createMessageEnvelope<S extends MessageShape>(
|
|
111
111
|
group.addMember(sharedWith, "reader");
|
112
112
|
}
|
113
113
|
|
114
|
-
// @ts-expect-error -
|
114
|
+
// @ts-expect-error - CoreCoMapSchema doesn't have static methods
|
115
115
|
return schema.create(value ?? {}, group);
|
116
116
|
}
|
117
117
|
|
@@ -129,7 +129,7 @@ async function serializeMessagePayload({
|
|
129
129
|
}: {
|
130
130
|
// Skipping type validation here to avoid excessive type complexity that affects the typecheck performance
|
131
131
|
type: "request" | "response";
|
132
|
-
schema:
|
132
|
+
schema: CoreCoMapSchema;
|
133
133
|
resolve: any;
|
134
134
|
value: any;
|
135
135
|
owner: Account;
|
@@ -198,7 +198,7 @@ async function handleMessagePayload({
|
|
198
198
|
}: {
|
199
199
|
type: "request" | "response";
|
200
200
|
// Skipping type validation here to avoid excessive type complexity that affects the typecheck performance
|
201
|
-
schema:
|
201
|
+
schema: CoreCoMapSchema;
|
202
202
|
resolve: any;
|
203
203
|
request: unknown;
|
204
204
|
loadAs: Account;
|
@@ -290,7 +290,9 @@ async function handleMessagePayload({
|
|
290
290
|
throw new JazzRequestError("Creator account not found", 400);
|
291
291
|
}
|
292
292
|
|
293
|
-
const coSchema =
|
293
|
+
const coSchema = coValueClassFromCoValueClassOrSchema(
|
294
|
+
schema,
|
295
|
+
) as CoValueClass<CoMap>;
|
294
296
|
const value = await loadCoValue<CoMap, true>(coSchema, requestData.id, {
|
295
297
|
resolve,
|
296
298
|
loadAs,
|
@@ -317,13 +319,13 @@ function parseSchemaAndResolve<
|
|
317
319
|
if ("schema" in options) {
|
318
320
|
return {
|
319
321
|
// Using a type cast to reduce the type complexity
|
320
|
-
schema: coMapDefiner(options.schema) as
|
322
|
+
schema: coMapDefiner(options.schema) as CoreCoMapSchema,
|
321
323
|
resolve: options.resolve as any,
|
322
324
|
};
|
323
325
|
}
|
324
326
|
|
325
327
|
return {
|
326
|
-
schema: coMapDefiner(options) as
|
328
|
+
schema: coMapDefiner(options) as CoreCoMapSchema,
|
327
329
|
resolve: true as any,
|
328
330
|
};
|
329
331
|
}
|
@@ -335,11 +337,11 @@ class HttpRoute<
|
|
335
337
|
ResponseResolve extends ResolveQuery<CoMapSchema<ResponseShape>> = any,
|
336
338
|
> {
|
337
339
|
private requestDefinition: {
|
338
|
-
schema:
|
340
|
+
schema: CoreCoMapSchema;
|
339
341
|
resolve: any;
|
340
342
|
};
|
341
343
|
private responseDefinition: {
|
342
|
-
schema:
|
344
|
+
schema: CoreCoMapSchema;
|
343
345
|
resolve: any;
|
344
346
|
};
|
345
347
|
private url: string;
|
@@ -6,8 +6,6 @@ import {
|
|
6
6
|
CoValueClass,
|
7
7
|
CoValueFromRaw,
|
8
8
|
ID,
|
9
|
-
RefsToResolve,
|
10
|
-
RefsToResolveStrict,
|
11
9
|
Resolved,
|
12
10
|
SubscribeListenerOptions,
|
13
11
|
SubscribeRestArgs,
|
@@ -16,6 +14,12 @@ import {
|
|
16
14
|
subscribeToCoValueWithoutMe,
|
17
15
|
} from "../internal.js";
|
18
16
|
|
17
|
+
/**
|
18
|
+
* Extends `SchemaUnion` with a non-abstract constructor.
|
19
|
+
*/
|
20
|
+
export type SchemaUnionConcreteSubclass<V extends CoValue> =
|
21
|
+
typeof SchemaUnion & CoValueClass<V>;
|
22
|
+
|
19
23
|
/**
|
20
24
|
* SchemaUnion allows you to create union types of CoValues that can be discriminated at runtime.
|
21
25
|
*
|
@@ -86,7 +90,7 @@ export abstract class SchemaUnion extends CoValueBase implements CoValue {
|
|
86
90
|
**/
|
87
91
|
static Of<V extends CoValue>(
|
88
92
|
discriminator: (raw: V["_raw"]) => CoValueClass<V> & CoValueFromRaw<V>,
|
89
|
-
):
|
93
|
+
): SchemaUnionConcreteSubclass<V> {
|
90
94
|
return class SchemaUnionClass extends SchemaUnion {
|
91
95
|
static override fromRaw<T extends CoValue>(
|
92
96
|
this: CoValueClass<T> & CoValueFromRaw<T>,
|
@@ -97,7 +101,7 @@ export abstract class SchemaUnion extends CoValueBase implements CoValue {
|
|
97
101
|
) as unknown as CoValueClass<T> & CoValueFromRaw<T>;
|
98
102
|
return ResolvedClass.fromRaw(raw);
|
99
103
|
}
|
100
|
-
} as unknown as
|
104
|
+
} as unknown as SchemaUnionConcreteSubclass<V>;
|
101
105
|
}
|
102
106
|
|
103
107
|
/**
|
package/src/tools/exports.ts
CHANGED
@@ -35,7 +35,6 @@ export type {
|
|
35
35
|
TextPos,
|
36
36
|
AccountClass,
|
37
37
|
AccountCreationProps,
|
38
|
-
WithHelpers,
|
39
38
|
} from "./internal.js";
|
40
39
|
|
41
40
|
export {
|
@@ -49,7 +48,6 @@ export {
|
|
49
48
|
CoRichText,
|
50
49
|
Account,
|
51
50
|
isControlledAccount,
|
52
|
-
createCoValueObservable,
|
53
51
|
loadCoValue,
|
54
52
|
subscribeToCoValue,
|
55
53
|
ImageDefinition,
|
@@ -99,26 +97,17 @@ export {
|
|
99
97
|
export type * from "./types.js";
|
100
98
|
|
101
99
|
export {
|
102
|
-
|
103
|
-
anySchemaToCoSchema,
|
100
|
+
coValueClassFromCoValueClassOrSchema,
|
104
101
|
type InstanceOfSchema,
|
105
102
|
type InstanceOfSchemaCoValuesNullable,
|
106
|
-
type
|
103
|
+
type CoValueClassOrSchema,
|
107
104
|
type Loaded,
|
108
105
|
type BaseAccountShape,
|
109
106
|
type DefaultAccountShape,
|
110
|
-
type
|
111
|
-
type AnyAccountSchema,
|
112
|
-
type CoListSchema,
|
113
|
-
type CoMapSchema,
|
114
|
-
type CoFeedSchema,
|
115
|
-
type PlainTextSchema,
|
116
|
-
type FileStreamSchema,
|
107
|
+
type CoreAccountSchema as AnyAccountSchema,
|
117
108
|
type ResolveQuery,
|
118
109
|
type ResolveQueryStrict,
|
119
110
|
type InitFor,
|
120
|
-
type CoRecordSchema,
|
121
|
-
type CoProfileSchema,
|
122
111
|
} from "./internal.js";
|
123
112
|
|
124
113
|
export {
|
@@ -1,7 +1,6 @@
|
|
1
1
|
import {
|
2
2
|
AgentSecret,
|
3
3
|
CoID,
|
4
|
-
ControlledAgent,
|
5
4
|
CryptoProvider,
|
6
5
|
LocalNode,
|
7
6
|
Peer,
|
@@ -14,12 +13,11 @@ import { AuthSecretStorage } from "../auth/AuthSecretStorage.js";
|
|
14
13
|
import { type Account, type AccountClass } from "../coValues/account.js";
|
15
14
|
import { RegisteredSchemas } from "../coValues/registeredSchemas.js";
|
16
15
|
import {
|
17
|
-
type AccountSchema,
|
18
|
-
type AnyAccountSchema,
|
19
16
|
CoValueFromRaw,
|
17
|
+
type CoreAccountSchema,
|
20
18
|
type ID,
|
21
19
|
type InstanceOfSchema,
|
22
|
-
|
20
|
+
coValueClassFromCoValueClassOrSchema,
|
23
21
|
} from "../internal.js";
|
24
22
|
import { AuthCredentials, NewAccountProps } from "../types.js";
|
25
23
|
import { activeAccountContext } from "./activeAccountContext.js";
|
@@ -89,7 +87,7 @@ export type JazzContext<Acc extends Account> =
|
|
89
87
|
export async function createJazzContextFromExistingCredentials<
|
90
88
|
S extends
|
91
89
|
| (AccountClass<Account> & CoValueFromRaw<Account>)
|
92
|
-
|
|
90
|
+
| CoreAccountSchema,
|
93
91
|
>({
|
94
92
|
credentials,
|
95
93
|
peersToLoadFrom,
|
@@ -115,7 +113,8 @@ export async function createJazzContextFromExistingCredentials<
|
|
115
113
|
const CurrentAccountSchema =
|
116
114
|
PropsAccountSchema ?? (RegisteredSchemas["Account"] as unknown as S);
|
117
115
|
|
118
|
-
const AccountClass =
|
116
|
+
const AccountClass =
|
117
|
+
coValueClassFromCoValueClassOrSchema(CurrentAccountSchema);
|
119
118
|
|
120
119
|
const node = await LocalNode.withLoadedAccount({
|
121
120
|
accountID: credentials.accountID as unknown as CoID<RawAccount>,
|
@@ -153,7 +152,7 @@ export async function createJazzContextFromExistingCredentials<
|
|
153
152
|
export async function createJazzContextForNewAccount<
|
154
153
|
S extends
|
155
154
|
| (AccountClass<Account> & CoValueFromRaw<Account>)
|
156
|
-
|
|
155
|
+
| CoreAccountSchema,
|
157
156
|
>({
|
158
157
|
creationProps,
|
159
158
|
initialAgentSecret,
|
@@ -174,7 +173,8 @@ export async function createJazzContextForNewAccount<
|
|
174
173
|
const CurrentAccountSchema =
|
175
174
|
PropsAccountSchema ?? (RegisteredSchemas["Account"] as unknown as S);
|
176
175
|
|
177
|
-
const AccountClass =
|
176
|
+
const AccountClass =
|
177
|
+
coValueClassFromCoValueClassOrSchema(CurrentAccountSchema);
|
178
178
|
|
179
179
|
const { node } = await LocalNode.withNewlyCreatedAccount({
|
180
180
|
creationProps,
|
@@ -209,7 +209,7 @@ export async function createJazzContextForNewAccount<
|
|
209
209
|
export async function createJazzContext<
|
210
210
|
S extends
|
211
211
|
| (AccountClass<Account> & CoValueFromRaw<Account>)
|
212
|
-
|
|
212
|
+
| CoreAccountSchema,
|
213
213
|
>(options: {
|
214
214
|
credentials?: AuthCredentials;
|
215
215
|
newAccountProps?: NewAccountProps;
|
@@ -3,7 +3,7 @@ import { Account } from "../coValues/account.js";
|
|
3
3
|
import type {
|
4
4
|
CoValue,
|
5
5
|
CoValueClass,
|
6
|
-
|
6
|
+
CoValueClassOrSchema,
|
7
7
|
ID,
|
8
8
|
} from "../internal.js";
|
9
9
|
|
@@ -68,7 +68,7 @@ export function parseInviteLink(inviteURL: string):
|
|
68
68
|
}
|
69
69
|
|
70
70
|
/** @category Invite Links */
|
71
|
-
export function consumeInviteLink<S extends
|
71
|
+
export function consumeInviteLink<S extends CoValueClassOrSchema>({
|
72
72
|
inviteURL,
|
73
73
|
as = Account.getMe(),
|
74
74
|
forValueHint,
|
@@ -0,0 +1,18 @@
|
|
1
|
+
/**
|
2
|
+
* Remove getters from an object
|
3
|
+
*
|
4
|
+
* @param obj - The object to remove getters from.
|
5
|
+
* @returns A new object with the getters removed.
|
6
|
+
*/
|
7
|
+
export function removeGetters<T extends object>(obj: T): Partial<T> {
|
8
|
+
const result: any = {};
|
9
|
+
|
10
|
+
for (const key of Object.keys(obj)) {
|
11
|
+
const descriptor = Object.getOwnPropertyDescriptor(obj, key);
|
12
|
+
if (!descriptor?.get) {
|
13
|
+
result[key] = (obj as any)[key];
|
14
|
+
}
|
15
|
+
}
|
16
|
+
|
17
|
+
return result;
|
18
|
+
}
|
@@ -1,4 +1,17 @@
|
|
1
1
|
export { Loaded as loaded } from "./zodSchema.js";
|
2
|
+
export { CoMapSchema as Map } from "./schemaTypes/CoMapSchema.js";
|
3
|
+
export { CoRecordSchema as Record } from "./schemaTypes/CoRecordSchema.js";
|
4
|
+
export { CoListSchema as List } from "./schemaTypes/CoListSchema.js";
|
5
|
+
export { CoFeedSchema as Feed } from "./schemaTypes/CoFeedSchema.js";
|
6
|
+
export { PlainTextSchema as PlainText } from "./schemaTypes/PlainTextSchema.js";
|
7
|
+
export { RichTextSchema as RichText } from "./schemaTypes/RichTextSchema.js";
|
8
|
+
export { FileStreamSchema as FileStream } from "./schemaTypes/FileStreamSchema.js";
|
9
|
+
export {
|
10
|
+
AccountSchema as Account,
|
11
|
+
CoProfileSchema as Profile,
|
12
|
+
} from "./schemaTypes/AccountSchema.js";
|
13
|
+
export { CoOptionalSchema as Optional } from "./schemaTypes/CoOptionalSchema.js";
|
14
|
+
export { CoDiscriminatedUnionSchema as DiscriminatedUnion } from "./schemaTypes/CoDiscriminatedUnionSchema.js";
|
2
15
|
export {
|
3
16
|
coMapDefiner as map,
|
4
17
|
coRecordDefiner as record,
|
@@ -12,4 +25,5 @@ export {
|
|
12
25
|
coProfileDefiner as profile,
|
13
26
|
coOptionalDefiner as optional,
|
14
27
|
coDiscriminatedUnionDefiner as discriminatedUnion,
|
28
|
+
ImageDefinitionSchema as Image,
|
15
29
|
} from "./zodCo.js";
|
@@ -0,0 +1,156 @@
|
|
1
|
+
import { RawCoList, RawCoMap } from "cojson";
|
2
|
+
import {
|
3
|
+
Account,
|
4
|
+
CoDiscriminatedUnionSchema,
|
5
|
+
CoFeed,
|
6
|
+
CoFeedSchema,
|
7
|
+
CoList,
|
8
|
+
CoListSchema,
|
9
|
+
CoMap,
|
10
|
+
CoPlainText,
|
11
|
+
CoRichText,
|
12
|
+
CoValueClass,
|
13
|
+
FileStream,
|
14
|
+
FileStreamSchema,
|
15
|
+
PlainTextSchema,
|
16
|
+
SchemaUnion,
|
17
|
+
enrichAccountSchema,
|
18
|
+
enrichCoMapSchema,
|
19
|
+
isCoValueClass,
|
20
|
+
} from "../../../internal.js";
|
21
|
+
import { coField } from "../../schema.js";
|
22
|
+
|
23
|
+
import { CoreCoValueSchema } from "../schemaTypes/CoValueSchema.js";
|
24
|
+
import { RichTextSchema } from "../schemaTypes/RichTextSchema.js";
|
25
|
+
import { schemaUnionDiscriminatorFor } from "../unionUtils.js";
|
26
|
+
import {
|
27
|
+
AnyCoreCoValueSchema,
|
28
|
+
AnyZodOrCoValueSchema,
|
29
|
+
CoValueClassFromAnySchema,
|
30
|
+
CoValueClassOrSchema,
|
31
|
+
CoValueSchemaFromCoreSchema,
|
32
|
+
} from "../zodSchema.js";
|
33
|
+
import {
|
34
|
+
SchemaField,
|
35
|
+
schemaFieldToCoFieldDef,
|
36
|
+
} from "./schemaFieldToCoFieldDef.js";
|
37
|
+
|
38
|
+
// Note: if you're editing this function, edit the `isAnyCoValueSchema`
|
39
|
+
// function in `zodReExport.ts` as well
|
40
|
+
export function isAnyCoValueSchema(
|
41
|
+
schema: AnyZodOrCoValueSchema | CoValueClass,
|
42
|
+
): schema is AnyCoreCoValueSchema {
|
43
|
+
return "collaborative" in schema && schema.collaborative === true;
|
44
|
+
}
|
45
|
+
|
46
|
+
export function isCoValueSchema(
|
47
|
+
schema: AnyZodOrCoValueSchema | CoValueClass,
|
48
|
+
): schema is CoValueSchemaFromCoreSchema<AnyCoreCoValueSchema> {
|
49
|
+
return isAnyCoValueSchema(schema) && "getCoValueClass" in schema;
|
50
|
+
}
|
51
|
+
|
52
|
+
/**
|
53
|
+
* Convert a "core" CoValue schema into a CoValue schema.
|
54
|
+
* See {@link CoreCoValueSchema} for more information.
|
55
|
+
*
|
56
|
+
* @returns The CoValue schema matching the provided CoreCoValueSchema
|
57
|
+
*/
|
58
|
+
export function hydrateCoreCoValueSchema<S extends AnyCoreCoValueSchema>(
|
59
|
+
schema: S,
|
60
|
+
): CoValueSchemaFromCoreSchema<S> {
|
61
|
+
if (isCoValueSchema(schema)) {
|
62
|
+
// If the schema is already a CoValue schema, return it as is
|
63
|
+
return schema as any;
|
64
|
+
}
|
65
|
+
|
66
|
+
if (schema.builtin === "CoOptional") {
|
67
|
+
throw new Error(
|
68
|
+
`co.optional() of collaborative types is not supported as top-level schema: ${JSON.stringify(schema)}`,
|
69
|
+
);
|
70
|
+
} else if (schema.builtin === "CoMap" || schema.builtin === "Account") {
|
71
|
+
const def = schema.getDefinition();
|
72
|
+
const ClassToExtend = schema.builtin === "Account" ? Account : CoMap;
|
73
|
+
|
74
|
+
const coValueClass = class ZCoMap extends ClassToExtend {
|
75
|
+
constructor(options: { fromRaw: RawCoMap } | undefined) {
|
76
|
+
super(options);
|
77
|
+
for (const [fieldName, fieldType] of Object.entries(def.shape)) {
|
78
|
+
(this as any)[fieldName] = schemaFieldToCoFieldDef(
|
79
|
+
fieldType as SchemaField,
|
80
|
+
);
|
81
|
+
}
|
82
|
+
if (def.catchall) {
|
83
|
+
(this as any)[coField.items] = schemaFieldToCoFieldDef(
|
84
|
+
def.catchall as SchemaField,
|
85
|
+
);
|
86
|
+
}
|
87
|
+
}
|
88
|
+
};
|
89
|
+
|
90
|
+
const coValueSchema =
|
91
|
+
ClassToExtend === Account
|
92
|
+
? enrichAccountSchema(schema as any, coValueClass as any)
|
93
|
+
: enrichCoMapSchema(schema as any, coValueClass as any);
|
94
|
+
|
95
|
+
return coValueSchema as unknown as CoValueSchemaFromCoreSchema<S>;
|
96
|
+
} else if (schema.builtin === "CoList") {
|
97
|
+
const element = schema.element;
|
98
|
+
const coValueClass = class ZCoList extends CoList {
|
99
|
+
constructor(options: { fromRaw: RawCoList } | undefined) {
|
100
|
+
super(options);
|
101
|
+
(this as any)[coField.items] = schemaFieldToCoFieldDef(
|
102
|
+
element as SchemaField,
|
103
|
+
);
|
104
|
+
}
|
105
|
+
};
|
106
|
+
|
107
|
+
const coValueSchema = new CoListSchema(element, coValueClass as any);
|
108
|
+
|
109
|
+
return coValueSchema as unknown as CoValueSchemaFromCoreSchema<S>;
|
110
|
+
} else if (schema.builtin === "CoFeed") {
|
111
|
+
const coValueClass = CoFeed.Of(
|
112
|
+
schemaFieldToCoFieldDef(schema.element as SchemaField),
|
113
|
+
);
|
114
|
+
const coValueSchema = new CoFeedSchema(schema.element, coValueClass);
|
115
|
+
return coValueSchema as unknown as CoValueSchemaFromCoreSchema<S>;
|
116
|
+
} else if (schema.builtin === "FileStream") {
|
117
|
+
const coValueClass = FileStream;
|
118
|
+
return new FileStreamSchema(coValueClass) as CoValueSchemaFromCoreSchema<S>;
|
119
|
+
} else if (schema.builtin === "CoPlainText") {
|
120
|
+
const coValueClass = CoPlainText;
|
121
|
+
return new PlainTextSchema(coValueClass) as CoValueSchemaFromCoreSchema<S>;
|
122
|
+
} else if (schema.builtin === "CoRichText") {
|
123
|
+
const coValueClass = CoRichText;
|
124
|
+
return new RichTextSchema(coValueClass) as CoValueSchemaFromCoreSchema<S>;
|
125
|
+
} else if (schema.builtin === "CoDiscriminatedUnion") {
|
126
|
+
const coValueClass = SchemaUnion.Of(schemaUnionDiscriminatorFor(schema));
|
127
|
+
const coValueSchema = new CoDiscriminatedUnionSchema(schema, coValueClass);
|
128
|
+
return coValueSchema as CoValueSchemaFromCoreSchema<S>;
|
129
|
+
} else {
|
130
|
+
const notReachable: never = schema;
|
131
|
+
throw new Error(
|
132
|
+
`Unsupported zod CoValue type for top-level schema: ${JSON.stringify(notReachable, undefined, 2)}`,
|
133
|
+
);
|
134
|
+
}
|
135
|
+
}
|
136
|
+
|
137
|
+
/**
|
138
|
+
* Convert a CoValue class or a CoValue schema into a CoValue class.
|
139
|
+
*
|
140
|
+
* This function bridges the gap between CoValue classes created with the class syntax,
|
141
|
+
* and CoValue classes created with our `co.` definers.
|
142
|
+
*
|
143
|
+
* @param schema A CoValue class or a CoValue schema
|
144
|
+
* @returns The same CoValue class, or a CoValue class that matches the provided schema
|
145
|
+
*/
|
146
|
+
export function coValueClassFromCoValueClassOrSchema<
|
147
|
+
S extends CoValueClassOrSchema,
|
148
|
+
>(schema: S): CoValueClassFromAnySchema<S> {
|
149
|
+
if (isCoValueClass(schema)) {
|
150
|
+
return schema as any;
|
151
|
+
} else if (isCoValueSchema(schema)) {
|
152
|
+
return schema.getCoValueClass() as any;
|
153
|
+
}
|
154
|
+
|
155
|
+
throw new Error(`Unsupported schema: ${JSON.stringify(schema)}`);
|
156
|
+
}
|