@postxl/schema 2.0.1 → 2.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/model/model.json-decoder.d.ts +44 -1
- package/dist/model/model.json-decoder.js +46 -4
- package/dist/model/model.transformer.d.ts +40 -4
- package/dist/model/model.transformer.js +4 -3
- package/dist/model/model.types.d.ts +21 -1
- package/dist/project-schema/project-schema.json-decoder.d.ts +18 -1
- package/dist/project-schema/project-schema.transformer.d.ts +28 -2
- package/dist/samples/sample-schemas.d.ts +4 -0
- package/dist/samples/simple.schema.json +1 -0
- package/package.json +2 -2
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export declare const zModelNameJSON: z.ZodString;
|
|
3
|
+
/**
|
|
4
|
+
* A single composite index entry. Two input shapes are accepted and normalized to
|
|
5
|
+
* the canonical `{ fields, unique, map }` object:
|
|
6
|
+
*
|
|
7
|
+
* - Array shorthand `["a", "b"]` → a multi-column UNIQUE index (`unique: true`),
|
|
8
|
+
* preserving the historical behavior of the `indexes` field.
|
|
9
|
+
* - Object `{ fields, unique?, map? }` → `unique` defaults to `false` (a plain
|
|
10
|
+
* `@@index`), with optional `map` to pin the database constraint name.
|
|
11
|
+
*/
|
|
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.core.$brand<"PXL.FieldName">)[];
|
|
14
|
+
unique: boolean;
|
|
15
|
+
map: string | undefined;
|
|
16
|
+
}, (string & z.core.$brand<"PXL.FieldName">)[]>>, z.ZodPipe<z.ZodObject<{
|
|
17
|
+
fields: z.ZodArray<z.core.$ZodBranded<z.ZodString, "PXL.FieldName", "out">>;
|
|
18
|
+
unique: z.ZodOptional<z.ZodBoolean>;
|
|
19
|
+
map: z.ZodOptional<z.ZodString>;
|
|
20
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
21
|
+
fields: (string & z.core.$brand<"PXL.FieldName">)[];
|
|
22
|
+
unique: boolean;
|
|
23
|
+
map: string | undefined;
|
|
24
|
+
}, {
|
|
25
|
+
fields: (string & z.core.$brand<"PXL.FieldName">)[];
|
|
26
|
+
unique?: boolean | undefined;
|
|
27
|
+
map?: string | undefined;
|
|
28
|
+
}>>]>;
|
|
3
29
|
export declare const zModelJSON: z.ZodPreprocess<z.ZodObject<{
|
|
4
30
|
name: z.ZodString;
|
|
5
31
|
description: z.ZodOptional<z.ZodString>;
|
|
@@ -27,6 +53,7 @@ export declare const zModelJSON: z.ZodPreprocess<z.ZodObject<{
|
|
|
27
53
|
visibleFor: z.ZodArray<z.ZodString>;
|
|
28
54
|
}, z.core.$strip>>;
|
|
29
55
|
}, z.core.$strip>>;
|
|
56
|
+
exposeRestApi: z.ZodOptional<z.ZodBoolean>;
|
|
30
57
|
schema: z.ZodOptional<z.ZodString>;
|
|
31
58
|
databaseName: z.ZodOptional<z.ZodString>;
|
|
32
59
|
excelName: z.ZodOptional<z.ZodString>;
|
|
@@ -38,7 +65,23 @@ export declare const zModelJSON: z.ZodPreprocess<z.ZodObject<{
|
|
|
38
65
|
labelField: z.ZodOptional<z.ZodString>;
|
|
39
66
|
keyField: z.ZodOptional<z.ZodString>;
|
|
40
67
|
defaultSort: z.ZodOptional<z.ZodArray<z.core.$ZodBranded<z.ZodString, "PXL.FieldName", "out">>>;
|
|
41
|
-
indexes: z.ZodOptional<z.ZodArray<z.ZodArray<z.core.$ZodBranded<z.ZodString, "PXL.FieldName", "out"
|
|
68
|
+
indexes: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodPipe<z.ZodArray<z.core.$ZodBranded<z.ZodString, "PXL.FieldName", "out">>, z.ZodTransform<{
|
|
69
|
+
fields: (string & z.core.$brand<"PXL.FieldName">)[];
|
|
70
|
+
unique: boolean;
|
|
71
|
+
map: string | undefined;
|
|
72
|
+
}, (string & z.core.$brand<"PXL.FieldName">)[]>>, z.ZodPipe<z.ZodObject<{
|
|
73
|
+
fields: z.ZodArray<z.core.$ZodBranded<z.ZodString, "PXL.FieldName", "out">>;
|
|
74
|
+
unique: z.ZodOptional<z.ZodBoolean>;
|
|
75
|
+
map: z.ZodOptional<z.ZodString>;
|
|
76
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
77
|
+
fields: (string & z.core.$brand<"PXL.FieldName">)[];
|
|
78
|
+
unique: boolean;
|
|
79
|
+
map: string | undefined;
|
|
80
|
+
}, {
|
|
81
|
+
fields: (string & z.core.$brand<"PXL.FieldName">)[];
|
|
82
|
+
unique?: boolean | undefined;
|
|
83
|
+
map?: string | undefined;
|
|
84
|
+
}>>]>>>;
|
|
42
85
|
seed: z.ZodOptional<z.ZodArray<z.ZodAny>>;
|
|
43
86
|
source: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
44
87
|
faker: z.ZodOptional<z.ZodObject<{
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.zModelJSON = exports.zModelNameJSON = void 0;
|
|
3
|
+
exports.zModelJSON = exports.zModelIndexJSON = exports.zModelNameJSON = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const utils_1 = require("@postxl/utils");
|
|
6
6
|
const brands_1 = require("../field/shared/brands");
|
|
@@ -17,6 +17,33 @@ exports.zModelNameJSON = zod_1.z
|
|
|
17
17
|
error: (issue) => `Model name "${(0, utils_1.red)(issue.input)}" must be PascalCase, i.e. ${(0, utils_1.toPascalCase)(issue.input)}!`,
|
|
18
18
|
})
|
|
19
19
|
.describe('Name of the model.');
|
|
20
|
+
const zModelIndexFields = zod_1.z.array(brands_1.zFieldName).min(1, { error: 'Index must have at least 1 field' });
|
|
21
|
+
/**
|
|
22
|
+
* A single composite index entry. Two input shapes are accepted and normalized to
|
|
23
|
+
* the canonical `{ fields, unique, map }` object:
|
|
24
|
+
*
|
|
25
|
+
* - Array shorthand `["a", "b"]` → a multi-column UNIQUE index (`unique: true`),
|
|
26
|
+
* preserving the historical behavior of the `indexes` field.
|
|
27
|
+
* - Object `{ fields, unique?, map? }` → `unique` defaults to `false` (a plain
|
|
28
|
+
* `@@index`), with optional `map` to pin the database constraint name.
|
|
29
|
+
*/
|
|
30
|
+
exports.zModelIndexJSON = zod_1.z.union([
|
|
31
|
+
zModelIndexFields.transform((fields) => ({ fields, unique: true, map: undefined })),
|
|
32
|
+
zod_1.z
|
|
33
|
+
.object({
|
|
34
|
+
fields: zModelIndexFields.describe('The field names that make up the index, in index order.'),
|
|
35
|
+
unique: zod_1.z
|
|
36
|
+
.boolean()
|
|
37
|
+
.optional()
|
|
38
|
+
.describe('Emit a `@@unique` multi-column constraint instead of a plain `@@index`. Defaults to `false`.'),
|
|
39
|
+
map: zod_1.z
|
|
40
|
+
.string()
|
|
41
|
+
.min(1, { error: 'Index `map` must not be empty' })
|
|
42
|
+
.optional()
|
|
43
|
+
.describe('Explicit database constraint/index name (Prisma `map:`). Match an existing name to avoid drift.'),
|
|
44
|
+
})
|
|
45
|
+
.transform(({ fields, unique, map }) => ({ fields, unique: unique ?? false, map })),
|
|
46
|
+
]);
|
|
20
47
|
exports.zModelJSON = zod_1.z.preprocess((input) => {
|
|
21
48
|
if (typeof input === 'object' && input !== null) {
|
|
22
49
|
const original = input;
|
|
@@ -41,6 +68,13 @@ exports.zModelJSON = zod_1.z.preprocess((input) => {
|
|
|
41
68
|
.optional()
|
|
42
69
|
.describe(`Indicates if the model is readonly. To be used for system models that should not be editable through actions (e.g. Mutation, Action).`),
|
|
43
70
|
auth: project_schema_auth_1.zAuthRuleSetJSON.optional().describe('Authorization rules for this model.'),
|
|
71
|
+
exposeRestApi: zod_1.z
|
|
72
|
+
.boolean()
|
|
73
|
+
.optional()
|
|
74
|
+
.describe(`Expose this model through the generated REST API (\`backend-rest-api\`). Defaults to \`false\`.
|
|
75
|
+
Opt-in is deliberate: forgetting to opt out would silently publish the model's rows,
|
|
76
|
+
whereas forgetting to opt in only produces a missing route. The REST API as a whole is
|
|
77
|
+
additionally gated behind the \`REST_API_ENABLED\` environment variable.`),
|
|
44
78
|
//
|
|
45
79
|
schema: zod_1.z
|
|
46
80
|
//
|
|
@@ -98,9 +132,17 @@ The key field is used in navigation, Excel import, and other places where a huma
|
|
|
98
132
|
Each entry references a field name and is applied ascending in the given order.`),
|
|
99
133
|
indexes: zod_1.z
|
|
100
134
|
//
|
|
101
|
-
.array(
|
|
102
|
-
.optional()
|
|
103
|
-
|
|
135
|
+
.array(exports.zModelIndexJSON)
|
|
136
|
+
.optional().describe(`Composite (multi-column) indexes for the model.
|
|
137
|
+
|
|
138
|
+
Each entry is either:
|
|
139
|
+
- a shorthand array of field names (\`["a", "b"]\`), which creates a multi-column UNIQUE index, or
|
|
140
|
+
- an object \`{ "fields": ["a", "b"], "unique": false, "map": "my_index_name" }\` where
|
|
141
|
+
\`unique\` defaults to \`false\` (a plain \`@@index\`) and \`map\` optionally pins the
|
|
142
|
+
database constraint/index name (use it to match an existing constraint so Prisma
|
|
143
|
+
reports no drift).
|
|
144
|
+
|
|
145
|
+
Field order is preserved verbatim in the generated Prisma index.`),
|
|
104
146
|
seed: zod_1.z
|
|
105
147
|
.array(zod_1.z.any())
|
|
106
148
|
.optional()
|
|
@@ -14,9 +14,18 @@ export declare function modelJSONTransformer(input: ModelJSON, ctx: z.Refinement
|
|
|
14
14
|
keyFieldName: (string & z.core.$brand<"PXL.FieldName">) | undefined;
|
|
15
15
|
defaultSort: (string & z.core.$brand<"PXL.FieldName">)[] | undefined;
|
|
16
16
|
isReadonly: boolean;
|
|
17
|
+
exposeRestApi: boolean;
|
|
17
18
|
excelName: string;
|
|
18
19
|
description: string;
|
|
19
|
-
indexes: (
|
|
20
|
+
indexes: ({
|
|
21
|
+
fields: (string & z.core.$brand<"PXL.FieldName">)[];
|
|
22
|
+
unique: boolean;
|
|
23
|
+
map: string | undefined;
|
|
24
|
+
} | {
|
|
25
|
+
fields: (string & z.core.$brand<"PXL.FieldName">)[];
|
|
26
|
+
unique: boolean;
|
|
27
|
+
map: string | undefined;
|
|
28
|
+
})[];
|
|
20
29
|
seed: any[];
|
|
21
30
|
faker: {
|
|
22
31
|
seed: number;
|
|
@@ -50,6 +59,7 @@ export declare function modelJSONTransformer(input: ModelJSON, ctx: z.Refinement
|
|
|
50
59
|
export type ModelEnriched = ReturnType<typeof modelJSONTransformer>;
|
|
51
60
|
declare function addDefaults({ description, fields, standardFields, seed, faker, ...input }: ModelJSON): {
|
|
52
61
|
isReadonly: boolean;
|
|
62
|
+
exposeRestApi: boolean;
|
|
53
63
|
databaseName: string;
|
|
54
64
|
excelName: string;
|
|
55
65
|
description: string;
|
|
@@ -58,7 +68,15 @@ declare function addDefaults({ description, fields, standardFields, seed, faker,
|
|
|
58
68
|
name: string;
|
|
59
69
|
}[];
|
|
60
70
|
standardFields: string[];
|
|
61
|
-
indexes: (
|
|
71
|
+
indexes: ({
|
|
72
|
+
fields: (string & z.core.$brand<"PXL.FieldName">)[];
|
|
73
|
+
unique: boolean;
|
|
74
|
+
map: string | undefined;
|
|
75
|
+
} | {
|
|
76
|
+
fields: (string & z.core.$brand<"PXL.FieldName">)[];
|
|
77
|
+
unique: boolean;
|
|
78
|
+
map: string | undefined;
|
|
79
|
+
})[];
|
|
62
80
|
seed: any[];
|
|
63
81
|
faker: {
|
|
64
82
|
seed: number;
|
|
@@ -106,13 +124,22 @@ declare function brandModel({ name, schema, databaseName, standardFields, defaul
|
|
|
106
124
|
keyFieldName: (string & z.core.$brand<"PXL.FieldName">) | undefined;
|
|
107
125
|
defaultSort: (string & z.core.$brand<"PXL.FieldName">)[] | undefined;
|
|
108
126
|
isReadonly: boolean;
|
|
127
|
+
exposeRestApi: boolean;
|
|
109
128
|
excelName: string;
|
|
110
129
|
description: string;
|
|
111
130
|
fields: {
|
|
112
131
|
[x: string]: unknown;
|
|
113
132
|
name: string;
|
|
114
133
|
}[];
|
|
115
|
-
indexes: (
|
|
134
|
+
indexes: ({
|
|
135
|
+
fields: (string & z.core.$brand<"PXL.FieldName">)[];
|
|
136
|
+
unique: boolean;
|
|
137
|
+
map: string | undefined;
|
|
138
|
+
} | {
|
|
139
|
+
fields: (string & z.core.$brand<"PXL.FieldName">)[];
|
|
140
|
+
unique: boolean;
|
|
141
|
+
map: string | undefined;
|
|
142
|
+
})[];
|
|
116
143
|
seed: any[];
|
|
117
144
|
faker: {
|
|
118
145
|
seed: number;
|
|
@@ -158,9 +185,18 @@ declare function combineFields({ fields, standardFields, ...model }: BrandedMode
|
|
|
158
185
|
keyFieldName: (string & z.core.$brand<"PXL.FieldName">) | undefined;
|
|
159
186
|
defaultSort: (string & z.core.$brand<"PXL.FieldName">)[] | undefined;
|
|
160
187
|
isReadonly: boolean;
|
|
188
|
+
exposeRestApi: boolean;
|
|
161
189
|
excelName: string;
|
|
162
190
|
description: string;
|
|
163
|
-
indexes: (
|
|
191
|
+
indexes: ({
|
|
192
|
+
fields: (string & z.core.$brand<"PXL.FieldName">)[];
|
|
193
|
+
unique: boolean;
|
|
194
|
+
map: string | undefined;
|
|
195
|
+
} | {
|
|
196
|
+
fields: (string & z.core.$brand<"PXL.FieldName">)[];
|
|
197
|
+
unique: boolean;
|
|
198
|
+
map: string | undefined;
|
|
199
|
+
})[];
|
|
164
200
|
seed: any[];
|
|
165
201
|
faker: {
|
|
166
202
|
seed: number;
|
|
@@ -51,6 +51,7 @@ function addDefaults({ description, fields, standardFields, seed, faker, ...inpu
|
|
|
51
51
|
return {
|
|
52
52
|
...input,
|
|
53
53
|
isReadonly: input.isReadonly ?? false,
|
|
54
|
+
exposeRestApi: input.exposeRestApi ?? false,
|
|
54
55
|
databaseName: input.databaseName ?? (0, utils_1.toSnakeCase)(input.name),
|
|
55
56
|
excelName: input.excelName ?? (0, utils_1.toExcelColumnName)((0, utils_1.toPascalCase)((0, utils_1.pluralize)(input.name))),
|
|
56
57
|
description: description ?? '',
|
|
@@ -128,16 +129,16 @@ function combineFields({ fields, standardFields, ...model }, ctx) {
|
|
|
128
129
|
function validateIndexes({ fields, indexes, ...model }, ctx) {
|
|
129
130
|
const checkedIndexes = new Set();
|
|
130
131
|
for (const index of indexes) {
|
|
131
|
-
for (const fieldName of index) {
|
|
132
|
+
for (const fieldName of index.fields) {
|
|
132
133
|
if (!fields[fieldName]) {
|
|
133
134
|
ctx.addIssue({
|
|
134
135
|
code: zod_1.z.ZodIssueCode.custom,
|
|
135
|
-
message: `Index [${index.join(',')} ]in model ${model.name} references unknown field ${fieldName}!`,
|
|
136
|
+
message: `Index [${index.fields.join(',')} ]in model ${model.name} references unknown field ${fieldName}!`,
|
|
136
137
|
});
|
|
137
138
|
return zod_1.z.NEVER;
|
|
138
139
|
}
|
|
139
140
|
}
|
|
140
|
-
const indexName = index.toSorted((a, b) => a.localeCompare(b)).join(',');
|
|
141
|
+
const indexName = index.fields.toSorted((a, b) => a.localeCompare(b)).join(',');
|
|
141
142
|
if (checkedIndexes.has(indexName)) {
|
|
142
143
|
ctx.addIssue({
|
|
143
144
|
code: zod_1.z.ZodIssueCode.custom,
|
|
@@ -7,6 +7,10 @@ export type Model = {
|
|
|
7
7
|
name: Branded.ModelName;
|
|
8
8
|
description: string;
|
|
9
9
|
isReadonly: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Whether the model is exposed through the generated REST API. Defaults to `false`.
|
|
12
|
+
*/
|
|
13
|
+
exposeRestApi: boolean;
|
|
10
14
|
databaseSchema: DatabaseSchemaName;
|
|
11
15
|
databaseName: string;
|
|
12
16
|
excelName: string;
|
|
@@ -47,5 +51,21 @@ export type Model = {
|
|
|
47
51
|
};
|
|
48
52
|
auth?: AuthRuleSet;
|
|
49
53
|
};
|
|
50
|
-
export type ModelIndex =
|
|
54
|
+
export type ModelIndex = {
|
|
55
|
+
/**
|
|
56
|
+
* The field names that make up the index, in the order they should be indexed.
|
|
57
|
+
* Order is preserved verbatim in the generated Prisma `@@index`/`@@unique`.
|
|
58
|
+
*/
|
|
59
|
+
fields: Field.FieldName[];
|
|
60
|
+
/**
|
|
61
|
+
* When `true`, the index is emitted as a `@@unique([...])` multi-column unique
|
|
62
|
+
* constraint; otherwise as a non-unique `@@index([...])`.
|
|
63
|
+
*/
|
|
64
|
+
unique: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Optional explicit constraint/index name (Prisma `map:`). Set this to match an
|
|
67
|
+
* existing database constraint name so Prisma sees a no-op instead of drift.
|
|
68
|
+
*/
|
|
69
|
+
map: string | undefined;
|
|
70
|
+
};
|
|
51
71
|
export type Seed = Record<string, unknown>;
|
|
@@ -99,6 +99,7 @@ export declare const zProjectSchemaJSON: z.ZodPreprocess<z.ZodObject<{
|
|
|
99
99
|
visibleFor: z.ZodArray<z.ZodString>;
|
|
100
100
|
}, z.core.$strip>>;
|
|
101
101
|
}, z.core.$strip>>;
|
|
102
|
+
exposeRestApi: z.ZodOptional<z.ZodBoolean>;
|
|
102
103
|
schema: z.ZodOptional<z.ZodString>;
|
|
103
104
|
databaseName: z.ZodOptional<z.ZodString>;
|
|
104
105
|
excelName: z.ZodOptional<z.ZodString>;
|
|
@@ -110,7 +111,23 @@ export declare const zProjectSchemaJSON: z.ZodPreprocess<z.ZodObject<{
|
|
|
110
111
|
labelField: z.ZodOptional<z.ZodString>;
|
|
111
112
|
keyField: z.ZodOptional<z.ZodString>;
|
|
112
113
|
defaultSort: z.ZodOptional<z.ZodArray<z.core.$ZodBranded<z.ZodString, "PXL.FieldName", "out">>>;
|
|
113
|
-
indexes: z.ZodOptional<z.ZodArray<z.ZodArray<z.core.$ZodBranded<z.ZodString, "PXL.FieldName", "out"
|
|
114
|
+
indexes: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodPipe<z.ZodArray<z.core.$ZodBranded<z.ZodString, "PXL.FieldName", "out">>, z.ZodTransform<{
|
|
115
|
+
fields: (string & z.core.$brand<"PXL.FieldName">)[];
|
|
116
|
+
unique: boolean;
|
|
117
|
+
map: string | undefined;
|
|
118
|
+
}, (string & z.core.$brand<"PXL.FieldName">)[]>>, z.ZodPipe<z.ZodObject<{
|
|
119
|
+
fields: z.ZodArray<z.core.$ZodBranded<z.ZodString, "PXL.FieldName", "out">>;
|
|
120
|
+
unique: z.ZodOptional<z.ZodBoolean>;
|
|
121
|
+
map: z.ZodOptional<z.ZodString>;
|
|
122
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
123
|
+
fields: (string & z.core.$brand<"PXL.FieldName">)[];
|
|
124
|
+
unique: boolean;
|
|
125
|
+
map: string | undefined;
|
|
126
|
+
}, {
|
|
127
|
+
fields: (string & z.core.$brand<"PXL.FieldName">)[];
|
|
128
|
+
unique?: boolean | undefined;
|
|
129
|
+
map?: string | undefined;
|
|
130
|
+
}>>]>>>;
|
|
114
131
|
seed: z.ZodOptional<z.ZodArray<z.ZodAny>>;
|
|
115
132
|
source: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
116
133
|
faker: z.ZodOptional<z.ZodObject<{
|
|
@@ -78,6 +78,7 @@ export declare const zProjectSchema: z.ZodPipe<z.ZodPreprocess<z.ZodObject<{
|
|
|
78
78
|
visibleFor: z.ZodArray<z.ZodString>;
|
|
79
79
|
}, z.core.$strip>>;
|
|
80
80
|
}, z.core.$strip>>;
|
|
81
|
+
exposeRestApi: z.ZodOptional<z.ZodBoolean>;
|
|
81
82
|
schema: z.ZodOptional<z.ZodString>;
|
|
82
83
|
databaseName: z.ZodOptional<z.ZodString>;
|
|
83
84
|
excelName: z.ZodOptional<z.ZodString>;
|
|
@@ -89,7 +90,23 @@ export declare const zProjectSchema: z.ZodPipe<z.ZodPreprocess<z.ZodObject<{
|
|
|
89
90
|
labelField: z.ZodOptional<z.ZodString>;
|
|
90
91
|
keyField: z.ZodOptional<z.ZodString>;
|
|
91
92
|
defaultSort: z.ZodOptional<z.ZodArray<z.core.$ZodBranded<z.ZodString, "PXL.FieldName", "out">>>;
|
|
92
|
-
indexes: z.ZodOptional<z.ZodArray<z.ZodArray<z.core.$ZodBranded<z.ZodString, "PXL.FieldName", "out"
|
|
93
|
+
indexes: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodPipe<z.ZodArray<z.core.$ZodBranded<z.ZodString, "PXL.FieldName", "out">>, z.ZodTransform<{
|
|
94
|
+
fields: (string & z.core.$brand<"PXL.FieldName">)[];
|
|
95
|
+
unique: boolean;
|
|
96
|
+
map: string | undefined;
|
|
97
|
+
}, (string & z.core.$brand<"PXL.FieldName">)[]>>, z.ZodPipe<z.ZodObject<{
|
|
98
|
+
fields: z.ZodArray<z.core.$ZodBranded<z.ZodString, "PXL.FieldName", "out">>;
|
|
99
|
+
unique: z.ZodOptional<z.ZodBoolean>;
|
|
100
|
+
map: z.ZodOptional<z.ZodString>;
|
|
101
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
102
|
+
fields: (string & z.core.$brand<"PXL.FieldName">)[];
|
|
103
|
+
unique: boolean;
|
|
104
|
+
map: string | undefined;
|
|
105
|
+
}, {
|
|
106
|
+
fields: (string & z.core.$brand<"PXL.FieldName">)[];
|
|
107
|
+
unique?: boolean | undefined;
|
|
108
|
+
map?: string | undefined;
|
|
109
|
+
}>>]>>>;
|
|
93
110
|
seed: z.ZodOptional<z.ZodArray<z.ZodAny>>;
|
|
94
111
|
source: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
95
112
|
faker: z.ZodOptional<z.ZodObject<{
|
|
@@ -185,6 +202,7 @@ export declare const zProjectSchema: z.ZodPipe<z.ZodPreprocess<z.ZodObject<{
|
|
|
185
202
|
visibleFor: string[];
|
|
186
203
|
} | undefined;
|
|
187
204
|
} | undefined;
|
|
205
|
+
exposeRestApi?: boolean | undefined;
|
|
188
206
|
schema?: string | undefined;
|
|
189
207
|
databaseName?: string | undefined;
|
|
190
208
|
excelName?: string | undefined;
|
|
@@ -197,7 +215,15 @@ export declare const zProjectSchema: z.ZodPipe<z.ZodPreprocess<z.ZodObject<{
|
|
|
197
215
|
labelField?: string | undefined;
|
|
198
216
|
keyField?: string | undefined;
|
|
199
217
|
defaultSort?: (string & z.core.$brand<"PXL.FieldName">)[] | undefined;
|
|
200
|
-
indexes?: (
|
|
218
|
+
indexes?: ({
|
|
219
|
+
fields: (string & z.core.$brand<"PXL.FieldName">)[];
|
|
220
|
+
unique: boolean;
|
|
221
|
+
map: string | undefined;
|
|
222
|
+
} | {
|
|
223
|
+
fields: (string & z.core.$brand<"PXL.FieldName">)[];
|
|
224
|
+
unique: boolean;
|
|
225
|
+
map: string | undefined;
|
|
226
|
+
})[] | undefined;
|
|
201
227
|
seed?: any[] | undefined;
|
|
202
228
|
source?: Record<string, unknown> | undefined;
|
|
203
229
|
faker?: {
|
|
@@ -1771,6 +1771,7 @@ export declare const sampleSchemas: {
|
|
|
1771
1771
|
faker: {
|
|
1772
1772
|
items: number;
|
|
1773
1773
|
};
|
|
1774
|
+
exposeRestApi?: never;
|
|
1774
1775
|
standardFields?: never;
|
|
1775
1776
|
labelField?: never;
|
|
1776
1777
|
standardActions?: never;
|
|
@@ -1781,6 +1782,7 @@ export declare const sampleSchemas: {
|
|
|
1781
1782
|
name: string;
|
|
1782
1783
|
description: string;
|
|
1783
1784
|
schema: string;
|
|
1785
|
+
exposeRestApi: boolean;
|
|
1784
1786
|
fields: ({
|
|
1785
1787
|
name: string;
|
|
1786
1788
|
type: string;
|
|
@@ -1857,6 +1859,7 @@ export declare const sampleSchemas: {
|
|
|
1857
1859
|
};
|
|
1858
1860
|
defaultField?: never;
|
|
1859
1861
|
seed?: never;
|
|
1862
|
+
exposeRestApi?: never;
|
|
1860
1863
|
standardFields?: never;
|
|
1861
1864
|
labelField?: never;
|
|
1862
1865
|
isReadonly?: never;
|
|
@@ -1886,6 +1889,7 @@ export declare const sampleSchemas: {
|
|
|
1886
1889
|
defaultField?: never;
|
|
1887
1890
|
seed?: never;
|
|
1888
1891
|
faker?: never;
|
|
1892
|
+
exposeRestApi?: never;
|
|
1889
1893
|
labelField?: never;
|
|
1890
1894
|
standardActions?: never;
|
|
1891
1895
|
actions?: never;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@postxl/schema",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "Decoders for PXL Schema definitions and validation for PXL code generation framework",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"directory": "packages/schema"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@postxl/utils": "^1.4.
|
|
39
|
+
"@postxl/utils": "^1.4.2"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {},
|
|
42
42
|
"wallaby": {
|