@atproto/lex-schema 0.1.5 → 0.1.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.
Files changed (263) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/core/$type.d.ts +2 -2
  3. package/dist/core/$type.d.ts.map +1 -1
  4. package/dist/core/$type.js.map +1 -1
  5. package/dist/core/record-key.d.ts +1 -1
  6. package/dist/core/record-key.d.ts.map +1 -1
  7. package/dist/core/record-key.js.map +1 -1
  8. package/dist/core/schema.d.ts +3 -2
  9. package/dist/core/schema.d.ts.map +1 -1
  10. package/dist/core/schema.js +1 -1
  11. package/dist/core/schema.js.map +1 -1
  12. package/dist/core/standard-schema.d.ts +2 -2
  13. package/dist/core/standard-schema.d.ts.map +1 -1
  14. package/dist/core/standard-schema.js.map +1 -1
  15. package/dist/core/string-format.d.ts +2 -2
  16. package/dist/core/string-format.d.ts.map +1 -1
  17. package/dist/core/string-format.js.map +1 -1
  18. package/dist/core/validation-error.d.ts +1 -1
  19. package/dist/core/validation-error.d.ts.map +1 -1
  20. package/dist/core/validation-error.js +1 -1
  21. package/dist/core/validation-error.js.map +1 -1
  22. package/dist/core/validator.d.ts +1 -1
  23. package/dist/core/validator.d.ts.map +1 -1
  24. package/dist/core/validator.js +1 -1
  25. package/dist/core/validator.js.map +1 -1
  26. package/dist/helpers.d.ts +2 -2
  27. package/dist/helpers.d.ts.map +1 -1
  28. package/dist/helpers.js +2 -2
  29. package/dist/helpers.js.map +1 -1
  30. package/dist/schema/array.d.ts +1 -1
  31. package/dist/schema/array.d.ts.map +1 -1
  32. package/dist/schema/array.js +1 -1
  33. package/dist/schema/array.js.map +1 -1
  34. package/dist/schema/blob.d.ts +1 -1
  35. package/dist/schema/blob.d.ts.map +1 -1
  36. package/dist/schema/blob.js +2 -2
  37. package/dist/schema/blob.js.map +1 -1
  38. package/dist/schema/boolean.js +1 -1
  39. package/dist/schema/boolean.js.map +1 -1
  40. package/dist/schema/bytes.js +1 -1
  41. package/dist/schema/bytes.js.map +1 -1
  42. package/dist/schema/cid.d.ts +1 -1
  43. package/dist/schema/cid.d.ts.map +1 -1
  44. package/dist/schema/cid.js +3 -3
  45. package/dist/schema/cid.js.map +1 -1
  46. package/dist/schema/custom.js +1 -1
  47. package/dist/schema/custom.js.map +1 -1
  48. package/dist/schema/dict.d.ts +1 -1
  49. package/dist/schema/dict.d.ts.map +1 -1
  50. package/dist/schema/dict.js +1 -1
  51. package/dist/schema/dict.js.map +1 -1
  52. package/dist/schema/discriminated-union.d.ts +1 -1
  53. package/dist/schema/discriminated-union.d.ts.map +1 -1
  54. package/dist/schema/discriminated-union.js +2 -1
  55. package/dist/schema/discriminated-union.js.map +1 -1
  56. package/dist/schema/enum.js +1 -1
  57. package/dist/schema/enum.js.map +1 -1
  58. package/dist/schema/integer.js +1 -1
  59. package/dist/schema/integer.js.map +1 -1
  60. package/dist/schema/intersection.d.ts +1 -1
  61. package/dist/schema/intersection.d.ts.map +1 -1
  62. package/dist/schema/intersection.js +3 -1
  63. package/dist/schema/intersection.js.map +1 -1
  64. package/dist/schema/lex-map.d.ts +1 -1
  65. package/dist/schema/lex-map.d.ts.map +1 -1
  66. package/dist/schema/lex-map.js +1 -1
  67. package/dist/schema/lex-map.js.map +1 -1
  68. package/dist/schema/lex-value.d.ts +1 -1
  69. package/dist/schema/lex-value.d.ts.map +1 -1
  70. package/dist/schema/lex-value.js +1 -1
  71. package/dist/schema/lex-value.js.map +1 -1
  72. package/dist/schema/literal.js +1 -1
  73. package/dist/schema/literal.js.map +1 -1
  74. package/dist/schema/never.js +1 -1
  75. package/dist/schema/never.js.map +1 -1
  76. package/dist/schema/null.js +1 -1
  77. package/dist/schema/null.js.map +1 -1
  78. package/dist/schema/nullable.d.ts +1 -1
  79. package/dist/schema/nullable.d.ts.map +1 -1
  80. package/dist/schema/nullable.js +1 -1
  81. package/dist/schema/nullable.js.map +1 -1
  82. package/dist/schema/object.d.ts +2 -1
  83. package/dist/schema/object.d.ts.map +1 -1
  84. package/dist/schema/object.js +1 -1
  85. package/dist/schema/object.js.map +1 -1
  86. package/dist/schema/optional.d.ts +2 -1
  87. package/dist/schema/optional.d.ts.map +1 -1
  88. package/dist/schema/optional.js +2 -1
  89. package/dist/schema/optional.js.map +1 -1
  90. package/dist/schema/params.d.ts +1 -1
  91. package/dist/schema/params.d.ts.map +1 -1
  92. package/dist/schema/params.js +1 -1
  93. package/dist/schema/params.js.map +1 -1
  94. package/dist/schema/payload.d.ts +3 -2
  95. package/dist/schema/payload.d.ts.map +1 -1
  96. package/dist/schema/payload.js +2 -1
  97. package/dist/schema/payload.js.map +1 -1
  98. package/dist/schema/permission-set.d.ts +1 -1
  99. package/dist/schema/permission-set.d.ts.map +1 -1
  100. package/dist/schema/permission-set.js +1 -0
  101. package/dist/schema/permission-set.js.map +1 -1
  102. package/dist/schema/permission.d.ts +1 -1
  103. package/dist/schema/permission.d.ts.map +1 -1
  104. package/dist/schema/permission.js.map +1 -1
  105. package/dist/schema/procedure.d.ts +1 -1
  106. package/dist/schema/procedure.d.ts.map +1 -1
  107. package/dist/schema/procedure.js +2 -0
  108. package/dist/schema/procedure.js.map +1 -1
  109. package/dist/schema/query.d.ts +1 -1
  110. package/dist/schema/query.d.ts.map +1 -1
  111. package/dist/schema/query.js +2 -0
  112. package/dist/schema/query.js.map +1 -1
  113. package/dist/schema/record.d.ts +2 -2
  114. package/dist/schema/record.d.ts.map +1 -1
  115. package/dist/schema/record.js +1 -1
  116. package/dist/schema/record.js.map +1 -1
  117. package/dist/schema/ref.d.ts +1 -1
  118. package/dist/schema/ref.d.ts.map +1 -1
  119. package/dist/schema/ref.js +1 -1
  120. package/dist/schema/ref.js.map +1 -1
  121. package/dist/schema/refine.d.ts +2 -2
  122. package/dist/schema/refine.d.ts.map +1 -1
  123. package/dist/schema/refine.js +1 -1
  124. package/dist/schema/refine.js.map +1 -1
  125. package/dist/schema/regexp.js +1 -1
  126. package/dist/schema/regexp.js.map +1 -1
  127. package/dist/schema/string.d.ts +2 -2
  128. package/dist/schema/string.d.ts.map +1 -1
  129. package/dist/schema/string.js +1 -1
  130. package/dist/schema/string.js.map +1 -1
  131. package/dist/schema/subscription.d.ts +3 -2
  132. package/dist/schema/subscription.d.ts.map +1 -1
  133. package/dist/schema/subscription.js +2 -0
  134. package/dist/schema/subscription.js.map +1 -1
  135. package/dist/schema/token.d.ts +1 -1
  136. package/dist/schema/token.d.ts.map +1 -1
  137. package/dist/schema/token.js +1 -1
  138. package/dist/schema/token.js.map +1 -1
  139. package/dist/schema/typed-object.d.ts +2 -2
  140. package/dist/schema/typed-object.d.ts.map +1 -1
  141. package/dist/schema/typed-object.js +1 -1
  142. package/dist/schema/typed-object.js.map +1 -1
  143. package/dist/schema/typed-ref.d.ts +1 -1
  144. package/dist/schema/typed-ref.d.ts.map +1 -1
  145. package/dist/schema/typed-ref.js +1 -1
  146. package/dist/schema/typed-ref.js.map +1 -1
  147. package/dist/schema/typed-union.d.ts +1 -1
  148. package/dist/schema/typed-union.d.ts.map +1 -1
  149. package/dist/schema/typed-union.js +3 -1
  150. package/dist/schema/typed-union.js.map +1 -1
  151. package/dist/schema/union.d.ts +1 -1
  152. package/dist/schema/union.d.ts.map +1 -1
  153. package/dist/schema/union.js +1 -1
  154. package/dist/schema/union.js.map +1 -1
  155. package/dist/schema/unknown.js +1 -1
  156. package/dist/schema/unknown.js.map +1 -1
  157. package/dist/schema/with-default.d.ts +1 -1
  158. package/dist/schema/with-default.d.ts.map +1 -1
  159. package/dist/schema/with-default.js +1 -1
  160. package/dist/schema/with-default.js.map +1 -1
  161. package/package.json +6 -10
  162. package/src/core/$type.test.ts +0 -24
  163. package/src/core/$type.ts +0 -199
  164. package/src/core/record-key.ts +0 -85
  165. package/src/core/result.ts +0 -15
  166. package/src/core/schema.ts +0 -412
  167. package/src/core/standard-schema.test.ts +0 -124
  168. package/src/core/standard-schema.ts +0 -31
  169. package/src/core/string-format.ts +0 -411
  170. package/src/core/types.ts +0 -120
  171. package/src/core/validation-error.ts +0 -134
  172. package/src/core/validation-issue.ts +0 -340
  173. package/src/core/validator.ts +0 -636
  174. package/src/core.ts +0 -9
  175. package/src/external.ts +0 -3
  176. package/src/helpers.test.ts +0 -694
  177. package/src/helpers.ts +0 -222
  178. package/src/index.ts +0 -3
  179. package/src/schema/array.test.ts +0 -251
  180. package/src/schema/array.ts +0 -126
  181. package/src/schema/blob.test.ts +0 -733
  182. package/src/schema/blob.ts +0 -150
  183. package/src/schema/boolean.test.ts +0 -118
  184. package/src/schema/boolean.ts +0 -46
  185. package/src/schema/bytes.test.ts +0 -227
  186. package/src/schema/bytes.ts +0 -81
  187. package/src/schema/cid.test.ts +0 -125
  188. package/src/schema/cid.ts +0 -69
  189. package/src/schema/custom.test.ts +0 -414
  190. package/src/schema/custom.ts +0 -106
  191. package/src/schema/dict.test.ts +0 -181
  192. package/src/schema/dict.ts +0 -122
  193. package/src/schema/discriminated-union.test.ts +0 -676
  194. package/src/schema/discriminated-union.ts +0 -196
  195. package/src/schema/enum.test.ts +0 -398
  196. package/src/schema/enum.ts +0 -77
  197. package/src/schema/integer.test.ts +0 -314
  198. package/src/schema/integer.ts +0 -86
  199. package/src/schema/intersection.test.ts +0 -33
  200. package/src/schema/intersection.ts +0 -113
  201. package/src/schema/lex-map.test.ts +0 -593
  202. package/src/schema/lex-map.ts +0 -63
  203. package/src/schema/lex-value.test.ts +0 -81
  204. package/src/schema/lex-value.ts +0 -86
  205. package/src/schema/literal.test.ts +0 -533
  206. package/src/schema/literal.ts +0 -70
  207. package/src/schema/never.test.ts +0 -175
  208. package/src/schema/never.ts +0 -56
  209. package/src/schema/null.test.ts +0 -80
  210. package/src/schema/null.ts +0 -49
  211. package/src/schema/nullable.test.ts +0 -470
  212. package/src/schema/nullable.ts +0 -74
  213. package/src/schema/object.test.ts +0 -69
  214. package/src/schema/object.ts +0 -136
  215. package/src/schema/optional.test.ts +0 -479
  216. package/src/schema/optional.ts +0 -92
  217. package/src/schema/params.test.ts +0 -1118
  218. package/src/schema/params.ts +0 -371
  219. package/src/schema/payload.test.ts +0 -340
  220. package/src/schema/payload.ts +0 -204
  221. package/src/schema/permission-set.test.ts +0 -613
  222. package/src/schema/permission-set.ts +0 -86
  223. package/src/schema/permission.test.ts +0 -537
  224. package/src/schema/permission.ts +0 -63
  225. package/src/schema/procedure.test.ts +0 -324
  226. package/src/schema/procedure.ts +0 -98
  227. package/src/schema/query.test.ts +0 -348
  228. package/src/schema/query.ts +0 -86
  229. package/src/schema/record.test.ts +0 -812
  230. package/src/schema/record.ts +0 -217
  231. package/src/schema/ref.test.ts +0 -349
  232. package/src/schema/ref.ts +0 -103
  233. package/src/schema/refine.test.ts +0 -579
  234. package/src/schema/refine.ts +0 -153
  235. package/src/schema/regexp.test.ts +0 -577
  236. package/src/schema/regexp.ts +0 -82
  237. package/src/schema/string.test.ts +0 -773
  238. package/src/schema/string.ts +0 -229
  239. package/src/schema/subscription.test.ts +0 -499
  240. package/src/schema/subscription.ts +0 -108
  241. package/src/schema/token.test.ts +0 -152
  242. package/src/schema/token.ts +0 -103
  243. package/src/schema/typed-object.test.ts +0 -745
  244. package/src/schema/typed-object.ts +0 -181
  245. package/src/schema/typed-ref.test.ts +0 -796
  246. package/src/schema/typed-ref.ts +0 -126
  247. package/src/schema/typed-union.test.ts +0 -355
  248. package/src/schema/typed-union.ts +0 -130
  249. package/src/schema/union.test.ts +0 -191
  250. package/src/schema/union.ts +0 -89
  251. package/src/schema/unknown.test.ts +0 -313
  252. package/src/schema/unknown.ts +0 -47
  253. package/src/schema/with-default.ts +0 -81
  254. package/src/schema.ts +0 -43
  255. package/src/util/array-agg.test.ts +0 -42
  256. package/src/util/array-agg.ts +0 -44
  257. package/src/util/assertion-util.ts +0 -1
  258. package/src/util/if-any.ts +0 -3
  259. package/src/util/lazy-property.ts +0 -14
  260. package/src/util/memoize.ts +0 -37
  261. package/tsconfig.build.json +0 -12
  262. package/tsconfig.json +0 -7
  263. package/tsconfig.tests.json +0 -8
