nextjs-cms 0.5.83 → 0.5.85

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-esbuild.js';
1
+ export * from './loader-with-jiti.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,0BAA0B,CAAA"}
1
+ {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../../src/core/config/loader.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAA"}
@@ -1 +1 @@
1
- export * from './loader-with-esbuild.js';
1
+ export * from './loader-with-jiti.js';
@@ -1,2 +1,2 @@
1
- export * from './section-factory-with-esbuild.js';
1
+ export * from './section-factory-with-jiti.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,mCAAmC,CAAA"}
1
+ {"version":3,"file":"SectionFactory.d.ts","sourceRoot":"","sources":["../../../src/core/factories/SectionFactory.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAA"}
@@ -1 +1 @@
1
- export * from './section-factory-with-esbuild.js';
1
+ export * from './section-factory-with-jiti.js';
@@ -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
- jpeg: "jpeg";
57
+ webp: "webp";
58
58
  jpg: "jpg";
59
+ jpeg: "jpeg";
59
60
  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
- jpeg: "jpeg";
204
+ webp: "webp";
205
205
  jpg: "jpg";
206
+ jpeg: "jpeg";
206
207
  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
- jpeg: "jpeg";
276
+ webp: "webp";
277
277
  jpg: "jpg";
278
+ jpeg: "jpeg";
278
279
  png: "png";
279
- webp: "webp";
280
280
  }>>>;
281
281
  /**
282
282
  * Remove the extension from the file name
@@ -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
- jpeg: "jpeg";
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
- jpeg: "jpeg";
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?: "jpeg" | "jpg" | "png" | "webp" | undefined;
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
- jpeg: "jpeg";
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
- jpeg: "jpeg";
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;
@@ -35,8 +35,18 @@ export declare class TagsField extends Field<'tags', Config> {
35
35
  };
36
36
  readonly placeholder: string;
37
37
  readonly sanitize: boolean;
38
+ private _itemIdentifier;
39
+ private _tags;
38
40
  constructor(config: BaseFieldConfig<Config>);
39
41
  getValue(): any;
42
+ /**
43
+ * When destinationDb is set, the value should not be saved to the main item table
44
+ */
45
+ hasSqlNameAndValue(): boolean;
46
+ /**
47
+ * Get the value of the field when submitting to the database
48
+ */
49
+ getSubmitValue(): string | undefined;
40
50
  exportForClient(): {
41
51
  placeholder: string;
42
52
  sanitize: boolean;
@@ -51,8 +61,29 @@ export declare class TagsField extends Field<'tags', Config> {
51
61
  };
52
62
  checkRequired(): void;
53
63
  /**
54
- * TODO: This is a temporary solution to convert the value to an array of tags
55
- * The tags class is not complete
64
+ * Build the field to be rendered in a form
65
+ */
66
+ build(): Promise<void>;
67
+ /**
68
+ * Save tags to the destination table after the main item is saved
69
+ */
70
+ postSubmit(itemId: string): Promise<void>;
71
+ /**
72
+ * Rollback the tags from the destination table if something goes wrong
73
+ */
74
+ postSubmitRollback(): Promise<void>;
75
+ /**
76
+ * Check the destination db config is set
77
+ * @private
78
+ */
79
+ private checkDestinationDBConfig;
80
+ /**
81
+ * Check if destination table and columns exist
82
+ * @private
83
+ */
84
+ private checkDestinationDBTableAndColumns;
85
+ /**
86
+ * Prepare and build the field for submission
56
87
  */
57
88
  prepareForSubmission(): Promise<void>;
58
89
  }
@@ -1 +1 @@
1
- {"version":3,"file":"tags.d.ts","sourceRoot":"","sources":["../../../src/core/fields/tags.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,CAAC,MAAM,KAAK,CAAA;AAGxB,QAAA,MAAM,YAAY;IACd;;;OAGG;;;;;;;;;;;IAiBH;;;;;OAKG;;kBAEL,CAAA;AAEF,KAAK,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAA;AAE1C,qBAAa,SAAU,SAAQ,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC;IAChD,gBAAyB,CAAC,UAAU,CAAC,EAAE,MAAM,CAAc;IAC3D,SAAkB,aAAa,CAAC,EAAE;QAC9B,KAAK,EAAE,MAAM,CAAA;QACb,cAAc,EAAE,MAAM,CAAA;QACtB,gBAAgB,EAAE,MAAM,CAAA;KAC3B,CAAA;IACD,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAA;gBAEd,MAAM,EAAE,eAAe,CAAC,MAAM,CAAC;IAO3C,QAAQ;IAGQ,eAAe;;;;;;;;;;;;IAQ/B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2
  import { entityKind } from '../helpers/index.js';
3
+ import { MysqlTableChecker } from '../db/index.js';
4
+ import { db } from '../../db/client.js';
5
+ import { sql } from 'drizzle-orm';
3
6
  import * as z from 'zod';
4
7
  import { escapeHTML } from '../security/dom.js';
5
8
  const configSchema = z.strictObject({
@@ -36,6 +39,8 @@ export class TagsField extends Field {
36
39
  destinationDb;
37
40
  placeholder;
38
41
  sanitize;
42
+ _itemIdentifier;
43
+ _tags = [];
39
44
  constructor(config) {
40
45
  super(config, 'tags');
41
46
  this.destinationDb = config.destinationDb;
@@ -45,6 +50,20 @@ export class TagsField extends Field {
45
50
  getValue() {
46
51
  return this.value;
47
52
  }
53
+ /**
54
+ * When destinationDb is set, the value should not be saved to the main item table
55
+ */
56
+ hasSqlNameAndValue() {
57
+ return this.destinationDb === undefined;
58
+ }
59
+ /**
60
+ * Get the value of the field when submitting to the database
61
+ */
62
+ getSubmitValue() {
63
+ if (!this.hasSqlNameAndValue())
64
+ return;
65
+ return this.value;
66
+ }
48
67
  exportForClient() {
49
68
  return {
50
69
  ...super.exportForClient(),
@@ -58,21 +77,124 @@ export class TagsField extends Field {
58
77
  }
59
78
  }
60
79
  /**
61
- * TODO: This is a temporary solution to convert the value to an array of tags
62
- * The tags class is not complete
80
+ * Build the field to be rendered in a form
81
+ */
82
+ async build() {
83
+ if (this.destinationDb) {
84
+ this.checkDestinationDBConfig();
85
+ await this.checkDestinationDBTableAndColumns();
86
+ }
87
+ }
88
+ /**
89
+ * Save tags to the destination table after the main item is saved
90
+ */
91
+ async postSubmit(itemId) {
92
+ if (!this.destinationDb)
93
+ return;
94
+ this._itemIdentifier = itemId;
95
+ try {
96
+ /**
97
+ * Delete the existing values
98
+ */
99
+ await db.execute(sql `DELETE FROM \`${sql.raw(this.destinationDb.table)}\` WHERE \`${sql.raw(this.destinationDb.itemIdentifier)}\` = ${this._itemIdentifier}`);
100
+ /**
101
+ * Check if we actually have values to save
102
+ */
103
+ if (!this._tags || this._tags.length === 0) {
104
+ return;
105
+ }
106
+ /**
107
+ * Prepare the sql statement
108
+ */
109
+ const sqlChunks = [];
110
+ sqlChunks.push(sql `INSERT INTO \`${sql.raw(this.destinationDb.table)}\` (\`${sql.raw(this.destinationDb.selectIdentifier)}\`, \`${sql.raw(this.destinationDb.itemIdentifier)}\`) VALUES `);
111
+ /**
112
+ * Loop through the tags and add them to the sql statement values
113
+ */
114
+ const count = this._tags.length;
115
+ this._tags.forEach((tag, index) => {
116
+ sqlChunks.push(sql `(${tag}, ${this._itemIdentifier})`);
117
+ if (index < count - 1) {
118
+ /**
119
+ * Add a comma to separate the values in the sql statement
120
+ */
121
+ sqlChunks.push(sql `, `);
122
+ }
123
+ });
124
+ /**
125
+ * Join the sql chunks
126
+ */
127
+ const finalSql = sql.join(sqlChunks);
128
+ /**
129
+ * Execute the sql statement
130
+ */
131
+ await db.execute(finalSql);
132
+ }
133
+ catch (error) {
134
+ console.error(error);
135
+ throw new Error(`${this.label}: Error saving tags to the destination table`);
136
+ }
137
+ }
138
+ /**
139
+ * Rollback the tags from the destination table if something goes wrong
140
+ */
141
+ async postSubmitRollback() {
142
+ if (!this.destinationDb)
143
+ return;
144
+ if (!this._itemIdentifier) {
145
+ throw new Error(`${this.label}: Item identifier is not set. Make sure to set the item identifier by calling postSubmit() before calling postSubmitRollback()`);
146
+ }
147
+ try {
148
+ await db.execute(sql `DELETE FROM \`${sql.raw(this.destinationDb.table)}\` WHERE \`${sql.raw(this.destinationDb.itemIdentifier)}\` = ${this._itemIdentifier}`);
149
+ }
150
+ catch (error) {
151
+ throw new Error(`${this.label}: Error deleting tags from the destination table`);
152
+ }
153
+ }
154
+ /**
155
+ * Check the destination db config is set
156
+ * @private
157
+ */
158
+ checkDestinationDBConfig() {
159
+ if (this.destinationDb?.table.trim().length === 0 ||
160
+ this.destinationDb?.selectIdentifier.trim().length === 0 ||
161
+ this.destinationDb?.itemIdentifier.trim().length === 0) {
162
+ throw new Error(`Field ${this.label}: Destination table, select identifier and item identifier are required`);
163
+ }
164
+ }
165
+ /**
166
+ * Check if destination table and columns exist
167
+ * @private
168
+ */
169
+ async checkDestinationDBTableAndColumns() {
170
+ if (!this.destinationDb) {
171
+ throw new Error(`Field ${this.label}: Destination table, select identifier and item identifier are required`);
172
+ }
173
+ const columns = await MysqlTableChecker.getColumns(this.destinationDb.table);
174
+ if (!columns.includes(this.destinationDb.selectIdentifier) ||
175
+ !columns.includes(this.destinationDb.itemIdentifier)) {
176
+ 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?`);
177
+ }
178
+ }
179
+ /**
180
+ * Prepare and build the field for submission
63
181
  */
64
182
  async prepareForSubmission() {
183
+ if (this.destinationDb) {
184
+ this.checkDestinationDBConfig();
185
+ await this.checkDestinationDBTableAndColumns();
186
+ }
65
187
  if (this.value) {
66
- let _tags = this.value.split(',');
67
- if (!Array.isArray(_tags)) {
188
+ this._tags = this.value.split(',');
189
+ if (!Array.isArray(this._tags)) {
68
190
  throw new Error(`Field ${this.label} must be an array of tags`);
69
191
  }
70
- if (_tags.some((tag) => typeof tag !== 'string')) {
192
+ if (this._tags.some((tag) => typeof tag !== 'string')) {
71
193
  throw new Error(`Field ${this.label} must contain only string tags`);
72
194
  }
73
195
  if (this.sanitize) {
74
- _tags = _tags.map((tag) => escapeHTML(tag) || tag);
75
- this.value = _tags.join(',');
196
+ this._tags = this._tags.map((tag) => escapeHTML(tag) || tag);
197
+ this.value = this._tags.join(',');
76
198
  }
77
199
  }
78
200
  }
@@ -117,9 +117,10 @@ 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
- readonly: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
120
+ variants: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types/index.js").Variant, import("../types/index.js").Variant>>>;
121
121
  name: z.ZodString;
122
122
  order: z.ZodNumber;
123
+ readonly: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
123
124
  db: z.ZodObject<{
124
125
  table: z.ZodString;
125
126
  identifier: z.ZodOptional<z.ZodCustom<FieldConfig, FieldConfig>>;
@@ -143,7 +144,6 @@ declare const optionsSchema: z.ZodObject<{
143
144
  name: z.ZodOptional<z.ZodString>;
144
145
  }, z.core.$strict>>>;
145
146
  }, z.core.$strict>;
146
- variants: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types/index.js").Variant, import("../types/index.js").Variant>>>;
147
147
  icon: z.ZodOptional<z.ZodString>;
148
148
  gallery: z.ZodOptional<z.ZodObject<{
149
149
  db: z.ZodObject<{
@@ -214,9 +214,10 @@ export declare const categorySectionConfigSchema: z.ZodObject<{
214
214
  * @default false
215
215
  */
216
216
  allowRecursiveDelete: z.ZodOptional<z.ZodBoolean>;
217
- readonly: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
217
+ variants: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types/index.js").Variant, import("../types/index.js").Variant>>>;
218
218
  name: z.ZodString;
219
219
  order: z.ZodNumber;
220
+ readonly: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
220
221
  db: z.ZodObject<{
221
222
  table: z.ZodString;
222
223
  identifier: z.ZodOptional<z.ZodCustom<FieldConfig, FieldConfig>>;
@@ -240,7 +241,6 @@ export declare const categorySectionConfigSchema: z.ZodObject<{
240
241
  name: z.ZodOptional<z.ZodString>;
241
242
  }, z.core.$strict>>>;
242
243
  }, z.core.$strict>;
243
- variants: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types/index.js").Variant, import("../types/index.js").Variant>>>;
244
244
  icon: z.ZodOptional<z.ZodString>;
245
245
  gallery: z.ZodOptional<z.ZodObject<{
246
246
  db: z.ZodObject<{
@@ -6,7 +6,21 @@ import { Section } from './section.js';
6
6
  import type { FieldConfig } from '../fields/index.js';
7
7
  import * as z from 'zod';
8
8
  declare const configSchema: z.ZodObject<{
9
- headingField: z.ZodCustom<(({
9
+ headingField: z.ZodCustom<{
10
+ type: "text";
11
+ build: z.core.$InferOuterFunctionType<z.core.$ZodFunctionArgs, z.ZodCustom<import("../index.js").TextField, import("../index.js").TextField>>;
12
+ name: string;
13
+ placeholder?: string | undefined;
14
+ minLength?: number | undefined;
15
+ maxLength?: number | undefined;
16
+ defaultValue?: string | undefined;
17
+ sanitize?: boolean | undefined;
18
+ label?: string | undefined;
19
+ required?: boolean | undefined;
20
+ order?: number | undefined;
21
+ conditionalRules?: import("../types/index.js").ConditionalRule[] | undefined;
22
+ adminGenerated?: boolean | "readonly" | undefined;
23
+ } | (({
10
24
  hasAutoIncrement: true;
11
25
  name: string;
12
26
  format?: "int" | undefined;
@@ -39,7 +53,7 @@ declare const configSchema: z.ZodObject<{
39
53
  }) & {
40
54
  type: "number";
41
55
  build: z.core.$InferOuterFunctionType<z.core.$ZodFunctionArgs, z.ZodCustom<import("../index.js").NumberField, import("../index.js").NumberField>>;
42
- }) | {
56
+ }), {
43
57
  type: "text";
44
58
  build: z.core.$InferOuterFunctionType<z.core.$ZodFunctionArgs, z.ZodCustom<import("../index.js").TextField, import("../index.js").TextField>>;
45
59
  name: string;
@@ -53,7 +67,7 @@ declare const configSchema: z.ZodObject<{
53
67
  order?: number | undefined;
54
68
  conditionalRules?: import("../types/index.js").ConditionalRule[] | undefined;
55
69
  adminGenerated?: boolean | "readonly" | undefined;
56
- }, (({
70
+ } | (({
57
71
  hasAutoIncrement: true;
58
72
  name: string;
59
73
  format?: "int" | undefined;
@@ -86,21 +100,7 @@ declare const configSchema: z.ZodObject<{
86
100
  }) & {
87
101
  type: "number";
88
102
  build: z.core.$InferOuterFunctionType<z.core.$ZodFunctionArgs, z.ZodCustom<import("../index.js").NumberField, import("../index.js").NumberField>>;
89
- }) | {
90
- type: "text";
91
- build: z.core.$InferOuterFunctionType<z.core.$ZodFunctionArgs, z.ZodCustom<import("../index.js").TextField, import("../index.js").TextField>>;
92
- name: string;
93
- placeholder?: string | undefined;
94
- minLength?: number | undefined;
95
- maxLength?: number | undefined;
96
- defaultValue?: string | undefined;
97
- sanitize?: boolean | undefined;
98
- label?: string | undefined;
99
- required?: boolean | undefined;
100
- order?: number | undefined;
101
- conditionalRules?: import("../types/index.js").ConditionalRule[] | undefined;
102
- adminGenerated?: boolean | "readonly" | undefined;
103
- }>;
103
+ })>;
104
104
  title: z.ZodObject<{
105
105
  section: z.ZodString;
106
106
  singular: z.ZodString;
@@ -134,7 +134,7 @@ declare const configSchema: z.ZodObject<{
134
134
  size: number;
135
135
  unit: "kb" | "mb";
136
136
  } | undefined;
137
- fileType?: ("jpeg" | "jpg" | "png" | "webp")[] | undefined;
137
+ fileType?: ("webp" | "jpg" | "jpeg" | "png")[] | undefined;
138
138
  removeExtension?: boolean | undefined;
139
139
  label?: string | undefined;
140
140
  required?: boolean | undefined;
@@ -163,7 +163,7 @@ declare const configSchema: z.ZodObject<{
163
163
  size: number;
164
164
  unit: "kb" | "mb";
165
165
  } | undefined;
166
- fileType?: ("jpeg" | "jpg" | "png" | "webp")[] | undefined;
166
+ fileType?: ("webp" | "jpg" | "jpeg" | "png")[] | undefined;
167
167
  removeExtension?: boolean | undefined;
168
168
  label?: string | undefined;
169
169
  required?: boolean | undefined;
@@ -200,7 +200,21 @@ export declare class HasItemsSection extends Section<Config> {
200
200
  constructor(config: BaseSectionOptions<Config>);
201
201
  }
202
202
  declare const optionsSchema: z.ZodObject<{
203
- headingField: z.ZodCustom<(({
203
+ headingField: z.ZodCustom<{
204
+ type: "text";
205
+ build: z.core.$InferOuterFunctionType<z.core.$ZodFunctionArgs, z.ZodCustom<import("../index.js").TextField, import("../index.js").TextField>>;
206
+ name: string;
207
+ placeholder?: string | undefined;
208
+ minLength?: number | undefined;
209
+ maxLength?: number | undefined;
210
+ defaultValue?: string | undefined;
211
+ sanitize?: boolean | undefined;
212
+ label?: string | undefined;
213
+ required?: boolean | undefined;
214
+ order?: number | undefined;
215
+ conditionalRules?: import("../types/index.js").ConditionalRule[] | undefined;
216
+ adminGenerated?: boolean | "readonly" | undefined;
217
+ } | (({
204
218
  hasAutoIncrement: true;
205
219
  name: string;
206
220
  format?: "int" | undefined;
@@ -233,7 +247,7 @@ declare const optionsSchema: z.ZodObject<{
233
247
  }) & {
234
248
  type: "number";
235
249
  build: z.core.$InferOuterFunctionType<z.core.$ZodFunctionArgs, z.ZodCustom<import("../index.js").NumberField, import("../index.js").NumberField>>;
236
- }) | {
250
+ }), {
237
251
  type: "text";
238
252
  build: z.core.$InferOuterFunctionType<z.core.$ZodFunctionArgs, z.ZodCustom<import("../index.js").TextField, import("../index.js").TextField>>;
239
253
  name: string;
@@ -247,7 +261,7 @@ declare const optionsSchema: z.ZodObject<{
247
261
  order?: number | undefined;
248
262
  conditionalRules?: import("../types/index.js").ConditionalRule[] | undefined;
249
263
  adminGenerated?: boolean | "readonly" | undefined;
250
- }, (({
264
+ } | (({
251
265
  hasAutoIncrement: true;
252
266
  name: string;
253
267
  format?: "int" | undefined;
@@ -280,21 +294,7 @@ declare const optionsSchema: z.ZodObject<{
280
294
  }) & {
281
295
  type: "number";
282
296
  build: z.core.$InferOuterFunctionType<z.core.$ZodFunctionArgs, z.ZodCustom<import("../index.js").NumberField, import("../index.js").NumberField>>;
283
- }) | {
284
- type: "text";
285
- build: z.core.$InferOuterFunctionType<z.core.$ZodFunctionArgs, z.ZodCustom<import("../index.js").TextField, import("../index.js").TextField>>;
286
- name: string;
287
- placeholder?: string | undefined;
288
- minLength?: number | undefined;
289
- maxLength?: number | undefined;
290
- defaultValue?: string | undefined;
291
- sanitize?: boolean | undefined;
292
- label?: string | undefined;
293
- required?: boolean | undefined;
294
- order?: number | undefined;
295
- conditionalRules?: import("../types/index.js").ConditionalRule[] | undefined;
296
- adminGenerated?: boolean | "readonly" | undefined;
297
- }>;
297
+ })>;
298
298
  title: z.ZodObject<{
299
299
  section: z.ZodString;
300
300
  singular: z.ZodString;
@@ -328,7 +328,7 @@ declare const optionsSchema: z.ZodObject<{
328
328
  size: number;
329
329
  unit: "kb" | "mb";
330
330
  } | undefined;
331
- fileType?: ("jpeg" | "jpg" | "png" | "webp")[] | undefined;
331
+ fileType?: ("webp" | "jpg" | "jpeg" | "png")[] | undefined;
332
332
  removeExtension?: boolean | undefined;
333
333
  label?: string | undefined;
334
334
  required?: boolean | undefined;
@@ -357,7 +357,7 @@ declare const optionsSchema: z.ZodObject<{
357
357
  size: number;
358
358
  unit: "kb" | "mb";
359
359
  } | undefined;
360
- fileType?: ("jpeg" | "jpg" | "png" | "webp")[] | undefined;
360
+ fileType?: ("webp" | "jpg" | "jpeg" | "png")[] | undefined;
361
361
  removeExtension?: boolean | undefined;
362
362
  label?: string | undefined;
363
363
  required?: boolean | undefined;
@@ -368,9 +368,10 @@ 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
- readonly: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
371
+ variants: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types/index.js").Variant, import("../types/index.js").Variant>>>;
372
372
  name: z.ZodString;
373
373
  order: z.ZodNumber;
374
+ readonly: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
374
375
  db: z.ZodObject<{
375
376
  table: z.ZodString;
376
377
  identifier: z.ZodOptional<z.ZodCustom<FieldConfig, FieldConfig>>;
@@ -394,7 +395,6 @@ declare const optionsSchema: z.ZodObject<{
394
395
  name: z.ZodOptional<z.ZodString>;
395
396
  }, z.core.$strict>>>;
396
397
  }, z.core.$strict>;
397
- variants: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types/index.js").Variant, import("../types/index.js").Variant>>>;
398
398
  icon: z.ZodOptional<z.ZodString>;
399
399
  gallery: z.ZodOptional<z.ZodObject<{
400
400
  db: z.ZodObject<{
@@ -418,7 +418,21 @@ declare const hasItemsSectionConfigSchema: z.ZodObject<{
418
418
  fields: z.ZodArray<z.ZodCustom<FieldConfig, FieldConfig>>;
419
419
  build: z.ZodFunction<z.core.$ZodFunctionArgs, z.ZodCustom<HasItemsSection, HasItemsSection>>;
420
420
  fieldGroups: z.ZodOptional<z.ZodArray<z.ZodCustom<FieldGroupConfig, FieldGroupConfig>>>;
421
- headingField: z.ZodCustom<(({
421
+ headingField: z.ZodCustom<{
422
+ type: "text";
423
+ build: z.core.$InferOuterFunctionType<z.core.$ZodFunctionArgs, z.ZodCustom<import("../index.js").TextField, import("../index.js").TextField>>;
424
+ name: string;
425
+ placeholder?: string | undefined;
426
+ minLength?: number | undefined;
427
+ maxLength?: number | undefined;
428
+ defaultValue?: string | undefined;
429
+ sanitize?: boolean | undefined;
430
+ label?: string | undefined;
431
+ required?: boolean | undefined;
432
+ order?: number | undefined;
433
+ conditionalRules?: import("../types/index.js").ConditionalRule[] | undefined;
434
+ adminGenerated?: boolean | "readonly" | undefined;
435
+ } | (({
422
436
  hasAutoIncrement: true;
423
437
  name: string;
424
438
  format?: "int" | undefined;
@@ -451,7 +465,7 @@ declare const hasItemsSectionConfigSchema: z.ZodObject<{
451
465
  }) & {
452
466
  type: "number";
453
467
  build: z.core.$InferOuterFunctionType<z.core.$ZodFunctionArgs, z.ZodCustom<import("../index.js").NumberField, import("../index.js").NumberField>>;
454
- }) | {
468
+ }), {
455
469
  type: "text";
456
470
  build: z.core.$InferOuterFunctionType<z.core.$ZodFunctionArgs, z.ZodCustom<import("../index.js").TextField, import("../index.js").TextField>>;
457
471
  name: string;
@@ -465,7 +479,7 @@ declare const hasItemsSectionConfigSchema: z.ZodObject<{
465
479
  order?: number | undefined;
466
480
  conditionalRules?: import("../types/index.js").ConditionalRule[] | undefined;
467
481
  adminGenerated?: boolean | "readonly" | undefined;
468
- }, (({
482
+ } | (({
469
483
  hasAutoIncrement: true;
470
484
  name: string;
471
485
  format?: "int" | undefined;
@@ -498,21 +512,7 @@ declare const hasItemsSectionConfigSchema: z.ZodObject<{
498
512
  }) & {
499
513
  type: "number";
500
514
  build: z.core.$InferOuterFunctionType<z.core.$ZodFunctionArgs, z.ZodCustom<import("../index.js").NumberField, import("../index.js").NumberField>>;
501
- }) | {
502
- type: "text";
503
- build: z.core.$InferOuterFunctionType<z.core.$ZodFunctionArgs, z.ZodCustom<import("../index.js").TextField, import("../index.js").TextField>>;
504
- name: string;
505
- placeholder?: string | undefined;
506
- minLength?: number | undefined;
507
- maxLength?: number | undefined;
508
- defaultValue?: string | undefined;
509
- sanitize?: boolean | undefined;
510
- label?: string | undefined;
511
- required?: boolean | undefined;
512
- order?: number | undefined;
513
- conditionalRules?: import("../types/index.js").ConditionalRule[] | undefined;
514
- adminGenerated?: boolean | "readonly" | undefined;
515
- }>;
515
+ })>;
516
516
  title: z.ZodObject<{
517
517
  section: z.ZodString;
518
518
  singular: z.ZodString;
@@ -546,7 +546,7 @@ declare const hasItemsSectionConfigSchema: z.ZodObject<{
546
546
  size: number;
547
547
  unit: "kb" | "mb";
548
548
  } | undefined;
549
- fileType?: ("jpeg" | "jpg" | "png" | "webp")[] | undefined;
549
+ fileType?: ("webp" | "jpg" | "jpeg" | "png")[] | undefined;
550
550
  removeExtension?: boolean | undefined;
551
551
  label?: string | undefined;
552
552
  required?: boolean | undefined;
@@ -575,7 +575,7 @@ declare const hasItemsSectionConfigSchema: z.ZodObject<{
575
575
  size: number;
576
576
  unit: "kb" | "mb";
577
577
  } | undefined;
578
- fileType?: ("jpeg" | "jpg" | "png" | "webp")[] | undefined;
578
+ fileType?: ("webp" | "jpg" | "jpeg" | "png")[] | undefined;
579
579
  removeExtension?: boolean | undefined;
580
580
  label?: string | undefined;
581
581
  required?: boolean | undefined;
@@ -585,9 +585,10 @@ declare const hasItemsSectionConfigSchema: z.ZodObject<{
585
585
  adminGenerated?: boolean | "readonly" | undefined;
586
586
  }>>;
587
587
  generateQR: z.ZodOptional<z.ZodBoolean>;
588
- readonly: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
588
+ variants: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types/index.js").Variant, import("../types/index.js").Variant>>>;
589
589
  name: z.ZodString;
590
590
  order: z.ZodNumber;
591
+ readonly: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
591
592
  db: z.ZodObject<{
592
593
  table: z.ZodString;
593
594
  identifier: z.ZodOptional<z.ZodCustom<FieldConfig, FieldConfig>>;
@@ -611,7 +612,6 @@ declare const hasItemsSectionConfigSchema: z.ZodObject<{
611
612
  name: z.ZodOptional<z.ZodString>;
612
613
  }, z.core.$strict>>>;
613
614
  }, z.core.$strict>;
614
- variants: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types/index.js").Variant, import("../types/index.js").Variant>>>;
615
615
  icon: z.ZodOptional<z.ZodString>;
616
616
  gallery: z.ZodOptional<z.ZodObject<{
617
617
  db: z.ZodObject<{
@@ -62,9 +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
+ variants: z.ZodOptional<z.ZodArray<z.ZodCustom<Variant, Variant>>>;
66
66
  name: z.ZodString;
67
67
  order: z.ZodNumber;
68
+ readonly: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
68
69
  db: z.ZodObject<{
69
70
  table: z.ZodString;
70
71
  identifier: z.ZodOptional<z.ZodCustom<FieldConfig, FieldConfig>>;
@@ -88,7 +89,6 @@ export declare const baseHelperFunctionOptionsSchema: z.ZodObject<{
88
89
  name: z.ZodOptional<z.ZodString>;
89
90
  }, z.core.$strict>>>;
90
91
  }, z.core.$strict>;
91
- variants: z.ZodOptional<z.ZodArray<z.ZodCustom<Variant, Variant>>>;
92
92
  icon: z.ZodOptional<z.ZodString>;
93
93
  gallery: z.ZodOptional<z.ZodObject<{
94
94
  db: z.ZodObject<{
@@ -22,10 +22,10 @@ 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
- readonly: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
25
+ variants: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types/index.js").Variant, import("../types/index.js").Variant>>>;
26
26
  name: z.ZodString;
27
27
  order: z.ZodNumber;
28
- variants: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types/index.js").Variant, import("../types/index.js").Variant>>>;
28
+ readonly: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
29
29
  icon: z.ZodOptional<z.ZodString>;
30
30
  gallery: z.ZodOptional<z.ZodObject<{
31
31
  db: z.ZodObject<{
@@ -53,10 +53,10 @@ declare const simpleSectionConfigSchema: z.ZodObject<{
53
53
  db: z.ZodObject<{
54
54
  table: z.ZodString;
55
55
  }, z.core.$strict>;
56
- readonly: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
56
+ variants: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types/index.js").Variant, import("../types/index.js").Variant>>>;
57
57
  name: z.ZodString;
58
58
  order: z.ZodNumber;
59
- variants: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types/index.js").Variant, import("../types/index.js").Variant>>>;
59
+ readonly: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
60
60
  icon: z.ZodOptional<z.ZodString>;
61
61
  gallery: z.ZodOptional<z.ZodObject<{
62
62
  db: z.ZodObject<{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nextjs-cms",
3
- "version": "0.5.83",
3
+ "version": "0.5.85",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "type": "module",