@byterings-dev/contracts 0.0.0-stage → 0.1.1
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/LICENSE +21 -0
- package/dist/api-keys.d.ts +54 -0
- package/dist/api-keys.js +23 -0
- package/dist/api-keys.js.map +1 -0
- package/dist/audit.d.ts +21 -0
- package/dist/audit.js +22 -0
- package/dist/audit.js.map +1 -0
- package/dist/auth.d.ts +76 -0
- package/dist/auth.js +39 -0
- package/dist/auth.js.map +1 -0
- package/dist/common.d.ts +27 -0
- package/dist/common.js +25 -0
- package/dist/common.js.map +1 -0
- package/dist/config.d.ts +241 -0
- package/dist/config.js +73 -0
- package/dist/config.js.map +1 -0
- package/dist/entities.d.ts +140 -0
- package/dist/entities.js +62 -0
- package/dist/entities.js.map +1 -0
- package/dist/fields.d.ts +233 -0
- package/dist/fields.js +445 -0
- package/dist/fields.js.map +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +34 -0
- package/dist/index.js.map +1 -0
- package/dist/media.d.ts +48 -0
- package/dist/media.js +46 -0
- package/dist/media.js.map +1 -0
- package/dist/members.d.ts +40 -0
- package/dist/members.js +26 -0
- package/dist/members.js.map +1 -0
- package/dist/openapi.d.ts +122 -0
- package/dist/openapi.js +958 -0
- package/dist/openapi.js.map +1 -0
- package/dist/pagination.d.ts +25 -0
- package/dist/pagination.js +30 -0
- package/dist/pagination.js.map +1 -0
- package/dist/permissions.d.ts +46 -0
- package/dist/permissions.js +73 -0
- package/dist/permissions.js.map +1 -0
- package/dist/plugins.d.ts +204 -0
- package/dist/plugins.js +108 -0
- package/dist/plugins.js.map +1 -0
- package/dist/records.d.ts +50 -0
- package/dist/records.js +47 -0
- package/dist/records.js.map +1 -0
- package/dist/release.d.ts +75 -0
- package/dist/release.js +32 -0
- package/dist/release.js.map +1 -0
- package/dist/templates.d.ts +142 -0
- package/dist/templates.js +79 -0
- package/dist/templates.js.map +1 -0
- package/dist/tenants.d.ts +52 -0
- package/dist/tenants.js +47 -0
- package/dist/tenants.js.map +1 -0
- package/package.json +29 -3
- package/README.md +0 -3
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/** Entity keys appear in URLs: lower-case, digits, hyphen, underscore. */
|
|
3
|
+
export declare const entityKeySchema: z.ZodString;
|
|
4
|
+
export declare const entityStatusSchema: z.ZodEnum<{
|
|
5
|
+
active: "active";
|
|
6
|
+
archived: "archived";
|
|
7
|
+
}>;
|
|
8
|
+
export declare const entitySchema: z.ZodObject<{
|
|
9
|
+
id: z.ZodUUID;
|
|
10
|
+
key: z.ZodString;
|
|
11
|
+
name: z.ZodString;
|
|
12
|
+
pluralName: z.ZodString;
|
|
13
|
+
description: z.ZodNullable<z.ZodString>;
|
|
14
|
+
titleField: z.ZodNullable<z.ZodString>;
|
|
15
|
+
publicRead: z.ZodBoolean;
|
|
16
|
+
publishField: z.ZodNullable<z.ZodString>;
|
|
17
|
+
publishValue: z.ZodNullable<z.ZodString>;
|
|
18
|
+
status: z.ZodEnum<{
|
|
19
|
+
active: "active";
|
|
20
|
+
archived: "archived";
|
|
21
|
+
}>;
|
|
22
|
+
owner: z.ZodString;
|
|
23
|
+
overridden: z.ZodBoolean;
|
|
24
|
+
version: z.ZodNumber;
|
|
25
|
+
fields: z.ZodArray<z.ZodObject<{
|
|
26
|
+
id: z.ZodUUID;
|
|
27
|
+
entityId: z.ZodUUID;
|
|
28
|
+
key: z.ZodString;
|
|
29
|
+
label: z.ZodString;
|
|
30
|
+
type: z.ZodEnum<{
|
|
31
|
+
boolean: "boolean";
|
|
32
|
+
date: "date";
|
|
33
|
+
datetime: "datetime";
|
|
34
|
+
text: "text";
|
|
35
|
+
longtext: "longtext";
|
|
36
|
+
integer: "integer";
|
|
37
|
+
decimal: "decimal";
|
|
38
|
+
select: "select";
|
|
39
|
+
multiselect: "multiselect";
|
|
40
|
+
relation: "relation";
|
|
41
|
+
media: "media";
|
|
42
|
+
}>;
|
|
43
|
+
description: z.ZodNullable<z.ZodString>;
|
|
44
|
+
required: z.ZodBoolean;
|
|
45
|
+
unique: z.ZodBoolean;
|
|
46
|
+
isPublic: z.ZodBoolean;
|
|
47
|
+
readMinRole: z.ZodEnum<{
|
|
48
|
+
viewer: "viewer";
|
|
49
|
+
editor: "editor";
|
|
50
|
+
admin: "admin";
|
|
51
|
+
owner: "owner";
|
|
52
|
+
}>;
|
|
53
|
+
writeMinRole: z.ZodEnum<{
|
|
54
|
+
viewer: "viewer";
|
|
55
|
+
editor: "editor";
|
|
56
|
+
admin: "admin";
|
|
57
|
+
owner: "owner";
|
|
58
|
+
}>;
|
|
59
|
+
defaultValue: z.ZodNullable<z.ZodUnknown>;
|
|
60
|
+
config: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
61
|
+
position: z.ZodNumber;
|
|
62
|
+
owner: z.ZodString;
|
|
63
|
+
overridden: z.ZodBoolean;
|
|
64
|
+
createdAt: z.ZodString;
|
|
65
|
+
updatedAt: z.ZodString;
|
|
66
|
+
}, z.core.$strip>>;
|
|
67
|
+
createdAt: z.ZodString;
|
|
68
|
+
updatedAt: z.ZodString;
|
|
69
|
+
}, z.core.$strip>;
|
|
70
|
+
export type EntityDefinition = z.infer<typeof entitySchema>;
|
|
71
|
+
export declare const createEntityRequestSchema: z.ZodObject<{
|
|
72
|
+
fields: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
73
|
+
label: z.ZodString;
|
|
74
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
75
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
76
|
+
unique: z.ZodOptional<z.ZodBoolean>;
|
|
77
|
+
isPublic: z.ZodOptional<z.ZodBoolean>;
|
|
78
|
+
readMinRole: z.ZodOptional<z.ZodEnum<{
|
|
79
|
+
viewer: "viewer";
|
|
80
|
+
editor: "editor";
|
|
81
|
+
admin: "admin";
|
|
82
|
+
owner: "owner";
|
|
83
|
+
}>>;
|
|
84
|
+
writeMinRole: z.ZodOptional<z.ZodEnum<{
|
|
85
|
+
viewer: "viewer";
|
|
86
|
+
editor: "editor";
|
|
87
|
+
admin: "admin";
|
|
88
|
+
owner: "owner";
|
|
89
|
+
}>>;
|
|
90
|
+
defaultValue: z.ZodOptional<z.ZodUnknown>;
|
|
91
|
+
config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
92
|
+
key: z.ZodString;
|
|
93
|
+
type: z.ZodEnum<{
|
|
94
|
+
boolean: "boolean";
|
|
95
|
+
date: "date";
|
|
96
|
+
datetime: "datetime";
|
|
97
|
+
text: "text";
|
|
98
|
+
longtext: "longtext";
|
|
99
|
+
integer: "integer";
|
|
100
|
+
decimal: "decimal";
|
|
101
|
+
select: "select";
|
|
102
|
+
multiselect: "multiselect";
|
|
103
|
+
relation: "relation";
|
|
104
|
+
media: "media";
|
|
105
|
+
}>;
|
|
106
|
+
}, z.core.$strip>>>;
|
|
107
|
+
name: z.ZodString;
|
|
108
|
+
pluralName: z.ZodOptional<z.ZodString>;
|
|
109
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
110
|
+
titleField: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
111
|
+
publicRead: z.ZodOptional<z.ZodBoolean>;
|
|
112
|
+
publishField: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
113
|
+
publishValue: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
114
|
+
key: z.ZodString;
|
|
115
|
+
}, z.core.$strip>;
|
|
116
|
+
export type CreateEntityRequest = z.infer<typeof createEntityRequestSchema>;
|
|
117
|
+
export declare const updateEntityRequestSchema: z.ZodObject<{
|
|
118
|
+
name: z.ZodOptional<z.ZodString>;
|
|
119
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
120
|
+
active: "active";
|
|
121
|
+
archived: "archived";
|
|
122
|
+
}>>;
|
|
123
|
+
pluralName: z.ZodOptional<z.ZodString>;
|
|
124
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
125
|
+
titleField: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
126
|
+
publicRead: z.ZodOptional<z.ZodBoolean>;
|
|
127
|
+
publishField: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
128
|
+
publishValue: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
129
|
+
}, z.core.$strip>;
|
|
130
|
+
export type UpdateEntityRequest = z.infer<typeof updateEntityRequestSchema>;
|
|
131
|
+
export declare const metadataVersionSchema: z.ZodObject<{
|
|
132
|
+
id: z.ZodUUID;
|
|
133
|
+
entityId: z.ZodUUID;
|
|
134
|
+
version: z.ZodNumber;
|
|
135
|
+
action: z.ZodString;
|
|
136
|
+
actorId: z.ZodNullable<z.ZodString>;
|
|
137
|
+
snapshot: z.ZodUnknown;
|
|
138
|
+
createdAt: z.ZodString;
|
|
139
|
+
}, z.core.$strip>;
|
|
140
|
+
export type MetadataVersion = z.infer<typeof metadataVersionSchema>;
|
package/dist/entities.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.metadataVersionSchema = exports.updateEntityRequestSchema = exports.createEntityRequestSchema = exports.entitySchema = exports.entityStatusSchema = exports.entityKeySchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const fields_1 = require("./fields");
|
|
6
|
+
/** Entity keys appear in URLs: lower-case, digits, hyphen, underscore. */
|
|
7
|
+
exports.entityKeySchema = zod_1.z
|
|
8
|
+
.string()
|
|
9
|
+
.min(1)
|
|
10
|
+
.max(63)
|
|
11
|
+
.regex(/^[a-z][a-z0-9_-]*$/, 'Start with a lower-case letter; use a-z, 0-9, - and _');
|
|
12
|
+
exports.entityStatusSchema = zod_1.z.enum(['active', 'archived']);
|
|
13
|
+
exports.entitySchema = zod_1.z.object({
|
|
14
|
+
id: zod_1.z.uuid(),
|
|
15
|
+
key: zod_1.z.string(),
|
|
16
|
+
name: zod_1.z.string(),
|
|
17
|
+
pluralName: zod_1.z.string(),
|
|
18
|
+
description: zod_1.z.string().nullable(),
|
|
19
|
+
titleField: zod_1.z.string().nullable(),
|
|
20
|
+
publicRead: zod_1.z.boolean(),
|
|
21
|
+
publishField: zod_1.z.string().nullable(),
|
|
22
|
+
publishValue: zod_1.z.string().nullable(),
|
|
23
|
+
status: exports.entityStatusSchema,
|
|
24
|
+
owner: zod_1.z.string(),
|
|
25
|
+
overridden: zod_1.z.boolean(),
|
|
26
|
+
version: zod_1.z.number().int(),
|
|
27
|
+
fields: zod_1.z.array(fields_1.fieldSchema),
|
|
28
|
+
createdAt: zod_1.z.string(),
|
|
29
|
+
updatedAt: zod_1.z.string(),
|
|
30
|
+
});
|
|
31
|
+
const mutableEntityAttributes = {
|
|
32
|
+
name: zod_1.z.string().trim().min(1).max(120),
|
|
33
|
+
pluralName: zod_1.z.string().trim().min(1).max(120).optional(),
|
|
34
|
+
description: zod_1.z.string().trim().max(1000).nullable().optional(),
|
|
35
|
+
/** Field key used as the record's display title. */
|
|
36
|
+
titleField: zod_1.z.string().max(63).nullable().optional(),
|
|
37
|
+
/** Anonymous read access through the public API (ADR-025). */
|
|
38
|
+
publicRead: zod_1.z.boolean().optional(),
|
|
39
|
+
/** Field whose value decides whether a record is published (select or boolean). */
|
|
40
|
+
publishField: zod_1.z.string().max(63).nullable().optional(),
|
|
41
|
+
publishValue: zod_1.z.string().max(100).nullable().optional(),
|
|
42
|
+
};
|
|
43
|
+
exports.createEntityRequestSchema = zod_1.z.object({
|
|
44
|
+
key: exports.entityKeySchema,
|
|
45
|
+
...mutableEntityAttributes,
|
|
46
|
+
fields: zod_1.z.array(fields_1.createFieldRequestSchema).max(200).optional(),
|
|
47
|
+
});
|
|
48
|
+
exports.updateEntityRequestSchema = zod_1.z.object({
|
|
49
|
+
...mutableEntityAttributes,
|
|
50
|
+
name: mutableEntityAttributes.name.optional(),
|
|
51
|
+
status: exports.entityStatusSchema.optional(),
|
|
52
|
+
});
|
|
53
|
+
exports.metadataVersionSchema = zod_1.z.object({
|
|
54
|
+
id: zod_1.z.uuid(),
|
|
55
|
+
entityId: zod_1.z.uuid(),
|
|
56
|
+
version: zod_1.z.number().int(),
|
|
57
|
+
action: zod_1.z.string(),
|
|
58
|
+
actorId: zod_1.z.string().nullable(),
|
|
59
|
+
snapshot: zod_1.z.unknown(),
|
|
60
|
+
createdAt: zod_1.z.string(),
|
|
61
|
+
});
|
|
62
|
+
//# sourceMappingURL=entities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entities.js","sourceRoot":"","sources":["../src/entities.ts"],"names":[],"mappings":"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"}
|
package/dist/fields.d.ts
ADDED
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Field type registry (developmentPlan §7.5). Every field type defines its
|
|
3
|
+
* configuration schema, value validation/normalization, filter operators and
|
|
4
|
+
* sort support here, once, for the API, Admin Studio and SDK.
|
|
5
|
+
*/
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
export declare const FIELD_TYPES: readonly ["text", "longtext", "integer", "decimal", "boolean", "date", "datetime", "select", "multiselect", "relation", "media"];
|
|
8
|
+
export declare const fieldTypeSchema: z.ZodEnum<{
|
|
9
|
+
boolean: "boolean";
|
|
10
|
+
date: "date";
|
|
11
|
+
datetime: "datetime";
|
|
12
|
+
text: "text";
|
|
13
|
+
longtext: "longtext";
|
|
14
|
+
integer: "integer";
|
|
15
|
+
decimal: "decimal";
|
|
16
|
+
select: "select";
|
|
17
|
+
multiselect: "multiselect";
|
|
18
|
+
relation: "relation";
|
|
19
|
+
media: "media";
|
|
20
|
+
}>;
|
|
21
|
+
export type FieldType = z.infer<typeof fieldTypeSchema>;
|
|
22
|
+
export declare const FILTER_OPERATORS: readonly ["eq", "ne", "gt", "gte", "lt", "lte", "in", "contains", "startsWith", "isNull"];
|
|
23
|
+
export type FilterOperator = (typeof FILTER_OPERATORS)[number];
|
|
24
|
+
/** Field keys: camelCase identifiers. */
|
|
25
|
+
export declare const fieldKeySchema: z.ZodString;
|
|
26
|
+
/** Keys reserved for record system attributes. */
|
|
27
|
+
export declare const RESERVED_FIELD_KEYS: Set<string>;
|
|
28
|
+
export declare const TEXT_FORMATS: readonly ["plain", "email", "url", "slug"];
|
|
29
|
+
export declare const MEDIA_KINDS: readonly ["image", "video", "audio", "document"];
|
|
30
|
+
export declare const fieldConfigSchemas: {
|
|
31
|
+
readonly text: z.ZodObject<{
|
|
32
|
+
minLength: z.ZodOptional<z.ZodNumber>;
|
|
33
|
+
maxLength: z.ZodDefault<z.ZodNumber>;
|
|
34
|
+
format: z.ZodDefault<z.ZodEnum<{
|
|
35
|
+
email: "email";
|
|
36
|
+
slug: "slug";
|
|
37
|
+
plain: "plain";
|
|
38
|
+
url: "url";
|
|
39
|
+
}>>;
|
|
40
|
+
}, z.core.$strict>;
|
|
41
|
+
readonly longtext: z.ZodObject<{
|
|
42
|
+
maxLength: z.ZodDefault<z.ZodNumber>;
|
|
43
|
+
markdown: z.ZodDefault<z.ZodBoolean>;
|
|
44
|
+
}, z.core.$strict>;
|
|
45
|
+
readonly integer: z.ZodObject<{
|
|
46
|
+
min: z.ZodOptional<z.ZodNumber>;
|
|
47
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
48
|
+
}, z.core.$strict>;
|
|
49
|
+
readonly decimal: z.ZodObject<{
|
|
50
|
+
min: z.ZodOptional<z.ZodNumber>;
|
|
51
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
52
|
+
scale: z.ZodDefault<z.ZodNumber>;
|
|
53
|
+
}, z.core.$strict>;
|
|
54
|
+
readonly boolean: z.ZodObject<{}, z.core.$strict>;
|
|
55
|
+
readonly date: z.ZodObject<{
|
|
56
|
+
min: z.ZodOptional<z.ZodISODate>;
|
|
57
|
+
max: z.ZodOptional<z.ZodISODate>;
|
|
58
|
+
}, z.core.$strict>;
|
|
59
|
+
readonly datetime: z.ZodObject<{}, z.core.$strict>;
|
|
60
|
+
readonly select: z.ZodObject<{
|
|
61
|
+
options: z.ZodArray<z.ZodObject<{
|
|
62
|
+
value: z.ZodString;
|
|
63
|
+
label: z.ZodString;
|
|
64
|
+
}, z.core.$strip>>;
|
|
65
|
+
}, z.core.$strict>;
|
|
66
|
+
readonly multiselect: z.ZodObject<{
|
|
67
|
+
options: z.ZodArray<z.ZodObject<{
|
|
68
|
+
value: z.ZodString;
|
|
69
|
+
label: z.ZodString;
|
|
70
|
+
}, z.core.$strip>>;
|
|
71
|
+
minItems: z.ZodOptional<z.ZodNumber>;
|
|
72
|
+
maxItems: z.ZodOptional<z.ZodNumber>;
|
|
73
|
+
}, z.core.$strict>;
|
|
74
|
+
readonly relation: z.ZodObject<{
|
|
75
|
+
targetEntityId: z.ZodUUID;
|
|
76
|
+
cardinality: z.ZodDefault<z.ZodEnum<{
|
|
77
|
+
one: "one";
|
|
78
|
+
many: "many";
|
|
79
|
+
}>>;
|
|
80
|
+
maxItems: z.ZodDefault<z.ZodNumber>;
|
|
81
|
+
}, z.core.$strict>;
|
|
82
|
+
readonly media: z.ZodObject<{
|
|
83
|
+
multiple: z.ZodDefault<z.ZodBoolean>;
|
|
84
|
+
accept: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
85
|
+
image: "image";
|
|
86
|
+
video: "video";
|
|
87
|
+
audio: "audio";
|
|
88
|
+
document: "document";
|
|
89
|
+
}>>>;
|
|
90
|
+
maxItems: z.ZodDefault<z.ZodNumber>;
|
|
91
|
+
}, z.core.$strict>;
|
|
92
|
+
};
|
|
93
|
+
export type FieldConfig<T extends FieldType = FieldType> = z.infer<(typeof fieldConfigSchemas)[T]>;
|
|
94
|
+
export interface FieldTypeInfo {
|
|
95
|
+
type: FieldType;
|
|
96
|
+
label: string;
|
|
97
|
+
description: string;
|
|
98
|
+
supportsUnique: boolean;
|
|
99
|
+
supportsDefault: boolean;
|
|
100
|
+
sortable: boolean;
|
|
101
|
+
operators: readonly FilterOperator[];
|
|
102
|
+
}
|
|
103
|
+
export declare const FIELD_TYPE_INFO: Readonly<Record<FieldType, FieldTypeInfo>>;
|
|
104
|
+
export declare const fieldOwnerSchema: z.ZodString;
|
|
105
|
+
export declare const fieldSchema: z.ZodObject<{
|
|
106
|
+
id: z.ZodUUID;
|
|
107
|
+
entityId: z.ZodUUID;
|
|
108
|
+
key: z.ZodString;
|
|
109
|
+
label: z.ZodString;
|
|
110
|
+
type: z.ZodEnum<{
|
|
111
|
+
boolean: "boolean";
|
|
112
|
+
date: "date";
|
|
113
|
+
datetime: "datetime";
|
|
114
|
+
text: "text";
|
|
115
|
+
longtext: "longtext";
|
|
116
|
+
integer: "integer";
|
|
117
|
+
decimal: "decimal";
|
|
118
|
+
select: "select";
|
|
119
|
+
multiselect: "multiselect";
|
|
120
|
+
relation: "relation";
|
|
121
|
+
media: "media";
|
|
122
|
+
}>;
|
|
123
|
+
description: z.ZodNullable<z.ZodString>;
|
|
124
|
+
required: z.ZodBoolean;
|
|
125
|
+
unique: z.ZodBoolean;
|
|
126
|
+
isPublic: z.ZodBoolean;
|
|
127
|
+
readMinRole: z.ZodEnum<{
|
|
128
|
+
viewer: "viewer";
|
|
129
|
+
editor: "editor";
|
|
130
|
+
admin: "admin";
|
|
131
|
+
owner: "owner";
|
|
132
|
+
}>;
|
|
133
|
+
writeMinRole: z.ZodEnum<{
|
|
134
|
+
viewer: "viewer";
|
|
135
|
+
editor: "editor";
|
|
136
|
+
admin: "admin";
|
|
137
|
+
owner: "owner";
|
|
138
|
+
}>;
|
|
139
|
+
defaultValue: z.ZodNullable<z.ZodUnknown>;
|
|
140
|
+
config: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
141
|
+
position: z.ZodNumber;
|
|
142
|
+
owner: z.ZodString;
|
|
143
|
+
overridden: z.ZodBoolean;
|
|
144
|
+
createdAt: z.ZodString;
|
|
145
|
+
updatedAt: z.ZodString;
|
|
146
|
+
}, z.core.$strip>;
|
|
147
|
+
export type FieldDefinition = z.infer<typeof fieldSchema>;
|
|
148
|
+
export declare const createFieldRequestSchema: z.ZodObject<{
|
|
149
|
+
label: z.ZodString;
|
|
150
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
151
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
152
|
+
unique: z.ZodOptional<z.ZodBoolean>;
|
|
153
|
+
isPublic: z.ZodOptional<z.ZodBoolean>;
|
|
154
|
+
readMinRole: z.ZodOptional<z.ZodEnum<{
|
|
155
|
+
viewer: "viewer";
|
|
156
|
+
editor: "editor";
|
|
157
|
+
admin: "admin";
|
|
158
|
+
owner: "owner";
|
|
159
|
+
}>>;
|
|
160
|
+
writeMinRole: z.ZodOptional<z.ZodEnum<{
|
|
161
|
+
viewer: "viewer";
|
|
162
|
+
editor: "editor";
|
|
163
|
+
admin: "admin";
|
|
164
|
+
owner: "owner";
|
|
165
|
+
}>>;
|
|
166
|
+
defaultValue: z.ZodOptional<z.ZodUnknown>;
|
|
167
|
+
config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
168
|
+
key: z.ZodString;
|
|
169
|
+
type: z.ZodEnum<{
|
|
170
|
+
boolean: "boolean";
|
|
171
|
+
date: "date";
|
|
172
|
+
datetime: "datetime";
|
|
173
|
+
text: "text";
|
|
174
|
+
longtext: "longtext";
|
|
175
|
+
integer: "integer";
|
|
176
|
+
decimal: "decimal";
|
|
177
|
+
select: "select";
|
|
178
|
+
multiselect: "multiselect";
|
|
179
|
+
relation: "relation";
|
|
180
|
+
media: "media";
|
|
181
|
+
}>;
|
|
182
|
+
}, z.core.$strip>;
|
|
183
|
+
export type CreateFieldRequest = z.infer<typeof createFieldRequestSchema>;
|
|
184
|
+
export declare const updateFieldRequestSchema: z.ZodObject<{
|
|
185
|
+
label: z.ZodOptional<z.ZodString>;
|
|
186
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
187
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
188
|
+
unique: z.ZodOptional<z.ZodBoolean>;
|
|
189
|
+
isPublic: z.ZodOptional<z.ZodBoolean>;
|
|
190
|
+
readMinRole: z.ZodOptional<z.ZodEnum<{
|
|
191
|
+
viewer: "viewer";
|
|
192
|
+
editor: "editor";
|
|
193
|
+
admin: "admin";
|
|
194
|
+
owner: "owner";
|
|
195
|
+
}>>;
|
|
196
|
+
writeMinRole: z.ZodOptional<z.ZodEnum<{
|
|
197
|
+
viewer: "viewer";
|
|
198
|
+
editor: "editor";
|
|
199
|
+
admin: "admin";
|
|
200
|
+
owner: "owner";
|
|
201
|
+
}>>;
|
|
202
|
+
defaultValue: z.ZodOptional<z.ZodUnknown>;
|
|
203
|
+
config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
204
|
+
}, z.core.$strip>;
|
|
205
|
+
export type UpdateFieldRequest = z.infer<typeof updateFieldRequestSchema>;
|
|
206
|
+
export declare const reorderFieldsRequestSchema: z.ZodObject<{
|
|
207
|
+
fieldIds: z.ZodArray<z.ZodUUID>;
|
|
208
|
+
}, z.core.$strip>;
|
|
209
|
+
export type ReorderFieldsRequest = z.infer<typeof reorderFieldsRequestSchema>;
|
|
210
|
+
/** Parses and defaults a field's type-specific configuration. */
|
|
211
|
+
export declare function parseFieldConfig(type: FieldType, config: unknown): ReturnType<(typeof fieldConfigSchemas)[FieldType]['safeParse']>;
|
|
212
|
+
/** Minimal field shape needed to validate values. */
|
|
213
|
+
export interface ValueFieldShape {
|
|
214
|
+
key: string;
|
|
215
|
+
type: FieldType;
|
|
216
|
+
required: boolean;
|
|
217
|
+
config: Record<string, unknown>;
|
|
218
|
+
}
|
|
219
|
+
/** Zod schema for a single non-null value of the field. */
|
|
220
|
+
export declare function nonNullValueSchema(field: Pick<ValueFieldShape, 'type' | 'config'>): z.ZodType;
|
|
221
|
+
/** True when a value counts as "empty" for required checks. */
|
|
222
|
+
export declare function isEmptyValue(value: unknown): boolean;
|
|
223
|
+
/**
|
|
224
|
+
* Validates one value. Returns the normalized value or an error message.
|
|
225
|
+
* `null` clears an optional field.
|
|
226
|
+
*/
|
|
227
|
+
export declare function validateFieldValue(field: ValueFieldShape, value: unknown): {
|
|
228
|
+
ok: true;
|
|
229
|
+
value: unknown;
|
|
230
|
+
} | {
|
|
231
|
+
ok: false;
|
|
232
|
+
message: string;
|
|
233
|
+
};
|