nextjs-cms 0.5.78 → 0.5.80

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.
@@ -1,2 +1,2 @@
1
- export * from './loader-with-jiti.js';
1
+ export * from './loader-with-esbuild.js';
2
2
  //# sourceMappingURL=loader.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../../src/core/config/loader.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAA"}
1
+ {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../../src/core/config/loader.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAA"}
@@ -1 +1 @@
1
- export * from './loader-with-jiti.js';
1
+ export * from './loader-with-esbuild.js';
@@ -1,2 +1,2 @@
1
- export * from './section-factory-with-jiti.js';
1
+ export * from './section-factory-with-esbuild.js';
2
2
  //# sourceMappingURL=SectionFactory.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SectionFactory.d.ts","sourceRoot":"","sources":["../../../src/core/factories/SectionFactory.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAA"}
1
+ {"version":3,"file":"SectionFactory.d.ts","sourceRoot":"","sources":["../../../src/core/factories/SectionFactory.ts"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAA"}
@@ -1 +1 @@
1
- export * from './section-factory-with-jiti.js';
1
+ export * from './section-factory-with-esbuild.js';
@@ -1 +1 @@
1
- {"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../../src/core/fields/select.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AACjD,OAAO,EAAE,KAAK,EAAyB,MAAM,YAAY,CAAA;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAMhD,OAAO,KAAK,EAAE,eAAe,EAAyB,eAAe,EAAyB,MAAM,aAAa,CAAA;AAEjH,OAAO,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C,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA6DzC,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC;IAuBzD;;;OAGG;IACH,OAAO,CAAC,wBAAwB;IAYhC;;;OAGG;YACW,iCAAiC;IAiB/C;;OAEG;IACY,KAAK;YAyBN,YAAY;IA4D1B;;;OAGG;YACW,sBAAsB;IASpC;;;OAGG;IACH,OAAO,CAAC,aAAa;IAUrB,aAAa;IAWb;;OAEG;IACG,oBAAoB;CAuC7B;AAED,MAAM,MAAM,uBAAuB,GAAG,UAAU,CAAC,WAAW,CAAC,iBAAiB,CAAC,CAAC,CAAA;AAehF,eAAO,MAAM,wBAAwB;;;QA3hBjC;;WAEG;;QAEH;;WAEG;;;;;;;;;;;;;;;;;;;;;;QANH;;WAEG;;QAEH;;WAEG;;;;;;;;;;;;;;;;;;;;QANH;;WAEG;;QAEH;;WAEG;;;;;;;;;;;;;;;;;oBAyhBL,CAAA;AAEF,QAAA,MAAM,uBAAuB;;;QAjiBzB;;WAEG;;QAEH;;WAEG;;;;;;;;;;;;;;;;;;;;;;QANH;;WAEG;;QAEH;;WAEG;;;;;;;;;;;;;;;;;;;;QANH;;WAEG;;QAEH;;WAEG;;;;;;;;;;;;;;;;;;;;;;;;;mBAkiBN,CAAA;AAED;;;GAGG;AACH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAA;AAE3E;;;GAGG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,eAAe,CAAC,iBAAiB,CAAC,GAAG,qBAAqB,CAgC5F"}
@@ -230,6 +230,12 @@ export class SelectField extends Field {
230
230
  * Delete the existing values
231
231
  */
232
232
  await db.execute(sql `DELETE FROM \`${sql.raw(this.destinationDb.table)}\` WHERE \`${sql.raw(this.destinationDb.itemIdentifier)}\` = ${this._itemIdentifier}`);
233
+ /**
234
+ * Check if we actually have values to save
235
+ */
236
+ if (!this.value || this.value.length === 0) {
237
+ return;
238
+ }
233
239
  /**
234
240
  * Prepare the sql statement
235
241
  */
@@ -237,19 +243,18 @@ export class SelectField extends Field {
237
243
  sqlChunks.push(sql `INSERT INTO \`${sql.raw(this.destinationDb.table)}\` (\`${sql.raw(this.destinationDb.selectIdentifier)}\`, \`${sql.raw(this.destinationDb.itemIdentifier)}\`) VALUES `);
238
244
  /**
239
245
  * Loop through the values and add them to the sql statement values
246
+ * We know this.value exists and has length > 0 because we checked above
240
247
  */
241
- if (this.value && this.value.length > 0) {
242
- const count = this.value.length;
243
- this.value.forEach((value, index) => {
244
- sqlChunks.push(sql `(${value.value}, ${this._itemIdentifier})`);
245
- if (index < count - 1) {
246
- /**
247
- * Add a comma to separate the values in the sql statement
248
- */
249
- sqlChunks.push(sql `, `);
250
- }
251
- });
252
- }
248
+ const count = this.value.length;
249
+ this.value.forEach((value, index) => {
250
+ sqlChunks.push(sql `(${value.value}, ${this._itemIdentifier})`);
251
+ if (index < count - 1) {
252
+ /**
253
+ * Add a comma to separate the values in the sql statement
254
+ */
255
+ sqlChunks.push(sql `, `);
256
+ }
257
+ });
253
258
  /**
254
259
  * Join the sql chunks
255
260
  */
@@ -303,7 +308,7 @@ export class SelectField extends Field {
303
308
  const columns = await MysqlTableChecker.getColumns(this.destinationDb.table);
304
309
  if (!columns.includes(this.destinationDb.selectIdentifier) ||
305
310
  !columns.includes(this.destinationDb.itemIdentifier)) {
306
- throw new Error(`Field ${this.label}: Table ${this.destinationDb.table} and/or columns: ${this.destinationDb.selectIdentifier}, ${this.destinationDb.itemIdentifier} do not exist in the database!`);
311
+ throw new Error(`Field ${this.label}: Table ${this.destinationDb.table} and/or columns: ${this.destinationDb.selectIdentifier}, ${this.destinationDb.itemIdentifier} do not exist in the database!, did you forget to run update-sections?`);
307
312
  }
308
313
  }
309
314
  /**
@@ -386,7 +391,7 @@ export class SelectField extends Field {
386
391
  async checkDBTableAndColumns() {
387
392
  const columns = await MysqlTableChecker.getColumns(this.db.table);
388
393
  if (!columns.includes(this.db.identifier) || !columns.includes(this.db.label)) {
389
- throw new Error(`Field ${this.label}: Table ${this.db.table} and/or columns: ${this.db.identifier}, ${this.db.label} do not exist in the database!`);
394
+ throw new Error(`Field ${this.label}: Table ${this.db.table} and/or columns: ${this.db.identifier}, ${this.db.label} do not exist in the database!, did you forget to run update-sections?`);
390
395
  }
391
396
  }
392
397
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"selectMultiple.d.ts","sourceRoot":"","sources":["../../../src/core/fields/selectMultiple.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AACjD,OAAO,EAAE,KAAK,EAAyB,MAAM,YAAY,CAAA;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAChD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAO/C,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAE5E,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AAgDxB,QAAA,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAdnB,WAAW,GAAG,UAAU;cACxB,MAAM;gBACJ,MAAM;iBACL,eAAe,GAAG,eAAe;;cAHpC,WAAW,GAAG,UAAU;cACxB,MAAM;gBACJ,MAAM;iBACL,eAAe,GAAG,eAAe;;;;;;;;;;;;;;;oBAepD,CAAA;AAEF,KAAK,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAA;AAEhF,qBAAa,mBAAoB,SAAQ,KAAK,CAAC,iBAAiB,EAAE,yBAAyB,CAAC;IACxF,gBAAyB,CAAC,UAAU,CAAC,EAAE,MAAM,CAAwB;IACrE,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAA;IAClC,QAAQ,CAAC,WAAW,EAAE,IAAI,GAAG,SAAS,GAAG,QAAQ,CAAA;IACjD,QAAQ,CAA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AAG,UAAU,CAAC,mBAAmB,CAAC,iBAAiB,CAAC,CAAC,CAAA;AAqBhG,QAAA,MAAM,qCAAqC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAhbzB,WAAW,GAAG,UAAU;cACxB,MAAM;gBACJ,MAAM;iBACL,eAAe,GAAG,eAAe;;cAHpC,WAAW,GAAG,UAAU;cACxB,MAAM;gBACJ,MAAM;iBACL,eAAe,GAAG,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAsbrD,CAAA;AAED;;;GAGG;AACH,MAAM,MAAM,6BAA6B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qCAAqC,CAAC,CAAA;AAEjG;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,eAAe,CAAC,yBAAyB,CAAC,GAAG,6BAA6B,CAiBpH"}
@@ -198,6 +198,12 @@ export class SelectMultipleField extends Field {
198
198
  * Delete the existing values
199
199
  */
200
200
  await db.execute(sql `DELETE FROM \`${sql.raw(this.destinationDb.table)}\` WHERE \`${sql.raw(this.destinationDb.itemIdentifier)}\` = ${this._itemIdentifier}`);
201
+ /**
202
+ * Check if the we actually have values to save
203
+ */
204
+ if (!this.value || this.value.length === 0) {
205
+ return;
206
+ }
201
207
  /**
202
208
  * Prepare the sql statement
203
209
  */
@@ -205,19 +211,18 @@ export class SelectMultipleField extends Field {
205
211
  sqlChunks.push(sql `INSERT INTO \`${sql.raw(this.destinationDb.table)}\` (\`${sql.raw(this.destinationDb.selectIdentifier)}\`, \`${sql.raw(this.destinationDb.itemIdentifier)}\`) VALUES `);
206
212
  /**
207
213
  * Loop through the values and add them to the sql statement values
214
+ * We know this.value exists and has length > 0 because we checked above
208
215
  */
209
- if (this.value && this.value.length > 0) {
210
- const count = this.value.length;
211
- this.value.forEach((value, index) => {
212
- sqlChunks.push(sql `(${value.value}, ${this._itemIdentifier})`);
213
- if (index < count - 1) {
214
- /**
215
- * Add a comma to separate the values in the sql statement
216
- */
217
- sqlChunks.push(sql `, `);
218
- }
219
- });
220
- }
216
+ const count = this.value.length;
217
+ this.value.forEach((value, index) => {
218
+ sqlChunks.push(sql `(${value.value}, ${this._itemIdentifier})`);
219
+ if (index < count - 1) {
220
+ /**
221
+ * Add a comma to separate the values in the sql statement
222
+ */
223
+ sqlChunks.push(sql `, `);
224
+ }
225
+ });
221
226
  /**
222
227
  * Join the sql chunks
223
228
  */
@@ -294,7 +299,7 @@ export class SelectMultipleField extends Field {
294
299
  async checkDBTableAndColumns() {
295
300
  const columns = await MysqlTableChecker.getColumns(this.db.table);
296
301
  if (!columns.includes(this.db.identifier) || !columns.includes(this.db.label)) {
297
- throw new Error(`Field ${this.label}: Table ${this.db.table} and/or columns: ${this.db.identifier}, ${this.db.label} do not exist in the database!`);
302
+ throw new Error(`Field ${this.label}: Table ${this.db.table} and/or columns: ${this.db.identifier}, ${this.db.label} do not exist in the database!, did you forget to run update-sections?`);
298
303
  }
299
304
  }
300
305
  /**
@@ -308,7 +313,7 @@ export class SelectMultipleField extends Field {
308
313
  const columns = await MysqlTableChecker.getColumns(this.destinationDb.table);
309
314
  if (!columns.includes(this.destinationDb.selectIdentifier) ||
310
315
  !columns.includes(this.destinationDb.itemIdentifier)) {
311
- throw new Error(`Field ${this.label}: Table ${this.destinationDb.table} and/or columns: ${this.destinationDb.selectIdentifier}, ${this.destinationDb.itemIdentifier} do not exist in the database!`);
316
+ throw new Error(`Field ${this.label}: Table ${this.destinationDb.table} and/or columns: ${this.destinationDb.selectIdentifier}, ${this.destinationDb.itemIdentifier} do not exist in the database!, did you forget to run update-sections?`);
312
317
  }
313
318
  }
314
319
  /**
@@ -117,6 +117,7 @@ declare const optionsSchema: z.ZodObject<{
117
117
  */
118
118
  allowRecursiveDelete: z.ZodOptional<z.ZodBoolean>;
119
119
  fields: z.ZodUnion<[z.ZodArray<z.ZodCustom<FieldConfig, FieldConfig>>, z.ZodArray<z.ZodCustom<FieldGroupConfig, FieldGroupConfig>>]>;
120
+ variants: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types/index.js").Variant, import("../types/index.js").Variant>>>;
120
121
  name: z.ZodString;
121
122
  order: z.ZodNumber;
122
123
  readonly: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
@@ -159,7 +160,6 @@ declare const optionsSchema: z.ZodObject<{
159
160
  quality: z.ZodNumber;
160
161
  }, z.core.$strict>>;
161
162
  }, z.core.$strict>>;
162
- variants: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types/index.js").Variant, import("../types/index.js").Variant>>>;
163
163
  hooks: z.ZodOptional<z.ZodCustom<import("./section.js").Hooks, import("./section.js").Hooks>>;
164
164
  }, z.core.$strict>;
165
165
  export declare const categorySectionConfigSchema: z.ZodObject<{
@@ -214,6 +214,7 @@ export declare const categorySectionConfigSchema: z.ZodObject<{
214
214
  * @default false
215
215
  */
216
216
  allowRecursiveDelete: z.ZodOptional<z.ZodBoolean>;
217
+ variants: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types/index.js").Variant, import("../types/index.js").Variant>>>;
217
218
  name: z.ZodString;
218
219
  order: z.ZodNumber;
219
220
  readonly: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
@@ -256,7 +257,6 @@ export declare const categorySectionConfigSchema: z.ZodObject<{
256
257
  quality: z.ZodNumber;
257
258
  }, z.core.$strict>>;
258
259
  }, z.core.$strict>>;
259
- variants: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types/index.js").Variant, import("../types/index.js").Variant>>>;
260
260
  hooks: z.ZodOptional<z.ZodCustom<import("./section.js").Hooks, import("./section.js").Hooks>>;
261
261
  }, z.core.$strict>;
262
262
  export type CategorySectionOptions = z.infer<typeof optionsSchema>;
@@ -368,6 +368,7 @@ declare const optionsSchema: z.ZodObject<{
368
368
  }>>;
369
369
  generateQR: z.ZodOptional<z.ZodBoolean>;
370
370
  fields: z.ZodUnion<[z.ZodArray<z.ZodCustom<FieldConfig, FieldConfig>>, z.ZodArray<z.ZodCustom<FieldGroupConfig, FieldGroupConfig>>]>;
371
+ variants: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types/index.js").Variant, import("../types/index.js").Variant>>>;
371
372
  name: z.ZodString;
372
373
  order: z.ZodNumber;
373
374
  readonly: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
@@ -410,7 +411,6 @@ declare const optionsSchema: z.ZodObject<{
410
411
  quality: z.ZodNumber;
411
412
  }, z.core.$strict>>;
412
413
  }, z.core.$strict>>;
413
- variants: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types/index.js").Variant, import("../types/index.js").Variant>>>;
414
414
  hooks: z.ZodOptional<z.ZodCustom<import("./section.js").Hooks, import("./section.js").Hooks>>;
415
415
  }, z.core.$strict>;
416
416
  declare const hasItemsSectionConfigSchema: z.ZodObject<{
@@ -585,6 +585,7 @@ declare const hasItemsSectionConfigSchema: z.ZodObject<{
585
585
  adminGenerated?: boolean | "readonly" | undefined;
586
586
  }>>;
587
587
  generateQR: z.ZodOptional<z.ZodBoolean>;
588
+ variants: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types/index.js").Variant, import("../types/index.js").Variant>>>;
588
589
  name: z.ZodString;
589
590
  order: z.ZodNumber;
590
591
  readonly: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
@@ -627,7 +628,6 @@ declare const hasItemsSectionConfigSchema: z.ZodObject<{
627
628
  quality: z.ZodNumber;
628
629
  }, z.core.$strict>>;
629
630
  }, z.core.$strict>>;
630
- variants: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types/index.js").Variant, import("../types/index.js").Variant>>>;
631
631
  hooks: z.ZodOptional<z.ZodCustom<import("./section.js").Hooks, import("./section.js").Hooks>>;
632
632
  }, z.core.$strict>;
633
633
  export type HasItemsSectionOptions = z.infer<typeof optionsSchema>;
@@ -62,6 +62,7 @@ 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
+ variants: z.ZodOptional<z.ZodArray<z.ZodCustom<Variant, Variant>>>;
65
66
  name: z.ZodString;
66
67
  order: z.ZodNumber;
67
68
  readonly: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
@@ -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;
@@ -22,6 +22,7 @@ declare const optionsSchema: z.ZodObject<{
22
22
  table: z.ZodString;
23
23
  }, z.core.$strict>;
24
24
  fields: z.ZodUnion<[z.ZodArray<z.ZodCustom<FieldConfig, FieldConfig>>, z.ZodArray<z.ZodCustom<FieldGroupConfig, FieldGroupConfig>>]>;
25
+ variants: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types/index.js").Variant, import("../types/index.js").Variant>>>;
25
26
  name: z.ZodString;
26
27
  order: z.ZodNumber;
27
28
  readonly: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
@@ -41,7 +42,6 @@ declare const optionsSchema: z.ZodObject<{
41
42
  quality: z.ZodNumber;
42
43
  }, z.core.$strict>>;
43
44
  }, z.core.$strict>>;
44
- variants: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types/index.js").Variant, import("../types/index.js").Variant>>>;
45
45
  hooks: z.ZodOptional<z.ZodCustom<import("./section.js").Hooks, import("./section.js").Hooks>>;
46
46
  }, z.core.$strict>;
47
47
  declare const simpleSectionConfigSchema: z.ZodObject<{
@@ -53,6 +53,7 @@ declare const simpleSectionConfigSchema: z.ZodObject<{
53
53
  db: z.ZodObject<{
54
54
  table: z.ZodString;
55
55
  }, z.core.$strict>;
56
+ variants: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types/index.js").Variant, import("../types/index.js").Variant>>>;
56
57
  name: z.ZodString;
57
58
  order: z.ZodNumber;
58
59
  readonly: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
@@ -72,7 +73,6 @@ declare const simpleSectionConfigSchema: z.ZodObject<{
72
73
  quality: z.ZodNumber;
73
74
  }, z.core.$strict>>;
74
75
  }, z.core.$strict>>;
75
- variants: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types/index.js").Variant, import("../types/index.js").Variant>>>;
76
76
  hooks: z.ZodOptional<z.ZodCustom<import("./section.js").Hooks, import("./section.js").Hooks>>;
77
77
  }, z.core.$strict>;
78
78
  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.5.78",
3
+ "version": "0.5.80",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "type": "module",