@atproto/lex-document 0.0.21 → 0.1.0-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # @atproto/lex-document
2
2
 
3
+ ## 0.1.0-next.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#4929](https://github.com/bluesky-social/atproto/pull/4929) [`bb7491c`](https://github.com/bluesky-social/atproto/commit/bb7491c29e06181e1d2f8cf6eb454f9bb8ab961b) Thanks [@devinivy](https://github.com/devinivy)! - **BREAKING:** Drop support for Node.js 18 and 20. Node.js 22 is now the minimum supported version. Docker images now use Node.js 24.
8
+
9
+ - [#4943](https://github.com/bluesky-social/atproto/pull/4943) [`07ae5d4`](https://github.com/bluesky-social/atproto/commit/07ae5d4452df51e045e0239da7a04cf0bc154028) Thanks [@devinivy](https://github.com/devinivy)! - **BREAKING:** Convert to pure ESM. All packages now ship `"type": "module"` with ES module output and Node16 module resolution.
10
+
11
+ Node.js 22's `require()` compatibility layer can still load these packages in CommonJS code.
12
+
13
+ - [#4930](https://github.com/bluesky-social/atproto/pull/4930) [`042df15`](https://github.com/bluesky-social/atproto/commit/042df15087c0e62cd1e715fcbf58852fab875af9) Thanks [@devinivy](https://github.com/devinivy)! - Build with TypeScript 6.0. Emitted `.d.ts` files now use TypeScript 6's stricter `Uint8Array<ArrayBuffer>` typing in places where Web/Node APIs require buffer-backed (not shared-memory) byte arrays. Consumers compiling against these types on older TypeScript should see no runtime impact, but may need to widen or cast in spots that previously relied on `Uint8Array` defaulting to `<ArrayBufferLike>`.
14
+
15
+ Internal: tsconfig `moduleResolution: "node"` is silenced via `ignoreDeprecations: "6.0"` for now; the proper migration to `node16`/`bundler` resolution is deferred.
16
+
17
+ ### Patch Changes
18
+
19
+ - Updated dependencies [[`bb7491c`](https://github.com/bluesky-social/atproto/commit/bb7491c29e06181e1d2f8cf6eb454f9bb8ab961b), [`07ae5d4`](https://github.com/bluesky-social/atproto/commit/07ae5d4452df51e045e0239da7a04cf0bc154028), [`042df15`](https://github.com/bluesky-social/atproto/commit/042df15087c0e62cd1e715fcbf58852fab875af9)]:
20
+ - @atproto/lex-schema@0.1.0-next.0
21
+
3
22
  ## 0.0.21
4
23
 
5
24
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import 'core-js/modules/esnext.symbol.async-dispose';
2
- import 'core-js/modules/esnext.symbol.dispose';
1
+ import 'core-js/es/symbol/async-dispose.js';
2
+ import 'core-js/es/symbol/dispose.js';
3
3
  export * from './lexicon-document.js';
4
4
  export * from './lexicon-indexer.js';
5
5
  export * from './lexicon-schema-builder.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,6CAA6C,CAAA;AACpD,OAAO,uCAAuC,CAAA;AAE9C,cAAc,uBAAuB,CAAA;AACrC,cAAc,sBAAsB,CAAA;AACpC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,+BAA+B,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,oCAAoC,CAAA;AAC3C,OAAO,8BAA8B,CAAA;AAErC,cAAc,uBAAuB,CAAA;AACrC,cAAc,sBAAsB,CAAA;AACpC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,+BAA+B,CAAA"}
package/dist/index.js CHANGED
@@ -1,10 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- require("core-js/modules/esnext.symbol.async-dispose");
5
- require("core-js/modules/esnext.symbol.dispose");
6
- tslib_1.__exportStar(require("./lexicon-document.js"), exports);
7
- tslib_1.__exportStar(require("./lexicon-indexer.js"), exports);
8
- tslib_1.__exportStar(require("./lexicon-schema-builder.js"), exports);
9
- tslib_1.__exportStar(require("./lexicon-iterable-indexer.js"), exports);
1
+ import 'core-js/es/symbol/async-dispose.js';
2
+ import 'core-js/es/symbol/dispose.js';
3
+ export * from './lexicon-document.js';
4
+ export * from './lexicon-indexer.js';
5
+ export * from './lexicon-schema-builder.js';
6
+ export * from './lexicon-iterable-indexer.js';
10
7
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,uDAAoD;AACpD,iDAA8C;AAE9C,gEAAqC;AACrC,+DAAoC;AACpC,sEAA2C;AAC3C,wEAA6C","sourcesContent":["import 'core-js/modules/esnext.symbol.async-dispose'\nimport 'core-js/modules/esnext.symbol.dispose'\n\nexport * from './lexicon-document.js'\nexport * from './lexicon-indexer.js'\nexport * from './lexicon-schema-builder.js'\nexport * from './lexicon-iterable-indexer.js'\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,oCAAoC,CAAA;AAC3C,OAAO,8BAA8B,CAAA;AAErC,cAAc,uBAAuB,CAAA;AACrC,cAAc,sBAAsB,CAAA;AACpC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,+BAA+B,CAAA","sourcesContent":["import 'core-js/es/symbol/async-dispose.js'\nimport 'core-js/es/symbol/dispose.js'\n\nexport * from './lexicon-document.js'\nexport * from './lexicon-indexer.js'\nexport * from './lexicon-schema-builder.js'\nexport * from './lexicon-iterable-indexer.js'\n"]}
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.lexiconDocumentSchema = exports.lexiconIdentifierSchema = exports.lexiconPermissionSetSchema = exports.lexiconPermissionSchema = exports.lexiconLanguageDict = exports.lexiconLanguageSchema = 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
- const lex_schema_1 = require("@atproto/lex-schema");
1
+ import { l } from '@atproto/lex-schema';
5
2
  // https://atproto.com/specs/lexicon
6
3
  // "Concrete" Types
7
4
  /**
@@ -10,11 +7,11 @@ const lex_schema_1 = require("@atproto/lex-schema");
10
7
  * Validates boolean field definitions that may include a default value,
11
8
  * a constant value, and an optional description.
12
9
  */
13
- exports.lexiconBooleanSchema = lex_schema_1.l.object({
14
- type: lex_schema_1.l.literal('boolean'),
15
- default: lex_schema_1.l.optional(lex_schema_1.l.boolean()),
16
- const: lex_schema_1.l.optional(lex_schema_1.l.boolean()),
17
- description: lex_schema_1.l.optional(lex_schema_1.l.string()),
10
+ export const lexiconBooleanSchema = l.object({
11
+ type: l.literal('boolean'),
12
+ default: l.optional(l.boolean()),
13
+ const: l.optional(l.boolean()),
14
+ description: l.optional(l.string()),
18
15
  });
19
16
  /**
20
17
  * Schema for validating Lexicon integer type definitions.
@@ -22,14 +19,14 @@ exports.lexiconBooleanSchema = lex_schema_1.l.object({
22
19
  * Validates integer field definitions with support for default values,
23
20
  * minimum/maximum constraints, enumerated values, and constant values.
24
21
  */
25
- exports.lexiconIntegerSchema = lex_schema_1.l.object({
26
- type: lex_schema_1.l.literal('integer'),
27
- default: lex_schema_1.l.optional(lex_schema_1.l.integer()),
28
- minimum: lex_schema_1.l.optional(lex_schema_1.l.integer()),
29
- maximum: lex_schema_1.l.optional(lex_schema_1.l.integer()),
30
- enum: lex_schema_1.l.optional(lex_schema_1.l.array(lex_schema_1.l.integer())),
31
- const: lex_schema_1.l.optional(lex_schema_1.l.integer()),
32
- description: lex_schema_1.l.optional(lex_schema_1.l.string()),
22
+ export const lexiconIntegerSchema = l.object({
23
+ type: l.literal('integer'),
24
+ default: l.optional(l.integer()),
25
+ minimum: l.optional(l.integer()),
26
+ maximum: l.optional(l.integer()),
27
+ enum: l.optional(l.array(l.integer())),
28
+ const: l.optional(l.integer()),
29
+ description: l.optional(l.string()),
33
30
  });
34
31
  /**
35
32
  * Schema for validating Lexicon string type definitions.
@@ -38,18 +35,18 @@ exports.lexiconIntegerSchema = lex_schema_1.l.object({
38
35
  * length constraints (both character and grapheme-based), enumerated values,
39
36
  * known values, and constant values.
40
37
  */
41
- exports.lexiconStringSchema = lex_schema_1.l.object({
42
- type: lex_schema_1.l.literal('string'),
43
- format: lex_schema_1.l.optional(lex_schema_1.l.enum(lex_schema_1.l.STRING_FORMATS)),
44
- default: lex_schema_1.l.optional(lex_schema_1.l.string()),
45
- minLength: lex_schema_1.l.optional(lex_schema_1.l.integer()),
46
- maxLength: lex_schema_1.l.optional(lex_schema_1.l.integer()),
47
- minGraphemes: lex_schema_1.l.optional(lex_schema_1.l.integer()),
48
- maxGraphemes: lex_schema_1.l.optional(lex_schema_1.l.integer()),
49
- enum: lex_schema_1.l.optional(lex_schema_1.l.array(lex_schema_1.l.string())),
50
- const: lex_schema_1.l.optional(lex_schema_1.l.string()),
51
- knownValues: lex_schema_1.l.optional(lex_schema_1.l.array(lex_schema_1.l.string())),
52
- description: lex_schema_1.l.optional(lex_schema_1.l.string()),
38
+ export const lexiconStringSchema = l.object({
39
+ type: l.literal('string'),
40
+ format: l.optional(l.enum(l.STRING_FORMATS)),
41
+ default: l.optional(l.string()),
42
+ minLength: l.optional(l.integer()),
43
+ maxLength: l.optional(l.integer()),
44
+ minGraphemes: l.optional(l.integer()),
45
+ maxGraphemes: l.optional(l.integer()),
46
+ enum: l.optional(l.array(l.string())),
47
+ const: l.optional(l.string()),
48
+ knownValues: l.optional(l.array(l.string())),
49
+ description: l.optional(l.string()),
53
50
  });
54
51
  /**
55
52
  * Schema for validating Lexicon bytes type definitions.
@@ -57,11 +54,11 @@ exports.lexiconStringSchema = lex_schema_1.l.object({
57
54
  * Validates binary data field definitions with optional length constraints.
58
55
  * Used for raw byte arrays in DAG-CBOR encoding.
59
56
  */
60
- exports.lexiconBytesSchema = lex_schema_1.l.object({
61
- type: lex_schema_1.l.literal('bytes'),
62
- maxLength: lex_schema_1.l.optional(lex_schema_1.l.integer()),
63
- minLength: lex_schema_1.l.optional(lex_schema_1.l.integer()),
64
- description: lex_schema_1.l.optional(lex_schema_1.l.string()),
57
+ export const lexiconBytesSchema = l.object({
58
+ type: l.literal('bytes'),
59
+ maxLength: l.optional(l.integer()),
60
+ minLength: l.optional(l.integer()),
61
+ description: l.optional(l.string()),
65
62
  });
66
63
  /**
67
64
  * Schema for validating Lexicon CID link type definitions.
@@ -69,9 +66,9 @@ exports.lexiconBytesSchema = lex_schema_1.l.object({
69
66
  * Validates Content Identifier (CID) link field definitions.
70
67
  * CIDs are used to reference content-addressed data in IPFS/IPLD.
71
68
  */
72
- exports.lexiconCidLinkSchema = lex_schema_1.l.object({
73
- type: lex_schema_1.l.literal('cid-link'),
74
- description: lex_schema_1.l.optional(lex_schema_1.l.string()),
69
+ export const lexiconCidLinkSchema = l.object({
70
+ type: l.literal('cid-link'),
71
+ description: l.optional(l.string()),
75
72
  });
76
73
  /**
77
74
  * Schema for validating Lexicon blob type definitions.
@@ -79,25 +76,25 @@ exports.lexiconCidLinkSchema = lex_schema_1.l.object({
79
76
  * Validates blob field definitions with optional MIME type acceptance list
80
77
  * and maximum size constraints. Blobs represent uploaded file references.
81
78
  */
82
- exports.lexiconBlobSchema = lex_schema_1.l.object({
83
- type: lex_schema_1.l.literal('blob'),
84
- accept: lex_schema_1.l.optional(lex_schema_1.l.array(lex_schema_1.l.string())),
85
- maxSize: lex_schema_1.l.optional(lex_schema_1.l.integer()),
86
- description: lex_schema_1.l.optional(lex_schema_1.l.string()),
79
+ export const lexiconBlobSchema = l.object({
80
+ type: l.literal('blob'),
81
+ accept: l.optional(l.array(l.string())),
82
+ maxSize: l.optional(l.integer()),
83
+ description: l.optional(l.string()),
87
84
  });
88
85
  /**
89
86
  * Array of all concrete (primitive) Lexicon type schemas.
90
87
  * Includes boolean, integer, string, bytes, cid-link, and blob types.
91
88
  */
92
89
  const CONCRETE_TYPES = [
93
- exports.lexiconBooleanSchema,
94
- exports.lexiconIntegerSchema,
95
- exports.lexiconStringSchema,
90
+ lexiconBooleanSchema,
91
+ lexiconIntegerSchema,
92
+ lexiconStringSchema,
96
93
  // Lexicon (DAG-CBOR)
97
- exports.lexiconBytesSchema,
98
- exports.lexiconCidLinkSchema,
94
+ lexiconBytesSchema,
95
+ lexiconCidLinkSchema,
99
96
  // Lexicon Specific
100
- exports.lexiconBlobSchema,
97
+ lexiconBlobSchema,
101
98
  ];
102
99
  // Meta types
103
100
  /**
@@ -106,9 +103,9 @@ const CONCRETE_TYPES = [
106
103
  * Validates unknown field definitions which accept any valid data.
107
104
  * Used when the schema cannot determine the type ahead of time.
108
105
  */
109
- exports.lexiconUnknownSchema = lex_schema_1.l.object({
110
- type: lex_schema_1.l.literal('unknown'),
111
- description: lex_schema_1.l.optional(lex_schema_1.l.string()),
106
+ export const lexiconUnknownSchema = l.object({
107
+ type: l.literal('unknown'),
108
+ description: l.optional(l.string()),
112
109
  });
113
110
  /**
114
111
  * Schema for validating Lexicon token type definitions.
@@ -117,9 +114,9 @@ exports.lexiconUnknownSchema = lex_schema_1.l.object({
117
114
  * Tokens are used to define enumeration-like values that can be
118
115
  * referenced across different lexicons.
119
116
  */
120
- exports.lexiconTokenSchema = lex_schema_1.l.object({
121
- type: lex_schema_1.l.literal('token'),
122
- description: lex_schema_1.l.optional(lex_schema_1.l.string()),
117
+ export const lexiconTokenSchema = l.object({
118
+ type: l.literal('token'),
119
+ description: l.optional(l.string()),
123
120
  });
124
121
  /**
125
122
  * Schema for validating Lexicon reference type definitions.
@@ -128,10 +125,10 @@ exports.lexiconTokenSchema = lex_schema_1.l.object({
128
125
  * within the same or different Lexicon documents. References use the
129
126
  * format "nsid#defName" for cross-document refs or "#defName" for local refs.
130
127
  */
131
- exports.lexiconRefSchema = lex_schema_1.l.object({
132
- type: lex_schema_1.l.literal('ref'),
133
- ref: lex_schema_1.l.string(),
134
- description: lex_schema_1.l.optional(lex_schema_1.l.string()),
128
+ export const lexiconRefSchema = l.object({
129
+ type: l.literal('ref'),
130
+ ref: l.string(),
131
+ description: l.optional(l.string()),
135
132
  });
136
133
  /**
137
134
  * Schema for validating Lexicon union reference type definitions.
@@ -140,19 +137,19 @@ exports.lexiconRefSchema = lex_schema_1.l.object({
140
137
  * The union can be closed (only listed types allowed) or open (allows
141
138
  * additional unlisted types).
142
139
  */
143
- exports.lexiconRefUnionSchema = lex_schema_1.l.object({
144
- type: lex_schema_1.l.literal('union'),
145
- refs: lex_schema_1.l.array(lex_schema_1.l.string()),
146
- closed: lex_schema_1.l.optional(lex_schema_1.l.boolean()),
147
- description: lex_schema_1.l.optional(lex_schema_1.l.string()),
140
+ export const lexiconRefUnionSchema = l.object({
141
+ type: l.literal('union'),
142
+ refs: l.array(l.string()),
143
+ closed: l.optional(l.boolean()),
144
+ description: l.optional(l.string()),
148
145
  });
149
146
  // Complex Types
150
147
  const ARRAY_ITEMS_SCHEMAS = [
151
148
  ...CONCRETE_TYPES,
152
149
  // Meta
153
- exports.lexiconUnknownSchema,
154
- exports.lexiconRefSchema,
155
- exports.lexiconRefUnionSchema,
150
+ lexiconUnknownSchema,
151
+ lexiconRefSchema,
152
+ lexiconRefUnionSchema,
156
153
  ];
157
154
  /**
158
155
  * Schema for validating Lexicon array type definitions.
@@ -160,12 +157,12 @@ const ARRAY_ITEMS_SCHEMAS = [
160
157
  * Validates array field definitions with specified item type and
161
158
  * optional length constraints.
162
159
  */
163
- exports.lexiconArraySchema = lex_schema_1.l.object({
164
- type: lex_schema_1.l.literal('array'),
165
- items: lex_schema_1.l.discriminatedUnion('type', ARRAY_ITEMS_SCHEMAS),
166
- minLength: lex_schema_1.l.optional(lex_schema_1.l.integer()),
167
- maxLength: lex_schema_1.l.optional(lex_schema_1.l.integer()),
168
- description: lex_schema_1.l.optional(lex_schema_1.l.string()),
160
+ export const lexiconArraySchema = l.object({
161
+ type: l.literal('array'),
162
+ items: l.discriminatedUnion('type', ARRAY_ITEMS_SCHEMAS),
163
+ minLength: l.optional(l.integer()),
164
+ maxLength: l.optional(l.integer()),
165
+ description: l.optional(l.string()),
169
166
  });
170
167
  const requirePropertiesRefinement = {
171
168
  check: (v) => !v.required || v.required.every((k) => k in v.properties),
@@ -179,15 +176,15 @@ const requirePropertiesRefinement = {
179
176
  * and nullable field lists. Includes refinement to ensure all required
180
177
  * properties are defined in the properties map.
181
178
  */
182
- exports.lexiconObjectSchema = lex_schema_1.l.refine(lex_schema_1.l.object({
183
- type: lex_schema_1.l.literal('object'),
184
- properties: lex_schema_1.l.dict(lex_schema_1.l.string(), lex_schema_1.l.discriminatedUnion('type', [
179
+ export const lexiconObjectSchema = l.refine(l.object({
180
+ type: l.literal('object'),
181
+ properties: l.dict(l.string(), l.discriminatedUnion('type', [
185
182
  ...ARRAY_ITEMS_SCHEMAS,
186
- exports.lexiconArraySchema,
183
+ lexiconArraySchema,
187
184
  ])),
188
- required: lex_schema_1.l.optional(lex_schema_1.l.array(lex_schema_1.l.string())),
189
- nullable: lex_schema_1.l.optional(lex_schema_1.l.array(lex_schema_1.l.string())),
190
- description: lex_schema_1.l.optional(lex_schema_1.l.string()),
185
+ required: l.optional(l.array(l.string())),
186
+ nullable: l.optional(l.array(l.string())),
187
+ description: l.optional(l.string()),
191
188
  }), requirePropertiesRefinement);
192
189
  // Records
193
190
  /**
@@ -199,7 +196,7 @@ exports.lexiconObjectSchema = lex_schema_1.l.refine(lex_schema_1.l.object({
199
196
  * - "tid": Timestamp identifier
200
197
  * - "literal:<string>": A specific literal string value
201
198
  */
202
- exports.lexiconRecordKeySchema = lex_schema_1.l.custom(lex_schema_1.l.isLexiconRecordKey, 'Invalid record key definition (must be "any", "nsid", "tid", or "literal:<string>")');
199
+ export const lexiconRecordKeySchema = l.custom(l.isLexiconRecordKey, 'Invalid record key definition (must be "any", "nsid", "tid", or "literal:<string>")');
203
200
  /**
204
201
  * Schema for validating Lexicon record type definitions.
205
202
  *
@@ -207,11 +204,11 @@ exports.lexiconRecordKeySchema = lex_schema_1.l.custom(lex_schema_1.l.isLexiconR
207
204
  * stored in AT Protocol repositories. Records have a key type
208
205
  * and an object schema defining the record's data structure.
209
206
  */
210
- exports.lexiconRecordSchema = lex_schema_1.l.object({
211
- type: lex_schema_1.l.literal('record'),
212
- record: exports.lexiconObjectSchema,
213
- description: lex_schema_1.l.optional(lex_schema_1.l.string()),
214
- key: exports.lexiconRecordKeySchema,
207
+ export const lexiconRecordSchema = l.object({
208
+ type: l.literal('record'),
209
+ record: lexiconObjectSchema,
210
+ description: l.optional(l.string()),
211
+ key: lexiconRecordKeySchema,
215
212
  });
216
213
  // XRPC Methods
217
214
  /**
@@ -221,26 +218,26 @@ exports.lexiconRecordSchema = lex_schema_1.l.object({
221
218
  * Parameters can only be primitive types (boolean, integer, string)
222
219
  * or arrays of primitives.
223
220
  */
224
- exports.lexiconParameters = lex_schema_1.l.refine(lex_schema_1.l.object({
225
- type: lex_schema_1.l.literal('params'),
226
- properties: lex_schema_1.l.dict(lex_schema_1.l.string(), lex_schema_1.l.discriminatedUnion('type', [
227
- exports.lexiconBooleanSchema,
228
- exports.lexiconIntegerSchema,
229
- exports.lexiconStringSchema,
230
- lex_schema_1.l.object({
231
- type: lex_schema_1.l.literal('array'),
232
- items: lex_schema_1.l.discriminatedUnion('type', [
233
- exports.lexiconBooleanSchema,
234
- exports.lexiconIntegerSchema,
235
- exports.lexiconStringSchema,
221
+ export const lexiconParameters = l.refine(l.object({
222
+ type: l.literal('params'),
223
+ properties: l.dict(l.string(), l.discriminatedUnion('type', [
224
+ lexiconBooleanSchema,
225
+ lexiconIntegerSchema,
226
+ lexiconStringSchema,
227
+ l.object({
228
+ type: l.literal('array'),
229
+ items: l.discriminatedUnion('type', [
230
+ lexiconBooleanSchema,
231
+ lexiconIntegerSchema,
232
+ lexiconStringSchema,
236
233
  ]),
237
- minLength: lex_schema_1.l.optional(lex_schema_1.l.integer()),
238
- maxLength: lex_schema_1.l.optional(lex_schema_1.l.integer()),
239
- description: lex_schema_1.l.optional(lex_schema_1.l.string()),
234
+ minLength: l.optional(l.integer()),
235
+ maxLength: l.optional(l.integer()),
236
+ description: l.optional(l.string()),
240
237
  }),
241
238
  ])),
242
- required: lex_schema_1.l.optional(lex_schema_1.l.array(lex_schema_1.l.string())),
243
- description: lex_schema_1.l.optional(lex_schema_1.l.string()),
239
+ required: l.optional(l.array(l.string())),
240
+ description: l.optional(l.string()),
244
241
  }), requirePropertiesRefinement);
245
242
  /**
246
243
  * Schema for validating Lexicon XRPC method payloads.
@@ -249,17 +246,17 @@ exports.lexiconParameters = lex_schema_1.l.refine(lex_schema_1.l.object({
249
246
  * Payloads specify the encoding (MIME type) and optional schema for
250
247
  * the request or response body.
251
248
  */
252
- exports.lexiconPayload = lex_schema_1.l.object({
253
- encoding: lex_schema_1.l.refine(lex_schema_1.l.string(), {
249
+ export const lexiconPayload = l.object({
250
+ encoding: l.refine(l.string(), {
254
251
  check: (v) => !v.includes(',') && !v.includes(';') && !v.includes(' '),
255
252
  message: 'Invalid encoding string (must be a single MIME type without parameters)',
256
253
  }),
257
- schema: lex_schema_1.l.optional(lex_schema_1.l.discriminatedUnion('type', [
258
- exports.lexiconRefSchema,
259
- exports.lexiconRefUnionSchema,
260
- exports.lexiconObjectSchema,
254
+ schema: l.optional(l.discriminatedUnion('type', [
255
+ lexiconRefSchema,
256
+ lexiconRefUnionSchema,
257
+ lexiconObjectSchema,
261
258
  ])),
262
- description: lex_schema_1.l.optional(lex_schema_1.l.string()),
259
+ description: l.optional(l.string()),
263
260
  });
264
261
  /**
265
262
  * Schema for validating Lexicon XRPC error definitions.
@@ -267,9 +264,9 @@ exports.lexiconPayload = lex_schema_1.l.object({
267
264
  * Validates error definitions that can be returned by XRPC methods.
268
265
  * Each error has a name and optional description.
269
266
  */
270
- exports.lexiconError = lex_schema_1.l.object({
271
- name: lex_schema_1.l.string({ minLength: 1 }),
272
- description: lex_schema_1.l.optional(lex_schema_1.l.string()),
267
+ export const lexiconError = l.object({
268
+ name: l.string({ minLength: 1 }),
269
+ description: l.optional(l.string()),
273
270
  });
274
271
  /**
275
272
  * Schema for validating Lexicon query (GET) method definitions.
@@ -278,12 +275,12 @@ exports.lexiconError = lex_schema_1.l.object({
278
275
  * operations. Queries can have parameters, an output payload, and
279
276
  * defined error types.
280
277
  */
281
- exports.lexiconQuerySchema = lex_schema_1.l.object({
282
- type: lex_schema_1.l.literal('query'),
283
- parameters: lex_schema_1.l.optional(exports.lexiconParameters),
284
- output: lex_schema_1.l.optional(exports.lexiconPayload),
285
- errors: lex_schema_1.l.optional(lex_schema_1.l.array(exports.lexiconError)),
286
- description: lex_schema_1.l.optional(lex_schema_1.l.string()),
278
+ export const lexiconQuerySchema = l.object({
279
+ type: l.literal('query'),
280
+ parameters: l.optional(lexiconParameters),
281
+ output: l.optional(lexiconPayload),
282
+ errors: l.optional(l.array(lexiconError)),
283
+ description: l.optional(l.string()),
287
284
  });
288
285
  /**
289
286
  * Schema for validating Lexicon procedure (POST) method definitions.
@@ -292,13 +289,13 @@ exports.lexiconQuerySchema = lex_schema_1.l.object({
292
289
  * operations that may modify state. Procedures can have parameters,
293
290
  * input payload, output payload, and defined error types.
294
291
  */
295
- exports.lexiconProcedureSchema = lex_schema_1.l.object({
296
- type: lex_schema_1.l.literal('procedure'),
297
- parameters: lex_schema_1.l.optional(exports.lexiconParameters),
298
- input: lex_schema_1.l.optional(exports.lexiconPayload),
299
- output: lex_schema_1.l.optional(exports.lexiconPayload),
300
- errors: lex_schema_1.l.optional(lex_schema_1.l.array(exports.lexiconError)),
301
- description: lex_schema_1.l.optional(lex_schema_1.l.string()),
292
+ export const lexiconProcedureSchema = l.object({
293
+ type: l.literal('procedure'),
294
+ parameters: l.optional(lexiconParameters),
295
+ input: l.optional(lexiconPayload),
296
+ output: l.optional(lexiconPayload),
297
+ errors: l.optional(l.array(lexiconError)),
298
+ description: l.optional(l.string()),
302
299
  });
303
300
  /**
304
301
  * Schema for validating Lexicon subscription (WebSocket) method definitions.
@@ -307,57 +304,57 @@ exports.lexiconProcedureSchema = lex_schema_1.l.object({
307
304
  * streaming connections over WebSocket. Subscriptions have parameters,
308
305
  * a message schema defining the streamed data format, and error types.
309
306
  */
310
- exports.lexiconSubscriptionSchema = lex_schema_1.l.object({
311
- type: lex_schema_1.l.literal('subscription'),
312
- description: lex_schema_1.l.optional(lex_schema_1.l.string()),
313
- parameters: lex_schema_1.l.optional(exports.lexiconParameters),
314
- message: lex_schema_1.l.object({
315
- description: lex_schema_1.l.optional(lex_schema_1.l.string()),
316
- schema: exports.lexiconRefUnionSchema,
307
+ export const lexiconSubscriptionSchema = l.object({
308
+ type: l.literal('subscription'),
309
+ description: l.optional(l.string()),
310
+ parameters: l.optional(lexiconParameters),
311
+ message: l.object({
312
+ description: l.optional(l.string()),
313
+ schema: lexiconRefUnionSchema,
317
314
  }),
318
- errors: lex_schema_1.l.optional(lex_schema_1.l.array(exports.lexiconError)),
315
+ errors: l.optional(l.array(lexiconError)),
319
316
  });
320
317
  // Permissions
321
318
  /**
322
319
  * Schema for validating language codes in Lexicon permission definitions.
323
320
  */
324
- exports.lexiconLanguageSchema = lex_schema_1.l.string({ format: 'language' });
321
+ export const lexiconLanguageSchema = l.string({ format: 'language' });
325
322
  /**
326
323
  * Schema for validating language-keyed string dictionaries.
327
324
  * Used for localized text in permission definitions.
328
325
  */
329
- exports.lexiconLanguageDict = lex_schema_1.l.dict(exports.lexiconLanguageSchema, lex_schema_1.l.string());
326
+ export const lexiconLanguageDict = l.dict(lexiconLanguageSchema, l.string());
330
327
  /**
331
328
  * Schema for validating individual Lexicon permission definitions.
332
329
  */
333
- exports.lexiconPermissionSchema = lex_schema_1.l.intersection(lex_schema_1.l.object({
334
- type: lex_schema_1.l.literal('permission'),
335
- resource: lex_schema_1.l.string({ minLength: 1 }),
336
- }), lex_schema_1.l.dict(lex_schema_1.l.string(), lex_schema_1.l.paramSchema));
330
+ export const lexiconPermissionSchema = l.intersection(l.object({
331
+ type: l.literal('permission'),
332
+ resource: l.string({ minLength: 1 }),
333
+ }), l.dict(l.string(), l.paramSchema));
337
334
  /**
338
335
  * Schema for validating Lexicon permission set definitions.
339
336
  */
340
- exports.lexiconPermissionSetSchema = lex_schema_1.l.object({
341
- type: lex_schema_1.l.literal('permission-set'),
342
- permissions: lex_schema_1.l.array(exports.lexiconPermissionSchema),
343
- title: lex_schema_1.l.optional(lex_schema_1.l.string()),
344
- 'title:lang': lex_schema_1.l.optional(exports.lexiconLanguageDict),
345
- detail: lex_schema_1.l.optional(lex_schema_1.l.string()),
346
- 'detail:lang': lex_schema_1.l.optional(exports.lexiconLanguageDict),
347
- description: lex_schema_1.l.optional(lex_schema_1.l.string()),
337
+ export const lexiconPermissionSetSchema = l.object({
338
+ type: l.literal('permission-set'),
339
+ permissions: l.array(lexiconPermissionSchema),
340
+ title: l.optional(l.string()),
341
+ 'title:lang': l.optional(lexiconLanguageDict),
342
+ detail: l.optional(l.string()),
343
+ 'detail:lang': l.optional(lexiconLanguageDict),
344
+ description: l.optional(l.string()),
348
345
  });
349
346
  const NAMED_LEXICON_SCHEMAS = [
350
347
  ...CONCRETE_TYPES,
351
- exports.lexiconArraySchema,
352
- exports.lexiconObjectSchema,
353
- exports.lexiconTokenSchema,
348
+ lexiconArraySchema,
349
+ lexiconObjectSchema,
350
+ lexiconTokenSchema,
354
351
  ];
355
352
  const MAIN_LEXICON_SCHEMAS = [
356
- exports.lexiconPermissionSetSchema,
357
- exports.lexiconProcedureSchema,
358
- exports.lexiconQuerySchema,
359
- exports.lexiconRecordSchema,
360
- exports.lexiconSubscriptionSchema,
353
+ lexiconPermissionSetSchema,
354
+ lexiconProcedureSchema,
355
+ lexiconQuerySchema,
356
+ lexiconRecordSchema,
357
+ lexiconSubscriptionSchema,
361
358
  ...NAMED_LEXICON_SCHEMAS,
362
359
  ];
363
360
  /**
@@ -366,7 +363,7 @@ const MAIN_LEXICON_SCHEMAS = [
366
363
  * Validates that the identifier follows the Namespaced Identifier format
367
364
  * (e.g., "com.atproto.repo.createRecord").
368
365
  */
369
- exports.lexiconIdentifierSchema = lex_schema_1.l.string({ format: 'nsid' });
366
+ export const lexiconIdentifierSchema = l.string({ format: 'nsid' });
370
367
  /**
371
368
  * Schema for validating complete Lexicon document structures.
372
369
  *
@@ -403,13 +400,13 @@ exports.lexiconIdentifierSchema = lex_schema_1.l.string({ format: 'nsid' });
403
400
  * })
404
401
  * ```
405
402
  */
406
- exports.lexiconDocumentSchema = lex_schema_1.l.object({
407
- lexicon: lex_schema_1.l.literal(1),
408
- id: exports.lexiconIdentifierSchema,
409
- revision: lex_schema_1.l.optional(lex_schema_1.l.integer()),
410
- description: lex_schema_1.l.optional(lex_schema_1.l.string()),
411
- defs: lex_schema_1.l.intersection(lex_schema_1.l.object({
412
- main: lex_schema_1.l.optional(lex_schema_1.l.discriminatedUnion('type', MAIN_LEXICON_SCHEMAS)),
413
- }), lex_schema_1.l.dict(lex_schema_1.l.string({ minLength: 1 }), lex_schema_1.l.discriminatedUnion('type', NAMED_LEXICON_SCHEMAS))),
403
+ export const lexiconDocumentSchema = l.object({
404
+ lexicon: l.literal(1),
405
+ id: lexiconIdentifierSchema,
406
+ revision: l.optional(l.integer()),
407
+ description: l.optional(l.string()),
408
+ defs: l.intersection(l.object({
409
+ main: l.optional(l.discriminatedUnion('type', MAIN_LEXICON_SCHEMAS)),
410
+ }), l.dict(l.string({ minLength: 1 }), l.discriminatedUnion('type', NAMED_LEXICON_SCHEMAS))),
414
411
  });
415
412
  //# sourceMappingURL=lexicon-document.js.map