@atproto/lex-document 0.0.4 → 0.0.6
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/CHANGELOG.md +16 -0
- package/dist/lexicon-document.d.ts +25 -499
- package/dist/lexicon-document.d.ts.map +1 -1
- package/dist/lexicon-document.js +5 -10
- package/dist/lexicon-document.js.map +1 -1
- package/dist/lexicon-schema-builder.d.ts +7 -7
- package/dist/lexicon-schema-builder.d.ts.map +1 -1
- package/dist/lexicon-schema-builder.js +1 -3
- package/dist/lexicon-schema-builder.js.map +1 -1
- package/package.json +3 -3
- package/src/lexicon-document.test.ts +4 -4
- package/src/lexicon-document.ts +4 -15
- package/src/lexicon-schema-builder.test.ts +2 -2
- package/src/lexicon-schema-builder.ts +2 -3
- package/tsconfig.tests.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atproto/lex-document
|
|
2
2
|
|
|
3
|
+
## 0.0.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`e6b6107`](https://github.com/bluesky-social/atproto/commit/e6b6107e028fee964972274b71f5da1329a7bece), [`e6b6107`](https://github.com/bluesky-social/atproto/commit/e6b6107e028fee964972274b71f5da1329a7bece), [`e6b6107`](https://github.com/bluesky-social/atproto/commit/e6b6107e028fee964972274b71f5da1329a7bece), [`e6b6107`](https://github.com/bluesky-social/atproto/commit/e6b6107e028fee964972274b71f5da1329a7bece), [`e6b6107`](https://github.com/bluesky-social/atproto/commit/e6b6107e028fee964972274b71f5da1329a7bece), [`e6b6107`](https://github.com/bluesky-social/atproto/commit/e6b6107e028fee964972274b71f5da1329a7bece), [`e6b6107`](https://github.com/bluesky-social/atproto/commit/e6b6107e028fee964972274b71f5da1329a7bece), [`e6b6107`](https://github.com/bluesky-social/atproto/commit/e6b6107e028fee964972274b71f5da1329a7bece), [`e6b6107`](https://github.com/bluesky-social/atproto/commit/e6b6107e028fee964972274b71f5da1329a7bece), [`e6b6107`](https://github.com/bluesky-social/atproto/commit/e6b6107e028fee964972274b71f5da1329a7bece), [`e6b6107`](https://github.com/bluesky-social/atproto/commit/e6b6107e028fee964972274b71f5da1329a7bece), [`e6b6107`](https://github.com/bluesky-social/atproto/commit/e6b6107e028fee964972274b71f5da1329a7bece), [`e6b6107`](https://github.com/bluesky-social/atproto/commit/e6b6107e028fee964972274b71f5da1329a7bece), [`e6b6107`](https://github.com/bluesky-social/atproto/commit/e6b6107e028fee964972274b71f5da1329a7bece), [`e6b6107`](https://github.com/bluesky-social/atproto/commit/e6b6107e028fee964972274b71f5da1329a7bece)]:
|
|
8
|
+
- @atproto/lex-schema@0.0.5
|
|
9
|
+
|
|
10
|
+
## 0.0.5
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- [#4416](https://github.com/bluesky-social/atproto/pull/4416) [`d551b0e`](https://github.com/bluesky-social/atproto/commit/d551b0e3527714c111c3ec6e4c90ad7f46369fab) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Align lexicon document validation with the spec
|
|
15
|
+
|
|
16
|
+
- Updated dependencies []:
|
|
17
|
+
- @atproto/lex-schema@0.0.4
|
|
18
|
+
|
|
3
19
|
## 0.0.4
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -607,132 +607,6 @@ export declare const lexiconPayload: l.ObjectSchema<{
|
|
|
607
607
|
readonly description: l.OptionalSchema<string>;
|
|
608
608
|
}>;
|
|
609
609
|
export type LexiconPayload = l.Infer<typeof lexiconPayload>;
|
|
610
|
-
export declare const lexiconSubscriptionMessage: l.ObjectSchema<{
|
|
611
|
-
readonly description: l.OptionalSchema<string>;
|
|
612
|
-
readonly schema: l.OptionalSchema<{
|
|
613
|
-
type: "ref";
|
|
614
|
-
ref: string;
|
|
615
|
-
description?: string | undefined;
|
|
616
|
-
} | {
|
|
617
|
-
type: "union";
|
|
618
|
-
refs: string[];
|
|
619
|
-
closed?: boolean | undefined;
|
|
620
|
-
description?: string | undefined;
|
|
621
|
-
} | {
|
|
622
|
-
type: "object";
|
|
623
|
-
properties: l.DictSchemaOutput<l.StringSchema<{}>, l.DiscriminatedUnionSchema<"type", readonly [l.ObjectSchema<{
|
|
624
|
-
readonly type: l.LiteralSchema<"boolean">;
|
|
625
|
-
readonly default: l.OptionalSchema<boolean>;
|
|
626
|
-
readonly const: l.OptionalSchema<boolean>;
|
|
627
|
-
readonly description: l.OptionalSchema<string>;
|
|
628
|
-
}>, l.ObjectSchema<{
|
|
629
|
-
readonly type: l.LiteralSchema<"integer">;
|
|
630
|
-
readonly default: l.OptionalSchema<number>;
|
|
631
|
-
readonly minimum: l.OptionalSchema<number>;
|
|
632
|
-
readonly maximum: l.OptionalSchema<number>;
|
|
633
|
-
readonly enum: l.OptionalSchema<number[]>;
|
|
634
|
-
readonly const: l.OptionalSchema<number>;
|
|
635
|
-
readonly description: l.OptionalSchema<string>;
|
|
636
|
-
}>, l.ObjectSchema<{
|
|
637
|
-
readonly type: l.LiteralSchema<"string">;
|
|
638
|
-
readonly format: l.OptionalSchema<"datetime" | "uri" | "at-uri" | "did" | "handle" | "at-identifier" | "nsid" | "cid" | "language" | "tid" | "record-key">;
|
|
639
|
-
readonly default: l.OptionalSchema<string>;
|
|
640
|
-
readonly minLength: l.OptionalSchema<number>;
|
|
641
|
-
readonly maxLength: l.OptionalSchema<number>;
|
|
642
|
-
readonly minGraphemes: l.OptionalSchema<number>;
|
|
643
|
-
readonly maxGraphemes: l.OptionalSchema<number>;
|
|
644
|
-
readonly enum: l.OptionalSchema<string[]>;
|
|
645
|
-
readonly const: l.OptionalSchema<string>;
|
|
646
|
-
readonly knownValues: l.OptionalSchema<string[]>;
|
|
647
|
-
readonly description: l.OptionalSchema<string>;
|
|
648
|
-
}>, l.ObjectSchema<{
|
|
649
|
-
readonly type: l.LiteralSchema<"bytes">;
|
|
650
|
-
readonly maxLength: l.OptionalSchema<number>;
|
|
651
|
-
readonly minLength: l.OptionalSchema<number>;
|
|
652
|
-
readonly description: l.OptionalSchema<string>;
|
|
653
|
-
}>, l.ObjectSchema<{
|
|
654
|
-
readonly type: l.LiteralSchema<"cid-link">;
|
|
655
|
-
readonly description: l.OptionalSchema<string>;
|
|
656
|
-
}>, l.ObjectSchema<{
|
|
657
|
-
readonly type: l.LiteralSchema<"blob">;
|
|
658
|
-
readonly accept: l.OptionalSchema<string[]>;
|
|
659
|
-
readonly maxSize: l.OptionalSchema<number>;
|
|
660
|
-
readonly description: l.OptionalSchema<string>;
|
|
661
|
-
}>, l.ObjectSchema<{
|
|
662
|
-
readonly type: l.LiteralSchema<"unknown">;
|
|
663
|
-
readonly description: l.OptionalSchema<string>;
|
|
664
|
-
}>, l.ObjectSchema<{
|
|
665
|
-
readonly type: l.LiteralSchema<"ref">;
|
|
666
|
-
readonly ref: l.StringSchema<{}>;
|
|
667
|
-
readonly description: l.OptionalSchema<string>;
|
|
668
|
-
}>, l.ObjectSchema<{
|
|
669
|
-
readonly type: l.LiteralSchema<"union">;
|
|
670
|
-
readonly refs: l.ArraySchema<l.StringSchema<{}>>;
|
|
671
|
-
readonly closed: l.OptionalSchema<boolean>;
|
|
672
|
-
readonly description: l.OptionalSchema<string>;
|
|
673
|
-
}>, l.ObjectSchema<{
|
|
674
|
-
readonly type: l.LiteralSchema<"array">;
|
|
675
|
-
readonly items: l.DiscriminatedUnionSchema<"type", readonly [l.ObjectSchema<{
|
|
676
|
-
readonly type: l.LiteralSchema<"boolean">;
|
|
677
|
-
readonly default: l.OptionalSchema<boolean>;
|
|
678
|
-
readonly const: l.OptionalSchema<boolean>;
|
|
679
|
-
readonly description: l.OptionalSchema<string>;
|
|
680
|
-
}>, l.ObjectSchema<{
|
|
681
|
-
readonly type: l.LiteralSchema<"integer">;
|
|
682
|
-
readonly default: l.OptionalSchema<number>;
|
|
683
|
-
readonly minimum: l.OptionalSchema<number>;
|
|
684
|
-
readonly maximum: l.OptionalSchema<number>;
|
|
685
|
-
readonly enum: l.OptionalSchema<number[]>;
|
|
686
|
-
readonly const: l.OptionalSchema<number>;
|
|
687
|
-
readonly description: l.OptionalSchema<string>;
|
|
688
|
-
}>, l.ObjectSchema<{
|
|
689
|
-
readonly type: l.LiteralSchema<"string">;
|
|
690
|
-
readonly format: l.OptionalSchema<"datetime" | "uri" | "at-uri" | "did" | "handle" | "at-identifier" | "nsid" | "cid" | "language" | "tid" | "record-key">;
|
|
691
|
-
readonly default: l.OptionalSchema<string>;
|
|
692
|
-
readonly minLength: l.OptionalSchema<number>;
|
|
693
|
-
readonly maxLength: l.OptionalSchema<number>;
|
|
694
|
-
readonly minGraphemes: l.OptionalSchema<number>;
|
|
695
|
-
readonly maxGraphemes: l.OptionalSchema<number>;
|
|
696
|
-
readonly enum: l.OptionalSchema<string[]>;
|
|
697
|
-
readonly const: l.OptionalSchema<string>;
|
|
698
|
-
readonly knownValues: l.OptionalSchema<string[]>;
|
|
699
|
-
readonly description: l.OptionalSchema<string>;
|
|
700
|
-
}>, l.ObjectSchema<{
|
|
701
|
-
readonly type: l.LiteralSchema<"bytes">;
|
|
702
|
-
readonly maxLength: l.OptionalSchema<number>;
|
|
703
|
-
readonly minLength: l.OptionalSchema<number>;
|
|
704
|
-
readonly description: l.OptionalSchema<string>;
|
|
705
|
-
}>, l.ObjectSchema<{
|
|
706
|
-
readonly type: l.LiteralSchema<"cid-link">;
|
|
707
|
-
readonly description: l.OptionalSchema<string>;
|
|
708
|
-
}>, l.ObjectSchema<{
|
|
709
|
-
readonly type: l.LiteralSchema<"blob">;
|
|
710
|
-
readonly accept: l.OptionalSchema<string[]>;
|
|
711
|
-
readonly maxSize: l.OptionalSchema<number>;
|
|
712
|
-
readonly description: l.OptionalSchema<string>;
|
|
713
|
-
}>, l.ObjectSchema<{
|
|
714
|
-
readonly type: l.LiteralSchema<"unknown">;
|
|
715
|
-
readonly description: l.OptionalSchema<string>;
|
|
716
|
-
}>, l.ObjectSchema<{
|
|
717
|
-
readonly type: l.LiteralSchema<"ref">;
|
|
718
|
-
readonly ref: l.StringSchema<{}>;
|
|
719
|
-
readonly description: l.OptionalSchema<string>;
|
|
720
|
-
}>, l.ObjectSchema<{
|
|
721
|
-
readonly type: l.LiteralSchema<"union">;
|
|
722
|
-
readonly refs: l.ArraySchema<l.StringSchema<{}>>;
|
|
723
|
-
readonly closed: l.OptionalSchema<boolean>;
|
|
724
|
-
readonly description: l.OptionalSchema<string>;
|
|
725
|
-
}>]>;
|
|
726
|
-
readonly minLength: l.OptionalSchema<number>;
|
|
727
|
-
readonly maxLength: l.OptionalSchema<number>;
|
|
728
|
-
readonly description: l.OptionalSchema<string>;
|
|
729
|
-
}>]>>;
|
|
730
|
-
required?: string[] | undefined;
|
|
731
|
-
nullable?: string[] | undefined;
|
|
732
|
-
description?: string | undefined;
|
|
733
|
-
}>;
|
|
734
|
-
}>;
|
|
735
|
-
export type LexiconSubscriptionMessage = l.Infer<typeof lexiconSubscriptionMessage>;
|
|
736
610
|
export declare const lexiconError: l.ObjectSchema<{
|
|
737
611
|
readonly name: l.StringSchema<{
|
|
738
612
|
readonly minLength: 1;
|
|
@@ -1325,130 +1199,14 @@ export declare const lexiconSubscriptionSchema: l.ObjectSchema<{
|
|
|
1325
1199
|
required?: string[] | undefined;
|
|
1326
1200
|
description?: string | undefined;
|
|
1327
1201
|
}>;
|
|
1328
|
-
readonly message: l.
|
|
1329
|
-
description
|
|
1330
|
-
schema
|
|
1331
|
-
type: "
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
refs: string[];
|
|
1337
|
-
closed?: boolean | undefined;
|
|
1338
|
-
description?: string | undefined;
|
|
1339
|
-
} | {
|
|
1340
|
-
type: "object";
|
|
1341
|
-
properties: l.DictSchemaOutput<l.StringSchema<{}>, l.DiscriminatedUnionSchema<"type", readonly [l.ObjectSchema<{
|
|
1342
|
-
readonly type: l.LiteralSchema<"boolean">;
|
|
1343
|
-
readonly default: l.OptionalSchema<boolean>;
|
|
1344
|
-
readonly const: l.OptionalSchema<boolean>;
|
|
1345
|
-
readonly description: l.OptionalSchema<string>;
|
|
1346
|
-
}>, l.ObjectSchema<{
|
|
1347
|
-
readonly type: l.LiteralSchema<"integer">;
|
|
1348
|
-
readonly default: l.OptionalSchema<number>;
|
|
1349
|
-
readonly minimum: l.OptionalSchema<number>;
|
|
1350
|
-
readonly maximum: l.OptionalSchema<number>;
|
|
1351
|
-
readonly enum: l.OptionalSchema<number[]>;
|
|
1352
|
-
readonly const: l.OptionalSchema<number>;
|
|
1353
|
-
readonly description: l.OptionalSchema<string>;
|
|
1354
|
-
}>, l.ObjectSchema<{
|
|
1355
|
-
readonly type: l.LiteralSchema<"string">;
|
|
1356
|
-
readonly format: l.OptionalSchema<"datetime" | "uri" | "at-uri" | "did" | "handle" | "at-identifier" | "nsid" | "cid" | "language" | "tid" | "record-key">;
|
|
1357
|
-
readonly default: l.OptionalSchema<string>;
|
|
1358
|
-
readonly minLength: l.OptionalSchema<number>;
|
|
1359
|
-
readonly maxLength: l.OptionalSchema<number>;
|
|
1360
|
-
readonly minGraphemes: l.OptionalSchema<number>;
|
|
1361
|
-
readonly maxGraphemes: l.OptionalSchema<number>;
|
|
1362
|
-
readonly enum: l.OptionalSchema<string[]>;
|
|
1363
|
-
readonly const: l.OptionalSchema<string>;
|
|
1364
|
-
readonly knownValues: l.OptionalSchema<string[]>;
|
|
1365
|
-
readonly description: l.OptionalSchema<string>;
|
|
1366
|
-
}>, l.ObjectSchema<{
|
|
1367
|
-
readonly type: l.LiteralSchema<"bytes">;
|
|
1368
|
-
readonly maxLength: l.OptionalSchema<number>;
|
|
1369
|
-
readonly minLength: l.OptionalSchema<number>;
|
|
1370
|
-
readonly description: l.OptionalSchema<string>;
|
|
1371
|
-
}>, l.ObjectSchema<{
|
|
1372
|
-
readonly type: l.LiteralSchema<"cid-link">;
|
|
1373
|
-
readonly description: l.OptionalSchema<string>;
|
|
1374
|
-
}>, l.ObjectSchema<{
|
|
1375
|
-
readonly type: l.LiteralSchema<"blob">;
|
|
1376
|
-
readonly accept: l.OptionalSchema<string[]>;
|
|
1377
|
-
readonly maxSize: l.OptionalSchema<number>;
|
|
1378
|
-
readonly description: l.OptionalSchema<string>;
|
|
1379
|
-
}>, l.ObjectSchema<{
|
|
1380
|
-
readonly type: l.LiteralSchema<"unknown">;
|
|
1381
|
-
readonly description: l.OptionalSchema<string>;
|
|
1382
|
-
}>, l.ObjectSchema<{
|
|
1383
|
-
readonly type: l.LiteralSchema<"ref">;
|
|
1384
|
-
readonly ref: l.StringSchema<{}>;
|
|
1385
|
-
readonly description: l.OptionalSchema<string>;
|
|
1386
|
-
}>, l.ObjectSchema<{
|
|
1387
|
-
readonly type: l.LiteralSchema<"union">;
|
|
1388
|
-
readonly refs: l.ArraySchema<l.StringSchema<{}>>;
|
|
1389
|
-
readonly closed: l.OptionalSchema<boolean>;
|
|
1390
|
-
readonly description: l.OptionalSchema<string>;
|
|
1391
|
-
}>, l.ObjectSchema<{
|
|
1392
|
-
readonly type: l.LiteralSchema<"array">;
|
|
1393
|
-
readonly items: l.DiscriminatedUnionSchema<"type", readonly [l.ObjectSchema<{
|
|
1394
|
-
readonly type: l.LiteralSchema<"boolean">;
|
|
1395
|
-
readonly default: l.OptionalSchema<boolean>;
|
|
1396
|
-
readonly const: l.OptionalSchema<boolean>;
|
|
1397
|
-
readonly description: l.OptionalSchema<string>;
|
|
1398
|
-
}>, l.ObjectSchema<{
|
|
1399
|
-
readonly type: l.LiteralSchema<"integer">;
|
|
1400
|
-
readonly default: l.OptionalSchema<number>;
|
|
1401
|
-
readonly minimum: l.OptionalSchema<number>;
|
|
1402
|
-
readonly maximum: l.OptionalSchema<number>;
|
|
1403
|
-
readonly enum: l.OptionalSchema<number[]>;
|
|
1404
|
-
readonly const: l.OptionalSchema<number>;
|
|
1405
|
-
readonly description: l.OptionalSchema<string>;
|
|
1406
|
-
}>, l.ObjectSchema<{
|
|
1407
|
-
readonly type: l.LiteralSchema<"string">;
|
|
1408
|
-
readonly format: l.OptionalSchema<"datetime" | "uri" | "at-uri" | "did" | "handle" | "at-identifier" | "nsid" | "cid" | "language" | "tid" | "record-key">;
|
|
1409
|
-
readonly default: l.OptionalSchema<string>;
|
|
1410
|
-
readonly minLength: l.OptionalSchema<number>;
|
|
1411
|
-
readonly maxLength: l.OptionalSchema<number>;
|
|
1412
|
-
readonly minGraphemes: l.OptionalSchema<number>;
|
|
1413
|
-
readonly maxGraphemes: l.OptionalSchema<number>;
|
|
1414
|
-
readonly enum: l.OptionalSchema<string[]>;
|
|
1415
|
-
readonly const: l.OptionalSchema<string>;
|
|
1416
|
-
readonly knownValues: l.OptionalSchema<string[]>;
|
|
1417
|
-
readonly description: l.OptionalSchema<string>;
|
|
1418
|
-
}>, l.ObjectSchema<{
|
|
1419
|
-
readonly type: l.LiteralSchema<"bytes">;
|
|
1420
|
-
readonly maxLength: l.OptionalSchema<number>;
|
|
1421
|
-
readonly minLength: l.OptionalSchema<number>;
|
|
1422
|
-
readonly description: l.OptionalSchema<string>;
|
|
1423
|
-
}>, l.ObjectSchema<{
|
|
1424
|
-
readonly type: l.LiteralSchema<"cid-link">;
|
|
1425
|
-
readonly description: l.OptionalSchema<string>;
|
|
1426
|
-
}>, l.ObjectSchema<{
|
|
1427
|
-
readonly type: l.LiteralSchema<"blob">;
|
|
1428
|
-
readonly accept: l.OptionalSchema<string[]>;
|
|
1429
|
-
readonly maxSize: l.OptionalSchema<number>;
|
|
1430
|
-
readonly description: l.OptionalSchema<string>;
|
|
1431
|
-
}>, l.ObjectSchema<{
|
|
1432
|
-
readonly type: l.LiteralSchema<"unknown">;
|
|
1433
|
-
readonly description: l.OptionalSchema<string>;
|
|
1434
|
-
}>, l.ObjectSchema<{
|
|
1435
|
-
readonly type: l.LiteralSchema<"ref">;
|
|
1436
|
-
readonly ref: l.StringSchema<{}>;
|
|
1437
|
-
readonly description: l.OptionalSchema<string>;
|
|
1438
|
-
}>, l.ObjectSchema<{
|
|
1439
|
-
readonly type: l.LiteralSchema<"union">;
|
|
1440
|
-
readonly refs: l.ArraySchema<l.StringSchema<{}>>;
|
|
1441
|
-
readonly closed: l.OptionalSchema<boolean>;
|
|
1442
|
-
readonly description: l.OptionalSchema<string>;
|
|
1443
|
-
}>]>;
|
|
1444
|
-
readonly minLength: l.OptionalSchema<number>;
|
|
1445
|
-
readonly maxLength: l.OptionalSchema<number>;
|
|
1446
|
-
readonly description: l.OptionalSchema<string>;
|
|
1447
|
-
}>]>>;
|
|
1448
|
-
required?: string[] | undefined;
|
|
1449
|
-
nullable?: string[] | undefined;
|
|
1450
|
-
description?: string | undefined;
|
|
1451
|
-
} | undefined;
|
|
1202
|
+
readonly message: l.ObjectSchema<{
|
|
1203
|
+
readonly description: l.OptionalSchema<string>;
|
|
1204
|
+
readonly schema: l.ObjectSchema<{
|
|
1205
|
+
readonly type: l.LiteralSchema<"union">;
|
|
1206
|
+
readonly refs: l.ArraySchema<l.StringSchema<{}>>;
|
|
1207
|
+
readonly closed: l.OptionalSchema<boolean>;
|
|
1208
|
+
readonly description: l.OptionalSchema<string>;
|
|
1209
|
+
}>;
|
|
1452
1210
|
}>;
|
|
1453
1211
|
readonly errors: l.OptionalSchema<{
|
|
1454
1212
|
name: string;
|
|
@@ -2416,130 +2174,14 @@ declare const MAIN_LEXICON_SCHEMAS: readonly [l.ObjectSchema<{
|
|
|
2416
2174
|
required?: string[] | undefined;
|
|
2417
2175
|
description?: string | undefined;
|
|
2418
2176
|
}>;
|
|
2419
|
-
readonly message: l.
|
|
2420
|
-
description
|
|
2421
|
-
schema
|
|
2422
|
-
type: "
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
refs: string[];
|
|
2428
|
-
closed?: boolean | undefined;
|
|
2429
|
-
description?: string | undefined;
|
|
2430
|
-
} | {
|
|
2431
|
-
type: "object";
|
|
2432
|
-
properties: l.DictSchemaOutput<l.StringSchema<{}>, l.DiscriminatedUnionSchema<"type", readonly [l.ObjectSchema<{
|
|
2433
|
-
readonly type: l.LiteralSchema<"boolean">;
|
|
2434
|
-
readonly default: l.OptionalSchema<boolean>;
|
|
2435
|
-
readonly const: l.OptionalSchema<boolean>;
|
|
2436
|
-
readonly description: l.OptionalSchema<string>;
|
|
2437
|
-
}>, l.ObjectSchema<{
|
|
2438
|
-
readonly type: l.LiteralSchema<"integer">;
|
|
2439
|
-
readonly default: l.OptionalSchema<number>;
|
|
2440
|
-
readonly minimum: l.OptionalSchema<number>;
|
|
2441
|
-
readonly maximum: l.OptionalSchema<number>;
|
|
2442
|
-
readonly enum: l.OptionalSchema<number[]>;
|
|
2443
|
-
readonly const: l.OptionalSchema<number>;
|
|
2444
|
-
readonly description: l.OptionalSchema<string>;
|
|
2445
|
-
}>, l.ObjectSchema<{
|
|
2446
|
-
readonly type: l.LiteralSchema<"string">;
|
|
2447
|
-
readonly format: l.OptionalSchema<"datetime" | "uri" | "at-uri" | "did" | "handle" | "at-identifier" | "nsid" | "cid" | "language" | "tid" | "record-key">;
|
|
2448
|
-
readonly default: l.OptionalSchema<string>;
|
|
2449
|
-
readonly minLength: l.OptionalSchema<number>;
|
|
2450
|
-
readonly maxLength: l.OptionalSchema<number>;
|
|
2451
|
-
readonly minGraphemes: l.OptionalSchema<number>;
|
|
2452
|
-
readonly maxGraphemes: l.OptionalSchema<number>;
|
|
2453
|
-
readonly enum: l.OptionalSchema<string[]>;
|
|
2454
|
-
readonly const: l.OptionalSchema<string>;
|
|
2455
|
-
readonly knownValues: l.OptionalSchema<string[]>;
|
|
2456
|
-
readonly description: l.OptionalSchema<string>;
|
|
2457
|
-
}>, l.ObjectSchema<{
|
|
2458
|
-
readonly type: l.LiteralSchema<"bytes">;
|
|
2459
|
-
readonly maxLength: l.OptionalSchema<number>;
|
|
2460
|
-
readonly minLength: l.OptionalSchema<number>;
|
|
2461
|
-
readonly description: l.OptionalSchema<string>;
|
|
2462
|
-
}>, l.ObjectSchema<{
|
|
2463
|
-
readonly type: l.LiteralSchema<"cid-link">;
|
|
2464
|
-
readonly description: l.OptionalSchema<string>;
|
|
2465
|
-
}>, l.ObjectSchema<{
|
|
2466
|
-
readonly type: l.LiteralSchema<"blob">;
|
|
2467
|
-
readonly accept: l.OptionalSchema<string[]>;
|
|
2468
|
-
readonly maxSize: l.OptionalSchema<number>;
|
|
2469
|
-
readonly description: l.OptionalSchema<string>;
|
|
2470
|
-
}>, l.ObjectSchema<{
|
|
2471
|
-
readonly type: l.LiteralSchema<"unknown">;
|
|
2472
|
-
readonly description: l.OptionalSchema<string>;
|
|
2473
|
-
}>, l.ObjectSchema<{
|
|
2474
|
-
readonly type: l.LiteralSchema<"ref">;
|
|
2475
|
-
readonly ref: l.StringSchema<{}>;
|
|
2476
|
-
readonly description: l.OptionalSchema<string>;
|
|
2477
|
-
}>, l.ObjectSchema<{
|
|
2478
|
-
readonly type: l.LiteralSchema<"union">;
|
|
2479
|
-
readonly refs: l.ArraySchema<l.StringSchema<{}>>;
|
|
2480
|
-
readonly closed: l.OptionalSchema<boolean>;
|
|
2481
|
-
readonly description: l.OptionalSchema<string>;
|
|
2482
|
-
}>, l.ObjectSchema<{
|
|
2483
|
-
readonly type: l.LiteralSchema<"array">;
|
|
2484
|
-
readonly items: l.DiscriminatedUnionSchema<"type", readonly [l.ObjectSchema<{
|
|
2485
|
-
readonly type: l.LiteralSchema<"boolean">;
|
|
2486
|
-
readonly default: l.OptionalSchema<boolean>;
|
|
2487
|
-
readonly const: l.OptionalSchema<boolean>;
|
|
2488
|
-
readonly description: l.OptionalSchema<string>;
|
|
2489
|
-
}>, l.ObjectSchema<{
|
|
2490
|
-
readonly type: l.LiteralSchema<"integer">;
|
|
2491
|
-
readonly default: l.OptionalSchema<number>;
|
|
2492
|
-
readonly minimum: l.OptionalSchema<number>;
|
|
2493
|
-
readonly maximum: l.OptionalSchema<number>;
|
|
2494
|
-
readonly enum: l.OptionalSchema<number[]>;
|
|
2495
|
-
readonly const: l.OptionalSchema<number>;
|
|
2496
|
-
readonly description: l.OptionalSchema<string>;
|
|
2497
|
-
}>, l.ObjectSchema<{
|
|
2498
|
-
readonly type: l.LiteralSchema<"string">;
|
|
2499
|
-
readonly format: l.OptionalSchema<"datetime" | "uri" | "at-uri" | "did" | "handle" | "at-identifier" | "nsid" | "cid" | "language" | "tid" | "record-key">;
|
|
2500
|
-
readonly default: l.OptionalSchema<string>;
|
|
2501
|
-
readonly minLength: l.OptionalSchema<number>;
|
|
2502
|
-
readonly maxLength: l.OptionalSchema<number>;
|
|
2503
|
-
readonly minGraphemes: l.OptionalSchema<number>;
|
|
2504
|
-
readonly maxGraphemes: l.OptionalSchema<number>;
|
|
2505
|
-
readonly enum: l.OptionalSchema<string[]>;
|
|
2506
|
-
readonly const: l.OptionalSchema<string>;
|
|
2507
|
-
readonly knownValues: l.OptionalSchema<string[]>;
|
|
2508
|
-
readonly description: l.OptionalSchema<string>;
|
|
2509
|
-
}>, l.ObjectSchema<{
|
|
2510
|
-
readonly type: l.LiteralSchema<"bytes">;
|
|
2511
|
-
readonly maxLength: l.OptionalSchema<number>;
|
|
2512
|
-
readonly minLength: l.OptionalSchema<number>;
|
|
2513
|
-
readonly description: l.OptionalSchema<string>;
|
|
2514
|
-
}>, l.ObjectSchema<{
|
|
2515
|
-
readonly type: l.LiteralSchema<"cid-link">;
|
|
2516
|
-
readonly description: l.OptionalSchema<string>;
|
|
2517
|
-
}>, l.ObjectSchema<{
|
|
2518
|
-
readonly type: l.LiteralSchema<"blob">;
|
|
2519
|
-
readonly accept: l.OptionalSchema<string[]>;
|
|
2520
|
-
readonly maxSize: l.OptionalSchema<number>;
|
|
2521
|
-
readonly description: l.OptionalSchema<string>;
|
|
2522
|
-
}>, l.ObjectSchema<{
|
|
2523
|
-
readonly type: l.LiteralSchema<"unknown">;
|
|
2524
|
-
readonly description: l.OptionalSchema<string>;
|
|
2525
|
-
}>, l.ObjectSchema<{
|
|
2526
|
-
readonly type: l.LiteralSchema<"ref">;
|
|
2527
|
-
readonly ref: l.StringSchema<{}>;
|
|
2528
|
-
readonly description: l.OptionalSchema<string>;
|
|
2529
|
-
}>, l.ObjectSchema<{
|
|
2530
|
-
readonly type: l.LiteralSchema<"union">;
|
|
2531
|
-
readonly refs: l.ArraySchema<l.StringSchema<{}>>;
|
|
2532
|
-
readonly closed: l.OptionalSchema<boolean>;
|
|
2533
|
-
readonly description: l.OptionalSchema<string>;
|
|
2534
|
-
}>]>;
|
|
2535
|
-
readonly minLength: l.OptionalSchema<number>;
|
|
2536
|
-
readonly maxLength: l.OptionalSchema<number>;
|
|
2537
|
-
readonly description: l.OptionalSchema<string>;
|
|
2538
|
-
}>]>>;
|
|
2539
|
-
required?: string[] | undefined;
|
|
2540
|
-
nullable?: string[] | undefined;
|
|
2541
|
-
description?: string | undefined;
|
|
2542
|
-
} | undefined;
|
|
2177
|
+
readonly message: l.ObjectSchema<{
|
|
2178
|
+
readonly description: l.OptionalSchema<string>;
|
|
2179
|
+
readonly schema: l.ObjectSchema<{
|
|
2180
|
+
readonly type: l.LiteralSchema<"union">;
|
|
2181
|
+
readonly refs: l.ArraySchema<l.StringSchema<{}>>;
|
|
2182
|
+
readonly closed: l.OptionalSchema<boolean>;
|
|
2183
|
+
readonly description: l.OptionalSchema<string>;
|
|
2184
|
+
}>;
|
|
2543
2185
|
}>;
|
|
2544
2186
|
readonly errors: l.OptionalSchema<{
|
|
2545
2187
|
name: string;
|
|
@@ -3612,6 +3254,15 @@ export declare const lexiconDocumentSchema: l.ObjectSchema<{
|
|
|
3612
3254
|
description?: string | undefined;
|
|
3613
3255
|
} | {
|
|
3614
3256
|
type: "subscription";
|
|
3257
|
+
message: {
|
|
3258
|
+
schema: {
|
|
3259
|
+
type: "union";
|
|
3260
|
+
refs: string[];
|
|
3261
|
+
closed?: boolean | undefined;
|
|
3262
|
+
description?: string | undefined;
|
|
3263
|
+
};
|
|
3264
|
+
description?: string | undefined;
|
|
3265
|
+
};
|
|
3615
3266
|
description?: string | undefined;
|
|
3616
3267
|
parameters?: {
|
|
3617
3268
|
type: "params";
|
|
@@ -3675,131 +3326,6 @@ export declare const lexiconDocumentSchema: l.ObjectSchema<{
|
|
|
3675
3326
|
required?: string[] | undefined;
|
|
3676
3327
|
description?: string | undefined;
|
|
3677
3328
|
} | undefined;
|
|
3678
|
-
message?: {
|
|
3679
|
-
description?: string | undefined;
|
|
3680
|
-
schema?: {
|
|
3681
|
-
type: "ref";
|
|
3682
|
-
ref: string;
|
|
3683
|
-
description?: string | undefined;
|
|
3684
|
-
} | {
|
|
3685
|
-
type: "union";
|
|
3686
|
-
refs: string[];
|
|
3687
|
-
closed?: boolean | undefined;
|
|
3688
|
-
description?: string | undefined;
|
|
3689
|
-
} | {
|
|
3690
|
-
type: "object";
|
|
3691
|
-
properties: l.DictSchemaOutput<l.StringSchema<{}>, l.DiscriminatedUnionSchema<"type", readonly [l.ObjectSchema<{
|
|
3692
|
-
readonly type: l.LiteralSchema<"boolean">;
|
|
3693
|
-
readonly default: l.OptionalSchema<boolean>;
|
|
3694
|
-
readonly const: l.OptionalSchema<boolean>;
|
|
3695
|
-
readonly description: l.OptionalSchema<string>;
|
|
3696
|
-
}>, l.ObjectSchema<{
|
|
3697
|
-
readonly type: l.LiteralSchema<"integer">;
|
|
3698
|
-
readonly default: l.OptionalSchema<number>;
|
|
3699
|
-
readonly minimum: l.OptionalSchema<number>;
|
|
3700
|
-
readonly maximum: l.OptionalSchema<number>;
|
|
3701
|
-
readonly enum: l.OptionalSchema<number[]>;
|
|
3702
|
-
readonly const: l.OptionalSchema<number>;
|
|
3703
|
-
readonly description: l.OptionalSchema<string>;
|
|
3704
|
-
}>, l.ObjectSchema<{
|
|
3705
|
-
readonly type: l.LiteralSchema<"string">;
|
|
3706
|
-
readonly format: l.OptionalSchema<"datetime" | "uri" | "at-uri" | "did" | "handle" | "at-identifier" | "nsid" | "cid" | "language" | "tid" | "record-key">;
|
|
3707
|
-
readonly default: l.OptionalSchema<string>;
|
|
3708
|
-
readonly minLength: l.OptionalSchema<number>;
|
|
3709
|
-
readonly maxLength: l.OptionalSchema<number>;
|
|
3710
|
-
readonly minGraphemes: l.OptionalSchema<number>;
|
|
3711
|
-
readonly maxGraphemes: l.OptionalSchema<number>;
|
|
3712
|
-
readonly enum: l.OptionalSchema<string[]>;
|
|
3713
|
-
readonly const: l.OptionalSchema<string>;
|
|
3714
|
-
readonly knownValues: l.OptionalSchema<string[]>;
|
|
3715
|
-
readonly description: l.OptionalSchema<string>;
|
|
3716
|
-
}>, l.ObjectSchema<{
|
|
3717
|
-
readonly type: l.LiteralSchema<"bytes">;
|
|
3718
|
-
readonly maxLength: l.OptionalSchema<number>;
|
|
3719
|
-
readonly minLength: l.OptionalSchema<number>;
|
|
3720
|
-
readonly description: l.OptionalSchema<string>;
|
|
3721
|
-
}>, l.ObjectSchema<{
|
|
3722
|
-
readonly type: l.LiteralSchema<"cid-link">;
|
|
3723
|
-
readonly description: l.OptionalSchema<string>;
|
|
3724
|
-
}>, l.ObjectSchema<{
|
|
3725
|
-
readonly type: l.LiteralSchema<"blob">;
|
|
3726
|
-
readonly accept: l.OptionalSchema<string[]>;
|
|
3727
|
-
readonly maxSize: l.OptionalSchema<number>;
|
|
3728
|
-
readonly description: l.OptionalSchema<string>;
|
|
3729
|
-
}>, l.ObjectSchema<{
|
|
3730
|
-
readonly type: l.LiteralSchema<"unknown">;
|
|
3731
|
-
readonly description: l.OptionalSchema<string>;
|
|
3732
|
-
}>, l.ObjectSchema<{
|
|
3733
|
-
readonly type: l.LiteralSchema<"ref">;
|
|
3734
|
-
readonly ref: l.StringSchema<{}>;
|
|
3735
|
-
readonly description: l.OptionalSchema<string>;
|
|
3736
|
-
}>, l.ObjectSchema<{
|
|
3737
|
-
readonly type: l.LiteralSchema<"union">;
|
|
3738
|
-
readonly refs: l.ArraySchema<l.StringSchema<{}>>;
|
|
3739
|
-
readonly closed: l.OptionalSchema<boolean>;
|
|
3740
|
-
readonly description: l.OptionalSchema<string>;
|
|
3741
|
-
}>, l.ObjectSchema<{
|
|
3742
|
-
readonly type: l.LiteralSchema<"array">;
|
|
3743
|
-
readonly items: l.DiscriminatedUnionSchema<"type", readonly [l.ObjectSchema<{
|
|
3744
|
-
readonly type: l.LiteralSchema<"boolean">;
|
|
3745
|
-
readonly default: l.OptionalSchema<boolean>;
|
|
3746
|
-
readonly const: l.OptionalSchema<boolean>;
|
|
3747
|
-
readonly description: l.OptionalSchema<string>;
|
|
3748
|
-
}>, l.ObjectSchema<{
|
|
3749
|
-
readonly type: l.LiteralSchema<"integer">;
|
|
3750
|
-
readonly default: l.OptionalSchema<number>;
|
|
3751
|
-
readonly minimum: l.OptionalSchema<number>;
|
|
3752
|
-
readonly maximum: l.OptionalSchema<number>;
|
|
3753
|
-
readonly enum: l.OptionalSchema<number[]>;
|
|
3754
|
-
readonly const: l.OptionalSchema<number>;
|
|
3755
|
-
readonly description: l.OptionalSchema<string>;
|
|
3756
|
-
}>, l.ObjectSchema<{
|
|
3757
|
-
readonly type: l.LiteralSchema<"string">;
|
|
3758
|
-
readonly format: l.OptionalSchema<"datetime" | "uri" | "at-uri" | "did" | "handle" | "at-identifier" | "nsid" | "cid" | "language" | "tid" | "record-key">;
|
|
3759
|
-
readonly default: l.OptionalSchema<string>;
|
|
3760
|
-
readonly minLength: l.OptionalSchema<number>;
|
|
3761
|
-
readonly maxLength: l.OptionalSchema<number>;
|
|
3762
|
-
readonly minGraphemes: l.OptionalSchema<number>;
|
|
3763
|
-
readonly maxGraphemes: l.OptionalSchema<number>;
|
|
3764
|
-
readonly enum: l.OptionalSchema<string[]>;
|
|
3765
|
-
readonly const: l.OptionalSchema<string>;
|
|
3766
|
-
readonly knownValues: l.OptionalSchema<string[]>;
|
|
3767
|
-
readonly description: l.OptionalSchema<string>;
|
|
3768
|
-
}>, l.ObjectSchema<{
|
|
3769
|
-
readonly type: l.LiteralSchema<"bytes">;
|
|
3770
|
-
readonly maxLength: l.OptionalSchema<number>;
|
|
3771
|
-
readonly minLength: l.OptionalSchema<number>;
|
|
3772
|
-
readonly description: l.OptionalSchema<string>;
|
|
3773
|
-
}>, l.ObjectSchema<{
|
|
3774
|
-
readonly type: l.LiteralSchema<"cid-link">;
|
|
3775
|
-
readonly description: l.OptionalSchema<string>;
|
|
3776
|
-
}>, l.ObjectSchema<{
|
|
3777
|
-
readonly type: l.LiteralSchema<"blob">;
|
|
3778
|
-
readonly accept: l.OptionalSchema<string[]>;
|
|
3779
|
-
readonly maxSize: l.OptionalSchema<number>;
|
|
3780
|
-
readonly description: l.OptionalSchema<string>;
|
|
3781
|
-
}>, l.ObjectSchema<{
|
|
3782
|
-
readonly type: l.LiteralSchema<"unknown">;
|
|
3783
|
-
readonly description: l.OptionalSchema<string>;
|
|
3784
|
-
}>, l.ObjectSchema<{
|
|
3785
|
-
readonly type: l.LiteralSchema<"ref">;
|
|
3786
|
-
readonly ref: l.StringSchema<{}>;
|
|
3787
|
-
readonly description: l.OptionalSchema<string>;
|
|
3788
|
-
}>, l.ObjectSchema<{
|
|
3789
|
-
readonly type: l.LiteralSchema<"union">;
|
|
3790
|
-
readonly refs: l.ArraySchema<l.StringSchema<{}>>;
|
|
3791
|
-
readonly closed: l.OptionalSchema<boolean>;
|
|
3792
|
-
readonly description: l.OptionalSchema<string>;
|
|
3793
|
-
}>]>;
|
|
3794
|
-
readonly minLength: l.OptionalSchema<number>;
|
|
3795
|
-
readonly maxLength: l.OptionalSchema<number>;
|
|
3796
|
-
readonly description: l.OptionalSchema<string>;
|
|
3797
|
-
}>]>>;
|
|
3798
|
-
required?: string[] | undefined;
|
|
3799
|
-
nullable?: string[] | undefined;
|
|
3800
|
-
description?: string | undefined;
|
|
3801
|
-
} | undefined;
|
|
3802
|
-
} | undefined;
|
|
3803
3329
|
errors?: {
|
|
3804
3330
|
name: string;
|
|
3805
3331
|
description?: string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lexicon-document.d.ts","sourceRoot":"","sources":["../src/lexicon-document.ts"],"names":[],"mappings":"AAAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAchC,CAAA;AACF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAA"}
|
package/dist/lexicon-document.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.lexiconDocumentSchema = exports.lexiconIdentifierSchema = exports.lexiconSubscriptionSchema = exports.lexiconProcedureSchema = exports.lexiconQuerySchema = exports.lexiconError = exports.
|
|
3
|
+
exports.lexiconDocumentSchema = exports.lexiconIdentifierSchema = exports.lexiconSubscriptionSchema = exports.lexiconProcedureSchema = exports.lexiconQuerySchema = exports.lexiconError = exports.lexiconPayload = exports.lexiconParameters = exports.lexiconRecordSchema = exports.lexiconRecordKeySchema = exports.lexiconObjectSchema = exports.lexiconArraySchema = exports.lexiconRefUnionSchema = exports.lexiconRefSchema = exports.lexiconTokenSchema = exports.lexiconUnknownSchema = exports.lexiconBlobSchema = exports.lexiconCidLinkSchema = exports.lexiconBytesSchema = exports.lexiconStringSchema = exports.lexiconIntegerSchema = exports.lexiconBooleanSchema = void 0;
|
|
4
4
|
const lex_schema_1 = require("@atproto/lex-schema");
|
|
5
5
|
// Re-usable shortcuts (avoid creating too many schemas)
|
|
6
6
|
const bool = lex_schema_1.l.boolean();
|
|
@@ -155,14 +155,6 @@ exports.lexiconPayload = lex_schema_1.l.object({
|
|
|
155
155
|
])),
|
|
156
156
|
description: strOpt,
|
|
157
157
|
});
|
|
158
|
-
exports.lexiconSubscriptionMessage = lex_schema_1.l.object({
|
|
159
|
-
description: strOpt,
|
|
160
|
-
schema: lex_schema_1.l.optional(lex_schema_1.l.discriminatedUnion('type', [
|
|
161
|
-
exports.lexiconRefSchema,
|
|
162
|
-
exports.lexiconRefUnionSchema,
|
|
163
|
-
exports.lexiconObjectSchema,
|
|
164
|
-
])),
|
|
165
|
-
});
|
|
166
158
|
exports.lexiconError = lex_schema_1.l.object({
|
|
167
159
|
name: lex_schema_1.l.string({ minLength: 1 }),
|
|
168
160
|
description: strOpt,
|
|
@@ -186,7 +178,10 @@ exports.lexiconSubscriptionSchema = lex_schema_1.l.object({
|
|
|
186
178
|
type: lex_schema_1.l.literal('subscription'),
|
|
187
179
|
description: strOpt,
|
|
188
180
|
parameters: lex_schema_1.l.optional(exports.lexiconParameters),
|
|
189
|
-
message: lex_schema_1.l.
|
|
181
|
+
message: lex_schema_1.l.object({
|
|
182
|
+
description: strOpt,
|
|
183
|
+
schema: exports.lexiconRefUnionSchema,
|
|
184
|
+
}),
|
|
190
185
|
errors: lex_schema_1.l.optional(lex_schema_1.l.array(exports.lexiconError)),
|
|
191
186
|
});
|
|
192
187
|
// Permissions
|
|
@@ -1 +1 @@
|
|
|
1
|
-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;IACb,YAAY,EAAE,cAAC,CAAC,QAAQ,CAAC,mBAAmB,CAAC;IAC7C,MAAM,EAAE,MAAM;IACd,aAAa,EAAE,cAAC,CAAC,QAAQ,CAAC,mBAAmB,CAAC;IAC9C,WAAW,EAAE,MAAM;CACpB,CAAC,CAAA;AAIF,+CAA+C;AAC/C,MAAM,qBAAqB,GAAG;IAC5B,GAAG,cAAc;IACjB,0BAAkB;IAClB,2BAAmB;IACnB,0BAAkB;CACV,CAAA;AAMV,6CAA6C;AAC7C,MAAM,oBAAoB,GAAG;IAC3B,0BAA0B;IAC1B,8BAAsB;IACtB,0BAAkB;IAClB,2BAAmB;IACnB,iCAAyB;IACzB,GAAG,qBAAqB;CAChB,CAAA;AAMG,QAAA,uBAAuB,GAAG,cAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAA;AAGtD,QAAA,qBAAqB,GAAG,cAAC,CAAC,MAAM,CAAC;IAC5C,OAAO,EAAE,cAAC,CAAC,OAAO,CAAC,CAAC,CAAC;IACrB,EAAE,EAAE,+BAAuB;IAC3B,QAAQ,EAAE,MAAM;IAChB,WAAW,EAAE,MAAM;IACnB,IAAI,EAAE,cAAC,CAAC,YAAY,CAClB,cAAC,CAAC,MAAM,CAAC;QACP,IAAI,EAAE,cAAC,CAAC,QAAQ,CAAC,cAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC;KACrE,CAAC,EACF,cAAC,CAAC,IAAI,CACJ,cAAC,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC,EAC1B,cAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE,qBAAqB,CAAC,CACpD,CACF;CACF,CAAC,CAAA","sourcesContent":["import { l } from '@atproto/lex-schema'\n\n// Re-usable shortcuts (avoid creating too many schemas)\n\nconst bool = l.boolean()\nconst int = l.integer()\nconst str = l.string()\n\nconst boopOpt = l.optional(bool)\nconst intOpt = l.optional(int)\nconst strOpt = l.optional(str)\n\nconst strArrOpt = l.optional(l.array(str))\n\n// https://atproto.com/specs/lexicon\n\n// \"Concrete\" Types\n\nexport const lexiconBooleanSchema = l.object({\n type: l.literal('boolean'),\n default: boopOpt,\n const: boopOpt,\n description: strOpt,\n})\nexport type LexiconBoolean = l.Infer<typeof lexiconBooleanSchema>\n\nexport const lexiconIntegerSchema = l.object({\n type: l.literal('integer'),\n default: intOpt,\n minimum: intOpt,\n maximum: intOpt,\n enum: l.optional(l.array(l.integer())),\n const: intOpt,\n description: strOpt,\n})\nexport type LexiconInteger = l.Infer<typeof lexiconIntegerSchema>\n\nexport const lexiconStringSchema = l.object({\n type: l.literal('string'),\n format: l.optional(l.enum<l.StringFormat>(l.STRING_FORMATS)),\n default: strOpt,\n minLength: intOpt,\n maxLength: intOpt,\n minGraphemes: intOpt,\n maxGraphemes: intOpt,\n enum: strArrOpt,\n const: strOpt,\n knownValues: strArrOpt,\n description: strOpt,\n})\nexport type LexiconString = l.Infer<typeof lexiconStringSchema>\n\nexport const lexiconBytesSchema = l.object({\n type: l.literal('bytes'),\n maxLength: intOpt,\n minLength: intOpt,\n description: strOpt,\n})\nexport type LexiconBytes = l.Infer<typeof lexiconBytesSchema>\n\nexport const lexiconCidLinkSchema = l.object({\n type: l.literal('cid-link'),\n description: strOpt,\n})\nexport type LexiconCid = l.Infer<typeof lexiconCidLinkSchema>\n\nexport const lexiconBlobSchema = l.object({\n type: l.literal('blob'),\n accept: strArrOpt,\n maxSize: intOpt,\n description: strOpt,\n})\nexport type LexiconBlob = l.Infer<typeof lexiconBlobSchema>\n\nconst CONCRETE_TYPES = [\n lexiconBooleanSchema,\n lexiconIntegerSchema,\n lexiconStringSchema,\n // Lexicon (DAG-CBOR)\n lexiconBytesSchema,\n lexiconCidLinkSchema,\n // Lexicon Specific\n lexiconBlobSchema,\n] as const\n\n// Meta types\n\nexport const lexiconUnknownSchema = l.object({\n type: l.literal('unknown'),\n description: strOpt,\n})\nexport type LexiconUnknown = l.Infer<typeof lexiconUnknownSchema>\n\nexport const lexiconTokenSchema = l.object({\n type: l.literal('token'),\n description: strOpt,\n})\nexport type LexiconToken = l.Infer<typeof lexiconTokenSchema>\n\nexport const lexiconRefSchema = l.object({\n type: l.literal('ref'),\n ref: str,\n description: strOpt,\n})\nexport type LexiconRef = l.Infer<typeof lexiconRefSchema>\n\nexport const lexiconRefUnionSchema = l.object({\n type: l.literal('union'),\n refs: l.array(str),\n closed: boopOpt,\n description: strOpt,\n})\nexport type LexiconRefUnion = l.Infer<typeof lexiconRefUnionSchema>\n\n// Complex Types\n\nconst ARRAY_ITEMS_SCHEMAS = [\n ...CONCRETE_TYPES,\n // Meta\n lexiconUnknownSchema,\n lexiconRefSchema,\n lexiconRefUnionSchema,\n] as const\n\nexport type LexiconArrayItems = l.Infer<(typeof ARRAY_ITEMS_SCHEMAS)[number]>\n\nexport const lexiconArraySchema = l.object({\n type: l.literal('array'),\n items: l.discriminatedUnion('type', ARRAY_ITEMS_SCHEMAS),\n minLength: intOpt,\n maxLength: intOpt,\n description: strOpt,\n})\nexport type LexiconArray = l.Infer<typeof lexiconArraySchema>\n\nconst requirePropertiesRefinement: l.RefinementCheck<{\n required?: string[]\n properties: Record<string, unknown>\n}> = {\n check: (v) => !v.required || v.required.every((k) => k in v.properties),\n message: 'All required parameters must be defined in properties',\n path: 'required',\n}\n\nexport const lexiconObjectSchema = l.refine(\n l.object({\n type: l.literal('object'),\n properties: l.dict(\n str,\n l.discriminatedUnion('type', [\n ...ARRAY_ITEMS_SCHEMAS,\n lexiconArraySchema,\n ]),\n ),\n required: strArrOpt,\n nullable: strArrOpt,\n description: strOpt,\n }),\n requirePropertiesRefinement,\n)\nexport type LexiconObject = l.Infer<typeof lexiconObjectSchema>\n\n// Records\n\nexport const lexiconRecordKeySchema = l.custom(\n l.isLexiconRecordKey,\n 'Invalid record key definition (must be \"any\", \"nsid\", \"tid\", or \"literal:<string>\")',\n)\n\nexport type LexiconRecordKey = l.LexiconRecordKey\n\nexport const lexiconRecordSchema = l.object({\n type: l.literal('record'),\n record: lexiconObjectSchema,\n description: strOpt,\n key: lexiconRecordKeySchema,\n})\nexport type LexiconRecord = l.Infer<typeof lexiconRecordSchema>\n\n// XRPC Methods\n\nexport const lexiconParameters = l.refine(\n l.object({\n type: l.literal('params'),\n properties: l.dict(\n str,\n l.discriminatedUnion('type', [\n lexiconBooleanSchema,\n lexiconIntegerSchema,\n lexiconStringSchema,\n l.object({\n type: l.literal('array'),\n items: l.discriminatedUnion('type', [\n lexiconBooleanSchema,\n lexiconIntegerSchema,\n lexiconStringSchema,\n ]),\n minLength: intOpt,\n maxLength: intOpt,\n description: strOpt,\n }),\n ]),\n ),\n required: strArrOpt,\n description: strOpt,\n }),\n requirePropertiesRefinement,\n)\nexport type LexiconParameters = l.Infer<typeof lexiconParameters>\n\nexport const lexiconPayload = l.object({\n encoding: str,\n schema: l.optional(\n l.discriminatedUnion('type', [\n lexiconRefSchema,\n lexiconRefUnionSchema,\n lexiconObjectSchema,\n ]),\n ),\n description: strOpt,\n})\nexport type LexiconPayload = l.Infer<typeof lexiconPayload>\n\nexport const lexiconSubscriptionMessage = l.object({\n description: strOpt,\n schema: l.optional(\n l.discriminatedUnion('type', [\n lexiconRefSchema,\n lexiconRefUnionSchema,\n lexiconObjectSchema,\n ]),\n ),\n})\nexport type LexiconSubscriptionMessage = l.Infer<\n typeof lexiconSubscriptionMessage\n>\n\nexport const lexiconError = l.object({\n name: l.string({ minLength: 1 }),\n description: strOpt,\n})\nexport type LexiconError = l.Infer<typeof lexiconError>\n\nexport const lexiconQuerySchema = l.object({\n type: l.literal('query'),\n parameters: l.optional(lexiconParameters),\n output: l.optional(lexiconPayload),\n errors: l.optional(l.array(lexiconError)),\n description: strOpt,\n})\nexport type LexiconQuery = l.Infer<typeof lexiconQuerySchema>\n\nexport const lexiconProcedureSchema = l.object({\n type: l.literal('procedure'),\n parameters: l.optional(lexiconParameters),\n input: l.optional(lexiconPayload),\n output: l.optional(lexiconPayload),\n errors: l.optional(l.array(lexiconError)),\n description: strOpt,\n})\nexport type LexiconProcedure = l.Infer<typeof lexiconProcedureSchema>\n\nexport const lexiconSubscriptionSchema = l.object({\n type: l.literal('subscription'),\n description: strOpt,\n parameters: l.optional(lexiconParameters),\n message: l.optional(lexiconSubscriptionMessage),\n errors: l.optional(l.array(lexiconError)),\n})\n\nexport type LexiconSubscription = l.Infer<typeof lexiconSubscriptionSchema>\n\n// Permissions\n\nconst lexiconLanguageSchema = l.string({ format: 'language' })\n\nexport type LexiconLanguage = l.Infer<typeof lexiconLanguageSchema>\n\nconst lexiconLanguageDict = l.dict(lexiconLanguageSchema, str)\n\nexport type LexiconLanguageDict = l.Infer<typeof lexiconLanguageDict>\n\nconst lexiconPermissionSchema = l.intersection(\n l.object({\n type: l.literal('permission'),\n resource: l.string({ minLength: 1 }),\n }),\n l.paramsSchema,\n)\n\nexport type LexiconPermission = l.Infer<typeof lexiconPermissionSchema>\n\nconst lexiconPermissionSetSchema = l.object({\n type: l.literal('permission-set'),\n permissions: l.array(lexiconPermissionSchema),\n title: strOpt,\n 'title:lang': l.optional(lexiconLanguageDict),\n detail: strOpt,\n 'detail:lang': l.optional(lexiconLanguageDict),\n description: strOpt,\n})\n\nexport type LexiconPermissionSet = l.Infer<typeof lexiconPermissionSetSchema>\n\n// Schemas that can appear anywhere in the defs\nconst NAMED_LEXICON_SCHEMAS = [\n ...CONCRETE_TYPES,\n lexiconArraySchema,\n lexiconObjectSchema,\n lexiconTokenSchema,\n] as const\n\nexport type NamedLexiconDefinition = l.Infer<\n (typeof NAMED_LEXICON_SCHEMAS)[number]\n>\n\n// Schemas that can only appear as \"main\" def\nconst MAIN_LEXICON_SCHEMAS = [\n lexiconPermissionSetSchema,\n lexiconProcedureSchema,\n lexiconQuerySchema,\n lexiconRecordSchema,\n lexiconSubscriptionSchema,\n ...NAMED_LEXICON_SCHEMAS,\n] as const\n\nexport type MainLexiconDefinition = l.Infer<\n (typeof MAIN_LEXICON_SCHEMAS)[number]\n>\n\nexport const lexiconIdentifierSchema = l.string({ format: 'nsid' })\nexport type LexiconIdentifier = l.Infer<typeof lexiconIdentifierSchema>\n\nexport const lexiconDocumentSchema = l.object({\n lexicon: l.literal(1),\n id: lexiconIdentifierSchema,\n revision: intOpt,\n description: strOpt,\n defs: l.intersection(\n l.object({\n main: l.optional(l.discriminatedUnion('type', MAIN_LEXICON_SCHEMAS)),\n }),\n l.dict(\n l.string({ minLength: 1 }),\n l.discriminatedUnion('type', NAMED_LEXICON_SCHEMAS),\n ),\n ),\n})\nexport type LexiconDocument = l.Infer<typeof lexiconDocumentSchema>\n"]}
|
|
1
|
+
{"version":3,"file":"lexicon-document.js","sourceRoot":"","sources":["../src/lexicon-document.ts"],"names":[],"mappings":";;;AAAA,oDAAuC;AAEvC,wDAAwD;AAExD,MAAM,IAAI,GAAG,cAAC,CAAC,OAAO,EAAE,CAAA;AACxB,MAAM,GAAG,GAAG,cAAC,CAAC,OAAO,EAAE,CAAA;AACvB,MAAM,GAAG,GAAG,cAAC,CAAC,MAAM,EAAE,CAAA;AAEtB,MAAM,OAAO,GAAG,cAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;AAChC,MAAM,MAAM,GAAG,cAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAA;AAC9B,MAAM,MAAM,GAAG,cAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAA;AAE9B,MAAM,SAAS,GAAG,cAAC,CAAC,QAAQ,CAAC,cAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAA;AAE1C,oCAAoC;AAEpC,mBAAmB;AAEN,QAAA,oBAAoB,GAAG,cAAC,CAAC,MAAM,CAAC;IAC3C,IAAI,EAAE,cAAC,CAAC,OAAO,CAAC,SAAS,CAAC;IAC1B,OAAO,EAAE,OAAO;IAChB,KAAK,EAAE,OAAO;IACd,WAAW,EAAE,MAAM;CACpB,CAAC,CAAA;AAGW,QAAA,oBAAoB,GAAG,cAAC,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kB,CAAC,MAAM,EAAE,qBAAqB,CAAC,CACpD,CACF;CACF,CAAC,CAAA","sourcesContent":["import { l } from '@atproto/lex-schema'\n\n// Re-usable shortcuts (avoid creating too many schemas)\n\nconst bool = l.boolean()\nconst int = l.integer()\nconst str = l.string()\n\nconst boopOpt = l.optional(bool)\nconst intOpt = l.optional(int)\nconst strOpt = l.optional(str)\n\nconst strArrOpt = l.optional(l.array(str))\n\n// https://atproto.com/specs/lexicon\n\n// \"Concrete\" Types\n\nexport const lexiconBooleanSchema = l.object({\n type: l.literal('boolean'),\n default: boopOpt,\n const: boopOpt,\n description: strOpt,\n})\nexport type LexiconBoolean = l.Infer<typeof lexiconBooleanSchema>\n\nexport const lexiconIntegerSchema = l.object({\n type: l.literal('integer'),\n default: intOpt,\n minimum: intOpt,\n maximum: intOpt,\n enum: l.optional(l.array(l.integer())),\n const: intOpt,\n description: strOpt,\n})\nexport type LexiconInteger = l.Infer<typeof lexiconIntegerSchema>\n\nexport const lexiconStringSchema = l.object({\n type: l.literal('string'),\n format: l.optional(l.enum<l.StringFormat>(l.STRING_FORMATS)),\n default: strOpt,\n minLength: intOpt,\n maxLength: intOpt,\n minGraphemes: intOpt,\n maxGraphemes: intOpt,\n enum: strArrOpt,\n const: strOpt,\n knownValues: strArrOpt,\n description: strOpt,\n})\nexport type LexiconString = l.Infer<typeof lexiconStringSchema>\n\nexport const lexiconBytesSchema = l.object({\n type: l.literal('bytes'),\n maxLength: intOpt,\n minLength: intOpt,\n description: strOpt,\n})\nexport type LexiconBytes = l.Infer<typeof lexiconBytesSchema>\n\nexport const lexiconCidLinkSchema = l.object({\n type: l.literal('cid-link'),\n description: strOpt,\n})\nexport type LexiconCid = l.Infer<typeof lexiconCidLinkSchema>\n\nexport const lexiconBlobSchema = l.object({\n type: l.literal('blob'),\n accept: strArrOpt,\n maxSize: intOpt,\n description: strOpt,\n})\nexport type LexiconBlob = l.Infer<typeof lexiconBlobSchema>\n\nconst CONCRETE_TYPES = [\n lexiconBooleanSchema,\n lexiconIntegerSchema,\n lexiconStringSchema,\n // Lexicon (DAG-CBOR)\n lexiconBytesSchema,\n lexiconCidLinkSchema,\n // Lexicon Specific\n lexiconBlobSchema,\n] as const\n\n// Meta types\n\nexport const lexiconUnknownSchema = l.object({\n type: l.literal('unknown'),\n description: strOpt,\n})\nexport type LexiconUnknown = l.Infer<typeof lexiconUnknownSchema>\n\nexport const lexiconTokenSchema = l.object({\n type: l.literal('token'),\n description: strOpt,\n})\nexport type LexiconToken = l.Infer<typeof lexiconTokenSchema>\n\nexport const lexiconRefSchema = l.object({\n type: l.literal('ref'),\n ref: str,\n description: strOpt,\n})\nexport type LexiconRef = l.Infer<typeof lexiconRefSchema>\n\nexport const lexiconRefUnionSchema = l.object({\n type: l.literal('union'),\n refs: l.array(str),\n closed: boopOpt,\n description: strOpt,\n})\nexport type LexiconRefUnion = l.Infer<typeof lexiconRefUnionSchema>\n\n// Complex Types\n\nconst ARRAY_ITEMS_SCHEMAS = [\n ...CONCRETE_TYPES,\n // Meta\n lexiconUnknownSchema,\n lexiconRefSchema,\n lexiconRefUnionSchema,\n] as const\n\nexport type LexiconArrayItems = l.Infer<(typeof ARRAY_ITEMS_SCHEMAS)[number]>\n\nexport const lexiconArraySchema = l.object({\n type: l.literal('array'),\n items: l.discriminatedUnion('type', ARRAY_ITEMS_SCHEMAS),\n minLength: intOpt,\n maxLength: intOpt,\n description: strOpt,\n})\nexport type LexiconArray = l.Infer<typeof lexiconArraySchema>\n\nconst requirePropertiesRefinement: l.RefinementCheck<{\n required?: string[]\n properties: Record<string, unknown>\n}> = {\n check: (v) => !v.required || v.required.every((k) => k in v.properties),\n message: 'All required parameters must be defined in properties',\n path: 'required',\n}\n\nexport const lexiconObjectSchema = l.refine(\n l.object({\n type: l.literal('object'),\n properties: l.dict(\n str,\n l.discriminatedUnion('type', [\n ...ARRAY_ITEMS_SCHEMAS,\n lexiconArraySchema,\n ]),\n ),\n required: strArrOpt,\n nullable: strArrOpt,\n description: strOpt,\n }),\n requirePropertiesRefinement,\n)\nexport type LexiconObject = l.Infer<typeof lexiconObjectSchema>\n\n// Records\n\nexport const lexiconRecordKeySchema = l.custom(\n l.isLexiconRecordKey,\n 'Invalid record key definition (must be \"any\", \"nsid\", \"tid\", or \"literal:<string>\")',\n)\n\nexport type LexiconRecordKey = l.LexiconRecordKey\n\nexport const lexiconRecordSchema = l.object({\n type: l.literal('record'),\n record: lexiconObjectSchema,\n description: strOpt,\n key: lexiconRecordKeySchema,\n})\nexport type LexiconRecord = l.Infer<typeof lexiconRecordSchema>\n\n// XRPC Methods\n\nexport const lexiconParameters = l.refine(\n l.object({\n type: l.literal('params'),\n properties: l.dict(\n str,\n l.discriminatedUnion('type', [\n lexiconBooleanSchema,\n lexiconIntegerSchema,\n lexiconStringSchema,\n l.object({\n type: l.literal('array'),\n items: l.discriminatedUnion('type', [\n lexiconBooleanSchema,\n lexiconIntegerSchema,\n lexiconStringSchema,\n ]),\n minLength: intOpt,\n maxLength: intOpt,\n description: strOpt,\n }),\n ]),\n ),\n required: strArrOpt,\n description: strOpt,\n }),\n requirePropertiesRefinement,\n)\nexport type LexiconParameters = l.Infer<typeof lexiconParameters>\n\nexport const lexiconPayload = l.object({\n encoding: str,\n schema: l.optional(\n l.discriminatedUnion('type', [\n lexiconRefSchema,\n lexiconRefUnionSchema,\n lexiconObjectSchema,\n ]),\n ),\n description: strOpt,\n})\nexport type LexiconPayload = l.Infer<typeof lexiconPayload>\n\nexport const lexiconError = l.object({\n name: l.string({ minLength: 1 }),\n description: strOpt,\n})\nexport type LexiconError = l.Infer<typeof lexiconError>\n\nexport const lexiconQuerySchema = l.object({\n type: l.literal('query'),\n parameters: l.optional(lexiconParameters),\n output: l.optional(lexiconPayload),\n errors: l.optional(l.array(lexiconError)),\n description: strOpt,\n})\nexport type LexiconQuery = l.Infer<typeof lexiconQuerySchema>\n\nexport const lexiconProcedureSchema = l.object({\n type: l.literal('procedure'),\n parameters: l.optional(lexiconParameters),\n input: l.optional(lexiconPayload),\n output: l.optional(lexiconPayload),\n errors: l.optional(l.array(lexiconError)),\n description: strOpt,\n})\nexport type LexiconProcedure = l.Infer<typeof lexiconProcedureSchema>\n\nexport const lexiconSubscriptionSchema = l.object({\n type: l.literal('subscription'),\n description: strOpt,\n parameters: l.optional(lexiconParameters),\n message: l.object({\n description: strOpt,\n schema: lexiconRefUnionSchema,\n }),\n errors: l.optional(l.array(lexiconError)),\n})\n\nexport type LexiconSubscription = l.Infer<typeof lexiconSubscriptionSchema>\n\n// Permissions\n\nconst lexiconLanguageSchema = l.string({ format: 'language' })\n\nexport type LexiconLanguage = l.Infer<typeof lexiconLanguageSchema>\n\nconst lexiconLanguageDict = l.dict(lexiconLanguageSchema, str)\n\nexport type LexiconLanguageDict = l.Infer<typeof lexiconLanguageDict>\n\nconst lexiconPermissionSchema = l.intersection(\n l.object({\n type: l.literal('permission'),\n resource: l.string({ minLength: 1 }),\n }),\n l.paramsSchema,\n)\n\nexport type LexiconPermission = l.Infer<typeof lexiconPermissionSchema>\n\nconst lexiconPermissionSetSchema = l.object({\n type: l.literal('permission-set'),\n permissions: l.array(lexiconPermissionSchema),\n title: strOpt,\n 'title:lang': l.optional(lexiconLanguageDict),\n detail: strOpt,\n 'detail:lang': l.optional(lexiconLanguageDict),\n description: strOpt,\n})\n\nexport type LexiconPermissionSet = l.Infer<typeof lexiconPermissionSetSchema>\n\n// Schemas that can appear anywhere in the defs\nconst NAMED_LEXICON_SCHEMAS = [\n ...CONCRETE_TYPES,\n lexiconArraySchema,\n lexiconObjectSchema,\n lexiconTokenSchema,\n] as const\n\nexport type NamedLexiconDefinition = l.Infer<\n (typeof NAMED_LEXICON_SCHEMAS)[number]\n>\n\n// Schemas that can only appear as \"main\" def\nconst MAIN_LEXICON_SCHEMAS = [\n lexiconPermissionSetSchema,\n lexiconProcedureSchema,\n lexiconQuerySchema,\n lexiconRecordSchema,\n lexiconSubscriptionSchema,\n ...NAMED_LEXICON_SCHEMAS,\n] as const\n\nexport type MainLexiconDefinition = l.Infer<\n (typeof MAIN_LEXICON_SCHEMAS)[number]\n>\n\nexport const lexiconIdentifierSchema = l.string({ format: 'nsid' })\nexport type LexiconIdentifier = l.Infer<typeof lexiconIdentifierSchema>\n\nexport const lexiconDocumentSchema = l.object({\n lexicon: l.literal(1),\n id: lexiconIdentifierSchema,\n revision: intOpt,\n description: strOpt,\n defs: l.intersection(\n l.object({\n main: l.optional(l.discriminatedUnion('type', MAIN_LEXICON_SCHEMAS)),\n }),\n l.dict(\n l.string({ minLength: 1 }),\n l.discriminatedUnion('type', NAMED_LEXICON_SCHEMAS),\n ),\n ),\n})\nexport type LexiconDocument = l.Infer<typeof lexiconDocumentSchema>\n"]}
|
|
@@ -18,21 +18,21 @@ export declare class LexiconSchemaBuilder {
|
|
|
18
18
|
#private;
|
|
19
19
|
protected indexer: LexiconIndexer;
|
|
20
20
|
static build(indexer: LexiconIndexer, fullRef: string): Promise<l.Validator<unknown>>;
|
|
21
|
-
static buildAll(indexer: LexiconIndexer): Promise<Map<string, l.Validator<unknown> | l.Query<
|
|
21
|
+
static buildAll(indexer: LexiconIndexer): Promise<Map<string, l.Validator<unknown> | l.Query<`${string}.${string}.${string}`, l.ParamsSchema<l.ParamsSchemaShape>, l.Payload<string | undefined, l.Schema<any> | undefined>, readonly string[] | undefined> | l.Subscription<`${string}.${string}.${string}`, l.ParamsSchema<l.ParamsSchemaShape>, l.Schema<any>, readonly string[] | undefined> | l.Procedure<`${string}.${string}.${string}`, l.ParamsSchema<l.ParamsSchemaShape>, l.Payload<string | undefined, l.Schema<any> | undefined>, l.Payload<string | undefined, l.Schema<any> | undefined>, readonly string[] | undefined> | l.PermissionSet<any, any>>>;
|
|
22
22
|
constructor(indexer: LexiconIndexer);
|
|
23
23
|
done(): Promise<void>;
|
|
24
24
|
buildFullRef: (fullRef: string) => Promise<l.Validator<unknown> | l.PermissionSet<`${string}.${string}.${string}`, l.Permission<string, {
|
|
25
25
|
[x: string]: string | number | boolean | (string | number | boolean)[];
|
|
26
|
-
}>[]> | l.Procedure<`${string}.${string}.${string}`, l.ParamsSchema<{}>, l.Payload<string | undefined, l.
|
|
26
|
+
}>[]> | l.Procedure<`${string}.${string}.${string}`, l.ParamsSchema<{}>, l.Payload<string | undefined, l.Schema<any> | undefined>, l.Payload<string | undefined, l.Schema<any> | undefined>, string[]> | l.Query<`${string}.${string}.${string}`, l.ParamsSchema<{}>, l.Payload<string | undefined, l.Schema<any> | undefined>, string[]> | l.Subscription<`${string}.${string}.${string}`, l.ParamsSchema<{}>, l.ObjectSchema<any> | l.RefSchema<unknown> | l.TypedUnionSchema<l.TypedRefSchema<{
|
|
27
27
|
[x: string]: any;
|
|
28
|
-
}>[], boolean
|
|
28
|
+
}>[], boolean>, string[]>>;
|
|
29
29
|
protected buildRefGetter(fullRef: string): () => l.Validator<unknown>;
|
|
30
30
|
protected buildTypedRefGetter(fullRef: string): () => l.TypedObjectSchema | l.RecordSchema;
|
|
31
31
|
protected compileDef(doc: LexiconDocument, hash: string): l.Validator<unknown> | l.PermissionSet<`${string}.${string}.${string}`, l.Permission<string, {
|
|
32
32
|
[x: string]: string | number | boolean | (string | number | boolean)[];
|
|
33
|
-
}>[]> | l.Procedure<`${string}.${string}.${string}`, l.ParamsSchema<{}>, l.Payload<string | undefined, l.
|
|
33
|
+
}>[]> | l.Procedure<`${string}.${string}.${string}`, l.ParamsSchema<{}>, l.Payload<string | undefined, l.Schema<any> | undefined>, l.Payload<string | undefined, l.Schema<any> | undefined>, string[]> | l.Query<`${string}.${string}.${string}`, l.ParamsSchema<{}>, l.Payload<string | undefined, l.Schema<any> | undefined>, string[]> | l.Subscription<`${string}.${string}.${string}`, l.ParamsSchema<{}>, l.ObjectSchema<any> | l.RefSchema<unknown> | l.TypedUnionSchema<l.TypedRefSchema<{
|
|
34
34
|
[x: string]: any;
|
|
35
|
-
}>[], boolean
|
|
35
|
+
}>[], boolean>, string[]>;
|
|
36
36
|
protected compileLeaf(doc: LexiconDocument, def: LexiconArray | LexiconArrayItems): l.Validator<unknown>;
|
|
37
37
|
protected compileRef(doc: LexiconDocument, def: LexiconRef | LexiconRefUnion): l.RefSchema<unknown> | l.TypedUnionSchema<l.TypedRefSchema<{
|
|
38
38
|
[x: string]: any;
|
|
@@ -40,9 +40,9 @@ export declare class LexiconSchemaBuilder {
|
|
|
40
40
|
protected compileObject(doc: LexiconDocument, def: LexiconObject): l.ObjectSchema;
|
|
41
41
|
protected compilePayload(doc: LexiconDocument, def: LexiconPayload | undefined): l.Payload;
|
|
42
42
|
protected compileErrors(_doc: LexiconDocument, errors?: readonly LexiconError[]): undefined | string[];
|
|
43
|
-
protected compilePayloadSchema(doc: LexiconDocument, def
|
|
43
|
+
protected compilePayloadSchema(doc: LexiconDocument, def: LexiconObject | LexiconRef | LexiconRefUnion): l.ObjectSchema<any> | l.RefSchema<unknown> | l.TypedUnionSchema<l.TypedRefSchema<{
|
|
44
44
|
[x: string]: any;
|
|
45
|
-
}>[], boolean
|
|
45
|
+
}>[], boolean>;
|
|
46
46
|
protected compileParams(doc: LexiconDocument, def?: LexiconParameters): l.ParamsSchema<{}>;
|
|
47
47
|
}
|
|
48
48
|
export declare function memoize<Fn extends (arg: string) => unknown>(fn: Fn): Fn;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lexicon-schema-builder.d.ts","sourceRoot":"","sources":["../src/lexicon-schema-builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,qBAAqB,CAAA;AACvC,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,eAAe,EACf,YAAY,EACZ,aAAa,EACb,iBAAiB,EACjB,cAAc,EACd,UAAU,EACV,eAAe,EAChB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAErD;;;;;;;;;;;;GAYG;AACH,qBAAa,oBAAoB;;IA8CnB,SAAS,CAAC,OAAO,EAAE,cAAc;WA7ChC,KAAK,CAChB,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AAC,WAAW,CACnB,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,YAAY,GAAG,iBAAiB,GACpC,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC;IA0DvB,SAAS,CAAC,UAAU,CAClB,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,UAAU,GAAG,eAAe;;;IAkBnC,SAAS,CAAC,aAAa,CACrB,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,aAAa,GACjB,CAAC,CAAC,YAAY;IAuBjB,SAAS,CAAC,cAAc,CACtB,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,GAAG,SAAS,GAC9B,CAAC,CAAC,OAAO;IAOZ,SAAS,CAAC,aAAa,CACrB,IAAI,EAAE,eAAe,EACrB,MAAM,CAAC,EAAE,SAAS,YAAY,EAAE,GAC/B,SAAS,GAAG,MAAM,EAAE;IAIvB,SAAS,CAAC,oBAAoB,CAC5B,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,aAAa,GAAG,UAAU,GAAG,eAAe;;;IAUnD,SAAS,CAAC,aAAa,CAAC,GAAG,EAAE,eAAe,EAAE,GAAG,CAAC,EAAE,iBAAiB;CAmBtE;AA6CD,wBAAgB,OAAO,CAAC,EAAE,SAAS,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,CAQvE"}
|
|
@@ -106,7 +106,7 @@ class LexiconSchemaBuilder {
|
|
|
106
106
|
case 'query':
|
|
107
107
|
return lex_schema_1.l.query(doc.id, this.compileParams(doc, def.parameters), this.compilePayload(doc, def.output), this.compileErrors(doc, def.errors));
|
|
108
108
|
case 'subscription':
|
|
109
|
-
return lex_schema_1.l.subscription(doc.id, this.compileParams(doc, def.parameters), this.compilePayloadSchema(doc, def.message
|
|
109
|
+
return lex_schema_1.l.subscription(doc.id, this.compileParams(doc, def.parameters), this.compilePayloadSchema(doc, def.message.schema), this.compileErrors(doc, def.errors));
|
|
110
110
|
case 'token':
|
|
111
111
|
return lex_schema_1.l.token(doc.id, hash);
|
|
112
112
|
case 'record':
|
|
@@ -214,8 +214,6 @@ class LexiconSchemaBuilder {
|
|
|
214
214
|
return errors?.map((e) => e.name);
|
|
215
215
|
}
|
|
216
216
|
compilePayloadSchema(doc, def) {
|
|
217
|
-
if (!def)
|
|
218
|
-
return undefined;
|
|
219
217
|
switch (def.type) {
|
|
220
218
|
case 'object':
|
|
221
219
|
return this.compileObject(doc, def);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lexicon-schema-builder.js","sourceRoot":"","sources":["../src/lexicon-schema-builder.ts"],"names":[],"mappings":";;;AA0XA,0BAQC;AAlYD,oDAAuC;AAcvC;;;;;;;;;;;;GAYG;AACH,MAAa,oBAAoB;IA8CT;IA7CtB,MAAM,CAAC,KAAK,CAAC,KAAK,CAChB,OAAuB,EACvB,OAAe;QAEf,MAAM,GAAG,GAAG,IAAI,oBAAoB,CAAC,OAAO,CAAC,CAAA;QAC7C,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,YAAY,CAAC,OAAO,CAAC,CAAA;YAC9C,IAAI,CAAC,CAAC,MAAM,YAAY,cAAC,CAAC,MAAM,CAAC,EAAE,CAAC;gBAClC,MAAM,IAAI,KAAK,CAAC,OAAO,OAAO,uBAAuB,CAAC,CAAA;YACxD,CAAC;YACD,OAAO,MAAM,CAAA;QACf,CAAC;gBAAS,CAAC;YACT,MAAM,GAAG,CAAC,IAAI,EAAE,CAAA;QAClB,CAAC;IACH,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAuB;QAC3C,MAAM,OAAO,GAAG,IAAI,oBAAoB,CAAC,OAAO,CAAC,CAAA;QACjD,MAAM,OAAO,GAAG,IAAI,GAAG,EAOpB,CAAA;QACH,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,EAAE,CAAC;YACpC,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAA;QACz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,CAAC,CAAA;QACtB,OAAO,MAAM,CAAA;IACf,CAAC,CAAO,CAAA;AACV,CAAC;AAED,SAAS,qBAAqB,CAC5B,GAAM;IAEN,OAAO,CACL,GAAG,IAAI,IAAI;QACX,OAAO,GAAG,KAAK,QAAQ;QACvB,MAAM,CAAC,aAAa,IAAI,GAAG;QAC3B,OAAO,GAAG,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,UAAU,CAChD,CAAA;AACH,CAAC","sourcesContent":["import { l } from '@atproto/lex-schema'\nimport {\n LexiconArray,\n LexiconArrayItems,\n LexiconDocument,\n LexiconError,\n LexiconObject,\n LexiconParameters,\n LexiconPayload,\n LexiconRef,\n LexiconRefUnion,\n} from './lexicon-document.js'\nimport { LexiconIndexer } from './lexicon-indexer.js'\n\n/**\n * Builds a validator for a given lexicon \"ref\" from a lexicon indexer.\n *\n * @example\n *\n * ```ts\n * import { LexiconSchemaBuilder } from '@atproto/lex/doc'\n * import { LexiconStreamIndexer } from '@atproto/lex/doc'\n *\n * const indexer = new LexiconStreamIndexer(lexiconDocs)\n * const validator = await LexiconSchemaBuilder.build(indexer, 'com.example.foo#bar')\n * ```\n */\nexport class LexiconSchemaBuilder {\n static async build(\n indexer: LexiconIndexer,\n fullRef: string,\n ): Promise<l.Validator<unknown>> {\n const ctx = new LexiconSchemaBuilder(indexer)\n try {\n const result = await ctx.buildFullRef(fullRef)\n if (!(result instanceof l.Schema)) {\n throw new Error(`Ref ${fullRef} is not a schema type`)\n }\n return result\n } finally {\n await ctx.done()\n }\n }\n\n static async buildAll(indexer: LexiconIndexer) {\n const builder = new LexiconSchemaBuilder(indexer)\n const schemas = new Map<\n string,\n | l.Validator<unknown>\n | l.Query\n | l.Subscription\n | l.Procedure\n | l.PermissionSet\n >()\n if (!isAsyncIterableObject(indexer)) {\n throw new Error('An iterable indexer is required to build all schemas')\n }\n try {\n for await (const doc of indexer) {\n for (const hash of Object.keys(doc.defs)) {\n const fullRef = `${doc.id}#${hash}`\n const schema = await builder.buildFullRef(fullRef)\n schemas.set(fullRef, schema)\n }\n }\n return schemas\n } finally {\n await builder.done()\n }\n }\n\n #asyncTasks = new AsyncTasks()\n\n constructor(protected indexer: LexiconIndexer) {}\n\n async done(): Promise<void> {\n await this.#asyncTasks.done()\n }\n\n buildFullRef = memoize(async (fullRef: string) => {\n const { nsid, hash } = parseRef(fullRef)\n\n const doc = await this.indexer.get(nsid)\n\n return this.compileDef(doc, hash)\n })\n\n protected buildRefGetter(fullRef: string): () => l.Validator<unknown> {\n let validator: l.Validator<unknown>\n\n this.#asyncTasks.add(\n this.buildFullRef(fullRef).then((v) => {\n if (!(v instanceof l.Schema)) {\n throw new Error(`Only refs to schema types are allowed`)\n }\n validator = v\n }),\n )\n\n return () => {\n if (validator) return validator\n throw new Error('Validator not yet built. Did you await done()?')\n }\n }\n\n protected buildTypedRefGetter(\n fullRef: string,\n ): () => l.TypedObjectSchema | l.RecordSchema {\n let validator: l.TypedObjectSchema | l.RecordSchema\n\n this.#asyncTasks.add(\n this.buildFullRef(fullRef).then((v) => {\n if (v instanceof l.TypedObjectSchema || v instanceof l.RecordSchema) {\n validator = v\n } else {\n throw new Error(\n 'Only refs to records and object definitions are allowed',\n )\n }\n }),\n )\n\n return () => {\n if (validator) return validator\n throw new Error('Validator not yet built. Did you await done()?')\n }\n }\n\n protected compileDef(doc: LexiconDocument, hash: string) {\n const def = Object.hasOwn(doc.defs, hash) ? doc.defs[hash] : null\n if (!def) {\n throw new Error(\n `No definition found for hash \"${JSON.stringify(hash)}\" in ${doc.id}`,\n )\n }\n switch (def.type) {\n case 'permission-set':\n return l.permissionSet(\n doc.id,\n def.permissions.map(({ resource, type, ...p }) =>\n l.permission(resource, p),\n ),\n def,\n )\n case 'procedure':\n return l.procedure(\n doc.id,\n this.compileParams(doc, def.parameters),\n this.compilePayload(doc, def.input),\n this.compilePayload(doc, def.output),\n this.compileErrors(doc, def.errors),\n )\n case 'query':\n return l.query(\n doc.id,\n this.compileParams(doc, def.parameters),\n this.compilePayload(doc, def.output),\n this.compileErrors(doc, def.errors),\n )\n case 'subscription':\n return l.subscription(\n doc.id,\n this.compileParams(doc, def.parameters),\n this.compilePayloadSchema(doc, def.message?.schema),\n this.compileErrors(doc, def.errors),\n )\n case 'token':\n return l.token(doc.id, hash)\n case 'record':\n return l.record(def.key, doc.id, this.compileObject(doc, def.record))\n case 'object':\n return l.typedObject(doc.id, hash, this.compileObject(doc, def))\n default:\n return this.compileLeaf(doc, def)\n }\n }\n\n protected compileLeaf(\n doc: LexiconDocument,\n def: LexiconArray | LexiconArrayItems,\n ): l.Validator<unknown> {\n if (\n 'const' in def &&\n 'enum' in def &&\n def.enum != null &&\n def.const !== undefined &&\n !(def.enum as readonly unknown[]).includes(def.const)\n ) {\n return l.never()\n }\n\n switch (def.type) {\n case 'string': {\n const schema: l.StringSchema = l.string(def)\n if (def.const != null) {\n schema.assert(def.const)\n return l.literal(def.const, def)\n } else if (def.enum != null) {\n for (const v of def.enum) schema.assert(v)\n return l.enum(def.enum, def)\n } else {\n return schema\n }\n }\n case 'integer': {\n const schema: l.IntegerSchema = l.integer(def)\n if (def.const != null) {\n schema.assert(def.const)\n return l.literal(def.const, def)\n } else if (def.enum != null) {\n for (const v of def.enum) schema.assert(v)\n return l.enum(def.enum, def)\n } else {\n return schema\n }\n }\n case 'boolean': {\n if (def.const != null) {\n return l.literal(def.const, def)\n } else {\n return l.boolean(def)\n }\n }\n case 'blob':\n return l.blob(def)\n case 'cid-link':\n return l.cidLink()\n case 'bytes':\n return l.bytes(def)\n case 'unknown':\n return l.unknown()\n case 'array':\n return l.array(this.compileLeaf(doc, def.items), def)\n default:\n return this.compileRef(doc, def)\n }\n }\n\n protected compileRef(\n doc: LexiconDocument,\n def: LexiconRef | LexiconRefUnion,\n ) {\n switch (def.type) {\n case 'ref':\n return l.ref(this.buildRefGetter(buildFullRef(doc, def.ref)))\n case 'union':\n return l.typedUnion(\n def.refs.map((r) =>\n l.typedRef(this.buildTypedRefGetter(buildFullRef(doc, r))),\n ),\n def.closed ?? false,\n )\n default:\n // @ts-expect-error\n throw new Error(`Unknown lexicon type: ${def.type}`)\n }\n }\n\n protected compileObject(\n doc: LexiconDocument,\n def: LexiconObject,\n ): l.ObjectSchema {\n const props: Record<string, l.Validator> = {}\n for (const [key, propDef] of Object.entries(def.properties)) {\n if (propDef === undefined) continue\n\n const isNullable = def.nullable?.includes(key)\n const isRequired = def.required?.includes(key)\n\n let schema = this.compileLeaf(doc, propDef)\n\n if (isNullable) {\n schema = l.nullable(schema)\n }\n\n if (!isRequired) {\n schema = l.optional(schema)\n }\n\n props[key] = schema\n }\n return l.object(props)\n }\n\n protected compilePayload(\n doc: LexiconDocument,\n def: LexiconPayload | undefined,\n ): l.Payload {\n return l.payload(\n def?.encoding,\n def?.schema ? this.compilePayloadSchema(doc, def.schema) : undefined,\n )\n }\n\n protected compileErrors(\n _doc: LexiconDocument,\n errors?: readonly LexiconError[],\n ): undefined | string[] {\n return errors?.map((e) => e.name)\n }\n\n protected compilePayloadSchema(\n doc: LexiconDocument,\n def?: LexiconObject | LexiconRef | LexiconRefUnion,\n ) {\n if (!def) return undefined\n switch (def.type) {\n case 'object':\n return this.compileObject(doc, def)\n default:\n return this.compileRef(doc, def)\n }\n }\n\n protected compileParams(doc: LexiconDocument, def?: LexiconParameters) {\n if (!def) return l.params()\n\n const props: Record<string, l.Validator> = {}\n for (const [key, propDef] of Object.entries(def.properties)) {\n if (propDef === undefined) continue\n\n const isRequired = def.required?.includes(key)\n\n let schema = this.compileLeaf(doc, propDef)\n\n if (!isRequired) {\n schema = l.optional(schema)\n }\n\n props[key] = schema\n }\n return l.params(props)\n }\n}\n\nclass AsyncTasks {\n /**\n * A set that, eventually, contains only rejected promises.\n */\n #promises = new Set<Promise<void>>()\n\n async done(): Promise<void> {\n do {\n // @NOTE this is going to throw on the first rejected promise (which is\n // what we want)\n for (const p of this.#promises) await p\n // At this point, all settled promises should have been removed. If\n // this.#promises is not empty, it means new promises were added during\n // the awaiting process, so we loop again.\n } while (this.#promises.size > 0)\n }\n\n add(p: Promise<void>) {\n const promise = Promise.resolve(p).then(() => {\n // No need to keep the promise any longer\n this.#promises.delete(promise)\n })\n\n void promise.catch((_err) => {\n // ignore errors here, they should be caught though done()\n })\n\n this.#promises.add(promise)\n }\n}\n\nfunction parseRef(fullRef: string) {\n const { length, 0: nsid, 1: hash } = fullRef.split('#')\n if (length !== 2) throw new Error('Uri can only have one hash segment')\n if (!nsid || !hash) throw new Error('Invalid ref, missing hash')\n return { nsid, hash }\n}\n\nfunction buildFullRef(from: LexiconDocument, ref: string) {\n if (ref.startsWith('#')) return `${from.id}${ref}`\n return ref\n}\n\nexport function memoize<Fn extends (arg: string) => unknown>(fn: Fn): Fn {\n const cache = new Map<string, ReturnType<Fn>>()\n return ((arg: string) => {\n if (cache.has(arg)) return cache.get(arg)!\n const result = fn(arg) as ReturnType<Fn>\n cache.set(arg, result)\n return result\n }) as Fn\n}\n\nfunction isAsyncIterableObject<T>(\n obj: T,\n): obj is T & object & AsyncIterable<unknown> {\n return (\n obj != null &&\n typeof obj === 'object' &&\n Symbol.asyncIterator in obj &&\n typeof obj[Symbol.asyncIterator] === 'function'\n )\n}\n"]}
|
|
1
|
+
{"version":3,"file":"lexicon-schema-builder.js","sourceRoot":"","sources":["../src/lexicon-schema-builder.ts"],"names":[],"mappings":";;;AAyXA,0BAQC;AAjYD,oDAAuC;AAcvC;;;;;;;;;;;;GAYG;AACH,MAAa,oBAAoB;IA8CT;IA7CtB,MAAM,CAAC,KAAK,CAAC,KAAK,CAChB,OAAuB,EACvB,OAAe;QAEf,MAAM,GAAG,GAAG,IAAI,oBAAoB,CAAC,OAAO,CAAC,CAAA;QAC7C,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,YAAY,CAAC,OAAO,CAAC,CAAA;YAC9C,IAAI,CAAC,CAAC,MAAM,YAAY,cAAC,CAAC,MAAM,CAAC,EAAE,CAAC;gBAClC,MAAM,IAAI,KA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AAG,GAAG,EAAE,CAAA;IAClD,OAAO,GAAG,CAAA;AACZ,CAAC;AAED,SAAgB,OAAO,CAAsC,EAAM;IACjE,MAAM,KAAK,GAAG,IAAI,GAAG,EAA0B,CAAA;IAC/C,OAAO,CAAC,CAAC,GAAW,EAAE,EAAE;QACtB,IAAI,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC;YAAE,OAAO,KAAK,CAAC,GAAG,CAAC,GAAG,CAAE,CAAA;QAC1C,MAAM,MAAM,GAAG,EAAE,CAAC,GAAG,CAAmB,CAAA;QACxC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,CAAA;QACtB,OAAO,MAAM,CAAA;IACf,CAAC,CAAO,CAAA;AACV,CAAC;AAED,SAAS,qBAAqB,CAC5B,GAAM;IAEN,OAAO,CACL,GAAG,IAAI,IAAI;QACX,OAAO,GAAG,KAAK,QAAQ;QACvB,MAAM,CAAC,aAAa,IAAI,GAAG;QAC3B,OAAO,GAAG,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,UAAU,CAChD,CAAA;AACH,CAAC","sourcesContent":["import { l } from '@atproto/lex-schema'\nimport {\n LexiconArray,\n LexiconArrayItems,\n LexiconDocument,\n LexiconError,\n LexiconObject,\n LexiconParameters,\n LexiconPayload,\n LexiconRef,\n LexiconRefUnion,\n} from './lexicon-document.js'\nimport { LexiconIndexer } from './lexicon-indexer.js'\n\n/**\n * Builds a validator for a given lexicon \"ref\" from a lexicon indexer.\n *\n * @example\n *\n * ```ts\n * import { LexiconSchemaBuilder } from '@atproto/lex/doc'\n * import { LexiconStreamIndexer } from '@atproto/lex/doc'\n *\n * const indexer = new LexiconStreamIndexer(lexiconDocs)\n * const validator = await LexiconSchemaBuilder.build(indexer, 'com.example.foo#bar')\n * ```\n */\nexport class LexiconSchemaBuilder {\n static async build(\n indexer: LexiconIndexer,\n fullRef: string,\n ): Promise<l.Validator<unknown>> {\n const ctx = new LexiconSchemaBuilder(indexer)\n try {\n const result = await ctx.buildFullRef(fullRef)\n if (!(result instanceof l.Schema)) {\n throw new Error(`Ref ${fullRef} is not a schema type`)\n }\n return result\n } finally {\n await ctx.done()\n }\n }\n\n static async buildAll(indexer: LexiconIndexer) {\n const builder = new LexiconSchemaBuilder(indexer)\n const schemas = new Map<\n string,\n | l.Validator<unknown>\n | l.Query\n | l.Subscription\n | l.Procedure\n | l.PermissionSet\n >()\n if (!isAsyncIterableObject(indexer)) {\n throw new Error('An iterable indexer is required to build all schemas')\n }\n try {\n for await (const doc of indexer) {\n for (const hash of Object.keys(doc.defs)) {\n const fullRef = `${doc.id}#${hash}`\n const schema = await builder.buildFullRef(fullRef)\n schemas.set(fullRef, schema)\n }\n }\n return schemas\n } finally {\n await builder.done()\n }\n }\n\n #asyncTasks = new AsyncTasks()\n\n constructor(protected indexer: LexiconIndexer) {}\n\n async done(): Promise<void> {\n await this.#asyncTasks.done()\n }\n\n buildFullRef = memoize(async (fullRef: string) => {\n const { nsid, hash } = parseRef(fullRef)\n\n const doc = await this.indexer.get(nsid)\n\n return this.compileDef(doc, hash)\n })\n\n protected buildRefGetter(fullRef: string): () => l.Validator<unknown> {\n let validator: l.Validator<unknown>\n\n this.#asyncTasks.add(\n this.buildFullRef(fullRef).then((v) => {\n if (!(v instanceof l.Schema)) {\n throw new Error(`Only refs to schema types are allowed`)\n }\n validator = v\n }),\n )\n\n return () => {\n if (validator) return validator\n throw new Error('Validator not yet built. Did you await done()?')\n }\n }\n\n protected buildTypedRefGetter(\n fullRef: string,\n ): () => l.TypedObjectSchema | l.RecordSchema {\n let validator: l.TypedObjectSchema | l.RecordSchema\n\n this.#asyncTasks.add(\n this.buildFullRef(fullRef).then((v) => {\n if (v instanceof l.TypedObjectSchema || v instanceof l.RecordSchema) {\n validator = v\n } else {\n throw new Error(\n 'Only refs to records and object definitions are allowed',\n )\n }\n }),\n )\n\n return () => {\n if (validator) return validator\n throw new Error('Validator not yet built. Did you await done()?')\n }\n }\n\n protected compileDef(doc: LexiconDocument, hash: string) {\n const def = Object.hasOwn(doc.defs, hash) ? doc.defs[hash] : null\n if (!def) {\n throw new Error(\n `No definition found for hash \"${JSON.stringify(hash)}\" in ${doc.id}`,\n )\n }\n switch (def.type) {\n case 'permission-set':\n return l.permissionSet(\n doc.id,\n def.permissions.map(({ resource, type, ...p }) =>\n l.permission(resource, p),\n ),\n def,\n )\n case 'procedure':\n return l.procedure(\n doc.id,\n this.compileParams(doc, def.parameters),\n this.compilePayload(doc, def.input),\n this.compilePayload(doc, def.output),\n this.compileErrors(doc, def.errors),\n )\n case 'query':\n return l.query(\n doc.id,\n this.compileParams(doc, def.parameters),\n this.compilePayload(doc, def.output),\n this.compileErrors(doc, def.errors),\n )\n case 'subscription':\n return l.subscription(\n doc.id,\n this.compileParams(doc, def.parameters),\n this.compilePayloadSchema(doc, def.message.schema),\n this.compileErrors(doc, def.errors),\n )\n case 'token':\n return l.token(doc.id, hash)\n case 'record':\n return l.record(def.key, doc.id, this.compileObject(doc, def.record))\n case 'object':\n return l.typedObject(doc.id, hash, this.compileObject(doc, def))\n default:\n return this.compileLeaf(doc, def)\n }\n }\n\n protected compileLeaf(\n doc: LexiconDocument,\n def: LexiconArray | LexiconArrayItems,\n ): l.Validator<unknown> {\n if (\n 'const' in def &&\n 'enum' in def &&\n def.enum != null &&\n def.const !== undefined &&\n !(def.enum as readonly unknown[]).includes(def.const)\n ) {\n return l.never()\n }\n\n switch (def.type) {\n case 'string': {\n const schema: l.StringSchema = l.string(def)\n if (def.const != null) {\n schema.assert(def.const)\n return l.literal(def.const, def)\n } else if (def.enum != null) {\n for (const v of def.enum) schema.assert(v)\n return l.enum(def.enum, def)\n } else {\n return schema\n }\n }\n case 'integer': {\n const schema: l.IntegerSchema = l.integer(def)\n if (def.const != null) {\n schema.assert(def.const)\n return l.literal(def.const, def)\n } else if (def.enum != null) {\n for (const v of def.enum) schema.assert(v)\n return l.enum(def.enum, def)\n } else {\n return schema\n }\n }\n case 'boolean': {\n if (def.const != null) {\n return l.literal(def.const, def)\n } else {\n return l.boolean(def)\n }\n }\n case 'blob':\n return l.blob(def)\n case 'cid-link':\n return l.cidLink()\n case 'bytes':\n return l.bytes(def)\n case 'unknown':\n return l.unknown()\n case 'array':\n return l.array(this.compileLeaf(doc, def.items), def)\n default:\n return this.compileRef(doc, def)\n }\n }\n\n protected compileRef(\n doc: LexiconDocument,\n def: LexiconRef | LexiconRefUnion,\n ) {\n switch (def.type) {\n case 'ref':\n return l.ref(this.buildRefGetter(buildFullRef(doc, def.ref)))\n case 'union':\n return l.typedUnion(\n def.refs.map((r) =>\n l.typedRef(this.buildTypedRefGetter(buildFullRef(doc, r))),\n ),\n def.closed ?? false,\n )\n default:\n // @ts-expect-error\n throw new Error(`Unknown lexicon type: ${def.type}`)\n }\n }\n\n protected compileObject(\n doc: LexiconDocument,\n def: LexiconObject,\n ): l.ObjectSchema {\n const props: Record<string, l.Validator> = {}\n for (const [key, propDef] of Object.entries(def.properties)) {\n if (propDef === undefined) continue\n\n const isNullable = def.nullable?.includes(key)\n const isRequired = def.required?.includes(key)\n\n let schema = this.compileLeaf(doc, propDef)\n\n if (isNullable) {\n schema = l.nullable(schema)\n }\n\n if (!isRequired) {\n schema = l.optional(schema)\n }\n\n props[key] = schema\n }\n return l.object(props)\n }\n\n protected compilePayload(\n doc: LexiconDocument,\n def: LexiconPayload | undefined,\n ): l.Payload {\n return l.payload(\n def?.encoding,\n def?.schema ? this.compilePayloadSchema(doc, def.schema) : undefined,\n )\n }\n\n protected compileErrors(\n _doc: LexiconDocument,\n errors?: readonly LexiconError[],\n ): undefined | string[] {\n return errors?.map((e) => e.name)\n }\n\n protected compilePayloadSchema(\n doc: LexiconDocument,\n def: LexiconObject | LexiconRef | LexiconRefUnion,\n ) {\n switch (def.type) {\n case 'object':\n return this.compileObject(doc, def)\n default:\n return this.compileRef(doc, def)\n }\n }\n\n protected compileParams(doc: LexiconDocument, def?: LexiconParameters) {\n if (!def) return l.params()\n\n const props: Record<string, l.Validator> = {}\n for (const [key, propDef] of Object.entries(def.properties)) {\n if (propDef === undefined) continue\n\n const isRequired = def.required?.includes(key)\n\n let schema = this.compileLeaf(doc, propDef)\n\n if (!isRequired) {\n schema = l.optional(schema)\n }\n\n props[key] = schema\n }\n return l.params(props)\n }\n}\n\nclass AsyncTasks {\n /**\n * A set that, eventually, contains only rejected promises.\n */\n #promises = new Set<Promise<void>>()\n\n async done(): Promise<void> {\n do {\n // @NOTE this is going to throw on the first rejected promise (which is\n // what we want)\n for (const p of this.#promises) await p\n // At this point, all settled promises should have been removed. If\n // this.#promises is not empty, it means new promises were added during\n // the awaiting process, so we loop again.\n } while (this.#promises.size > 0)\n }\n\n add(p: Promise<void>) {\n const promise = Promise.resolve(p).then(() => {\n // No need to keep the promise any longer\n this.#promises.delete(promise)\n })\n\n void promise.catch((_err) => {\n // ignore errors here, they should be caught though done()\n })\n\n this.#promises.add(promise)\n }\n}\n\nfunction parseRef(fullRef: string) {\n const { length, 0: nsid, 1: hash } = fullRef.split('#')\n if (length !== 2) throw new Error('Uri can only have one hash segment')\n if (!nsid || !hash) throw new Error('Invalid ref, missing hash')\n return { nsid, hash }\n}\n\nfunction buildFullRef(from: LexiconDocument, ref: string) {\n if (ref.startsWith('#')) return `${from.id}${ref}`\n return ref\n}\n\nexport function memoize<Fn extends (arg: string) => unknown>(fn: Fn): Fn {\n const cache = new Map<string, ReturnType<Fn>>()\n return ((arg: string) => {\n if (cache.has(arg)) return cache.get(arg)!\n const result = fn(arg) as ReturnType<Fn>\n cache.set(arg, result)\n return result\n }) as Fn\n}\n\nfunction isAsyncIterableObject<T>(\n obj: T,\n): obj is T & object & AsyncIterable<unknown> {\n return (\n obj != null &&\n typeof obj === 'object' &&\n Symbol.asyncIterator in obj &&\n typeof obj[Symbol.asyncIterator] === 'function'\n )\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atproto/lex-document",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Lexicon document validation tools for AT",
|
|
6
6
|
"keywords": [
|
|
@@ -38,11 +38,11 @@
|
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"core-js": "^3",
|
|
40
40
|
"tslib": "^2.8.1",
|
|
41
|
-
"@atproto/lex-schema": "0.0.
|
|
41
|
+
"@atproto/lex-schema": "0.0.5"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"jest": "^28.1.2",
|
|
45
|
-
"@atproto/lex-data": "0.0.
|
|
45
|
+
"@atproto/lex-data": "0.0.4"
|
|
46
46
|
},
|
|
47
47
|
"scripts": {
|
|
48
48
|
"build": "tsc --build tsconfig.build.json",
|
|
@@ -49,7 +49,7 @@ describe('lexiconDocumentSchema', () => {
|
|
|
49
49
|
}),
|
|
50
50
|
).toMatchObject({
|
|
51
51
|
success: false,
|
|
52
|
-
|
|
52
|
+
reason: { issues: [{ code: 'invalid_value', values: [1] }] },
|
|
53
53
|
})
|
|
54
54
|
})
|
|
55
55
|
|
|
@@ -66,7 +66,7 @@ describe('lexiconDocumentSchema', () => {
|
|
|
66
66
|
}),
|
|
67
67
|
).toMatchObject({
|
|
68
68
|
success: false,
|
|
69
|
-
|
|
69
|
+
reason: { issues: [{ code: 'invalid_format', format: 'nsid' }] },
|
|
70
70
|
})
|
|
71
71
|
})
|
|
72
72
|
|
|
@@ -83,7 +83,7 @@ describe('lexiconDocumentSchema', () => {
|
|
|
83
83
|
}),
|
|
84
84
|
).toMatchObject({
|
|
85
85
|
success: false,
|
|
86
|
-
|
|
86
|
+
reason: { issues: [{ code: 'invalid_type', expected: ['string'] }] },
|
|
87
87
|
})
|
|
88
88
|
})
|
|
89
89
|
|
|
@@ -104,7 +104,7 @@ describe('lexiconDocumentSchema', () => {
|
|
|
104
104
|
}),
|
|
105
105
|
).toMatchObject({
|
|
106
106
|
success: false,
|
|
107
|
-
|
|
107
|
+
reason: {
|
|
108
108
|
issues: [{ code: 'custom', path: ['defs', 'demo', 'required'] }],
|
|
109
109
|
},
|
|
110
110
|
})
|
package/src/lexicon-document.ts
CHANGED
|
@@ -221,20 +221,6 @@ export const lexiconPayload = l.object({
|
|
|
221
221
|
})
|
|
222
222
|
export type LexiconPayload = l.Infer<typeof lexiconPayload>
|
|
223
223
|
|
|
224
|
-
export const lexiconSubscriptionMessage = l.object({
|
|
225
|
-
description: strOpt,
|
|
226
|
-
schema: l.optional(
|
|
227
|
-
l.discriminatedUnion('type', [
|
|
228
|
-
lexiconRefSchema,
|
|
229
|
-
lexiconRefUnionSchema,
|
|
230
|
-
lexiconObjectSchema,
|
|
231
|
-
]),
|
|
232
|
-
),
|
|
233
|
-
})
|
|
234
|
-
export type LexiconSubscriptionMessage = l.Infer<
|
|
235
|
-
typeof lexiconSubscriptionMessage
|
|
236
|
-
>
|
|
237
|
-
|
|
238
224
|
export const lexiconError = l.object({
|
|
239
225
|
name: l.string({ minLength: 1 }),
|
|
240
226
|
description: strOpt,
|
|
@@ -264,7 +250,10 @@ export const lexiconSubscriptionSchema = l.object({
|
|
|
264
250
|
type: l.literal('subscription'),
|
|
265
251
|
description: strOpt,
|
|
266
252
|
parameters: l.optional(lexiconParameters),
|
|
267
|
-
message: l.
|
|
253
|
+
message: l.object({
|
|
254
|
+
description: strOpt,
|
|
255
|
+
schema: lexiconRefUnionSchema,
|
|
256
|
+
}),
|
|
268
257
|
errors: l.optional(l.array(lexiconError)),
|
|
269
258
|
})
|
|
270
259
|
|
|
@@ -160,7 +160,7 @@ describe('LexiconSchemaBuilder', () => {
|
|
|
160
160
|
|
|
161
161
|
expect(schema.safeParse(value)).toMatchObject({
|
|
162
162
|
success: false,
|
|
163
|
-
|
|
163
|
+
reason: {
|
|
164
164
|
issues: [
|
|
165
165
|
{
|
|
166
166
|
code: 'invalid_value',
|
|
@@ -231,7 +231,7 @@ describe('LexiconSchemaBuilder', () => {
|
|
|
231
231
|
|
|
232
232
|
expect(schema.safeParse(value)).toMatchObject({
|
|
233
233
|
success: false,
|
|
234
|
-
|
|
234
|
+
reason: { issues: [{ code: 'required_key', key: 'array' }] },
|
|
235
235
|
})
|
|
236
236
|
})
|
|
237
237
|
|
|
@@ -161,7 +161,7 @@ export class LexiconSchemaBuilder {
|
|
|
161
161
|
return l.subscription(
|
|
162
162
|
doc.id,
|
|
163
163
|
this.compileParams(doc, def.parameters),
|
|
164
|
-
this.compilePayloadSchema(doc, def.message
|
|
164
|
+
this.compilePayloadSchema(doc, def.message.schema),
|
|
165
165
|
this.compileErrors(doc, def.errors),
|
|
166
166
|
)
|
|
167
167
|
case 'token':
|
|
@@ -301,9 +301,8 @@ export class LexiconSchemaBuilder {
|
|
|
301
301
|
|
|
302
302
|
protected compilePayloadSchema(
|
|
303
303
|
doc: LexiconDocument,
|
|
304
|
-
def
|
|
304
|
+
def: LexiconObject | LexiconRef | LexiconRefUnion,
|
|
305
305
|
) {
|
|
306
|
-
if (!def) return undefined
|
|
307
306
|
switch (def.type) {
|
|
308
307
|
case 'object':
|
|
309
308
|
return this.compileObject(doc, def)
|