@atproto/lex-schema 0.0.2 → 0.0.4
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 +75 -0
- package/dist/core/$type.d.ts +6 -3
- package/dist/core/$type.d.ts.map +1 -1
- package/dist/core/$type.js +1 -0
- package/dist/core/$type.js.map +1 -1
- package/dist/core/record-key.d.ts +3 -3
- package/dist/core/record-key.d.ts.map +1 -1
- package/dist/core/record-key.js +12 -6
- package/dist/core/record-key.js.map +1 -1
- package/dist/core/result.d.ts.map +1 -1
- package/dist/core/result.js +6 -0
- package/dist/core/result.js.map +1 -1
- package/dist/core/string-format.d.ts +30 -27
- package/dist/core/string-format.d.ts.map +1 -1
- package/dist/core/string-format.js +56 -42
- package/dist/core/string-format.js.map +1 -1
- package/dist/core/types.d.ts +9 -1
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/types.js.map +1 -1
- package/dist/external.d.ts +31 -28
- package/dist/external.d.ts.map +1 -1
- package/dist/external.js +33 -17
- package/dist/external.js.map +1 -1
- package/dist/schema/_parameters.d.ts +2 -2
- package/dist/schema/_parameters.d.ts.map +1 -1
- package/dist/schema/array.d.ts +5 -6
- package/dist/schema/array.d.ts.map +1 -1
- package/dist/schema/array.js +5 -6
- package/dist/schema/array.js.map +1 -1
- package/dist/schema/blob.d.ts +2 -3
- package/dist/schema/blob.d.ts.map +1 -1
- package/dist/schema/blob.js +1 -2
- package/dist/schema/blob.js.map +1 -1
- package/dist/schema/boolean.d.ts +4 -5
- package/dist/schema/boolean.d.ts.map +1 -1
- package/dist/schema/boolean.js +2 -3
- package/dist/schema/boolean.js.map +1 -1
- package/dist/schema/bytes.d.ts +3 -4
- package/dist/schema/bytes.d.ts.map +1 -1
- package/dist/schema/bytes.js +2 -3
- package/dist/schema/bytes.js.map +1 -1
- package/dist/schema/cid.d.ts +13 -6
- package/dist/schema/cid.d.ts.map +1 -1
- package/dist/schema/cid.js +2 -4
- package/dist/schema/cid.js.map +1 -1
- package/dist/schema/custom.d.ts +3 -4
- package/dist/schema/custom.d.ts.map +1 -1
- package/dist/schema/custom.js +4 -3
- package/dist/schema/custom.js.map +1 -1
- package/dist/schema/dict.d.ts +3 -3
- package/dist/schema/dict.d.ts.map +1 -1
- package/dist/schema/dict.js +1 -1
- package/dist/schema/dict.js.map +1 -1
- package/dist/schema/discriminated-union.d.ts +15 -24
- package/dist/schema/discriminated-union.d.ts.map +1 -1
- package/dist/schema/discriminated-union.js +40 -64
- package/dist/schema/discriminated-union.js.map +1 -1
- package/dist/schema/enum.d.ts +8 -4
- package/dist/schema/enum.d.ts.map +1 -1
- package/dist/schema/enum.js +5 -3
- package/dist/schema/enum.js.map +1 -1
- package/dist/schema/integer.d.ts +3 -4
- package/dist/schema/integer.d.ts.map +1 -1
- package/dist/schema/integer.js +3 -4
- package/dist/schema/integer.js.map +1 -1
- package/dist/schema/intersection.d.ts +22 -14
- package/dist/schema/intersection.d.ts.map +1 -1
- package/dist/schema/intersection.js +12 -22
- package/dist/schema/intersection.js.map +1 -1
- package/dist/schema/literal.d.ts +7 -3
- package/dist/schema/literal.d.ts.map +1 -1
- package/dist/schema/literal.js +5 -3
- package/dist/schema/literal.js.map +1 -1
- package/dist/schema/never.d.ts +2 -2
- package/dist/schema/never.d.ts.map +1 -1
- package/dist/schema/never.js +1 -1
- package/dist/schema/never.js.map +1 -1
- package/dist/schema/null.d.ts +2 -3
- package/dist/schema/null.d.ts.map +1 -1
- package/dist/schema/null.js +1 -2
- package/dist/schema/null.js.map +1 -1
- package/dist/schema/nullable.d.ts +7 -0
- package/dist/schema/nullable.d.ts.map +1 -0
- package/dist/schema/nullable.js +19 -0
- package/dist/schema/nullable.js.map +1 -0
- package/dist/schema/object.d.ts +10 -44
- package/dist/schema/object.d.ts.map +1 -1
- package/dist/schema/object.js +10 -46
- package/dist/schema/object.js.map +1 -1
- package/dist/schema/optional.d.ts +7 -0
- package/dist/schema/optional.d.ts.map +1 -0
- package/dist/schema/optional.js +25 -0
- package/dist/schema/optional.js.map +1 -0
- package/dist/schema/params.d.ts +14 -19
- package/dist/schema/params.d.ts.map +1 -1
- package/dist/schema/params.js +10 -24
- package/dist/schema/params.js.map +1 -1
- package/dist/schema/payload.d.ts +4 -4
- package/dist/schema/payload.d.ts.map +1 -1
- package/dist/schema/payload.js.map +1 -1
- package/dist/schema/permission-set.d.ts +6 -6
- package/dist/schema/permission-set.d.ts.map +1 -1
- package/dist/schema/permission-set.js +1 -2
- package/dist/schema/permission-set.js.map +1 -1
- package/dist/schema/permission.d.ts +0 -1
- package/dist/schema/permission.d.ts.map +1 -1
- package/dist/schema/permission.js +0 -1
- package/dist/schema/permission.js.map +1 -1
- package/dist/schema/procedure.d.ts +8 -9
- package/dist/schema/procedure.d.ts.map +1 -1
- package/dist/schema/procedure.js +0 -1
- package/dist/schema/procedure.js.map +1 -1
- package/dist/schema/query.d.ts +7 -8
- package/dist/schema/query.d.ts.map +1 -1
- package/dist/schema/query.js +0 -1
- package/dist/schema/query.js.map +1 -1
- package/dist/schema/record.d.ts +34 -28
- package/dist/schema/record.d.ts.map +1 -1
- package/dist/schema/record.js +1 -2
- package/dist/schema/record.js.map +1 -1
- package/dist/schema/ref.d.ts +2 -3
- package/dist/schema/ref.d.ts.map +1 -1
- package/dist/schema/ref.js +1 -2
- package/dist/schema/ref.js.map +1 -1
- package/dist/schema/refine.d.ts +18 -0
- package/dist/schema/refine.d.ts.map +1 -0
- package/dist/schema/refine.js +33 -0
- package/dist/schema/refine.js.map +1 -0
- package/dist/schema/regexp.d.ts +7 -0
- package/dist/schema/regexp.d.ts.map +1 -0
- package/dist/schema/regexp.js +22 -0
- package/dist/schema/regexp.js.map +1 -0
- package/dist/schema/string.d.ts +4 -8
- package/dist/schema/string.d.ts.map +1 -1
- package/dist/schema/string.js +6 -3
- package/dist/schema/string.js.map +1 -1
- package/dist/schema/subscription.d.ts +7 -6
- package/dist/schema/subscription.d.ts.map +1 -1
- package/dist/schema/subscription.js.map +1 -1
- package/dist/schema/token.d.ts +2 -3
- package/dist/schema/token.d.ts.map +1 -1
- package/dist/schema/token.js +1 -2
- package/dist/schema/token.js.map +1 -1
- package/dist/schema/typed-object.d.ts +29 -27
- package/dist/schema/typed-object.d.ts.map +1 -1
- package/dist/schema/typed-object.js +1 -2
- package/dist/schema/typed-object.js.map +1 -1
- package/dist/schema/typed-ref.d.ts +2 -2
- package/dist/schema/typed-ref.d.ts.map +1 -1
- package/dist/schema/typed-ref.js +1 -1
- package/dist/schema/typed-ref.js.map +1 -1
- package/dist/schema/typed-union.d.ts +3 -4
- package/dist/schema/typed-union.d.ts.map +1 -1
- package/dist/schema/typed-union.js +3 -10
- package/dist/schema/typed-union.js.map +1 -1
- package/dist/schema/union.d.ts +2 -2
- package/dist/schema/union.d.ts.map +1 -1
- package/dist/schema/union.js +1 -1
- package/dist/schema/union.js.map +1 -1
- package/dist/schema/unknown-object.d.ts +2 -3
- package/dist/schema/unknown-object.d.ts.map +1 -1
- package/dist/schema/unknown-object.js +1 -2
- package/dist/schema/unknown-object.js.map +1 -1
- package/dist/schema/unknown.d.ts +2 -2
- package/dist/schema/unknown.d.ts.map +1 -1
- package/dist/schema/unknown.js +1 -1
- package/dist/schema/unknown.js.map +1 -1
- package/dist/schema.d.ts +4 -0
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +6 -1
- package/dist/schema.js.map +1 -1
- package/dist/util/array-agg.d.ts.map +1 -1
- package/dist/util/array-agg.js +1 -0
- package/dist/util/array-agg.js.map +1 -1
- package/dist/util/lazy-property.d.ts +2 -0
- package/dist/util/lazy-property.d.ts.map +1 -0
- package/dist/util/lazy-property.js +14 -0
- package/dist/util/lazy-property.js.map +1 -0
- package/dist/validation/schema.d.ts +24 -0
- package/dist/validation/schema.d.ts.map +1 -0
- package/dist/validation/schema.js +57 -0
- package/dist/validation/schema.js.map +1 -0
- package/dist/validation/validation-error.d.ts +3 -3
- package/dist/validation/validation-error.d.ts.map +1 -1
- package/dist/validation/validation-error.js +32 -4
- package/dist/validation/validation-error.js.map +1 -1
- package/dist/validation/validation-issue.d.ts +32 -24
- package/dist/validation/validation-issue.d.ts.map +1 -1
- package/dist/validation/validation-issue.js +136 -92
- package/dist/validation/validation-issue.js.map +1 -1
- package/dist/validation/validator.d.ts +20 -50
- package/dist/validation/validator.d.ts.map +1 -1
- package/dist/validation/validator.js +40 -134
- package/dist/validation/validator.js.map +1 -1
- package/dist/validation.d.ts +1 -0
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +1 -0
- package/dist/validation.js.map +1 -1
- package/package.json +8 -4
- package/src/core/$type.ts +7 -4
- package/src/core/record-key.ts +12 -5
- package/src/core/result.ts +6 -0
- package/src/core/string-format.ts +97 -61
- package/src/core/types.ts +12 -6
- package/src/external.ts +92 -70
- package/src/schema/_parameters.test.ts +416 -0
- package/src/schema/array.test.ts +237 -0
- package/src/schema/array.ts +17 -11
- package/src/schema/blob.test.ts +506 -0
- package/src/schema/blob.ts +3 -5
- package/src/schema/boolean.test.ts +116 -0
- package/src/schema/boolean.ts +5 -7
- package/src/schema/bytes.test.ts +226 -0
- package/src/schema/bytes.ts +4 -6
- package/src/schema/cid.test.ts +155 -0
- package/src/schema/cid.ts +14 -8
- package/src/schema/custom.test.ts +413 -0
- package/src/schema/custom.ts +10 -8
- package/src/schema/dict.test.ts +198 -0
- package/src/schema/dict.ts +6 -8
- package/src/schema/discriminated-union.test.ts +675 -0
- package/src/schema/discriminated-union.ts +68 -95
- package/src/schema/enum.test.ts +396 -0
- package/src/schema/enum.ts +12 -5
- package/src/schema/integer.test.ts +312 -0
- package/src/schema/integer.ts +5 -7
- package/src/schema/intersection.test.ts +32 -0
- package/src/schema/intersection.ts +37 -40
- package/src/schema/literal.test.ts +531 -0
- package/src/schema/literal.ts +12 -5
- package/src/schema/never.test.ts +174 -0
- package/src/schema/never.ts +3 -10
- package/src/schema/null.test.ts +79 -0
- package/src/schema/null.ts +3 -5
- package/src/schema/nullable.test.ts +480 -0
- package/src/schema/nullable.ts +23 -0
- package/src/schema/object.test.ts +47 -115
- package/src/schema/object.ts +19 -123
- package/src/schema/optional.test.ts +485 -0
- package/src/schema/optional.ts +31 -0
- package/src/schema/params.test.ts +582 -0
- package/src/schema/params.ts +37 -55
- package/src/schema/payload.test.ts +345 -0
- package/src/schema/payload.ts +5 -5
- package/src/schema/permission-set.test.ts +679 -0
- package/src/schema/permission-set.ts +6 -8
- package/src/schema/permission.test.ts +536 -0
- package/src/schema/permission.ts +0 -2
- package/src/schema/procedure.test.ts +443 -0
- package/src/schema/procedure.ts +11 -13
- package/src/schema/query.test.ts +408 -0
- package/src/schema/query.ts +9 -11
- package/src/schema/record.test.ts +694 -0
- package/src/schema/record.ts +38 -36
- package/src/schema/ref.test.ts +365 -0
- package/src/schema/ref.ts +8 -5
- package/src/schema/refine.test.ts +578 -0
- package/src/schema/refine.ts +85 -0
- package/src/schema/regexp.test.ts +580 -0
- package/src/schema/regexp.ts +22 -0
- package/src/schema/string.test.ts +612 -0
- package/src/schema/string.ts +11 -17
- package/src/schema/subscription.test.ts +689 -0
- package/src/schema/subscription.ts +13 -8
- package/src/schema/token.test.ts +428 -0
- package/src/schema/token.ts +3 -5
- package/src/schema/typed-object.test.ts +612 -0
- package/src/schema/typed-object.ts +23 -20
- package/src/schema/typed-ref.test.ts +823 -0
- package/src/schema/typed-ref.ts +10 -5
- package/src/schema/typed-union.test.ts +378 -0
- package/src/schema/typed-union.ts +6 -15
- package/src/schema/union.test.ts +200 -0
- package/src/schema/union.ts +5 -4
- package/src/schema/unknown-object.test.ts +592 -0
- package/src/schema/unknown-object.ts +3 -5
- package/src/schema/unknown.test.ts +312 -0
- package/src/schema/unknown.ts +3 -3
- package/src/schema.ts +7 -1
- package/src/util/array-agg.ts +1 -0
- package/src/util/lazy-property.ts +14 -0
- package/src/validation/schema.ts +92 -0
- package/src/validation/validation-error.ts +60 -9
- package/src/validation/validation-issue.ts +141 -144
- package/src/validation/validator.ts +67 -206
- package/src/validation.ts +1 -0
- package/tsconfig.build.json +12 -0
- package/tsconfig.json +7 -0
- package/tsconfig.tests.json +9 -0
package/dist/external.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { $Type,
|
|
2
|
-
import { ArraySchema, ArraySchemaOptions, BlobSchema, BlobSchemaOptions, BooleanSchema, BooleanSchemaOptions, BytesSchema, BytesSchemaOptions, CidSchema, CustomAssertion, CustomSchema, DictSchema, DiscriminatedUnionSchema,
|
|
1
|
+
import { $Type, $TypeOf, LexiconRecordKey, NsidString } from './core.js';
|
|
2
|
+
import { ArraySchema, ArraySchemaOptions, BlobSchema, BlobSchemaOptions, BooleanSchema, BooleanSchemaOptions, BytesSchema, BytesSchemaOptions, CidSchema, CidSchemaOptions, CustomAssertion, CustomSchema, DictSchema, DiscriminatedUnionSchema, DiscriminatedUnionVariants, EnumSchema, EnumSchemaOptions, IntegerSchema, IntegerSchemaOptions, IntersectionSchema, LiteralSchema, LiteralSchemaOptions, NeverSchema, NullSchema, NullableSchema, ObjectSchema, ObjectSchemaShape, OptionalSchema, ParamsSchema, ParamsSchemaShape, Payload, PayloadBody, Permission, PermissionOptions, PermissionSet, PermissionSetOptions, Procedure, Query, RecordSchema, RefSchema, RefSchemaGetter, RegexpSchema, StringSchema, StringSchemaOptions, Subscription, TokenSchema, TypedObjectSchema, TypedRefGetter, TypedRefSchema, TypedUnionSchema, UnionSchema, UnionSchemaValidators, UnknownObjectOutput, UnknownObjectSchema, UnknownSchema, refine } from './schema.js';
|
|
3
3
|
import { Infer, PropertyKey, Validator } from './validation.js';
|
|
4
4
|
export * from './core.js';
|
|
5
5
|
export * from './schema.js';
|
|
@@ -8,26 +8,31 @@ export declare function never(): NeverSchema;
|
|
|
8
8
|
export declare function unknown(): UnknownSchema;
|
|
9
9
|
export declare function _null(): NullSchema;
|
|
10
10
|
export { _null as null };
|
|
11
|
-
export declare function literal<const V extends null | string | number | boolean>(value: V): LiteralSchema<V>;
|
|
12
|
-
export declare function _enum<const V extends null | string | number | boolean>(value: readonly V[]): EnumSchema<V>;
|
|
11
|
+
export declare function literal<const V extends null | string | number | boolean>(value: V, options?: LiteralSchemaOptions<V>): LiteralSchema<V>;
|
|
12
|
+
export declare function _enum<const V extends null | string | number | boolean>(value: readonly V[], options?: EnumSchemaOptions<V>): EnumSchema<V>;
|
|
13
13
|
export { _enum as enum };
|
|
14
14
|
export declare function boolean(options?: BooleanSchemaOptions): BooleanSchema;
|
|
15
15
|
export declare function integer(options?: IntegerSchemaOptions): IntegerSchema;
|
|
16
|
-
export declare function cidLink(): CidSchema;
|
|
16
|
+
export declare function cidLink(options?: CidSchemaOptions): CidSchema;
|
|
17
17
|
export declare function bytes(options?: BytesSchemaOptions): BytesSchema;
|
|
18
|
-
export declare function blob(options?:
|
|
18
|
+
export declare function blob<O extends BlobSchemaOptions = NonNullable<unknown>>(options?: O): BlobSchema<O>;
|
|
19
19
|
export declare function string<const O extends StringSchemaOptions = NonNullable<unknown>>(options?: StringSchemaOptions & O): StringSchema<O>;
|
|
20
|
-
export declare function
|
|
21
|
-
export declare function
|
|
22
|
-
export declare function
|
|
20
|
+
export declare function regexp<T extends string = string>(pattern: RegExp): RegexpSchema<T>;
|
|
21
|
+
export declare function array<const S extends Validator>(items: S, options?: ArraySchemaOptions): ArraySchema<S>;
|
|
22
|
+
export declare function array<T, const S extends Validator<T> = Validator<T>>(items: S, options?: ArraySchemaOptions): ArraySchema<S>;
|
|
23
|
+
export declare function object<const P extends ObjectSchemaShape>(properties: P): ObjectSchema<P>;
|
|
24
|
+
export declare function dict<const K extends Validator<string>, const V extends Validator>(key: K, value: V): DictSchema<K, V>;
|
|
23
25
|
export type { UnknownObjectOutput as UnknownObject };
|
|
24
26
|
export declare function unknownObject(): UnknownObjectSchema;
|
|
25
27
|
export declare function ref<T>(get: RefSchemaGetter<T>): RefSchema<T>;
|
|
26
28
|
export declare function custom<T>(assertion: CustomAssertion<T>, message: string, path?: PropertyKey | readonly PropertyKey[]): CustomSchema<T>;
|
|
29
|
+
export declare function nullable<const S extends Validator>(schema: S): NullableSchema<Infer<S>>;
|
|
30
|
+
export declare function optional<const S extends Validator>(schema: S): OptionalSchema<Infer<S>>;
|
|
27
31
|
export declare function union<const V extends UnionSchemaValidators>(validators: V): UnionSchema<V>;
|
|
28
|
-
export declare function intersection<const
|
|
29
|
-
export
|
|
30
|
-
export declare function
|
|
32
|
+
export declare function intersection<const Left extends ObjectSchema, const Right extends DictSchema>(left: Left, right: Right): IntersectionSchema<Left, Right>;
|
|
33
|
+
export { refine };
|
|
34
|
+
export declare function discriminatedUnion<const Discriminator extends string, const Options extends DiscriminatedUnionVariants<Discriminator>>(discriminator: Discriminator, variants: Options): DiscriminatedUnionSchema<Discriminator, Options>;
|
|
35
|
+
export declare function token<const N extends NsidString, const H extends string>(nsid: N, hash: H): TokenSchema<$Type<N, H>>;
|
|
31
36
|
export declare function typedRef<const V extends {
|
|
32
37
|
$type?: string;
|
|
33
38
|
}>(get: TypedRefGetter<V>): TypedRefSchema<V>;
|
|
@@ -43,16 +48,16 @@ export declare function typedUnion<const R extends readonly TypedRefSchema[], co
|
|
|
43
48
|
* interface. This will typically be used by codegen (`lex build`) to generate
|
|
44
49
|
* schemas that work even if they contain circular references.
|
|
45
50
|
*/
|
|
46
|
-
export declare function typedObject<const N extends
|
|
51
|
+
export declare function typedObject<const N extends NsidString, const H extends string, const S extends Validator<{
|
|
47
52
|
[_ in string]?: unknown;
|
|
48
|
-
}>>(nsid: N, hash: H, schema:
|
|
49
|
-
export declare function typedObject<
|
|
53
|
+
}>>(nsid: N, hash: H, schema: S): TypedObjectSchema<$Type<N, H>, S>;
|
|
54
|
+
export declare function typedObject<V extends {
|
|
50
55
|
$type?: $Type;
|
|
51
56
|
}>(nsid: V extends {
|
|
52
57
|
$type?: infer T extends string;
|
|
53
58
|
} ? T extends `${infer N}#${string}` ? N : T : never, hash: V extends {
|
|
54
59
|
$type?: infer T extends string;
|
|
55
|
-
} ? T extends `${string}#${infer H}` ? H : 'main' : never, schema: Validator<Omit<V, '$type'>>): TypedObjectSchema<
|
|
60
|
+
} ? T extends `${string}#${infer H}` ? H : 'main' : never, schema: Validator<Omit<V, '$type'>>): TypedObjectSchema<$TypeOf<V>, Validator<Omit<V, '$type'>>>;
|
|
56
61
|
/**
|
|
57
62
|
* Ensures that a `$type` used in a record is a valid NSID (i.e. no fragment).
|
|
58
63
|
*/
|
|
@@ -68,19 +73,17 @@ type AsNsid<T> = T extends `${string}#${string}` ? never : T;
|
|
|
68
73
|
* interface. This will typically be used by codegen (`lex build`) to generate
|
|
69
74
|
* schemas that work even if they contain circular references.
|
|
70
75
|
*/
|
|
71
|
-
export declare function record<const K extends
|
|
76
|
+
export declare function record<const K extends LexiconRecordKey, const T extends NsidString, const S extends Validator<{
|
|
72
77
|
[_ in string]?: unknown;
|
|
73
|
-
}>>(key: K, type: AsNsid<T>, schema: S): RecordSchema<K, T, S
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}>(key: K, type: AsNsid<V['$type']>, schema: Validator<Omit<V, '$type'>>): RecordSchema<K, V['$type'], typeof schema, V>;
|
|
79
|
-
export declare function params<const P extends ParamsSchemaProperties = NonNullable<unknown>, const O extends ParamsSchemaOptions = ParamsSchemaOptions>(properties?: P, options?: ParamsSchemaOptions & O): ParamsSchema<P, O, import("./schema.js").ObjectSchemaPropertiesOutput<P, O>>;
|
|
78
|
+
}>>(key: K, type: AsNsid<T>, schema: S): RecordSchema<K, T, S>;
|
|
79
|
+
export declare function record<const K extends LexiconRecordKey, const V extends {
|
|
80
|
+
$type: NsidString;
|
|
81
|
+
}>(key: K, type: AsNsid<V['$type']>, schema: Validator<Omit<V, '$type'>>): RecordSchema<K, V['$type'], Validator<Omit<V, '$type'>>>;
|
|
82
|
+
export declare function params<const P extends ParamsSchemaShape = NonNullable<unknown>>(properties?: P): ParamsSchema<P>;
|
|
80
83
|
export declare function payload<const E extends string | undefined = undefined, const S extends PayloadBody<E> = undefined>(encoding?: E, schema?: S): Payload<E, S>;
|
|
81
|
-
export declare function query<const N extends
|
|
82
|
-
export declare function procedure<const N extends
|
|
83
|
-
export declare function subscription<const N extends
|
|
84
|
+
export declare function query<const N extends NsidString, const P extends ParamsSchema, const O extends Payload, const E extends undefined | readonly string[] = undefined>(nsid: N, parameters: P, output: O, errors?: E): Query<N, P, O, E>;
|
|
85
|
+
export declare function procedure<const N extends NsidString, const P extends ParamsSchema, const I extends Payload, const O extends Payload, const E extends undefined | readonly string[] = undefined>(nsid: N, parameters: P, input: I, output: O, errors?: E): Procedure<N, P, I, O, E>;
|
|
86
|
+
export declare function subscription<const N extends NsidString, const P extends ParamsSchema, const M extends undefined | RefSchema | TypedUnionSchema | ObjectSchema, const E extends undefined | readonly string[] = undefined>(nsid: N, parameters: P, message: M, errors?: E): Subscription<N, P, M, E>;
|
|
84
87
|
export declare function permission<const R extends string, const O extends PermissionOptions>(resource: R, options?: PermissionOptions & O): Permission<R, O>;
|
|
85
|
-
export declare function permissionSet<const N extends
|
|
88
|
+
export declare function permissionSet<const N extends NsidString, const P extends readonly Permission[]>(nsid: N, permissions: P, options?: PermissionSetOptions): PermissionSet<N, P>;
|
|
86
89
|
//# sourceMappingURL=external.d.ts.map
|
package/dist/external.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"external.d.ts","sourceRoot":"","sources":["../src/external.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAS,
|
|
1
|
+
{"version":3,"file":"external.d.ts","sourceRoot":"","sources":["../src/external.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,OAAO,EAAS,gBAAgB,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAC/E,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,UAAU,EACV,iBAAiB,EACjB,aAAa,EACb,oBAAoB,EACpB,WAAW,EACX,kBAAkB,EAClB,SAAS,EACT,gBAAgB,EAChB,eAAe,EAC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SAAS,UAAU,EAAE,EACrC,IAAI,EAAE,CAAC,EAAE,WAAW,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE,oBAAoB,uBAExD"}
|
package/dist/external.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.refine = void 0;
|
|
3
4
|
exports.never = never;
|
|
4
5
|
exports.unknown = unknown;
|
|
5
6
|
exports._null = _null;
|
|
@@ -13,12 +14,15 @@ exports.cidLink = cidLink;
|
|
|
13
14
|
exports.bytes = bytes;
|
|
14
15
|
exports.blob = blob;
|
|
15
16
|
exports.string = string;
|
|
17
|
+
exports.regexp = regexp;
|
|
16
18
|
exports.array = array;
|
|
17
19
|
exports.object = object;
|
|
18
20
|
exports.dict = dict;
|
|
19
21
|
exports.unknownObject = unknownObject;
|
|
20
22
|
exports.ref = ref;
|
|
21
23
|
exports.custom = custom;
|
|
24
|
+
exports.nullable = nullable;
|
|
25
|
+
exports.optional = optional;
|
|
22
26
|
exports.union = union;
|
|
23
27
|
exports.intersection = intersection;
|
|
24
28
|
exports.discriminatedUnion = discriminatedUnion;
|
|
@@ -37,6 +41,7 @@ exports.permissionSet = permissionSet;
|
|
|
37
41
|
const tslib_1 = require("tslib");
|
|
38
42
|
const core_js_1 = require("./core.js");
|
|
39
43
|
const schema_js_1 = require("./schema.js");
|
|
44
|
+
Object.defineProperty(exports, "refine", { enumerable: true, get: function () { return schema_js_1.refine; } });
|
|
40
45
|
tslib_1.__exportStar(require("./core.js"), exports);
|
|
41
46
|
tslib_1.__exportStar(require("./schema.js"), exports);
|
|
42
47
|
tslib_1.__exportStar(require("./validation.js"), exports);
|
|
@@ -53,27 +58,27 @@ function _null() {
|
|
|
53
58
|
return new schema_js_1.NullSchema();
|
|
54
59
|
}
|
|
55
60
|
/*@__NO_SIDE_EFFECTS__*/
|
|
56
|
-
function literal(value) {
|
|
57
|
-
return new schema_js_1.LiteralSchema(value);
|
|
61
|
+
function literal(value, options) {
|
|
62
|
+
return new schema_js_1.LiteralSchema(value, options);
|
|
58
63
|
}
|
|
59
64
|
/*@__NO_SIDE_EFFECTS__*/
|
|
60
|
-
function _enum(value) {
|
|
61
|
-
return new schema_js_1.EnumSchema(value);
|
|
65
|
+
function _enum(value, options) {
|
|
66
|
+
return new schema_js_1.EnumSchema(value, options);
|
|
62
67
|
}
|
|
63
68
|
/*@__NO_SIDE_EFFECTS__*/
|
|
64
|
-
function boolean(options
|
|
69
|
+
function boolean(options) {
|
|
65
70
|
return new schema_js_1.BooleanSchema(options);
|
|
66
71
|
}
|
|
67
72
|
/*@__NO_SIDE_EFFECTS__*/
|
|
68
|
-
function integer(options
|
|
73
|
+
function integer(options) {
|
|
69
74
|
return new schema_js_1.IntegerSchema(options);
|
|
70
75
|
}
|
|
71
76
|
/*@__NO_SIDE_EFFECTS__*/
|
|
72
|
-
function cidLink() {
|
|
73
|
-
return new schema_js_1.CidSchema();
|
|
77
|
+
function cidLink(options) {
|
|
78
|
+
return new schema_js_1.CidSchema(options);
|
|
74
79
|
}
|
|
75
80
|
/*@__NO_SIDE_EFFECTS__*/
|
|
76
|
-
function bytes(options
|
|
81
|
+
function bytes(options) {
|
|
77
82
|
return new schema_js_1.BytesSchema(options);
|
|
78
83
|
}
|
|
79
84
|
/*@__NO_SIDE_EFFECTS__*/
|
|
@@ -85,12 +90,15 @@ function string(options = {}) {
|
|
|
85
90
|
return new schema_js_1.StringSchema(options);
|
|
86
91
|
}
|
|
87
92
|
/*@__NO_SIDE_EFFECTS__*/
|
|
88
|
-
function
|
|
93
|
+
function regexp(pattern) {
|
|
94
|
+
return new schema_js_1.RegexpSchema(pattern);
|
|
95
|
+
}
|
|
96
|
+
function array(items, options) {
|
|
89
97
|
return new schema_js_1.ArraySchema(items, options);
|
|
90
98
|
}
|
|
91
99
|
/*@__NO_SIDE_EFFECTS__*/
|
|
92
|
-
function object(properties
|
|
93
|
-
return new schema_js_1.ObjectSchema(properties
|
|
100
|
+
function object(properties) {
|
|
101
|
+
return new schema_js_1.ObjectSchema(properties);
|
|
94
102
|
}
|
|
95
103
|
/*@__NO_SIDE_EFFECTS__*/
|
|
96
104
|
function dict(key, value) {
|
|
@@ -109,12 +117,20 @@ function custom(assertion, message, path) {
|
|
|
109
117
|
return new schema_js_1.CustomSchema(assertion, message, path);
|
|
110
118
|
}
|
|
111
119
|
/*@__NO_SIDE_EFFECTS__*/
|
|
120
|
+
function nullable(schema) {
|
|
121
|
+
return new schema_js_1.NullableSchema(schema);
|
|
122
|
+
}
|
|
123
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
124
|
+
function optional(schema) {
|
|
125
|
+
return new schema_js_1.OptionalSchema(schema);
|
|
126
|
+
}
|
|
127
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
112
128
|
function union(validators) {
|
|
113
129
|
return new schema_js_1.UnionSchema(validators);
|
|
114
130
|
}
|
|
115
131
|
/*@__NO_SIDE_EFFECTS__*/
|
|
116
|
-
function intersection(
|
|
117
|
-
return new schema_js_1.IntersectionSchema(
|
|
132
|
+
function intersection(left, right) {
|
|
133
|
+
return new schema_js_1.IntersectionSchema(left, right);
|
|
118
134
|
}
|
|
119
135
|
/*@__NO_SIDE_EFFECTS__*/
|
|
120
136
|
function discriminatedUnion(discriminator, variants) {
|
|
@@ -141,8 +157,8 @@ function record(key, type, schema) {
|
|
|
141
157
|
return new schema_js_1.RecordSchema(key, type, schema);
|
|
142
158
|
}
|
|
143
159
|
/*@__NO_SIDE_EFFECTS__*/
|
|
144
|
-
function params(properties = {}
|
|
145
|
-
return new schema_js_1.ParamsSchema(properties
|
|
160
|
+
function params(properties = {}) {
|
|
161
|
+
return new schema_js_1.ParamsSchema(properties);
|
|
146
162
|
}
|
|
147
163
|
/*@__NO_SIDE_EFFECTS__*/
|
|
148
164
|
function payload(encoding = undefined, schema = undefined) {
|
|
@@ -165,7 +181,7 @@ function permission(resource, options = {}) {
|
|
|
165
181
|
return new schema_js_1.Permission(resource, options);
|
|
166
182
|
}
|
|
167
183
|
/*@__NO_SIDE_EFFECTS__*/
|
|
168
|
-
function permissionSet(nsid, permissions, options
|
|
184
|
+
function permissionSet(nsid, permissions, options) {
|
|
169
185
|
return new schema_js_1.PermissionSet(nsid, permissions, options);
|
|
170
186
|
}
|
|
171
187
|
//# sourceMappingURL=external.js.map
|
package/dist/external.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"external.js","sourceRoot":"","sources":["../src/external.ts"],"names":[],"mappings":";;AA8DA,sBAEC;AAGD,0BAEC;AAGD,sBAEC;AAEiB,qBAAI;AAGtB,0BAIC;AAGD,sBAIC;AAGiB,qBAAI;AAGtB,0BAEC;AAGD,0BAEC;AAGD,0BAEC;AAGD,sBAEC;AAGD,oBAEC;AAGD,wBAIC;AAGD,sBAKC;AAGD,wBAQC;AAGD,oBAKC;AAMD,sCAEC;AAGD,kBAEC;AAGD,wBAMC;AAGD,sBAEC;AAGD,oCAIC;AAGD,gDAQC;AAGD,sBAKC;AAGD,4BAIC;AAGD,gCAKC;AAgCD,kCAMC;AAoCD,wBAMC;AAGD,wBAKC;AAGD,0BAKC;AAGD,sBAOC;AAGD,8BAQC;AAGD,oCAOC;AAGD,gCAKC;AAGD,sCAMC;;AA5WD,uCAAyD;AACzD,2CAqDoB;AAGpB,oDAAyB;AACzB,sDAA2B;AAC3B,0DAA+B;AAE/B,wBAAwB;AACxB,SAAgB,KAAK;IACnB,OAAO,IAAI,uBAAW,EAAE,CAAA;AAC1B,CAAC;AAED,wBAAwB;AACxB,SAAgB,OAAO;IACrB,OAAO,IAAI,yBAAa,EAAE,CAAA;AAC5B,CAAC;AAED,wBAAwB;AACxB,SAAgB,KAAK;IACnB,OAAO,IAAI,sBAAU,EAAE,CAAA;AACzB,CAAC;AAID,wBAAwB;AACxB,SAAgB,OAAO,CACrB,KAAQ;IAER,OAAO,IAAI,yBAAa,CAAI,KAAK,CAAC,CAAA;AACpC,C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AAE,UAAoC,EAAO;IACpE,OAAO,IAAI,yBAAa,CAAU,IAAI,EAAE,WAAW,EAAE,OAAO,CAAC,CAAA;AAC/D,CAAC","sourcesContent":["import { $Type, $type, Nsid, RecordKey } from './core.js'\nimport {\n ArraySchema,\n ArraySchemaOptions,\n BlobSchema,\n BlobSchemaOptions,\n BooleanSchema,\n BooleanSchemaOptions,\n BytesSchema,\n BytesSchemaOptions,\n CidSchema,\n CustomAssertion,\n CustomSchema,\n DictSchema,\n DiscriminatedUnionSchema,\n DiscriminatedUnionSchemaVariants,\n EnumSchema,\n IntegerSchema,\n IntegerSchemaOptions,\n IntersectionSchema,\n IntersectionSchemaValidators,\n LiteralSchema,\n NeverSchema,\n NullSchema,\n ObjectSchema,\n ObjectSchemaOptions,\n ObjectSchemaProperties,\n ParamsSchema,\n ParamsSchemaOptions,\n ParamsSchemaProperties,\n Payload,\n PayloadBody,\n Permission,\n PermissionOptions,\n PermissionSet,\n PermissionSetOptions,\n Procedure,\n Query,\n RecordSchema,\n RefSchema,\n RefSchemaGetter,\n StringSchema,\n StringSchemaOptions,\n Subscription,\n TokenSchema,\n TypedObjectSchema,\n TypedRefGetter,\n TypedRefSchema,\n TypedUnionSchema,\n UnionSchema,\n UnionSchemaValidators,\n UnknownObjectOutput,\n UnknownObjectSchema,\n UnknownSchema,\n} from './schema.js'\nimport { Infer, PropertyKey, Validator } from './validation.js'\n\nexport * from './core.js'\nexport * from './schema.js'\nexport * from './validation.js'\n\n/*@__NO_SIDE_EFFECTS__*/\nexport function never() {\n return new NeverSchema()\n}\n\n/*@__NO_SIDE_EFFECTS__*/\nexport function unknown() {\n return new UnknownSchema()\n}\n\n/*@__NO_SIDE_EFFECTS__*/\nexport function _null() {\n return new NullSchema()\n}\n\nexport { _null as null }\n\n/*@__NO_SIDE_EFFECTS__*/\nexport function literal<const V extends null | string | number | boolean>(\n value: V,\n) {\n return new LiteralSchema<V>(value)\n}\n\n/*@__NO_SIDE_EFFECTS__*/\nexport function _enum<const V extends null | string | number | boolean>(\n value: readonly V[],\n) {\n return new EnumSchema<V>(value)\n}\n\n// @NOTE \"enum\" is a reserved keyword in JS/TS\nexport { _enum as enum }\n\n/*@__NO_SIDE_EFFECTS__*/\nexport function boolean(options: BooleanSchemaOptions = {}) {\n return new BooleanSchema(options)\n}\n\n/*@__NO_SIDE_EFFECTS__*/\nexport function integer(options: IntegerSchemaOptions = {}) {\n return new IntegerSchema(options)\n}\n\n/*@__NO_SIDE_EFFECTS__*/\nexport function cidLink() {\n return new CidSchema()\n}\n\n/*@__NO_SIDE_EFFECTS__*/\nexport function bytes(options: BytesSchemaOptions = {}) {\n return new BytesSchema(options)\n}\n\n/*@__NO_SIDE_EFFECTS__*/\nexport function blob(options: BlobSchemaOptions = {}) {\n return new BlobSchema(options)\n}\n\n/*@__NO_SIDE_EFFECTS__*/\nexport function string<\n const O extends StringSchemaOptions = NonNullable<unknown>,\n>(options: StringSchemaOptions & O = {} as O) {\n return new StringSchema<O>(options)\n}\n\n/*@__NO_SIDE_EFFECTS__*/\nexport function array<const T>(\n items: Validator<T>,\n options: ArraySchemaOptions = {},\n) {\n return new ArraySchema(items, options)\n}\n\n/*@__NO_SIDE_EFFECTS__*/\nexport function object<\n const P extends ObjectSchemaProperties,\n const O extends ObjectSchemaOptions = NonNullable<unknown>,\n>(\n properties: ObjectSchemaProperties & P,\n options: ObjectSchemaOptions & O = {} as O,\n) {\n return new ObjectSchema<P, O>(properties, options)\n}\n\n/*@__NO_SIDE_EFFECTS__*/\nexport function dict<const K extends Validator, const V extends Validator>(\n key: K,\n value: V,\n) {\n return new DictSchema<K, V>(key, value)\n}\n\n// Utility\nexport type { UnknownObjectOutput as UnknownObject }\n\n/*@__NO_SIDE_EFFECTS__*/\nexport function unknownObject() {\n return new UnknownObjectSchema()\n}\n\n/*@__NO_SIDE_EFFECTS__*/\nexport function ref<T>(get: RefSchemaGetter<T>) {\n return new RefSchema<T>(get)\n}\n\n/*@__NO_SIDE_EFFECTS__*/\nexport function custom<T>(\n assertion: CustomAssertion<T>,\n message: string,\n path?: PropertyKey | readonly PropertyKey[],\n) {\n return new CustomSchema<T>(assertion, message, path)\n}\n\n/*@__NO_SIDE_EFFECTS__*/\nexport function union<const V extends UnionSchemaValidators>(validators: V) {\n return new UnionSchema<V>(validators)\n}\n\n/*@__NO_SIDE_EFFECTS__*/\nexport function intersection<const V extends IntersectionSchemaValidators>(\n validators: V,\n) {\n return new IntersectionSchema<V>(validators)\n}\n\n/*@__NO_SIDE_EFFECTS__*/\nexport function discriminatedUnion<\n const Discriminator extends string,\n const Options extends DiscriminatedUnionSchemaVariants<Discriminator>,\n>(discriminator: Discriminator, variants: Options) {\n return new DiscriminatedUnionSchema<Discriminator, Options>(\n discriminator,\n variants,\n )\n}\n\n/*@__NO_SIDE_EFFECTS__*/\nexport function token<const N extends Nsid, const H extends string>(\n nsid: N,\n hash: H,\n) {\n return new TokenSchema($type(nsid, hash))\n}\n\n/*@__NO_SIDE_EFFECTS__*/\nexport function typedRef<const V extends { $type?: string }>(\n get: TypedRefGetter<V>,\n) {\n return new TypedRefSchema<V>(get)\n}\n\n/*@__NO_SIDE_EFFECTS__*/\nexport function typedUnion<\n const R extends readonly TypedRefSchema[],\n const C extends boolean,\n>(refs: R, closed: C) {\n return new TypedUnionSchema<R, C>(refs, closed)\n}\n\n/**\n * This function offers two overloads:\n * - One that allows creating a {@link TypedObjectSchema}, and infer the output\n * type from the provided arguments, without requiring to specify any of the\n * generics. This is useful when you want to define a record without\n * explicitly defining its interface. This version does not support circular\n * references, as TypeScript cannot infer types in such cases.\n * - One allows creating a {@link TypedObjectSchema} with an explicitly defined\n * interface. This will typically be used by codegen (`lex build`) to generate\n * schemas that work even if they contain circular references.\n */\nexport function typedObject<\n const N extends Nsid,\n const H extends string,\n const Schema extends Validator<{ [_ in string]?: unknown }>,\n>(nsid: N, hash: H, schema: Schema): TypedObjectSchema<$Type<N, H>, Schema>\nexport function typedObject<const V extends { $type?: $Type }>(\n nsid: V extends { $type?: infer T extends string }\n ? T extends `${infer N}#${string}`\n ? N\n : T // (T is a \"main\" type, so already an NSID)\n : never,\n hash: V extends { $type?: infer T extends string }\n ? T extends `${string}#${infer H}`\n ? H\n : 'main'\n : never,\n schema: Validator<Omit<V, '$type'>>,\n): TypedObjectSchema<NonNullable<V['$type']>, typeof schema, V>\n/*@__NO_SIDE_EFFECTS__*/\nexport function typedObject<\n const N extends Nsid,\n const H extends string,\n const Schema extends Validator<{ [_ in string]?: unknown }>,\n>(nsid: N, hash: H, schema: Schema) {\n return new TypedObjectSchema<$Type<N, H>, Schema>($type(nsid, hash), schema)\n}\n\n/**\n * Ensures that a `$type` used in a record is a valid NSID (i.e. no fragment).\n */\ntype AsNsid<T> = T extends `${string}#${string}` ? never : T\n\n/**\n * This function offers two overloads:\n * - One that allows creating a {@link RecordSchema}, and infer the output type\n * from the provided arguments, without requiring to specify any of the\n * generics. This is useful when you want to define a record without\n * explicitly defining its interface. This version does not support circular\n * references, as TypeScript cannot infer types in such cases.\n * - One allows creating a {@link RecordSchema} with an explicitly defined\n * interface. This will typically be used by codegen (`lex build`) to generate\n * schemas that work even if they contain circular references.\n */\nexport function record<\n const K extends RecordKey,\n const T extends Nsid,\n const S extends Validator<{ [_ in string]?: unknown }>,\n>(\n key: K,\n type: AsNsid<T>,\n schema: S,\n): RecordSchema<K, T, S, Infer<S> & { $type: T }>\nexport function record<\n const K extends RecordKey,\n const V extends { $type: Nsid },\n>(\n key: K,\n type: AsNsid<V['$type']>,\n schema: Validator<Omit<V, '$type'>>,\n): RecordSchema<K, V['$type'], typeof schema, V>\n/*@__NO_SIDE_EFFECTS__*/\nexport function record<\n const K extends RecordKey,\n const T extends Nsid,\n const S extends Validator<{ [_ in string]?: unknown }>,\n>(key: K, type: T, schema: S) {\n return new RecordSchema<K, T, S, Infer<S> & { $type: T }>(key, type, schema)\n}\n\n/*@__NO_SIDE_EFFECTS__*/\nexport function params<\n const P extends ParamsSchemaProperties = NonNullable<unknown>,\n const O extends ParamsSchemaOptions = ParamsSchemaOptions,\n>(properties: P = {} as P, options: ParamsSchemaOptions & O = {} as O) {\n return new ParamsSchema<P, O>(properties, options)\n}\n\n/*@__NO_SIDE_EFFECTS__*/\nexport function payload<\n const E extends string | undefined = undefined,\n const S extends PayloadBody<E> = undefined,\n>(encoding: E = undefined as E, schema: S = undefined as S) {\n return new Payload<E, S>(encoding, schema)\n}\n\n/*@__NO_SIDE_EFFECTS__*/\nexport function query<\n const N extends Nsid,\n const P extends ParamsSchema,\n const O extends Payload,\n const E extends undefined | readonly string[] = undefined,\n>(nsid: N, parameters: P, output: O, errors: E = undefined as E) {\n return new Query<N, P, O, E>(nsid, parameters, output, errors)\n}\n\n/*@__NO_SIDE_EFFECTS__*/\nexport function procedure<\n const N extends Nsid,\n const P extends ParamsSchema,\n const I extends Payload,\n const O extends Payload,\n const E extends undefined | readonly string[] = undefined,\n>(nsid: N, parameters: P, input: I, output: O, errors: E = undefined as E) {\n return new Procedure<N, P, I, O, E>(nsid, parameters, input, output, errors)\n}\n\n/*@__NO_SIDE_EFFECTS__*/\nexport function subscription<\n const N extends string,\n const P extends ParamsSchema,\n const M extends undefined | RefSchema | TypedUnionSchema | ObjectSchema,\n const E extends undefined | readonly string[] = undefined,\n>(nsid: N, parameters: P, message: M, errors: E = undefined as E) {\n return new Subscription<N, P, M, E>(nsid, parameters, message, errors)\n}\n\n/*@__NO_SIDE_EFFECTS__*/\nexport function permission<\n const R extends string,\n const O extends PermissionOptions,\n>(resource: R, options: PermissionOptions & O = {} as O) {\n return new Permission<R, O>(resource, options)\n}\n\n/*@__NO_SIDE_EFFECTS__*/\nexport function permissionSet<\n const N extends string,\n const P extends readonly Permission[],\n const O extends PermissionSetOptions,\n>(nsid: N, permissions: P, options: PermissionSetOptions & O = {} as O) {\n return new PermissionSet<N, P, O>(nsid, permissions, options)\n}\n"]}
|
|
1
|
+
{"version":3,"file":"external.js","sourceRoot":"","sources":["../src/external.ts"],"names":[],"mappings":";;;AAkEA,sB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wB;AACxB,SAAgB,aAAa,CAG3B,IAAO,EAAE,WAAc,EAAE,OAA8B;IACvD,OAAO,IAAI,yBAAa,CAAO,IAAI,EAAE,WAAW,EAAE,OAAO,CAAC,CAAA;AAC5D,CAAC","sourcesContent":["import { $Type, $TypeOf, $type, LexiconRecordKey, NsidString } from './core.js'\nimport {\n ArraySchema,\n ArraySchemaOptions,\n BlobSchema,\n BlobSchemaOptions,\n BooleanSchema,\n BooleanSchemaOptions,\n BytesSchema,\n BytesSchemaOptions,\n CidSchema,\n CidSchemaOptions,\n CustomAssertion,\n CustomSchema,\n DictSchema,\n DiscriminatedUnionSchema,\n DiscriminatedUnionVariants,\n EnumSchema,\n EnumSchemaOptions,\n IntegerSchema,\n IntegerSchemaOptions,\n IntersectionSchema,\n LiteralSchema,\n LiteralSchemaOptions,\n NeverSchema,\n NullSchema,\n NullableSchema,\n ObjectSchema,\n ObjectSchemaShape,\n OptionalSchema,\n ParamsSchema,\n ParamsSchemaShape,\n Payload,\n PayloadBody,\n Permission,\n PermissionOptions,\n PermissionSet,\n PermissionSetOptions,\n Procedure,\n Query,\n RecordSchema,\n RefSchema,\n RefSchemaGetter,\n RegexpSchema,\n StringSchema,\n StringSchemaOptions,\n Subscription,\n TokenSchema,\n TypedObjectSchema,\n TypedRefGetter,\n TypedRefSchema,\n TypedUnionSchema,\n UnionSchema,\n UnionSchemaValidators,\n UnknownObjectOutput,\n UnknownObjectSchema,\n UnknownSchema,\n refine,\n} from './schema.js'\nimport { Infer, PropertyKey, Validator } from './validation.js'\n\nexport * from './core.js'\nexport * from './schema.js'\nexport * from './validation.js'\n\n/*@__NO_SIDE_EFFECTS__*/\nexport function never() {\n return new NeverSchema()\n}\n\n/*@__NO_SIDE_EFFECTS__*/\nexport function unknown() {\n return new UnknownSchema()\n}\n\n/*@__NO_SIDE_EFFECTS__*/\nexport function _null() {\n return new NullSchema()\n}\n\nexport { _null as null }\n\n/*@__NO_SIDE_EFFECTS__*/\nexport function literal<const V extends null | string | number | boolean>(\n value: V,\n options?: LiteralSchemaOptions<V>,\n) {\n return new LiteralSchema<V>(value, options)\n}\n\n/*@__NO_SIDE_EFFECTS__*/\nexport function _enum<const V extends null | string | number | boolean>(\n value: readonly V[],\n options?: EnumSchemaOptions<V>,\n) {\n return new EnumSchema<V>(value, options)\n}\n\n// @NOTE \"enum\" is a reserved keyword in JS/TS\nexport { _enum as enum }\n\n/*@__NO_SIDE_EFFECTS__*/\nexport function boolean(options?: BooleanSchemaOptions) {\n return new BooleanSchema(options)\n}\n\n/*@__NO_SIDE_EFFECTS__*/\nexport function integer(options?: IntegerSchemaOptions) {\n return new IntegerSchema(options)\n}\n\n/*@__NO_SIDE_EFFECTS__*/\nexport function cidLink(options?: CidSchemaOptions) {\n return new CidSchema(options)\n}\n\n/*@__NO_SIDE_EFFECTS__*/\nexport function bytes(options?: BytesSchemaOptions) {\n return new BytesSchema(options)\n}\n\n/*@__NO_SIDE_EFFECTS__*/\nexport function blob<O extends BlobSchemaOptions = NonNullable<unknown>>(\n options: O = {} as O,\n) {\n return new BlobSchema(options)\n}\n\n/*@__NO_SIDE_EFFECTS__*/\nexport function string<\n const O extends StringSchemaOptions = NonNullable<unknown>,\n>(options: StringSchemaOptions & O = {} as O) {\n return new StringSchema<O>(options)\n}\n\n/*@__NO_SIDE_EFFECTS__*/\nexport function regexp<T extends string = string>(pattern: RegExp) {\n return new RegexpSchema<T>(pattern)\n}\n\n/*@__NO_SIDE_EFFECTS__*/\nexport function array<const S extends Validator>(\n items: S,\n options?: ArraySchemaOptions,\n): ArraySchema<S>\nexport function array<T, const S extends Validator<T> = Validator<T>>(\n items: S,\n options?: ArraySchemaOptions,\n): ArraySchema<S>\nexport function array<const S extends Validator>(\n items: S,\n options?: ArraySchemaOptions,\n) {\n return new ArraySchema<S>(items, options)\n}\n\n/*@__NO_SIDE_EFFECTS__*/\nexport function object<const P extends ObjectSchemaShape>(properties: P) {\n return new ObjectSchema<P>(properties)\n}\n\n/*@__NO_SIDE_EFFECTS__*/\nexport function dict<\n const K extends Validator<string>,\n const V extends Validator,\n>(key: K, value: V) {\n return new DictSchema<K, V>(key, value)\n}\n\n// Utility\nexport type { UnknownObjectOutput as UnknownObject }\n\n/*@__NO_SIDE_EFFECTS__*/\nexport function unknownObject() {\n return new UnknownObjectSchema()\n}\n\n/*@__NO_SIDE_EFFECTS__*/\nexport function ref<T>(get: RefSchemaGetter<T>) {\n return new RefSchema<T>(get)\n}\n\n/*@__NO_SIDE_EFFECTS__*/\nexport function custom<T>(\n assertion: CustomAssertion<T>,\n message: string,\n path?: PropertyKey | readonly PropertyKey[],\n) {\n return new CustomSchema<T>(assertion, message, path)\n}\n\n/*@__NO_SIDE_EFFECTS__*/\nexport function nullable<const S extends Validator>(schema: S) {\n return new NullableSchema<Infer<S>>(schema)\n}\n\n/*@__NO_SIDE_EFFECTS__*/\nexport function optional<const S extends Validator>(schema: S) {\n return new OptionalSchema<Infer<S>>(schema)\n}\n\n/*@__NO_SIDE_EFFECTS__*/\nexport function union<const V extends UnionSchemaValidators>(validators: V) {\n return new UnionSchema<V>(validators)\n}\n\n/*@__NO_SIDE_EFFECTS__*/\nexport function intersection<\n const Left extends ObjectSchema,\n const Right extends DictSchema,\n>(left: Left, right: Right) {\n return new IntersectionSchema<Left, Right>(left, right)\n}\n\nexport { refine }\n\n/*@__NO_SIDE_EFFECTS__*/\nexport function discriminatedUnion<\n const Discriminator extends string,\n const Options extends DiscriminatedUnionVariants<Discriminator>,\n>(discriminator: Discriminator, variants: Options) {\n return new DiscriminatedUnionSchema<Discriminator, Options>(\n discriminator,\n variants,\n )\n}\n\n/*@__NO_SIDE_EFFECTS__*/\nexport function token<const N extends NsidString, const H extends string>(\n nsid: N,\n hash: H,\n) {\n return new TokenSchema($type(nsid, hash))\n}\n\n/*@__NO_SIDE_EFFECTS__*/\nexport function typedRef<const V extends { $type?: string }>(\n get: TypedRefGetter<V>,\n) {\n return new TypedRefSchema<V>(get)\n}\n\n/*@__NO_SIDE_EFFECTS__*/\nexport function typedUnion<\n const R extends readonly TypedRefSchema[],\n const C extends boolean,\n>(refs: R, closed: C) {\n return new TypedUnionSchema<R, C>(refs, closed)\n}\n\n/**\n * This function offers two overloads:\n * - One that allows creating a {@link TypedObjectSchema}, and infer the output\n * type from the provided arguments, without requiring to specify any of the\n * generics. This is useful when you want to define a record without\n * explicitly defining its interface. This version does not support circular\n * references, as TypeScript cannot infer types in such cases.\n * - One allows creating a {@link TypedObjectSchema} with an explicitly defined\n * interface. This will typically be used by codegen (`lex build`) to generate\n * schemas that work even if they contain circular references.\n */\nexport function typedObject<\n const N extends NsidString,\n const H extends string,\n const S extends Validator<{ [_ in string]?: unknown }>,\n>(nsid: N, hash: H, schema: S): TypedObjectSchema<$Type<N, H>, S>\nexport function typedObject<V extends { $type?: $Type }>(\n nsid: V extends { $type?: infer T extends string }\n ? T extends `${infer N}#${string}`\n ? N\n : T // (T is a \"main\" type, so already an NSID)\n : never,\n hash: V extends { $type?: infer T extends string }\n ? T extends `${string}#${infer H}`\n ? H\n : 'main'\n : never,\n schema: Validator<Omit<V, '$type'>>,\n): TypedObjectSchema<$TypeOf<V>, Validator<Omit<V, '$type'>>>\n/*@__NO_SIDE_EFFECTS__*/\nexport function typedObject<\n const N extends NsidString,\n const H extends string,\n const S extends Validator<{ [_ in string]?: unknown }>,\n>(nsid: N, hash: H, schema: S) {\n return new TypedObjectSchema<$Type<N, H>, S>($type(nsid, hash), schema)\n}\n\n/**\n * Ensures that a `$type` used in a record is a valid NSID (i.e. no fragment).\n */\ntype AsNsid<T> = T extends `${string}#${string}` ? never : T\n\n/**\n * This function offers two overloads:\n * - One that allows creating a {@link RecordSchema}, and infer the output type\n * from the provided arguments, without requiring to specify any of the\n * generics. This is useful when you want to define a record without\n * explicitly defining its interface. This version does not support circular\n * references, as TypeScript cannot infer types in such cases.\n * - One allows creating a {@link RecordSchema} with an explicitly defined\n * interface. This will typically be used by codegen (`lex build`) to generate\n * schemas that work even if they contain circular references.\n */\nexport function record<\n const K extends LexiconRecordKey,\n const T extends NsidString,\n const S extends Validator<{ [_ in string]?: unknown }>,\n>(key: K, type: AsNsid<T>, schema: S): RecordSchema<K, T, S>\nexport function record<\n const K extends LexiconRecordKey,\n const V extends { $type: NsidString },\n>(\n key: K,\n type: AsNsid<V['$type']>,\n schema: Validator<Omit<V, '$type'>>,\n): RecordSchema<K, V['$type'], Validator<Omit<V, '$type'>>>\n/*@__NO_SIDE_EFFECTS__*/\nexport function record<\n const K extends LexiconRecordKey,\n const T extends NsidString,\n const S extends Validator<{ [_ in string]?: unknown }>,\n>(key: K, type: T, schema: S) {\n return new RecordSchema<K, T, S>(key, type, schema)\n}\n\n/*@__NO_SIDE_EFFECTS__*/\nexport function params<\n const P extends ParamsSchemaShape = NonNullable<unknown>,\n>(properties: P = {} as P) {\n return new ParamsSchema<P>(properties)\n}\n\n/*@__NO_SIDE_EFFECTS__*/\nexport function payload<\n const E extends string | undefined = undefined,\n const S extends PayloadBody<E> = undefined,\n>(encoding: E = undefined as E, schema: S = undefined as S) {\n return new Payload<E, S>(encoding, schema)\n}\n\n/*@__NO_SIDE_EFFECTS__*/\nexport function query<\n const N extends NsidString,\n const P extends ParamsSchema,\n const O extends Payload,\n const E extends undefined | readonly string[] = undefined,\n>(nsid: N, parameters: P, output: O, errors: E = undefined as E) {\n return new Query<N, P, O, E>(nsid, parameters, output, errors)\n}\n\n/*@__NO_SIDE_EFFECTS__*/\nexport function procedure<\n const N extends NsidString,\n const P extends ParamsSchema,\n const I extends Payload,\n const O extends Payload,\n const E extends undefined | readonly string[] = undefined,\n>(nsid: N, parameters: P, input: I, output: O, errors: E = undefined as E) {\n return new Procedure<N, P, I, O, E>(nsid, parameters, input, output, errors)\n}\n\n/*@__NO_SIDE_EFFECTS__*/\nexport function subscription<\n const N extends NsidString,\n const P extends ParamsSchema,\n const M extends undefined | RefSchema | TypedUnionSchema | ObjectSchema,\n const E extends undefined | readonly string[] = undefined,\n>(nsid: N, parameters: P, message: M, errors: E = undefined as E) {\n return new Subscription<N, P, M, E>(nsid, parameters, message, errors)\n}\n\n/*@__NO_SIDE_EFFECTS__*/\nexport function permission<\n const R extends string,\n const O extends PermissionOptions,\n>(resource: R, options: PermissionOptions & O = {} as O) {\n return new Permission<R, O>(resource, options)\n}\n\n/*@__NO_SIDE_EFFECTS__*/\nexport function permissionSet<\n const N extends NsidString,\n const P extends readonly Permission[],\n>(nsid: N, permissions: P, options?: PermissionSetOptions) {\n return new PermissionSet<N, P>(nsid, permissions, options)\n}\n"]}
|
|
@@ -8,10 +8,10 @@ import { UnionSchema } from './union.js';
|
|
|
8
8
|
export type ParamScalar = Infer<typeof paramScalarSchema>;
|
|
9
9
|
declare const paramScalarSchema: UnionSchema<[BooleanSchema, IntegerSchema, StringSchema<{}>]>;
|
|
10
10
|
export type Param = Infer<typeof paramSchema>;
|
|
11
|
-
export declare const paramSchema: UnionSchema<[UnionSchema<[BooleanSchema, IntegerSchema, StringSchema<{}>]>, ArraySchema<
|
|
11
|
+
export declare const paramSchema: UnionSchema<[UnionSchema<[BooleanSchema, IntegerSchema, StringSchema<{}>]>, ArraySchema<UnionSchema<[BooleanSchema, IntegerSchema, StringSchema<{}>]>>]>;
|
|
12
12
|
export type Params = {
|
|
13
13
|
[_: string]: undefined | Param;
|
|
14
14
|
};
|
|
15
|
-
export declare const paramsSchema: DictSchema<StringSchema<{}>, UnionSchema<[UnionSchema<[BooleanSchema, IntegerSchema, StringSchema<{}>]>, ArraySchema<
|
|
15
|
+
export declare const paramsSchema: DictSchema<StringSchema<{}>, UnionSchema<[UnionSchema<[BooleanSchema, IntegerSchema, StringSchema<{}>]>, ArraySchema<UnionSchema<[BooleanSchema, IntegerSchema, StringSchema<{}>]>>]>>;
|
|
16
16
|
export {};
|
|
17
17
|
//# sourceMappingURL=_parameters.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_parameters.d.ts","sourceRoot":"","sources":["../../src/schema/_parameters.ts"],"names":[],"mappings":"AAA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EAAE,MAAM,GAAG,SAAS,GAAG,KAAK,CAAA;CAAE,CAAA;AACvD,eAAO,MAAM,YAAY,wLAGI,CAAA"}
|
package/dist/schema/array.d.ts
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { ValidationResult, Validator, ValidatorContext } from '../validation.js';
|
|
1
|
+
import { Infer, Schema, ValidationResult, Validator, ValidatorContext } from '../validation.js';
|
|
2
2
|
export type ArraySchemaOptions = {
|
|
3
3
|
minLength?: number;
|
|
4
4
|
maxLength?: number;
|
|
5
5
|
};
|
|
6
|
-
export declare class ArraySchema<
|
|
7
|
-
readonly
|
|
6
|
+
export declare class ArraySchema<const T extends Validator> extends Schema<Array<Infer<T>>> {
|
|
7
|
+
readonly itemsSchema: T;
|
|
8
8
|
readonly options: ArraySchemaOptions;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
validateInContext(input: unknown, ctx: ValidatorContext): ValidationResult<Array<Item>>;
|
|
9
|
+
constructor(itemsSchema: T, options?: ArraySchemaOptions);
|
|
10
|
+
validateInContext(input: unknown, ctx: ValidatorContext): ValidationResult<Array<Infer<T>>>;
|
|
12
11
|
}
|
|
13
12
|
//# sourceMappingURL=array.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"array.d.ts","sourceRoot":"","sources":["../../src/schema/array.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"array.d.ts","sourceRoot":"","sources":["../../src/schema/array.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,MAAM,EACN,gBAAgB,EAChB,SAAS,EACT,gBAAgB,EACjB,MAAM,kBAAkB,CAAA;AAEzB,MAAM,MAAM,kBAAkB,GAAG;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,qBAAa,WAAW,CAAC,KAAK,CAAC,CAAC,SAAS,SAAS,CAAE,SAAQ,MAAM,CAChE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAChB;IAEG,QAAQ,CAAC,WAAW,EAAE,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,kBAAkB;gBAD3B,WAAW,EAAE,CAAC,EACd,OAAO,GAAE,kBAAuB;IAK3C,iBAAiB,CACf,KAAK,EAAE,OAAO,EACd,GAAG,EAAE,gBAAgB,GACpB,gBAAgB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;CA8BrC"}
|
package/dist/schema/array.js
CHANGED
|
@@ -2,13 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ArraySchema = void 0;
|
|
4
4
|
const validation_js_1 = require("../validation.js");
|
|
5
|
-
class ArraySchema extends validation_js_1.
|
|
6
|
-
|
|
5
|
+
class ArraySchema extends validation_js_1.Schema {
|
|
6
|
+
itemsSchema;
|
|
7
7
|
options;
|
|
8
|
-
|
|
9
|
-
constructor(items, options) {
|
|
8
|
+
constructor(itemsSchema, options = {}) {
|
|
10
9
|
super();
|
|
11
|
-
this.
|
|
10
|
+
this.itemsSchema = itemsSchema;
|
|
12
11
|
this.options = options;
|
|
13
12
|
}
|
|
14
13
|
validateInContext(input, ctx) {
|
|
@@ -24,7 +23,7 @@ class ArraySchema extends validation_js_1.Validator {
|
|
|
24
23
|
}
|
|
25
24
|
let copy;
|
|
26
25
|
for (let i = 0; i < input.length; i++) {
|
|
27
|
-
const result = ctx.validateChild(input, i, this.
|
|
26
|
+
const result = ctx.validateChild(input, i, this.itemsSchema);
|
|
28
27
|
if (!result.success)
|
|
29
28
|
return result;
|
|
30
29
|
if (result.value !== input[i]) {
|
package/dist/schema/array.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"array.js","sourceRoot":"","sources":["../../src/schema/array.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"array.js","sourceRoot":"","sources":["../../src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C9B,6DAA6D;gBAC7D,IAAI,KAAK,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;gBAC1B,IAAI,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,KAAK,CAAA;YACxB,CAAC;QACH,CAAC;QAED,OAAO,GAAG,CAAC,OAAO,CAAC,IAAI,IAAI,KAAK,CAAsC,CAAA;IACxE,CAAC;CACF;AA3CD,kCA2CC","sourcesContent":["import {\n Infer,\n Schema,\n ValidationResult,\n Validator,\n ValidatorContext,\n} from '../validation.js'\n\nexport type ArraySchemaOptions = {\n minLength?: number\n maxLength?: number\n}\n\nexport class ArraySchema<const T extends Validator> extends Schema<\n Array<Infer<T>>\n> {\n constructor(\n readonly itemsSchema: T,\n readonly options: ArraySchemaOptions = {},\n ) {\n super()\n }\n\n validateInContext(\n input: unknown,\n ctx: ValidatorContext,\n ): ValidationResult<Array<Infer<T>>> {\n if (!Array.isArray(input)) {\n return ctx.issueInvalidType(input, 'array')\n }\n\n const { minLength, maxLength } = this.options\n\n if (minLength != null && input.length < minLength) {\n return ctx.issueTooSmall(input, 'array', minLength, input.length)\n }\n\n if (maxLength != null && input.length > maxLength) {\n return ctx.issueTooBig(input, 'array', maxLength, input.length)\n }\n\n let copy: undefined | Array<Infer<T>>\n\n for (let i = 0; i < input.length; i++) {\n const result = ctx.validateChild(input, i, this.itemsSchema)\n if (!result.success) return result\n\n if (result.value !== input[i]) {\n // Copy on write (but only if we did not already make a copy)\n copy ??= Array.from(input)\n copy[i] = result.value\n }\n }\n\n return ctx.success(copy ?? input) as ValidationResult<Array<Infer<T>>>\n }\n}\n"]}
|
package/dist/schema/blob.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BlobRef, LegacyBlobRef } from '@atproto/lex-data';
|
|
2
|
-
import {
|
|
2
|
+
import { Schema, ValidationResult, ValidatorContext } from '../validation.js';
|
|
3
3
|
export type BlobSchemaOptions = {
|
|
4
4
|
/**
|
|
5
5
|
* Whether to allow legacy blob references format
|
|
@@ -23,9 +23,8 @@ export type { BlobRef, LegacyBlobRef };
|
|
|
23
23
|
export type BlobSchemaOutput<Options> = Options extends {
|
|
24
24
|
allowLegacy: true;
|
|
25
25
|
} ? BlobRef | LegacyBlobRef : BlobRef;
|
|
26
|
-
export declare class BlobSchema<O extends BlobSchemaOptions> extends
|
|
26
|
+
export declare class BlobSchema<O extends BlobSchemaOptions> extends Schema<BlobSchemaOutput<O>> {
|
|
27
27
|
readonly options: O;
|
|
28
|
-
readonly lexiconType: "blob";
|
|
29
28
|
constructor(options: O);
|
|
30
29
|
validateInContext(input: unknown, ctx: ValidatorContext): ValidationResult<BlobSchemaOutput<O>>;
|
|
31
30
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blob.d.ts","sourceRoot":"","sources":["../../src/schema/blob.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,aAAa,EAGd,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"blob.d.ts","sourceRoot":"","sources":["../../src/schema/blob.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,aAAa,EAGd,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAE7E,MAAM,MAAM,iBAAiB,GAAG;IAC9B;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;IACjB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,YAAY,EAAE,OAAO,EAAE,aAAa,EAAE,CAAA;AAEtC,MAAM,MAAM,gBAAgB,CAAC,OAAO,IAAI,OAAO,SAAS;IAAE,WAAW,EAAE,IAAI,CAAA;CAAE,GACzE,OAAO,GAAG,aAAa,GACvB,OAAO,CAAA;AAEX,qBAAa,UAAU,CAAC,CAAC,SAAS,iBAAiB,CAAE,SAAQ,MAAM,CACjE,gBAAgB,CAAC,CAAC,CAAC,CACpB;IACa,QAAQ,CAAC,OAAO,EAAE,CAAC;gBAAV,OAAO,EAAE,CAAC;IAI/B,iBAAiB,CACf,KAAK,EAAE,OAAO,EACd,GAAG,EAAE,gBAAgB,GACpB,gBAAgB,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC;CAoBzC"}
|
package/dist/schema/blob.js
CHANGED
|
@@ -3,9 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.BlobSchema = void 0;
|
|
4
4
|
const lex_data_1 = require("@atproto/lex-data");
|
|
5
5
|
const validation_js_1 = require("../validation.js");
|
|
6
|
-
class BlobSchema extends validation_js_1.
|
|
6
|
+
class BlobSchema extends validation_js_1.Schema {
|
|
7
7
|
options;
|
|
8
|
-
lexiconType = 'blob';
|
|
9
8
|
constructor(options) {
|
|
10
9
|
super();
|
|
11
10
|
this.options = options;
|
package/dist/schema/blob.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blob.js","sourceRoot":"","sources":["../../src/schema/blob.ts"],"names":[],"mappings":";;;AAAA,gDAK0B;AAC1B,
|
|
1
|
+
{"version":3,"file":"blob.js","sourceRoot":"","sources":["../../src/schema/blob.ts"],"names":[],"mappings":";;;AAAA,gDAK0B;AAC1B,oDAA6E;AA4B7E,MAAa,UAAwC,SAAQ,sBAE5D;IACsB;IAArB,YAAqB,OAAU;QAC7B,KAAK,EAAE,CAAA;QADY,YAAO,GAAP,OAAO,CAAG;IAE/B,CAAC;IAED,iBAAiB,CACf,KAAc,EACd,GAAqB;QAErB,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;YACjC,OAAO,GAAG,CAAC,gBAAgB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA;QAC5C,CAAC;QAED,wEAAwE;QACxE,yIAAyI;QAEzI,kCAAkC;QAClC,oDAAoD;QACpD,gDAAgD;QAChD,IAAI;QAEJ,mCAAmC;QACnC,qEAAqE;QACrE,+DAA+D;QAC/D,IAAI;QAEJ,OAAO,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;IAC3B,CAAC;CACF;AA9BD,gCA8BC;AAED,SAAS,MAAM,CACb,KAAc,EACd,OAAU;IAEV,IAAK,KAAa,EAAE,KAAK,KAAK,SAAS,EAAE,CAAC;QACxC,OAAO,IAAA,oBAAS,EAAC,KAAK,EAAE,OAAO,CAAC,CAAA;IAClC,CAAC;IAED,IAAI,OAAO,CAAC,WAAW,KAAK,IAAI,EAAE,CAAC;QACjC,OAAO,IAAA,0BAAe,EAAC,KAAK,CAAC,CAAA;IAC/B,CAAC;IAED,OAAO,KAAK,CAAA;AACd,CAAC","sourcesContent":["import {\n BlobRef,\n LegacyBlobRef,\n isBlobRef,\n isLegacyBlobRef,\n} from '@atproto/lex-data'\nimport { Schema, ValidationResult, ValidatorContext } from '../validation.js'\n\nexport type BlobSchemaOptions = {\n /**\n * Whether to allow legacy blob references format\n * @see {@link LegacyBlobRef}\n */\n allowLegacy?: boolean\n /**\n * Whether to enforce strict validation on the blob reference (CID version, codec, hash function)\n */\n strict?: boolean\n /**\n * List of accepted mime types\n */\n accept?: string[]\n /**\n * Maximum size in bytes\n */\n maxSize?: number\n}\n\nexport type { BlobRef, LegacyBlobRef }\n\nexport type BlobSchemaOutput<Options> = Options extends { allowLegacy: true }\n ? BlobRef | LegacyBlobRef\n : BlobRef\n\nexport class BlobSchema<O extends BlobSchemaOptions> extends Schema<\n BlobSchemaOutput<O>\n> {\n constructor(readonly options: O) {\n super()\n }\n\n validateInContext(\n input: unknown,\n ctx: ValidatorContext,\n ): ValidationResult<BlobSchemaOutput<O>> {\n if (!isBlob(input, this.options)) {\n return ctx.issueInvalidType(input, 'blob')\n }\n\n // @NOTE Historically, we did not enforce constraints on blob references\n // https://github.com/bluesky-social/atproto/blob/4c15fb47cec26060bff2e710e95869a90c9d7fdd/packages/lexicon/src/validators/blob.ts#L5-L19\n\n // const { accept } = this.options\n // if (accept && !accept.includes(input.mimeType)) {\n // return ctx.issueInvalidValue(input, accept)\n // }\n\n // const { maxSize } = this.options\n // if (maxSize != null && input.size != -1 && input.size > maxSize) {\n // return ctx.issueTooBig(input, 'blob', maxSize, input.size)\n // }\n\n return ctx.success(input)\n }\n}\n\nfunction isBlob<O extends BlobSchemaOptions>(\n input: unknown,\n options: O,\n): input is BlobSchemaOutput<O> {\n if ((input as any)?.$type !== undefined) {\n return isBlobRef(input, options)\n }\n\n if (options.allowLegacy === true) {\n return isLegacyBlobRef(input)\n }\n\n return false\n}\n"]}
|
package/dist/schema/boolean.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Schema, ValidationResult, ValidatorContext } from '../validation.js';
|
|
2
2
|
export type BooleanSchemaOptions = {
|
|
3
3
|
default?: boolean;
|
|
4
4
|
};
|
|
5
|
-
export declare class BooleanSchema extends
|
|
6
|
-
readonly options
|
|
7
|
-
|
|
8
|
-
constructor(options: BooleanSchemaOptions);
|
|
5
|
+
export declare class BooleanSchema extends Schema<boolean> {
|
|
6
|
+
readonly options?: BooleanSchemaOptions | undefined;
|
|
7
|
+
constructor(options?: BooleanSchemaOptions | undefined);
|
|
9
8
|
validateInContext(input: unknown | undefined, ctx: ValidatorContext): ValidationResult<boolean>;
|
|
10
9
|
}
|
|
11
10
|
//# sourceMappingURL=boolean.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"boolean.d.ts","sourceRoot":"","sources":["../../src/schema/boolean.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"boolean.d.ts","sourceRoot":"","sources":["../../src/schema/boolean.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAE7E,MAAM,MAAM,oBAAoB,GAAG;IACjC,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,CAAA;AAED,qBAAa,aAAc,SAAQ,MAAM,CAAC,OAAO,CAAC;IACpC,QAAQ,CAAC,OAAO,CAAC,EAAE,oBAAoB;gBAA9B,OAAO,CAAC,EAAE,oBAAoB,YAAA;IAInD,iBAAiB,CACf,KAAK,EAAE,OAAO,YAAwB,EACtC,GAAG,EAAE,gBAAgB,GACpB,gBAAgB,CAAC,OAAO,CAAC;CAO7B"}
|
package/dist/schema/boolean.js
CHANGED
|
@@ -2,14 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BooleanSchema = void 0;
|
|
4
4
|
const validation_js_1 = require("../validation.js");
|
|
5
|
-
class BooleanSchema extends validation_js_1.
|
|
5
|
+
class BooleanSchema extends validation_js_1.Schema {
|
|
6
6
|
options;
|
|
7
|
-
lexiconType = 'boolean';
|
|
8
7
|
constructor(options) {
|
|
9
8
|
super();
|
|
10
9
|
this.options = options;
|
|
11
10
|
}
|
|
12
|
-
validateInContext(input = this.options
|
|
11
|
+
validateInContext(input = this.options?.default, ctx) {
|
|
13
12
|
if (typeof input === 'boolean') {
|
|
14
13
|
return ctx.success(input);
|
|
15
14
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"boolean.js","sourceRoot":"","sources":["../../src/schema/boolean.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"boolean.js","sourceRoot":"","sources":["../../src/schema/boolean.ts"],"names":[],"mappings":";;;AAAA,oDAA6E;AAM7E,MAAa,aAAc,SAAQ,sBAAe;IAC3B;IAArB,YAAqB,OAA8B;QACjD,KAAK,EAAE,CAAA;QADY,YAAO,GAAP,OAAO,CAAuB;IAEnD,CAAC;IAED,iBAAiB,CACf,QAAiB,IAAI,CAAC,OAAO,EAAE,OAAO,EACtC,GAAqB;QAErB,IAAI,OAAO,KAAK,KAAK,SAAS,EAAE,CAAC;YAC/B,OAAO,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;QAC3B,CAAC;QAED,OAAO,GAAG,CAAC,gBAAgB,CAAC,KAAK,EAAE,SAAS,CAAC,CAAA;IAC/C,CAAC;CACF;AAfD,sCAeC","sourcesContent":["import { Schema, ValidationResult, ValidatorContext } from '../validation.js'\n\nexport type BooleanSchemaOptions = {\n default?: boolean\n}\n\nexport class BooleanSchema extends Schema<boolean> {\n constructor(readonly options?: BooleanSchemaOptions) {\n super()\n }\n\n validateInContext(\n input: unknown = this.options?.default,\n ctx: ValidatorContext,\n ): ValidationResult<boolean> {\n if (typeof input === 'boolean') {\n return ctx.success(input)\n }\n\n return ctx.issueInvalidType(input, 'boolean')\n }\n}\n"]}
|
package/dist/schema/bytes.d.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Schema, ValidationResult, ValidatorContext } from '../validation.js';
|
|
2
2
|
export type BytesSchemaOptions = {
|
|
3
3
|
minLength?: number;
|
|
4
4
|
maxLength?: number;
|
|
5
5
|
};
|
|
6
|
-
export declare class BytesSchema extends
|
|
6
|
+
export declare class BytesSchema extends Schema<Uint8Array> {
|
|
7
7
|
readonly options: BytesSchemaOptions;
|
|
8
|
-
|
|
9
|
-
constructor(options: BytesSchemaOptions);
|
|
8
|
+
constructor(options?: BytesSchemaOptions);
|
|
10
9
|
validateInContext(input: unknown, ctx: ValidatorContext): ValidationResult<Uint8Array>;
|
|
11
10
|
}
|
|
12
11
|
//# sourceMappingURL=bytes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bytes.d.ts","sourceRoot":"","sources":["../../src/schema/bytes.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"bytes.d.ts","sourceRoot":"","sources":["../../src/schema/bytes.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAE7E,MAAM,MAAM,kBAAkB,GAAG;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,qBAAa,WAAY,SAAQ,MAAM,CAAC,UAAU,CAAC;IACrC,QAAQ,CAAC,OAAO,EAAE,kBAAkB;gBAA3B,OAAO,GAAE,kBAAuB;IAIrD,iBAAiB,CACf,KAAK,EAAE,OAAO,EACd,GAAG,EAAE,gBAAgB,GACpB,gBAAgB,CAAC,UAAU,CAAC;CAmBhC"}
|
package/dist/schema/bytes.js
CHANGED
|
@@ -3,10 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.BytesSchema = void 0;
|
|
4
4
|
const lex_data_1 = require("@atproto/lex-data");
|
|
5
5
|
const validation_js_1 = require("../validation.js");
|
|
6
|
-
class BytesSchema extends validation_js_1.
|
|
6
|
+
class BytesSchema extends validation_js_1.Schema {
|
|
7
7
|
options;
|
|
8
|
-
|
|
9
|
-
constructor(options) {
|
|
8
|
+
constructor(options = {}) {
|
|
10
9
|
super();
|
|
11
10
|
this.options = options;
|
|
12
11
|
}
|