@nixxie-cms/core 1.0.3 → 2.0.0
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/CHANGELOG.md +36 -0
- package/CHANGES-1.1.md +134 -0
- package/context/dist/nixxie-cms-core-context.cjs.js +4 -3
- package/context/dist/nixxie-cms-core-context.esm.js +3 -2
- package/dist/declarations/src/access.d.ts +2 -2
- package/dist/declarations/src/access.d.ts.map +1 -1
- package/dist/declarations/src/admin-ui/components/Navigation.d.ts +2 -2
- package/dist/declarations/src/admin-ui/components/Navigation.d.ts.map +1 -1
- package/dist/declarations/src/admin-ui/context.d.ts +6 -6
- package/dist/declarations/src/admin-ui/context.d.ts.map +1 -1
- package/dist/declarations/src/admin-ui/utils/Fields.d.ts +3 -3
- package/dist/declarations/src/admin-ui/utils/Fields.d.ts.map +1 -1
- package/dist/declarations/src/admin-ui/utils/filters.d.ts +5 -5
- package/dist/declarations/src/admin-ui/utils/filters.d.ts.map +1 -1
- package/dist/declarations/src/admin-ui/utils/useCreateItem.d.ts +3 -3
- package/dist/declarations/src/admin-ui/utils/useCreateItem.d.ts.map +1 -1
- package/dist/declarations/src/admin-ui/utils/utils.d.ts +2 -2
- package/dist/declarations/src/admin-ui/utils/utils.d.ts.map +1 -1
- package/dist/declarations/src/context.d.ts +1 -1
- package/dist/declarations/src/context.d.ts.map +1 -1
- package/dist/declarations/src/fields/types/bigInt/index.d.ts +3 -3
- package/dist/declarations/src/fields/types/bigInt/index.d.ts.map +1 -1
- package/dist/declarations/src/fields/types/bytes/index.d.ts +3 -3
- package/dist/declarations/src/fields/types/bytes/index.d.ts.map +1 -1
- package/dist/declarations/src/fields/types/calendarDay/index.d.ts +3 -3
- package/dist/declarations/src/fields/types/calendarDay/index.d.ts.map +1 -1
- package/dist/declarations/src/fields/types/checkbox/index.d.ts +3 -3
- package/dist/declarations/src/fields/types/checkbox/index.d.ts.map +1 -1
- package/dist/declarations/src/fields/types/decimal/index.d.ts +3 -3
- package/dist/declarations/src/fields/types/decimal/index.d.ts.map +1 -1
- package/dist/declarations/src/fields/types/file/index.d.ts +4 -4
- package/dist/declarations/src/fields/types/file/index.d.ts.map +1 -1
- package/dist/declarations/src/fields/types/float/index.d.ts +3 -3
- package/dist/declarations/src/fields/types/float/index.d.ts.map +1 -1
- package/dist/declarations/src/fields/types/image/index.d.ts +4 -4
- package/dist/declarations/src/fields/types/image/index.d.ts.map +1 -1
- package/dist/declarations/src/fields/types/integer/index.d.ts +3 -3
- package/dist/declarations/src/fields/types/integer/index.d.ts.map +1 -1
- package/dist/declarations/src/fields/types/json/index.d.ts +3 -3
- package/dist/declarations/src/fields/types/json/index.d.ts.map +1 -1
- package/dist/declarations/src/fields/types/multiselect/index.d.ts +3 -3
- package/dist/declarations/src/fields/types/multiselect/index.d.ts.map +1 -1
- package/dist/declarations/src/fields/types/multiselect/views/index.d.ts.map +1 -1
- package/dist/declarations/src/fields/types/password/index.d.ts +3 -3
- package/dist/declarations/src/fields/types/password/index.d.ts.map +1 -1
- package/dist/declarations/src/fields/types/relationship/index.d.ts +8 -8
- package/dist/declarations/src/fields/types/relationship/index.d.ts.map +1 -1
- package/dist/declarations/src/fields/types/relationship/views/ComboboxMany.d.ts +3 -3
- package/dist/declarations/src/fields/types/relationship/views/ComboboxMany.d.ts.map +1 -1
- package/dist/declarations/src/fields/types/relationship/views/ComboboxSingle.d.ts +3 -3
- package/dist/declarations/src/fields/types/relationship/views/ComboboxSingle.d.ts.map +1 -1
- package/dist/declarations/src/fields/types/relationship/views/index.d.ts +3 -3
- package/dist/declarations/src/fields/types/relationship/views/index.d.ts.map +1 -1
- package/dist/declarations/src/fields/types/relationship/views/types.d.ts +3 -3
- package/dist/declarations/src/fields/types/relationship/views/types.d.ts.map +1 -1
- package/dist/declarations/src/fields/types/select/index.d.ts +3 -3
- package/dist/declarations/src/fields/types/select/index.d.ts.map +1 -1
- package/dist/declarations/src/fields/types/text/index.d.ts +3 -3
- package/dist/declarations/src/fields/types/text/index.d.ts.map +1 -1
- package/dist/declarations/src/fields/types/timestamp/index.d.ts +3 -3
- package/dist/declarations/src/fields/types/timestamp/index.d.ts.map +1 -1
- package/dist/declarations/src/fields/types/virtual/index.d.ts +7 -7
- package/dist/declarations/src/fields/types/virtual/index.d.ts.map +1 -1
- package/dist/declarations/src/helpers.d.ts +249 -13
- package/dist/declarations/src/helpers.d.ts.map +1 -1
- package/dist/declarations/src/index.d.ts +9 -4
- package/dist/declarations/src/index.d.ts.map +1 -1
- package/dist/declarations/src/internal-unstable/admin-ui/pages/ListPage/index.d.ts.map +1 -1
- package/dist/declarations/src/lib/admin-meta.d.ts +11 -11
- package/dist/declarations/src/lib/admin-meta.d.ts.map +1 -1
- package/dist/declarations/src/lib/core/access-control.d.ts +18 -18
- package/dist/declarations/src/lib/core/access-control.d.ts.map +1 -1
- package/dist/declarations/src/lib/core/cascade.d.ts +47 -0
- package/dist/declarations/src/lib/core/cascade.d.ts.map +1 -0
- package/dist/declarations/src/lib/core/initialise-lists.d.ts +27 -24
- package/dist/declarations/src/lib/core/initialise-lists.d.ts.map +1 -1
- package/dist/declarations/src/lib/env.d.ts +9 -0
- package/dist/declarations/src/lib/env.d.ts.map +1 -0
- package/dist/declarations/src/lib/system.d.ts +1 -1
- package/dist/declarations/src/lib/system.d.ts.map +1 -1
- package/dist/declarations/src/list-features.d.ts +162 -0
- package/dist/declarations/src/list-features.d.ts.map +1 -0
- package/dist/declarations/src/schema.d.ts +24 -23
- package/dist/declarations/src/schema.d.ts.map +1 -1
- package/dist/declarations/src/session.d.ts +75 -0
- package/dist/declarations/src/session.d.ts.map +1 -1
- package/dist/declarations/src/types/admin-meta.d.ts +11 -11
- package/dist/declarations/src/types/admin-meta.d.ts.map +1 -1
- package/dist/declarations/src/types/config/access-control.d.ts +42 -42
- package/dist/declarations/src/types/config/access-control.d.ts.map +1 -1
- package/dist/declarations/src/types/config/fields.d.ts +19 -19
- package/dist/declarations/src/types/config/fields.d.ts.map +1 -1
- package/dist/declarations/src/types/config/hooks.d.ts +131 -131
- package/dist/declarations/src/types/config/hooks.d.ts.map +1 -1
- package/dist/declarations/src/types/config/index.d.ts +190 -8
- package/dist/declarations/src/types/config/index.d.ts.map +1 -1
- package/dist/declarations/src/types/config/lists.d.ts +146 -108
- package/dist/declarations/src/types/config/lists.d.ts.map +1 -1
- package/dist/declarations/src/types/context.d.ts +507 -47
- package/dist/declarations/src/types/context.d.ts.map +1 -1
- package/dist/declarations/src/types/next-fields.d.ts +28 -28
- package/dist/declarations/src/types/next-fields.d.ts.map +1 -1
- package/dist/declarations/src/types/type-info.d.ts +3 -3
- package/dist/declarations/src/types/type-info.d.ts.map +1 -1
- package/dist/{express-455ae20c.cjs.js → express-84d534c2.cjs.js} +6 -6
- package/dist/{express-7559ca2d.esm.js → express-d0a4ce99.esm.js} +6 -6
- package/dist/{index-15c8f81e.esm.js → index-5d8b0b4e.esm.js} +363 -183
- package/dist/index-6055753b.cjs.js +393 -0
- package/dist/{index-42045902.cjs.js → index-ac29f382.cjs.js} +363 -185
- package/dist/index-f1703b7b.esm.js +386 -0
- package/dist/nixxie-cms-core.cjs.js +1388 -30
- package/dist/nixxie-cms-core.esm.js +1362 -24
- package/dist/{non-null-graphql-add6bb3d.cjs.js → non-null-graphql-4a44c122.cjs.js} +1 -1
- package/dist/{non-null-graphql-a84ed64d.esm.js → non-null-graphql-8c5feaae.esm.js} +1 -1
- package/dist/{resolve-hooks-165a9ce2.cjs.js → resolve-hooks-10a5f84c.cjs.js} +240 -6
- package/dist/{resolve-hooks-6813a045.esm.js → resolve-hooks-9e676794.esm.js} +238 -7
- package/dist/{system-a321642d.cjs.js → system-6b37a5f8.cjs.js} +33 -7
- package/dist/{system-03e49e4f.esm.js → system-e591d821.esm.js} +33 -7
- package/fields/dist/nixxie-cms-core-fields.cjs.js +29 -576
- package/fields/dist/nixxie-cms-core-fields.esm.js +18 -565
- package/fields/types/bytes/dist/nixxie-cms-core-fields-types-bytes.cjs.js +4 -2
- package/fields/types/bytes/dist/nixxie-cms-core-fields-types-bytes.esm.js +4 -2
- package/fields/types/multiselect/views/dist/nixxie-cms-core-fields-types-multiselect-views.cjs.js +1 -6
- package/fields/types/multiselect/views/dist/nixxie-cms-core-fields-types-multiselect-views.esm.js +1 -6
- package/fields/types/password/dist/nixxie-cms-core-fields-types-password.cjs.js +4 -2
- package/fields/types/password/dist/nixxie-cms-core-fields-types-password.esm.js +4 -2
- package/internal-unstable/artifacts/dist/nixxie-cms-core-internal-unstable-artifacts.cjs.js +4 -3
- package/internal-unstable/artifacts/dist/nixxie-cms-core-internal-unstable-artifacts.esm.js +4 -3
- package/package.json +4 -4
- package/scripts/cli/dist/nixxie-cms-core-scripts-cli.cjs.js +4 -3
- package/scripts/cli/dist/nixxie-cms-core-scripts-cli.esm.js +4 -3
- package/scripts/dist/nixxie-cms-core-scripts.cjs.js +4 -3
- package/scripts/dist/nixxie-cms-core-scripts.esm.js +4 -3
- package/session/dist/nixxie-cms-core-session.cjs.js +286 -0
- package/session/dist/nixxie-cms-core-session.esm.js +279 -1
- package/src/access.ts +25 -25
- package/src/admin-ui/admin-meta-graphql.ts +5 -5
- package/src/admin-ui/components/CreateButtonLink.tsx +46 -46
- package/src/admin-ui/components/Navigation.tsx +3 -3
- package/src/admin-ui/context.tsx +6 -6
- package/src/admin-ui/utils/Fields.tsx +241 -241
- package/src/admin-ui/utils/actionData.ts +36 -36
- package/src/admin-ui/utils/filters.ts +148 -148
- package/src/admin-ui/utils/useCreateItem.ts +171 -171
- package/src/admin-ui/utils/utils.tsx +127 -127
- package/src/context.ts +1 -1
- package/src/fields/non-null-graphql.ts +115 -115
- package/src/fields/types/bigInt/index.ts +6 -6
- package/src/fields/types/bytes/index.ts +6 -6
- package/src/fields/types/calendarDay/index.ts +18 -19
- package/src/fields/types/checkbox/index.ts +6 -6
- package/src/fields/types/decimal/index.ts +6 -6
- package/src/fields/types/file/index.ts +8 -8
- package/src/fields/types/float/index.ts +6 -6
- package/src/fields/types/image/index.ts +8 -8
- package/src/fields/types/integer/index.ts +6 -6
- package/src/fields/types/json/index.ts +5 -5
- package/src/fields/types/multiselect/index.ts +7 -7
- package/src/fields/types/multiselect/views/index.tsx +149 -151
- package/src/fields/types/password/index.ts +6 -6
- package/src/fields/types/relationship/index.ts +13 -13
- package/src/fields/types/relationship/views/ComboboxMany.tsx +110 -110
- package/src/fields/types/relationship/views/ComboboxSingle.tsx +115 -115
- package/src/fields/types/relationship/views/ContextualActions.tsx +139 -139
- package/src/fields/types/relationship/views/index.tsx +492 -492
- package/src/fields/types/relationship/views/types.ts +46 -46
- package/src/fields/types/relationship/views/useApolloQuery.ts +185 -185
- package/src/fields/types/relationship/views/useFilter.tsx +109 -109
- package/src/fields/types/select/index.ts +6 -6
- package/src/fields/types/text/index.ts +6 -6
- package/src/fields/types/timestamp/index.ts +23 -21
- package/src/fields/types/virtual/index.ts +11 -11
- package/src/helpers.ts +773 -42
- package/src/index.ts +66 -24
- package/src/internal-unstable/admin-ui/pages/ItemPage/common.tsx +4 -4
- package/src/internal-unstable/admin-ui/pages/ItemPage/index.tsx +5 -5
- package/src/internal-unstable/admin-ui/pages/ListPage/index.tsx +8 -8
- package/src/lib/admin-meta.ts +369 -369
- package/src/lib/context/createContext.ts +6 -0
- package/src/lib/core/access-control.ts +434 -434
- package/src/lib/core/cascade.ts +236 -0
- package/src/lib/core/initialise-lists.ts +49 -33
- package/src/lib/core/mutations/index.ts +7 -0
- package/src/lib/core/mutations/nested-mutation-many-input-resolvers.ts +145 -145
- package/src/lib/core/mutations/nested-mutation-one-input-resolvers.ts +71 -71
- package/src/lib/core/queries/output-field.ts +178 -178
- package/src/lib/env.ts +50 -0
- package/src/lib/id-field.ts +2 -2
- package/src/lib/system.ts +221 -207
- package/src/lib/typescript-schema-printer.ts +227 -227
- package/src/list-features.ts +476 -0
- package/src/schema.ts +92 -22
- package/src/session.ts +225 -0
- package/src/types/admin-meta.ts +218 -218
- package/src/types/config/access-control.ts +186 -186
- package/src/types/config/fields.ts +96 -96
- package/src/types/config/hooks.ts +529 -529
- package/src/types/config/index.ts +206 -7
- package/src/types/config/lists.ts +606 -565
- package/src/types/context.ts +592 -55
- package/src/types/next-fields.ts +31 -31
- package/src/types/type-info.ts +38 -38
- package/src/types/type-tests.ts +21 -21
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { u as userInputError, m as merge } from '../../dist/resolve-hooks-
|
|
1
|
+
import { u as userInputError, m as merge } from '../../dist/resolve-hooks-9e676794.esm.js';
|
|
2
2
|
import 'pluralize';
|
|
3
3
|
import { f as fieldType, g, o as orderDirectionEnum } from '../../dist/next-fields-9bf04ed8.esm.js';
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
import { randomBytes } from 'node:crypto';
|
|
5
|
+
import { f as filters, r as resolveCommon } from '../../dist/index-f1703b7b.esm.js';
|
|
6
|
+
export { j as json, a as text, t as timestamp } from '../../dist/index-f1703b7b.esm.js';
|
|
7
|
+
import { a as assertReadIsNonNullAllowed, m as makeValidateHook, d as defaultIsRequired, r as resolveDbNullable } from '../../dist/non-null-graphql-8c5feaae.esm.js';
|
|
7
8
|
import 'node:path';
|
|
8
9
|
import { GNonNull } from '@graphql-ts/schema';
|
|
9
10
|
import '@graphql-ts/extend';
|
|
10
11
|
import Decimal from 'decimal.js';
|
|
11
|
-
|
|
12
|
+
export { i as integer, r as relationship, s as select } from '../../dist/index-5d8b0b4e.esm.js';
|
|
12
13
|
import { SUPPORTED_IMAGE_EXTENSIONS } from '../types/image/utils/dist/nixxie-cms-core-fields-types-image-utils.esm.js';
|
|
13
14
|
import { JPG } from 'image-size/types/jpg';
|
|
14
15
|
import { PNG } from 'image-size/types/png';
|
|
@@ -16,9 +17,10 @@ import { WEBP } from 'image-size/types/webp';
|
|
|
16
17
|
import { GIF } from 'image-size/types/gif';
|
|
17
18
|
import { PassThrough } from 'node:stream';
|
|
18
19
|
export { password } from '../types/password/dist/nixxie-cms-core-fields-types-password.esm.js';
|
|
19
|
-
import { h as humanize } from '../../dist/utils-0cc426c8.esm.js';
|
|
20
20
|
import { getNamedType, isLeafType } from 'graphql';
|
|
21
|
+
import { h as humanize } from '../../dist/utils-0cc426c8.esm.js';
|
|
21
22
|
export { bytes } from '../types/bytes/dist/nixxie-cms-core-fields-types-bytes.esm.js';
|
|
23
|
+
import 'node:async_hooks';
|
|
22
24
|
import 'graphql-upload/GraphQLUpload.js';
|
|
23
25
|
import '../../dist/admin-meta-14c60fec.esm.js';
|
|
24
26
|
import 'bcryptjs';
|
|
@@ -496,139 +498,9 @@ function float(config = {}) {
|
|
|
496
498
|
};
|
|
497
499
|
}
|
|
498
500
|
|
|
499
|
-
// for a signed 32-bit integer
|
|
500
|
-
const MAX_INT$3 = 0x7fffffff;
|
|
501
|
-
const MIN_INT$3 = -0x80000000;
|
|
502
|
-
function integer(config = {}) {
|
|
503
|
-
var _defaultValue_$kind;
|
|
504
|
-
const {
|
|
505
|
-
defaultValue: defaultValue_,
|
|
506
|
-
isIndexed,
|
|
507
|
-
validation = {}
|
|
508
|
-
} = config;
|
|
509
|
-
const {
|
|
510
|
-
isRequired = false,
|
|
511
|
-
min,
|
|
512
|
-
max
|
|
513
|
-
} = validation;
|
|
514
|
-
const defaultValue = typeof defaultValue_ === 'number' ? defaultValue_ : (_defaultValue_$kind = defaultValue_ === null || defaultValue_ === void 0 ? void 0 : defaultValue_.kind) !== null && _defaultValue_$kind !== void 0 ? _defaultValue_$kind : null;
|
|
515
|
-
return meta => {
|
|
516
|
-
var _config$db, _config$db2;
|
|
517
|
-
if (typeof defaultValue === 'number' && !Number.isInteger(defaultValue)) {
|
|
518
|
-
throw new Error(`${meta.listKey}.${meta.fieldKey} specifies a default value of: ${defaultValue} but it must be a valid finite number`);
|
|
519
|
-
}
|
|
520
|
-
if (min !== undefined && !Number.isInteger(min)) {
|
|
521
|
-
throw new Error(`${meta.listKey}.${meta.fieldKey} specifies validation.min: ${min} but it must be an integer`);
|
|
522
|
-
}
|
|
523
|
-
if (max !== undefined && !Number.isInteger(max)) {
|
|
524
|
-
throw new Error(`${meta.listKey}.${meta.fieldKey} specifies validation.max: ${max} but it must be an integer`);
|
|
525
|
-
}
|
|
526
|
-
if (min !== undefined && (min > MAX_INT$3 || min < MIN_INT$3)) {
|
|
527
|
-
throw new Error(`${meta.listKey}.${meta.fieldKey} specifies validation.min: ${min} which is outside of the range of a 32-bit signed integer`);
|
|
528
|
-
}
|
|
529
|
-
if (max !== undefined && (max > MAX_INT$3 || max < MIN_INT$3)) {
|
|
530
|
-
throw new Error(`${meta.listKey}.${meta.fieldKey} specifies validation.max: ${max} which is outside of the range of a 32-bit signed integer`);
|
|
531
|
-
}
|
|
532
|
-
if (min !== undefined && max !== undefined && min > max) {
|
|
533
|
-
throw new Error(`${meta.listKey}.${meta.fieldKey} specifies a validation.max that is less than the validation.min, and therefore has no valid options`);
|
|
534
|
-
}
|
|
535
|
-
const hasAdditionalValidation = min !== undefined || max !== undefined;
|
|
536
|
-
const {
|
|
537
|
-
mode,
|
|
538
|
-
validate
|
|
539
|
-
} = makeValidateHook(meta, config, hasAdditionalValidation ? ({
|
|
540
|
-
resolvedData,
|
|
541
|
-
operation,
|
|
542
|
-
addValidationError
|
|
543
|
-
}) => {
|
|
544
|
-
if (operation === 'delete') return;
|
|
545
|
-
const value = resolvedData[meta.fieldKey];
|
|
546
|
-
if (typeof value === 'number') {
|
|
547
|
-
if (min !== undefined && value < min) {
|
|
548
|
-
addValidationError(`value must be greater than or equal to ${min}`);
|
|
549
|
-
}
|
|
550
|
-
if (max !== undefined && value > max) {
|
|
551
|
-
addValidationError(`value must be less than or equal to ${max}`);
|
|
552
|
-
}
|
|
553
|
-
}
|
|
554
|
-
} : undefined, defaultValue !== null);
|
|
555
|
-
return fieldType({
|
|
556
|
-
kind: 'scalar',
|
|
557
|
-
mode,
|
|
558
|
-
scalar: 'Int',
|
|
559
|
-
index: isIndexed === true ? 'index' : isIndexed || undefined,
|
|
560
|
-
default: typeof defaultValue === 'number' ? {
|
|
561
|
-
kind: 'literal',
|
|
562
|
-
value: defaultValue
|
|
563
|
-
} : defaultValue === 'autoincrement' ? {
|
|
564
|
-
kind: 'autoincrement'
|
|
565
|
-
} : undefined,
|
|
566
|
-
map: (_config$db = config.db) === null || _config$db === void 0 ? void 0 : _config$db.map,
|
|
567
|
-
extendPrismaSchema: (_config$db2 = config.db) === null || _config$db2 === void 0 ? void 0 : _config$db2.extendPrismaSchema
|
|
568
|
-
})({
|
|
569
|
-
...config,
|
|
570
|
-
...defaultIsRequired(config, isRequired),
|
|
571
|
-
hooks: {
|
|
572
|
-
...config.hooks,
|
|
573
|
-
validate
|
|
574
|
-
},
|
|
575
|
-
input: {
|
|
576
|
-
uniqueWhere: isIndexed === 'unique' ? {
|
|
577
|
-
arg: g.arg({
|
|
578
|
-
type: g.Int
|
|
579
|
-
})
|
|
580
|
-
} : undefined,
|
|
581
|
-
where: {
|
|
582
|
-
arg: g.arg({
|
|
583
|
-
type: filters[meta.provider].Int[mode]
|
|
584
|
-
}),
|
|
585
|
-
resolve: mode === 'optional' ? resolveCommon : undefined
|
|
586
|
-
},
|
|
587
|
-
create: {
|
|
588
|
-
arg: g.arg({
|
|
589
|
-
type: g.Int,
|
|
590
|
-
defaultValue: typeof defaultValue === 'number' ? defaultValue : undefined
|
|
591
|
-
}),
|
|
592
|
-
resolve(value) {
|
|
593
|
-
if (value === undefined) {
|
|
594
|
-
if (defaultValue === 'autoincrement') return undefined;
|
|
595
|
-
return defaultValue;
|
|
596
|
-
}
|
|
597
|
-
return value;
|
|
598
|
-
}
|
|
599
|
-
},
|
|
600
|
-
update: {
|
|
601
|
-
arg: g.arg({
|
|
602
|
-
type: g.Int
|
|
603
|
-
})
|
|
604
|
-
},
|
|
605
|
-
orderBy: {
|
|
606
|
-
arg: g.arg({
|
|
607
|
-
type: orderDirectionEnum
|
|
608
|
-
})
|
|
609
|
-
}
|
|
610
|
-
},
|
|
611
|
-
output: g.field({
|
|
612
|
-
type: g.Int
|
|
613
|
-
}),
|
|
614
|
-
__nxTelemetryFieldTypeName: '@nixxie-cms/integer',
|
|
615
|
-
views: '@nixxie-cms/core/fields/types/integer/views',
|
|
616
|
-
getAdminMeta() {
|
|
617
|
-
return {
|
|
618
|
-
validation: {
|
|
619
|
-
min: min !== null && min !== void 0 ? min : MIN_INT$3,
|
|
620
|
-
max: max !== null && max !== void 0 ? max : MAX_INT$3
|
|
621
|
-
},
|
|
622
|
-
defaultValue
|
|
623
|
-
};
|
|
624
|
-
}
|
|
625
|
-
});
|
|
626
|
-
};
|
|
627
|
-
}
|
|
628
|
-
|
|
629
501
|
// for a signed 64-bit integer
|
|
630
|
-
const MAX_INT$
|
|
631
|
-
const MIN_INT$
|
|
502
|
+
const MAX_INT$1 = 9223372036854775807n;
|
|
503
|
+
const MIN_INT$1 = -9223372036854775808n;
|
|
632
504
|
|
|
633
505
|
// TODO: https://github.com/Nixxie/keystatic/blob/main/design-system/pkg/src/number-field/NumberField.tsx
|
|
634
506
|
function bigInt(config = {}) {
|
|
@@ -669,10 +541,10 @@ function bigInt(config = {}) {
|
|
|
669
541
|
if (max !== undefined && !Number.isInteger(max)) {
|
|
670
542
|
throw new Error(`${meta.listKey}.${meta.fieldKey} specifies validation.max: ${max} but it must be an integer`);
|
|
671
543
|
}
|
|
672
|
-
if (min !== undefined && (min > MAX_INT$
|
|
544
|
+
if (min !== undefined && (min > MAX_INT$1 || min < MIN_INT$1)) {
|
|
673
545
|
throw new Error(`${meta.listKey}.${meta.fieldKey} specifies validation.min: ${min} which is outside of the range of a 64-bit signed integer`);
|
|
674
546
|
}
|
|
675
|
-
if (max !== undefined && (max > MAX_INT$
|
|
547
|
+
if (max !== undefined && (max > MAX_INT$1 || max < MIN_INT$1)) {
|
|
676
548
|
throw new Error(`${meta.listKey}.${meta.fieldKey} specifies validation.max: ${max} which is outside of the range of a 64-bit signed integer`);
|
|
677
549
|
}
|
|
678
550
|
if (min !== undefined && max !== undefined && min > max) {
|
|
@@ -763,8 +635,8 @@ function bigInt(config = {}) {
|
|
|
763
635
|
var _min$toString, _max$toString;
|
|
764
636
|
return {
|
|
765
637
|
validation: {
|
|
766
|
-
min: (_min$toString = min === null || min === void 0 ? void 0 : min.toString()) !== null && _min$toString !== void 0 ? _min$toString : `${MIN_INT$
|
|
767
|
-
max: (_max$toString = max === null || max === void 0 ? void 0 : max.toString()) !== null && _max$toString !== void 0 ? _max$toString : `${MAX_INT$
|
|
638
|
+
min: (_min$toString = min === null || min === void 0 ? void 0 : min.toString()) !== null && _min$toString !== void 0 ? _min$toString : `${MIN_INT$1}`,
|
|
639
|
+
max: (_max$toString = max === null || max === void 0 ? void 0 : max.toString()) !== null && _max$toString !== void 0 ? _max$toString : `${MAX_INT$1}`
|
|
768
640
|
},
|
|
769
641
|
defaultValue: typeof defaultValue === 'bigint' ? defaultValue.toString() : defaultValue
|
|
770
642
|
};
|
|
@@ -1015,427 +887,6 @@ function defaultTransformName(_) {
|
|
|
1015
887
|
return randomBytes(16).toString('base64url');
|
|
1016
888
|
}
|
|
1017
889
|
|
|
1018
|
-
function json({
|
|
1019
|
-
defaultValue = null,
|
|
1020
|
-
...config
|
|
1021
|
-
} = {}) {
|
|
1022
|
-
return meta => {
|
|
1023
|
-
var _config$db, _config$db2;
|
|
1024
|
-
if (config.isIndexed === 'unique') {
|
|
1025
|
-
throw Error("isIndexed: 'unique' is not a supported option for field type json");
|
|
1026
|
-
}
|
|
1027
|
-
return fieldType({
|
|
1028
|
-
kind: 'scalar',
|
|
1029
|
-
mode: 'optional',
|
|
1030
|
-
scalar: 'Json',
|
|
1031
|
-
default: defaultValue === null ? undefined : meta.provider === 'sqlite' ? undefined : {
|
|
1032
|
-
kind: 'literal',
|
|
1033
|
-
// TODO: waiting on https://github.com/prisma/prisma/issues/26571
|
|
1034
|
-
// input.create manages defaultValues anyway
|
|
1035
|
-
value: JSON.stringify(defaultValue !== null && defaultValue !== void 0 ? defaultValue : null)
|
|
1036
|
-
},
|
|
1037
|
-
map: (_config$db = config.db) === null || _config$db === void 0 ? void 0 : _config$db.map,
|
|
1038
|
-
extendPrismaSchema: (_config$db2 = config.db) === null || _config$db2 === void 0 ? void 0 : _config$db2.extendPrismaSchema
|
|
1039
|
-
})({
|
|
1040
|
-
...config,
|
|
1041
|
-
__nxTelemetryFieldTypeName: '@nixxie-cms/json',
|
|
1042
|
-
input: {
|
|
1043
|
-
create: {
|
|
1044
|
-
arg: g.arg({
|
|
1045
|
-
type: g.JSON
|
|
1046
|
-
}),
|
|
1047
|
-
resolve(val) {
|
|
1048
|
-
// TODO: redundant when https://github.com/prisma/prisma/issues/26571 is resolved
|
|
1049
|
-
return val === undefined ? defaultValue : val;
|
|
1050
|
-
}
|
|
1051
|
-
},
|
|
1052
|
-
update: {
|
|
1053
|
-
arg: g.arg({
|
|
1054
|
-
type: g.JSON
|
|
1055
|
-
})
|
|
1056
|
-
}
|
|
1057
|
-
},
|
|
1058
|
-
output: g.field({
|
|
1059
|
-
type: g.JSON
|
|
1060
|
-
}),
|
|
1061
|
-
views: '@nixxie-cms/core/fields/types/json/views',
|
|
1062
|
-
getAdminMeta: () => ({
|
|
1063
|
-
defaultValue
|
|
1064
|
-
})
|
|
1065
|
-
});
|
|
1066
|
-
};
|
|
1067
|
-
}
|
|
1068
|
-
|
|
1069
|
-
// these are the lowest and highest values for a signed 32-bit integer
|
|
1070
|
-
const MAX_INT$1 = 2147483647;
|
|
1071
|
-
const MIN_INT$1 = -2147483648;
|
|
1072
|
-
function select(config) {
|
|
1073
|
-
const {
|
|
1074
|
-
isIndexed,
|
|
1075
|
-
ui: {
|
|
1076
|
-
displayMode = 'select',
|
|
1077
|
-
...ui
|
|
1078
|
-
} = {},
|
|
1079
|
-
defaultValue,
|
|
1080
|
-
validation
|
|
1081
|
-
} = config;
|
|
1082
|
-
return meta => {
|
|
1083
|
-
var _validation$isRequire, _config$db, _config$db2;
|
|
1084
|
-
const options = config.options.map(option => {
|
|
1085
|
-
if (typeof option === 'string') {
|
|
1086
|
-
return {
|
|
1087
|
-
label: humanize(option),
|
|
1088
|
-
value: option
|
|
1089
|
-
};
|
|
1090
|
-
}
|
|
1091
|
-
return option;
|
|
1092
|
-
});
|
|
1093
|
-
const accepted = new Set(options.map(x => x.value));
|
|
1094
|
-
if (accepted.size !== options.length) {
|
|
1095
|
-
throw new Error(`${meta.listKey}.${meta.fieldKey}: duplicate options, this is not allowed`);
|
|
1096
|
-
}
|
|
1097
|
-
const {
|
|
1098
|
-
mode,
|
|
1099
|
-
validate
|
|
1100
|
-
} = makeValidateHook(meta, config, ({
|
|
1101
|
-
resolvedData,
|
|
1102
|
-
operation,
|
|
1103
|
-
addValidationError
|
|
1104
|
-
}) => {
|
|
1105
|
-
if (operation === 'delete') return;
|
|
1106
|
-
const value = resolvedData[meta.fieldKey];
|
|
1107
|
-
if (value != null && !accepted.has(value)) {
|
|
1108
|
-
addValidationError(`value is not an accepted option`);
|
|
1109
|
-
}
|
|
1110
|
-
});
|
|
1111
|
-
const commonConfig = {
|
|
1112
|
-
...config,
|
|
1113
|
-
mode,
|
|
1114
|
-
...defaultIsRequired({
|
|
1115
|
-
ui
|
|
1116
|
-
}, (_validation$isRequire = validation === null || validation === void 0 ? void 0 : validation.isRequired) !== null && _validation$isRequire !== void 0 ? _validation$isRequire : false),
|
|
1117
|
-
hooks: {
|
|
1118
|
-
...config.hooks,
|
|
1119
|
-
validate
|
|
1120
|
-
},
|
|
1121
|
-
__nxTelemetryFieldTypeName: '@nixxie-cms/select',
|
|
1122
|
-
views: '@nixxie-cms/core/fields/types/select/views',
|
|
1123
|
-
getAdminMeta: () => {
|
|
1124
|
-
var _config$type;
|
|
1125
|
-
return {
|
|
1126
|
-
options,
|
|
1127
|
-
type: (_config$type = config.type) !== null && _config$type !== void 0 ? _config$type : 'string',
|
|
1128
|
-
displayMode: displayMode,
|
|
1129
|
-
defaultValue: defaultValue !== null && defaultValue !== void 0 ? defaultValue : null
|
|
1130
|
-
};
|
|
1131
|
-
}
|
|
1132
|
-
};
|
|
1133
|
-
const commonDbFieldConfig = {
|
|
1134
|
-
mode,
|
|
1135
|
-
index: isIndexed === true ? 'index' : isIndexed || undefined,
|
|
1136
|
-
default: defaultValue === undefined ? undefined : {
|
|
1137
|
-
kind: 'literal',
|
|
1138
|
-
value: defaultValue
|
|
1139
|
-
},
|
|
1140
|
-
map: (_config$db = config.db) === null || _config$db === void 0 ? void 0 : _config$db.map,
|
|
1141
|
-
extendPrismaSchema: (_config$db2 = config.db) === null || _config$db2 === void 0 ? void 0 : _config$db2.extendPrismaSchema
|
|
1142
|
-
};
|
|
1143
|
-
const resolveCreate = val => {
|
|
1144
|
-
if (val === undefined) {
|
|
1145
|
-
var _ref;
|
|
1146
|
-
return (_ref = defaultValue) !== null && _ref !== void 0 ? _ref : null;
|
|
1147
|
-
}
|
|
1148
|
-
return val;
|
|
1149
|
-
};
|
|
1150
|
-
if (config.type === 'integer') {
|
|
1151
|
-
if (config.options.some(({
|
|
1152
|
-
value
|
|
1153
|
-
}) => !Number.isInteger(value) || value > MAX_INT$1 || value < MIN_INT$1)) {
|
|
1154
|
-
throw new Error(`${meta.listKey}.${meta.fieldKey} specifies integer values that are outside the range of a 32-bit signed integer`);
|
|
1155
|
-
}
|
|
1156
|
-
return fieldType({
|
|
1157
|
-
kind: 'scalar',
|
|
1158
|
-
scalar: 'Int',
|
|
1159
|
-
...commonDbFieldConfig
|
|
1160
|
-
})({
|
|
1161
|
-
...commonConfig,
|
|
1162
|
-
input: {
|
|
1163
|
-
uniqueWhere: isIndexed === 'unique' ? {
|
|
1164
|
-
arg: g.arg({
|
|
1165
|
-
type: g.Int
|
|
1166
|
-
})
|
|
1167
|
-
} : undefined,
|
|
1168
|
-
where: {
|
|
1169
|
-
arg: g.arg({
|
|
1170
|
-
type: filters[meta.provider].Int[mode]
|
|
1171
|
-
}),
|
|
1172
|
-
resolve: mode === 'required' ? undefined : resolveCommon
|
|
1173
|
-
},
|
|
1174
|
-
create: {
|
|
1175
|
-
arg: g.arg({
|
|
1176
|
-
type: g.Int,
|
|
1177
|
-
defaultValue: typeof defaultValue === 'number' ? defaultValue : undefined
|
|
1178
|
-
}),
|
|
1179
|
-
resolve: resolveCreate
|
|
1180
|
-
},
|
|
1181
|
-
update: {
|
|
1182
|
-
arg: g.arg({
|
|
1183
|
-
type: g.Int
|
|
1184
|
-
})
|
|
1185
|
-
},
|
|
1186
|
-
orderBy: {
|
|
1187
|
-
arg: g.arg({
|
|
1188
|
-
type: orderDirectionEnum
|
|
1189
|
-
})
|
|
1190
|
-
}
|
|
1191
|
-
},
|
|
1192
|
-
output: g.field({
|
|
1193
|
-
type: g.Int
|
|
1194
|
-
})
|
|
1195
|
-
});
|
|
1196
|
-
}
|
|
1197
|
-
if (config.type === 'enum') {
|
|
1198
|
-
const enumName = `${meta.listKey}${humanize(meta.fieldKey).replace(/ /g, '')}Type`;
|
|
1199
|
-
const enumValues = options.map(x => `${x.value}`);
|
|
1200
|
-
const graphQLType = g.enum({
|
|
1201
|
-
name: enumName,
|
|
1202
|
-
values: g.enumValues(enumValues)
|
|
1203
|
-
});
|
|
1204
|
-
return fieldType(meta.provider === 'sqlite' ? {
|
|
1205
|
-
kind: 'scalar',
|
|
1206
|
-
scalar: 'String',
|
|
1207
|
-
...commonDbFieldConfig
|
|
1208
|
-
} : {
|
|
1209
|
-
kind: 'enum',
|
|
1210
|
-
values: enumValues,
|
|
1211
|
-
name: enumName,
|
|
1212
|
-
...commonDbFieldConfig
|
|
1213
|
-
})({
|
|
1214
|
-
...commonConfig,
|
|
1215
|
-
input: {
|
|
1216
|
-
uniqueWhere: isIndexed === 'unique' ? {
|
|
1217
|
-
arg: g.arg({
|
|
1218
|
-
type: graphQLType
|
|
1219
|
-
})
|
|
1220
|
-
} : undefined,
|
|
1221
|
-
where: {
|
|
1222
|
-
arg: g.arg({
|
|
1223
|
-
type: filters[meta.provider].enum(graphQLType).optional
|
|
1224
|
-
}),
|
|
1225
|
-
resolve: mode === 'required' ? undefined : resolveCommon
|
|
1226
|
-
},
|
|
1227
|
-
create: {
|
|
1228
|
-
arg: g.arg({
|
|
1229
|
-
type: graphQLType,
|
|
1230
|
-
defaultValue: typeof defaultValue === 'string' ? defaultValue : undefined
|
|
1231
|
-
}),
|
|
1232
|
-
resolve: resolveCreate
|
|
1233
|
-
},
|
|
1234
|
-
update: {
|
|
1235
|
-
arg: g.arg({
|
|
1236
|
-
type: graphQLType
|
|
1237
|
-
})
|
|
1238
|
-
},
|
|
1239
|
-
orderBy: {
|
|
1240
|
-
arg: g.arg({
|
|
1241
|
-
type: orderDirectionEnum
|
|
1242
|
-
})
|
|
1243
|
-
}
|
|
1244
|
-
},
|
|
1245
|
-
output: g.field({
|
|
1246
|
-
type: graphQLType
|
|
1247
|
-
})
|
|
1248
|
-
});
|
|
1249
|
-
}
|
|
1250
|
-
return fieldType({
|
|
1251
|
-
kind: 'scalar',
|
|
1252
|
-
scalar: 'String',
|
|
1253
|
-
...commonDbFieldConfig
|
|
1254
|
-
})({
|
|
1255
|
-
...commonConfig,
|
|
1256
|
-
input: {
|
|
1257
|
-
uniqueWhere: isIndexed === 'unique' ? {
|
|
1258
|
-
arg: g.arg({
|
|
1259
|
-
type: g.String
|
|
1260
|
-
})
|
|
1261
|
-
} : undefined,
|
|
1262
|
-
where: {
|
|
1263
|
-
arg: g.arg({
|
|
1264
|
-
type: filters[meta.provider].String[mode]
|
|
1265
|
-
}),
|
|
1266
|
-
resolve: mode === 'required' ? undefined : resolveString
|
|
1267
|
-
},
|
|
1268
|
-
create: {
|
|
1269
|
-
arg: g.arg({
|
|
1270
|
-
type: g.String,
|
|
1271
|
-
defaultValue: typeof defaultValue === 'string' ? defaultValue : undefined
|
|
1272
|
-
}),
|
|
1273
|
-
resolve: resolveCreate
|
|
1274
|
-
},
|
|
1275
|
-
update: {
|
|
1276
|
-
arg: g.arg({
|
|
1277
|
-
type: g.String
|
|
1278
|
-
})
|
|
1279
|
-
},
|
|
1280
|
-
orderBy: {
|
|
1281
|
-
arg: g.arg({
|
|
1282
|
-
type: orderDirectionEnum
|
|
1283
|
-
})
|
|
1284
|
-
}
|
|
1285
|
-
},
|
|
1286
|
-
output: g.field({
|
|
1287
|
-
type: g.String
|
|
1288
|
-
})
|
|
1289
|
-
});
|
|
1290
|
-
};
|
|
1291
|
-
}
|
|
1292
|
-
|
|
1293
|
-
function text(config = {}) {
|
|
1294
|
-
var _config$db, _config$db2, _config$db2$isNullabl, _validation$isRequire, _validation$length$mi, _validation$length, _validation$length2, _validation$length3;
|
|
1295
|
-
const {
|
|
1296
|
-
defaultValue: defaultValue_,
|
|
1297
|
-
isIndexed,
|
|
1298
|
-
validation = {}
|
|
1299
|
-
} = config;
|
|
1300
|
-
(_config$db = config.db) !== null && _config$db !== void 0 ? _config$db : config.db = {};
|
|
1301
|
-
(_config$db2$isNullabl = (_config$db2 = config.db).isNullable) !== null && _config$db2$isNullabl !== void 0 ? _config$db2$isNullabl : _config$db2.isNullable = false; // TODO: sigh, remove in breaking change?
|
|
1302
|
-
|
|
1303
|
-
const isRequired = (_validation$isRequire = validation.isRequired) !== null && _validation$isRequire !== void 0 ? _validation$isRequire : false;
|
|
1304
|
-
const match = validation.match;
|
|
1305
|
-
const min = validation.isRequired ? (_validation$length$mi = (_validation$length = validation.length) === null || _validation$length === void 0 ? void 0 : _validation$length.min) !== null && _validation$length$mi !== void 0 ? _validation$length$mi : 1 : (_validation$length2 = validation.length) === null || _validation$length2 === void 0 ? void 0 : _validation$length2.min;
|
|
1306
|
-
const max = (_validation$length3 = validation.length) === null || _validation$length3 === void 0 ? void 0 : _validation$length3.max;
|
|
1307
|
-
return meta => {
|
|
1308
|
-
var _config$db$isNullable, _config$db3, _config$db4, _config$db5, _config$db6;
|
|
1309
|
-
if (min !== undefined && (!Number.isInteger(min) || min < 0)) {
|
|
1310
|
-
throw new Error(`${meta.listKey}.${meta.fieldKey} specifies validation.length.min: ${min} but it must be a positive integer`);
|
|
1311
|
-
}
|
|
1312
|
-
if (max !== undefined && (!Number.isInteger(max) || max < 0)) {
|
|
1313
|
-
throw new Error(`${meta.listKey}.${meta.fieldKey} specifies validation.length.max: ${max} but it must be a positive integer`);
|
|
1314
|
-
}
|
|
1315
|
-
if (isRequired && min !== undefined && min === 0) {
|
|
1316
|
-
throw new Error(`${meta.listKey}.${meta.fieldKey} specifies validation.isRequired: true and validation.length.min: 0, this is not allowed because validation.isRequired implies at least a min length of 1`);
|
|
1317
|
-
}
|
|
1318
|
-
if (isRequired && max !== undefined && max === 0) {
|
|
1319
|
-
throw new Error(`${meta.listKey}.${meta.fieldKey} specifies validation.isRequired: true and validation.length.max: 0, this is not allowed because validation.isRequired implies at least a max length of 1`);
|
|
1320
|
-
}
|
|
1321
|
-
if (min !== undefined && max !== undefined && min > max) {
|
|
1322
|
-
throw new Error(`${meta.listKey}.${meta.fieldKey} specifies a validation.length.max that is less than the validation.length.min, and therefore has no valid options`);
|
|
1323
|
-
}
|
|
1324
|
-
|
|
1325
|
-
// defaulted to false as a zero length string is preferred to null
|
|
1326
|
-
const isNullable = (_config$db$isNullable = (_config$db3 = config.db) === null || _config$db3 === void 0 ? void 0 : _config$db3.isNullable) !== null && _config$db$isNullable !== void 0 ? _config$db$isNullable : false;
|
|
1327
|
-
const defaultValue = isNullable ? defaultValue_ !== null && defaultValue_ !== void 0 ? defaultValue_ : null : defaultValue_ !== null && defaultValue_ !== void 0 ? defaultValue_ : '';
|
|
1328
|
-
const hasAdditionalValidation = match || min !== undefined || max !== undefined;
|
|
1329
|
-
const {
|
|
1330
|
-
mode,
|
|
1331
|
-
validate
|
|
1332
|
-
} = makeValidateHook(meta, config, hasAdditionalValidation ? ({
|
|
1333
|
-
resolvedData,
|
|
1334
|
-
operation,
|
|
1335
|
-
addValidationError
|
|
1336
|
-
}) => {
|
|
1337
|
-
if (operation === 'delete') return;
|
|
1338
|
-
const value = resolvedData[meta.fieldKey];
|
|
1339
|
-
if (value != null) {
|
|
1340
|
-
if (min !== undefined && value.length < min) {
|
|
1341
|
-
if (min === 1) {
|
|
1342
|
-
addValidationError(`value must not be empty`);
|
|
1343
|
-
} else {
|
|
1344
|
-
addValidationError(`value must be at least ${min} characters long`);
|
|
1345
|
-
}
|
|
1346
|
-
}
|
|
1347
|
-
if (max !== undefined && value.length > max) {
|
|
1348
|
-
addValidationError(`value must be no longer than ${max} characters`);
|
|
1349
|
-
}
|
|
1350
|
-
if (match && !match.regex.test(value)) {
|
|
1351
|
-
var _match$explanation;
|
|
1352
|
-
addValidationError((_match$explanation = match.explanation) !== null && _match$explanation !== void 0 ? _match$explanation : `value must match ${match.regex}`);
|
|
1353
|
-
}
|
|
1354
|
-
}
|
|
1355
|
-
} : undefined);
|
|
1356
|
-
return fieldType({
|
|
1357
|
-
kind: 'scalar',
|
|
1358
|
-
mode,
|
|
1359
|
-
scalar: 'String',
|
|
1360
|
-
default: defaultValue === null ? undefined : {
|
|
1361
|
-
kind: 'literal',
|
|
1362
|
-
value: defaultValue
|
|
1363
|
-
},
|
|
1364
|
-
index: isIndexed === true ? 'index' : isIndexed || undefined,
|
|
1365
|
-
map: (_config$db4 = config.db) === null || _config$db4 === void 0 ? void 0 : _config$db4.map,
|
|
1366
|
-
nativeType: (_config$db5 = config.db) === null || _config$db5 === void 0 ? void 0 : _config$db5.nativeType,
|
|
1367
|
-
extendPrismaSchema: (_config$db6 = config.db) === null || _config$db6 === void 0 ? void 0 : _config$db6.extendPrismaSchema
|
|
1368
|
-
})({
|
|
1369
|
-
...config,
|
|
1370
|
-
...defaultIsRequired(config, isRequired),
|
|
1371
|
-
hooks: {
|
|
1372
|
-
...config.hooks,
|
|
1373
|
-
validate
|
|
1374
|
-
},
|
|
1375
|
-
input: {
|
|
1376
|
-
uniqueWhere: isIndexed === 'unique' ? {
|
|
1377
|
-
arg: g.arg({
|
|
1378
|
-
type: g.String
|
|
1379
|
-
})
|
|
1380
|
-
} : undefined,
|
|
1381
|
-
where: {
|
|
1382
|
-
arg: g.arg({
|
|
1383
|
-
type: filters[meta.provider].String[mode]
|
|
1384
|
-
}),
|
|
1385
|
-
resolve: mode === 'required' ? undefined : resolveString
|
|
1386
|
-
},
|
|
1387
|
-
create: {
|
|
1388
|
-
arg: g.arg({
|
|
1389
|
-
type: g.String,
|
|
1390
|
-
defaultValue: typeof defaultValue === 'string' ? defaultValue : undefined
|
|
1391
|
-
}),
|
|
1392
|
-
resolve(val) {
|
|
1393
|
-
if (val !== undefined) return val;
|
|
1394
|
-
return defaultValue !== null && defaultValue !== void 0 ? defaultValue : null;
|
|
1395
|
-
}
|
|
1396
|
-
},
|
|
1397
|
-
update: {
|
|
1398
|
-
arg: g.arg({
|
|
1399
|
-
type: g.String
|
|
1400
|
-
})
|
|
1401
|
-
},
|
|
1402
|
-
orderBy: {
|
|
1403
|
-
arg: g.arg({
|
|
1404
|
-
type: orderDirectionEnum
|
|
1405
|
-
})
|
|
1406
|
-
}
|
|
1407
|
-
},
|
|
1408
|
-
output: g.field({
|
|
1409
|
-
type: g.String
|
|
1410
|
-
}),
|
|
1411
|
-
__nxTelemetryFieldTypeName: '@nixxie-cms/text',
|
|
1412
|
-
views: '@nixxie-cms/core/fields/types/text/views',
|
|
1413
|
-
getAdminMeta() {
|
|
1414
|
-
var _config$ui$displayMod, _config$ui, _match$explanation2;
|
|
1415
|
-
return {
|
|
1416
|
-
displayMode: (_config$ui$displayMod = (_config$ui = config.ui) === null || _config$ui === void 0 ? void 0 : _config$ui.displayMode) !== null && _config$ui$displayMod !== void 0 ? _config$ui$displayMod : 'input',
|
|
1417
|
-
shouldUseModeInsensitive: meta.provider === 'postgresql',
|
|
1418
|
-
validation: {
|
|
1419
|
-
match: match ? {
|
|
1420
|
-
regex: {
|
|
1421
|
-
source: match.regex.source,
|
|
1422
|
-
flags: match.regex.flags
|
|
1423
|
-
},
|
|
1424
|
-
explanation: (_match$explanation2 = match.explanation) !== null && _match$explanation2 !== void 0 ? _match$explanation2 : `value must match ${match.regex}`
|
|
1425
|
-
} : null,
|
|
1426
|
-
length: {
|
|
1427
|
-
max: max !== null && max !== void 0 ? max : null,
|
|
1428
|
-
min: min !== null && min !== void 0 ? min : null
|
|
1429
|
-
}
|
|
1430
|
-
},
|
|
1431
|
-
defaultValue: defaultValue !== null && defaultValue !== void 0 ? defaultValue : isNullable ? null : '',
|
|
1432
|
-
isNullable
|
|
1433
|
-
};
|
|
1434
|
-
}
|
|
1435
|
-
});
|
|
1436
|
-
};
|
|
1437
|
-
}
|
|
1438
|
-
|
|
1439
890
|
function virtual({
|
|
1440
891
|
field,
|
|
1441
892
|
...config
|
|
@@ -1484,7 +935,9 @@ function calendarDay(config = {}) {
|
|
|
1484
935
|
try {
|
|
1485
936
|
g.CalendarDay.parseValue(defaultValue);
|
|
1486
937
|
} catch (err) {
|
|
1487
|
-
throw new Error(`The calendarDay field at ${meta.listKey}.${meta.fieldKey} specifies defaultValue: ${defaultValue} but values must be provided as a full-date ISO8601 string such as 1970-01-01
|
|
938
|
+
throw new Error(`The calendarDay field at ${meta.listKey}.${meta.fieldKey} specifies defaultValue: ${defaultValue} but values must be provided as a full-date ISO8601 string such as 1970-01-01`, {
|
|
939
|
+
cause: err
|
|
940
|
+
});
|
|
1488
941
|
}
|
|
1489
942
|
}
|
|
1490
943
|
const usesNativeDateType = meta.provider === 'postgresql' || meta.provider === 'mysql';
|
|
@@ -1782,4 +1235,4 @@ function configToOptionsAndGraphQLType(config, meta) {
|
|
|
1782
1235
|
};
|
|
1783
1236
|
}
|
|
1784
1237
|
|
|
1785
|
-
export { bigInt, calendarDay, checkbox, decimal, file, float, image,
|
|
1238
|
+
export { bigInt, calendarDay, checkbox, decimal, file, float, image, multiselect, virtual };
|
|
@@ -4,8 +4,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
require('pluralize');
|
|
6
6
|
var nextFields = require('../../../../dist/next-fields-49c025ef.cjs.js');
|
|
7
|
-
require('../../../../dist/resolve-hooks-
|
|
8
|
-
|
|
7
|
+
require('../../../../dist/resolve-hooks-10a5f84c.cjs.js');
|
|
8
|
+
require('node:crypto');
|
|
9
|
+
var nonNullGraphql = require('../../../../dist/non-null-graphql-4a44c122.cjs.js');
|
|
9
10
|
require('node:path');
|
|
10
11
|
require('@graphql-ts/schema');
|
|
11
12
|
require('@graphql-ts/extend');
|
|
@@ -13,6 +14,7 @@ var utils = require('../../../../dist/utils-b031e11c.cjs.js');
|
|
|
13
14
|
var graphql = require('graphql');
|
|
14
15
|
require('decimal.js');
|
|
15
16
|
require('graphql-upload/GraphQLUpload.js');
|
|
17
|
+
require('node:async_hooks');
|
|
16
18
|
|
|
17
19
|
function bytes(config = {}) {
|
|
18
20
|
var _config$graphql$scala, _config$graphql, _config$db, _validation$isRequire, _validation$length$mi, _validation$length, _validation$length2, _validation$length3;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import 'pluralize';
|
|
2
2
|
import { g, f as fieldType, o as orderDirectionEnum } from '../../../../dist/next-fields-9bf04ed8.esm.js';
|
|
3
|
-
import '../../../../dist/resolve-hooks-
|
|
4
|
-
import
|
|
3
|
+
import '../../../../dist/resolve-hooks-9e676794.esm.js';
|
|
4
|
+
import 'node:crypto';
|
|
5
|
+
import { m as makeValidateHook, d as defaultIsRequired } from '../../../../dist/non-null-graphql-8c5feaae.esm.js';
|
|
5
6
|
import 'node:path';
|
|
6
7
|
import '@graphql-ts/schema';
|
|
7
8
|
import '@graphql-ts/extend';
|
|
@@ -9,6 +10,7 @@ import { w as weakMemoize } from '../../../../dist/utils-f9556354.esm.js';
|
|
|
9
10
|
import { GraphQLError } from 'graphql';
|
|
10
11
|
import 'decimal.js';
|
|
11
12
|
import 'graphql-upload/GraphQLUpload.js';
|
|
13
|
+
import 'node:async_hooks';
|
|
12
14
|
|
|
13
15
|
function bytes(config = {}) {
|
|
14
16
|
var _config$graphql$scala, _config$graphql, _config$db, _validation$isRequire, _validation$length$mi, _validation$length, _validation$length2, _validation$length3;
|