@atproto/lexicon 0.0.4 → 0.2.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.
Files changed (47) hide show
  1. package/dist/blob-refs.d.ts +67 -0
  2. package/dist/index.d.ts +2 -0
  3. package/dist/index.js +12944 -680
  4. package/dist/index.js.map +4 -4
  5. package/dist/lexicons.d.ts +6 -4
  6. package/dist/serialize.d.ts +12 -0
  7. package/dist/src/index.d.ts +2 -0
  8. package/dist/src/lexicons.d.ts +15 -0
  9. package/dist/src/record/index.d.ts +4 -0
  10. package/dist/src/record/schema.d.ts +9 -0
  11. package/dist/src/record/schemas.d.ts +10 -0
  12. package/dist/src/record/util.d.ts +1 -0
  13. package/dist/src/record/validation.d.ts +24 -0
  14. package/dist/src/record/validator.d.ts +17 -0
  15. package/dist/src/types.d.ts +30268 -0
  16. package/dist/src/util.d.ts +6 -0
  17. package/dist/src/validation.d.ts +6 -0
  18. package/dist/src/validators/blob.d.ts +6 -0
  19. package/dist/src/validators/complex.d.ts +5 -0
  20. package/dist/src/validators/primitives.d.ts +9 -0
  21. package/dist/src/validators/xrpc.d.ts +3 -0
  22. package/dist/tsconfig.build.tsbuildinfo +1 -0
  23. package/dist/types.d.ts +14999 -23510
  24. package/dist/util.d.ts +6 -1
  25. package/dist/validation.d.ts +6 -5
  26. package/dist/validators/blob.d.ts +0 -3
  27. package/dist/validators/complex.d.ts +2 -2
  28. package/dist/validators/formats.d.ts +10 -0
  29. package/dist/validators/primitives.d.ts +2 -2
  30. package/dist/validators/xrpc.d.ts +1 -1
  31. package/package.json +13 -4
  32. package/src/blob-refs.ts +70 -0
  33. package/src/index.ts +2 -0
  34. package/src/lexicons.ts +36 -5
  35. package/src/serialize.ts +93 -0
  36. package/src/types.ts +306 -180
  37. package/src/util.ts +64 -5
  38. package/src/validation.ts +28 -4
  39. package/src/validators/blob.ts +5 -43
  40. package/src/validators/complex.ts +31 -32
  41. package/src/validators/formats.ts +121 -0
  42. package/src/validators/primitives.ts +114 -67
  43. package/src/validators/xrpc.ts +29 -29
  44. package/tests/_scaffolds/lexicons.ts +178 -51
  45. package/tests/general.test.ts +496 -177
  46. package/tsconfig.build.tsbuildinfo +1 -1
  47. package/tsconfig.json +3 -1
@@ -0,0 +1,67 @@
1
+ import { CID } from 'multiformats/cid';
2
+ import { z } from 'zod';
3
+ export declare const typedJsonBlobRef: z.ZodObject<{
4
+ $type: z.ZodLiteral<"blob">;
5
+ ref: z.ZodEffects<z.ZodEffects<z.ZodAny, any, any>, CID, any>;
6
+ mimeType: z.ZodString;
7
+ size: z.ZodNumber;
8
+ }, "strict", z.ZodTypeAny, {
9
+ ref: CID;
10
+ $type: "blob";
11
+ mimeType: string;
12
+ size: number;
13
+ }, {
14
+ $type: "blob";
15
+ mimeType: string;
16
+ size: number;
17
+ ref?: any;
18
+ }>;
19
+ export declare type TypedJsonBlobRef = z.infer<typeof typedJsonBlobRef>;
20
+ export declare const untypedJsonBlobRef: z.ZodObject<{
21
+ cid: z.ZodString;
22
+ mimeType: z.ZodString;
23
+ }, "strict", z.ZodTypeAny, {
24
+ cid: string;
25
+ mimeType: string;
26
+ }, {
27
+ cid: string;
28
+ mimeType: string;
29
+ }>;
30
+ export declare type UntypedJsonBlobRef = z.infer<typeof untypedJsonBlobRef>;
31
+ export declare const jsonBlobRef: z.ZodUnion<[z.ZodObject<{
32
+ $type: z.ZodLiteral<"blob">;
33
+ ref: z.ZodEffects<z.ZodEffects<z.ZodAny, any, any>, CID, any>;
34
+ mimeType: z.ZodString;
35
+ size: z.ZodNumber;
36
+ }, "strict", z.ZodTypeAny, {
37
+ ref: CID;
38
+ $type: "blob";
39
+ mimeType: string;
40
+ size: number;
41
+ }, {
42
+ $type: "blob";
43
+ mimeType: string;
44
+ size: number;
45
+ ref?: any;
46
+ }>, z.ZodObject<{
47
+ cid: z.ZodString;
48
+ mimeType: z.ZodString;
49
+ }, "strict", z.ZodTypeAny, {
50
+ cid: string;
51
+ mimeType: string;
52
+ }, {
53
+ cid: string;
54
+ mimeType: string;
55
+ }>]>;
56
+ export declare type JsonBlobRef = z.infer<typeof jsonBlobRef>;
57
+ export declare class BlobRef {
58
+ ref: CID;
59
+ mimeType: string;
60
+ size: number;
61
+ original: JsonBlobRef;
62
+ constructor(ref: CID, mimeType: string, size: number, original?: JsonBlobRef);
63
+ static asBlobRef(obj: unknown): BlobRef | null;
64
+ static fromJsonRef(json: JsonBlobRef): BlobRef;
65
+ ipld(): TypedJsonBlobRef;
66
+ toJSON(): unknown;
67
+ }
package/dist/index.d.ts CHANGED
@@ -1,2 +1,4 @@
1
1
  export * from './types';
2
2
  export * from './lexicons';
3
+ export * from './blob-refs';
4
+ export * from './serialize';