@usehercules/sdk 1.8.0 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +42 -0
- package/client.d.mts +0 -3
- package/client.d.mts.map +1 -1
- package/client.d.ts +0 -3
- package/client.d.ts.map +1 -1
- package/client.js +2 -15
- package/client.js.map +1 -1
- package/client.mjs +2 -15
- package/client.mjs.map +1 -1
- package/internal/qs/formats.d.mts +7 -0
- package/internal/qs/formats.d.mts.map +1 -0
- package/internal/qs/formats.d.ts +7 -0
- package/internal/qs/formats.d.ts.map +1 -0
- package/internal/qs/formats.js +13 -0
- package/internal/qs/formats.js.map +1 -0
- package/internal/qs/formats.mjs +9 -0
- package/internal/qs/formats.mjs.map +1 -0
- package/internal/qs/index.d.mts +10 -0
- package/internal/qs/index.d.mts.map +1 -0
- package/internal/qs/index.d.ts +10 -0
- package/internal/qs/index.d.ts.map +1 -0
- package/internal/qs/index.js +14 -0
- package/internal/qs/index.js.map +1 -0
- package/internal/qs/index.mjs +10 -0
- package/internal/qs/index.mjs.map +1 -0
- package/internal/qs/stringify.d.mts +3 -0
- package/internal/qs/stringify.d.mts.map +1 -0
- package/internal/qs/stringify.d.ts +3 -0
- package/internal/qs/stringify.d.ts.map +1 -0
- package/internal/qs/stringify.js +277 -0
- package/internal/qs/stringify.js.map +1 -0
- package/internal/qs/stringify.mjs +274 -0
- package/internal/qs/stringify.mjs.map +1 -0
- package/internal/qs/types.d.mts +57 -0
- package/internal/qs/types.d.mts.map +1 -0
- package/internal/qs/types.d.ts +57 -0
- package/internal/qs/types.d.ts.map +1 -0
- package/internal/qs/types.js +3 -0
- package/internal/qs/types.js.map +1 -0
- package/internal/qs/types.mjs +2 -0
- package/internal/qs/types.mjs.map +1 -0
- package/internal/qs/utils.d.mts +15 -0
- package/internal/qs/utils.d.mts.map +1 -0
- package/internal/qs/utils.d.ts +15 -0
- package/internal/qs/utils.d.ts.map +1 -0
- package/internal/qs/utils.js +230 -0
- package/internal/qs/utils.js.map +1 -0
- package/internal/qs/utils.mjs +217 -0
- package/internal/qs/utils.mjs.map +1 -0
- package/package.json +1 -1
- package/resources/beta/beta.d.mts +4 -0
- package/resources/beta/beta.d.mts.map +1 -1
- package/resources/beta/beta.d.ts +4 -0
- package/resources/beta/beta.d.ts.map +1 -1
- package/resources/beta/beta.js +4 -0
- package/resources/beta/beta.js.map +1 -1
- package/resources/beta/beta.mjs +4 -0
- package/resources/beta/beta.mjs.map +1 -1
- package/resources/beta/commerce/commerce.d.mts +17 -12
- package/resources/beta/commerce/commerce.d.mts.map +1 -1
- package/resources/beta/commerce/commerce.d.ts +17 -12
- package/resources/beta/commerce/commerce.d.ts.map +1 -1
- package/resources/beta/commerce/commerce.js.map +1 -1
- package/resources/beta/commerce/commerce.mjs.map +1 -1
- package/resources/beta/commerce/coupons.d.mts +2 -1
- package/resources/beta/commerce/coupons.d.mts.map +1 -1
- package/resources/beta/commerce/coupons.d.ts +2 -1
- package/resources/beta/commerce/coupons.d.ts.map +1 -1
- package/resources/beta/commerce/customers.d.mts +255 -4
- package/resources/beta/commerce/customers.d.mts.map +1 -1
- package/resources/beta/commerce/customers.d.ts +255 -4
- package/resources/beta/commerce/customers.d.ts.map +1 -1
- package/resources/beta/commerce/customers.js +2 -1
- package/resources/beta/commerce/customers.js.map +1 -1
- package/resources/beta/commerce/customers.mjs +2 -1
- package/resources/beta/commerce/customers.mjs.map +1 -1
- package/resources/beta/commerce/products/products.d.mts +275 -183
- package/resources/beta/commerce/products/products.d.mts.map +1 -1
- package/resources/beta/commerce/products/products.d.ts +275 -183
- package/resources/beta/commerce/products/products.d.ts.map +1 -1
- package/resources/beta/commerce/products/products.js.map +1 -1
- package/resources/beta/commerce/products/products.mjs.map +1 -1
- package/resources/beta/commerce/products/resources.d.mts +23 -22
- package/resources/beta/commerce/products/resources.d.mts.map +1 -1
- package/resources/beta/commerce/products/resources.d.ts +23 -22
- package/resources/beta/commerce/products/resources.d.ts.map +1 -1
- package/resources/beta/commerce/products/variants.d.mts +137 -103
- package/resources/beta/commerce/products/variants.d.mts.map +1 -1
- package/resources/beta/commerce/products/variants.d.ts +137 -103
- package/resources/beta/commerce/products/variants.d.ts.map +1 -1
- package/resources/beta/content/assets.d.mts +226 -0
- package/resources/beta/content/assets.d.mts.map +1 -0
- package/resources/beta/content/assets.d.ts +226 -0
- package/resources/beta/content/assets.d.ts.map +1 -0
- package/resources/beta/content/assets.js +56 -0
- package/resources/beta/content/assets.js.map +1 -0
- package/resources/beta/content/assets.mjs +52 -0
- package/resources/beta/content/assets.mjs.map +1 -0
- package/resources/beta/content/content.d.mts +26 -0
- package/resources/beta/content/content.d.mts.map +1 -0
- package/resources/beta/content/content.d.ts +26 -0
- package/resources/beta/content/content.d.ts.map +1 -0
- package/resources/beta/content/content.js +33 -0
- package/resources/beta/content/content.js.map +1 -0
- package/resources/beta/content/content.mjs +28 -0
- package/resources/beta/content/content.mjs.map +1 -0
- package/resources/beta/content/entries.d.mts +266 -0
- package/resources/beta/content/entries.d.mts.map +1 -0
- package/resources/beta/content/entries.d.ts +266 -0
- package/resources/beta/content/entries.d.ts.map +1 -0
- package/resources/beta/content/entries.js +63 -0
- package/resources/beta/content/entries.js.map +1 -0
- package/resources/beta/content/entries.mjs +59 -0
- package/resources/beta/content/entries.mjs.map +1 -0
- package/resources/beta/content/index.d.mts +7 -0
- package/resources/beta/content/index.d.mts.map +1 -0
- package/resources/beta/content/index.d.ts +7 -0
- package/resources/beta/content/index.d.ts.map +1 -0
- package/resources/beta/content/index.js +17 -0
- package/resources/beta/content/index.js.map +1 -0
- package/resources/beta/content/index.mjs +8 -0
- package/resources/beta/content/index.mjs.map +1 -0
- package/resources/beta/content/locales.d.mts +116 -0
- package/resources/beta/content/locales.d.mts.map +1 -0
- package/resources/beta/content/locales.d.ts +116 -0
- package/resources/beta/content/locales.d.ts.map +1 -0
- package/resources/beta/content/locales.js +49 -0
- package/resources/beta/content/locales.js.map +1 -0
- package/resources/beta/content/locales.mjs +45 -0
- package/resources/beta/content/locales.mjs.map +1 -0
- package/resources/beta/content/models/fields.d.mts +186 -0
- package/resources/beta/content/models/fields.d.mts.map +1 -0
- package/resources/beta/content/models/fields.d.ts +186 -0
- package/resources/beta/content/models/fields.d.ts.map +1 -0
- package/resources/beta/content/models/fields.js +37 -0
- package/resources/beta/content/models/fields.js.map +1 -0
- package/resources/beta/content/models/fields.mjs +33 -0
- package/resources/beta/content/models/fields.mjs.map +1 -0
- package/resources/beta/content/models/index.d.mts +3 -0
- package/resources/beta/content/models/index.d.mts.map +1 -0
- package/resources/beta/content/models/index.d.ts +3 -0
- package/resources/beta/content/models/index.d.ts.map +1 -0
- package/resources/beta/content/models/index.js +9 -0
- package/resources/beta/content/models/index.js.map +1 -0
- package/resources/beta/content/models/index.mjs +4 -0
- package/resources/beta/content/models/index.mjs.map +1 -0
- package/resources/beta/content/models/models.d.mts +296 -0
- package/resources/beta/content/models/models.d.mts.map +1 -0
- package/resources/beta/content/models/models.d.ts +296 -0
- package/resources/beta/content/models/models.d.ts.map +1 -0
- package/resources/beta/content/models/models.js +54 -0
- package/resources/beta/content/models/models.js.map +1 -0
- package/resources/beta/content/models/models.mjs +49 -0
- package/resources/beta/content/models/models.mjs.map +1 -0
- package/resources/beta/content/models.d.mts +2 -0
- package/resources/beta/content/models.d.mts.map +1 -0
- package/resources/beta/content/models.d.ts +2 -0
- package/resources/beta/content/models.d.ts.map +1 -0
- package/resources/beta/content/models.js +6 -0
- package/resources/beta/content/models.js.map +1 -0
- package/resources/beta/content/models.mjs +3 -0
- package/resources/beta/content/models.mjs.map +1 -0
- package/resources/beta/content/releases/index.d.mts +3 -0
- package/resources/beta/content/releases/index.d.mts.map +1 -0
- package/resources/beta/content/releases/index.d.ts +3 -0
- package/resources/beta/content/releases/index.d.ts.map +1 -0
- package/resources/beta/content/releases/index.js +9 -0
- package/resources/beta/content/releases/index.js.map +1 -0
- package/resources/beta/content/releases/index.mjs +4 -0
- package/resources/beta/content/releases/index.mjs.map +1 -0
- package/resources/beta/content/releases/items.d.mts +39 -0
- package/resources/beta/content/releases/items.d.mts.map +1 -0
- package/resources/beta/content/releases/items.d.ts +39 -0
- package/resources/beta/content/releases/items.d.ts.map +1 -0
- package/resources/beta/content/releases/items.js +28 -0
- package/resources/beta/content/releases/items.js.map +1 -0
- package/resources/beta/content/releases/items.mjs +24 -0
- package/resources/beta/content/releases/items.mjs.map +1 -0
- package/resources/beta/content/releases/releases.d.mts +151 -0
- package/resources/beta/content/releases/releases.d.mts.map +1 -0
- package/resources/beta/content/releases/releases.d.ts +151 -0
- package/resources/beta/content/releases/releases.d.ts.map +1 -0
- package/resources/beta/content/releases/releases.js +69 -0
- package/resources/beta/content/releases/releases.js.map +1 -0
- package/resources/beta/content/releases/releases.mjs +64 -0
- package/resources/beta/content/releases/releases.mjs.map +1 -0
- package/resources/beta/content/releases.d.mts +2 -0
- package/resources/beta/content/releases.d.mts.map +1 -0
- package/resources/beta/content/releases.d.ts +2 -0
- package/resources/beta/content/releases.d.ts.map +1 -0
- package/resources/beta/content/releases.js +6 -0
- package/resources/beta/content/releases.js.map +1 -0
- package/resources/beta/content/releases.mjs +3 -0
- package/resources/beta/content/releases.mjs.map +1 -0
- package/resources/beta/content.d.mts +2 -0
- package/resources/beta/content.d.mts.map +1 -0
- package/resources/beta/content.d.ts +2 -0
- package/resources/beta/content.d.ts.map +1 -0
- package/resources/beta/content.js +6 -0
- package/resources/beta/content.js.map +1 -0
- package/resources/beta/content.mjs +3 -0
- package/resources/beta/content.mjs.map +1 -0
- package/resources/beta/index.d.mts +1 -0
- package/resources/beta/index.d.mts.map +1 -1
- package/resources/beta/index.d.ts +1 -0
- package/resources/beta/index.d.ts.map +1 -1
- package/resources/beta/index.js +3 -1
- package/resources/beta/index.js.map +1 -1
- package/resources/beta/index.mjs +1 -0
- package/resources/beta/index.mjs.map +1 -1
- package/src/client.ts +2 -17
- package/src/internal/qs/LICENSE.md +13 -0
- package/src/internal/qs/README.md +3 -0
- package/src/internal/qs/formats.ts +10 -0
- package/src/internal/qs/index.ts +13 -0
- package/src/internal/qs/stringify.ts +385 -0
- package/src/internal/qs/types.ts +71 -0
- package/src/internal/qs/utils.ts +265 -0
- package/src/resources/beta/beta.ts +6 -0
- package/src/resources/beta/commerce/commerce.ts +19 -13
- package/src/resources/beta/commerce/coupons.ts +2 -1
- package/src/resources/beta/commerce/customers.ts +315 -5
- package/src/resources/beta/commerce/products/products.ts +318 -206
- package/src/resources/beta/commerce/products/resources.ts +23 -22
- package/src/resources/beta/commerce/products/variants.ts +164 -118
- package/src/resources/beta/content/assets.ts +299 -0
- package/src/resources/beta/content/content.ts +117 -0
- package/src/resources/beta/content/entries.ts +347 -0
- package/src/resources/beta/content/index.ts +47 -0
- package/src/resources/beta/content/locales.ts +169 -0
- package/src/resources/beta/content/models/fields.ts +276 -0
- package/src/resources/beta/content/models/index.ts +12 -0
- package/src/resources/beta/content/models/models.ts +436 -0
- package/src/resources/beta/content/models.ts +3 -0
- package/src/resources/beta/content/releases/index.ts +13 -0
- package/src/resources/beta/content/releases/items.ts +57 -0
- package/src/resources/beta/content/releases/releases.ts +220 -0
- package/src/resources/beta/content/releases.ts +3 -0
- package/src/resources/beta/content.ts +3 -0
- package/src/resources/beta/index.ts +1 -0
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.mts.map +1 -1
- package/version.d.ts +1 -1
- package/version.d.ts.map +1 -1
- package/version.js +1 -1
- package/version.js.map +1 -1
- package/version.mjs +1 -1
- package/version.mjs.map +1 -1
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { APIResource } from "../../../../core/resource.js";
|
|
2
|
+
import * as ModelsAPI from "./models.js";
|
|
3
|
+
import { APIPromise } from "../../../../core/api-promise.js";
|
|
4
|
+
import { RequestOptions } from "../../../../internal/request-options.js";
|
|
5
|
+
export declare class Fields extends APIResource {
|
|
6
|
+
/**
|
|
7
|
+
* Adds a new field to a content model. Fields define the structure of entries. The
|
|
8
|
+
* model must not be locked. Adding a field increments the model version.
|
|
9
|
+
*/
|
|
10
|
+
create(modelID: string, body: FieldCreateParams, options?: RequestOptions): APIPromise<ModelsAPI.Field>;
|
|
11
|
+
/**
|
|
12
|
+
* Updates an existing field in a content model. The field type cannot be changed
|
|
13
|
+
* after creation. The model must not be locked.
|
|
14
|
+
*/
|
|
15
|
+
update(fieldID: string, params: FieldUpdateParams, options?: RequestOptions): APIPromise<ModelsAPI.Field>;
|
|
16
|
+
/**
|
|
17
|
+
* Removes a field from a content model. Existing entry data for this field is
|
|
18
|
+
* preserved but will no longer be validated. The model must not be locked.
|
|
19
|
+
*/
|
|
20
|
+
delete(fieldID: string, params: FieldDeleteParams, options?: RequestOptions): APIPromise<void>;
|
|
21
|
+
}
|
|
22
|
+
export interface FieldCreateParams {
|
|
23
|
+
/**
|
|
24
|
+
* API identifier for the field (camelCase, e.g., 'title')
|
|
25
|
+
*/
|
|
26
|
+
api_id: string;
|
|
27
|
+
/**
|
|
28
|
+
* Display name for the field
|
|
29
|
+
*/
|
|
30
|
+
name: string;
|
|
31
|
+
/**
|
|
32
|
+
* Field data type
|
|
33
|
+
*/
|
|
34
|
+
type: 'text' | 'richtext' | 'number' | 'boolean' | 'date' | 'datetime' | 'json' | 'reference' | 'asset' | 'enum' | 'array';
|
|
35
|
+
/**
|
|
36
|
+
* Optional custom ID for the field. Must start with 'cf\_'. If not provided, one
|
|
37
|
+
* will be generated.
|
|
38
|
+
*/
|
|
39
|
+
id?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Description of the field
|
|
42
|
+
*/
|
|
43
|
+
description?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Display order within the model
|
|
46
|
+
*/
|
|
47
|
+
display_order?: number;
|
|
48
|
+
/**
|
|
49
|
+
* Whether field values are stored per-locale
|
|
50
|
+
*/
|
|
51
|
+
localized?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Validation rules
|
|
54
|
+
*/
|
|
55
|
+
validation?: FieldCreateParams.Validation;
|
|
56
|
+
}
|
|
57
|
+
export declare namespace FieldCreateParams {
|
|
58
|
+
/**
|
|
59
|
+
* Validation rules
|
|
60
|
+
*/
|
|
61
|
+
interface Validation {
|
|
62
|
+
/**
|
|
63
|
+
* Allowed MIME types for asset fields (e.g., 'image/\*', 'application/pdf')
|
|
64
|
+
*/
|
|
65
|
+
allowed_mime_types?: Array<string>;
|
|
66
|
+
/**
|
|
67
|
+
* Allowed model apiIds for reference fields
|
|
68
|
+
*/
|
|
69
|
+
allowed_models?: Array<string>;
|
|
70
|
+
/**
|
|
71
|
+
* Allowed values for enum fields
|
|
72
|
+
*/
|
|
73
|
+
allowed_values?: Array<string>;
|
|
74
|
+
/**
|
|
75
|
+
* Type of items for array fields
|
|
76
|
+
*/
|
|
77
|
+
array_item_type?: 'text' | 'richtext' | 'number' | 'boolean' | 'date' | 'datetime' | 'json' | 'reference' | 'asset' | 'enum' | 'array';
|
|
78
|
+
/**
|
|
79
|
+
* Default value for the field
|
|
80
|
+
*/
|
|
81
|
+
default_value?: unknown;
|
|
82
|
+
/**
|
|
83
|
+
* Maximum value for numbers, maximum length for text/arrays
|
|
84
|
+
*/
|
|
85
|
+
max?: number;
|
|
86
|
+
/**
|
|
87
|
+
* Minimum value for numbers, minimum length for text/arrays
|
|
88
|
+
*/
|
|
89
|
+
min?: number;
|
|
90
|
+
/**
|
|
91
|
+
* Regex pattern for text field validation
|
|
92
|
+
*/
|
|
93
|
+
pattern?: string;
|
|
94
|
+
/**
|
|
95
|
+
* Whether the field is required
|
|
96
|
+
*/
|
|
97
|
+
required?: boolean;
|
|
98
|
+
/**
|
|
99
|
+
* Whether field values must be unique
|
|
100
|
+
*/
|
|
101
|
+
unique?: boolean;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
export interface FieldUpdateParams {
|
|
105
|
+
/**
|
|
106
|
+
* Path param: The unique identifier of the content model
|
|
107
|
+
*/
|
|
108
|
+
model_id: string;
|
|
109
|
+
/**
|
|
110
|
+
* Body param: Description of the field
|
|
111
|
+
*/
|
|
112
|
+
description?: string;
|
|
113
|
+
/**
|
|
114
|
+
* Body param: Display order
|
|
115
|
+
*/
|
|
116
|
+
display_order?: number;
|
|
117
|
+
/**
|
|
118
|
+
* Body param: Whether field values are localized
|
|
119
|
+
*/
|
|
120
|
+
localized?: boolean;
|
|
121
|
+
/**
|
|
122
|
+
* Body param: Display name for the field
|
|
123
|
+
*/
|
|
124
|
+
name?: string;
|
|
125
|
+
/**
|
|
126
|
+
* Body param: Validation rules
|
|
127
|
+
*/
|
|
128
|
+
validation?: FieldUpdateParams.Validation;
|
|
129
|
+
}
|
|
130
|
+
export declare namespace FieldUpdateParams {
|
|
131
|
+
/**
|
|
132
|
+
* Validation rules
|
|
133
|
+
*/
|
|
134
|
+
interface Validation {
|
|
135
|
+
/**
|
|
136
|
+
* Allowed MIME types for asset fields (e.g., 'image/\*', 'application/pdf')
|
|
137
|
+
*/
|
|
138
|
+
allowed_mime_types?: Array<string>;
|
|
139
|
+
/**
|
|
140
|
+
* Allowed model apiIds for reference fields
|
|
141
|
+
*/
|
|
142
|
+
allowed_models?: Array<string>;
|
|
143
|
+
/**
|
|
144
|
+
* Allowed values for enum fields
|
|
145
|
+
*/
|
|
146
|
+
allowed_values?: Array<string>;
|
|
147
|
+
/**
|
|
148
|
+
* Type of items for array fields
|
|
149
|
+
*/
|
|
150
|
+
array_item_type?: 'text' | 'richtext' | 'number' | 'boolean' | 'date' | 'datetime' | 'json' | 'reference' | 'asset' | 'enum' | 'array';
|
|
151
|
+
/**
|
|
152
|
+
* Default value for the field
|
|
153
|
+
*/
|
|
154
|
+
default_value?: unknown;
|
|
155
|
+
/**
|
|
156
|
+
* Maximum value for numbers, maximum length for text/arrays
|
|
157
|
+
*/
|
|
158
|
+
max?: number;
|
|
159
|
+
/**
|
|
160
|
+
* Minimum value for numbers, minimum length for text/arrays
|
|
161
|
+
*/
|
|
162
|
+
min?: number;
|
|
163
|
+
/**
|
|
164
|
+
* Regex pattern for text field validation
|
|
165
|
+
*/
|
|
166
|
+
pattern?: string;
|
|
167
|
+
/**
|
|
168
|
+
* Whether the field is required
|
|
169
|
+
*/
|
|
170
|
+
required?: boolean;
|
|
171
|
+
/**
|
|
172
|
+
* Whether field values must be unique
|
|
173
|
+
*/
|
|
174
|
+
unique?: boolean;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
export interface FieldDeleteParams {
|
|
178
|
+
/**
|
|
179
|
+
* The unique identifier of the content model
|
|
180
|
+
*/
|
|
181
|
+
model_id: string;
|
|
182
|
+
}
|
|
183
|
+
export declare namespace Fields {
|
|
184
|
+
export { type FieldCreateParams as FieldCreateParams, type FieldUpdateParams as FieldUpdateParams, type FieldDeleteParams as FieldDeleteParams, };
|
|
185
|
+
}
|
|
186
|
+
//# sourceMappingURL=fields.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fields.d.ts","sourceRoot":"","sources":["../../../../src/resources/beta/content/models/fields.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,SAAS;OACd,EAAE,UAAU,EAAE;OAEd,EAAE,cAAc,EAAE;AAGzB,qBAAa,MAAO,SAAQ,WAAW;IACrC;;;OAGG;IACH,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,iBAAiB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,SAAS,CAAC,KAAK,CAAC;IAIvG;;;OAGG;IACH,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,iBAAiB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,SAAS,CAAC,KAAK,CAAC;IAKzG;;;OAGG;IACH,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,iBAAiB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,IAAI,CAAC;CAO/F;AAED,MAAM,WAAW,iBAAiB;IAChC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iB,IAAI,iBAAiB,EAC3C,KAAK,iBAAiB,IAAI,iBAAiB,GAC5C,CAAC;CACH"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.Fields = void 0;
|
|
5
|
+
const resource_1 = require("../../../../core/resource.js");
|
|
6
|
+
const headers_1 = require("../../../../internal/headers.js");
|
|
7
|
+
const path_1 = require("../../../../internal/utils/path.js");
|
|
8
|
+
class Fields extends resource_1.APIResource {
|
|
9
|
+
/**
|
|
10
|
+
* Adds a new field to a content model. Fields define the structure of entries. The
|
|
11
|
+
* model must not be locked. Adding a field increments the model version.
|
|
12
|
+
*/
|
|
13
|
+
create(modelID, body, options) {
|
|
14
|
+
return this._client.post((0, path_1.path) `/v1/content/models/${modelID}/fields`, { body, ...options });
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Updates an existing field in a content model. The field type cannot be changed
|
|
18
|
+
* after creation. The model must not be locked.
|
|
19
|
+
*/
|
|
20
|
+
update(fieldID, params, options) {
|
|
21
|
+
const { model_id, ...body } = params;
|
|
22
|
+
return this._client.patch((0, path_1.path) `/v1/content/models/${model_id}/fields/${fieldID}`, { body, ...options });
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Removes a field from a content model. Existing entry data for this field is
|
|
26
|
+
* preserved but will no longer be validated. The model must not be locked.
|
|
27
|
+
*/
|
|
28
|
+
delete(fieldID, params, options) {
|
|
29
|
+
const { model_id } = params;
|
|
30
|
+
return this._client.delete((0, path_1.path) `/v1/content/models/${model_id}/fields/${fieldID}`, {
|
|
31
|
+
...options,
|
|
32
|
+
headers: (0, headers_1.buildHeaders)([{ Accept: '*/*' }, options?.headers]),
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.Fields = Fields;
|
|
37
|
+
//# sourceMappingURL=fields.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fields.js","sourceRoot":"","sources":["../../../../src/resources/beta/content/models/fields.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,2DAAwD;AAGxD,6DAA4D;AAE5D,6DAAuD;AAEvD,MAAa,MAAO,SAAQ,sBAAW;IACrC;;;OAGG;IACH,MAAM,CAAC,OAAe,EAAE,IAAuB,EAAE,OAAwB;QACvE,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAA,WAAI,EAAA,sBAAsB,OAAO,SAAS,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC7F,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,OAAe,EAAE,MAAyB,EAAE,OAAwB;QACzE,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;QACrC,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAA,WAAI,EAAA,sBAAsB,QAAQ,WAAW,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC1G,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,OAAe,EAAE,MAAyB,EAAE,OAAwB;QACzE,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAC;QAC5B,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAA,WAAI,EAAA,sBAAsB,QAAQ,WAAW,OAAO,EAAE,EAAE;YACjF,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;CACF;AA7BD,wBA6BC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
import { APIResource } from "../../../../core/resource.mjs";
|
|
3
|
+
import { buildHeaders } from "../../../../internal/headers.mjs";
|
|
4
|
+
import { path } from "../../../../internal/utils/path.mjs";
|
|
5
|
+
export class Fields extends APIResource {
|
|
6
|
+
/**
|
|
7
|
+
* Adds a new field to a content model. Fields define the structure of entries. The
|
|
8
|
+
* model must not be locked. Adding a field increments the model version.
|
|
9
|
+
*/
|
|
10
|
+
create(modelID, body, options) {
|
|
11
|
+
return this._client.post(path `/v1/content/models/${modelID}/fields`, { body, ...options });
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Updates an existing field in a content model. The field type cannot be changed
|
|
15
|
+
* after creation. The model must not be locked.
|
|
16
|
+
*/
|
|
17
|
+
update(fieldID, params, options) {
|
|
18
|
+
const { model_id, ...body } = params;
|
|
19
|
+
return this._client.patch(path `/v1/content/models/${model_id}/fields/${fieldID}`, { body, ...options });
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Removes a field from a content model. Existing entry data for this field is
|
|
23
|
+
* preserved but will no longer be validated. The model must not be locked.
|
|
24
|
+
*/
|
|
25
|
+
delete(fieldID, params, options) {
|
|
26
|
+
const { model_id } = params;
|
|
27
|
+
return this._client.delete(path `/v1/content/models/${model_id}/fields/${fieldID}`, {
|
|
28
|
+
...options,
|
|
29
|
+
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=fields.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fields.mjs","sourceRoot":"","sources":["../../../../src/resources/beta/content/models/fields.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAGf,EAAE,YAAY,EAAE;OAEhB,EAAE,IAAI,EAAE;AAEf,MAAM,OAAO,MAAO,SAAQ,WAAW;IACrC;;;OAGG;IACH,MAAM,CAAC,OAAe,EAAE,IAAuB,EAAE,OAAwB;QACvE,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAA,sBAAsB,OAAO,SAAS,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC7F,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,OAAe,EAAE,MAAyB,EAAE,OAAwB;QACzE,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;QACrC,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAA,sBAAsB,QAAQ,WAAW,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC1G,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,OAAe,EAAE,MAAyB,EAAE,OAAwB;QACzE,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAC;QAC5B,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAA,sBAAsB,QAAQ,WAAW,OAAO,EAAE,EAAE;YACjF,GAAG,OAAO;YACV,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { Fields, type FieldCreateParams, type FieldUpdateParams, type FieldDeleteParams } from "./fields.mjs";
|
|
2
|
+
export { Models, type Field, type Model, type ModelCreateParams, type ModelUpdateParams, type ModelListParams, type ModelsCursorIDPage, } from "./models.mjs";
|
|
3
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../../src/resources/beta/content/models/index.ts"],"names":[],"mappings":"OAEO,EAAE,MAAM,EAAE,KAAK,iBAAiB,EAAE,KAAK,iBAAiB,EAAE,KAAK,iBAAiB,EAAE;OAClF,EACL,MAAM,EACN,KAAK,KAAK,EACV,KAAK,KAAK,EACV,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,kBAAkB,GACxB"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { Fields, type FieldCreateParams, type FieldUpdateParams, type FieldDeleteParams } from "./fields.js";
|
|
2
|
+
export { Models, type Field, type Model, type ModelCreateParams, type ModelUpdateParams, type ModelListParams, type ModelsCursorIDPage, } from "./models.js";
|
|
3
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/resources/beta/content/models/index.ts"],"names":[],"mappings":"OAEO,EAAE,MAAM,EAAE,KAAK,iBAAiB,EAAE,KAAK,iBAAiB,EAAE,KAAK,iBAAiB,EAAE;OAClF,EACL,MAAM,EACN,KAAK,KAAK,EACV,KAAK,KAAK,EACV,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,kBAAkB,GACxB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.Models = exports.Fields = void 0;
|
|
5
|
+
var fields_1 = require("./fields.js");
|
|
6
|
+
Object.defineProperty(exports, "Fields", { enumerable: true, get: function () { return fields_1.Fields; } });
|
|
7
|
+
var models_1 = require("./models.js");
|
|
8
|
+
Object.defineProperty(exports, "Models", { enumerable: true, get: function () { return models_1.Models; } });
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/resources/beta/content/models/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,sCAA0G;AAAjG,gGAAA,MAAM,OAAA;AACf,sCAQkB;AAPhB,gGAAA,MAAM,OAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../../src/resources/beta/content/models/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,MAAM,EAA0E;OAClF,EACL,MAAM,GAOP"}
|
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
import { APIResource } from "../../../../core/resource.mjs";
|
|
2
|
+
import * as FieldsAPI from "./fields.mjs";
|
|
3
|
+
import { FieldCreateParams, FieldDeleteParams, FieldUpdateParams, Fields } from "./fields.mjs";
|
|
4
|
+
import { APIPromise } from "../../../../core/api-promise.mjs";
|
|
5
|
+
import { CursorIDPage, type CursorIDPageParams, PagePromise } from "../../../../core/pagination.mjs";
|
|
6
|
+
import { RequestOptions } from "../../../../internal/request-options.mjs";
|
|
7
|
+
export declare class Models extends APIResource {
|
|
8
|
+
fields: FieldsAPI.Fields;
|
|
9
|
+
/**
|
|
10
|
+
* Creates a new content model with optional initial fields. Content models define
|
|
11
|
+
* the schema for entries. Example models: 'Blog Post', 'Product', 'Author'.
|
|
12
|
+
*/
|
|
13
|
+
create(body: ModelCreateParams, options?: RequestOptions): APIPromise<Model>;
|
|
14
|
+
/**
|
|
15
|
+
* Updates an existing content model. Use this to modify the name, description, or
|
|
16
|
+
* lock status. The api_id cannot be changed after creation.
|
|
17
|
+
*/
|
|
18
|
+
update(modelID: string, body?: ModelUpdateParams | null | undefined, options?: RequestOptions): APIPromise<Model>;
|
|
19
|
+
/**
|
|
20
|
+
* Retrieves a paginated list of content models. Content models define the
|
|
21
|
+
* schema/structure for content entries.
|
|
22
|
+
*/
|
|
23
|
+
list(query?: ModelListParams | null | undefined, options?: RequestOptions): PagePromise<ModelsCursorIDPage, Model>;
|
|
24
|
+
/**
|
|
25
|
+
* Archives a content model, hiding it from the API. Existing entries are
|
|
26
|
+
* preserved. Use this instead of deletion to maintain data integrity.
|
|
27
|
+
*/
|
|
28
|
+
archive(modelID: string, options?: RequestOptions): APIPromise<Model>;
|
|
29
|
+
/**
|
|
30
|
+
* Retrieves a content model by ID. Returns the model object including all field
|
|
31
|
+
* definitions.
|
|
32
|
+
*/
|
|
33
|
+
get(modelID: string, options?: RequestOptions): APIPromise<Model>;
|
|
34
|
+
}
|
|
35
|
+
export type ModelsCursorIDPage = CursorIDPage<Model>;
|
|
36
|
+
/**
|
|
37
|
+
* A field definition within a content model
|
|
38
|
+
*/
|
|
39
|
+
export interface Field {
|
|
40
|
+
/**
|
|
41
|
+
* Unique identifier for the topic subscription
|
|
42
|
+
*/
|
|
43
|
+
id: string;
|
|
44
|
+
/**
|
|
45
|
+
* API identifier for the field (camelCase, e.g., 'title', 'publishDate')
|
|
46
|
+
*/
|
|
47
|
+
api_id: string;
|
|
48
|
+
/**
|
|
49
|
+
* Timestamp when the field was created
|
|
50
|
+
*/
|
|
51
|
+
created: string;
|
|
52
|
+
/**
|
|
53
|
+
* Display name for the field
|
|
54
|
+
*/
|
|
55
|
+
name: string;
|
|
56
|
+
/**
|
|
57
|
+
* Field data type
|
|
58
|
+
*/
|
|
59
|
+
type: 'text' | 'richtext' | 'number' | 'boolean' | 'date' | 'datetime' | 'json' | 'reference' | 'asset' | 'enum' | 'array';
|
|
60
|
+
/**
|
|
61
|
+
* Description of the field
|
|
62
|
+
*/
|
|
63
|
+
description?: string | null;
|
|
64
|
+
/**
|
|
65
|
+
* Display order within the model
|
|
66
|
+
*/
|
|
67
|
+
display_order?: number;
|
|
68
|
+
/**
|
|
69
|
+
* Whether field values are stored per-locale
|
|
70
|
+
*/
|
|
71
|
+
localized?: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Validation rules
|
|
74
|
+
*/
|
|
75
|
+
validation?: Field.Validation;
|
|
76
|
+
}
|
|
77
|
+
export declare namespace Field {
|
|
78
|
+
/**
|
|
79
|
+
* Validation rules
|
|
80
|
+
*/
|
|
81
|
+
interface Validation {
|
|
82
|
+
/**
|
|
83
|
+
* Allowed MIME types for asset fields (e.g., 'image/\*', 'application/pdf')
|
|
84
|
+
*/
|
|
85
|
+
allowed_mime_types?: Array<string>;
|
|
86
|
+
/**
|
|
87
|
+
* Allowed model apiIds for reference fields
|
|
88
|
+
*/
|
|
89
|
+
allowed_models?: Array<string>;
|
|
90
|
+
/**
|
|
91
|
+
* Allowed values for enum fields
|
|
92
|
+
*/
|
|
93
|
+
allowed_values?: Array<string>;
|
|
94
|
+
/**
|
|
95
|
+
* Type of items for array fields
|
|
96
|
+
*/
|
|
97
|
+
array_item_type?: 'text' | 'richtext' | 'number' | 'boolean' | 'date' | 'datetime' | 'json' | 'reference' | 'asset' | 'enum' | 'array';
|
|
98
|
+
/**
|
|
99
|
+
* Default value for the field
|
|
100
|
+
*/
|
|
101
|
+
default_value?: unknown;
|
|
102
|
+
/**
|
|
103
|
+
* Maximum value for numbers, maximum length for text/arrays
|
|
104
|
+
*/
|
|
105
|
+
max?: number;
|
|
106
|
+
/**
|
|
107
|
+
* Minimum value for numbers, minimum length for text/arrays
|
|
108
|
+
*/
|
|
109
|
+
min?: number;
|
|
110
|
+
/**
|
|
111
|
+
* Regex pattern for text field validation
|
|
112
|
+
*/
|
|
113
|
+
pattern?: string;
|
|
114
|
+
/**
|
|
115
|
+
* Whether the field is required
|
|
116
|
+
*/
|
|
117
|
+
required?: boolean;
|
|
118
|
+
/**
|
|
119
|
+
* Whether field values must be unique
|
|
120
|
+
*/
|
|
121
|
+
unique?: boolean;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* A content model defines the schema/structure for content entries. Each model has
|
|
126
|
+
* fields that define what data entries can contain.
|
|
127
|
+
*/
|
|
128
|
+
export interface Model {
|
|
129
|
+
/**
|
|
130
|
+
* Unique identifier for the topic subscription
|
|
131
|
+
*/
|
|
132
|
+
id: string;
|
|
133
|
+
/**
|
|
134
|
+
* API identifier for the model (camelCase, e.g., 'blogPost', 'product')
|
|
135
|
+
*/
|
|
136
|
+
api_id: string;
|
|
137
|
+
/**
|
|
138
|
+
* Timestamp when the model was created
|
|
139
|
+
*/
|
|
140
|
+
created: string;
|
|
141
|
+
/**
|
|
142
|
+
* Whether field modifications are locked (for production safety)
|
|
143
|
+
*/
|
|
144
|
+
locked: boolean;
|
|
145
|
+
/**
|
|
146
|
+
* Display name for the model
|
|
147
|
+
*/
|
|
148
|
+
name: string;
|
|
149
|
+
/**
|
|
150
|
+
* Timestamp when the model was last updated
|
|
151
|
+
*/
|
|
152
|
+
updated: string;
|
|
153
|
+
/**
|
|
154
|
+
* Schema version number
|
|
155
|
+
*/
|
|
156
|
+
version: number;
|
|
157
|
+
/**
|
|
158
|
+
* Description of the model
|
|
159
|
+
*/
|
|
160
|
+
description?: string | null;
|
|
161
|
+
/**
|
|
162
|
+
* Fields defined in this model
|
|
163
|
+
*/
|
|
164
|
+
fields?: Array<Field>;
|
|
165
|
+
}
|
|
166
|
+
export interface ModelCreateParams {
|
|
167
|
+
/**
|
|
168
|
+
* API identifier for the model (camelCase, e.g., 'blogPost')
|
|
169
|
+
*/
|
|
170
|
+
api_id: string;
|
|
171
|
+
/**
|
|
172
|
+
* Display name for the model
|
|
173
|
+
*/
|
|
174
|
+
name: string;
|
|
175
|
+
/**
|
|
176
|
+
* Optional custom ID for the model. Must start with 'cm\_'. If not provided, one
|
|
177
|
+
* will be generated.
|
|
178
|
+
*/
|
|
179
|
+
id?: string;
|
|
180
|
+
/**
|
|
181
|
+
* Description of the model
|
|
182
|
+
*/
|
|
183
|
+
description?: string;
|
|
184
|
+
/**
|
|
185
|
+
* Initial fields to create with the model
|
|
186
|
+
*/
|
|
187
|
+
fields?: Array<ModelCreateParams.Field>;
|
|
188
|
+
}
|
|
189
|
+
export declare namespace ModelCreateParams {
|
|
190
|
+
/**
|
|
191
|
+
* Request to add a new field to a content model
|
|
192
|
+
*/
|
|
193
|
+
interface Field {
|
|
194
|
+
/**
|
|
195
|
+
* API identifier for the field (camelCase, e.g., 'title')
|
|
196
|
+
*/
|
|
197
|
+
api_id: string;
|
|
198
|
+
/**
|
|
199
|
+
* Display name for the field
|
|
200
|
+
*/
|
|
201
|
+
name: string;
|
|
202
|
+
/**
|
|
203
|
+
* Field data type
|
|
204
|
+
*/
|
|
205
|
+
type: 'text' | 'richtext' | 'number' | 'boolean' | 'date' | 'datetime' | 'json' | 'reference' | 'asset' | 'enum' | 'array';
|
|
206
|
+
/**
|
|
207
|
+
* Optional custom ID for the field. Must start with 'cf\_'. If not provided, one
|
|
208
|
+
* will be generated.
|
|
209
|
+
*/
|
|
210
|
+
id?: string;
|
|
211
|
+
/**
|
|
212
|
+
* Description of the field
|
|
213
|
+
*/
|
|
214
|
+
description?: string;
|
|
215
|
+
/**
|
|
216
|
+
* Display order within the model
|
|
217
|
+
*/
|
|
218
|
+
display_order?: number;
|
|
219
|
+
/**
|
|
220
|
+
* Whether field values are stored per-locale
|
|
221
|
+
*/
|
|
222
|
+
localized?: boolean;
|
|
223
|
+
/**
|
|
224
|
+
* Validation rules
|
|
225
|
+
*/
|
|
226
|
+
validation?: Field.Validation;
|
|
227
|
+
}
|
|
228
|
+
namespace Field {
|
|
229
|
+
/**
|
|
230
|
+
* Validation rules
|
|
231
|
+
*/
|
|
232
|
+
interface Validation {
|
|
233
|
+
/**
|
|
234
|
+
* Allowed MIME types for asset fields (e.g., 'image/\*', 'application/pdf')
|
|
235
|
+
*/
|
|
236
|
+
allowed_mime_types?: Array<string>;
|
|
237
|
+
/**
|
|
238
|
+
* Allowed model apiIds for reference fields
|
|
239
|
+
*/
|
|
240
|
+
allowed_models?: Array<string>;
|
|
241
|
+
/**
|
|
242
|
+
* Allowed values for enum fields
|
|
243
|
+
*/
|
|
244
|
+
allowed_values?: Array<string>;
|
|
245
|
+
/**
|
|
246
|
+
* Type of items for array fields
|
|
247
|
+
*/
|
|
248
|
+
array_item_type?: 'text' | 'richtext' | 'number' | 'boolean' | 'date' | 'datetime' | 'json' | 'reference' | 'asset' | 'enum' | 'array';
|
|
249
|
+
/**
|
|
250
|
+
* Default value for the field
|
|
251
|
+
*/
|
|
252
|
+
default_value?: unknown;
|
|
253
|
+
/**
|
|
254
|
+
* Maximum value for numbers, maximum length for text/arrays
|
|
255
|
+
*/
|
|
256
|
+
max?: number;
|
|
257
|
+
/**
|
|
258
|
+
* Minimum value for numbers, minimum length for text/arrays
|
|
259
|
+
*/
|
|
260
|
+
min?: number;
|
|
261
|
+
/**
|
|
262
|
+
* Regex pattern for text field validation
|
|
263
|
+
*/
|
|
264
|
+
pattern?: string;
|
|
265
|
+
/**
|
|
266
|
+
* Whether the field is required
|
|
267
|
+
*/
|
|
268
|
+
required?: boolean;
|
|
269
|
+
/**
|
|
270
|
+
* Whether field values must be unique
|
|
271
|
+
*/
|
|
272
|
+
unique?: boolean;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
export interface ModelUpdateParams {
|
|
277
|
+
/**
|
|
278
|
+
* Description of the model
|
|
279
|
+
*/
|
|
280
|
+
description?: string;
|
|
281
|
+
/**
|
|
282
|
+
* Lock the model to prevent field modifications
|
|
283
|
+
*/
|
|
284
|
+
locked?: boolean;
|
|
285
|
+
/**
|
|
286
|
+
* Display name for the model
|
|
287
|
+
*/
|
|
288
|
+
name?: string;
|
|
289
|
+
}
|
|
290
|
+
export interface ModelListParams extends CursorIDPageParams {
|
|
291
|
+
}
|
|
292
|
+
export declare namespace Models {
|
|
293
|
+
export { type Field as Field, type Model as Model, type ModelsCursorIDPage as ModelsCursorIDPage, type ModelCreateParams as ModelCreateParams, type ModelUpdateParams as ModelUpdateParams, type ModelListParams as ModelListParams, };
|
|
294
|
+
export { Fields as Fields, type FieldCreateParams as FieldCreateParams, type FieldUpdateParams as FieldUpdateParams, type FieldDeleteParams as FieldDeleteParams, };
|
|
295
|
+
}
|
|
296
|
+
//# sourceMappingURL=models.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"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