nextjs-cms 0.6.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -54,10 +54,10 @@ declare const configSchema: z.ZodObject<{
54
54
  * @hint 'jpg' is an alias for 'jpeg'
55
55
  */
56
56
  fileType: z.ZodOptional<z.ZodArray<z.ZodEnum<{
57
- webp: "webp";
58
- jpg: "jpg";
59
57
  jpeg: "jpeg";
58
+ jpg: "jpg";
60
59
  png: "png";
60
+ webp: "webp";
61
61
  }>>>;
62
62
  /**
63
63
  * Remove the extension from the file name
@@ -201,10 +201,10 @@ declare const optionsSchema: z.ZodObject<{
201
201
  * @hint 'jpg' is an alias for 'jpeg'
202
202
  */
203
203
  fileType: z.ZodOptional<z.ZodArray<z.ZodEnum<{
204
- webp: "webp";
205
- jpg: "jpg";
206
204
  jpeg: "jpeg";
205
+ jpg: "jpg";
207
206
  png: "png";
207
+ webp: "webp";
208
208
  }>>>;
209
209
  /**
210
210
  * Remove the extension from the file name
@@ -273,10 +273,10 @@ declare const photoFieldConfigSchema: z.ZodObject<{
273
273
  * @hint 'jpg' is an alias for 'jpeg'
274
274
  */
275
275
  fileType: z.ZodOptional<z.ZodArray<z.ZodEnum<{
276
- webp: "webp";
277
- jpg: "jpg";
278
276
  jpeg: "jpeg";
277
+ jpg: "jpg";
279
278
  png: "png";
279
+ webp: "webp";
280
280
  }>>>;
281
281
  /**
282
282
  * Remove the extension from the file name
@@ -99,9 +99,9 @@ export class PhotoField extends FileField {
99
99
  this._thumbnailConfig = config.thumbnail;
100
100
  this.extensions = config.fileType ?? ['jpeg'];
101
101
  /**
102
- * Replace 'jpg' with 'jpeg'
102
+ * Replace 'jpg' with 'jpeg' and remove duplicates
103
103
  */
104
- this.extensions = this.extensions.map((e) => (e === 'jpg' ? 'jpeg' : e));
104
+ this.extensions = [...new Set(this.extensions.map((e) => (e === 'jpg' ? 'jpeg' : e)))];
105
105
  /**
106
106
  * Extract the mime types from the extensions
107
107
  */
@@ -293,7 +293,7 @@ export class PhotoField extends FileField {
293
293
  /**
294
294
  * Check extension
295
295
  */
296
- let ext = this._file.name.split('.').pop();
296
+ let ext = this._file.name.split('.').pop()?.toLowerCase();
297
297
  // Treat jpg as jpeg
298
298
  if (ext === 'jpg')
299
299
  ext = 'jpeg';
@@ -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
- webp: "webp";
35
- jpg: "jpg";
36
34
  jpeg: "jpeg";
35
+ jpg: "jpg";
37
36
  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
- webp: "webp";
76
- jpg: "jpg";
77
75
  jpeg: "jpeg";
76
+ jpg: "jpg";
78
77
  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?: "webp" | "jpg" | "jpeg" | "png" | undefined;
121
+ format?: "jpeg" | "jpg" | "png" | "webp" | 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
- webp: "webp";
190
- jpg: "jpg";
191
189
  jpeg: "jpeg";
190
+ jpg: "jpg";
192
191
  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
- webp: "webp";
252
- jpg: "jpg";
253
251
  jpeg: "jpeg";
252
+ jpg: "jpg";
254
253
  png: "png";
254
+ webp: "webp";
255
255
  }>>;
256
256
  }, z.core.$strict>>;
257
257
  name: z.ZodString;
@@ -118,10 +118,10 @@ 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>>;
121
122
  name: z.ZodString;
122
123
  order: z.ZodNumber;
123
- icon: z.ZodOptional<z.ZodString>;
124
- readonly: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
124
+ variants: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types/index.js").Variant, import("../types/index.js").Variant>>>;
125
125
  db: z.ZodObject<{
126
126
  table: z.ZodString;
127
127
  identifier: z.ZodOptional<z.ZodCustom<FieldConfig, FieldConfig>>;
@@ -145,6 +145,7 @@ declare const optionsSchema: z.ZodObject<{
145
145
  name: z.ZodOptional<z.ZodString>;
146
146
  }, z.core.$strict>>>;
147
147
  }, z.core.$strict>;
