@postxl/schema 2.4.0 → 2.5.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 +3 -3
- package/dist/enum/enum.d.ts +2 -2
- package/dist/enum/enum.defaults.d.ts +8 -8
- package/dist/enum/enum.transformer.d.ts +4 -4
- package/dist/field/enum.d.ts +14 -5
- package/dist/field/enum.js +23 -0
- package/dist/field/field.d.ts +38 -29
- package/dist/field/id.d.ts +14 -12
- package/dist/field/id.js +3 -0
- package/dist/field/json.d.ts +4 -1
- package/dist/field/json.js +2 -0
- package/dist/field/relation.d.ts +11 -9
- package/dist/field/relation.js +2 -0
- package/dist/field/scalar.d.ts +5 -2
- package/dist/field/scalar.js +2 -0
- package/dist/field/shared/brands.d.ts +11 -11
- package/dist/field/shared/decoders.d.ts +1 -0
- package/dist/field/shared/decoders.js +6 -1
- package/dist/field/shared/types.d.ts +10 -0
- package/dist/model/model.brands.d.ts +2 -2
- package/dist/model/model.json-decoder.d.ts +8 -8
- package/dist/model/model.transformer.d.ts +88 -88
- package/dist/project-schema/project-schema.brands.d.ts +3 -3
- package/dist/project-schema/project-schema.defaults.d.ts +1 -1
- package/dist/project-schema/project-schema.json-decoder.d.ts +4 -4
- package/dist/project-schema/project-schema.transformer.d.ts +11 -11
- package/dist/samples/sample-schemas.d.ts +465 -465
- package/package.json +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.zFieldPropertyDefaultValue = exports.zFieldPropertyPlaceholder = exports.zFieldSeed = exports.zScalarValue = exports.zFieldFaker = exports.zFieldPropertyMax = exports.zFieldPropertyMin = exports.zFieldPropertyMaxLength = exports.zFieldPropertyIsUpdatedAt = exports.zFieldPropertyIsCreatedAt = exports.zFieldPropertyHasIndex = exports.zFieldPropertyIsUnique = exports.zFieldPropertyIsReadonly = exports.zFieldPropertyDescription = exports.zFieldPropertyLabel = exports.zFieldPropertyExcelName = exports.zFieldPropertyDatabaseName = exports.zFieldPropertyType = exports.zFieldPropertyName = void 0;
|
|
3
|
+
exports.zFieldPropertyDefaultValue = exports.zFieldPropertyPlaceholder = exports.zFieldSeed = exports.zScalarValue = exports.zFieldFaker = exports.zFieldPropertyMax = exports.zFieldPropertyMin = exports.zFieldPropertyMaxLength = exports.zFieldPropertyIsUpdatedAt = exports.zFieldPropertyIsCreatedAt = exports.zFieldPropertyHasIndex = exports.zFieldPropertyIsUnique = exports.zFieldPropertyIsSystemManaged = exports.zFieldPropertyIsReadonly = exports.zFieldPropertyDescription = exports.zFieldPropertyLabel = exports.zFieldPropertyExcelName = exports.zFieldPropertyDatabaseName = exports.zFieldPropertyType = exports.zFieldPropertyName = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const utils_1 = require("@postxl/utils");
|
|
6
6
|
exports.zFieldPropertyName = zod_1.z
|
|
@@ -46,6 +46,11 @@ exports.zFieldPropertyIsReadonly = zod_1.z
|
|
|
46
46
|
.boolean()
|
|
47
47
|
.optional()
|
|
48
48
|
.describe('If true, the field is readonly, ie. it cannot be changed by the user.');
|
|
49
|
+
exports.zFieldPropertyIsSystemManaged = zod_1.z
|
|
50
|
+
//
|
|
51
|
+
.boolean()
|
|
52
|
+
.optional()
|
|
53
|
+
.describe('If true, the field is owned by the runtime, not the user: it disappears from every human-facing write surface (admin table (bulk) edit, the `updateField`/`updateFieldMany` write unions, the update form, Excel import) but stays in the whole-object `update` decoder so code can still persist it. Use `isReadonly` instead when nothing may write the field after creation.');
|
|
49
54
|
exports.zFieldPropertyIsUnique = zod_1.z
|
|
50
55
|
//
|
|
51
56
|
.boolean()
|
|
@@ -52,6 +52,16 @@ export type FieldCommon<T extends string> = FieldCore<T> & {
|
|
|
52
52
|
* If true, the field is readonly, ie. it cannot be changed by the user.
|
|
53
53
|
*/
|
|
54
54
|
isReadonly: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* If true, the field is owned by the runtime rather than by the user.
|
|
57
|
+
*
|
|
58
|
+
* It is dropped from every human-facing write surface - the admin table is not editable on it,
|
|
59
|
+
* it is not a member of the `updateField` / `updateFieldMany` write unions, the update form does
|
|
60
|
+
* not render it, and an Excel import never produces a delta for it - but, unlike `isReadonly`, it
|
|
61
|
+
* *stays* in the whole-object `update` decoder and in the repository's update statement, so the
|
|
62
|
+
* code that owns it can keep persisting it.
|
|
63
|
+
*/
|
|
64
|
+
isSystemManaged: boolean;
|
|
55
65
|
/**
|
|
56
66
|
* If true, uniqueness is enforced for the field, ie no two items can have the same value for this field.
|
|
57
67
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
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
|
|
4
|
+
export declare const toModelName: (input: string) => string & z.$brand<"PXL.ModelName">;
|
|
5
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.$brand<"PXL.DatabaseModelName">;
|
|
@@ -10,19 +10,19 @@ export declare const zModelNameJSON: z.ZodString;
|
|
|
10
10
|
* `@@index`), with optional `map` to pin the database constraint name.
|
|
11
11
|
*/
|
|
12
12
|
export declare const zModelIndexJSON: z.ZodUnion<readonly [z.ZodPipe<z.ZodArray<z.core.$ZodBranded<z.ZodString, "PXL.FieldName", "out">>, z.ZodTransform<{
|
|
13
|
-
fields: (string & z
|
|
13
|
+
fields: (string & z.$brand<"PXL.FieldName">)[];
|
|
14
14
|
unique: boolean;
|
|
15
15
|
map: string | undefined;
|
|
16
|
-
}, (string & z
|
|
16
|
+
}, (string & z.$brand<"PXL.FieldName">)[]>>, z.ZodPipe<z.ZodObject<{
|
|
17
17
|
fields: z.ZodArray<z.core.$ZodBranded<z.ZodString, "PXL.FieldName", "out">>;
|
|
18
18
|
unique: z.ZodOptional<z.ZodBoolean>;
|
|
19
19
|
map: z.ZodOptional<z.ZodString>;
|
|
20
20
|
}, z.core.$strip>, z.ZodTransform<{
|
|
21
|
-
fields: (string & z
|
|
21
|
+
fields: (string & z.$brand<"PXL.FieldName">)[];
|
|
22
22
|
unique: boolean;
|
|
23
23
|
map: string | undefined;
|
|
24
24
|
}, {
|
|
25
|
-
fields: (string & z
|
|
25
|
+
fields: (string & z.$brand<"PXL.FieldName">)[];
|
|
26
26
|
unique?: boolean | undefined;
|
|
27
27
|
map?: string | undefined;
|
|
28
28
|
}>>]>;
|
|
@@ -70,19 +70,19 @@ export declare const zModelJSON: z.ZodPreprocess<z.ZodObject<{
|
|
|
70
70
|
keyField: z.ZodOptional<z.ZodString>;
|
|
71
71
|
defaultSort: z.ZodOptional<z.ZodArray<z.core.$ZodBranded<z.ZodString, "PXL.FieldName", "out">>>;
|
|
72
72
|
indexes: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodPipe<z.ZodArray<z.core.$ZodBranded<z.ZodString, "PXL.FieldName", "out">>, z.ZodTransform<{
|
|
73
|
-
fields: (string & z
|
|
73
|
+
fields: (string & z.$brand<"PXL.FieldName">)[];
|
|
74
74
|
unique: boolean;
|
|
75
75
|
map: string | undefined;
|
|
76
|
-
}, (string & z
|
|
76
|
+
}, (string & z.$brand<"PXL.FieldName">)[]>>, z.ZodPipe<z.ZodObject<{
|
|
77
77
|
fields: z.ZodArray<z.core.$ZodBranded<z.ZodString, "PXL.FieldName", "out">>;
|
|
78
78
|
unique: z.ZodOptional<z.ZodBoolean>;
|
|
79
79
|
map: z.ZodOptional<z.ZodString>;
|
|
80
80
|
}, z.core.$strip>, z.ZodTransform<{
|
|
81
|
-
fields: (string & z
|
|
81
|
+
fields: (string & z.$brand<"PXL.FieldName">)[];
|
|
82
82
|
unique: boolean;
|
|
83
83
|
map: string | undefined;
|
|
84
84
|
}, {
|
|
85
|
-
fields: (string & z
|
|
85
|
+
fields: (string & z.$brand<"PXL.FieldName">)[];
|
|
86
86
|
unique?: boolean | undefined;
|
|
87
87
|
map?: string | undefined;
|
|
88
88
|
}>>]>>>;
|
|
@@ -1,40 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import type { ModelJSON } from './model.json-decoder';
|
|
3
3
|
export declare function modelJSONTransformer(input: ModelJSON, ctx: z.RefinementCtx): {
|
|
4
|
-
fields: Record<string & z.core.$brand<"PXL.FieldName">, unknown>;
|
|
5
|
-
/**
|
|
6
|
-
* We also provide a list of field names to keep the original order
|
|
7
|
-
*/
|
|
8
|
-
fieldNames: (string & z.core.$brand<"PXL.FieldName">)[];
|
|
9
|
-
name: string & z.core.$brand<"PXL.ModelName">;
|
|
10
|
-
schema: (string & z.core.$brand<"PXL.DatabaseSchemaName">) | undefined;
|
|
11
|
-
databaseName: string & z.core.$brand<"PXL.DatabaseModelName">;
|
|
12
|
-
defaultFieldName: (string & z.core.$brand<"PXL.FieldName">) | undefined;
|
|
13
|
-
labelFieldName: (string & z.core.$brand<"PXL.FieldName">) | undefined;
|
|
14
|
-
labelQualifier: {
|
|
15
|
-
relationFieldName: string & z.core.$brand<"PXL.FieldName">;
|
|
16
|
-
separator: string | undefined;
|
|
17
|
-
} | undefined;
|
|
18
|
-
keyFieldName: (string & z.core.$brand<"PXL.FieldName">) | undefined;
|
|
19
|
-
defaultSort: (string & z.core.$brand<"PXL.FieldName">)[] | undefined;
|
|
20
|
-
isReadonly: boolean;
|
|
21
|
-
exposeRestApi: boolean;
|
|
22
|
-
excelName: string;
|
|
23
|
-
description: string;
|
|
24
|
-
indexes: ({
|
|
25
|
-
fields: (string & z.core.$brand<"PXL.FieldName">)[];
|
|
26
|
-
unique: boolean;
|
|
27
|
-
map: string | undefined;
|
|
28
|
-
} | {
|
|
29
|
-
fields: (string & z.core.$brand<"PXL.FieldName">)[];
|
|
30
|
-
unique: boolean;
|
|
31
|
-
map: string | undefined;
|
|
32
|
-
})[];
|
|
33
|
-
seed: any[];
|
|
34
|
-
faker: {
|
|
35
|
-
seed: number;
|
|
36
|
-
items: number;
|
|
37
|
-
};
|
|
38
4
|
auth?: {
|
|
39
5
|
read?: {
|
|
40
6
|
anyRole: string[];
|
|
@@ -59,37 +25,43 @@ export declare function modelJSONTransformer(input: ModelJSON, ctx: z.Refinement
|
|
|
59
25
|
} | undefined;
|
|
60
26
|
} | undefined;
|
|
61
27
|
source?: Record<string, unknown> | undefined;
|
|
62
|
-
};
|
|
63
|
-
export type ModelEnriched = ReturnType<typeof modelJSONTransformer>;
|
|
64
|
-
declare function addDefaults({ description, fields, standardFields, seed, faker, ...input }: ModelJSON): {
|
|
65
28
|
isReadonly: boolean;
|
|
66
29
|
exposeRestApi: boolean;
|
|
67
|
-
databaseName: string;
|
|
68
30
|
excelName: string;
|
|
69
31
|
description: string;
|
|
70
|
-
fields: {
|
|
71
|
-
[x: string]: unknown;
|
|
72
|
-
name: string;
|
|
73
|
-
}[];
|
|
74
|
-
standardFields: string[];
|
|
75
32
|
indexes: ({
|
|
76
|
-
fields: (string & z
|
|
33
|
+
fields: (string & z.$brand<"PXL.FieldName">)[];
|
|
77
34
|
unique: boolean;
|
|
78
35
|
map: string | undefined;
|
|
79
36
|
} | {
|
|
80
|
-
fields: (string & z
|
|
37
|
+
fields: (string & z.$brand<"PXL.FieldName">)[];
|
|
81
38
|
unique: boolean;
|
|
82
39
|
map: string | undefined;
|
|
83
40
|
})[];
|
|
84
41
|
seed: any[];
|
|
85
|
-
labelQualifier: {
|
|
86
|
-
relation: string;
|
|
87
|
-
separator: string | undefined;
|
|
88
|
-
} | undefined;
|
|
89
42
|
faker: {
|
|
90
43
|
seed: number;
|
|
91
44
|
items: number;
|
|
92
45
|
};
|
|
46
|
+
name: string & z.$brand<"PXL.ModelName">;
|
|
47
|
+
schema: (string & z.$brand<"PXL.DatabaseSchemaName">) | undefined;
|
|
48
|
+
databaseName: string & z.$brand<"PXL.DatabaseModelName">;
|
|
49
|
+
defaultFieldName: (string & z.$brand<"PXL.FieldName">) | undefined;
|
|
50
|
+
labelFieldName: (string & z.$brand<"PXL.FieldName">) | undefined;
|
|
51
|
+
labelQualifier: {
|
|
52
|
+
relationFieldName: string & z.$brand<"PXL.FieldName">;
|
|
53
|
+
separator: string | undefined;
|
|
54
|
+
} | undefined;
|
|
55
|
+
keyFieldName: (string & z.$brand<"PXL.FieldName">) | undefined;
|
|
56
|
+
defaultSort: (string & z.$brand<"PXL.FieldName">)[] | undefined;
|
|
57
|
+
fields: Record<string & z.$brand<"PXL.FieldName">, unknown>;
|
|
58
|
+
/**
|
|
59
|
+
* We also provide a list of field names to keep the original order
|
|
60
|
+
*/
|
|
61
|
+
fieldNames: (string & z.$brand<"PXL.FieldName">)[];
|
|
62
|
+
};
|
|
63
|
+
export type ModelEnriched = ReturnType<typeof modelJSONTransformer>;
|
|
64
|
+
declare function addDefaults({ description, fields, standardFields, seed, faker, ...input }: ModelJSON): {
|
|
93
65
|
name: string;
|
|
94
66
|
auth?: {
|
|
95
67
|
read?: {
|
|
@@ -118,45 +90,39 @@ declare function addDefaults({ description, fields, standardFields, seed, faker,
|
|
|
118
90
|
defaultField?: string | undefined;
|
|
119
91
|
labelField?: string | undefined;
|
|
120
92
|
keyField?: string | undefined;
|
|
121
|
-
defaultSort?: (string & z
|
|
93
|
+
defaultSort?: (string & z.$brand<"PXL.FieldName">)[] | undefined;
|
|
122
94
|
source?: Record<string, unknown> | undefined;
|
|
123
|
-
};
|
|
124
|
-
type WithDefaults = ReturnType<typeof addDefaults>;
|
|
125
|
-
declare function brandModel({ name, schema, databaseName, standardFields, defaultField, labelField, labelQualifier, keyField, defaultSort, ...input }: WithDefaults): {
|
|
126
|
-
name: string & z.core.$brand<"PXL.ModelName">;
|
|
127
|
-
schema: (string & z.core.$brand<"PXL.DatabaseSchemaName">) | undefined;
|
|
128
|
-
databaseName: string & z.core.$brand<"PXL.DatabaseModelName">;
|
|
129
|
-
standardFields: (string & z.core.$brand<"PXL.FieldName">)[];
|
|
130
|
-
defaultFieldName: (string & z.core.$brand<"PXL.FieldName">) | undefined;
|
|
131
|
-
labelFieldName: (string & z.core.$brand<"PXL.FieldName">) | undefined;
|
|
132
|
-
labelQualifier: {
|
|
133
|
-
relationFieldName: string & z.core.$brand<"PXL.FieldName">;
|
|
134
|
-
separator: string | undefined;
|
|
135
|
-
} | undefined;
|
|
136
|
-
keyFieldName: (string & z.core.$brand<"PXL.FieldName">) | undefined;
|
|
137
|
-
defaultSort: (string & z.core.$brand<"PXL.FieldName">)[] | undefined;
|
|
138
95
|
isReadonly: boolean;
|
|
139
96
|
exposeRestApi: boolean;
|
|
97
|
+
databaseName: string;
|
|
140
98
|
excelName: string;
|
|
141
99
|
description: string;
|
|
142
100
|
fields: {
|
|
143
101
|
[x: string]: unknown;
|
|
144
102
|
name: string;
|
|
145
103
|
}[];
|
|
104
|
+
standardFields: string[];
|
|
146
105
|
indexes: ({
|
|
147
|
-
fields: (string & z
|
|
106
|
+
fields: (string & z.$brand<"PXL.FieldName">)[];
|
|
148
107
|
unique: boolean;
|
|
149
108
|
map: string | undefined;
|
|
150
109
|
} | {
|
|
151
|
-
fields: (string & z
|
|
110
|
+
fields: (string & z.$brand<"PXL.FieldName">)[];
|
|
152
111
|
unique: boolean;
|
|
153
112
|
map: string | undefined;
|
|
154
113
|
})[];
|
|
155
114
|
seed: any[];
|
|
115
|
+
labelQualifier: {
|
|
116
|
+
relation: string;
|
|
117
|
+
separator: string | undefined;
|
|
118
|
+
} | undefined;
|
|
156
119
|
faker: {
|
|
157
120
|
seed: number;
|
|
158
121
|
items: number;
|
|
159
122
|
};
|
|
123
|
+
};
|
|
124
|
+
type WithDefaults = ReturnType<typeof addDefaults>;
|
|
125
|
+
declare function brandModel({ name, schema, databaseName, standardFields, defaultField, labelField, labelQualifier, keyField, defaultSort, ...input }: WithDefaults): {
|
|
160
126
|
auth?: {
|
|
161
127
|
read?: {
|
|
162
128
|
anyRole: string[];
|
|
@@ -181,35 +147,20 @@ declare function brandModel({ name, schema, databaseName, standardFields, defaul
|
|
|
181
147
|
} | undefined;
|
|
182
148
|
} | undefined;
|
|
183
149
|
source?: Record<string, unknown> | undefined;
|
|
184
|
-
};
|
|
185
|
-
type BrandedModel = ReturnType<typeof brandModel>;
|
|
186
|
-
declare function combineFields({ fields, standardFields, ...model }: BrandedModel, ctx: z.RefinementCtx): {
|
|
187
|
-
fields: Record<string & z.core.$brand<"PXL.FieldName">, unknown>;
|
|
188
|
-
/**
|
|
189
|
-
* We also provide a list of field names to keep the original order
|
|
190
|
-
*/
|
|
191
|
-
fieldNames: (string & z.core.$brand<"PXL.FieldName">)[];
|
|
192
|
-
name: string & z.core.$brand<"PXL.ModelName">;
|
|
193
|
-
schema: (string & z.core.$brand<"PXL.DatabaseSchemaName">) | undefined;
|
|
194
|
-
databaseName: string & z.core.$brand<"PXL.DatabaseModelName">;
|
|
195
|
-
defaultFieldName: (string & z.core.$brand<"PXL.FieldName">) | undefined;
|
|
196
|
-
labelFieldName: (string & z.core.$brand<"PXL.FieldName">) | undefined;
|
|
197
|
-
labelQualifier: {
|
|
198
|
-
relationFieldName: string & z.core.$brand<"PXL.FieldName">;
|
|
199
|
-
separator: string | undefined;
|
|
200
|
-
} | undefined;
|
|
201
|
-
keyFieldName: (string & z.core.$brand<"PXL.FieldName">) | undefined;
|
|
202
|
-
defaultSort: (string & z.core.$brand<"PXL.FieldName">)[] | undefined;
|
|
203
150
|
isReadonly: boolean;
|
|
204
151
|
exposeRestApi: boolean;
|
|
205
152
|
excelName: string;
|
|
206
153
|
description: string;
|
|
154
|
+
fields: {
|
|
155
|
+
[x: string]: unknown;
|
|
156
|
+
name: string;
|
|
157
|
+
}[];
|
|
207
158
|
indexes: ({
|
|
208
|
-
fields: (string & z
|
|
159
|
+
fields: (string & z.$brand<"PXL.FieldName">)[];
|
|
209
160
|
unique: boolean;
|
|
210
161
|
map: string | undefined;
|
|
211
162
|
} | {
|
|
212
|
-
fields: (string & z
|
|
163
|
+
fields: (string & z.$brand<"PXL.FieldName">)[];
|
|
213
164
|
unique: boolean;
|
|
214
165
|
map: string | undefined;
|
|
215
166
|
})[];
|
|
@@ -218,6 +169,21 @@ declare function combineFields({ fields, standardFields, ...model }: BrandedMode
|
|
|
218
169
|
seed: number;
|
|
219
170
|
items: number;
|
|
220
171
|
};
|
|
172
|
+
name: string & z.$brand<"PXL.ModelName">;
|
|
173
|
+
schema: (string & z.$brand<"PXL.DatabaseSchemaName">) | undefined;
|
|
174
|
+
databaseName: string & z.$brand<"PXL.DatabaseModelName">;
|
|
175
|
+
standardFields: (string & z.$brand<"PXL.FieldName">)[];
|
|
176
|
+
defaultFieldName: (string & z.$brand<"PXL.FieldName">) | undefined;
|
|
177
|
+
labelFieldName: (string & z.$brand<"PXL.FieldName">) | undefined;
|
|
178
|
+
labelQualifier: {
|
|
179
|
+
relationFieldName: string & z.$brand<"PXL.FieldName">;
|
|
180
|
+
separator: string | undefined;
|
|
181
|
+
} | undefined;
|
|
182
|
+
keyFieldName: (string & z.$brand<"PXL.FieldName">) | undefined;
|
|
183
|
+
defaultSort: (string & z.$brand<"PXL.FieldName">)[] | undefined;
|
|
184
|
+
};
|
|
185
|
+
type BrandedModel = ReturnType<typeof brandModel>;
|
|
186
|
+
declare function combineFields({ fields, standardFields, ...model }: BrandedModel, ctx: z.RefinementCtx): {
|
|
221
187
|
auth?: {
|
|
222
188
|
read?: {
|
|
223
189
|
anyRole: string[];
|
|
@@ -242,6 +208,40 @@ declare function combineFields({ fields, standardFields, ...model }: BrandedMode
|
|
|
242
208
|
} | undefined;
|
|
243
209
|
} | undefined;
|
|
244
210
|
source?: Record<string, unknown> | undefined;
|
|
211
|
+
isReadonly: boolean;
|
|
212
|
+
exposeRestApi: boolean;
|
|
213
|
+
excelName: string;
|
|
214
|
+
description: string;
|
|
215
|
+
indexes: ({
|
|
216
|
+
fields: (string & z.$brand<"PXL.FieldName">)[];
|
|
217
|
+
unique: boolean;
|
|
218
|
+
map: string | undefined;
|
|
219
|
+
} | {
|
|
220
|
+
fields: (string & z.$brand<"PXL.FieldName">)[];
|
|
221
|
+
unique: boolean;
|
|
222
|
+
map: string | undefined;
|
|
223
|
+
})[];
|
|
224
|
+
seed: any[];
|
|
225
|
+
faker: {
|
|
226
|
+
seed: number;
|
|
227
|
+
items: number;
|
|
228
|
+
};
|
|
229
|
+
name: string & z.$brand<"PXL.ModelName">;
|
|
230
|
+
schema: (string & z.$brand<"PXL.DatabaseSchemaName">) | undefined;
|
|
231
|
+
databaseName: string & z.$brand<"PXL.DatabaseModelName">;
|
|
232
|
+
defaultFieldName: (string & z.$brand<"PXL.FieldName">) | undefined;
|
|
233
|
+
labelFieldName: (string & z.$brand<"PXL.FieldName">) | undefined;
|
|
234
|
+
labelQualifier: {
|
|
235
|
+
relationFieldName: string & z.$brand<"PXL.FieldName">;
|
|
236
|
+
separator: string | undefined;
|
|
237
|
+
} | undefined;
|
|
238
|
+
keyFieldName: (string & z.$brand<"PXL.FieldName">) | undefined;
|
|
239
|
+
defaultSort: (string & z.$brand<"PXL.FieldName">)[] | undefined;
|
|
240
|
+
fields: Record<string & z.$brand<"PXL.FieldName">, unknown>;
|
|
241
|
+
/**
|
|
242
|
+
* We also provide a list of field names to keep the original order
|
|
243
|
+
*/
|
|
244
|
+
fieldNames: (string & z.$brand<"PXL.FieldName">)[];
|
|
245
245
|
};
|
|
246
246
|
export type CombinedFields = ReturnType<typeof combineFields>;
|
|
247
247
|
export {};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export declare const zProjectSchemaName: z.core.$ZodBranded<z.ZodString, "PXL.ProjectSchemaName", "out">;
|
|
3
3
|
export type ProjectSchemaName = z.infer<typeof zProjectSchemaName>;
|
|
4
|
-
export declare const toProjectSchemaName: (input: string) => string & z
|
|
4
|
+
export declare const toProjectSchemaName: (input: string) => string & z.$brand<"PXL.ProjectSchemaName">;
|
|
5
5
|
export declare const zProjectSlug: z.core.$ZodBranded<z.ZodString, "PXL.ProjectSlug", "out">;
|
|
6
6
|
export type ProjectSlug = z.infer<typeof zProjectSlug>;
|
|
7
|
-
export declare const toProjectSlug: (input: string) => string & z
|
|
7
|
+
export declare const toProjectSlug: (input: string) => string & z.$brand<"PXL.ProjectSlug">;
|
|
8
8
|
export declare const zDatabaseSchemaName: z.core.$ZodBranded<z.ZodString, "PXL.DatabaseSchemaName", "out">;
|
|
9
9
|
export type DatabaseSchemaName = z.infer<typeof zDatabaseSchemaName>;
|
|
10
|
-
export declare const toDatabaseSchemaName: (input: string) => string & z
|
|
10
|
+
export declare const toDatabaseSchemaName: (input: string) => string & z.$brand<"PXL.DatabaseSchemaName">;
|
|
@@ -10,7 +10,7 @@ export declare const databaseSchemaNameConfig: string & import("zod").$brand<"PX
|
|
|
10
10
|
/**
|
|
11
11
|
* The default project roles. Can be overridden via `defaultRoles` in the project schema.
|
|
12
12
|
*/
|
|
13
|
-
export declare const defaultProjectRoles: readonly [
|
|
13
|
+
export declare const defaultProjectRoles: readonly ['superadmin', 'admin', 'editor', 'viewer'];
|
|
14
14
|
export declare const defaultSystemUser: {
|
|
15
15
|
id: string;
|
|
16
16
|
sub: null;
|
|
@@ -117,19 +117,19 @@ export declare const zProjectSchemaJSON: z.ZodPreprocess<z.ZodObject<{
|
|
|
117
117
|
keyField: z.ZodOptional<z.ZodString>;
|
|
118
118
|
defaultSort: z.ZodOptional<z.ZodArray<z.core.$ZodBranded<z.ZodString, "PXL.FieldName", "out">>>;
|
|
119
119
|
indexes: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodPipe<z.ZodArray<z.core.$ZodBranded<z.ZodString, "PXL.FieldName", "out">>, z.ZodTransform<{
|
|
120
|
-
fields: (string & z
|
|
120
|
+
fields: (string & z.$brand<"PXL.FieldName">)[];
|
|
121
121
|
unique: boolean;
|
|
122
122
|
map: string | undefined;
|
|
123
|
-
}, (string & z
|
|
123
|
+
}, (string & z.$brand<"PXL.FieldName">)[]>>, z.ZodPipe<z.ZodObject<{
|
|
124
124
|
fields: z.ZodArray<z.core.$ZodBranded<z.ZodString, "PXL.FieldName", "out">>;
|
|
125
125
|
unique: z.ZodOptional<z.ZodBoolean>;
|
|
126
126
|
map: z.ZodOptional<z.ZodString>;
|
|
127
127
|
}, z.core.$strip>, z.ZodTransform<{
|
|
128
|
-
fields: (string & z
|
|
128
|
+
fields: (string & z.$brand<"PXL.FieldName">)[];
|
|
129
129
|
unique: boolean;
|
|
130
130
|
map: string | undefined;
|
|
131
131
|
}, {
|
|
132
|
-
fields: (string & z
|
|
132
|
+
fields: (string & z.$brand<"PXL.FieldName">)[];
|
|
133
133
|
unique?: boolean | undefined;
|
|
134
134
|
map?: string | undefined;
|
|
135
135
|
}>>]>>>;
|
|
@@ -96,19 +96,19 @@ export declare const zProjectSchema: z.ZodPipe<z.ZodPreprocess<z.ZodObject<{
|
|
|
96
96
|
keyField: z.ZodOptional<z.ZodString>;
|
|
97
97
|
defaultSort: z.ZodOptional<z.ZodArray<z.core.$ZodBranded<z.ZodString, "PXL.FieldName", "out">>>;
|
|
98
98
|
indexes: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodPipe<z.ZodArray<z.core.$ZodBranded<z.ZodString, "PXL.FieldName", "out">>, z.ZodTransform<{
|
|
99
|
-
fields: (string & z
|
|
99
|
+
fields: (string & z.$brand<"PXL.FieldName">)[];
|
|
100
100
|
unique: boolean;
|
|
101
101
|
map: string | undefined;
|
|
102
|
-
}, (string & z
|
|
102
|
+
}, (string & z.$brand<"PXL.FieldName">)[]>>, z.ZodPipe<z.ZodObject<{
|
|
103
103
|
fields: z.ZodArray<z.core.$ZodBranded<z.ZodString, "PXL.FieldName", "out">>;
|
|
104
104
|
unique: z.ZodOptional<z.ZodBoolean>;
|
|
105
105
|
map: z.ZodOptional<z.ZodString>;
|
|
106
106
|
}, z.core.$strip>, z.ZodTransform<{
|
|
107
|
-
fields: (string & z
|
|
107
|
+
fields: (string & z.$brand<"PXL.FieldName">)[];
|
|
108
108
|
unique: boolean;
|
|
109
109
|
map: string | undefined;
|
|
110
110
|
}, {
|
|
111
|
-
fields: (string & z
|
|
111
|
+
fields: (string & z.$brand<"PXL.FieldName">)[];
|
|
112
112
|
unique?: boolean | undefined;
|
|
113
113
|
map?: string | undefined;
|
|
114
114
|
}>>]>>>;
|
|
@@ -136,9 +136,8 @@ export declare const zProjectSchema: z.ZodPipe<z.ZodPreprocess<z.ZodObject<{
|
|
|
136
136
|
}, z.core.$strip>>, z.ZodTransform<ProjectSchema, {
|
|
137
137
|
name: string;
|
|
138
138
|
slug: string;
|
|
139
|
-
projectType: "standalone" | "workspace";
|
|
140
|
-
source: Record<string, unknown>;
|
|
141
139
|
description?: string | undefined;
|
|
140
|
+
projectType: "standalone" | "workspace";
|
|
142
141
|
version?: string | undefined;
|
|
143
142
|
schemas?: (string | {
|
|
144
143
|
name: string;
|
|
@@ -224,13 +223,13 @@ export declare const zProjectSchema: z.ZodPipe<z.ZodPreprocess<z.ZodObject<{
|
|
|
224
223
|
separator?: string | undefined;
|
|
225
224
|
} | undefined;
|
|
226
225
|
keyField?: string | undefined;
|
|
227
|
-
defaultSort?: (string & z
|
|
226
|
+
defaultSort?: (string & z.$brand<"PXL.FieldName">)[] | undefined;
|
|
228
227
|
indexes?: ({
|
|
229
|
-
fields: (string & z
|
|
228
|
+
fields: (string & z.$brand<"PXL.FieldName">)[];
|
|
230
229
|
unique: boolean;
|
|
231
230
|
map: string | undefined;
|
|
232
231
|
} | {
|
|
233
|
-
fields: (string & z
|
|
232
|
+
fields: (string & z.$brand<"PXL.FieldName">)[];
|
|
234
233
|
unique: boolean;
|
|
235
234
|
map: string | undefined;
|
|
236
235
|
})[] | undefined;
|
|
@@ -245,13 +244,14 @@ export declare const zProjectSchema: z.ZodPipe<z.ZodPreprocess<z.ZodObject<{
|
|
|
245
244
|
enums?: {
|
|
246
245
|
name: string;
|
|
247
246
|
description: string;
|
|
247
|
+
schema?: string | undefined;
|
|
248
|
+
databaseName?: string | undefined;
|
|
248
249
|
members: (string | {
|
|
249
250
|
value: string;
|
|
250
251
|
description?: string | undefined;
|
|
251
252
|
})[];
|
|
252
|
-
schema?: string | undefined;
|
|
253
|
-
databaseName?: string | undefined;
|
|
254
253
|
}[] | undefined;
|
|
255
254
|
modelFiles?: string[] | undefined;
|
|
256
255
|
enumFiles?: string[] | undefined;
|
|
256
|
+
source: Record<string, unknown>;
|
|
257
257
|
}>>;
|