@postxl/schema 1.1.0 → 1.2.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/dist/enum/enum.brands.d.ts +6 -6
- package/dist/enum/enum.brands.js +6 -3
- package/dist/enum/enum.d.ts +10 -34
- package/dist/enum/enum.defaults.d.ts +9 -9
- package/dist/enum/enum.json-decoder.d.ts +8 -44
- package/dist/enum/enum.json-decoder.js +9 -6
- package/dist/enum/enum.transformer.d.ts +4 -4
- package/dist/field/defaults.d.ts +5 -5
- package/dist/field/discriminated-union.d.ts +13 -49
- package/dist/field/enum.d.ts +9 -27
- package/dist/field/field.d.ts +80 -300
- package/dist/field/id.d.ts +22 -62
- package/dist/field/relation.d.ts +10 -32
- package/dist/field/relation.js +4 -2
- package/dist/field/scalar.d.ts +13 -77
- package/dist/field/shared/brands.d.ts +24 -24
- package/dist/field/shared/brands.js +28 -10
- package/dist/field/shared/decoders.d.ts +4 -4
- package/dist/field/shared/decoders.js +8 -6
- package/dist/field/shared/seed.d.ts +2 -8
- package/dist/model/model.brands.d.ts +4 -4
- package/dist/model/model.defaults.d.ts +10 -10
- package/dist/model/model.json-decoder.d.ts +10 -80
- package/dist/model/model.json-decoder.js +13 -10
- package/dist/model/model.transformer.d.ts +32 -30
- package/dist/project-schema/project-schema.brands.d.ts +6 -6
- package/dist/project-schema/project-schema.brands.js +6 -1
- package/dist/project-schema/project-schema.defaults.d.ts +2 -2
- package/dist/project-schema/project-schema.json-decoder.d.ts +19 -222
- package/dist/project-schema/project-schema.json-decoder.js +10 -8
- package/dist/project-schema/project-schema.transformer.d.ts +30 -189
- package/dist/samples/portfolex.schema.json +441 -0
- package/dist/samples/sample-schemas.d.ts +463 -0
- package/dist/samples/sample-schemas.js +4 -0
- package/dist/samples/steerex.schema.json +4679 -0
- package/package.json +2 -2
package/dist/field/id.d.ts
CHANGED
|
@@ -44,73 +44,33 @@ export type IdGenerationType =
|
|
|
44
44
|
*/
|
|
45
45
|
export declare const zFieldIdJSON: z.ZodObject<{
|
|
46
46
|
name: z.ZodLiteral<"id">;
|
|
47
|
-
type: z.ZodUnion<[z.ZodLiteral<"String">, z.ZodLiteral<"Int">]>;
|
|
47
|
+
type: z.ZodUnion<readonly [z.ZodLiteral<"String">, z.ZodLiteral<"Int">]>;
|
|
48
48
|
databaseName: z.ZodOptional<z.ZodString>;
|
|
49
|
-
excelName: z.
|
|
49
|
+
excelName: z.ZodOptional<z.ZodString>;
|
|
50
50
|
label: z.ZodOptional<z.ZodString>;
|
|
51
51
|
description: z.ZodOptional<z.ZodString>;
|
|
52
52
|
isReadonly: z.ZodOptional<z.ZodBoolean>;
|
|
53
53
|
faker: z.ZodOptional<z.ZodString>;
|
|
54
|
-
seed: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodDate]>, z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodDate]
|
|
55
|
-
},
|
|
56
|
-
type: "String" | "Int";
|
|
57
|
-
name: "id";
|
|
58
|
-
description?: string | undefined;
|
|
59
|
-
databaseName?: string | undefined;
|
|
60
|
-
excelName?: string | undefined;
|
|
61
|
-
label?: string | undefined;
|
|
62
|
-
isReadonly?: boolean | undefined;
|
|
63
|
-
faker?: string | undefined;
|
|
64
|
-
seed?: string | number | boolean | Date | (string | number | boolean | Date)[] | undefined;
|
|
65
|
-
}, {
|
|
66
|
-
type: "String" | "Int";
|
|
67
|
-
name: "id";
|
|
68
|
-
description?: string | undefined;
|
|
69
|
-
databaseName?: string | undefined;
|
|
70
|
-
excelName?: string | undefined;
|
|
71
|
-
label?: string | undefined;
|
|
72
|
-
isReadonly?: boolean | undefined;
|
|
73
|
-
faker?: string | undefined;
|
|
74
|
-
seed?: string | number | boolean | Date | (string | number | boolean | Date)[] | undefined;
|
|
75
|
-
}>;
|
|
54
|
+
seed: z.ZodOptional<z.ZodUnion<[z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodDate]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodDate]>>]>>;
|
|
55
|
+
}, z.core.$strip>;
|
|
76
56
|
export type FieldIdJSON = z.infer<typeof zFieldIdJSON>;
|
|
77
|
-
export declare const zFieldId: z.
|
|
57
|
+
export declare const zFieldId: z.ZodPipe<z.ZodObject<{
|
|
78
58
|
name: z.ZodLiteral<"id">;
|
|
79
|
-
type: z.ZodUnion<[z.ZodLiteral<"String">, z.ZodLiteral<"Int">]>;
|
|
59
|
+
type: z.ZodUnion<readonly [z.ZodLiteral<"String">, z.ZodLiteral<"Int">]>;
|
|
80
60
|
databaseName: z.ZodOptional<z.ZodString>;
|
|
81
|
-
excelName: z.
|
|
61
|
+
excelName: z.ZodOptional<z.ZodString>;
|
|
82
62
|
label: z.ZodOptional<z.ZodString>;
|
|
83
63
|
description: z.ZodOptional<z.ZodString>;
|
|
84
64
|
isReadonly: z.ZodOptional<z.ZodBoolean>;
|
|
85
65
|
faker: z.ZodOptional<z.ZodString>;
|
|
86
|
-
seed: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodDate]>, z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodDate]
|
|
87
|
-
},
|
|
88
|
-
type: "String" | "Int";
|
|
89
|
-
name: "id";
|
|
90
|
-
description?: string | undefined;
|
|
91
|
-
databaseName?: string | undefined;
|
|
92
|
-
excelName?: string | undefined;
|
|
93
|
-
label?: string | undefined;
|
|
94
|
-
isReadonly?: boolean | undefined;
|
|
95
|
-
faker?: string | undefined;
|
|
96
|
-
seed?: string | number | boolean | Date | (string | number | boolean | Date)[] | undefined;
|
|
97
|
-
}, {
|
|
98
|
-
type: "String" | "Int";
|
|
99
|
-
name: "id";
|
|
100
|
-
description?: string | undefined;
|
|
101
|
-
databaseName?: string | undefined;
|
|
102
|
-
excelName?: string | undefined;
|
|
103
|
-
label?: string | undefined;
|
|
104
|
-
isReadonly?: boolean | undefined;
|
|
105
|
-
faker?: string | undefined;
|
|
106
|
-
seed?: string | number | boolean | Date | (string | number | boolean | Date)[] | undefined;
|
|
107
|
-
}>, {
|
|
66
|
+
seed: z.ZodOptional<z.ZodUnion<[z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodDate]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodDate]>>]>>;
|
|
67
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
108
68
|
kind: "id";
|
|
109
|
-
name: "id" & z.
|
|
110
|
-
unbrandedTypeName: (
|
|
111
|
-
databaseType: ("BigInt" | "String" | "Boolean" | "DateTime" | "Decimal" | "Float" | "Int" | "Json" | "Bytes"
|
|
112
|
-
databaseName: string & z.
|
|
113
|
-
excelName: string & z.
|
|
69
|
+
name: "id" & z.core.$brand<"PXL.FieldName"> & z.core.$brand<"PXL.FieldName.Id">;
|
|
70
|
+
unbrandedTypeName: ("string" & z.core.$brand<"PXL.ScalarIdType"> & z.core.$brand<"PXL.ScalarType"> & z.core.$brand<"PXL.Type">) | ("number" & z.core.$brand<"PXL.ScalarIdType"> & z.core.$brand<"PXL.ScalarType"> & z.core.$brand<"PXL.Type">);
|
|
71
|
+
databaseType: ("BigInt" & z.core.$brand<"PXL.DatabaseFieldType">) | ("String" & z.core.$brand<"PXL.DatabaseFieldType">) | ("Boolean" & z.core.$brand<"PXL.DatabaseFieldType">) | ("DateTime" & z.core.$brand<"PXL.DatabaseFieldType">) | ("Decimal" & z.core.$brand<"PXL.DatabaseFieldType">) | ("Float" & z.core.$brand<"PXL.DatabaseFieldType">) | ("Int" & z.core.$brand<"PXL.DatabaseFieldType">) | ("Json" & z.core.$brand<"PXL.DatabaseFieldType">) | ("Bytes" & z.core.$brand<"PXL.DatabaseFieldType">);
|
|
72
|
+
databaseName: string & z.core.$brand<"PXL.DatabaseFieldName">;
|
|
73
|
+
excelName: string & z.core.$brand<"PXL.ExcelColumnName">;
|
|
114
74
|
description: string;
|
|
115
75
|
label: string;
|
|
116
76
|
hasIndex: true;
|
|
@@ -121,23 +81,23 @@ export declare const zFieldId: z.ZodEffects<z.ZodObject<{
|
|
|
121
81
|
isUpdatedAt: false;
|
|
122
82
|
seed: FieldSeedConfig;
|
|
123
83
|
}, {
|
|
124
|
-
type: "String" | "Int";
|
|
125
84
|
name: "id";
|
|
126
|
-
|
|
85
|
+
type: "String" | "Int";
|
|
127
86
|
databaseName?: string | undefined;
|
|
128
87
|
excelName?: string | undefined;
|
|
129
88
|
label?: string | undefined;
|
|
89
|
+
description?: string | undefined;
|
|
130
90
|
isReadonly?: boolean | undefined;
|
|
131
91
|
faker?: string | undefined;
|
|
132
92
|
seed?: string | number | boolean | Date | (string | number | boolean | Date)[] | undefined;
|
|
133
|
-
}
|
|
93
|
+
}>>;
|
|
134
94
|
export declare function fieldIdJSONTransformer(fieldInput: FieldIdJSON, ctx: z.RefinementCtx): {
|
|
135
95
|
kind: "id";
|
|
136
|
-
name: "id" & z.
|
|
137
|
-
unbrandedTypeName: (
|
|
138
|
-
databaseType: ("BigInt" | "String" | "Boolean" | "DateTime" | "Decimal" | "Float" | "Int" | "Json" | "Bytes"
|
|
139
|
-
databaseName: string & z.
|
|
140
|
-
excelName: string & z.
|
|
96
|
+
name: "id" & z.core.$brand<"PXL.FieldName"> & z.core.$brand<"PXL.FieldName.Id">;
|
|
97
|
+
unbrandedTypeName: ("string" & z.core.$brand<"PXL.ScalarIdType"> & z.core.$brand<"PXL.ScalarType"> & z.core.$brand<"PXL.Type">) | ("number" & z.core.$brand<"PXL.ScalarIdType"> & z.core.$brand<"PXL.ScalarType"> & z.core.$brand<"PXL.Type">);
|
|
98
|
+
databaseType: ("BigInt" & z.core.$brand<"PXL.DatabaseFieldType">) | ("String" & z.core.$brand<"PXL.DatabaseFieldType">) | ("Boolean" & z.core.$brand<"PXL.DatabaseFieldType">) | ("DateTime" & z.core.$brand<"PXL.DatabaseFieldType">) | ("Decimal" & z.core.$brand<"PXL.DatabaseFieldType">) | ("Float" & z.core.$brand<"PXL.DatabaseFieldType">) | ("Int" & z.core.$brand<"PXL.DatabaseFieldType">) | ("Json" & z.core.$brand<"PXL.DatabaseFieldType">) | ("Bytes" & z.core.$brand<"PXL.DatabaseFieldType">);
|
|
99
|
+
databaseName: string & z.core.$brand<"PXL.DatabaseFieldName">;
|
|
100
|
+
excelName: string & z.core.$brand<"PXL.ExcelColumnName">;
|
|
141
101
|
description: string;
|
|
142
102
|
label: string;
|
|
143
103
|
hasIndex: true;
|
package/dist/field/relation.d.ts
CHANGED
|
@@ -33,49 +33,27 @@ export type FieldRelation = FieldCommon<FieldKindRelation> & {
|
|
|
33
33
|
export declare const createRelationJSONDecoder: ({ modelNames }: {
|
|
34
34
|
modelNames: ModelName[];
|
|
35
35
|
}) => z.ZodObject<{
|
|
36
|
-
name: z.
|
|
37
|
-
type: z.
|
|
36
|
+
name: z.ZodString;
|
|
37
|
+
type: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
38
38
|
databaseName: z.ZodOptional<z.ZodString>;
|
|
39
|
-
excelName: z.
|
|
39
|
+
excelName: z.ZodOptional<z.ZodString>;
|
|
40
40
|
prismaRelationFieldName: z.ZodOptional<z.ZodString>;
|
|
41
41
|
deepClone: z.ZodOptional<z.ZodBoolean>;
|
|
42
42
|
label: z.ZodOptional<z.ZodString>;
|
|
43
43
|
description: z.ZodOptional<z.ZodString>;
|
|
44
44
|
isReadonly: z.ZodOptional<z.ZodBoolean>;
|
|
45
45
|
isUnique: z.ZodOptional<z.ZodBoolean>;
|
|
46
|
-
},
|
|
47
|
-
type: string;
|
|
48
|
-
name: string;
|
|
49
|
-
description?: string | undefined;
|
|
50
|
-
databaseName?: string | undefined;
|
|
51
|
-
excelName?: string | undefined;
|
|
52
|
-
label?: string | undefined;
|
|
53
|
-
isReadonly?: boolean | undefined;
|
|
54
|
-
isUnique?: boolean | undefined;
|
|
55
|
-
prismaRelationFieldName?: string | undefined;
|
|
56
|
-
deepClone?: boolean | undefined;
|
|
57
|
-
}, {
|
|
58
|
-
type: string;
|
|
59
|
-
name: string;
|
|
60
|
-
description?: string | undefined;
|
|
61
|
-
databaseName?: string | undefined;
|
|
62
|
-
excelName?: string | undefined;
|
|
63
|
-
label?: string | undefined;
|
|
64
|
-
isReadonly?: boolean | undefined;
|
|
65
|
-
isUnique?: boolean | undefined;
|
|
66
|
-
prismaRelationFieldName?: string | undefined;
|
|
67
|
-
deepClone?: boolean | undefined;
|
|
68
|
-
}>;
|
|
46
|
+
}, z.core.$strip>;
|
|
69
47
|
export type FieldRelationJSON = z.infer<ReturnType<typeof createRelationJSONDecoder>>;
|
|
70
48
|
export declare function fieldRelationJSONTransformer(fieldInput: FieldRelationJSON): {
|
|
71
49
|
kind: "relation";
|
|
72
|
-
type: string & z.
|
|
73
|
-
name: string & z.
|
|
74
|
-
referencedModelName: string & z.
|
|
50
|
+
type: string & z.core.$brand<"PXL.IdType"> & z.core.$brand<"PXL.Type">;
|
|
51
|
+
name: string & z.core.$brand<"PXL.FieldName">;
|
|
52
|
+
referencedModelName: string & z.core.$brand<"PXL.ModelName">;
|
|
75
53
|
label: string;
|
|
76
|
-
databaseName: string & z.
|
|
77
|
-
prismaRelationFieldName: (string & z.
|
|
78
|
-
excelName: string & z.
|
|
54
|
+
databaseName: string & z.core.$brand<"PXL.DatabaseFieldName">;
|
|
55
|
+
prismaRelationFieldName: (string & z.core.$brand<"PXL.DatabaseFieldName">) | undefined;
|
|
56
|
+
excelName: string & z.core.$brand<"PXL.ExcelColumnName">;
|
|
79
57
|
deepClone: boolean;
|
|
80
58
|
description: string | undefined;
|
|
81
59
|
isReadonly: boolean;
|
package/dist/field/relation.js
CHANGED
|
@@ -44,7 +44,9 @@ const utils_2 = require("./shared/utils");
|
|
|
44
44
|
exports.fieldKindRelation = 'relation';
|
|
45
45
|
const createRelationJSONDecoder = ({ modelNames }) => {
|
|
46
46
|
return zod_1.z.object({
|
|
47
|
-
name: Decoders.zFieldPropertyName.refine((name) => name.endsWith('Id'),
|
|
47
|
+
name: Decoders.zFieldPropertyName.refine((name) => name.endsWith('Id'), {
|
|
48
|
+
error: (issue) => `Relation field name must end with 'Id' - received ${issue.input}`,
|
|
49
|
+
}),
|
|
48
50
|
type: zod_1.z //
|
|
49
51
|
.string()
|
|
50
52
|
.describe('The name of the referenced model. If suffixed with "?", the field is optional.')
|
|
@@ -132,7 +134,7 @@ const fieldRelationTransformer = ({ fieldInput, model, projectSchema }, ctx) =>
|
|
|
132
134
|
modelName: model.name,
|
|
133
135
|
unbrandedType: idField.unbrandedTypeName,
|
|
134
136
|
databaseType: idField.databaseType,
|
|
135
|
-
prismaRelationFieldName: fieldInput.prismaRelationFieldName ?? Branded.toDatabaseFieldName(
|
|
137
|
+
prismaRelationFieldName: fieldInput.prismaRelationFieldName ?? Branded.toDatabaseFieldName(`${model.name}.${fieldInput.name}`),
|
|
136
138
|
};
|
|
137
139
|
};
|
|
138
140
|
exports.fieldRelationTransformer = fieldRelationTransformer;
|
package/dist/field/scalar.d.ts
CHANGED
|
@@ -56,10 +56,10 @@ type FieldScalarDateNoValidation = {
|
|
|
56
56
|
* JSON Schema for an scalar field
|
|
57
57
|
*/
|
|
58
58
|
export declare const zFieldScalarJSON: z.ZodObject<{
|
|
59
|
-
name: z.
|
|
60
|
-
type: z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<"String">, z.ZodLiteral<"String?">]>, z.ZodUnion<[z.ZodLiteral<"Boolean">, z.ZodLiteral<"Boolean?">]>, z.ZodUnion<[z.ZodLiteral<"DateTime">, z.ZodLiteral<"DateTime?">]>, z.ZodUnion<[z.ZodLiteral<"Decimal">, z.ZodLiteral<"Decimal?">]>, z.ZodUnion<[z.ZodLiteral<"Float">, z.ZodLiteral<"Float?">]>, z.ZodUnion<[z.ZodLiteral<"Int">, z.ZodLiteral<"Int?">]>, z.ZodUnion<[z.ZodLiteral<"Json">, z.ZodLiteral<"Json?">]>, z.ZodUnion<[z.ZodLiteral<"Bytes">, z.ZodLiteral<"Bytes?">]>, z.ZodUnion<[z.ZodLiteral<"BigInt">, z.ZodLiteral<"BigInt?">]>]>;
|
|
59
|
+
name: z.ZodString;
|
|
60
|
+
type: z.ZodUnion<readonly [z.ZodUnion<[z.ZodLiteral<"String">, z.ZodLiteral<"String?">]>, z.ZodUnion<[z.ZodLiteral<"Boolean">, z.ZodLiteral<"Boolean?">]>, z.ZodUnion<[z.ZodLiteral<"DateTime">, z.ZodLiteral<"DateTime?">]>, z.ZodUnion<[z.ZodLiteral<"Decimal">, z.ZodLiteral<"Decimal?">]>, z.ZodUnion<[z.ZodLiteral<"Float">, z.ZodLiteral<"Float?">]>, z.ZodUnion<[z.ZodLiteral<"Int">, z.ZodLiteral<"Int?">]>, z.ZodUnion<[z.ZodLiteral<"Json">, z.ZodLiteral<"Json?">]>, z.ZodUnion<[z.ZodLiteral<"Bytes">, z.ZodLiteral<"Bytes?">]>, z.ZodUnion<[z.ZodLiteral<"BigInt">, z.ZodLiteral<"BigInt?">]>]>;
|
|
61
61
|
databaseName: z.ZodOptional<z.ZodString>;
|
|
62
|
-
excelName: z.
|
|
62
|
+
excelName: z.ZodOptional<z.ZodString>;
|
|
63
63
|
label: z.ZodOptional<z.ZodString>;
|
|
64
64
|
description: z.ZodOptional<z.ZodString>;
|
|
65
65
|
isReadonly: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -69,52 +69,20 @@ export declare const zFieldScalarJSON: z.ZodObject<{
|
|
|
69
69
|
isUpdatedAt: z.ZodOptional<z.ZodBoolean>;
|
|
70
70
|
maxLength: z.ZodOptional<z.ZodNumber>;
|
|
71
71
|
faker: z.ZodOptional<z.ZodString>;
|
|
72
|
-
seed: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodDate]>, z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodDate]
|
|
72
|
+
seed: z.ZodOptional<z.ZodUnion<[z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodDate]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodDate]>>]>>;
|
|
73
73
|
placeholder: z.ZodOptional<z.ZodString>;
|
|
74
|
-
},
|
|
75
|
-
type: "BigInt" | "String" | "Boolean" | "DateTime" | "Decimal" | "Float" | "Int" | "Json" | "Bytes" | "String?" | "Boolean?" | "DateTime?" | "Decimal?" | "Float?" | "Int?" | "Json?" | "Bytes?" | "BigInt?";
|
|
76
|
-
name: string;
|
|
77
|
-
description?: string | undefined;
|
|
78
|
-
databaseName?: string | undefined;
|
|
79
|
-
excelName?: string | undefined;
|
|
80
|
-
label?: string | undefined;
|
|
81
|
-
isReadonly?: boolean | undefined;
|
|
82
|
-
faker?: string | undefined;
|
|
83
|
-
seed?: string | number | boolean | Date | (string | number | boolean | Date)[] | undefined;
|
|
84
|
-
isUnique?: boolean | undefined;
|
|
85
|
-
hasIndex?: boolean | undefined;
|
|
86
|
-
isCreatedAt?: boolean | undefined;
|
|
87
|
-
isUpdatedAt?: boolean | undefined;
|
|
88
|
-
maxLength?: number | undefined;
|
|
89
|
-
placeholder?: string | undefined;
|
|
90
|
-
}, {
|
|
91
|
-
type: "BigInt" | "String" | "Boolean" | "DateTime" | "Decimal" | "Float" | "Int" | "Json" | "Bytes" | "String?" | "Boolean?" | "DateTime?" | "Decimal?" | "Float?" | "Int?" | "Json?" | "Bytes?" | "BigInt?";
|
|
92
|
-
name: string;
|
|
93
|
-
description?: string | undefined;
|
|
94
|
-
databaseName?: string | undefined;
|
|
95
|
-
excelName?: string | undefined;
|
|
96
|
-
label?: string | undefined;
|
|
97
|
-
isReadonly?: boolean | undefined;
|
|
98
|
-
faker?: string | undefined;
|
|
99
|
-
seed?: string | number | boolean | Date | (string | number | boolean | Date)[] | undefined;
|
|
100
|
-
isUnique?: boolean | undefined;
|
|
101
|
-
hasIndex?: boolean | undefined;
|
|
102
|
-
isCreatedAt?: boolean | undefined;
|
|
103
|
-
isUpdatedAt?: boolean | undefined;
|
|
104
|
-
maxLength?: number | undefined;
|
|
105
|
-
placeholder?: string | undefined;
|
|
106
|
-
}>;
|
|
74
|
+
}, z.core.$strict>;
|
|
107
75
|
export type FieldScalarJSON = z.infer<typeof zFieldScalarJSON>;
|
|
108
76
|
export declare function fieldScalarJSONTransformer(fieldInput: FieldScalarJSON, ctx: z.RefinementCtx): FieldScalarEnriched;
|
|
109
77
|
export type FieldScalarEnriched = Omit<FieldCommon<FieldKindScalar>, 'modelName'> & FieldCommonScalar & {
|
|
110
78
|
type: Branded.ScalarType;
|
|
111
79
|
validations: Partial<ValidationString & ValidationNumber>;
|
|
112
80
|
};
|
|
113
|
-
export declare const zFieldScalar: z.
|
|
114
|
-
name: z.
|
|
115
|
-
type: z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<"String">, z.ZodLiteral<"String?">]>, z.ZodUnion<[z.ZodLiteral<"Boolean">, z.ZodLiteral<"Boolean?">]>, z.ZodUnion<[z.ZodLiteral<"DateTime">, z.ZodLiteral<"DateTime?">]>, z.ZodUnion<[z.ZodLiteral<"Decimal">, z.ZodLiteral<"Decimal?">]>, z.ZodUnion<[z.ZodLiteral<"Float">, z.ZodLiteral<"Float?">]>, z.ZodUnion<[z.ZodLiteral<"Int">, z.ZodLiteral<"Int?">]>, z.ZodUnion<[z.ZodLiteral<"Json">, z.ZodLiteral<"Json?">]>, z.ZodUnion<[z.ZodLiteral<"Bytes">, z.ZodLiteral<"Bytes?">]>, z.ZodUnion<[z.ZodLiteral<"BigInt">, z.ZodLiteral<"BigInt?">]>]>;
|
|
81
|
+
export declare const zFieldScalar: z.ZodPipe<z.ZodObject<{
|
|
82
|
+
name: z.ZodString;
|
|
83
|
+
type: z.ZodUnion<readonly [z.ZodUnion<[z.ZodLiteral<"String">, z.ZodLiteral<"String?">]>, z.ZodUnion<[z.ZodLiteral<"Boolean">, z.ZodLiteral<"Boolean?">]>, z.ZodUnion<[z.ZodLiteral<"DateTime">, z.ZodLiteral<"DateTime?">]>, z.ZodUnion<[z.ZodLiteral<"Decimal">, z.ZodLiteral<"Decimal?">]>, z.ZodUnion<[z.ZodLiteral<"Float">, z.ZodLiteral<"Float?">]>, z.ZodUnion<[z.ZodLiteral<"Int">, z.ZodLiteral<"Int?">]>, z.ZodUnion<[z.ZodLiteral<"Json">, z.ZodLiteral<"Json?">]>, z.ZodUnion<[z.ZodLiteral<"Bytes">, z.ZodLiteral<"Bytes?">]>, z.ZodUnion<[z.ZodLiteral<"BigInt">, z.ZodLiteral<"BigInt?">]>]>;
|
|
116
84
|
databaseName: z.ZodOptional<z.ZodString>;
|
|
117
|
-
excelName: z.
|
|
85
|
+
excelName: z.ZodOptional<z.ZodString>;
|
|
118
86
|
label: z.ZodOptional<z.ZodString>;
|
|
119
87
|
description: z.ZodOptional<z.ZodString>;
|
|
120
88
|
isReadonly: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -124,56 +92,24 @@ export declare const zFieldScalar: z.ZodEffects<z.ZodObject<{
|
|
|
124
92
|
isUpdatedAt: z.ZodOptional<z.ZodBoolean>;
|
|
125
93
|
maxLength: z.ZodOptional<z.ZodNumber>;
|
|
126
94
|
faker: z.ZodOptional<z.ZodString>;
|
|
127
|
-
seed: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodDate]>, z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodDate]
|
|
95
|
+
seed: z.ZodOptional<z.ZodUnion<[z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodDate]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodDate]>>]>>;
|
|
128
96
|
placeholder: z.ZodOptional<z.ZodString>;
|
|
129
|
-
},
|
|
130
|
-
type: "BigInt" | "String" | "Boolean" | "DateTime" | "Decimal" | "Float" | "Int" | "Json" | "Bytes" | "String?" | "Boolean?" | "DateTime?" | "Decimal?" | "Float?" | "Int?" | "Json?" | "Bytes?" | "BigInt?";
|
|
97
|
+
}, z.core.$strict>, z.ZodTransform<FieldScalarEnriched, {
|
|
131
98
|
name: string;
|
|
132
|
-
description?: string | undefined;
|
|
133
|
-
databaseName?: string | undefined;
|
|
134
|
-
excelName?: string | undefined;
|
|
135
|
-
label?: string | undefined;
|
|
136
|
-
isReadonly?: boolean | undefined;
|
|
137
|
-
faker?: string | undefined;
|
|
138
|
-
seed?: string | number | boolean | Date | (string | number | boolean | Date)[] | undefined;
|
|
139
|
-
isUnique?: boolean | undefined;
|
|
140
|
-
hasIndex?: boolean | undefined;
|
|
141
|
-
isCreatedAt?: boolean | undefined;
|
|
142
|
-
isUpdatedAt?: boolean | undefined;
|
|
143
|
-
maxLength?: number | undefined;
|
|
144
|
-
placeholder?: string | undefined;
|
|
145
|
-
}, {
|
|
146
99
|
type: "BigInt" | "String" | "Boolean" | "DateTime" | "Decimal" | "Float" | "Int" | "Json" | "Bytes" | "String?" | "Boolean?" | "DateTime?" | "Decimal?" | "Float?" | "Int?" | "Json?" | "Bytes?" | "BigInt?";
|
|
147
|
-
name: string;
|
|
148
|
-
description?: string | undefined;
|
|
149
100
|
databaseName?: string | undefined;
|
|
150
101
|
excelName?: string | undefined;
|
|
151
102
|
label?: string | undefined;
|
|
103
|
+
description?: string | undefined;
|
|
152
104
|
isReadonly?: boolean | undefined;
|
|
153
|
-
faker?: string | undefined;
|
|
154
|
-
seed?: string | number | boolean | Date | (string | number | boolean | Date)[] | undefined;
|
|
155
105
|
isUnique?: boolean | undefined;
|
|
156
106
|
hasIndex?: boolean | undefined;
|
|
157
107
|
isCreatedAt?: boolean | undefined;
|
|
158
108
|
isUpdatedAt?: boolean | undefined;
|
|
159
109
|
maxLength?: number | undefined;
|
|
160
|
-
placeholder?: string | undefined;
|
|
161
|
-
}>, FieldScalarEnriched, {
|
|
162
|
-
type: "BigInt" | "String" | "Boolean" | "DateTime" | "Decimal" | "Float" | "Int" | "Json" | "Bytes" | "String?" | "Boolean?" | "DateTime?" | "Decimal?" | "Float?" | "Int?" | "Json?" | "Bytes?" | "BigInt?";
|
|
163
|
-
name: string;
|
|
164
|
-
description?: string | undefined;
|
|
165
|
-
databaseName?: string | undefined;
|
|
166
|
-
excelName?: string | undefined;
|
|
167
|
-
label?: string | undefined;
|
|
168
|
-
isReadonly?: boolean | undefined;
|
|
169
110
|
faker?: string | undefined;
|
|
170
111
|
seed?: string | number | boolean | Date | (string | number | boolean | Date)[] | undefined;
|
|
171
|
-
isUnique?: boolean | undefined;
|
|
172
|
-
hasIndex?: boolean | undefined;
|
|
173
|
-
isCreatedAt?: boolean | undefined;
|
|
174
|
-
isUpdatedAt?: boolean | undefined;
|
|
175
|
-
maxLength?: number | undefined;
|
|
176
112
|
placeholder?: string | undefined;
|
|
177
|
-
}
|
|
113
|
+
}>>;
|
|
178
114
|
export declare const fieldScalarTransformer: FieldTransformer<FieldKindScalar, FieldScalarEnriched, FieldScalar>;
|
|
179
115
|
export {};
|
|
@@ -1,38 +1,38 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { ModelName } from '../../model/model.brands';
|
|
3
|
-
export declare const zFieldName: z.ZodBranded<z.
|
|
3
|
+
export declare const zFieldName: z.core.$ZodBranded<z.ZodString, "PXL.FieldName", "out">;
|
|
4
4
|
export type FieldName = z.infer<typeof zFieldName>;
|
|
5
|
-
export declare const toFieldName: (input: string) => string & z.
|
|
6
|
-
export declare const zFieldIdName: z.ZodBranded<z.ZodBranded<z.ZodLiteral<"id">, "PXL.FieldName">, "PXL.FieldName.Id">;
|
|
5
|
+
export declare const toFieldName: (input: string) => string & z.core.$brand<"PXL.FieldName">;
|
|
6
|
+
export declare const zFieldIdName: z.core.$ZodBranded<z.core.$ZodBranded<z.ZodLiteral<"id">, "PXL.FieldName", "out">, "PXL.FieldName.Id", "out">;
|
|
7
7
|
export type FieldIdName = z.infer<typeof zFieldIdName>;
|
|
8
|
-
export declare const toFieldIdName: (input: string) => "id" & z.
|
|
9
|
-
export declare const zDatabaseFieldName: z.ZodBranded<z.ZodString, "PXL.DatabaseFieldName">;
|
|
8
|
+
export declare const toFieldIdName: (input: string) => "id" & z.core.$brand<"PXL.FieldName"> & z.core.$brand<"PXL.FieldName.Id">;
|
|
9
|
+
export declare const zDatabaseFieldName: z.core.$ZodBranded<z.ZodString, "PXL.DatabaseFieldName", "out">;
|
|
10
10
|
export type DatabaseFieldName = z.infer<typeof zDatabaseFieldName>;
|
|
11
|
-
export declare const toDatabaseFieldName: (input: string) => string & z.
|
|
12
|
-
export declare const zExcelColumnName: z.ZodBranded<z.
|
|
11
|
+
export declare const toDatabaseFieldName: (input: string) => string & z.core.$brand<"PXL.DatabaseFieldName">;
|
|
12
|
+
export declare const zExcelColumnName: z.core.$ZodBranded<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, "PXL.ExcelColumnName", "out">;
|
|
13
13
|
export type ExcelColumnName = z.infer<typeof zExcelColumnName>;
|
|
14
|
-
export declare const toExcelColumnName: (input: string) => string & z.
|
|
15
|
-
export declare const zFieldLabel: z.ZodBranded<z.ZodString, "PXL.FieldLabel">;
|
|
14
|
+
export declare const toExcelColumnName: (input: string) => string & z.core.$brand<"PXL.ExcelColumnName">;
|
|
15
|
+
export declare const zFieldLabel: z.core.$ZodBranded<z.ZodString, "PXL.FieldLabel", "out">;
|
|
16
16
|
export type FieldLabel = z.infer<typeof zFieldLabel>;
|
|
17
|
-
export declare const toFieldLabel: (input: string) => string & z.
|
|
18
|
-
export declare const zType: z.ZodBranded<z.
|
|
17
|
+
export declare const toFieldLabel: (input: string) => string & z.core.$brand<"PXL.FieldLabel">;
|
|
18
|
+
export declare const zType: z.core.$ZodBranded<z.ZodString, "PXL.Type", "out">;
|
|
19
19
|
export type Type = z.infer<typeof zType>;
|
|
20
|
-
export declare const toType: (input: string) => string & z.
|
|
21
|
-
export declare const zIdType: z.ZodBranded<z.ZodBranded<z.
|
|
20
|
+
export declare const toType: (input: string) => string & z.core.$brand<"PXL.Type">;
|
|
21
|
+
export declare const zIdType: z.core.$ZodBranded<z.core.$ZodBranded<z.ZodString, "PXL.IdType", "out">, "PXL.Type", "out">;
|
|
22
22
|
export type IdType = z.infer<typeof zIdType>;
|
|
23
|
-
export declare const toIdType: (input: ModelName) => string & z.
|
|
24
|
-
export declare const zScalarType: z.ZodBranded<z.ZodBranded<z.ZodUnion<[z.ZodLiteral<"string">, z.ZodLiteral<"number">, z.ZodLiteral<"boolean">, z.ZodLiteral<"Date">]>, "PXL.ScalarType">, "PXL.Type">;
|
|
23
|
+
export declare const toIdType: (input: ModelName) => string & z.core.$brand<"PXL.IdType"> & z.core.$brand<"PXL.Type">;
|
|
24
|
+
export declare const zScalarType: z.core.$ZodBranded<z.core.$ZodBranded<z.ZodUnion<readonly [z.ZodLiteral<"string">, z.ZodLiteral<"number">, z.ZodLiteral<"boolean">, z.ZodLiteral<"Date">]>, "PXL.ScalarType", "out">, "PXL.Type", "out">;
|
|
25
25
|
export type ScalarType = z.infer<typeof zScalarType>;
|
|
26
|
-
export declare const toScalarType: (input: string) => (
|
|
27
|
-
export declare const zScalarIdType: z.ZodBranded<z.ZodBranded<z.ZodBranded<z.ZodUnion<[z.ZodLiteral<"string">, z.ZodLiteral<"number">]>, "PXL.ScalarIdType">, "PXL.ScalarType">, "PXL.Type">;
|
|
26
|
+
export declare const toScalarType: (input: string) => ("string" & z.core.$brand<"PXL.ScalarType"> & z.core.$brand<"PXL.Type">) | ("number" & z.core.$brand<"PXL.ScalarType"> & z.core.$brand<"PXL.Type">) | ("boolean" & z.core.$brand<"PXL.ScalarType"> & z.core.$brand<"PXL.Type">) | ("Date" & z.core.$brand<"PXL.ScalarType"> & z.core.$brand<"PXL.Type">);
|
|
27
|
+
export declare const zScalarIdType: z.core.$ZodBranded<z.core.$ZodBranded<z.core.$ZodBranded<z.ZodUnion<readonly [z.ZodLiteral<"string">, z.ZodLiteral<"number">]>, "PXL.ScalarIdType", "out">, "PXL.ScalarType", "out">, "PXL.Type", "out">;
|
|
28
28
|
export type ScalarIdType = z.infer<typeof zScalarIdType>;
|
|
29
|
-
export declare const toScalarIdType: (input: string) => (
|
|
30
|
-
export declare const zEnumType: z.ZodBranded<z.ZodBranded<z.
|
|
29
|
+
export declare const toScalarIdType: (input: string) => ("string" & z.core.$brand<"PXL.ScalarIdType"> & z.core.$brand<"PXL.ScalarType"> & z.core.$brand<"PXL.Type">) | ("number" & z.core.$brand<"PXL.ScalarIdType"> & z.core.$brand<"PXL.ScalarType"> & z.core.$brand<"PXL.Type">);
|
|
30
|
+
export declare const zEnumType: z.core.$ZodBranded<z.core.$ZodBranded<z.ZodString, "PXL.EnumType", "out">, "PXL.Type", "out">;
|
|
31
31
|
export type EnumType = z.infer<typeof zEnumType>;
|
|
32
|
-
export declare const toEnumType: (input: string) => string & z.
|
|
33
|
-
export declare const zDiscriminatedUnionType: z.ZodBranded<z.ZodBranded<z.
|
|
32
|
+
export declare const toEnumType: (input: string) => string & z.core.$brand<"PXL.EnumType"> & z.core.$brand<"PXL.Type">;
|
|
33
|
+
export declare const zDiscriminatedUnionType: z.core.$ZodBranded<z.core.$ZodBranded<z.ZodString, "PXL.DiscriminatedUnionType", "out">, "PXL.Type", "out">;
|
|
34
34
|
export type DiscriminatedUnionType = z.infer<typeof zDiscriminatedUnionType>;
|
|
35
|
-
export declare const toDiscriminatedUnionType: (input: string) => string & z.
|
|
36
|
-
export declare const zDatabaseFieldType: z.ZodBranded<z.ZodUnion<[z.ZodLiteral<"BigInt">, z.ZodLiteral<"String">, z.ZodLiteral<"Boolean">, z.ZodLiteral<"DateTime">, z.ZodLiteral<"Decimal">, z.ZodLiteral<"Float">, z.ZodLiteral<"Int">, z.ZodLiteral<"Json">, z.ZodLiteral<"Bytes">]>, "PXL.DatabaseFieldType">;
|
|
35
|
+
export declare const toDiscriminatedUnionType: (input: string) => string & z.core.$brand<"PXL.DiscriminatedUnionType"> & z.core.$brand<"PXL.Type">;
|
|
36
|
+
export declare const zDatabaseFieldType: z.core.$ZodBranded<z.ZodUnion<readonly [z.ZodLiteral<"BigInt">, z.ZodLiteral<"String">, z.ZodLiteral<"Boolean">, z.ZodLiteral<"DateTime">, z.ZodLiteral<"Decimal">, z.ZodLiteral<"Float">, z.ZodLiteral<"Int">, z.ZodLiteral<"Json">, z.ZodLiteral<"Bytes">]>, "PXL.DatabaseFieldType", "out">;
|
|
37
37
|
export type DatabaseFieldType = z.infer<typeof zDatabaseFieldType>;
|
|
38
|
-
export declare const toDatabaseFieldType: (input: string) => ("BigInt" | "String" | "Boolean" | "DateTime" | "Decimal" | "Float" | "Int" | "Json" | "Bytes"
|
|
38
|
+
export declare const toDatabaseFieldType: (input: string) => ("BigInt" & z.core.$brand<"PXL.DatabaseFieldType">) | ("String" & z.core.$brand<"PXL.DatabaseFieldType">) | ("Boolean" & z.core.$brand<"PXL.DatabaseFieldType">) | ("DateTime" & z.core.$brand<"PXL.DatabaseFieldType">) | ("Decimal" & z.core.$brand<"PXL.DatabaseFieldType">) | ("Float" & z.core.$brand<"PXL.DatabaseFieldType">) | ("Int" & z.core.$brand<"PXL.DatabaseFieldType">) | ("Json" & z.core.$brand<"PXL.DatabaseFieldType">) | ("Bytes" & z.core.$brand<"PXL.DatabaseFieldType">);
|
|
@@ -6,10 +6,15 @@ const utils_1 = require("@postxl/utils");
|
|
|
6
6
|
// --- Names ---------------------------------------------------------------------------------------
|
|
7
7
|
exports.zFieldName = zod_1.z
|
|
8
8
|
.string()
|
|
9
|
-
.refine(utils_1.isCamelCase,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}))
|
|
9
|
+
.refine(utils_1.isCamelCase, {
|
|
10
|
+
error: (issue) => {
|
|
11
|
+
const s = String(issue.input);
|
|
12
|
+
return `Field name must be camelCase - received ${s}, expected ${(0, utils_1.toCamelCase)(s)}`;
|
|
13
|
+
},
|
|
14
|
+
})
|
|
15
|
+
.refine((s) => !s.endsWith('?'), {
|
|
16
|
+
error: (issue) => `Field name "${issue.input}" must not end with '?'! If you want to make a field optional, add "?" to the 'type' property, not to 'name'!`,
|
|
17
|
+
})
|
|
13
18
|
.brand('PXL.FieldName');
|
|
14
19
|
const toFieldName = (input) => exports.zFieldName.parse(input);
|
|
15
20
|
exports.toFieldName = toFieldName;
|
|
@@ -31,14 +36,24 @@ exports.toFieldLabel = toFieldLabel;
|
|
|
31
36
|
// --- Types ---------------------------------------------------------------------------------------
|
|
32
37
|
exports.zType = zod_1.z
|
|
33
38
|
.string()
|
|
34
|
-
.refine(utils_1.isPascalCase,
|
|
39
|
+
.refine(utils_1.isPascalCase, {
|
|
40
|
+
error: (issue) => {
|
|
41
|
+
const s = String(issue.input);
|
|
42
|
+
return `Type must be PascalCase - received ${s}, expected ${(0, utils_1.toPascalCase)(s)}`;
|
|
43
|
+
},
|
|
44
|
+
})
|
|
35
45
|
.brand('PXL.Type')
|
|
36
46
|
.describe('The name of the TypeScript type');
|
|
37
47
|
const toType = (input) => exports.zType.parse(input);
|
|
38
48
|
exports.toType = toType;
|
|
39
49
|
exports.zIdType = zod_1.z
|
|
40
50
|
.string()
|
|
41
|
-
.refine(utils_1.isPascalCase,
|
|
51
|
+
.refine(utils_1.isPascalCase, {
|
|
52
|
+
error: (issue) => {
|
|
53
|
+
const s = String(issue.input);
|
|
54
|
+
return `Id type must be PascalCase - received ${s}, expected ${(0, utils_1.toPascalCase)(s)}`;
|
|
55
|
+
},
|
|
56
|
+
})
|
|
42
57
|
.brand('PXL.IdType')
|
|
43
58
|
.brand('PXL.Type')
|
|
44
59
|
.describe('The name of the TypeScript type that represents an id field of a model, e.g. `UserId`');
|
|
@@ -74,9 +89,12 @@ const toScalarIdType = (input) => exports.zScalarIdType.parse(input);
|
|
|
74
89
|
exports.toScalarIdType = toScalarIdType;
|
|
75
90
|
exports.zEnumType = zod_1.z
|
|
76
91
|
.string()
|
|
77
|
-
.refine(utils_1.isPascalCase,
|
|
78
|
-
|
|
79
|
-
|
|
92
|
+
.refine(utils_1.isPascalCase, {
|
|
93
|
+
error: (issue) => {
|
|
94
|
+
const s = String(issue.input);
|
|
95
|
+
return `Enum name must be PascalCase - received ${s}, expected ${(0, utils_1.toPascalCase)(s)}`;
|
|
96
|
+
},
|
|
97
|
+
})
|
|
80
98
|
.brand('PXL.EnumType')
|
|
81
99
|
.brand('PXL.Type')
|
|
82
100
|
.describe('The name of the TypeScript type that represents an enum, e.g. `ActionStatus`');
|
|
@@ -84,7 +102,7 @@ const toEnumType = (input) => exports.zEnumType.parse(input);
|
|
|
84
102
|
exports.toEnumType = toEnumType;
|
|
85
103
|
exports.zDiscriminatedUnionType = zod_1.z
|
|
86
104
|
.string()
|
|
87
|
-
.refine(utils_1.isPascalCase, {
|
|
105
|
+
.refine(utils_1.isPascalCase, { error: 'Discriminated union name must be PascalCase' })
|
|
88
106
|
.brand('PXL.DiscriminatedUnionType')
|
|
89
107
|
.brand('PXL.Type')
|
|
90
108
|
.describe('The name of the TypeScript type that represents a discriminated union, e.g. `ActionStatus`');
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
export declare const zFieldPropertyName: z.
|
|
2
|
+
export declare const zFieldPropertyName: z.ZodString;
|
|
3
3
|
export declare const zFieldPropertyType: z.ZodString;
|
|
4
4
|
export declare const zFieldPropertyDatabaseName: z.ZodOptional<z.ZodString>;
|
|
5
|
-
export declare const zFieldPropertyExcelName: z.
|
|
5
|
+
export declare const zFieldPropertyExcelName: z.ZodOptional<z.ZodString>;
|
|
6
6
|
export declare const zFieldPropertyLabel: z.ZodOptional<z.ZodString>;
|
|
7
7
|
export declare const zFieldPropertyDescription: z.ZodOptional<z.ZodString>;
|
|
8
8
|
export declare const zFieldPropertyIsReadonly: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -12,6 +12,6 @@ export declare const zFieldPropertyIsCreatedAt: z.ZodOptional<z.ZodBoolean>;
|
|
|
12
12
|
export declare const zFieldPropertyIsUpdatedAt: z.ZodOptional<z.ZodBoolean>;
|
|
13
13
|
export declare const zFieldPropertyMaxLength: z.ZodOptional<z.ZodNumber>;
|
|
14
14
|
export declare const zFieldFaker: z.ZodOptional<z.ZodString>;
|
|
15
|
-
export declare const zScalarValue: z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodDate]>;
|
|
16
|
-
export declare const zFieldSeed: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodDate]>, z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodDate]
|
|
15
|
+
export declare const zScalarValue: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodDate]>;
|
|
16
|
+
export declare const zFieldSeed: z.ZodOptional<z.ZodUnion<[z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodDate]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodDate]>>]>>;
|
|
17
17
|
export declare const zFieldPropertyPlaceholder: z.ZodOptional<z.ZodString>;
|
|
@@ -6,12 +6,14 @@ const utils_1 = require("@postxl/utils");
|
|
|
6
6
|
exports.zFieldPropertyName = zod_1.z
|
|
7
7
|
//
|
|
8
8
|
.string()
|
|
9
|
-
.min(1, 'Name of the field must not be empty')
|
|
10
|
-
.refine((name) => (0, utils_1.toCamelCase)(name) === name,
|
|
9
|
+
.min(1, { error: 'Name of the field must not be empty' })
|
|
10
|
+
.refine((name) => (0, utils_1.toCamelCase)(name) === name, {
|
|
11
|
+
error: (issue) => `Field name must be camelCased, but is ${(0, utils_1.red)(String(issue.input))}!`,
|
|
12
|
+
})
|
|
11
13
|
.describe('Name of the field. Must be camelCased.');
|
|
12
14
|
exports.zFieldPropertyType = zod_1.z
|
|
13
15
|
.string()
|
|
14
|
-
.min(1, 'Type of the field must not be empty')
|
|
16
|
+
.min(1, { error: 'Type of the field must not be empty' })
|
|
15
17
|
.describe(`The type of the field. This should either be:
|
|
16
18
|
* \`String\` or \`Int\` in case name is \`id\
|
|
17
19
|
* \`String\`, \`Int\`, \`Float\` or \`DateTime\` for scalar fields
|
|
@@ -26,9 +28,9 @@ exports.zFieldPropertyDatabaseName = zod_1.z
|
|
|
26
28
|
exports.zFieldPropertyExcelName = zod_1.z
|
|
27
29
|
.string()
|
|
28
30
|
.optional()
|
|
29
|
-
.refine((val) => val === undefined || val === (0, utils_1.toExcelColumnName)(val),
|
|
30
|
-
|
|
31
|
-
})
|
|
31
|
+
.refine((val) => val === undefined || val === (0, utils_1.toExcelColumnName)(val), {
|
|
32
|
+
error: (issue) => `Excel column name "${(0, utils_1.red)(String(issue.input ?? ''))}" is not a valid Excel table name. It must start with a letter or underscore and can only contain letters, numbers, and underscores.`,
|
|
33
|
+
})
|
|
32
34
|
.describe('Mapping of the field to an Excel column name. If not provided, we use the `label` field.');
|
|
33
35
|
exports.zFieldPropertyLabel = zod_1.z
|
|
34
36
|
.string()
|
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import * as Decoders from './decoders';
|
|
3
3
|
declare const _seedDecoder: z.ZodObject<{
|
|
4
|
-
seed: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodDate]>, z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodDate]
|
|
4
|
+
seed: z.ZodOptional<z.ZodUnion<[z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodDate]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodDate]>>]>>;
|
|
5
5
|
faker: z.ZodOptional<z.ZodString>;
|
|
6
|
-
},
|
|
7
|
-
faker?: string | undefined;
|
|
8
|
-
seed?: string | number | boolean | Date | (string | number | boolean | Date)[] | undefined;
|
|
9
|
-
}, {
|
|
10
|
-
faker?: string | undefined;
|
|
11
|
-
seed?: string | number | boolean | Date | (string | number | boolean | Date)[] | undefined;
|
|
12
|
-
}>;
|
|
6
|
+
}, z.core.$strip>;
|
|
13
7
|
type Decoded = z.infer<typeof _seedDecoder>;
|
|
14
8
|
export type FieldSeedConfig = FieldSeedConfig_Default | FieldSeedConfig_Const | FieldSeedConfig_Array | FieldSeedConfig_Faker;
|
|
15
9
|
export type FieldSeedConfig_Default = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
export declare const zModelName: z.ZodBranded<z.ZodString, "PXL.ModelName">;
|
|
2
|
+
export declare const zModelName: z.core.$ZodBranded<z.ZodString, "PXL.ModelName", "out">;
|
|
3
3
|
export type ModelName = z.infer<typeof zModelName>;
|
|
4
|
-
export declare const toModelName: (input: string) => string & z.
|
|
5
|
-
export declare const zDatabaseModelName: z.ZodBranded<z.ZodString, "PXL.DatabaseModelName">;
|
|
4
|
+
export declare const toModelName: (input: string) => string & z.core.$brand<"PXL.ModelName">;
|
|
5
|
+
export declare const zDatabaseModelName: z.core.$ZodBranded<z.ZodString, "PXL.DatabaseModelName", "out">;
|
|
6
6
|
export type DatabaseModelName = z.infer<typeof zDatabaseModelName>;
|
|
7
|
-
export declare const toDatabaseModelName: (input: string) => string & z.
|
|
7
|
+
export declare const toDatabaseModelName: (input: string) => string & z.core.$brand<"PXL.DatabaseModelName">;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import * as Branded from './model.brands';
|
|
2
2
|
import { ModelJSON } from './model.json-decoder';
|
|
3
|
-
export declare const defaultModelName_Config: string & import("zod")
|
|
4
|
-
export declare const standardModelName_User: string & import("zod")
|
|
5
|
-
export declare const standardModelName_Action: string & import("zod")
|
|
6
|
-
export declare const standardModelName_ActionOperation: string & import("zod")
|
|
7
|
-
export declare const standardModelName_File: string & import("zod")
|
|
3
|
+
export declare const defaultModelName_Config: string & import("zod").$brand<"PXL.ModelName">;
|
|
4
|
+
export declare const standardModelName_User: string & import("zod").$brand<"PXL.ModelName">;
|
|
5
|
+
export declare const standardModelName_Action: string & import("zod").$brand<"PXL.ModelName">;
|
|
6
|
+
export declare const standardModelName_ActionOperation: string & import("zod").$brand<"PXL.ModelName">;
|
|
7
|
+
export declare const standardModelName_File: string & import("zod").$brand<"PXL.ModelName">;
|
|
8
8
|
export declare const defaultModelNames: {
|
|
9
|
-
config: string & import("zod")
|
|
10
|
-
user: string & import("zod")
|
|
11
|
-
action: string & import("zod")
|
|
12
|
-
mutation: string & import("zod")
|
|
13
|
-
file: string & import("zod")
|
|
9
|
+
config: string & import("zod").$brand<"PXL.ModelName">;
|
|
10
|
+
user: string & import("zod").$brand<"PXL.ModelName">;
|
|
11
|
+
action: string & import("zod").$brand<"PXL.ModelName">;
|
|
12
|
+
mutation: string & import("zod").$brand<"PXL.ModelName">;
|
|
13
|
+
file: string & import("zod").$brand<"PXL.ModelName">;
|
|
14
14
|
};
|
|
15
15
|
export declare const defaultModel_Config: ModelJSON;
|
|
16
16
|
export declare const defaultModelJson_User: ModelJSON;
|