document-model 6.2.3-dev.79 → 6.2.3-dev.80
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/dist/scalars.d.ts +59 -0
- package/dist/scalars.d.ts.map +1 -0
- package/dist/scalars.js +287 -0
- package/dist/scalars.js.map +1 -0
- package/package.json +9 -4
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/scalars/types.d.ts
|
|
3
|
+
declare const SCALAR_DEFINITION: unique symbol;
|
|
4
|
+
export declare const SCALAR_DEFINITION_VERSION = 1;
|
|
5
|
+
type ScalarDefinition<TName extends string = string, TValue = unknown> = {
|
|
6
|
+
readonly [SCALAR_DEFINITION]: typeof SCALAR_DEFINITION_VERSION;
|
|
7
|
+
readonly name: TName;
|
|
8
|
+
readonly description?: string;
|
|
9
|
+
readonly schema: z.ZodType<TValue>;
|
|
10
|
+
readonly typescriptType: string | null;
|
|
11
|
+
readonly zodSource: string | null;
|
|
12
|
+
readonly example?: TValue;
|
|
13
|
+
};
|
|
14
|
+
type ScalarValue<T> = T extends ScalarDefinition<string, infer V> ? V : never;
|
|
15
|
+
/** The definition format version `value` is branded with, if it has a brand. */
|
|
16
|
+
export declare function scalarDefinitionVersion(value: unknown): unknown;
|
|
17
|
+
export declare function isScalarDefinition(value: unknown): value is ScalarDefinition;
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/scalars/catalog.d.ts
|
|
20
|
+
export declare const scalarCatalog: readonly ScalarDefinition[];
|
|
21
|
+
export declare function getCatalogScalar(name: string): ScalarDefinition | undefined;
|
|
22
|
+
type DocumentModelScalar = ScalarDefinition & {
|
|
23
|
+
readonly typescriptType: string;
|
|
24
|
+
readonly zodSource: string;
|
|
25
|
+
};
|
|
26
|
+
export declare const documentModelScalars: readonly DocumentModelScalar[];
|
|
27
|
+
//#endregion
|
|
28
|
+
//#region src/scalars/define-scalar.d.ts
|
|
29
|
+
type Json = string | number | boolean | null | Json[] | {
|
|
30
|
+
[key: string]: Json;
|
|
31
|
+
};
|
|
32
|
+
type OutputIsAny = {
|
|
33
|
+
"defineScalar refuses this schema: its output is any": never;
|
|
34
|
+
};
|
|
35
|
+
type AcceptsMissingValue = {
|
|
36
|
+
"defineScalar refuses this schema: it accepts a missing value; nullability belongs in the SDL": never;
|
|
37
|
+
};
|
|
38
|
+
type OutputCanBeNull = {
|
|
39
|
+
"defineScalar refuses this schema: its output can be null; nullability belongs in the SDL": never;
|
|
40
|
+
};
|
|
41
|
+
type OutputIsNotJson = {
|
|
42
|
+
"defineScalar refuses this schema: its output must be JSON": never;
|
|
43
|
+
};
|
|
44
|
+
type OutputFailsSchema = {
|
|
45
|
+
"defineScalar refuses this schema: its output must pass the schema again": never;
|
|
46
|
+
};
|
|
47
|
+
type TakesMissingValue<S extends z.ZodType> = S["_zod"]["optin"] extends "defaulted" ? true : S["_zod"]["optout"] extends "optional" ? true : unknown extends z.input<S> ? false : undefined extends z.input<S> ? true : false;
|
|
48
|
+
type CanonicalSchema<S extends z.ZodType> = 0 extends 1 & z.output<S> ? OutputIsAny : TakesMissingValue<S> extends true ? AcceptsMissingValue : z.output<S> extends Json ? null extends z.output<S> ? OutputCanBeNull : z.output<S> extends z.input<S> ? S : OutputFailsSchema : OutputIsNotJson;
|
|
49
|
+
type ScalarInput<TName extends string, S extends z.ZodType> = {
|
|
50
|
+
name: TName;
|
|
51
|
+
schema: S & CanonicalSchema<S>;
|
|
52
|
+
description?: string;
|
|
53
|
+
example?: NoInfer<z.input<S>>;
|
|
54
|
+
};
|
|
55
|
+
export declare function defineScalar<TName extends string, S extends z.ZodType>(input: ScalarInput<TName, S>): ScalarDefinition<TName, z.output<S>>;
|
|
56
|
+
//#endregion
|
|
57
|
+
export type { ScalarDefinition, ScalarValue };
|
|
58
|
+
export {};
|
|
59
|
+
//# sourceMappingURL=scalars.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scalars.d.ts","names":[],"sources":["../src/scalars/types.ts","../src/scalars/catalog.ts","../src/scalars/define-scalar.ts"],"mappings":";;cAEa;qBACA;KAED,iBACV,+BACA;YAEU,2BAA2B;WAC5B,MAAM;WACN;WACA,QAAQ,EAAE,QAAQ;WAClB;WACA;WACA,UAAU;;KAGT,YAAY,KACtB,UAAU,+BAA+B,KAAK;;wBAGhC,wBAAwB;wBAQxB,mBAAmB,iBAAiB,SAAS;;;qBCPhD,wBAAwB;wBA4BrB,iBAAiB,eAAe;KAI3C,sBAAsB;WAChB;WACA;;qBAKE,+BAA+B;;;KCzDvC,0CAA0C;GAAY,cAAc;;KAEpE;EACH;;KAEG;EACH;;KAEG;EACH;;KAEG;EACH;;KAEG;EACH;;KAMG,kBAAkB,UAAU,EAAE,WACjC,gDAEI,gEAEkB,EAAE,MAAM,+BAEJ,EAAE,MAAM;KAI/B,gBAAgB,UAAU,EAAE,yBAAyB,EAAE,OAAO,KAC/D,cACA,kBAAkB,kBAChB,sBACA,EAAE,OAAO,WAAW,oBACL,EAAE,OAAO,KACpB,kBACA,EAAE,OAAO,WAAW,EAAE,MAAM,KAC1B,IACA,oBACJ;KAEH,YAAY,sBAAsB,UAAU,EAAE;EACjD,MAAM;EACN,QAAQ,IAAI,gBAAgB;EAC5B;EACA,UAAU,QAAQ,EAAE,MAAM;;wBA2CZ,aAAa,sBAAsB,UAAU,EAAE,SAC7D,OAAO,YAAY,OAAO,KACzB,iBAAiB,OAAO,EAAE,OAAO"}
|
package/dist/scalars.js
ADDED
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/scalars/types.ts
|
|
3
|
+
const SCALAR_DEFINITION = Symbol.for("powerhouse.scalar-definition");
|
|
4
|
+
const SCALAR_DEFINITION_VERSION = 1;
|
|
5
|
+
/** The definition format version `value` is branded with, if it has a brand. */
|
|
6
|
+
function scalarDefinitionVersion(value) {
|
|
7
|
+
return typeof value === "object" && value !== null && SCALAR_DEFINITION in value ? value[SCALAR_DEFINITION] : void 0;
|
|
8
|
+
}
|
|
9
|
+
function isScalarDefinition(value) {
|
|
10
|
+
return scalarDefinitionVersion(value) === 1;
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region src/scalars/define-catalog-scalar.ts
|
|
14
|
+
function defineCatalogScalar(input) {
|
|
15
|
+
return Object.freeze({
|
|
16
|
+
...input,
|
|
17
|
+
[SCALAR_DEFINITION]: 1
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region src/scalars/declarations/unknown.ts
|
|
22
|
+
const unknownScalar = defineCatalogScalar({
|
|
23
|
+
name: "Unknown",
|
|
24
|
+
typescriptType: "unknown",
|
|
25
|
+
zodSource: "z.unknown()",
|
|
26
|
+
schema: z.unknown()
|
|
27
|
+
});
|
|
28
|
+
//#endregion
|
|
29
|
+
//#region src/scalars/declarations/date-time.ts
|
|
30
|
+
const dateTimeScalar = defineCatalogScalar({
|
|
31
|
+
example: "2024-01-01T00:00:00.000Z",
|
|
32
|
+
name: "DateTime",
|
|
33
|
+
typescriptType: "string",
|
|
34
|
+
zodSource: "z.iso.datetime()",
|
|
35
|
+
schema: z.iso.datetime()
|
|
36
|
+
});
|
|
37
|
+
//#endregion
|
|
38
|
+
//#region src/scalars/pattern.ts
|
|
39
|
+
function matchesScalarPattern(pattern, value) {
|
|
40
|
+
return Reflect.apply(pattern.test.bind(pattern), void 0, [value]) === true;
|
|
41
|
+
}
|
|
42
|
+
//#endregion
|
|
43
|
+
//#region src/scalars/declarations/address.ts
|
|
44
|
+
const addressScalar = defineCatalogScalar({
|
|
45
|
+
example: "eip155:0x0000000000000000000000000000000000000000",
|
|
46
|
+
name: "Address",
|
|
47
|
+
typescriptType: "`${string}:0x${string}`",
|
|
48
|
+
zodSource: "z.custom<`${string}:0x${string}`>((val) => /^[a-zA-Z0-9]+:0x[a-fA-F0-9]{40}$/.test(val as string))",
|
|
49
|
+
schema: z.custom((val) => matchesScalarPattern(/^[a-zA-Z0-9]+:0x[a-fA-F0-9]{40}$/, val))
|
|
50
|
+
});
|
|
51
|
+
//#endregion
|
|
52
|
+
//#region src/scalars/declarations/attachment-ref.ts
|
|
53
|
+
const attachmentRefScalar = defineCatalogScalar({
|
|
54
|
+
example: "attachment://v1:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
|
55
|
+
name: "AttachmentRef",
|
|
56
|
+
typescriptType: "`attachment://v${number}:${string}`",
|
|
57
|
+
zodSource: "z.custom<`attachment://v${number}:${string}`>((val) => /^attachment:\\/\\/v\\d+:.+$/.test(val as string))",
|
|
58
|
+
schema: z.custom((val) => matchesScalarPattern(/^attachment:\/\/v\d+:.+$/, val))
|
|
59
|
+
});
|
|
60
|
+
//#endregion
|
|
61
|
+
//#region src/scalars/declarations/amount-tokens.ts
|
|
62
|
+
const amountTokensScalar = defineCatalogScalar({
|
|
63
|
+
name: "Amount_Tokens",
|
|
64
|
+
typescriptType: "number",
|
|
65
|
+
zodSource: "z.number()",
|
|
66
|
+
schema: z.number()
|
|
67
|
+
});
|
|
68
|
+
//#endregion
|
|
69
|
+
//#region src/scalars/declarations/ethereum-address.ts
|
|
70
|
+
const ethereumAddressScalar = defineCatalogScalar({
|
|
71
|
+
name: "EthereumAddress",
|
|
72
|
+
typescriptType: "string",
|
|
73
|
+
zodSource: "z.string().regex(/^0x[a-fA-F0-9]{40}$/, { error: 'Invalid Ethereum address format' })",
|
|
74
|
+
schema: z.string().regex(/^0x[a-fA-F0-9]{40}$/, { error: "Invalid Ethereum address format" })
|
|
75
|
+
});
|
|
76
|
+
//#endregion
|
|
77
|
+
//#region src/scalars/declarations/email-address.ts
|
|
78
|
+
const emailAddressScalar = defineCatalogScalar({
|
|
79
|
+
name: "EmailAddress",
|
|
80
|
+
typescriptType: "string",
|
|
81
|
+
zodSource: "z.email()",
|
|
82
|
+
schema: z.email()
|
|
83
|
+
});
|
|
84
|
+
//#endregion
|
|
85
|
+
//#region src/scalars/declarations/amount-percentage.ts
|
|
86
|
+
const amountPercentageScalar = defineCatalogScalar({
|
|
87
|
+
name: "Amount_Percentage",
|
|
88
|
+
typescriptType: "number",
|
|
89
|
+
zodSource: "z.number()",
|
|
90
|
+
schema: z.number()
|
|
91
|
+
});
|
|
92
|
+
//#endregion
|
|
93
|
+
//#region src/scalars/declarations/date.ts
|
|
94
|
+
const dateScalar = defineCatalogScalar({
|
|
95
|
+
example: "2024-01-01T00:00:00.000Z",
|
|
96
|
+
name: "Date",
|
|
97
|
+
typescriptType: "string",
|
|
98
|
+
zodSource: "z.iso.datetime()",
|
|
99
|
+
schema: z.iso.datetime()
|
|
100
|
+
});
|
|
101
|
+
//#endregion
|
|
102
|
+
//#region src/scalars/declarations/url.ts
|
|
103
|
+
const urlScalar = defineCatalogScalar({
|
|
104
|
+
example: "https://example.com",
|
|
105
|
+
name: "URL",
|
|
106
|
+
typescriptType: "string",
|
|
107
|
+
zodSource: "z.url()",
|
|
108
|
+
schema: z.url()
|
|
109
|
+
});
|
|
110
|
+
//#endregion
|
|
111
|
+
//#region src/scalars/declarations/amount-money.ts
|
|
112
|
+
const amountMoneyScalar = defineCatalogScalar({
|
|
113
|
+
name: "Amount_Money",
|
|
114
|
+
typescriptType: "number",
|
|
115
|
+
zodSource: "z.number()",
|
|
116
|
+
schema: z.number()
|
|
117
|
+
});
|
|
118
|
+
//#endregion
|
|
119
|
+
//#region src/scalars/declarations/olabel.ts
|
|
120
|
+
const olabelScalar = defineCatalogScalar({
|
|
121
|
+
name: "OLabel",
|
|
122
|
+
typescriptType: "string",
|
|
123
|
+
zodSource: "z.string()",
|
|
124
|
+
schema: z.string()
|
|
125
|
+
});
|
|
126
|
+
//#endregion
|
|
127
|
+
//#region src/scalars/declarations/currency.ts
|
|
128
|
+
const currencyScalar = defineCatalogScalar({
|
|
129
|
+
name: "Currency",
|
|
130
|
+
typescriptType: "string",
|
|
131
|
+
zodSource: "z.string()",
|
|
132
|
+
schema: z.string()
|
|
133
|
+
});
|
|
134
|
+
//#endregion
|
|
135
|
+
//#region src/scalars/declarations/phid.ts
|
|
136
|
+
const phidScalar = defineCatalogScalar({
|
|
137
|
+
name: "PHID",
|
|
138
|
+
typescriptType: "string",
|
|
139
|
+
zodSource: "z.string()",
|
|
140
|
+
schema: z.string()
|
|
141
|
+
});
|
|
142
|
+
//#endregion
|
|
143
|
+
//#region src/scalars/declarations/oid.ts
|
|
144
|
+
const oidScalar = defineCatalogScalar({
|
|
145
|
+
name: "OID",
|
|
146
|
+
typescriptType: "string",
|
|
147
|
+
zodSource: "z.string()",
|
|
148
|
+
schema: z.string()
|
|
149
|
+
});
|
|
150
|
+
//#endregion
|
|
151
|
+
//#region src/scalars/declarations/amount-fiat.ts
|
|
152
|
+
const amountFiatScalar = defineCatalogScalar({
|
|
153
|
+
name: "Amount_Fiat",
|
|
154
|
+
typescriptType: "{ unit: string, value: number }",
|
|
155
|
+
zodSource: "z.object({ unit: z.string(), value: z.number() })",
|
|
156
|
+
schema: z.object({
|
|
157
|
+
unit: z.string(),
|
|
158
|
+
value: z.number()
|
|
159
|
+
})
|
|
160
|
+
});
|
|
161
|
+
//#endregion
|
|
162
|
+
//#region src/scalars/declarations/amount-currency.ts
|
|
163
|
+
const amountCurrencyScalar = defineCatalogScalar({
|
|
164
|
+
name: "Amount_Currency",
|
|
165
|
+
typescriptType: "{ unit: string, value: string }",
|
|
166
|
+
zodSource: "z.object({ unit: z.string(), value: z.string()})",
|
|
167
|
+
schema: z.object({
|
|
168
|
+
unit: z.string(),
|
|
169
|
+
value: z.string()
|
|
170
|
+
})
|
|
171
|
+
});
|
|
172
|
+
//#endregion
|
|
173
|
+
//#region src/scalars/declarations/amount-crypto.ts
|
|
174
|
+
const amountCryptoScalar = defineCatalogScalar({
|
|
175
|
+
name: "Amount_Crypto",
|
|
176
|
+
typescriptType: "{ unit: string, value: string }",
|
|
177
|
+
zodSource: "z.object({ unit: z.string(), value: z.string() })",
|
|
178
|
+
schema: z.object({
|
|
179
|
+
unit: z.string(),
|
|
180
|
+
value: z.string()
|
|
181
|
+
})
|
|
182
|
+
});
|
|
183
|
+
//#endregion
|
|
184
|
+
//#region src/scalars/declarations/amount.ts
|
|
185
|
+
const amountScalar = defineCatalogScalar({
|
|
186
|
+
name: "Amount",
|
|
187
|
+
typescriptType: "{ unit?: string, value?: number }",
|
|
188
|
+
zodSource: "z.object({ unit: z.string().optional(), value: z.number() })",
|
|
189
|
+
schema: z.object({
|
|
190
|
+
unit: z.string().optional(),
|
|
191
|
+
value: z.number()
|
|
192
|
+
})
|
|
193
|
+
});
|
|
194
|
+
//#endregion
|
|
195
|
+
//#region src/scalars/declarations/upload.ts
|
|
196
|
+
const uploadScalar = defineCatalogScalar({
|
|
197
|
+
name: "Upload",
|
|
198
|
+
typescriptType: "File",
|
|
199
|
+
zodSource: "z.any()",
|
|
200
|
+
schema: z.any()
|
|
201
|
+
});
|
|
202
|
+
//#endregion
|
|
203
|
+
//#region src/scalars/declarations/json-object.ts
|
|
204
|
+
const jsonObjectScalar = defineCatalogScalar({
|
|
205
|
+
name: "JSONObject",
|
|
206
|
+
typescriptType: null,
|
|
207
|
+
zodSource: null,
|
|
208
|
+
schema: z.record(z.string(), z.unknown())
|
|
209
|
+
});
|
|
210
|
+
//#endregion
|
|
211
|
+
//#region src/scalars/catalog.ts
|
|
212
|
+
const scalarCatalog = Object.freeze([
|
|
213
|
+
unknownScalar,
|
|
214
|
+
dateTimeScalar,
|
|
215
|
+
addressScalar,
|
|
216
|
+
attachmentRefScalar,
|
|
217
|
+
amountTokensScalar,
|
|
218
|
+
ethereumAddressScalar,
|
|
219
|
+
emailAddressScalar,
|
|
220
|
+
amountPercentageScalar,
|
|
221
|
+
dateScalar,
|
|
222
|
+
urlScalar,
|
|
223
|
+
amountMoneyScalar,
|
|
224
|
+
olabelScalar,
|
|
225
|
+
currencyScalar,
|
|
226
|
+
phidScalar,
|
|
227
|
+
oidScalar,
|
|
228
|
+
amountFiatScalar,
|
|
229
|
+
amountCurrencyScalar,
|
|
230
|
+
amountCryptoScalar,
|
|
231
|
+
amountScalar,
|
|
232
|
+
uploadScalar,
|
|
233
|
+
jsonObjectScalar
|
|
234
|
+
]);
|
|
235
|
+
const byName = new Map(scalarCatalog.map((definition) => [definition.name, definition]));
|
|
236
|
+
function getCatalogScalar(name) {
|
|
237
|
+
return byName.get(name);
|
|
238
|
+
}
|
|
239
|
+
const documentModelScalars = Object.freeze(scalarCatalog.filter((definition) => definition.typescriptType !== null && definition.zodSource !== null));
|
|
240
|
+
//#endregion
|
|
241
|
+
//#region src/scalars/define-scalar.ts
|
|
242
|
+
const inputKeys = /* @__PURE__ */ new Set([
|
|
243
|
+
"name",
|
|
244
|
+
"schema",
|
|
245
|
+
"description",
|
|
246
|
+
"example"
|
|
247
|
+
]);
|
|
248
|
+
const graphqlBuiltIns = /* @__PURE__ */ new Set([
|
|
249
|
+
"Int",
|
|
250
|
+
"Float",
|
|
251
|
+
"String",
|
|
252
|
+
"Boolean",
|
|
253
|
+
"ID"
|
|
254
|
+
]);
|
|
255
|
+
const catalogNames = new Set(scalarCatalog.map((definition) => definition.name));
|
|
256
|
+
const graphqlName = /^[_A-Za-z][_0-9A-Za-z]*$/;
|
|
257
|
+
const refusals = [
|
|
258
|
+
(input) => {
|
|
259
|
+
const unknownKeys = Object.keys(input).filter((key) => !inputKeys.has(key));
|
|
260
|
+
return unknownKeys.length > 0 ? `unknown input key ${unknownKeys.join(", ")}; defineScalar accepts only name, schema, description and example` : void 0;
|
|
261
|
+
},
|
|
262
|
+
({ name }) => typeof name !== "string" || !graphqlName.test(name) || name.startsWith("__") ? "the name is not a valid GraphQL name" : void 0,
|
|
263
|
+
({ name }) => graphqlBuiltIns.has(name) ? "the name is a GraphQL built-in scalar" : void 0,
|
|
264
|
+
({ name }) => catalogNames.has(name) ? "the name is a catalog scalar" : void 0,
|
|
265
|
+
({ schema }) => schema._zod.optin === "defaulted" || schema._zod.optout === "optional" ? "the schema accepts a missing value; nullability belongs in the SDL" : void 0
|
|
266
|
+
];
|
|
267
|
+
function defineScalar(input) {
|
|
268
|
+
for (const refusal of refusals) {
|
|
269
|
+
const reason = refusal(input);
|
|
270
|
+
if (reason !== void 0) throw new Error(`Cannot define scalar "${String(input.name)}": ${reason}.`);
|
|
271
|
+
}
|
|
272
|
+
const { example, ...definition } = input;
|
|
273
|
+
const schema = input.schema;
|
|
274
|
+
const parsedExample = example === void 0 ? void 0 : schema.safeParse(example);
|
|
275
|
+
if (parsedExample?.success === false) throw new Error(`Cannot define scalar "${input.name}": the example fails the schema: ${z.prettifyError(parsedExample.error)}`);
|
|
276
|
+
return defineCatalogScalar({
|
|
277
|
+
...definition,
|
|
278
|
+
schema,
|
|
279
|
+
...parsedExample && { example: parsedExample.data },
|
|
280
|
+
typescriptType: null,
|
|
281
|
+
zodSource: null
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
//#endregion
|
|
285
|
+
export { SCALAR_DEFINITION_VERSION, defineScalar, documentModelScalars, getCatalogScalar, isScalarDefinition, scalarCatalog, scalarDefinitionVersion };
|
|
286
|
+
|
|
287
|
+
//# sourceMappingURL=scalars.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scalars.js","names":[],"sources":["../src/scalars/types.ts","../src/scalars/define-catalog-scalar.ts","../src/scalars/declarations/unknown.ts","../src/scalars/declarations/date-time.ts","../src/scalars/pattern.ts","../src/scalars/declarations/address.ts","../src/scalars/declarations/attachment-ref.ts","../src/scalars/declarations/amount-tokens.ts","../src/scalars/declarations/ethereum-address.ts","../src/scalars/declarations/email-address.ts","../src/scalars/declarations/amount-percentage.ts","../src/scalars/declarations/date.ts","../src/scalars/declarations/url.ts","../src/scalars/declarations/amount-money.ts","../src/scalars/declarations/olabel.ts","../src/scalars/declarations/currency.ts","../src/scalars/declarations/phid.ts","../src/scalars/declarations/oid.ts","../src/scalars/declarations/amount-fiat.ts","../src/scalars/declarations/amount-currency.ts","../src/scalars/declarations/amount-crypto.ts","../src/scalars/declarations/amount.ts","../src/scalars/declarations/upload.ts","../src/scalars/declarations/json-object.ts","../src/scalars/catalog.ts","../src/scalars/define-scalar.ts"],"sourcesContent":["import type { z } from \"zod\";\n\nexport const SCALAR_DEFINITION = Symbol.for(\"powerhouse.scalar-definition\");\nexport const SCALAR_DEFINITION_VERSION = 1;\n\nexport type ScalarDefinition<\n TName extends string = string,\n TValue = unknown,\n> = {\n readonly [SCALAR_DEFINITION]: typeof SCALAR_DEFINITION_VERSION;\n readonly name: TName;\n readonly description?: string;\n readonly schema: z.ZodType<TValue>;\n readonly typescriptType: string | null;\n readonly zodSource: string | null;\n readonly example?: TValue;\n};\n\nexport type ScalarValue<T> =\n T extends ScalarDefinition<string, infer V> ? V : never;\n\n/** The definition format version `value` is branded with, if it has a brand. */\nexport function scalarDefinitionVersion(value: unknown): unknown {\n return typeof value === \"object\" &&\n value !== null &&\n SCALAR_DEFINITION in value\n ? value[SCALAR_DEFINITION]\n : undefined;\n}\n\nexport function isScalarDefinition(value: unknown): value is ScalarDefinition {\n return scalarDefinitionVersion(value) === SCALAR_DEFINITION_VERSION;\n}\n","import {\n SCALAR_DEFINITION,\n SCALAR_DEFINITION_VERSION,\n type ScalarDefinition,\n} from \"./types.js\";\n\nexport function defineCatalogScalar<TName extends string, TValue>(\n input: Omit<ScalarDefinition<TName, TValue>, typeof SCALAR_DEFINITION>,\n): ScalarDefinition<TName, TValue> {\n return Object.freeze({\n ...input,\n [SCALAR_DEFINITION]: SCALAR_DEFINITION_VERSION,\n } satisfies ScalarDefinition<TName, TValue>);\n}\n","import { z } from \"zod\";\nimport { defineCatalogScalar } from \"../define-catalog-scalar.js\";\n\nexport const unknownScalar = defineCatalogScalar({\n name: \"Unknown\",\n typescriptType: \"unknown\",\n zodSource: \"z.unknown()\",\n schema: z.unknown(),\n});\n","import { z } from \"zod\";\nimport { defineCatalogScalar } from \"../define-catalog-scalar.js\";\n\nexport const dateTimeScalar = defineCatalogScalar({\n example: \"2024-01-01T00:00:00.000Z\",\n name: \"DateTime\",\n typescriptType: \"string\",\n zodSource: \"z.iso.datetime()\",\n schema: z.iso.datetime(),\n});\n","export function matchesScalarPattern(pattern: RegExp, value: unknown): boolean {\n return Reflect.apply(pattern.test.bind(pattern), undefined, [value]) === true;\n}\n","import { z } from \"zod\";\nimport { defineCatalogScalar } from \"../define-catalog-scalar.js\";\nimport { matchesScalarPattern } from \"../pattern.js\";\n\nexport const addressScalar = defineCatalogScalar({\n example: \"eip155:0x0000000000000000000000000000000000000000\",\n name: \"Address\",\n typescriptType: \"`${string}:0x${string}`\",\n zodSource:\n \"z.custom<`${string}:0x${string}`>((val) => /^[a-zA-Z0-9]+:0x[a-fA-F0-9]{40}$/.test(val as string))\",\n schema: z.custom<`${string}:0x${string}`>((val) =>\n matchesScalarPattern(/^[a-zA-Z0-9]+:0x[a-fA-F0-9]{40}$/, val),\n ),\n});\n","import { z } from \"zod\";\nimport { defineCatalogScalar } from \"../define-catalog-scalar.js\";\nimport { matchesScalarPattern } from \"../pattern.js\";\n\nexport const attachmentRefScalar = defineCatalogScalar({\n example:\n \"attachment://v1:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\n name: \"AttachmentRef\",\n typescriptType: \"`attachment://v${number}:${string}`\",\n zodSource:\n \"z.custom<`attachment://v${number}:${string}`>((val) => /^attachment:\\\\/\\\\/v\\\\d+:.+$/.test(val as string))\",\n schema: z.custom<`attachment://v${number}:${string}`>((val) =>\n matchesScalarPattern(/^attachment:\\/\\/v\\d+:.+$/, val),\n ),\n});\n","import { z } from \"zod\";\nimport { defineCatalogScalar } from \"../define-catalog-scalar.js\";\n\nexport const amountTokensScalar = defineCatalogScalar({\n name: \"Amount_Tokens\",\n typescriptType: \"number\",\n zodSource: \"z.number()\",\n schema: z.number(),\n});\n","import { z } from \"zod\";\nimport { defineCatalogScalar } from \"../define-catalog-scalar.js\";\n\nexport const ethereumAddressScalar = defineCatalogScalar({\n name: \"EthereumAddress\",\n typescriptType: \"string\",\n zodSource:\n \"z.string().regex(/^0x[a-fA-F0-9]{40}$/, { error: 'Invalid Ethereum address format' })\",\n schema: z.string().regex(/^0x[a-fA-F0-9]{40}$/, {\n error: \"Invalid Ethereum address format\",\n }),\n});\n","import { z } from \"zod\";\nimport { defineCatalogScalar } from \"../define-catalog-scalar.js\";\n\nexport const emailAddressScalar = defineCatalogScalar({\n name: \"EmailAddress\",\n typescriptType: \"string\",\n zodSource: \"z.email()\",\n schema: z.email(),\n});\n","import { z } from \"zod\";\nimport { defineCatalogScalar } from \"../define-catalog-scalar.js\";\n\nexport const amountPercentageScalar = defineCatalogScalar({\n name: \"Amount_Percentage\",\n typescriptType: \"number\",\n zodSource: \"z.number()\",\n schema: z.number(),\n});\n","import { z } from \"zod\";\nimport { defineCatalogScalar } from \"../define-catalog-scalar.js\";\n\nexport const dateScalar = defineCatalogScalar({\n example: \"2024-01-01T00:00:00.000Z\",\n name: \"Date\",\n typescriptType: \"string\",\n zodSource: \"z.iso.datetime()\",\n schema: z.iso.datetime(),\n});\n","import { z } from \"zod\";\nimport { defineCatalogScalar } from \"../define-catalog-scalar.js\";\n\nexport const urlScalar = defineCatalogScalar({\n example: \"https://example.com\",\n name: \"URL\",\n typescriptType: \"string\",\n zodSource: \"z.url()\",\n schema: z.url(),\n});\n","import { z } from \"zod\";\nimport { defineCatalogScalar } from \"../define-catalog-scalar.js\";\n\nexport const amountMoneyScalar = defineCatalogScalar({\n name: \"Amount_Money\",\n typescriptType: \"number\",\n zodSource: \"z.number()\",\n schema: z.number(),\n});\n","import { z } from \"zod\";\nimport { defineCatalogScalar } from \"../define-catalog-scalar.js\";\n\nexport const olabelScalar = defineCatalogScalar({\n name: \"OLabel\",\n typescriptType: \"string\",\n zodSource: \"z.string()\",\n schema: z.string(),\n});\n","import { z } from \"zod\";\nimport { defineCatalogScalar } from \"../define-catalog-scalar.js\";\n\nexport const currencyScalar = defineCatalogScalar({\n name: \"Currency\",\n typescriptType: \"string\",\n zodSource: \"z.string()\",\n schema: z.string(),\n});\n","import { z } from \"zod\";\nimport { defineCatalogScalar } from \"../define-catalog-scalar.js\";\n\nexport const phidScalar = defineCatalogScalar({\n name: \"PHID\",\n typescriptType: \"string\",\n zodSource: \"z.string()\",\n schema: z.string(),\n});\n","import { z } from \"zod\";\nimport { defineCatalogScalar } from \"../define-catalog-scalar.js\";\n\nexport const oidScalar = defineCatalogScalar({\n name: \"OID\",\n typescriptType: \"string\",\n zodSource: \"z.string()\",\n schema: z.string(),\n});\n","import { z } from \"zod\";\nimport { defineCatalogScalar } from \"../define-catalog-scalar.js\";\n\nexport const amountFiatScalar = defineCatalogScalar({\n name: \"Amount_Fiat\",\n typescriptType: \"{ unit: string, value: number }\",\n zodSource: \"z.object({ unit: z.string(), value: z.number() })\",\n schema: z.object({ unit: z.string(), value: z.number() }),\n});\n","import { z } from \"zod\";\nimport { defineCatalogScalar } from \"../define-catalog-scalar.js\";\n\nexport const amountCurrencyScalar = defineCatalogScalar({\n name: \"Amount_Currency\",\n typescriptType: \"{ unit: string, value: string }\",\n zodSource: \"z.object({ unit: z.string(), value: z.string()})\",\n schema: z.object({ unit: z.string(), value: z.string() }),\n});\n","import { z } from \"zod\";\nimport { defineCatalogScalar } from \"../define-catalog-scalar.js\";\n\nexport const amountCryptoScalar = defineCatalogScalar({\n name: \"Amount_Crypto\",\n typescriptType: \"{ unit: string, value: string }\",\n zodSource: \"z.object({ unit: z.string(), value: z.string() })\",\n schema: z.object({ unit: z.string(), value: z.string() }),\n});\n","import { z } from \"zod\";\nimport { defineCatalogScalar } from \"../define-catalog-scalar.js\";\n\nexport const amountScalar = defineCatalogScalar({\n name: \"Amount\",\n typescriptType: \"{ unit?: string, value?: number }\",\n zodSource: \"z.object({ unit: z.string().optional(), value: z.number() })\",\n schema: z.object({ unit: z.string().optional(), value: z.number() }),\n});\n","import { z } from \"zod\";\nimport { defineCatalogScalar } from \"../define-catalog-scalar.js\";\n\nexport const uploadScalar = defineCatalogScalar({\n name: \"Upload\",\n typescriptType: \"File\",\n zodSource: \"z.any()\",\n schema: z.any(),\n});\n","import { z } from \"zod\";\nimport { defineCatalogScalar } from \"../define-catalog-scalar.js\";\n\nexport const jsonObjectScalar = defineCatalogScalar({\n name: \"JSONObject\",\n typescriptType: null,\n zodSource: null,\n schema: z.record(z.string(), z.unknown()),\n});\n","import { unknownScalar } from \"./declarations/unknown.js\";\nimport { dateTimeScalar } from \"./declarations/date-time.js\";\nimport { addressScalar } from \"./declarations/address.js\";\nimport { attachmentRefScalar } from \"./declarations/attachment-ref.js\";\nimport { amountTokensScalar } from \"./declarations/amount-tokens.js\";\nimport { ethereumAddressScalar } from \"./declarations/ethereum-address.js\";\nimport { emailAddressScalar } from \"./declarations/email-address.js\";\nimport { amountPercentageScalar } from \"./declarations/amount-percentage.js\";\nimport { dateScalar } from \"./declarations/date.js\";\nimport { urlScalar } from \"./declarations/url.js\";\nimport { amountMoneyScalar } from \"./declarations/amount-money.js\";\nimport { olabelScalar } from \"./declarations/olabel.js\";\nimport { currencyScalar } from \"./declarations/currency.js\";\nimport { phidScalar } from \"./declarations/phid.js\";\nimport { oidScalar } from \"./declarations/oid.js\";\nimport { amountFiatScalar } from \"./declarations/amount-fiat.js\";\nimport { amountCurrencyScalar } from \"./declarations/amount-currency.js\";\nimport { amountCryptoScalar } from \"./declarations/amount-crypto.js\";\nimport { amountScalar } from \"./declarations/amount.js\";\nimport { uploadScalar } from \"./declarations/upload.js\";\nimport { jsonObjectScalar } from \"./declarations/json-object.js\";\nimport type { ScalarDefinition } from \"./types.js\";\n\nexport const scalarCatalog: readonly ScalarDefinition[] = Object.freeze([\n unknownScalar,\n dateTimeScalar,\n addressScalar,\n attachmentRefScalar,\n amountTokensScalar,\n ethereumAddressScalar,\n emailAddressScalar,\n amountPercentageScalar,\n dateScalar,\n urlScalar,\n amountMoneyScalar,\n olabelScalar,\n currencyScalar,\n phidScalar,\n oidScalar,\n amountFiatScalar,\n amountCurrencyScalar,\n amountCryptoScalar,\n amountScalar,\n uploadScalar,\n jsonObjectScalar,\n]);\n\nconst byName = new Map(\n scalarCatalog.map((definition) => [definition.name, definition]),\n);\n\nexport function getCatalogScalar(name: string): ScalarDefinition | undefined {\n return byName.get(name);\n}\n\ntype DocumentModelScalar = ScalarDefinition & {\n readonly typescriptType: string;\n readonly zodSource: string;\n};\n\n// A model's SDL may use every catalog scalar codegen can type. JSONObject is\n// host-only, so it has neither a TypeScript type nor a zod source.\nexport const documentModelScalars: readonly DocumentModelScalar[] =\n Object.freeze(\n scalarCatalog.filter(\n (definition): definition is DocumentModelScalar =>\n definition.typescriptType !== null && definition.zodSource !== null,\n ),\n );\n","import { z } from \"zod\";\nimport { scalarCatalog } from \"./catalog.js\";\nimport { defineCatalogScalar } from \"./define-catalog-scalar.js\";\nimport type { ScalarDefinition } from \"./types.js\";\n\ntype Json = string | number | boolean | null | Json[] | { [key: string]: Json };\n\ntype OutputIsAny = {\n \"defineScalar refuses this schema: its output is any\": never;\n};\ntype AcceptsMissingValue = {\n \"defineScalar refuses this schema: it accepts a missing value; nullability belongs in the SDL\": never;\n};\ntype OutputCanBeNull = {\n \"defineScalar refuses this schema: its output can be null; nullability belongs in the SDL\": never;\n};\ntype OutputIsNotJson = {\n \"defineScalar refuses this schema: its output must be JSON\": never;\n};\ntype OutputFailsSchema = {\n \"defineScalar refuses this schema: its output must pass the schema again\": never;\n};\n\n// zod marks .default() and .prefault() with optin \"defaulted\" and .optional()\n// and .nullish() with optout \"optional\". z.coerce and z.preprocess take\n// `unknown`, which includes undefined, so for them only the markers count.\ntype TakesMissingValue<S extends z.ZodType> =\n S[\"_zod\"][\"optin\"] extends \"defaulted\"\n ? true\n : S[\"_zod\"][\"optout\"] extends \"optional\"\n ? true\n : unknown extends z.input<S>\n ? false\n : undefined extends z.input<S>\n ? true\n : false;\n\ntype CanonicalSchema<S extends z.ZodType> = 0 extends 1 & z.output<S>\n ? OutputIsAny\n : TakesMissingValue<S> extends true\n ? AcceptsMissingValue\n : z.output<S> extends Json\n ? null extends z.output<S>\n ? OutputCanBeNull\n : z.output<S> extends z.input<S>\n ? S\n : OutputFailsSchema\n : OutputIsNotJson;\n\ntype ScalarInput<TName extends string, S extends z.ZodType> = {\n name: TName;\n schema: S & CanonicalSchema<S>;\n description?: string;\n example?: NoInfer<z.input<S>>;\n};\n\nconst inputKeys = new Set([\"name\", \"schema\", \"description\", \"example\"]);\nconst graphqlBuiltIns: ReadonlySet<unknown> = new Set([\n \"Int\",\n \"Float\",\n \"String\",\n \"Boolean\",\n \"ID\",\n]);\nconst catalogNames: ReadonlySet<unknown> = new Set(\n scalarCatalog.map((definition) => definition.name),\n);\nconst graphqlName = /^[_A-Za-z][_0-9A-Za-z]*$/;\n\ntype Refusal = (\n input: Readonly<Record<string, unknown>> & { readonly schema: z.ZodType },\n) => string | undefined;\n\nconst refusals: readonly Refusal[] = [\n (input) => {\n const unknownKeys = Object.keys(input).filter((key) => !inputKeys.has(key));\n return unknownKeys.length > 0\n ? `unknown input key ${unknownKeys.join(\", \")}; defineScalar accepts only name, schema, description and example`\n : undefined;\n },\n ({ name }) =>\n typeof name !== \"string\" || !graphqlName.test(name) || name.startsWith(\"__\")\n ? \"the name is not a valid GraphQL name\"\n : undefined,\n ({ name }) =>\n graphqlBuiltIns.has(name)\n ? \"the name is a GraphQL built-in scalar\"\n : undefined,\n ({ name }) =>\n catalogNames.has(name) ? \"the name is a catalog scalar\" : undefined,\n ({ schema }) =>\n schema._zod.optin === \"defaulted\" || schema._zod.optout === \"optional\"\n ? \"the schema accepts a missing value; nullability belongs in the SDL\"\n : undefined,\n];\n\nexport function defineScalar<TName extends string, S extends z.ZodType>(\n input: ScalarInput<TName, S>,\n): ScalarDefinition<TName, z.output<S>> {\n for (const refusal of refusals) {\n const reason = refusal(input);\n if (reason !== undefined) {\n throw new Error(\n `Cannot define scalar \"${String(input.name)}\": ${reason}.`,\n );\n }\n }\n const { example, ...definition } = input;\n // TypeScript cannot relate a generic S to its own z.output<S>.\n const schema = input.schema as z.ZodType<z.output<S>>;\n const parsedExample =\n example === undefined ? undefined : schema.safeParse(example);\n if (parsedExample?.success === false) {\n throw new Error(\n `Cannot define scalar \"${input.name}\": the example fails the schema: ${z.prettifyError(parsedExample.error)}`,\n );\n }\n return defineCatalogScalar({\n ...definition,\n schema,\n ...(parsedExample && { example: parsedExample.data }),\n typescriptType: null,\n zodSource: null,\n });\n}\n"],"mappings":";;AAEA,MAAa,oBAAoB,OAAO,IAAI,8BAA8B;AAC1E,MAAa,4BAA4B;;AAmBzC,SAAgB,wBAAwB,OAAyB;CAC/D,OAAO,OAAO,UAAU,YACtB,UAAU,QACV,qBAAqB,QACnB,MAAM,qBACN,KAAA;AACN;AAEA,SAAgB,mBAAmB,OAA2C;CAC5E,OAAO,wBAAwB,KAAK,MAAA;AACtC;;;AC1BA,SAAgB,oBACd,OACiC;CACjC,OAAO,OAAO,OAAO;EACnB,GAAG;GACF,oBAAA;CACH,CAA2C;AAC7C;;;ACVA,MAAa,gBAAgB,oBAAoB;CAC/C,MAAM;CACN,gBAAgB;CAChB,WAAW;CACX,QAAQ,EAAE,QAAQ;AACpB,CAAC;;;ACLD,MAAa,iBAAiB,oBAAoB;CAChD,SAAS;CACT,MAAM;CACN,gBAAgB;CAChB,WAAW;CACX,QAAQ,EAAE,IAAI,SAAS;AACzB,CAAC;;;ACTD,SAAgB,qBAAqB,SAAiB,OAAyB;CAC7E,OAAO,QAAQ,MAAM,QAAQ,KAAK,KAAK,OAAO,GAAG,KAAA,GAAW,CAAC,KAAK,CAAC,MAAM;AAC3E;;;ACEA,MAAa,gBAAgB,oBAAoB;CAC/C,SAAS;CACT,MAAM;CACN,gBAAgB;CAChB,WACE;CACF,QAAQ,EAAE,QAAiC,QACzC,qBAAqB,oCAAoC,GAAG,CAC9D;AACF,CAAC;;;ACTD,MAAa,sBAAsB,oBAAoB;CACrD,SACE;CACF,MAAM;CACN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,MAAM,IAAI,MACR,yBAAyB,MAAM,KAAK,mCAAmC,EAAE,cAAc,cAAc,KAAK,GAC5G;CAEF,OAAO,oBAAoB;EACzB,GAAG;EACH;EACA,GAAI,iBAAiB,EAAE,SAAS,cAAc,KAAK;EACnD,gBAAgB;EAChB,WAAW;CACb,CAAC;AACH"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "document-model",
|
|
3
|
-
"version": "6.2.3-dev.
|
|
3
|
+
"version": "6.2.3-dev.80",
|
|
4
4
|
"license": "AGPL-3.0-only",
|
|
5
5
|
"private": false,
|
|
6
6
|
"files": [
|
|
@@ -13,6 +13,11 @@
|
|
|
13
13
|
},
|
|
14
14
|
"type": "module",
|
|
15
15
|
"exports": {
|
|
16
|
+
"./scalars": {
|
|
17
|
+
"source": "./scalars.ts",
|
|
18
|
+
"import": "./dist/scalars.js",
|
|
19
|
+
"types": "./dist/scalars.d.ts"
|
|
20
|
+
},
|
|
16
21
|
".": {
|
|
17
22
|
"source": "./index.ts",
|
|
18
23
|
"import": "./dist/index.js",
|
|
@@ -48,11 +53,11 @@
|
|
|
48
53
|
"mutative": "^1.0.5",
|
|
49
54
|
"tsdown": "0.23.0",
|
|
50
55
|
"tsx": "4.23.13",
|
|
51
|
-
"vitest": "5.0.3"
|
|
52
|
-
"zod": "^4.5.4"
|
|
56
|
+
"vitest": "5.0.3"
|
|
53
57
|
},
|
|
54
58
|
"dependencies": {
|
|
55
|
-
"@powerhousedao/shared": "6.2.3-dev.
|
|
59
|
+
"@powerhousedao/shared": "6.2.3-dev.80",
|
|
60
|
+
"zod": "^4.5.4"
|
|
56
61
|
},
|
|
57
62
|
"description": "Powerhouse document model — foundational data structure for local-first, event-sourced documents with typed operations, reducers, and GraphQL schema validation.",
|
|
58
63
|
"keywords": [
|