nextjs-cms 0.6.7 → 0.6.9
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/core/config/config-loader.d.ts +4 -10
- package/dist/core/config/config-loader.d.ts.map +1 -1
- package/dist/core/config/config-loader.js +17 -16
- package/dist/core/factories/FieldFactory.d.ts.map +1 -1
- package/dist/core/factories/FieldFactory.js +8 -0
- package/dist/core/fields/color.js +2 -2
- package/dist/core/fields/date.js +2 -2
- package/dist/core/fields/document.js +13 -13
- package/dist/core/fields/field.d.ts +5 -1
- package/dist/core/fields/field.d.ts.map +1 -1
- package/dist/core/fields/field.js +12 -0
- package/dist/core/fields/map.js +2 -2
- package/dist/core/fields/number.js +7 -7
- package/dist/core/fields/password.js +4 -4
- package/dist/core/fields/photo.js +17 -17
- package/dist/core/fields/select.d.ts +1 -1
- package/dist/core/fields/select.js +2 -2
- package/dist/core/fields/slug.js +3 -3
- package/dist/core/fields/text.js +3 -3
- package/dist/core/fields/video.js +12 -12
- package/dist/core/sections/category.d.ts +34 -34
- package/dist/core/sections/hasItems.d.ts +34 -34
- package/dist/core/sections/section.d.ts +17 -17
- package/dist/core/sections/simple.d.ts +6 -6
- package/dist/core/submit/submit.d.ts.map +1 -1
- package/dist/core/submit/submit.js +10 -0
- package/dist/translations/client.d.ts +5178 -1
- package/dist/translations/client.d.ts.map +1 -1
- package/dist/translations/client.js +29 -4
- package/dist/translations/dict-store.d.ts +5 -1
- package/dist/translations/dict-store.d.ts.map +1 -1
- package/dist/translations/dict-store.js +30 -3
- package/dist/translations/index.d.ts +1 -1
- package/dist/translations/index.js +1 -1
- package/dist/translations/server.d.ts +5171 -1
- package/dist/translations/server.d.ts.map +1 -1
- package/dist/translations/server.js +26 -4
- package/package.json +1 -1
- package/dist/core/helpers/i18n.d.ts +0 -2
- package/dist/core/helpers/i18n.d.ts.map +0 -1
- package/dist/core/helpers/i18n.js +0 -3
- package/dist/core/localization.d.ts +0 -40
- package/dist/core/localization.d.ts.map +0 -1
- package/dist/core/localization.js +0 -48
- package/dist/logging/audit.d.ts +0 -20
- package/dist/logging/audit.d.ts.map +0 -1
- package/dist/logging/audit.js +0 -48
- package/dist/translations/localized-string.d.ts +0 -17
- package/dist/translations/localized-string.d.ts.map +0 -1
- package/dist/translations/localized-string.js +0 -32
- package/dist/translations/use-project-translation.d.ts +0 -19
- package/dist/translations/use-project-translation.d.ts.map +0 -1
- package/dist/translations/use-project-translation.js +0 -25
- package/dist/validators/types.d.ts +0 -7
- package/dist/validators/types.d.ts.map +0 -1
- package/dist/validators/types.js +0 -0
|
@@ -402,7 +402,7 @@ export class SelectField extends Field {
|
|
|
402
402
|
if (this.db.table.trim().length === 0 ||
|
|
403
403
|
this.db.identifier.trim().length === 0 ||
|
|
404
404
|
this.db.label.trim().length === 0) {
|
|
405
|
-
throw new Error(`Field ${
|
|
405
|
+
throw new Error(`Field ${this.getLocalizedLabel()}: Table, identifier and label are required`);
|
|
406
406
|
}
|
|
407
407
|
}
|
|
408
408
|
checkRequired() {
|
|
@@ -411,7 +411,7 @@ export class SelectField extends Field {
|
|
|
411
411
|
*/
|
|
412
412
|
if (this.required) {
|
|
413
413
|
if (!this.value || this.value.toString().trim().length === 0) {
|
|
414
|
-
throw new Error(`Field ${
|
|
414
|
+
throw new Error(`Field ${this.getLocalizedLabel()} is required`);
|
|
415
415
|
}
|
|
416
416
|
}
|
|
417
417
|
}
|
package/dist/core/fields/slug.js
CHANGED
|
@@ -72,7 +72,7 @@ export class SlugField extends Field {
|
|
|
72
72
|
checkRequired() {
|
|
73
73
|
if (this.required) {
|
|
74
74
|
if (!this.value || this.value.trim().length === 0) {
|
|
75
|
-
throw new Error(getString('fieldIsRequired',
|
|
75
|
+
throw new Error(getString('fieldIsRequired', this.locale, { field: this.getLocalizedLabel() }));
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
}
|
|
@@ -96,7 +96,7 @@ export class SlugField extends Field {
|
|
|
96
96
|
*/
|
|
97
97
|
if (this.minLength) {
|
|
98
98
|
if (this.minLength > this.value.length) {
|
|
99
|
-
throw new Error(getString('minLength',
|
|
99
|
+
throw new Error(getString('minLength', this.locale, { min: this.minLength }));
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
/**
|
|
@@ -104,7 +104,7 @@ export class SlugField extends Field {
|
|
|
104
104
|
*/
|
|
105
105
|
if (this.maxLength) {
|
|
106
106
|
if (this.maxLength < this.value.length) {
|
|
107
|
-
throw new Error(getString('maxLength',
|
|
107
|
+
throw new Error(getString('maxLength', this.locale, { max: this.maxLength }));
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
}
|
package/dist/core/fields/text.js
CHANGED
|
@@ -76,7 +76,7 @@ export class TextField extends Field {
|
|
|
76
76
|
*/
|
|
77
77
|
if (this.required) {
|
|
78
78
|
if (!this.value || this.value.trim().length === 0) {
|
|
79
|
-
throw new Error(getString('fieldIsRequired',
|
|
79
|
+
throw new Error(getString('fieldIsRequired', this.locale, { field: this.getLocalizedLabel() }));
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
}
|
|
@@ -100,7 +100,7 @@ export class TextField extends Field {
|
|
|
100
100
|
*/
|
|
101
101
|
if (this.minLength) {
|
|
102
102
|
if (this.minLength > this.value.length) {
|
|
103
|
-
throw new Error(getString('minLength',
|
|
103
|
+
throw new Error(getString('minLength', this.locale, { min: this.minLength }));
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
/**
|
|
@@ -108,7 +108,7 @@ export class TextField extends Field {
|
|
|
108
108
|
*/
|
|
109
109
|
if (this.maxLength) {
|
|
110
110
|
if (this.maxLength < this.value.length) {
|
|
111
|
-
throw new Error(getString('maxLength',
|
|
111
|
+
throw new Error(getString('maxLength', this.locale, { max: this.maxLength }));
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
}
|
|
@@ -76,13 +76,13 @@ export class VideoField extends FileField {
|
|
|
76
76
|
}
|
|
77
77
|
async readChunkFromFile({ arrayBuffer, length, startPosition = 0, }) {
|
|
78
78
|
if (!arrayBuffer) {
|
|
79
|
-
throw new Error(getString('errorReadingFile',
|
|
79
|
+
throw new Error(getString('errorReadingFile', this.locale));
|
|
80
80
|
}
|
|
81
81
|
const buffer = new Uint8Array(arrayBuffer);
|
|
82
82
|
const start = Math.max(0, startPosition);
|
|
83
83
|
const end = Math.min(start + length, buffer.length);
|
|
84
84
|
if (start >= end) {
|
|
85
|
-
throw new Error(getString('errorReadingFile',
|
|
85
|
+
throw new Error(getString('errorReadingFile', this.locale));
|
|
86
86
|
}
|
|
87
87
|
return buffer.subarray(start, end);
|
|
88
88
|
}
|
|
@@ -91,10 +91,10 @@ export class VideoField extends FileField {
|
|
|
91
91
|
*/
|
|
92
92
|
async writeToFile() {
|
|
93
93
|
if (!this._folder) {
|
|
94
|
-
throw new Error(getString('videoFolderNotSet',
|
|
94
|
+
throw new Error(getString('videoFolderNotSet', this.locale, { field: this.getLocalizedLabel() }));
|
|
95
95
|
}
|
|
96
96
|
if (!this._buffer) {
|
|
97
|
-
throw new Error(getString('videoBufferNotSet',
|
|
97
|
+
throw new Error(getString('videoBufferNotSet', this.locale, { field: this.getLocalizedLabel() }));
|
|
98
98
|
}
|
|
99
99
|
try {
|
|
100
100
|
/**
|
|
@@ -111,7 +111,7 @@ export class VideoField extends FileField {
|
|
|
111
111
|
await fs.promises.writeFile(path.join(uploadsFolder, '.videos', this._folder, this.value), this._buffer);
|
|
112
112
|
}
|
|
113
113
|
catch (error) {
|
|
114
|
-
throw new Error(getString('videoWriteError',
|
|
114
|
+
throw new Error(getString('videoWriteError', this.locale, { field: this.getLocalizedLabel() }) + ` ${error.message}`);
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
117
|
async postSubmit(folder) {
|
|
@@ -120,7 +120,7 @@ export class VideoField extends FileField {
|
|
|
120
120
|
}
|
|
121
121
|
async postSubmitRollback() {
|
|
122
122
|
if (!this._folder) {
|
|
123
|
-
throw new Error(getString('videoFolderNotSet',
|
|
123
|
+
throw new Error(getString('videoFolderNotSet', this.locale, { field: this.getLocalizedLabel() }));
|
|
124
124
|
}
|
|
125
125
|
try {
|
|
126
126
|
const uploadsFolder = (await getCMSConfig()).media.upload.path;
|
|
@@ -128,7 +128,7 @@ export class VideoField extends FileField {
|
|
|
128
128
|
await fs.promises.unlink(pathToFile);
|
|
129
129
|
}
|
|
130
130
|
catch (error) {
|
|
131
|
-
throw new Error(getString('fileDeleteError',
|
|
131
|
+
throw new Error(getString('fileDeleteError', this.locale, { field: this.getLocalizedLabel() }));
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
134
|
async cleanupReplacedFile(previousValue, sectionName) {
|
|
@@ -166,7 +166,7 @@ export class VideoField extends FileField {
|
|
|
166
166
|
* Note: Those values are coming from the browser (not safe)
|
|
167
167
|
*/
|
|
168
168
|
if ((this.required && !this._file) || !this._file?.type || !this._file?.name || !this._file?.size) {
|
|
169
|
-
throw new Error(getString('fieldIsRequired',
|
|
169
|
+
throw new Error(getString('fieldIsRequired', this.locale, { field: this.getLocalizedLabel() }));
|
|
170
170
|
}
|
|
171
171
|
}
|
|
172
172
|
/**
|
|
@@ -181,14 +181,14 @@ export class VideoField extends FileField {
|
|
|
181
181
|
const arrayBuffer = await this._file.arrayBuffer();
|
|
182
182
|
this._buffer = Buffer.from(arrayBuffer);
|
|
183
183
|
if (!this._buffer.length) {
|
|
184
|
-
throw new Error(getString('fieldIsRequired',
|
|
184
|
+
throw new Error(getString('fieldIsRequired', this.locale, { field: this.getLocalizedLabel() }));
|
|
185
185
|
}
|
|
186
186
|
/**
|
|
187
187
|
* Check extension
|
|
188
188
|
*/
|
|
189
189
|
const ext = this._file.name.split('.').pop();
|
|
190
190
|
if (!ext || !this.extensions.includes(ext)) {
|
|
191
|
-
throw new Error(getString('invalidFileTypeOrExtension',
|
|
191
|
+
throw new Error(getString('invalidFileTypeOrExtension', this.locale, { field: this.getLocalizedLabel(), extensions: this.extensions.join(', ') }));
|
|
192
192
|
}
|
|
193
193
|
/**
|
|
194
194
|
* Read the first 4100 bytes of the file
|
|
@@ -203,14 +203,14 @@ export class VideoField extends FileField {
|
|
|
203
203
|
* If the file type is invalid, return an error
|
|
204
204
|
*/
|
|
205
205
|
if (!fileType) {
|
|
206
|
-
throw new Error(getString('invalidDocumentFileType',
|
|
206
|
+
throw new Error(getString('invalidDocumentFileType', this.locale, { field: this.getLocalizedLabel() }));
|
|
207
207
|
}
|
|
208
208
|
/**
|
|
209
209
|
* Don't just trust the file extension
|
|
210
210
|
* Check the `fileType.ext` against the allowed extensions
|
|
211
211
|
*/
|
|
212
212
|
if (!fileType.ext || !this.extensions.includes(fileType.ext)) {
|
|
213
|
-
throw new Error(getString('invalidFileTypeOrExtension',
|
|
213
|
+
throw new Error(getString('invalidFileTypeOrExtension', this.locale, { field: this.getLocalizedLabel(), extensions: this.extensions.join(', ') }));
|
|
214
214
|
}
|
|
215
215
|
/**
|
|
216
216
|
* Generate a random name for the file
|
|
@@ -119,8 +119,23 @@ declare const optionsSchema: z.ZodObject<{
|
|
|
119
119
|
allowRecursiveDelete: z.ZodOptional<z.ZodBoolean>;
|
|
120
120
|
fields: z.ZodUnion<[z.ZodArray<z.ZodCustom<FieldConfig, FieldConfig>>, z.ZodArray<z.ZodCustom<FieldGroupConfig, FieldGroupConfig>>]>;
|
|
121
121
|
name: z.ZodString;
|
|
122
|
+
gallery: z.ZodOptional<z.ZodObject<{
|
|
123
|
+
db: z.ZodObject<{
|
|
124
|
+
tableName: z.ZodString;
|
|
125
|
+
identifierField: z.ZodOptional<z.ZodString>;
|
|
126
|
+
photoNameField: z.ZodOptional<z.ZodString>;
|
|
127
|
+
metaField: z.ZodOptional<z.ZodString>;
|
|
128
|
+
}, z.core.$strict>;
|
|
129
|
+
watermark: z.ZodOptional<z.ZodBoolean>;
|
|
130
|
+
thumbnail: z.ZodOptional<z.ZodObject<{
|
|
131
|
+
width: z.ZodNumber;
|
|
132
|
+
height: z.ZodNumber;
|
|
133
|
+
crop: z.ZodBoolean;
|
|
134
|
+
quality: z.ZodNumber;
|
|
135
|
+
}, z.core.$strict>>;
|
|
136
|
+
}, z.core.$strict>>;
|
|
122
137
|
readonly: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
123
|
-
|
|
138
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
124
139
|
db: z.ZodObject<{
|
|
125
140
|
table: z.ZodString;
|
|
126
141
|
identifier: z.ZodOptional<z.ZodCustom<FieldConfig, FieldConfig>>;
|
|
@@ -144,23 +159,8 @@ declare const optionsSchema: z.ZodObject<{
|
|
|
144
159
|
name: z.ZodOptional<z.ZodString>;
|
|
145
160
|
}, z.core.$strict>>>;
|
|
146
161
|
}, z.core.$strict>;
|
|
147
|
-
icon: z.ZodOptional<z.ZodString>;
|
|
148
|
-
gallery: z.ZodOptional<z.ZodObject<{
|
|
149
|
-
db: z.ZodObject<{
|
|
150
|
-
tableName: z.ZodString;
|
|
151
|
-
identifierField: z.ZodOptional<z.ZodString>;
|
|
152
|
-
photoNameField: z.ZodOptional<z.ZodString>;
|
|
153
|
-
metaField: z.ZodOptional<z.ZodString>;
|
|
154
|
-
}, z.core.$strict>;
|
|
155
|
-
watermark: z.ZodOptional<z.ZodBoolean>;
|
|
156
|
-
thumbnail: z.ZodOptional<z.ZodObject<{
|
|
157
|
-
width: z.ZodNumber;
|
|
158
|
-
height: z.ZodNumber;
|
|
159
|
-
crop: z.ZodBoolean;
|
|
160
|
-
quality: z.ZodNumber;
|
|
161
|
-
}, z.core.$strict>>;
|
|
162
|
-
}, z.core.$strict>>;
|
|
163
162
|
variants: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types/index.js").Variant, import("../types/index.js").Variant>>>;
|
|
163
|
+
order: z.ZodNumber;
|
|
164
164
|
hooks: z.ZodOptional<z.ZodCustom<import("./section.js").Hooks, import("./section.js").Hooks>>;
|
|
165
165
|
}, z.core.$strict>;
|
|
166
166
|
export declare const categorySectionConfigSchema: z.ZodObject<{
|
|
@@ -216,8 +216,23 @@ export declare const categorySectionConfigSchema: z.ZodObject<{
|
|
|
216
216
|
*/
|
|
217
217
|
allowRecursiveDelete: z.ZodOptional<z.ZodBoolean>;
|
|
218
218
|
name: z.ZodString;
|
|
219
|
+
gallery: z.ZodOptional<z.ZodObject<{
|
|
220
|
+
db: z.ZodObject<{
|
|
221
|
+
tableName: z.ZodString;
|
|
222
|
+
identifierField: z.ZodOptional<z.ZodString>;
|
|
223
|
+
photoNameField: z.ZodOptional<z.ZodString>;
|
|
224
|
+
metaField: z.ZodOptional<z.ZodString>;
|
|
225
|
+
}, z.core.$strict>;
|
|
226
|
+
watermark: z.ZodOptional<z.ZodBoolean>;
|
|
227
|
+
thumbnail: z.ZodOptional<z.ZodObject<{
|
|
228
|
+
width: z.ZodNumber;
|
|
229
|
+
height: z.ZodNumber;
|
|
230
|
+
crop: z.ZodBoolean;
|
|
231
|
+
quality: z.ZodNumber;
|
|
232
|
+
}, z.core.$strict>>;
|
|
233
|
+
}, z.core.$strict>>;
|
|
219
234
|
readonly: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
220
|
-
|
|
235
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
221
236
|
db: z.ZodObject<{
|
|
222
237
|
table: z.ZodString;
|
|
223
238
|
identifier: z.ZodOptional<z.ZodCustom<FieldConfig, FieldConfig>>;
|
|
@@ -241,23 +256,8 @@ export declare const categorySectionConfigSchema: z.ZodObject<{
|
|
|
241
256
|
name: z.ZodOptional<z.ZodString>;
|
|
242
257
|
}, z.core.$strict>>>;
|
|
243
258
|
}, z.core.$strict>;
|
|
244
|
-
icon: z.ZodOptional<z.ZodString>;
|
|
245
|
-
gallery: z.ZodOptional<z.ZodObject<{
|
|
246
|
-
db: z.ZodObject<{
|
|
247
|
-
tableName: z.ZodString;
|
|
248
|
-
identifierField: z.ZodOptional<z.ZodString>;
|
|
249
|
-
photoNameField: z.ZodOptional<z.ZodString>;
|
|
250
|
-
metaField: z.ZodOptional<z.ZodString>;
|
|
251
|
-
}, z.core.$strict>;
|
|
252
|
-
watermark: z.ZodOptional<z.ZodBoolean>;
|
|
253
|
-
thumbnail: z.ZodOptional<z.ZodObject<{
|
|
254
|
-
width: z.ZodNumber;
|
|
255
|
-
height: z.ZodNumber;
|
|
256
|
-
crop: z.ZodBoolean;
|
|
257
|
-
quality: z.ZodNumber;
|
|
258
|
-
}, z.core.$strict>>;
|
|
259
|
-
}, z.core.$strict>>;
|
|
260
259
|
variants: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types/index.js").Variant, import("../types/index.js").Variant>>>;
|
|
260
|
+
order: z.ZodNumber;
|
|
261
261
|
hooks: z.ZodOptional<z.ZodCustom<import("./section.js").Hooks, import("./section.js").Hooks>>;
|
|
262
262
|
}, z.core.$strict>;
|
|
263
263
|
export type CategorySectionOptions = z.infer<typeof optionsSchema>;
|
|
@@ -418,8 +418,23 @@ declare const optionsSchema: z.ZodObject<{
|
|
|
418
418
|
generateQR: z.ZodOptional<z.ZodBoolean>;
|
|
419
419
|
fields: z.ZodUnion<[z.ZodArray<z.ZodCustom<FieldConfig, FieldConfig>>, z.ZodArray<z.ZodCustom<FieldGroupConfig, FieldGroupConfig>>]>;
|
|
420
420
|
name: z.ZodString;
|
|
421
|
+
gallery: z.ZodOptional<z.ZodObject<{
|
|
422
|
+
db: z.ZodObject<{
|
|
423
|
+
tableName: z.ZodString;
|
|
424
|
+
identifierField: z.ZodOptional<z.ZodString>;
|
|
425
|
+
photoNameField: z.ZodOptional<z.ZodString>;
|
|
426
|
+
metaField: z.ZodOptional<z.ZodString>;
|
|
427
|
+
}, z.core.$strict>;
|
|
428
|
+
watermark: z.ZodOptional<z.ZodBoolean>;
|
|
429
|
+
thumbnail: z.ZodOptional<z.ZodObject<{
|
|
430
|
+
width: z.ZodNumber;
|
|
431
|
+
height: z.ZodNumber;
|
|
432
|
+
crop: z.ZodBoolean;
|
|
433
|
+
quality: z.ZodNumber;
|
|
434
|
+
}, z.core.$strict>>;
|
|
435
|
+
}, z.core.$strict>>;
|
|
421
436
|
readonly: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
422
|
-
|
|
437
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
423
438
|
db: z.ZodObject<{
|
|
424
439
|
table: z.ZodString;
|
|
425
440
|
identifier: z.ZodOptional<z.ZodCustom<FieldConfig, FieldConfig>>;
|
|
@@ -443,23 +458,8 @@ declare const optionsSchema: z.ZodObject<{
|
|
|
443
458
|
name: z.ZodOptional<z.ZodString>;
|
|
444
459
|
}, z.core.$strict>>>;
|
|
445
460
|
}, z.core.$strict>;
|
|
446
|
-
icon: z.ZodOptional<z.ZodString>;
|
|
447
|
-
gallery: z.ZodOptional<z.ZodObject<{
|
|
448
|
-
db: z.ZodObject<{
|
|
449
|
-
tableName: z.ZodString;
|
|
450
|
-
identifierField: z.ZodOptional<z.ZodString>;
|
|
451
|
-
photoNameField: z.ZodOptional<z.ZodString>;
|
|
452
|
-
metaField: z.ZodOptional<z.ZodString>;
|
|
453
|
-
}, z.core.$strict>;
|
|
454
|
-
watermark: z.ZodOptional<z.ZodBoolean>;
|
|
455
|
-
thumbnail: z.ZodOptional<z.ZodObject<{
|
|
456
|
-
width: z.ZodNumber;
|
|
457
|
-
height: z.ZodNumber;
|
|
458
|
-
crop: z.ZodBoolean;
|
|
459
|
-
quality: z.ZodNumber;
|
|
460
|
-
}, z.core.$strict>>;
|
|
461
|
-
}, z.core.$strict>>;
|
|
462
461
|
variants: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types/index.js").Variant, import("../types/index.js").Variant>>>;
|
|
462
|
+
order: z.ZodNumber;
|
|
463
463
|
hooks: z.ZodOptional<z.ZodCustom<import("./section.js").Hooks, import("./section.js").Hooks>>;
|
|
464
464
|
}, z.core.$strict>;
|
|
465
465
|
declare const hasItemsSectionConfigSchema: z.ZodObject<{
|
|
@@ -659,8 +659,23 @@ declare const hasItemsSectionConfigSchema: z.ZodObject<{
|
|
|
659
659
|
}>>;
|
|
660
660
|
generateQR: z.ZodOptional<z.ZodBoolean>;
|
|
661
661
|
name: z.ZodString;
|
|
662
|
+
gallery: z.ZodOptional<z.ZodObject<{
|
|
663
|
+
db: z.ZodObject<{
|
|
664
|
+
tableName: z.ZodString;
|
|
665
|
+
identifierField: z.ZodOptional<z.ZodString>;
|
|
666
|
+
photoNameField: z.ZodOptional<z.ZodString>;
|
|
667
|
+
metaField: z.ZodOptional<z.ZodString>;
|
|
668
|
+
}, z.core.$strict>;
|
|
669
|
+
watermark: z.ZodOptional<z.ZodBoolean>;
|
|
670
|
+
thumbnail: z.ZodOptional<z.ZodObject<{
|
|
671
|
+
width: z.ZodNumber;
|
|
672
|
+
height: z.ZodNumber;
|
|
673
|
+
crop: z.ZodBoolean;
|
|
674
|
+
quality: z.ZodNumber;
|
|
675
|
+
}, z.core.$strict>>;
|
|
676
|
+
}, z.core.$strict>>;
|
|
662
677
|
readonly: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
663
|
-
|
|
678
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
664
679
|
db: z.ZodObject<{
|
|
665
680
|
table: z.ZodString;
|
|
666
681
|
identifier: z.ZodOptional<z.ZodCustom<FieldConfig, FieldConfig>>;
|
|
@@ -684,23 +699,8 @@ declare const hasItemsSectionConfigSchema: z.ZodObject<{
|
|
|
684
699
|
name: z.ZodOptional<z.ZodString>;
|
|
685
700
|
}, z.core.$strict>>>;
|
|
686
701
|
}, z.core.$strict>;
|
|
687
|
-
icon: z.ZodOptional<z.ZodString>;
|
|
688
|
-
gallery: z.ZodOptional<z.ZodObject<{
|
|
689
|
-
db: z.ZodObject<{
|
|
690
|
-
tableName: z.ZodString;
|
|
691
|
-
identifierField: z.ZodOptional<z.ZodString>;
|
|
692
|
-
photoNameField: z.ZodOptional<z.ZodString>;
|
|
693
|
-
metaField: z.ZodOptional<z.ZodString>;
|
|
694
|
-
}, z.core.$strict>;
|
|
695
|
-
watermark: z.ZodOptional<z.ZodBoolean>;
|
|
696
|
-
thumbnail: z.ZodOptional<z.ZodObject<{
|
|
697
|
-
width: z.ZodNumber;
|
|
698
|
-
height: z.ZodNumber;
|
|
699
|
-
crop: z.ZodBoolean;
|
|
700
|
-
quality: z.ZodNumber;
|
|
701
|
-
}, z.core.$strict>>;
|
|
702
|
-
}, z.core.$strict>>;
|
|
703
702
|
variants: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types/index.js").Variant, import("../types/index.js").Variant>>>;
|
|
703
|
+
order: z.ZodNumber;
|
|
704
704
|
hooks: z.ZodOptional<z.ZodCustom<import("./section.js").Hooks, import("./section.js").Hooks>>;
|
|
705
705
|
}, z.core.$strict>;
|
|
706
706
|
export type HasItemsSectionOptions = z.infer<typeof optionsSchema>;
|
|
@@ -63,8 +63,23 @@ export declare const baseSectionOptionsSchema: z.ZodObject<{
|
|
|
63
63
|
export declare const baseHelperFunctionOptionsSchema: z.ZodObject<{
|
|
64
64
|
fields: z.ZodUnion<[z.ZodArray<z.ZodCustom<FieldConfig, FieldConfig>>, z.ZodArray<z.ZodCustom<FieldGroupConfig, FieldGroupConfig>>]>;
|
|
65
65
|
name: z.ZodString;
|
|
66
|
+
gallery: z.ZodOptional<z.ZodObject<{
|
|
67
|
+
db: z.ZodObject<{
|
|
68
|
+
tableName: z.ZodString;
|
|
69
|
+
identifierField: z.ZodOptional<z.ZodString>;
|
|
70
|
+
photoNameField: z.ZodOptional<z.ZodString>;
|
|
71
|
+
metaField: z.ZodOptional<z.ZodString>;
|
|
72
|
+
}, z.core.$strict>;
|
|
73
|
+
watermark: z.ZodOptional<z.ZodBoolean>;
|
|
74
|
+
thumbnail: z.ZodOptional<z.ZodObject<{
|
|
75
|
+
width: z.ZodNumber;
|
|
76
|
+
height: z.ZodNumber;
|
|
77
|
+
crop: z.ZodBoolean;
|
|
78
|
+
quality: z.ZodNumber;
|
|
79
|
+
}, z.core.$strict>>;
|
|
80
|
+
}, z.core.$strict>>;
|
|
66
81
|
readonly: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
67
|
-
|
|
82
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
68
83
|
db: z.ZodObject<{
|
|
69
84
|
table: z.ZodString;
|
|
70
85
|
identifier: z.ZodOptional<z.ZodCustom<FieldConfig, FieldConfig>>;
|
|
@@ -88,23 +103,8 @@ export declare const baseHelperFunctionOptionsSchema: z.ZodObject<{
|
|
|
88
103
|
name: z.ZodOptional<z.ZodString>;
|
|
89
104
|
}, z.core.$strict>>>;
|
|
90
105
|
}, z.core.$strict>;
|
|
91
|
-
icon: z.ZodOptional<z.ZodString>;
|
|
92
|
-
gallery: z.ZodOptional<z.ZodObject<{
|
|
93
|
-
db: z.ZodObject<{
|
|
94
|
-
tableName: z.ZodString;
|
|
95
|
-
identifierField: z.ZodOptional<z.ZodString>;
|
|
96
|
-
photoNameField: z.ZodOptional<z.ZodString>;
|
|
97
|
-
metaField: z.ZodOptional<z.ZodString>;
|
|
98
|
-
}, z.core.$strict>;
|
|
99
|
-
watermark: z.ZodOptional<z.ZodBoolean>;
|
|
100
|
-
thumbnail: z.ZodOptional<z.ZodObject<{
|
|
101
|
-
width: z.ZodNumber;
|
|
102
|
-
height: z.ZodNumber;
|
|
103
|
-
crop: z.ZodBoolean;
|
|
104
|
-
quality: z.ZodNumber;
|
|
105
|
-
}, z.core.$strict>>;
|
|
106
|
-
}, z.core.$strict>>;
|
|
107
106
|
variants: z.ZodOptional<z.ZodArray<z.ZodCustom<Variant, Variant>>>;
|
|
107
|
+
order: z.ZodNumber;
|
|
108
108
|
hooks: z.ZodOptional<z.ZodCustom<Hooks, Hooks>>;
|
|
109
109
|
}, z.core.$strict>;
|
|
110
110
|
export declare function validateSectionConfig(config: BaseSectionOptions): void;
|
|
@@ -24,9 +24,6 @@ declare const optionsSchema: z.ZodObject<{
|
|
|
24
24
|
}, z.core.$strict>;
|
|
25
25
|
fields: z.ZodUnion<[z.ZodArray<z.ZodCustom<FieldConfig, FieldConfig>>, z.ZodArray<z.ZodCustom<FieldGroupConfig, FieldGroupConfig>>]>;
|
|
26
26
|
name: z.ZodString;
|
|
27
|
-
readonly: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
28
|
-
order: z.ZodNumber;
|
|
29
|
-
icon: z.ZodOptional<z.ZodString>;
|
|
30
27
|
gallery: z.ZodOptional<z.ZodObject<{
|
|
31
28
|
db: z.ZodObject<{
|
|
32
29
|
tableName: z.ZodString;
|
|
@@ -42,7 +39,10 @@ declare const optionsSchema: z.ZodObject<{
|
|
|
42
39
|
quality: z.ZodNumber;
|
|
43
40
|
}, z.core.$strict>>;
|
|
44
41
|
}, z.core.$strict>>;
|
|
42
|
+
readonly: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
43
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
45
44
|
variants: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types/index.js").Variant, import("../types/index.js").Variant>>>;
|
|
45
|
+
order: z.ZodNumber;
|
|
46
46
|
hooks: z.ZodOptional<z.ZodCustom<import("./section.js").Hooks, import("./section.js").Hooks>>;
|
|
47
47
|
}, z.core.$strict>;
|
|
48
48
|
declare const simpleSectionConfigSchema: z.ZodObject<{
|
|
@@ -55,9 +55,6 @@ declare const simpleSectionConfigSchema: z.ZodObject<{
|
|
|
55
55
|
table: z.ZodString;
|
|
56
56
|
}, z.core.$strict>;
|
|
57
57
|
name: z.ZodString;
|
|
58
|
-
readonly: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
59
|
-
order: z.ZodNumber;
|
|
60
|
-
icon: z.ZodOptional<z.ZodString>;
|
|
61
58
|
gallery: z.ZodOptional<z.ZodObject<{
|
|
62
59
|
db: z.ZodObject<{
|
|
63
60
|
tableName: z.ZodString;
|
|
@@ -73,7 +70,10 @@ declare const simpleSectionConfigSchema: z.ZodObject<{
|
|
|
73
70
|
quality: z.ZodNumber;
|
|
74
71
|
}, z.core.$strict>>;
|
|
75
72
|
}, z.core.$strict>>;
|
|
73
|
+
readonly: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
74
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
76
75
|
variants: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types/index.js").Variant, import("../types/index.js").Variant>>>;
|
|
76
|
+
order: z.ZodNumber;
|
|
77
77
|
hooks: z.ZodOptional<z.ZodCustom<import("./section.js").Hooks, import("./section.js").Hooks>>;
|
|
78
78
|
}, z.core.$strict>;
|
|
79
79
|
export type SimpleSectionOptions = z.infer<typeof optionsSchema>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"submit.d.ts","sourceRoot":"","sources":["../../../src/core/submit/submit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA;AAGtC,OAAO,KAAK,EAAE,KAAK,EAAe,MAAM,WAAW,CAAA;AACnD,OAAO,KAAK,EAAE,OAAO,EAAoC,MAAM,aAAa,CAAA;AAE5E,OAAO,EAAE,UAAU,EAAM,MAAM,YAAY,CAAA;AAG3C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AACtC,OAAO,EAAa,KAAK,YAAY,EAAE,KAAK,eAAe,EAAE,MAAM,wBAAwB,CAAA;
|
|
1
|
+
{"version":3,"file":"submit.d.ts","sourceRoot":"","sources":["../../../src/core/submit/submit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA;AAGtC,OAAO,KAAK,EAAE,KAAK,EAAe,MAAM,WAAW,CAAA;AACnD,OAAO,KAAK,EAAE,OAAO,EAAoC,MAAM,aAAa,CAAA;AAE5E,OAAO,EAAE,UAAU,EAAM,MAAM,YAAY,CAAA;AAG3C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AACtC,OAAO,EAAa,KAAK,YAAY,EAAE,KAAK,eAAe,EAAE,MAAM,wBAA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AI,CAE7B;IAED,OAAO,CAAC,SAAS;CAMpB"}
|
|
@@ -7,6 +7,8 @@ import { MysqlTableChecker } from '../db';
|
|
|
7
7
|
import { recordLog } from '../../logging/index.js';
|
|
8
8
|
import getString from '../../translations';
|
|
9
9
|
import { resolveLocalizedString } from '../../translations/localization.js';
|
|
10
|
+
import { resolveLocale } from '../../translations/locale-utils.js';
|
|
11
|
+
import { getCMSConfig } from '../config/index.js';
|
|
10
12
|
export class Submit {
|
|
11
13
|
static [entityKind] = 'Submit';
|
|
12
14
|
user;
|
|
@@ -178,6 +180,14 @@ export class Submit {
|
|
|
178
180
|
* Build the fields from the field configs
|
|
179
181
|
*/
|
|
180
182
|
this._sectionInfo.buildFields();
|
|
183
|
+
/**
|
|
184
|
+
* Set locale for fields so validation errors are localized
|
|
185
|
+
*/
|
|
186
|
+
const cmsConfig = await getCMSConfig();
|
|
187
|
+
const locale = resolveLocale(user.locale, cmsConfig.i18n.supportedLanguages, cmsConfig.i18n.fallbackLanguage);
|
|
188
|
+
for (const field of this._sectionInfo.fields) {
|
|
189
|
+
field.setLocale(locale, cmsConfig.i18n.fallbackLanguage);
|
|
190
|
+
}
|
|
181
191
|
}
|
|
182
192
|
/**
|
|
183
193
|
* Perform post submit operations
|