148
+ icon: z.ZodOptional<z.ZodString>;
148
149
  gallery: z.ZodOptional<z.ZodObject<{
149
150
  db: z.ZodObject<{
150
151
  tableName: z.ZodString;
@@ -160,7 +161,6 @@ declare const optionsSchema: z.ZodObject<{
160
161
  quality: z.ZodNumber;
161
162
  }, z.core.$strict>>;
162
163
  }, z.core.$strict>>;
163
- variants: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types/index.js").Variant, import("../types/index.js").Variant>>>;
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<{
@@ -215,10 +215,10 @@ export declare const categorySectionConfigSchema: z.ZodObject<{
215
215
  * @default false
216
216
  */
217
217
  allowRecursiveDelete: z.ZodOptional<z.ZodBoolean>;
218
+ readonly: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
218
219
  name: z.ZodString;
219
220
  order: z.ZodNumber;
220
- icon: z.ZodOptional<z.ZodString>;
221
- readonly: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
221
+ variants: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types/index.js").Variant, import("../types/index.js").Variant>>>;
222
222
  db: z.ZodObject<{
223
223
  table: z.ZodString;
224
224
  identifier: z.ZodOptional<z.ZodCustom<FieldConfig, FieldConfig>>;
@@ -242,6 +242,7 @@ export declare const categorySectionConfigSchema: z.ZodObject<{
242
242
  name: z.ZodOptional<z.ZodString>;
243
243
  }, z.core.$strict>>>;
244
244
  }, z.core.$strict>;
245
+ icon: z.ZodOptional<z.ZodString>;
245
246
  gallery: z.ZodOptional<z.ZodObject<{
246
247
  db: z.ZodObject<{
247
248
  tableName: z.ZodString;
@@ -257,7 +258,6 @@ export declare const categorySectionConfigSchema: z.ZodObject<{
257
258
  quality: z.ZodNumber;
258
259
  }, z.core.$strict>>;
259
260
  }, z.core.$strict>>;
260
- variants: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types/index.js").Variant, import("../types/index.js").Variant>>>;
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>;
@@ -135,7 +135,7 @@ declare const configSchema: z.ZodObject<{
135
135
  size: number;
136
136
  unit: "kb" | "mb";
137
137
  } | undefined;
138
- fileType?: ("webp" | "jpg" | "jpeg" | "png")[] | undefined;
138
+ fileType?: ("jpeg" | "jpg" | "png" | "webp")[] | undefined;
139
139
  removeExtension?: boolean | undefined;
140
140
  label?: string | Record<string, string> | undefined;
141
141
  required?: boolean | undefined;
@@ -164,7 +164,7 @@ declare const configSchema: z.ZodObject<{
164
164
  size: number;
165
165
  unit: "kb" | "mb";
166
166
  } | undefined;
167
- fileType?: ("webp" | "jpg" | "jpeg" | "png")[] | undefined;
167
+ fileType?: ("jpeg" | "jpg" | "png" | "webp")[] | undefined;
168
168
  removeExtension?: boolean | undefined;
169
169
  label?: string | Record<string, string> | undefined;
170
170
  required?: boolean | undefined;
@@ -329,7 +329,7 @@ declare const optionsSchema: z.ZodObject<{
329
329
  size: number;
330
330
  unit: "kb" | "mb";
331
331
  } | undefined;
332
- fileType?: ("webp" | "jpg" | "jpeg" | "png")[] | undefined;
332
+ fileType?: ("jpeg" | "jpg" | "png" | "webp")[] | undefined;
333
333
  removeExtension?: boolean | undefined;
334
334
  label?: string | Record<string, string> | undefined;
335
335
  required?: boolean | undefined;
@@ -358,7 +358,7 @@ declare const optionsSchema: z.ZodObject<{
358
358
  size: number;
359
359
  unit: "kb" | "mb";
360
360
  } | undefined;
361
- fileType?: ("webp" | "jpg" | "jpeg" | "png")[] | undefined;
361
+ fileType?: ("jpeg" | "jpg" | "png" | "webp")[] | undefined;
362
362
  removeExtension?: boolean | undefined;
363
363
  label?: string | Record<string, string> | undefined;
364
364
  required?: boolean | undefined;
@@ -369,10 +369,10 @@ declare const optionsSchema: z.ZodObject<{
369
369
  }>>;
370
370
  generateQR: z.ZodOptional<z.ZodBoolean>;
371
371
  fields: z.ZodUnion<[z.ZodArray<z.ZodCustom<FieldConfig, FieldConfig>>, z.ZodArray<z.ZodCustom<FieldGroupConfig, FieldGroupConfig>>]>;
372
+ readonly: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
372
373
  name: z.ZodString;
373
374
  order: z.ZodNumber;
374
- icon: z.ZodOptional<z.ZodString>;
375
- readonly: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
375
+ variants: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types/index.js").Variant, import("../types/index.js").Variant>>>;
376
376
  db: z.ZodObject<{
377
377
  table: z.ZodString;
378
378
  identifier: z.ZodOptional<z.ZodCustom<FieldConfig, FieldConfig>>;
@@ -396,6 +396,7 @@ declare const optionsSchema: z.ZodObject<{
396
396
  name: z.ZodOptional<z.ZodString>;
397
397
  }, z.core.$strict>>>;
398
398
  }, z.core.$strict>;
399
+ icon: z.ZodOptional<z.ZodString>;
399
400
  gallery: z.ZodOptional<z.ZodObject<{
400
401
  db: z.ZodObject<{
401
402
  tableName: z.ZodString;
@@ -411,7 +412,6 @@ declare const optionsSchema: z.ZodObject<{
411
412
  quality: z.ZodNumber;
412
413
  }, z.core.$strict>>;
413
414
  }, z.core.$strict>>;
414
- variants: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types/index.js").Variant, import("../types/index.js").Variant>>>;
415
415
  hooks: z.ZodOptional<z.ZodCustom<import("./section.js").Hooks, import("./section.js").Hooks>>;
416
416
  }, z.core.$strict>;
417
417
  declare const hasItemsSectionConfigSchema: z.ZodObject<{
@@ -547,7 +547,7 @@ declare const hasItemsSectionConfigSchema: z.ZodObject<{
547
547
  size: number;
548
548
  unit: "kb" | "mb";
549
549
  } | undefined;
550
- fileType?: ("webp" | "jpg" | "jpeg" | "png")[] | undefined;
550
+ fileType?: ("jpeg" | "jpg" | "png" | "webp")[] | undefined;
551
551
  removeExtension?: boolean | undefined;
552
552
  label?: string | Record<string, string> | undefined;
553
553
  required?: boolean | undefined;
@@ -576,7 +576,7 @@ declare const hasItemsSectionConfigSchema: z.ZodObject<{
576
576
  size: number;
577
577
  unit: "kb" | "mb";
578
578
  } | undefined;
579
- fileType?: ("webp" | "jpg" | "jpeg" | "png")[] | undefined;
579
+ fileType?: ("jpeg" | "jpg" | "png" | "webp")[] | undefined;
580
580
  removeExtension?: boolean | undefined;
581
581
  label?: string | Record<string, string> | undefined;
582
582
  required?: boolean | undefined;
@@ -586,10 +586,10 @@ declare const hasItemsSectionConfigSchema: z.ZodObject<{
586
586
  adminGenerated?: boolean | "readonly" | undefined;
587
587
  }>>;
588
588
  generateQR: z.ZodOptional<z.ZodBoolean>;
589
+ readonly: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
589
590
  name: z.ZodString;
590
591
  order: z.ZodNumber;
591
- icon: z.ZodOptional<z.ZodString>;
592
- readonly: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
592
+ variants: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types/index.js").Variant, import("../types/index.js").Variant>>>;
593
593
  db: z.ZodObject<{
594
594
  table: z.ZodString;
595
595
  identifier: z.ZodOptional<z.ZodCustom<FieldConfig, FieldConfig>>;
@@ -613,6 +613,7 @@ declare const hasItemsSectionConfigSchema: z.ZodObject<{
613
613
  name: z.ZodOptional<z.ZodString>;
614
614
  }, z.core.$strict>>>;
615
615
  }, z.core.$strict>;
616
+ icon: z.ZodOptional<z.ZodString>;
616
617
  gallery: z.ZodOptional<z.ZodObject<{
617
618
  db: z.ZodObject<{
618
619
  tableName: z.ZodString;
@@ -628,7 +629,6 @@ declare const hasItemsSectionConfigSchema: z.ZodObject<{
628
629
  quality: z.ZodNumber;
629
630
  }, z.core.$strict>>;
630
631
  }, z.core.$strict>>;
631
- variants: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types/index.js").Variant, import("../types/index.js").Variant>>>;
632
632
  hooks: z.ZodOptional<z.ZodCustom<import("./section.js").Hooks, import("./section.js").Hooks>>;
633
633
  }, z.core.$strict>;
634
634
  export type HasItemsSectionOptions = z.infer<typeof optionsSchema>;
@@ -62,10 +62,10 @@ export declare const baseSectionOptionsSchema: z.ZodObject<{
62
62
  */
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
+ readonly: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
65
66
  name: z.ZodString;
66
67
  order: z.ZodNumber;
67
- icon: z.ZodOptional<z.ZodString>;
68
- readonly: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
68
+ variants: z.ZodOptional<z.ZodArray<z.ZodCustom<Variant, Variant>>>;
69
69
  db: z.ZodObject<{
70
70
  table: z.ZodString;
71
71
  identifier: z.ZodOptional<z.ZodCustom<FieldConfig, FieldConfig>>;
@@ -89,6 +89,7 @@ export declare const baseHelperFunctionOptionsSchema: z.ZodObject<{
89
89
  name: z.ZodOptional<z.ZodString>;
90
90
  }, z.core.$strict>>>;
91
91
  }, z.core.$strict>;
92
+ icon: z.ZodOptional<z.ZodString>;
92
93
  gallery: z.ZodOptional<z.ZodObject<{
93
94
  db: z.ZodObject<{
94
95
  tableName: z.ZodString;
@@ -104,7 +105,6 @@ export declare const baseHelperFunctionOptionsSchema: z.ZodObject<{
104
105
  quality: z.ZodNumber;
105
106
  }, z.core.$strict>>;
106
107
  }, z.core.$strict>>;
107
- variants: z.ZodOptional<z.ZodArray<z.ZodCustom<Variant, Variant>>>;
108
108
  hooks: z.ZodOptional<z.ZodCustom<Hooks, Hooks>>;
109
109
  }, z.core.$strict>;
110
110
  export declare function validateSectionConfig(config: BaseSectionOptions): void;
@@ -23,10 +23,11 @@ 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>>;
26
27
  name: z.ZodString;
27
28
  order: z.ZodNumber;
29
+ variants: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types/index.js").Variant, import("../types/index.js").Variant>>>;
28
30
  icon: z.ZodOptional<z.ZodString>;
29
- readonly: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
30
31
  gallery: z.ZodOptional<z.ZodObject<{
31
32
  db: z.ZodObject<{
32
33
  tableName: z.ZodString;
@@ -42,7 +43,6 @@ declare const optionsSchema: z.ZodObject<{
42
43
  quality: z.ZodNumber;
43
44
  }, z.core.$strict>>;
44
45
  }, z.core.$strict>>;
45
- variants: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types/index.js").Variant, import("../types/index.js").Variant>>>;
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<{
@@ -54,10 +54,11 @@ declare const simpleSectionConfigSchema: z.ZodObject<{
54
54
  db: z.ZodObject<{
55
55
  table: z.ZodString;
56
56
  }, z.core.$strict>;
57
+ readonly: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
57
58
  name: z.ZodString;
58
59
  order: z.ZodNumber;
60
+ variants: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types/index.js").Variant, import("../types/index.js").Variant>>>;
59
61
  icon: z.ZodOptional<z.ZodString>;
60
- readonly: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
61
62
  gallery: z.ZodOptional<z.ZodObject<{
62
63
  db: z.ZodObject<{
63
64
  tableName: z.ZodString;
@@ -73,7 +74,6 @@ declare const simpleSectionConfigSchema: z.ZodObject<{
73
74
  quality: z.ZodNumber;
74
75
  }, z.core.$strict>>;
75
76
  }, z.core.$strict>>;
76
- variants: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types/index.js").Variant, import("../types/index.js").Variant>>>;
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>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nextjs-cms",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "type": "module",
@@ -192,8 +192,8 @@
192
192
  "tsx": "^4.20.6",
193
193
  "typescript": "^5.9.2",
194
194
  "@lzcms/eslint-config": "0.3.0",
195
- "@lzcms/prettier-config": "0.1.0",
196
- "@lzcms/tsconfig": "0.1.0"
195
+ "@lzcms/tsconfig": "0.1.0",
196
+ "@lzcms/prettier-config": "0.1.0"
197
197
  },
198
198
  "license": "MIT",
199
199
  "keywords": [