@tryghost/metafield-types 0.1.2 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +66 -0
- package/README.md +31 -22
- package/build/identity.d.ts +47 -25
- package/build/identity.d.ts.map +1 -1
- package/build/identity.js +52 -29
- package/build/identity.js.map +1 -1
- package/build/index.d.ts +278 -61
- package/build/index.d.ts.map +1 -1
- package/build/index.js +273 -96
- package/build/index.js.map +1 -1
- package/build/structure.d.ts +247 -59
- package/build/structure.d.ts.map +1 -1
- package/build/structure.js +158 -59
- package/build/structure.js.map +1 -1
- package/package.json +2 -2
package/build/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { type FieldType } from './structure.js';
|
|
3
|
-
export {
|
|
2
|
+
import { type FieldType, type FieldShape, type TypedSettings, type ValueOf } from './structure.js';
|
|
3
|
+
export { FIELD_STRUCTURES, FIELD_TYPE_IDS, LIST_SOURCES, MAX_OPTIONS, MIN_OPTIONS, OPTION_SEPARATOR, TEXT_SIZES, choice, country, editableAnswers, inOptionOrder, isFieldType, isRecordValue, matchField, matchLeaf, matchShape, partsOf, text, type ChoiceLeaf, type FieldHandlers, type FieldOfShape, type FieldShape, type FieldStructure, type FieldType, type FieldTypeOfShape, type Leaf, type LeafHandlers, type LeafKind, type ListSource, type PartsOf, type RecordStructure, type ScalarStructure, type SetSettings, type SetStructure, type SettingsOf, type ShapeHandlers, type ShapeOf, type StructureOf, type TextLeaf, type TextSize, type TypedSettings, type ValueOf, } from './structure.js';
|
|
4
4
|
/**
|
|
5
5
|
* The shared catalog of member metafield types.
|
|
6
6
|
*
|
|
@@ -10,10 +10,9 @@ export { FIELD_KINDS, FIELD_PARTS, FIELD_TYPE_IDS, PART_TYPE_IDS, partTypesOf, s
|
|
|
10
10
|
* last statement lives here and nowhere else, so that Ghost core, which enforces it, and
|
|
11
11
|
* admin, which gives instant feedback against it, cannot disagree about what is valid.
|
|
12
12
|
*
|
|
13
|
-
* A type is
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* part being a record itself.
|
|
13
|
+
* A type is composed of leaves, each one value with its own rule. Most types are a single
|
|
14
|
+
* leaf. An address is a *record*: a set of named parts, each a leaf, from which the whole
|
|
15
|
+
* type's rule is derived. A part is always a leaf, never a record itself.
|
|
17
16
|
*
|
|
18
17
|
* ## What a write may say
|
|
19
18
|
*
|
|
@@ -51,12 +50,13 @@ export { FIELD_KINDS, FIELD_PARTS, FIELD_TYPE_IDS, PART_TYPE_IDS, partTypesOf, s
|
|
|
51
50
|
* answer and a disagreement between them is a file that silently stops round-tripping.
|
|
52
51
|
*
|
|
53
52
|
* The line is whether more than one renderer must agree on a string, not presentation
|
|
54
|
-
* against validity — the sentences above are presentation. Admin
|
|
55
|
-
*
|
|
56
|
-
*
|
|
53
|
+
* against validity — the sentences above are presentation. Admin and Portal each label a
|
|
54
|
+
* record's parts in their own words, and each is held against the catalog by a type, so a
|
|
55
|
+
* part added there fails to compile in both until it has a label.
|
|
57
56
|
*/
|
|
58
57
|
export declare const FieldTypeSchema: z.ZodEnum<{
|
|
59
58
|
address: "address";
|
|
59
|
+
list: "list";
|
|
60
60
|
long_text: "long_text";
|
|
61
61
|
short_text: "short_text";
|
|
62
62
|
}>;
|
|
@@ -81,6 +81,267 @@ export declare const MEMBER_ACCESS: {
|
|
|
81
81
|
readonly read: 'read';
|
|
82
82
|
readonly write: 'write';
|
|
83
83
|
};
|
|
84
|
+
/**
|
|
85
|
+
* Whether a field is in use. An archived field keeps its definition and the values members
|
|
86
|
+
* hold for it, so it can be restored, but it takes no new values and members no longer see it.
|
|
87
|
+
*/
|
|
88
|
+
export declare const FIELD_STATUSES: readonly ['active', 'archived'];
|
|
89
|
+
export type FieldStatus = (typeof FIELD_STATUSES)[number];
|
|
90
|
+
export declare const FieldStatusSchema: z.ZodEnum<{
|
|
91
|
+
active: "active";
|
|
92
|
+
archived: "archived";
|
|
93
|
+
}>;
|
|
94
|
+
export declare const FIELD_STATUS: {
|
|
95
|
+
readonly active: 'active';
|
|
96
|
+
readonly archived: 'archived';
|
|
97
|
+
};
|
|
98
|
+
/**
|
|
99
|
+
* A set field's settings as stored or sent back: their shape alone, which every read checks. A
|
|
100
|
+
* write checks the rules `SetSettingsSchema` layers on top, so a rule tightened later never hides
|
|
101
|
+
* a field set up under the old one, the way a value's rule never hides what a member already holds.
|
|
102
|
+
*/
|
|
103
|
+
export declare const SetSettingsShape: z.ZodObject<{
|
|
104
|
+
options: z.ZodArray<z.ZodString>;
|
|
105
|
+
multiple: z.ZodBoolean;
|
|
106
|
+
}, z.core.$strip>;
|
|
107
|
+
/**
|
|
108
|
+
* What a set field is set up with: its shape, with each option's text tidied and the rules a write
|
|
109
|
+
* must meet on top. Options are a set as well, so the same text can't be offered twice; they are
|
|
110
|
+
* listed in the order they are shown.
|
|
111
|
+
*/
|
|
112
|
+
export declare const SetSettingsSchema: z.ZodPipe<z.ZodObject<{
|
|
113
|
+
options: z.ZodArray<z.ZodString>;
|
|
114
|
+
multiple: z.ZodBoolean;
|
|
115
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
116
|
+
options: string[];
|
|
117
|
+
multiple: boolean;
|
|
118
|
+
}, {
|
|
119
|
+
options: string[];
|
|
120
|
+
multiple: boolean;
|
|
121
|
+
}>>;
|
|
122
|
+
/**
|
|
123
|
+
* What a field holds beside its type, `base`, with its type and the settings that type's shape
|
|
124
|
+
* takes, held as `settings` says for each shape: a set's options, and nothing for any other shape.
|
|
125
|
+
* One variant per shape, so a field's settings are always read against its type. Writes give the
|
|
126
|
+
* rules, reads the shape alone, and Ghost's table its column.
|
|
127
|
+
*/
|
|
128
|
+
export declare const withTypedSettings: <Base extends z.ZodRawShape, ForScalar extends z.ZodType, ForRecord extends z.ZodType, ForSet extends z.ZodType>(base: Base, settings: {
|
|
129
|
+
scalar: ForScalar;
|
|
130
|
+
record: ForRecord;
|
|
131
|
+
set: ForSet;
|
|
132
|
+
} & { [S in FieldShape]: z.ZodType; }) => z.ZodDiscriminatedUnion<[z.ZodObject<Base & {
|
|
133
|
+
type: z.ZodEnum<{
|
|
134
|
+
long_text: "long_text";
|
|
135
|
+
short_text: "short_text";
|
|
136
|
+
}>;
|
|
137
|
+
settings: ForScalar & z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
|
|
138
|
+
} extends infer T ? { -readonly [P in keyof T]: T[P]; } : never, z.core.$strip>, z.ZodObject<Base & {
|
|
139
|
+
type: z.ZodEnum<{
|
|
140
|
+
address: "address";
|
|
141
|
+
}>;
|
|
142
|
+
settings: ForRecord & z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
|
|
143
|
+
} extends infer T_1 ? { -readonly [P in keyof T_1]: T_1[P]; } : never, z.core.$strip>, z.ZodObject<Base & {
|
|
144
|
+
type: z.ZodEnum<{
|
|
145
|
+
list: "list";
|
|
146
|
+
}>;
|
|
147
|
+
settings: ForSet & z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
|
|
148
|
+
} extends infer T_2 ? { -readonly [P in keyof T_2]: T_2[P]; } : never, z.core.$strip>], "type">;
|
|
149
|
+
/**
|
|
150
|
+
* Each shape's settings in one place: a set's options and whether a member picks several, and
|
|
151
|
+
* nothing for any other shape. A list's defaults have no options, which a list's write rules
|
|
152
|
+
* refuse, so an edit of a list read with its defaults always writes the settings it is given.
|
|
153
|
+
* Keyed by shape, so a shape added to the catalog fails to compile until it has an entry.
|
|
154
|
+
*/
|
|
155
|
+
export declare const SHAPE_SETTINGS: {
|
|
156
|
+
scalar: {
|
|
157
|
+
written: z.ZodOptional<z.ZodUndefined>;
|
|
158
|
+
read: z.ZodOptional<z.ZodUndefined>;
|
|
159
|
+
defaults: undefined;
|
|
160
|
+
};
|
|
161
|
+
record: {
|
|
162
|
+
written: z.ZodOptional<z.ZodUndefined>;
|
|
163
|
+
read: z.ZodOptional<z.ZodUndefined>;
|
|
164
|
+
defaults: undefined;
|
|
165
|
+
};
|
|
166
|
+
set: {
|
|
167
|
+
written: z.ZodPipe<z.ZodObject<{
|
|
168
|
+
options: z.ZodArray<z.ZodString>;
|
|
169
|
+
multiple: z.ZodBoolean;
|
|
170
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
171
|
+
options: string[];
|
|
172
|
+
multiple: boolean;
|
|
173
|
+
}, {
|
|
174
|
+
options: string[];
|
|
175
|
+
multiple: boolean;
|
|
176
|
+
}>>;
|
|
177
|
+
read: z.ZodObject<{
|
|
178
|
+
options: z.ZodArray<z.ZodString>;
|
|
179
|
+
multiple: z.ZodBoolean;
|
|
180
|
+
}, z.core.$strip>;
|
|
181
|
+
defaults: {
|
|
182
|
+
options: never[];
|
|
183
|
+
multiple: false;
|
|
184
|
+
};
|
|
185
|
+
};
|
|
186
|
+
};
|
|
187
|
+
/** Each shape's settings as a write states them, checked against the rules. */
|
|
188
|
+
export declare const WRITTEN_SETTINGS: {
|
|
189
|
+
scalar: z.ZodOptional<z.ZodUndefined>;
|
|
190
|
+
record: z.ZodOptional<z.ZodUndefined>;
|
|
191
|
+
set: z.ZodPipe<z.ZodObject<{
|
|
192
|
+
options: z.ZodArray<z.ZodString>;
|
|
193
|
+
multiple: z.ZodBoolean;
|
|
194
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
195
|
+
options: string[];
|
|
196
|
+
multiple: boolean;
|
|
197
|
+
}, {
|
|
198
|
+
options: string[];
|
|
199
|
+
multiple: boolean;
|
|
200
|
+
}>>;
|
|
201
|
+
};
|
|
202
|
+
/** Each shape's settings as they are read back, checked for their shape alone. */
|
|
203
|
+
export declare const READ_SETTINGS: {
|
|
204
|
+
scalar: z.ZodOptional<z.ZodUndefined>;
|
|
205
|
+
record: z.ZodOptional<z.ZodUndefined>;
|
|
206
|
+
set: z.ZodObject<{
|
|
207
|
+
options: z.ZodArray<z.ZodString>;
|
|
208
|
+
multiple: z.ZodBoolean;
|
|
209
|
+
}, z.core.$strip>;
|
|
210
|
+
};
|
|
211
|
+
/**
|
|
212
|
+
* Where a refusal points within what was sent: the path to the refused value, with its parts and
|
|
213
|
+
* positions joined by dots, such as `settings.options.2` for a field's third option. Ghost names
|
|
214
|
+
* a refusal's `property` this way, and a form files the problems it finds under the same keys, so
|
|
215
|
+
* each lands beside the input that set the value.
|
|
216
|
+
*/
|
|
217
|
+
export declare function refusedProperty(path: readonly PropertyKey[]): string;
|
|
218
|
+
/**
|
|
219
|
+
* A field's type and settings as a write states them, checked together and against the rules:
|
|
220
|
+
* the settings must be what that type is set up with, so a list carries its options and
|
|
221
|
+
* nothing else carries any.
|
|
222
|
+
*/
|
|
223
|
+
export declare const TypedSettingsInputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
224
|
+
type: z.ZodEnum<{
|
|
225
|
+
long_text: "long_text";
|
|
226
|
+
short_text: "short_text";
|
|
227
|
+
}>;
|
|
228
|
+
settings: z.ZodOptional<z.ZodUndefined> & z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
|
|
229
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
230
|
+
type: z.ZodEnum<{
|
|
231
|
+
address: "address";
|
|
232
|
+
}>;
|
|
233
|
+
settings: z.ZodOptional<z.ZodUndefined> & z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
|
|
234
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
235
|
+
type: z.ZodEnum<{
|
|
236
|
+
list: "list";
|
|
237
|
+
}>;
|
|
238
|
+
settings: z.ZodPipe<z.ZodObject<{
|
|
239
|
+
options: z.ZodArray<z.ZodString>;
|
|
240
|
+
multiple: z.ZodBoolean;
|
|
241
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
242
|
+
options: string[];
|
|
243
|
+
multiple: boolean;
|
|
244
|
+
}, {
|
|
245
|
+
options: string[];
|
|
246
|
+
multiple: boolean;
|
|
247
|
+
}>> & z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
|
|
248
|
+
}, z.core.$strip>], "type">;
|
|
249
|
+
/** A field's type and settings as they are read back: paired, but checked for their shape alone. */
|
|
250
|
+
export declare const TypedSettingsSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
251
|
+
type: z.ZodEnum<{
|
|
252
|
+
long_text: "long_text";
|
|
253
|
+
short_text: "short_text";
|
|
254
|
+
}>;
|
|
255
|
+
settings: z.ZodOptional<z.ZodUndefined> & z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
|
|
256
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
257
|
+
type: z.ZodEnum<{
|
|
258
|
+
address: "address";
|
|
259
|
+
}>;
|
|
260
|
+
settings: z.ZodOptional<z.ZodUndefined> & z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
|
|
261
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
262
|
+
type: z.ZodEnum<{
|
|
263
|
+
list: "list";
|
|
264
|
+
}>;
|
|
265
|
+
settings: z.ZodObject<{
|
|
266
|
+
options: z.ZodArray<z.ZodString>;
|
|
267
|
+
multiple: z.ZodBoolean;
|
|
268
|
+
}, z.core.$strip> & z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
|
|
269
|
+
}, z.core.$strip>], "type">;
|
|
270
|
+
/**
|
|
271
|
+
* A field definition as the Admin and Members APIs return it. Ghost writes every definition through
|
|
272
|
+
* this and Admin reads every one through it, so both ends are checked against one shape. Portal
|
|
273
|
+
* uses the type without the check, because zod would add to every page view on every site. Dates
|
|
274
|
+
* are ISO strings, as JSON carries them.
|
|
275
|
+
*/
|
|
276
|
+
export declare const MetafieldDefinitionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
277
|
+
type: z.ZodEnum<{
|
|
278
|
+
long_text: "long_text";
|
|
279
|
+
short_text: "short_text";
|
|
280
|
+
}>;
|
|
281
|
+
settings: z.ZodOptional<z.ZodUndefined> & z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
|
|
282
|
+
namespace: z.core.$ZodBranded<import("zod/mini").ZodMiniString<string>, "Namespace", "out">;
|
|
283
|
+
key: z.core.$ZodBranded<import("zod/mini").ZodMiniString<string>, "Key", "out">;
|
|
284
|
+
name: z.ZodString;
|
|
285
|
+
status: z.ZodEnum<{
|
|
286
|
+
active: "active";
|
|
287
|
+
archived: "archived";
|
|
288
|
+
}>;
|
|
289
|
+
access: z.ZodObject<{
|
|
290
|
+
member: z.ZodEnum<{
|
|
291
|
+
none: "none";
|
|
292
|
+
read: "read";
|
|
293
|
+
write: "write";
|
|
294
|
+
}>;
|
|
295
|
+
}, z.core.$strip>;
|
|
296
|
+
created_at: z.ZodISODateTime;
|
|
297
|
+
updated_at: z.ZodNullable<z.ZodISODateTime>;
|
|
298
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
299
|
+
type: z.ZodEnum<{
|
|
300
|
+
address: "address";
|
|
301
|
+
}>;
|
|
302
|
+
settings: z.ZodOptional<z.ZodUndefined> & z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
|
|
303
|
+
namespace: z.core.$ZodBranded<import("zod/mini").ZodMiniString<string>, "Namespace", "out">;
|
|
304
|
+
key: z.core.$ZodBranded<import("zod/mini").ZodMiniString<string>, "Key", "out">;
|
|
305
|
+
name: z.ZodString;
|
|
306
|
+
status: z.ZodEnum<{
|
|
307
|
+
active: "active";
|
|
308
|
+
archived: "archived";
|
|
309
|
+
}>;
|
|
310
|
+
access: z.ZodObject<{
|
|
311
|
+
member: z.ZodEnum<{
|
|
312
|
+
none: "none";
|
|
313
|
+
read: "read";
|
|
314
|
+
write: "write";
|
|
315
|
+
}>;
|
|
316
|
+
}, z.core.$strip>;
|
|
317
|
+
created_at: z.ZodISODateTime;
|
|
318
|
+
updated_at: z.ZodNullable<z.ZodISODateTime>;
|
|
319
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
320
|
+
type: z.ZodEnum<{
|
|
321
|
+
list: "list";
|
|
322
|
+
}>;
|
|
323
|
+
settings: z.ZodObject<{
|
|
324
|
+
options: z.ZodArray<z.ZodString>;
|
|
325
|
+
multiple: z.ZodBoolean;
|
|
326
|
+
}, z.core.$strip> & z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
|
|
327
|
+
namespace: z.core.$ZodBranded<import("zod/mini").ZodMiniString<string>, "Namespace", "out">;
|
|
328
|
+
key: z.core.$ZodBranded<import("zod/mini").ZodMiniString<string>, "Key", "out">;
|
|
329
|
+
name: z.ZodString;
|
|
330
|
+
status: z.ZodEnum<{
|
|
331
|
+
active: "active";
|
|
332
|
+
archived: "archived";
|
|
333
|
+
}>;
|
|
334
|
+
access: z.ZodObject<{
|
|
335
|
+
member: z.ZodEnum<{
|
|
336
|
+
none: "none";
|
|
337
|
+
read: "read";
|
|
338
|
+
write: "write";
|
|
339
|
+
}>;
|
|
340
|
+
}, z.core.$strip>;
|
|
341
|
+
created_at: z.ZodISODateTime;
|
|
342
|
+
updated_at: z.ZodNullable<z.ZodISODateTime>;
|
|
343
|
+
}, z.core.$strip>], "type">;
|
|
344
|
+
export type MetafieldDefinition = z.output<typeof MetafieldDefinitionSchema>;
|
|
84
345
|
/**
|
|
85
346
|
* Where a change to a member's values was made, as a member's activity feed names it.
|
|
86
347
|
* Shared so a place added on the server is one Admin has to be told how to describe.
|
|
@@ -117,59 +378,15 @@ export interface MetafieldChangeEntry<TDate = string> {
|
|
|
117
378
|
*/
|
|
118
379
|
export declare const MAX_LONG_TEXT_BYTES = 65535;
|
|
119
380
|
/**
|
|
120
|
-
*
|
|
121
|
-
* code and a postal code both store short text, but they are different things — the
|
|
122
|
-
* part's type is what a control or a filter dispatches on, the way a field's own type
|
|
123
|
-
* is for a scalar.
|
|
381
|
+
* A value of any field type, as a caller holding a field of unknown type must accept it.
|
|
124
382
|
*/
|
|
125
|
-
export
|
|
126
|
-
|
|
127
|
-
postal_code: z.ZodString;
|
|
128
|
-
country_code: z.ZodString;
|
|
129
|
-
};
|
|
130
|
-
export interface FieldTypeDefinition {
|
|
131
|
-
/** What kind of value this is, for anything that has to compare one. */
|
|
132
|
-
kind: import('./structure.js').FieldKind;
|
|
133
|
-
value: z.ZodType;
|
|
134
|
-
}
|
|
135
|
-
export declare const FIELD_TYPES: {
|
|
136
|
-
short_text: {
|
|
137
|
-
kind: "text";
|
|
138
|
-
value: z.ZodString;
|
|
139
|
-
};
|
|
140
|
-
long_text: {
|
|
141
|
-
kind: "text";
|
|
142
|
-
value: z.ZodString;
|
|
143
|
-
};
|
|
144
|
-
address: {
|
|
145
|
-
kind: 'record';
|
|
146
|
-
value: z.ZodObject<{
|
|
147
|
-
line1: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodUnion<readonly [z.ZodLiteral<"">, z.ZodString]>>>;
|
|
148
|
-
line2: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodUnion<readonly [z.ZodLiteral<"">, z.ZodString]>>>;
|
|
149
|
-
city: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodUnion<readonly [z.ZodLiteral<"">, z.ZodString]>>>;
|
|
150
|
-
state: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodUnion<readonly [z.ZodLiteral<"">, z.ZodString]>>>;
|
|
151
|
-
postal_code: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodUnion<readonly [z.ZodLiteral<"">, z.ZodString]>>>;
|
|
152
|
-
country: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodUnion<readonly [z.ZodLiteral<"">, z.ZodString]>>>;
|
|
153
|
-
}, z.core.$strict>;
|
|
154
|
-
};
|
|
155
|
-
};
|
|
156
|
-
/** Named for the admin types built on it, which speak of an address rather than a record. */
|
|
157
|
-
export declare const AddressValue: z.ZodObject<{
|
|
158
|
-
line1: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodUnion<readonly [z.ZodLiteral<"">, z.ZodString]>>>;
|
|
159
|
-
line2: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodUnion<readonly [z.ZodLiteral<"">, z.ZodString]>>>;
|
|
160
|
-
city: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodUnion<readonly [z.ZodLiteral<"">, z.ZodString]>>>;
|
|
161
|
-
state: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodUnion<readonly [z.ZodLiteral<"">, z.ZodString]>>>;
|
|
162
|
-
postal_code: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodUnion<readonly [z.ZodLiteral<"">, z.ZodString]>>>;
|
|
163
|
-
country: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodUnion<readonly [z.ZodLiteral<"">, z.ZodString]>>>;
|
|
164
|
-
}, z.core.$strict>;
|
|
165
|
-
export type Address = z.infer<typeof AddressValue>;
|
|
383
|
+
export type FieldValue = ValueOf<FieldType>;
|
|
384
|
+
export type Address = ValueOf<'address'>;
|
|
166
385
|
/**
|
|
167
|
-
*
|
|
168
|
-
*
|
|
169
|
-
*
|
|
170
|
-
*
|
|
386
|
+
* The rule a value of one field must satisfy. It takes the field rather than its type so that a
|
|
387
|
+
* rule depending on the field's own setup, such as the options a list field offers, changes here
|
|
388
|
+
* and nowhere else; such a rule is built from the field rather than kept per type. Throws for a
|
|
389
|
+
* type this build doesn't know.
|
|
171
390
|
*/
|
|
172
|
-
export
|
|
173
|
-
[T in FieldType]: z.infer<(typeof FIELD_TYPES)[T]['value']>;
|
|
174
|
-
}[FieldType];
|
|
391
|
+
export declare function valueSchemaFor(field: TypedSettings): z.ZodType<FieldValue>;
|
|
175
392
|
//# sourceMappingURL=index.d.ts.map
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","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