nextjs-cms 0.7.3 → 0.7.5
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 +32 -24
- package/dist/core/config/config-loader.d.ts.map +1 -1
- package/dist/core/config/config-loader.js +45 -23
- package/dist/core/fields/photo.d.ts +6 -6
- package/dist/core/fields/photo.js +3 -3
- package/dist/core/fields/richText.d.ts +9 -9
- package/dist/core/fields/select.d.ts +1 -1
- package/dist/core/sections/category.d.ts +4 -4
- package/dist/core/sections/hasItems.d.ts +10 -10
- package/dist/core/sections/section.d.ts +15 -4
- package/dist/core/sections/section.d.ts.map +1 -1
- package/dist/core/sections/section.js +3 -3
- package/dist/core/sections/simple.d.ts +2 -2
- package/dist/core/submit/ItemEditSubmit.d.ts +10 -0
- package/dist/core/submit/ItemEditSubmit.d.ts.map +1 -1
- package/dist/core/submit/ItemEditSubmit.js +38 -0
- package/dist/core/submit/NewItemSubmit.d.ts +10 -0
- package/dist/core/submit/NewItemSubmit.d.ts.map +1 -1
- package/dist/core/submit/NewItemSubmit.js +37 -0
- package/dist/core/submit/submit.d.ts +4 -2
- package/dist/core/submit/submit.d.ts.map +1 -1
- package/dist/core/submit/submit.js +6 -28
- package/dist/translations/client.d.ts +4 -4
- package/dist/translations/server.d.ts +4 -4
- package/package.json +1 -1
|
@@ -31,23 +31,27 @@ declare const cmsConfigSchema: z.ZodObject<{
|
|
|
31
31
|
alpha: z.ZodNumber;
|
|
32
32
|
}, z.core.$strip>>;
|
|
33
33
|
image: z.ZodOptional<z.ZodObject<{
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
34
|
+
size: z.ZodOptional<z.ZodObject<{
|
|
35
|
+
width: z.ZodNumber;
|
|
36
|
+
height: z.ZodNumber;
|
|
37
|
+
fit: z.ZodEnum<{
|
|
38
|
+
cover: "cover";
|
|
39
|
+
contain: "contain";
|
|
40
|
+
}>;
|
|
41
|
+
strict: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
42
|
+
}, z.core.$strip>>;
|
|
43
|
+
quality: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
42
44
|
}, z.core.$strip>>;
|
|
43
45
|
thumbnail: z.ZodOptional<z.ZodObject<{
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
46
|
+
size: z.ZodOptional<z.ZodObject<{
|
|
47
|
+
width: z.ZodNumber;
|
|
48
|
+
height: z.ZodNumber;
|
|
49
|
+
fit: z.ZodEnum<{
|
|
50
|
+
cover: "cover";
|
|
51
|
+
contain: "contain";
|
|
52
|
+
}>;
|
|
53
|
+
}, z.core.$strip>>;
|
|
54
|
+
quality: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
51
55
|
}, z.core.$strip>>;
|
|
52
56
|
watermark: z.ZodOptional<z.ZodBoolean>;
|
|
53
57
|
}, z.core.$strip>>;
|
|
@@ -126,17 +130,21 @@ export interface ComputedCMSConfig {
|
|
|
126
130
|
alpha: number;
|
|
127
131
|
};
|
|
128
132
|
image: {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
133
|
+
size: {
|
|
134
|
+
width: number;
|
|
135
|
+
height: number;
|
|
136
|
+
fit: 'cover' | 'contain';
|
|
137
|
+
strict: boolean;
|
|
138
|
+
};
|
|
139
|
+
quality: number;
|
|
134
140
|
};
|
|
135
141
|
thumbnail: {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
142
|
+
size: {
|
|
143
|
+
width: number;
|
|
144
|
+
height: number;
|
|
145
|
+
fit: 'cover' | 'contain';
|
|
146
|
+
};
|
|
147
|
+
quality: number;
|
|
140
148
|
};
|
|
141
149
|
watermark: boolean;
|
|
142
150
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-loader.d.ts","sourceRoot":"","sources":["../../../src/core/config/config-loader.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AAGxB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAA;AAEzE,2DAA2D;AAC3D,eAAO,MAAM,sBAAsB,iBAAkB,CAAA;AAErD,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAA;AAGrE,QAAA,MAAM,eAAe
|
|
1
|
+
{"version":3,"file":"config-loader.d.ts","sourceRoot":"","sources":["../../../src/core/config/config-loader.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AAGxB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAA;AAEzE,2DAA2D;AAC3D,eAAO,MAAM,sBAAsB,iBAAkB,CAAA;AAErD,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAA;AAGrE,QAAA,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAmQnB,CAAA;AAGF,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAA;AAEvD,MAAM,WAAW,mBAAmB;IAChC,KAAK,CAAC,EAAE,eAAe,CAAA;CAC1B;AAED,MAAM,WAAW,iBAAiB;IAC9B,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACjC,iEAAiE;IACjE,KAAK,CAAC,EAAE,eAAe,CAAA;IACvB,+CAA+C;IAC/C,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC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EAAE,MAAM,CAAA;YAChB,MAAM,EAAE;gBACJ,MAAM,EAAE,WAAW,GAAG,WAAW,GAAG,YAAY,CAAA;gBAChD,OAAO,EAAE,WAAW,GAAG,WAAW,GAAG,YAAY,CAAA;aACpD,CAAA;SACJ,CAAA;KACJ,CAAA;IACD,OAAO,EAAE,iBAAiB,EAAE,CAAA;IAC5B,IAAI,EAAE;QACF,kBAAkB,EAAE,SAAS,MAAM,EAAE,CAAA;QACrC,gBAAgB,EAAE,MAAM,CAAA;KAC3B,CAAA;IACD,SAAS,EAAE;QACP,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;KAC1B,CAAA;CACJ;AA+MD;;;;;;GAMG;AACH,wBAAsB,YAAY,IAAI,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC,CAazE"}
|
|
@@ -107,11 +107,15 @@ const cmsConfigSchema = z.object({
|
|
|
107
107
|
*/
|
|
108
108
|
image: z
|
|
109
109
|
.object({
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
110
|
+
size: z
|
|
111
|
+
.object({
|
|
112
|
+
width: z.number(),
|
|
113
|
+
height: z.number(),
|
|
114
|
+
fit: z.enum(['cover', 'contain']),
|
|
115
|
+
strict: z.boolean().optional().default(false),
|
|
116
|
+
})
|
|
117
|
+
.optional(),
|
|
118
|
+
quality: z.number().min(50).max(100).optional().default(80),
|
|
115
119
|
})
|
|
116
120
|
.optional(),
|
|
117
121
|
/**
|
|
@@ -119,10 +123,14 @@ const cmsConfigSchema = z.object({
|
|
|
119
123
|
*/
|
|
120
124
|
thumbnail: z
|
|
121
125
|
.object({
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
+
size: z
|
|
127
|
+
.object({
|
|
128
|
+
width: z.number(),
|
|
129
|
+
height: z.number(),
|
|
130
|
+
fit: z.enum(['cover', 'contain']),
|
|
131
|
+
})
|
|
132
|
+
.optional(),
|
|
133
|
+
quality: z.number().min(50).max(100).optional().default(80),
|
|
126
134
|
})
|
|
127
135
|
.optional(),
|
|
128
136
|
/**
|
|
@@ -291,16 +299,26 @@ function mergeConfig(defaults, userConfig) {
|
|
|
291
299
|
images: {
|
|
292
300
|
background: userConfig.media?.images?.background ?? defaults.media.images.background,
|
|
293
301
|
image: {
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
302
|
+
size: {
|
|
303
|
+
width: userConfig.media?.images?.image?.size?.width ??
|
|
304
|
+
defaults.media.images.image.size.width,
|
|
305
|
+
height: userConfig.media?.images?.image?.size?.height ??
|
|
306
|
+
defaults.media.images.image.size.height,
|
|
307
|
+
fit: userConfig.media?.images?.image?.size?.fit ?? defaults.media.images.image.size.fit,
|
|
308
|
+
strict: userConfig.media?.images?.image?.size?.strict ??
|
|
309
|
+
defaults.media.images.image.size.strict,
|
|
310
|
+
},
|
|
298
311
|
quality: userConfig.media?.images?.image?.quality ?? defaults.media.images.image.quality,
|
|
299
312
|
},
|
|
300
313
|
thumbnail: {
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
314
|
+
size: {
|
|
315
|
+
width: userConfig.media?.images?.thumbnail?.size?.width ??
|
|
316
|
+
defaults.media.images.thumbnail.size.width,
|
|
317
|
+
height: userConfig.media?.images?.thumbnail?.size?.height ??
|
|
318
|
+
defaults.media.images.thumbnail.size.height,
|
|
319
|
+
fit: userConfig.media?.images?.thumbnail?.size?.fit ??
|
|
320
|
+
defaults.media.images.thumbnail.size.fit,
|
|
321
|
+
},
|
|
304
322
|
quality: userConfig.media?.images?.thumbnail?.quality ?? defaults.media.images.thumbnail.quality,
|
|
305
323
|
},
|
|
306
324
|
watermark: userConfig.media?.images?.watermark ?? defaults.media.images.watermark,
|
|
@@ -350,16 +368,20 @@ const defaultConfig = {
|
|
|
350
368
|
images: {
|
|
351
369
|
background: { r: 0, g: 0, b: 0, alpha: 0 },
|
|
352
370
|
image: {
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
371
|
+
size: {
|
|
372
|
+
width: 1200,
|
|
373
|
+
height: 630,
|
|
374
|
+
fit: 'cover',
|
|
375
|
+
strict: false,
|
|
376
|
+
},
|
|
357
377
|
quality: 80,
|
|
358
378
|
},
|
|
359
379
|
thumbnail: {
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
380
|
+
size: {
|
|
381
|
+
width: 200,
|
|
382
|
+
height: 200,
|
|
383
|
+
fit: 'contain',
|
|
384
|
+
},
|
|
363
385
|
quality: 80,
|
|
364
386
|
},
|
|
365
387
|
watermark: false,
|
|
@@ -104,10 +104,10 @@ declare const configSchema: z.ZodObject<{
|
|
|
104
104
|
* @hint 'jpg' is an alias for 'jpeg'
|
|
105
105
|
*/
|
|
106
106
|
fileType: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
107
|
-
|
|
107
|
+
webp: "webp";
|
|
108
108
|
jpg: "jpg";
|
|
109
|
+
jpeg: "jpeg";
|
|
109
110
|
png: "png";
|
|
110
|
-
webp: "webp";
|
|
111
111
|
}>>>;
|
|
112
112
|
/**
|
|
113
113
|
* Remove the extension from the file name
|
|
@@ -298,10 +298,10 @@ declare const optionsSchema: z.ZodObject<{
|
|
|
298
298
|
* @hint 'jpg' is an alias for 'jpeg'
|
|
299
299
|
*/
|
|
300
300
|
fileType: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
301
|
-
|
|
301
|
+
webp: "webp";
|
|
302
302
|
jpg: "jpg";
|
|
303
|
+
jpeg: "jpeg";
|
|
303
304
|
png: "png";
|
|
304
|
-
webp: "webp";
|
|
305
305
|
}>>>;
|
|
306
306
|
/**
|
|
307
307
|
* Remove the extension from the file name
|
|
@@ -393,10 +393,10 @@ declare const photoFieldConfigSchema: z.ZodObject<{
|
|
|
393
393
|
* @hint 'jpg' is an alias for 'jpeg'
|
|
394
394
|
*/
|
|
395
395
|
fileType: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
396
|
-
|
|
396
|
+
webp: "webp";
|
|
397
397
|
jpg: "jpg";
|
|
398
|
+
jpeg: "jpeg";
|
|
398
399
|
png: "png";
|
|
399
|
-
webp: "webp";
|
|
400
400
|
}>>>;
|
|
401
401
|
/**
|
|
402
402
|
* Remove the extension from the file name
|
|
@@ -175,10 +175,10 @@ export class PhotoField extends FileField {
|
|
|
175
175
|
// Fetch CMS config and construct a ThumbnailConfig from it
|
|
176
176
|
const cmsConfig = await getCMSConfig();
|
|
177
177
|
const t = cmsConfig.media.images.thumbnail;
|
|
178
|
-
const fit = t.fit ?? 'contain';
|
|
178
|
+
const fit = t.size.fit ?? 'contain';
|
|
179
179
|
this._thumbnail = fit === 'contain'
|
|
180
|
-
? { width: t.width, height: t.height, fit: 'contain', quality: t.quality }
|
|
181
|
-
: { width: t.width, height: t.height, fit: 'cover', quality: t.quality };
|
|
180
|
+
? { width: t.size.width, height: t.size.height, fit: 'contain', quality: t.quality }
|
|
181
|
+
: { width: t.size.width, height: t.size.height, fit: 'cover', quality: t.quality };
|
|
182
182
|
}
|
|
183
183
|
return this._thumbnail;
|
|
184
184
|
}
|
|
@@ -31,10 +31,10 @@ declare const allowImageUploadsSchema: z.ZodObject<{
|
|
|
31
31
|
*/
|
|
32
32
|
omitExtension: z.ZodOptional<z.ZodBoolean>;
|
|
33
33
|
format: z.ZodOptional<z.ZodEnum<{
|
|
34
|
-
|
|
34
|
+
webp: "webp";
|
|
35
35
|
jpg: "jpg";
|
|
36
|
+
jpeg: "jpeg";
|
|
36
37
|
png: "png";
|
|
37
|
-
webp: "webp";
|
|
38
38
|
}>>;
|
|
39
39
|
}, z.core.$strict>;
|
|
40
40
|
declare const configSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
@@ -72,10 +72,10 @@ declare const configSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
72
72
|
*/
|
|
73
73
|
omitExtension: z.ZodOptional<z.ZodBoolean>;
|
|
74
74
|
format: z.ZodOptional<z.ZodEnum<{
|
|
75
|
-
|
|
75
|
+
webp: "webp";
|
|
76
76
|
jpg: "jpg";
|
|
77
|
+
jpeg: "jpeg";
|
|
77
78
|
png: "png";
|
|
78
|
-
webp: "webp";
|
|
79
79
|
}>>;
|
|
80
80
|
}, z.core.$strict>>;
|
|
81
81
|
}, z.core.$strict>, z.ZodObject<{
|
|
@@ -118,7 +118,7 @@ export declare class RichTextField extends Field<'rich_text', Config> {
|
|
|
118
118
|
} | undefined;
|
|
119
119
|
handleMethod?: "base64" | "tempSave" | undefined;
|
|
120
120
|
omitExtension?: boolean | undefined;
|
|
121
|
-
format?: "
|
|
121
|
+
format?: "webp" | "jpg" | "jpeg" | "png" | undefined;
|
|
122
122
|
};
|
|
123
123
|
sanitize: boolean;
|
|
124
124
|
type: "rich_text";
|
|
@@ -186,10 +186,10 @@ declare const optionsSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
186
186
|
*/
|
|
187
187
|
omitExtension: z.ZodOptional<z.ZodBoolean>;
|
|
188
188
|
format: z.ZodOptional<z.ZodEnum<{
|
|
189
|
-
|
|
189
|
+
webp: "webp";
|
|
190
190
|
jpg: "jpg";
|
|
191
|
+
jpeg: "jpeg";
|
|
191
192
|
png: "png";
|
|
192
|
-
webp: "webp";
|
|
193
193
|
}>>;
|
|
194
194
|
}, z.core.$strict>>;
|
|
195
195
|
name: z.ZodString;
|
|
@@ -248,10 +248,10 @@ declare const richTextFieldConfigSchema: z.ZodIntersection<z.ZodDiscriminatedUni
|
|
|
248
248
|
*/
|
|
249
249
|
omitExtension: z.ZodOptional<z.ZodBoolean>;
|
|
250
250
|
format: z.ZodOptional<z.ZodEnum<{
|
|
251
|
-
|
|
251
|
+
webp: "webp";
|
|
252
252
|
jpg: "jpg";
|
|
253
|
+
jpeg: "jpeg";
|
|
253
254
|
png: "png";
|
|
254
|
-
webp: "webp";
|
|
255
255
|
}>>;
|
|
256
256
|
}, z.core.$strict>>;
|
|
257
257
|
name: z.ZodString;
|
|
@@ -346,8 +346,8 @@ declare const selectFieldConfigSchema: z.ZodIntersection<z.ZodUnion<readonly [z.
|
|
|
346
346
|
}, z.core.$strict>]>, z.ZodObject<{
|
|
347
347
|
type: z.ZodLiteral<"select">;
|
|
348
348
|
optionsType: z.ZodEnum<{
|
|
349
|
-
db: "db";
|
|
350
349
|
section: "section";
|
|
350
|
+
db: "db";
|
|
351
351
|
static: "static";
|
|
352
352
|
}>;
|
|
353
353
|
build: z.ZodFunction<z.core.$ZodFunctionArgs, z.ZodCustom<SelectField, SelectField>>;
|
|
@@ -118,9 +118,7 @@ declare const optionsSchema: z.ZodObject<{
|
|
|
118
118
|
*/
|
|
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
|
-
readonly: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
122
121
|
name: z.ZodString;
|
|
123
|
-
order: z.ZodNumber;
|
|
124
122
|
db: z.ZodObject<{
|
|
125
123
|
table: z.ZodString;
|
|
126
124
|
identifier: z.ZodOptional<z.ZodCustom<FieldConfig, FieldConfig>>;
|
|
@@ -144,6 +142,8 @@ declare const optionsSchema: z.ZodObject<{
|
|
|
144
142
|
name: z.ZodOptional<z.ZodString>;
|
|
145
143
|
}, z.core.$strict>>>;
|
|
146
144
|
}, z.core.$strict>;
|
|
145
|
+
readonly: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
146
|
+
order: z.ZodNumber;
|
|
147
147
|
icon: z.ZodOptional<z.ZodString>;
|
|
148
148
|
gallery: z.ZodOptional<z.ZodObject<{
|
|
149
149
|
db: z.ZodObject<{
|
|
@@ -218,9 +218,7 @@ export declare const categorySectionConfigSchema: z.ZodObject<{
|
|
|
218
218
|
* @default false
|
|
219
219
|
*/
|
|
220
220
|
allowRecursiveDelete: z.ZodOptional<z.ZodBoolean>;
|
|
221
|
-
readonly: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
222
221
|
name: z.ZodString;
|
|
223
|
-
order: z.ZodNumber;
|
|
224
222
|
db: z.ZodObject<{
|
|
225
223
|
table: z.ZodString;
|
|
226
224
|
identifier: z.ZodOptional<z.ZodCustom<FieldConfig, FieldConfig>>;
|
|
@@ -244,6 +242,8 @@ export declare const categorySectionConfigSchema: z.ZodObject<{
|
|
|
244
242
|
name: z.ZodOptional<z.ZodString>;
|
|
245
243
|
}, z.core.$strict>>>;
|
|
246
244
|
}, z.core.$strict>;
|
|
245
|
+
readonly: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
246
|
+
order: z.ZodNumber;
|
|
247
247
|
icon: z.ZodOptional<z.ZodString>;
|
|
248
248
|
gallery: z.ZodOptional<z.ZodObject<{
|
|
249
249
|
db: z.ZodObject<{
|
|
@@ -163,7 +163,7 @@ declare const configSchema: z.ZodObject<{
|
|
|
163
163
|
size: number;
|
|
164
164
|
unit: "kb" | "mb";
|
|
165
165
|
} | undefined;
|
|
166
|
-
fileType?: ("
|
|
166
|
+
fileType?: ("webp" | "jpg" | "jpeg" | "png")[] | undefined;
|
|
167
167
|
removeExtension?: boolean | undefined;
|
|
168
168
|
label?: string | Record<string, string> | undefined;
|
|
169
169
|
required?: boolean | undefined;
|
|
@@ -220,7 +220,7 @@ declare const configSchema: z.ZodObject<{
|
|
|
220
220
|
size: number;
|
|
221
221
|
unit: "kb" | "mb";
|
|
222
222
|
} | undefined;
|
|
223
|
-
fileType?: ("
|
|
223
|
+
fileType?: ("webp" | "jpg" | "jpeg" | "png")[] | undefined;
|
|
224
224
|
removeExtension?: boolean | undefined;
|
|
225
225
|
label?: string | Record<string, string> | undefined;
|
|
226
226
|
required?: boolean | undefined;
|
|
@@ -413,7 +413,7 @@ declare const optionsSchema: z.ZodObject<{
|
|
|
413
413
|
size: number;
|
|
414
414
|
unit: "kb" | "mb";
|
|
415
415
|
} | undefined;
|
|
416
|
-
fileType?: ("
|
|
416
|
+
fileType?: ("webp" | "jpg" | "jpeg" | "png")[] | undefined;
|
|
417
417
|
removeExtension?: boolean | undefined;
|
|
418
418
|
label?: string | Record<string, string> | undefined;
|
|
419
419
|
required?: boolean | undefined;
|
|
@@ -470,7 +470,7 @@ declare const optionsSchema: z.ZodObject<{
|
|
|
470
470
|
size: number;
|
|
471
471
|
unit: "kb" | "mb";
|
|
472
472
|
} | undefined;
|
|
473
|
-
fileType?: ("
|
|
473
|
+
fileType?: ("webp" | "jpg" | "jpeg" | "png")[] | undefined;
|
|
474
474
|
removeExtension?: boolean | undefined;
|
|
475
475
|
label?: string | Record<string, string> | undefined;
|
|
476
476
|
required?: boolean | undefined;
|
|
@@ -481,9 +481,7 @@ declare const optionsSchema: z.ZodObject<{
|
|
|
481
481
|
}>>;
|
|
482
482
|
generateQR: z.ZodOptional<z.ZodBoolean>;
|
|
483
483
|
fields: z.ZodUnion<[z.ZodArray<z.ZodCustom<FieldConfig, FieldConfig>>, z.ZodArray<z.ZodCustom<FieldGroupConfig, FieldGroupConfig>>]>;
|
|
484
|
-
readonly: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
485
484
|
name: z.ZodString;
|
|
486
|
-
order: z.ZodNumber;
|
|
487
485
|
db: z.ZodObject<{
|
|
488
486
|
table: z.ZodString;
|
|
489
487
|
identifier: z.ZodOptional<z.ZodCustom<FieldConfig, FieldConfig>>;
|
|
@@ -507,6 +505,8 @@ declare const optionsSchema: z.ZodObject<{
|
|
|
507
505
|
name: z.ZodOptional<z.ZodString>;
|
|
508
506
|
}, z.core.$strict>>>;
|
|
509
507
|
}, z.core.$strict>;
|
|
508
|
+
readonly: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
509
|
+
order: z.ZodNumber;
|
|
510
510
|
icon: z.ZodOptional<z.ZodString>;
|
|
511
511
|
gallery: z.ZodOptional<z.ZodObject<{
|
|
512
512
|
db: z.ZodObject<{
|
|
@@ -690,7 +690,7 @@ declare const hasItemsSectionConfigSchema: z.ZodObject<{
|
|
|
690
690
|
size: number;
|
|
691
691
|
unit: "kb" | "mb";
|
|
692
692
|
} | undefined;
|
|
693
|
-
fileType?: ("
|
|
693
|
+
fileType?: ("webp" | "jpg" | "jpeg" | "png")[] | undefined;
|
|
694
694
|
removeExtension?: boolean | undefined;
|
|
695
695
|
label?: string | Record<string, string> | undefined;
|
|
696
696
|
required?: boolean | undefined;
|
|
@@ -747,7 +747,7 @@ declare const hasItemsSectionConfigSchema: z.ZodObject<{
|
|
|
747
747
|
size: number;
|
|
748
748
|
unit: "kb" | "mb";
|
|
749
749
|
} | undefined;
|
|
750
|
-
fileType?: ("
|
|
750
|
+
fileType?: ("webp" | "jpg" | "jpeg" | "png")[] | undefined;
|
|
751
751
|
removeExtension?: boolean | undefined;
|
|
752
752
|
label?: string | Record<string, string> | undefined;
|
|
753
753
|
required?: boolean | undefined;
|
|
@@ -757,9 +757,7 @@ declare const hasItemsSectionConfigSchema: z.ZodObject<{
|
|
|
757
757
|
adminGenerated?: boolean | "readonly" | undefined;
|
|
758
758
|
}>>;
|
|
759
759
|
generateQR: z.ZodOptional<z.ZodBoolean>;
|
|
760
|
-
readonly: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
761
760
|
name: z.ZodString;
|
|
762
|
-
order: z.ZodNumber;
|
|
763
761
|
db: z.ZodObject<{
|
|
764
762
|
table: z.ZodString;
|
|
765
763
|
identifier: z.ZodOptional<z.ZodCustom<FieldConfig, FieldConfig>>;
|
|
@@ -783,6 +781,8 @@ declare const hasItemsSectionConfigSchema: z.ZodObject<{
|
|
|
783
781
|
name: z.ZodOptional<z.ZodString>;
|
|
784
782
|
}, z.core.$strict>>>;
|
|
785
783
|
}, z.core.$strict>;
|
|
784
|
+
readonly: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
785
|
+
order: z.ZodNumber;
|
|
786
786
|
icon: z.ZodOptional<z.ZodString>;
|
|
787
787
|
gallery: z.ZodOptional<z.ZodObject<{
|
|
788
788
|
db: z.ZodObject<{
|
|
@@ -65,9 +65,7 @@ export declare const baseSectionOptionsSchema: z.ZodObject<{
|
|
|
65
65
|
*/
|
|
66
66
|
export declare const baseHelperFunctionOptionsSchema: z.ZodObject<{
|
|
67
67
|
fields: z.ZodUnion<[z.ZodArray<z.ZodCustom<FieldConfig, FieldConfig>>, z.ZodArray<z.ZodCustom<FieldGroupConfig, FieldGroupConfig>>]>;
|
|
68
|
-
readonly: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
69
68
|
name: z.ZodString;
|
|
70
|
-
order: z.ZodNumber;
|
|
71
69
|
db: z.ZodObject<{
|
|
72
70
|
table: z.ZodString;
|
|
73
71
|
identifier: z.ZodOptional<z.ZodCustom<FieldConfig, FieldConfig>>;
|
|
@@ -91,6 +89,8 @@ export declare const baseHelperFunctionOptionsSchema: z.ZodObject<{
|
|
|
91
89
|
name: z.ZodOptional<z.ZodString>;
|
|
92
90
|
}, z.core.$strict>>>;
|
|
93
91
|
}, z.core.$strict>;
|
|
92
|
+
readonly: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
93
|
+
order: z.ZodNumber;
|
|
94
94
|
icon: z.ZodOptional<z.ZodString>;
|
|
95
95
|
gallery: z.ZodOptional<z.ZodObject<{
|
|
96
96
|
db: z.ZodObject<{
|
|
@@ -121,13 +121,22 @@ export declare function validateFieldNamesForSection({ sectionName, fields, iden
|
|
|
121
121
|
fields: FieldConfig[];
|
|
122
122
|
identifierField?: FieldConfig;
|
|
123
123
|
}): void;
|
|
124
|
-
export type
|
|
124
|
+
export type BeforeCreateContext = {
|
|
125
|
+
values: Record<string, unknown>;
|
|
126
|
+
section: Section;
|
|
127
|
+
};
|
|
128
|
+
export type AfterCreateContext = {
|
|
125
129
|
itemId?: string | number;
|
|
126
130
|
values: Record<string, unknown>;
|
|
127
131
|
section: Section;
|
|
128
132
|
};
|
|
133
|
+
export type BeforeUpdateContext = {
|
|
134
|
+
itemId: string | number;
|
|
135
|
+
values: Record<string, unknown>;
|
|
136
|
+
section: Section;
|
|
137
|
+
};
|
|
129
138
|
export type AfterUpdateContext = {
|
|
130
|
-
itemId
|
|
139
|
+
itemId: string | number;
|
|
131
140
|
values: Record<string, unknown>;
|
|
132
141
|
section: Section;
|
|
133
142
|
};
|
|
@@ -144,6 +153,8 @@ export type OnErrorContext = {
|
|
|
144
153
|
error?: unknown;
|
|
145
154
|
};
|
|
146
155
|
export type Hooks = {
|
|
156
|
+
beforeCreate?: (ctx: BeforeCreateContext) => Promise<void> | void;
|
|
157
|
+
afterCreate?: (ctx: AfterCreateContext) => Promise<void> | void;
|
|
147
158
|
beforeUpdate?: (ctx: BeforeUpdateContext) => Promise<void> | void;
|
|
148
159
|
afterUpdate?: (ctx: AfterUpdateContext) => Promise<void> | void;
|
|
149
160
|
onDelete?: (ctx: OnDeleteContext) => Promise<void> | void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"section.d.ts","sourceRoot":"","sources":["../../../src/core/sections/section.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAChD,OAAO,KAAK,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAEhF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAErD,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAE5E,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AAGxB,eAAO,MAAM,iBAAiB,uCAA0B,CAAA;AACxD,eAAO,MAAM,sBAAsB,iDAA+B,CAAA;AAIlE,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;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wBAAgB,yBAAyB,CAAC,CAAC,SAAS,kBAAkB,EAClE,OAAO,EAAE,CAAC,GACX,CAAC,GAAG;IAAE,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG;QAAE,UAAU,EAAE,WAAW,CAAA;KAAE,CAAA;CAAE,CAmCnD;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,kBAAkB,EAAE,OAAO,EAAE,CAAC,GAAG,CAAC,CAmBhF;AAED,wBAAgB,2BAA2B,CAAC,MAAM,EAAE;IAAE,MAAM,EAAE,WAAW,EAAE,CAAC;IAAC,WAAW,EAAE,gBAAgB,EAAE,CAAA;CAAE,GAAG;IAC7G,MAAM,EAAE,WAAW,EAAE,CAAA;IACrB,WAAW,EAAE,gBAAgB,EAAE,CAAA;CAClC,CAYA"}
|
|
@@ -270,9 +270,9 @@ export class Section {
|
|
|
270
270
|
},
|
|
271
271
|
watermark: this._galleryConfig.watermark ?? cmsConfig.media.images.watermark,
|
|
272
272
|
thumbnail: {
|
|
273
|
-
width: this._galleryConfig.thumbnail?.width ?? cmsConfig.media.images.thumbnail.width,
|
|
274
|
-
height: this._galleryConfig.thumbnail?.height ?? cmsConfig.media.images.thumbnail.height,
|
|
275
|
-
fit: this._galleryConfig.thumbnail?.fit ?? cmsConfig.media.images.thumbnail.fit ?? 'contain',
|
|
273
|
+
width: this._galleryConfig.thumbnail?.width ?? cmsConfig.media.images.thumbnail.size.width,
|
|
274
|
+
height: this._galleryConfig.thumbnail?.height ?? cmsConfig.media.images.thumbnail.size.height,
|
|
275
|
+
fit: this._galleryConfig.thumbnail?.fit ?? cmsConfig.media.images.thumbnail.size.fit ?? 'contain',
|
|
276
276
|
quality: this._galleryConfig.thumbnail?.quality ?? cmsConfig.media.images.thumbnail.quality ?? 80,
|
|
277
277
|
},
|
|
278
278
|
};
|
|
@@ -23,8 +23,8 @@ declare const optionsSchema: z.ZodObject<{
|
|
|
23
23
|
table: z.ZodString;
|
|
24
24
|
}, z.core.$strict>;
|
|
25
25
|
fields: z.ZodUnion<[z.ZodArray<z.ZodCustom<FieldConfig, FieldConfig>>, z.ZodArray<z.ZodCustom<FieldGroupConfig, FieldGroupConfig>>]>;
|
|
26
|
-
readonly: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
27
26
|
name: z.ZodString;
|
|
27
|
+
readonly: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
28
28
|
order: z.ZodNumber;
|
|
29
29
|
icon: z.ZodOptional<z.ZodString>;
|
|
30
30
|
gallery: z.ZodOptional<z.ZodObject<{
|
|
@@ -57,8 +57,8 @@ declare const simpleSectionConfigSchema: z.ZodObject<{
|
|
|
57
57
|
db: z.ZodObject<{
|
|
58
58
|
table: z.ZodString;
|
|
59
59
|
}, z.core.$strict>;
|
|
60
|
-
readonly: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
61
60
|
name: z.ZodString;
|
|
61
|
+
readonly: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
62
62
|
order: z.ZodNumber;
|
|
63
63
|
icon: z.ZodOptional<z.ZodString>;
|
|
64
64
|
gallery: z.ZodOptional<z.ZodObject<{
|
|
@@ -17,6 +17,16 @@ export declare class EditSubmit extends Submit {
|
|
|
17
17
|
protected readonly _itemId: string;
|
|
18
18
|
protected _values: Record<string, any>;
|
|
19
19
|
protected getLogEventType(): LogEventType;
|
|
20
|
+
/**
|
|
21
|
+
* Run the beforeUpdate hook before item update
|
|
22
|
+
* @protected
|
|
23
|
+
*/
|
|
24
|
+
protected runPreSubmitHooks(): Promise<void>;
|
|
25
|
+
/**
|
|
26
|
+
* Run the afterUpdate hook after item update
|
|
27
|
+
* @protected
|
|
28
|
+
*/
|
|
29
|
+
protected runPostSubmitHooks(): Promise<void>;
|
|
20
30
|
/**
|
|
21
31
|
* Constructor
|
|
22
32
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ItemEditSubmit.d.ts","sour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C,IAAI,CAAC;IAc5D;;OAEG;gBACS,MAAM,EAAE,eAAe;IAKnC;;;OAGG;IACmB,UAAU;IASV,MAAM;YAQd,qBAAqB;cAuBhB,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO;cAIjD,gBAAgB,IAAI,MAAM,EAAE;IAO/C,OAAO,CAAC,WAAW;IAInB,OAAO,CAAC,iBAAiB;IAczB;;;OAGG;YACW,aAAa;YAQb,sBAAsB;IAoBpC;;;;;OAKG;cACsB,kBAAkB;IAI3C;;;;;OAKG;cACsB,cAAc;YAUzB,oBAAoB;IAoBlC;;;OAGG;cACgB,aAAa,IAAI,GAAG,GAAG,SAAS;IAmBnD;;;;OAIG;IACM,aAAa,CAAC,KAAK,EAAE,KAAK;IAmBnC;;;;OAIG;IACY,WAAW,CAAC,KAAK,EAAE,KAAK;IAQvC;;OAEG;IACM,iBAAiB;IAI1B;;;;OAIG;cACgB,iBAAiB,IAAI,MAAM;IAI9C;;;;OAIG;IACM,aAAa,CAAC,KAAK,EAAE,KAAK;CAgBtC"}
|
|
@@ -10,6 +10,44 @@ export class EditSubmit extends Submit {
|
|
|
10
10
|
getLogEventType() {
|
|
11
11
|
return 'section.item.update';
|
|
12
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* Run the beforeUpdate hook before item update
|
|
15
|
+
* @protected
|
|
16
|
+
*/
|
|
17
|
+
async runPreSubmitHooks() {
|
|
18
|
+
if (!this._sectionInfo.hooks?.beforeUpdate)
|
|
19
|
+
return;
|
|
20
|
+
try {
|
|
21
|
+
await this._sectionInfo.hooks.beforeUpdate({
|
|
22
|
+
itemId: this._itemId,
|
|
23
|
+
values: this.sqlNamesAndValues,
|
|
24
|
+
section: this._sectionInfo,
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
catch (e) {
|
|
28
|
+
// Do not break the submit flow if a hook throws
|
|
29
|
+
console.error('beforeUpdate hook failed:', e);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Run the afterUpdate hook after item update
|
|
34
|
+
* @protected
|
|
35
|
+
*/
|
|
36
|
+
async runPostSubmitHooks() {
|
|
37
|
+
if (!this._sectionInfo.hooks?.afterUpdate)
|
|
38
|
+
return;
|
|
39
|
+
try {
|
|
40
|
+
await this._sectionInfo.hooks.afterUpdate({
|
|
41
|
+
itemId: this._itemId,
|
|
42
|
+
values: this.sqlNamesAndValues,
|
|
43
|
+
section: this._sectionInfo,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
catch (e) {
|
|
47
|
+
// Do not break the submit flow if a hook throws
|
|
48
|
+
console.error('afterUpdate hook failed:', e);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
13
51
|
/**
|
|
14
52
|
* Constructor
|
|
15
53
|
*/
|
|
@@ -5,6 +5,16 @@ import type { LogEventType } from '../../logging/index.js';
|
|
|
5
5
|
export declare class NewSubmit extends Submit {
|
|
6
6
|
static readonly [entityKind]: string;
|
|
7
7
|
protected getLogEventType(): LogEventType;
|
|
8
|
+
/**
|
|
9
|
+
* Run the beforeCreate hook before item insertion
|
|
10
|
+
* @protected
|
|
11
|
+
*/
|
|
12
|
+
protected runPreSubmitHooks(): Promise<void>;
|
|
13
|
+
/**
|
|
14
|
+
* Run the afterCreate hook after item insertion
|
|
15
|
+
* @protected
|
|
16
|
+
*/
|
|
17
|
+
protected runPostSubmitHooks(): Promise<void>;
|
|
8
18
|
/**
|
|
9
19
|
* Rollback submit
|
|
10
20
|
* This will rollback the submit for this item
|