document-model 6.2.3 → 6.3.0-dev.2

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.
@@ -0,0 +1,85 @@
1
+ import { z } from "zod";
2
+ //#region src/scalars/scalar-literal.d.ts
3
+ /**
4
+ * Closed literal grammar handed to `parseLiteral`. It mirrors the GraphQL
5
+ * literal kinds the catalog supports so a declaration never needs graphql-js.
6
+ */
7
+ type ScalarLiteralNode = {
8
+ readonly kind: "string";
9
+ readonly value: string;
10
+ } | {
11
+ readonly kind: "int";
12
+ readonly value: string;
13
+ } | {
14
+ readonly kind: "float";
15
+ readonly value: string;
16
+ } | {
17
+ readonly kind: "boolean";
18
+ readonly value: boolean;
19
+ } | {
20
+ readonly kind: "null";
21
+ } | {
22
+ readonly kind: "enum";
23
+ readonly value: string;
24
+ } | {
25
+ readonly kind: "list";
26
+ readonly values: readonly ScalarLiteralNode[];
27
+ } | {
28
+ readonly kind: "object";
29
+ readonly fields: readonly {
30
+ readonly name: string;
31
+ readonly value: ScalarLiteralNode;
32
+ }[];
33
+ } | {
34
+ readonly kind: "variable";
35
+ readonly name: string;
36
+ };
37
+ //#endregion
38
+ //#region src/scalars/types.d.ts
39
+ declare const SCALAR_DEFINITION: unique symbol;
40
+ declare const SCALAR_DEFINITION_VERSION = 1;
41
+ /** The wire shape of a scalar's values. */
42
+ type ScalarRepresentation = "string" | "number" | "boolean" | "json-object" | "json" | "opaque";
43
+ /** The GraphQL coercion of a scalar: variables, inline literals, and output. */
44
+ type ScalarCoercion<TValue> = {
45
+ readonly parseValue: (input: unknown) => TValue;
46
+ readonly parseLiteral: (node: ScalarLiteralNode) => TValue;
47
+ readonly serialize: (value: unknown) => unknown;
48
+ };
49
+ type ScalarDefinition<TName extends string = string, TValue = unknown> = {
50
+ readonly [SCALAR_DEFINITION]: typeof SCALAR_DEFINITION_VERSION;
51
+ readonly name: TName;
52
+ readonly description?: string;
53
+ readonly schema: z.ZodType<TValue>;
54
+ readonly typescriptType: string | null;
55
+ readonly zodSource: string | null;
56
+ readonly example?: TValue;
57
+ /**
58
+ * The wire shape of a value. It picks the literal kinds a derived coercion
59
+ * accepts. A definition from a release before this field lacks it.
60
+ */
61
+ readonly representation?: ScalarRepresentation;
62
+ /** Absent means derived: `schema` runs on every path and only the literal kinds of `representation` parse. */
63
+ readonly coercion?: ScalarCoercion<TValue>;
64
+ };
65
+ /** A definition this release made, with its representation filled. */
66
+ type DescribedScalarDefinition<TName extends string = string, TValue = unknown> = ScalarDefinition<TName, TValue> & {
67
+ readonly representation: ScalarRepresentation;
68
+ };
69
+ type ScalarValue<T> = T extends ScalarDefinition<string, infer V> ? V : never;
70
+ /** The definition format version `value` is branded with, if it has a brand. */
71
+ declare function scalarDefinitionVersion(value: unknown): unknown;
72
+ declare function isScalarDefinition(value: unknown): value is ScalarDefinition;
73
+ //#endregion
74
+ //#region src/scalars/catalog.d.ts
75
+ declare const scalarCatalog: readonly DescribedScalarDefinition[];
76
+ declare function getCatalogScalar(name: string): DescribedScalarDefinition | undefined;
77
+ type DocumentModelScalar = DescribedScalarDefinition & {
78
+ readonly typescriptType: string;
79
+ readonly zodSource: string;
80
+ };
81
+ declare const documentModelScalars: readonly DocumentModelScalar[];
82
+ //#endregion
83
+ export { SCALAR_DEFINITION_VERSION as a, ScalarRepresentation as c, scalarDefinitionVersion as d, ScalarLiteralNode as f, DescribedScalarDefinition as i, ScalarValue as l, getCatalogScalar as n, ScalarCoercion as o, scalarCatalog as r, ScalarDefinition as s, documentModelScalars as t, isScalarDefinition as u };
84
+ export {};
85
+ //# sourceMappingURL=catalog-B3nJD57s.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalog-B3nJD57s.d.ts","names":[],"sources":["../src/scalars/scalar-literal.ts","../src/scalars/types.ts","../src/scalars/catalog.ts"],"mappings":";;;;;;KAIY;WACG;WAAyB;;WACzB;WAAsB;;WACtB;WAAwB;;WACxB;WAA0B;;WAC1B;;WACA;WAAuB;;WACvB;WAAuB,iBAAiB;;WAExC;WACA;aACE;aACA,OAAO;;;WAGT;WAA2B;;;;cChB7B;cACA;;KAGD;;KASA,eAAe;WAChB,aAAa,mBAAmB;WAChC,eAAe,MAAM,sBAAsB;WAC3C,YAAY;;KAGX,iBACV,+BACA;YAEU,2BAA2B;WAC5B,MAAM;WACN;WACA,QAAQ,EAAE,QAAQ;WAClB;WACA;WACA,UAAU;;;;;WAKV,iBAAiB;;WAEjB,WAAW,eAAe;;;KAIzB,0BACV,+BACA,oBACE,iBAAiB,OAAO;WACjB,gBAAgB;;KAGf,YAAY,KACtB,UAAU,+BAA+B,KAAK;;iBAGhC,wBAAwB;iBAQxB,mBAAmB,iBAAiB,SAAS;;;cCbhD,wBAAwB;iBAOrB,iBACd,eACC;KAIE,sBAAsB;WAChB;WACA;;cAKE,+BAA+B"}