nextjs-cms 0.9.20 → 0.9.22
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/api/index.d.ts +8 -48
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/lib/serverActions.d.ts +9 -49
- package/dist/api/lib/serverActions.d.ts.map +1 -1
- package/dist/api/lib/serverActions.js +82 -34
- package/dist/api/root.d.ts +16 -96
- package/dist/api/root.d.ts.map +1 -1
- package/dist/api/routers/gallery.d.ts +1 -0
- package/dist/api/routers/gallery.d.ts.map +1 -1
- package/dist/api/routers/gallery.js +36 -8
- package/dist/api/routers/hasItemsSection.d.ts +3 -30
- package/dist/api/routers/hasItemsSection.d.ts.map +1 -1
- package/dist/api/routers/navigation.d.ts +3 -3
- package/dist/api/routers/simpleSection.d.ts +1 -15
- package/dist/api/routers/simpleSection.d.ts.map +1 -1
- package/dist/cli/lib/update-sections.d.ts.map +1 -1
- package/dist/cli/lib/update-sections.js +660 -213
- package/dist/core/db/table-checker/MysqlTable.d.ts.map +1 -1
- package/dist/core/db/table-checker/MysqlTable.js +3 -1
- package/dist/core/factories/FieldFactory.d.ts +1 -1
- package/dist/core/factories/FieldFactory.d.ts.map +1 -1
- package/dist/core/factories/FieldFactory.js +11 -9
- package/dist/core/fields/date.d.ts.map +1 -1
- package/dist/core/fields/date.js +10 -6
- package/dist/core/fields/select.d.ts +23 -11
- package/dist/core/fields/select.d.ts.map +1 -1
- package/dist/core/fields/select.js +9 -5
- package/dist/core/fields/selectMultiple.d.ts +12 -4
- package/dist/core/fields/selectMultiple.d.ts.map +1 -1
- package/dist/core/fields/selectMultiple.js +10 -6
- package/dist/core/sections/category.d.ts +44 -42
- package/dist/core/sections/category.d.ts.map +1 -1
- package/dist/core/sections/hasItems.d.ts +44 -42
- package/dist/core/sections/hasItems.d.ts.map +1 -1
- package/dist/core/sections/section.d.ts +64 -43
- package/dist/core/sections/section.d.ts.map +1 -1
- package/dist/core/sections/section.js +18 -3
- package/dist/core/sections/simple.d.ts +8 -6
- package/dist/core/sections/simple.d.ts.map +1 -1
- package/dist/core/submit/ItemEditSubmit.d.ts.map +1 -1
- package/dist/core/submit/ItemEditSubmit.js +7 -1
- package/dist/core/submit/LocaleSubmit.d.ts +3 -3
- package/dist/core/submit/LocaleSubmit.d.ts.map +1 -1
- package/dist/core/submit/LocaleSubmit.js +9 -6
- package/dist/core/submit/submit.d.ts +4 -4
- package/dist/core/submit/submit.d.ts.map +1 -1
- package/dist/core/submit/submit.js +13 -9
- package/dist/core/types/index.d.ts +2 -2
- package/dist/core/types/index.d.ts.map +1 -1
- package/dist/db/cms-system-tables.d.ts.map +1 -1
- package/dist/db/cms-system-tables.js +2 -1
- package/dist/db/schema.d.ts +61 -0
- package/dist/db/schema.d.ts.map +1 -1
- package/dist/db/schema.js +8 -0
- package/dist/translations/base/en.d.ts +4 -0
- package/dist/translations/base/en.d.ts.map +1 -1
- package/dist/translations/base/en.js +4 -0
- package/dist/translations/client.d.ts +52 -4
- package/dist/translations/client.d.ts.map +1 -1
- package/dist/translations/server.d.ts +52 -4
- package/dist/translations/server.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MysqlTable.d.ts","sourceRoot":"","sources":["../../../../src/core/db/table-checker/MysqlTable.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAG7C;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,cAAc;WACpC,iBAAiB;WAgBjB,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"MysqlTable.d.ts","sourceRoot":"","sources":["../../../../src/core/db/table-checker/MysqlTable.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAG7C;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,cAAc;WACpC,iBAAiB;WAgBjB,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;WAoBhD,eAAe,CAAC,KAAK,EAAE,MAAM;;;kBAIR,MAAM;qBAAW,MAAM,EAAE;;;kBAC1B,MAAM;qBAAW,MAAM,EAAE;;;;kBACtB,MAAM;qBAAW,MAAM,EAAE;;;WA2DhD,yBAAyB,CAAC,KAAK,EAAE,MAAM;;mBAU7B,MAAM;kBACP,MAAM;kBACN,MAAM;iBACP,MAAM;qBACF,MAAM;mBACR,MAAM;;;CAahC"}
|
|
@@ -26,7 +26,9 @@ export class MysqlTableChecker extends DbTableChecker {
|
|
|
26
26
|
SELECT COLUMN_NAME
|
|
27
27
|
FROM information_schema.COLUMNS c
|
|
28
28
|
inner join information_schema.TABLES t ON t.TABLE_NAME = c.TABLE_NAME
|
|
29
|
-
WHERE t.
|
|
29
|
+
WHERE t.TABLE_SCHEMA = DATABASE()
|
|
30
|
+
AND c.TABLE_SCHEMA = DATABASE()
|
|
31
|
+
AND t.TABLE_NAME = ${tableName}`;
|
|
30
32
|
const _cols = [];
|
|
31
33
|
const _res = await db.execute(statement);
|
|
32
34
|
// @ts-ignore
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FieldFactory.d.ts","sourceRoot":"","sources":["../../../src/core/factories/FieldFactory.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FieldFactory.d.ts","sourceRoot":"","sources":["../../../src/core/factories/FieldFactory.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAGlD,OAAO,KAAK,EAAgD,OAAO,EAAuB,MAAM,sBAAsB,CAAA;AAWtH,KAAK,eAAe,GACd;IACI,IAAI,EAAE,KAAK,CAAA;IACX,WAAW,EAAE,MAAM,CAAA;IACnB,OAAO,EAAE,OAAO,CAAA;IAChB,MAAM,CAAC,EAAE,KAAK,CAAA;CACjB,GACD;IACI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{ sql } from 'drizzle-orm';
|
|
2
|
-
import { db } from '../../db/client.js';
|
|
3
|
-
import { SectionFactory } from './SectionFactory.js';
|
|
4
|
-
import { SimpleSection, HasItemsSection, CategorySection } from '../sections/index.js';
|
|
5
|
-
import { checkboxField, DateRangeField, SelectField, SelectMultipleField, TagsField } from '../fields/index.js';
|
|
6
|
-
import { is } from '../helpers/index.js';
|
|
7
3
|
import { cloneDeep } from 'lodash-es';
|
|
8
|
-
import
|
|
4
|
+
import { db } from '../../db/client.js';
|
|
9
5
|
import getString from '../../translations/index.js';
|
|
10
|
-
import { resolveMultilingualString } from '../../translations/language-utils.js';
|
|
11
|
-
import { resolveLanguage } from '../../translations/language-utils.js';
|
|
6
|
+
import { resolveLanguage, resolveMultilingualString } from '../../translations/language-utils.js';
|
|
12
7
|
import { getCMSConfig } from '../config/index.js';
|
|
8
|
+
import { checkboxField, DateRangeField, SelectField, SelectMultipleField, TagsField } from '../fields/index.js';
|
|
9
|
+
import { is } from '../helpers/index.js';
|
|
10
|
+
import { CategorySection, HasItemsSection, SimpleSection } from '../sections/index.js';
|
|
11
|
+
import { SectionFactory } from './SectionFactory.js';
|
|
13
12
|
export class FieldFactory {
|
|
14
13
|
session;
|
|
15
14
|
_values = {};
|
|
@@ -483,7 +482,7 @@ export class FieldFactory {
|
|
|
483
482
|
if (!this._sectionInfo)
|
|
484
483
|
return;
|
|
485
484
|
const localizationEnabled = !!cmsConfig.localization?.enabled;
|
|
486
|
-
const hasLocalized = this._sectionInfo.
|
|
485
|
+
const hasLocalized = this._sectionInfo.hasLocalizedContent;
|
|
487
486
|
const identifierName = this._sectionInfo.db.identifier.name;
|
|
488
487
|
const sectionName = this._sectionInfo.name;
|
|
489
488
|
if (this._sectionInfo.fieldConfigs.some((f) => f.name === identifierName && 'localized' in f && f.localized)) {
|
|
@@ -493,6 +492,9 @@ export class FieldFactory {
|
|
|
493
492
|
const names = this._sectionInfo.fieldConfigs
|
|
494
493
|
.filter((f) => 'localized' in f && f.localized)
|
|
495
494
|
.map((f) => f.name);
|
|
495
|
+
if (this._sectionInfo.hasLocalizedContent && !this._sectionInfo.hasLocalizedFields) {
|
|
496
|
+
names.push('gallery');
|
|
497
|
+
}
|
|
496
498
|
console.warn(chalk.yellow(`[nextjs-cms] Section "${sectionName}": fields [${names.join(', ')}] are marked localized but localization is not enabled in config`));
|
|
497
499
|
}
|
|
498
500
|
if (this._sectionInfo.hooks) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date.d.ts","sourceRoot":"","sources":["../../../src/core/fields/date.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;AAExB,OAAO,EAKH,KAAK,cAAc,EACtB,MAAM,4BAA4B,CAAA;AAEnC,QAAA,MAAM,YAAY;;;;;;;;IAId;;;;OAIG;;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;IAE3D;;;;OAIG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,GAAG,WAAW,CAAA;IAClD,QAAQ,CAAC,OAAO,EAAE,cAAc,GAAG,SAAS,CAAA;IAC5C,QAAQ,CAAC,OAAO,EAAE,cAAc,GAAG,SAAS,CAAA;IAC5C,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAkB;gBACpC,MAAM,EAAE,eAAe,CAAC,MAAM,CAAC;IAkB3C;;;OAGG;IACH,OAAO,CAAC,SAAS;IAQjB;;;OAGG;IACH,QAAQ,IAAI,MAAM,G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AAU,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC,CAAA;AAE5E,QAAA,MAAM,aAAa;;;;;;;;IAjJf;;;;OAIG;;;;;;;;;kBAgJL,CAAA;AAEF,QAAA,MAAM,qBAAqB;;;;;;;;;;IAtJvB;;;;OAIG;;;;;;;;;kBAsJL,CAAA;AAEF;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAA;AAEnE;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,GAAG,eAAe,CAmB/E"}
|
package/dist/core/fields/date.js
CHANGED
|
@@ -93,15 +93,19 @@ export class DateField extends Field {
|
|
|
93
93
|
* Normalizes the value to ISO string format for storage
|
|
94
94
|
*/
|
|
95
95
|
async prepareForSubmission() {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
96
|
+
if (this.value === undefined || this.value === null || this.value === '') {
|
|
97
|
+
if (this.required) {
|
|
98
|
+
throw new Error(getString('invalidDatePleaseProvideValid', this.language, { field: this.getLocalizedLabel() }));
|
|
99
|
+
}
|
|
100
|
+
this.value = null;
|
|
101
|
+
return;
|
|
100
102
|
}
|
|
101
|
-
|
|
103
|
+
const date = new Date(this.value);
|
|
104
|
+
if (isNaN(date.getTime())) {
|
|
102
105
|
throw new Error(getString('invalidDatePleaseProvideValid', this.language, { field: this.getLocalizedLabel() }));
|
|
103
106
|
}
|
|
104
|
-
|
|
107
|
+
this.validateDateBounds(date);
|
|
108
|
+
this.value = date.toISOString();
|
|
105
109
|
}
|
|
106
110
|
validateDateBounds(date) {
|
|
107
111
|
const minDate = resolveDateBoundValue(this.minDate);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import * as z from 'zod';
|
|
2
|
+
import type { CategorySection, HasItemsSection } from '../sections';
|
|
1
3
|
import type { BaseFieldConfig } from './field.js';
|
|
2
|
-
import { Field } from './field.js';
|
|
3
4
|
import { entityKind } from '../helpers/index.js';
|
|
4
|
-
import
|
|
5
|
-
import * as z from 'zod';
|
|
5
|
+
import { Field } from './field.js';
|
|
6
6
|
export declare const selectOptionSchema: z.ZodObject<{
|
|
7
7
|
value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
|
8
8
|
label: z.ZodString;
|
|
@@ -42,6 +42,10 @@ export declare const selectFieldSpecificConfigSchema: z.ZodUnion<readonly [z.Zod
|
|
|
42
42
|
db: z.ZodObject<{
|
|
43
43
|
table: z.ZodString;
|
|
44
44
|
identifier: z.ZodString;
|
|
45
|
+
identifierType: z.ZodOptional<z.ZodEnum<{
|
|
46
|
+
number: "number";
|
|
47
|
+
text: "text";
|
|
48
|
+
}>>;
|
|
45
49
|
label: z.ZodString;
|
|
46
50
|
orderBy: z.ZodOptional<z.ZodString>;
|
|
47
51
|
}, z.core.$strict>;
|
|
@@ -146,7 +150,7 @@ export declare class SelectField extends Field<'select', SelectFieldConfig> {
|
|
|
146
150
|
label: string;
|
|
147
151
|
required: boolean;
|
|
148
152
|
localized?: boolean;
|
|
149
|
-
conditionalFields: import("../types
|
|
153
|
+
conditionalFields: import("../types").ConditionalField[];
|
|
150
154
|
readonly: boolean;
|
|
151
155
|
defaultValue: any;
|
|
152
156
|
};
|
|
@@ -201,6 +205,10 @@ export declare const selectFieldOptionsSchema: z.ZodUnion<readonly [z.ZodObject<
|
|
|
201
205
|
db: z.ZodObject<{
|
|
202
206
|
table: z.ZodString;
|
|
203
207
|
identifier: z.ZodString;
|
|
208
|
+
identifierType: z.ZodOptional<z.ZodEnum<{
|
|
209
|
+
number: "number";
|
|
210
|
+
text: "text";
|
|
211
|
+
}>>;
|
|
204
212
|
label: z.ZodString;
|
|
205
213
|
orderBy: z.ZodOptional<z.ZodString>;
|
|
206
214
|
}, z.core.$strict>;
|
|
@@ -210,7 +218,7 @@ export declare const selectFieldOptionsSchema: z.ZodUnion<readonly [z.ZodObject<
|
|
|
210
218
|
required: z.ZodOptional<z.ZodBoolean>;
|
|
211
219
|
defaultValue: z.ZodOptional<z.ZodAny>;
|
|
212
220
|
order: z.ZodOptional<z.ZodNumber>;
|
|
213
|
-
conditionalRules: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types
|
|
221
|
+
conditionalRules: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types").ConditionalRule, import("../types").ConditionalRule>>>;
|
|
214
222
|
adminGenerated: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodLiteral<false>, z.ZodLiteral<"readonly">]>>;
|
|
215
223
|
localized: z.ZodOptional<z.ZodBoolean>;
|
|
216
224
|
}, z.core.$strict>, z.ZodObject<{
|
|
@@ -237,7 +245,7 @@ export declare const selectFieldOptionsSchema: z.ZodUnion<readonly [z.ZodObject<
|
|
|
237
245
|
required: z.ZodOptional<z.ZodBoolean>;
|
|
238
246
|
defaultValue: z.ZodOptional<z.ZodAny>;
|
|
239
247
|
order: z.ZodOptional<z.ZodNumber>;
|
|
240
|
-
conditionalRules: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types
|
|
248
|
+
conditionalRules: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types").ConditionalRule, import("../types").ConditionalRule>>>;
|
|
241
249
|
adminGenerated: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodLiteral<false>, z.ZodLiteral<"readonly">]>>;
|
|
242
250
|
localized: z.ZodOptional<z.ZodBoolean>;
|
|
243
251
|
}, z.core.$strict>, z.ZodObject<{
|
|
@@ -264,7 +272,7 @@ export declare const selectFieldOptionsSchema: z.ZodUnion<readonly [z.ZodObject<
|
|
|
264
272
|
required: z.ZodOptional<z.ZodBoolean>;
|
|
265
273
|
defaultValue: z.ZodOptional<z.ZodAny>;
|
|
266
274
|
order: z.ZodOptional<z.ZodNumber>;
|
|
267
|
-
conditionalRules: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types
|
|
275
|
+
conditionalRules: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types").ConditionalRule, import("../types").ConditionalRule>>>;
|
|
268
276
|
adminGenerated: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodLiteral<false>, z.ZodLiteral<"readonly">]>>;
|
|
269
277
|
localized: z.ZodOptional<z.ZodBoolean>;
|
|
270
278
|
}, z.core.$strict>]>;
|
|
@@ -285,6 +293,10 @@ declare const selectFieldConfigSchema: z.ZodIntersection<z.ZodUnion<readonly [z.
|
|
|
285
293
|
db: z.ZodObject<{
|
|
286
294
|
table: z.ZodString;
|
|
287
295
|
identifier: z.ZodString;
|
|
296
|
+
identifierType: z.ZodOptional<z.ZodEnum<{
|
|
297
|
+
number: "number";
|
|
298
|
+
text: "text";
|
|
299
|
+
}>>;
|
|
288
300
|
label: z.ZodString;
|
|
289
301
|
orderBy: z.ZodOptional<z.ZodString>;
|
|
290
302
|
}, z.core.$strict>;
|
|
@@ -294,7 +306,7 @@ declare const selectFieldConfigSchema: z.ZodIntersection<z.ZodUnion<readonly [z.
|
|
|
294
306
|
required: z.ZodOptional<z.ZodBoolean>;
|
|
295
307
|
defaultValue: z.ZodOptional<z.ZodAny>;
|
|
296
308
|
order: z.ZodOptional<z.ZodNumber>;
|
|
297
|
-
conditionalRules: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types
|
|
309
|
+
conditionalRules: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types").ConditionalRule, import("../types").ConditionalRule>>>;
|
|
298
310
|
adminGenerated: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodLiteral<false>, z.ZodLiteral<"readonly">]>>;
|
|
299
311
|
localized: z.ZodOptional<z.ZodBoolean>;
|
|
300
312
|
}, z.core.$strict>, z.ZodObject<{
|
|
@@ -321,7 +333,7 @@ declare const selectFieldConfigSchema: z.ZodIntersection<z.ZodUnion<readonly [z.
|
|
|
321
333
|
required: z.ZodOptional<z.ZodBoolean>;
|
|
322
334
|
defaultValue: z.ZodOptional<z.ZodAny>;
|
|
323
335
|
order: z.ZodOptional<z.ZodNumber>;
|
|
324
|
-
conditionalRules: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types
|
|
336
|
+
conditionalRules: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types").ConditionalRule, import("../types").ConditionalRule>>>;
|
|
325
337
|
adminGenerated: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodLiteral<false>, z.ZodLiteral<"readonly">]>>;
|
|
326
338
|
localized: z.ZodOptional<z.ZodBoolean>;
|
|
327
339
|
}, z.core.$strict>, z.ZodObject<{
|
|
@@ -348,14 +360,14 @@ declare const selectFieldConfigSchema: z.ZodIntersection<z.ZodUnion<readonly [z.
|
|
|
348
360
|
required: z.ZodOptional<z.ZodBoolean>;
|
|
349
361
|
defaultValue: z.ZodOptional<z.ZodAny>;
|
|
350
362
|
order: z.ZodOptional<z.ZodNumber>;
|
|
351
|
-
conditionalRules: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types
|
|
363
|
+
conditionalRules: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types").ConditionalRule, import("../types").ConditionalRule>>>;
|
|
352
364
|
adminGenerated: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodLiteral<false>, z.ZodLiteral<"readonly">]>>;
|
|
353
365
|
localized: z.ZodOptional<z.ZodBoolean>;
|
|
354
366
|
}, z.core.$strict>]>, z.ZodObject<{
|
|
355
367
|
type: z.ZodLiteral<"select">;
|
|
356
368
|
optionsType: z.ZodEnum<{
|
|
357
|
-
db: "db";
|
|
358
369
|
section: "section";
|
|
370
|
+
db: "db";
|
|
359
371
|
static: "static";
|
|
360
372
|
}>;
|
|
361
373
|
build: z.ZodFunction<z.core.$ZodFunctionArgs, z.ZodCustom<SelectField, SelectField>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../../src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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;;;QAvhBjC;;WAEG;;QAEH;;WAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;QANH;;WAEG;;QAEH;;WAEG;;;;;;;;;;;;;;;;;;;;;QANH;;WAEG;;QAEH;;WAEG;;;;;;;;;;;;;;;;;;oBAqhBL,CAAA;AAEF,QAAA,MAAM,uBAAuB;;;QA7hBzB;;WAEG;;QAEH;;WAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;QANH;;WAEG;;QAEH;;WAEG;;;;;;;;;;;;;;;;;;;;;QANH;;WAEG;;QAEH;;WAEG;;;;;;;;;;;;;;;;;;;;;;;;;;mBA8hBN,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"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Field, baseFieldConfigSchema } from './field.js';
|
|
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';
|
|
6
1
|
import chalk from 'chalk';
|
|
2
|
+
import { sql } from 'drizzle-orm';
|
|
7
3
|
import * as z from 'zod';
|
|
4
|
+
import { db } from '../../db/client.js';
|
|
5
|
+
import { MysqlTableChecker } from '../db/index.js';
|
|
6
|
+
import { entityKind } from '../helpers/index.js';
|
|
7
|
+
import { baseFieldConfigSchema, Field } from './field.js';
|
|
8
8
|
export const selectOptionSchema = z.strictObject({
|
|
9
9
|
value: z.union([z.string(), z.number()]).describe('Stored value for this option'),
|
|
10
10
|
label: z.string().describe('Human-readable label for the option'),
|
|
@@ -34,6 +34,10 @@ const selectFieldDbConfigSchema = selectFieldSharedExtrasSchema.extend({
|
|
|
34
34
|
.strictObject({
|
|
35
35
|
table: z.string().min(1).describe('Database table to read select options from'),
|
|
36
36
|
identifier: z.string().min(1).describe('Identifier column for the option'),
|
|
37
|
+
identifierType: z
|
|
38
|
+
.enum(['text', 'number'])
|
|
39
|
+
.optional()
|
|
40
|
+
.describe('Identifier column type for generated lookup tables'),
|
|
37
41
|
label: z.string().min(1).describe('Label column for the option'),
|
|
38
42
|
orderBy: z.string().optional().describe('Optional order by column'),
|
|
39
43
|
})
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import * as z from 'zod';
|
|
2
|
+
import type { CategorySection, HasItemsSection } from '../sections/index.js';
|
|
1
3
|
import type { BaseFieldConfig } from './field.js';
|
|
2
|
-
import { Field } from './field.js';
|
|
3
|
-
import { entityKind } from '../helpers/index.js';
|
|
4
4
|
import type { SelectOption } from './select.js';
|
|
5
|
-
import
|
|
6
|
-
import
|
|
5
|
+
import { entityKind } from '../helpers/index.js';
|
|
6
|
+
import { Field } from './field.js';
|
|
7
7
|
declare const selectMultipleFieldConfigSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
8
8
|
destinationDb: z.ZodOptional<z.ZodObject<{
|
|
9
9
|
table: z.ZodString;
|
|
@@ -15,6 +15,10 @@ declare const selectMultipleFieldConfigSchema: z.ZodUnion<readonly [z.ZodObject<
|
|
|
15
15
|
db: z.ZodObject<{
|
|
16
16
|
table: z.ZodString;
|
|
17
17
|
identifier: z.ZodString;
|
|
18
|
+
identifierType: z.ZodOptional<z.ZodEnum<{
|
|
19
|
+
number: "number";
|
|
20
|
+
text: "text";
|
|
21
|
+
}>>;
|
|
18
22
|
label: z.ZodString;
|
|
19
23
|
orderBy: z.ZodOptional<z.ZodString>;
|
|
20
24
|
}, z.core.$strict>;
|
|
@@ -159,6 +163,10 @@ declare const selectMultipleFieldHelperConfigSchema: z.ZodIntersection<z.ZodUnio
|
|
|
159
163
|
db: z.ZodObject<{
|
|
160
164
|
table: z.ZodString;
|
|
161
165
|
identifier: z.ZodString;
|
|
166
|
+
identifierType: z.ZodOptional<z.ZodEnum<{
|
|
167
|
+
number: "number";
|
|
168
|
+
text: "text";
|
|
169
|
+
}>>;
|
|
162
170
|
label: z.ZodString;
|
|
163
171
|
orderBy: z.ZodOptional<z.ZodString>;
|
|
164
172
|
}, z.core.$strict>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selectMultiple.d.ts","sourceRoot":"","sources":["../../../src/core/fields/selectMultiple.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"selectMultiple.d.ts","sourceRoot":"","sources":["../../../src/core/fields/selectMultiple.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AAExB,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAC5E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAG/C,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAChD,OAAO,EAAyB,KAAK,EAAE,MAAM,YAAY,CAAA;AAqDzD,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,CA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C,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAmBxE;;OAEG;IACY,KAAK;YAsBN,YAAY;IAuB1B;;;OAGG;YACW,sBAAsB;IASpC;;;OAGG;YACW,iCAAiC;IAiB/C;;;OAGG;IACH,OAAO,CAAC,aAAa;IAUrB;;;OAGG;IACH,OAAO,CAAC,wBAAwB;IAYhC,aAAa;IAWb;;OAEG;IACG,oBAAoB;CAkC7B;AAED,MAAM,MAAM,+BAA+B,GAAG,UAAU,CAAC,mBAAmB,CAAC,iBAAiB,CAAC,CAAC,CAAA;AAqBhG,QAAA,MAAM,qCAAqC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAzbzB,WAAW,GAAG,UAAU;cACxB,MAAM;gBACJ,MAAM;iBACL,eAAe,GAAG,eAAe;;cAHpC,WAAW,GAAG,UAAU;cACxB,MAAM;gBACJ,MAAM;iBACL,eAAe,GAAG,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBA+brD,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"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Field, baseFieldConfigSchema } from './field.js';
|
|
2
|
-
import { entityKind } from '../helpers/index.js';
|
|
3
|
-
import { selectFieldDestinationDbSchema, selectOptionSchema } from './select.js';
|
|
4
|
-
import { MysqlTableChecker } from '../db/index.js';
|
|
5
|
-
import { db } from '../../db/client.js';
|
|
6
|
-
import { sql } from 'drizzle-orm';
|
|
7
1
|
import chalk from 'chalk';
|
|
2
|
+
import { sql } from 'drizzle-orm';
|
|
8
3
|
import * as z from 'zod';
|
|
4
|
+
import { db } from '../../db/client.js';
|
|
5
|
+
import { MysqlTableChecker } from '../db/index.js';
|
|
6
|
+
import { entityKind } from '../helpers/index.js';
|
|
7
|
+
import { baseFieldConfigSchema, Field } from './field.js';
|
|
8
|
+
import { selectFieldDestinationDbSchema, selectOptionSchema } from './select.js';
|
|
9
9
|
/*export type SelectMultipleValue = {
|
|
10
10
|
value: string | number
|
|
11
11
|
label: string
|
|
@@ -24,6 +24,10 @@ const selectMultipleFieldDbConfigSchema = selectMultipleSharedExtrasSchema.exten
|
|
|
24
24
|
.strictObject({
|
|
25
25
|
table: z.string().min(1).describe('Database table to read select options from'),
|
|
26
26
|
identifier: z.string().min(1).describe('Identifier column for the option'),
|
|
27
|
+
identifierType: z
|
|
28
|
+
.enum(['text', 'number'])
|
|
29
|
+
.optional()
|
|
30
|
+
.describe('Identifier column type for generated lookup tables'),
|
|
27
31
|
label: z.string().min(1).describe('Label column for the option'),
|
|
28
32
|
orderBy: z.string().optional().describe('Optional order by column'),
|
|
29
33
|
})
|