package/src/core/$type.ts DELETED
@@ -1,199 +0,0 @@
1
- import { NsidString } from './string-format.js'
2
- import { OmitKey, Simplify } from './types.js'
3
-
4
- /**
5
- * Constructs the `$type` string type for a given NSID and hash.
6
- *
7
- * The `$type` value identifies a schema definition within a lexicon:
8
- * - For "main" definitions: just the NSID (e.g., `'app.bsky.feed.post'`)
9
- * - For named definitions: NSID + hash + name (e.g., `'app.bsky.feed.defs#postView'`)
10
- *
11
- * @typeParam N - The NSID string type
12
- * @typeParam H - The hash/definition name (use `'main'` for the main definition)
13
- *
14
- * @example
15
- * ```typescript
16
- * type MainType = $Type<'app.bsky.feed.post', 'main'>
17
- * // Result: 'app.bsky.feed.post'
18
- *
19
- * type DefType = $Type<'app.bsky.feed.defs', 'postView'>
20
- * // Result: 'app.bsky.feed.defs#postView'
21
- * ```
22
- */
23
- export type $Type<
24
- N extends NsidString = NsidString,
25
- H extends string = string,
26
- > = N extends NsidString
27
- ? string extends H
28
- ? N | `${N}#${string}`
29
- : H extends 'main'
30
- ? N
31
- : `${N}#${H}`
32
- : never
33
-
34
- /**
35
- * Extracts the `$type` string type from an object type.
36
- *
37
- * @typeParam O - An object type with an optional `$type` property
38
- *
39
- * @example
40
- * ```typescript
41
- * type Post = { $type: 'app.bsky.feed.post'; text: string }
42
- * type PostType = $TypeOf<Post>
43
- * // Result: 'app.bsky.feed.post'
44
- * ```
45
- */
46
- export type $TypeOf<O extends { $type?: string }> = NonNullable<O['$type']>
47
-
48
- /**
49
- * Constructs a `$type` string value from an NSID and definition name.
50
- *
51
- * For the "main" definition, returns just the NSID. For named definitions,
52
- * returns the NSID followed by `#` and the definition name.
53
- *
54
- * @typeParam N - The NSID string type
55
- * @typeParam H - The definition name type
56
- * @param nsid - The NSID of the lexicon
57
- * @param hash - The definition name within the lexicon (use `'main'` for the main definition)
58
- * @returns The constructed `$type` string
59
- *
60
- * @example
61
- * ```typescript
62
- * $type('app.bsky.feed.post', 'main')
63
- * // Returns: 'app.bsky.feed.post'
64
- *
65
- * $type('app.bsky.feed.defs', 'postView')
66
- * // Returns: 'app.bsky.feed.defs#postView'
67
- * ```
68
- */
69
- /*@__NO_SIDE_EFFECTS__*/
70
- export function $type<N extends NsidString, H extends string>(
71
- nsid: N,
72
- hash: H,
73
- ): $Type<N, H> {
74
- return (hash === 'main' ? nsid : `${nsid}#${hash}`) as $Type<N, H>
75
- }
76
-
77
- /**
78
- * Represents an object with a required `$type` property.
79
- *
80
- * This type adds a `$type` property to an existing object type, useful for
81
- * representing typed AT Protocol objects.
82
- *
83
- * @typeParam V - The base object type
84
- * @typeParam T - The `$type` string literal type
85
- *
86
- * @example
87
- * ```typescript
88
- * type Post = $Typed<{ text: string; createdAt: string }, 'app.bsky.feed.post'>
89
- * // Result: { $type: 'app.bsky.feed.post'; text: string; createdAt: string }
90
- * ```
91
- */
92
- export type $Typed<V, T extends string = string> = Simplify<
93
- V & {
94
- $type: T
95
- }
96
- >
97
-
98
- /**
99
- * Ensures an object has the specified `$type` property.
100
- *
101
- * If the object already has the correct `$type`, returns it unchanged.
102
- * Otherwise, creates a new object with the `$type` property added.
103
- *
104
- * @typeParam V - The object type (may already have `$type`)
105
- * @typeParam T - The expected `$type` string
106
- * @param value - The object to add `$type` to
107
- * @param $type - The `$type` value to ensure
108
- * @returns The object with the `$type` property
109
- *
110
- * @example
111
- * ```typescript
112
- * const post = $typed({ text: 'hello' }, 'app.bsky.feed.post')
113
- * // Result: { $type: 'app.bsky.feed.post', text: 'hello' }
114
- *
115
- * // If already typed, returns same object
116
- * const typed = { $type: 'app.bsky.feed.post', text: 'hello' }
117
- * const same = $typed(typed, 'app.bsky.feed.post')
118
- * console.log(typed === same) // true
119
- * ```
120
- */
121
- export function $typed<V extends { $type?: unknown }, T extends string>(
122
- value: V,
123
- $type: T,
124
- ): $Typed<V, T> {
125
- return value.$type === $type ? (value as $Typed<V, T>) : { ...value, $type }
126
- }
127
-
128
- /**
129
- * Represents an object with an optional `$type` property.
130
- *
131
- * This is used for objects that may or may not have type information,
132
- * such as input parameters that accept both typed and untyped values.
133
- *
134
- * @typeParam V - The base object type
135
- * @typeParam T - The optional `$type` string literal type
136
- */
137
- export type $TypedMaybe<V, T extends string = string> = Simplify<
138
- V & {
139
- $type?: T
140
- }
141
- >
142
-
143
- /**
144
- * Removes the `$type` property from an object type.
145
- *
146
- * Useful for extracting the "content" of a typed object without the type marker.
147
- *
148
- * @typeParam V - An object type with an optional `$type` property
149
- *
150
- * @example
151
- * ```typescript
152
- * type Post = { $type: 'app.bsky.feed.post'; text: string }
153
- * type PostContent = Un$Typed<Post>
154
- * // Result: { text: string }
155
- * ```
156
- */
157
- export type Un$Typed<V extends { $type?: string }> = OmitKey<V, '$type'>
158
-
159
- /**
160
- * Unique symbol for branding unknown `$type` strings.
161
- * @internal
162
- */
163
- declare const unknown$TypeSymbol: unique symbol
164
-
165
- /**
166
- * Represents an unknown or unrecognized `$type` string.
167
- *
168
- * This branded type is used in union types to distinguish between
169
- * known typed objects and unknown typed objects (from open unions).
170
- * The branding prevents accidentally matching known `$type` values.
171
- */
172
- export type Unknown$Type = string & { [unknown$TypeSymbol]: true }
173
-
174
- /**
175
- * Represents an object with an unknown `$type` value.
176
- *
177
- * This type is used in open union schemas to represent typed objects that
178
- * don't match any of the known types. The {@link Unknown$Type} branding ensures
179
- * that invalid instances of known types don't accidentally match this type.
180
- *
181
- * For example, in an open union like:
182
- * ```typescript
183
- * type MyOpenUnion = { $type: 'A'; a: number } | Unknown$TypedObject
184
- * ```
185
- *
186
- * A value `{ $type: 'A' }` (missing the required `a` property) will NOT match
187
- * `Unknown$TypedObject` because `'A'` is not assignable to `Unknown$Type`.
188
- * This ensures that malformed instances of known types are properly rejected.
189
- *
190
- * @example
191
- * ```typescript
192
- * // This represents any typed object we don't recognize
193
- * const unknownTyped: Unknown$TypedObject = {
194
- * $type: 'some.unknown.type' as Unknown$Type,
195
- * // ... arbitrary properties
196
- * }
197
- * ```
198
- */
199
- export type Unknown$TypedObject = { $type: Unknown$Type }
@@ -1,85 +0,0 @@
1
- import { NsidString, TidString, isValidRecordKey } from '@atproto/syntax'
2
-
3
- /**
4
- * The valid record key constraint types in a lexicon definition.
5
- *
6
- * - `'any'` - Accepts any valid record key
7
- * - `'nsid'` - Record key must be a valid NSID
8
- * - `'tid'` - Record key must be a valid TID
9
- * - `'literal:...'` - Record key must be the exact specified value
10
- *
11
- * @example
12
- * ```typescript
13
- * const constraint: LexiconRecordKey = 'tid'
14
- * const literalConstraint: LexiconRecordKey = 'literal:self'
15
- * ```
16
- */
17
- export type LexiconRecordKey = 'any' | 'nsid' | 'tid' | `literal:${string}`
18
-
19
- /**
20
- * Type guard that checks if a value is a valid lexicon record key constraint.
21
- *
22
- * @typeParam T - The input type
23
- * @param key - The value to check
24
- * @returns `true` if the value is a valid record key constraint
25
- *
26
- * @example
27
- * ```typescript
28
- * if (isLexiconRecordKey(value)) {
29
- * // value is typed as LexiconRecordKey
30
- * console.log('Valid constraint:', value)
31
- * }
32
- * ```
33
- */
34
- /*@__NO_SIDE_EFFECTS__*/
35
- export function isLexiconRecordKey<T>(key: T): key is T & LexiconRecordKey {
36
- return (
37
- key === 'any' ||
38
- key === 'nsid' ||
39
- key === 'tid' ||
40
- (typeof key === 'string' &&
41
- key.startsWith('literal:') &&
42
- key.length > 8 &&
43
- isValidRecordKey(key.slice(8)))
44
- )
45
- }
46
-
47
- /**
48
- * Validates and returns a value as a lexicon record key constraint, throwing if invalid.
49
- *
50
- * @param key - The value to validate
51
- * @returns The value typed as {@link LexiconRecordKey}
52
- * @throws {Error} If the value is not a valid record key constraint
53
- *
54
- * @example
55
- * ```typescript
56
- * const constraint = asLexiconRecordKey('tid')
57
- * // constraint is typed as LexiconRecordKey
58
- *
59
- * asLexiconRecordKey('invalid') // throws Error
60
- * ```
61
- */
62
- /*@__NO_SIDE_EFFECTS__*/
63
- export function asLexiconRecordKey(key: unknown): LexiconRecordKey {
64
- if (isLexiconRecordKey(key)) return key
65
- throw new Error(`Invalid record key: ${String(key)}`)
66
- }
67
-
68
- /**
69
- * Maps a lexicon record key definition to its corresponding string subtype.
70
- *
71
- * - `'any'` maps to `string`
72
- * - `'nsid'` maps to `NsidString`
73
- * - `'tid'` maps to `TidString`
74
- * - `'literal:...'` maps to the literal string value
75
- */
76
- export type RecordKeyValue<Key extends LexiconRecordKey = LexiconRecordKey> =
77
- Key extends 'any'
78
- ? string
79
- : Key extends 'tid'
80
- ? TidString
81
- : Key extends 'nsid'
82
- ? NsidString
83
- : Key extends `literal:${infer L extends string}`
84
- ? L
85
- : never
@@ -1,15 +0,0 @@
1
- export type ResultSuccess<V = any> = {
2
- success: true
3
- value: V
4
- reason?: undefined
5
- }
6
-
7
- /**
8
- * Represents a failed result containing an error reason.
9
- *
10
- * @typeParam E - The type of the error reason
11
- */
12
- export type ResultFailure<E = Error> = {
13
- success: false
14
- reason: E
15
- }