payload 3.0.0-beta.67 → 3.0.0-beta.68
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/admin/RichText.d.ts +4 -4
- package/dist/admin/RichText.d.ts.map +1 -1
- package/dist/admin/RichText.js.map +1 -1
- package/dist/auth/operations/resetPassword.js +1 -1
- package/dist/auth/operations/resetPassword.js.map +1 -1
- package/dist/auth/strategies/jwt.d.ts.map +1 -1
- package/dist/auth/strategies/jwt.js +29 -0
- package/dist/auth/strategies/jwt.js.map +1 -1
- package/dist/auth/strategies/local/incrementLoginAttempts.d.ts.map +1 -1
- package/dist/auth/strategies/local/incrementLoginAttempts.js +1 -1
- package/dist/auth/strategies/local/incrementLoginAttempts.js.map +1 -1
- package/dist/auth/strategies/local/register.d.ts +2 -2
- package/dist/auth/strategies/local/register.d.ts.map +1 -1
- package/dist/auth/strategies/local/register.js.map +1 -1
- package/dist/bin/generateTypes.js +2 -2
- package/dist/bin/generateTypes.js.map +1 -1
- package/dist/collections/config/client.d.ts.map +1 -1
- package/dist/collections/config/defaults.d.ts +4 -69
- package/dist/collections/config/defaults.d.ts.map +1 -1
- package/dist/collections/config/defaults.js.map +1 -1
- package/dist/collections/config/reservedFieldNames.d.ts +15 -0
- package/dist/collections/config/reservedFieldNames.d.ts.map +1 -0
- package/dist/collections/config/reservedFieldNames.js +104 -0
- package/dist/collections/config/reservedFieldNames.js.map +1 -0
- package/dist/collections/config/reservedFieldNames.spec.js +148 -0
- package/dist/collections/config/reservedFieldNames.spec.js.map +1 -0
- package/dist/collections/config/sanitize.d.ts.map +1 -1
- package/dist/collections/config/sanitize.js +13 -9
- package/dist/collections/config/sanitize.js.map +1 -1
- package/dist/collections/config/types.d.ts +2 -2
- package/dist/collections/config/types.d.ts.map +1 -1
- package/dist/collections/config/types.js.map +1 -1
- package/dist/collections/dataloader.d.ts.map +1 -1
- package/dist/collections/dataloader.js.map +1 -1
- package/dist/collections/operations/create.d.ts.map +1 -1
- package/dist/collections/operations/create.js.map +1 -1
- package/dist/collections/operations/deleteByID.d.ts.map +1 -1
- package/dist/collections/operations/deleteByID.js.map +1 -1
- package/dist/collections/operations/duplicate.js.map +1 -1
- package/dist/collections/operations/update.js.map +1 -1
- package/dist/collections/operations/updateByID.js.map +1 -1
- package/dist/config/client.d.ts.map +1 -1
- package/dist/config/client.js +26 -26
- package/dist/config/client.js.map +1 -1
- package/dist/config/sanitize.d.ts.map +1 -1
- package/dist/config/sanitize.js +4 -7
- package/dist/config/sanitize.js.map +1 -1
- package/dist/config/types.d.ts +3 -4
- package/dist/config/types.d.ts.map +1 -1
- package/dist/config/types.js.map +1 -1
- package/dist/errors/APIError.d.ts +1 -0
- package/dist/errors/APIError.d.ts.map +1 -1
- package/dist/errors/APIError.js +3 -0
- package/dist/errors/APIError.js.map +1 -1
- package/dist/errors/ValidationError.d.ts +1 -0
- package/dist/errors/ValidationError.d.ts.map +1 -1
- package/dist/errors/ValidationError.js +3 -0
- package/dist/errors/ValidationError.js.map +1 -1
- package/dist/errors/index.d.ts +2 -2
- package/dist/errors/index.d.ts.map +1 -1
- package/dist/errors/index.js +2 -2
- package/dist/errors/index.js.map +1 -1
- package/dist/exports/shared.d.ts +3 -2
- package/dist/exports/shared.d.ts.map +1 -1
- package/dist/exports/shared.js +3 -2
- package/dist/exports/shared.js.map +1 -1
- package/dist/fields/config/sanitize.d.ts +3 -2
- package/dist/fields/config/sanitize.d.ts.map +1 -1
- package/dist/fields/config/sanitize.js +8 -16
- package/dist/fields/config/sanitize.js.map +1 -1
- package/dist/fields/config/sanitize.spec.js +1 -17
- package/dist/fields/config/sanitize.spec.js.map +1 -1
- package/dist/fields/getDefaultValue.d.ts +5 -5
- package/dist/fields/getDefaultValue.d.ts.map +1 -1
- package/dist/fields/getDefaultValue.js +4 -6
- package/dist/fields/getDefaultValue.js.map +1 -1
- package/dist/fields/hooks/afterChange/index.d.ts +6 -6
- package/dist/fields/hooks/afterChange/index.d.ts.map +1 -1
- package/dist/fields/hooks/afterChange/index.js +2 -2
- package/dist/fields/hooks/afterChange/index.js.map +1 -1
- package/dist/fields/hooks/afterChange/promise.d.ts +7 -7
- package/dist/fields/hooks/afterChange/promise.d.ts.map +1 -1
- package/dist/fields/hooks/afterChange/promise.js.map +1 -1
- package/dist/fields/hooks/afterChange/traverseFields.d.ts +7 -7
- package/dist/fields/hooks/afterChange/traverseFields.d.ts.map +1 -1
- package/dist/fields/hooks/afterChange/traverseFields.js.map +1 -1
- package/dist/fields/hooks/afterRead/index.d.ts +4 -4
- package/dist/fields/hooks/afterRead/index.d.ts.map +1 -1
- package/dist/fields/hooks/afterRead/index.js +2 -2
- package/dist/fields/hooks/afterRead/index.js.map +1 -1
- package/dist/fields/hooks/afterRead/promise.d.ts +3 -3
- package/dist/fields/hooks/afterRead/promise.d.ts.map +1 -1
- package/dist/fields/hooks/afterRead/promise.js +2 -2
- package/dist/fields/hooks/afterRead/promise.js.map +1 -1
- package/dist/fields/hooks/afterRead/traverseFields.d.ts +3 -3
- package/dist/fields/hooks/afterRead/traverseFields.d.ts.map +1 -1
- package/dist/fields/hooks/afterRead/traverseFields.js.map +1 -1
- package/dist/fields/hooks/beforeChange/cloneDataFromOriginalDoc.d.ts +2 -1
- package/dist/fields/hooks/beforeChange/cloneDataFromOriginalDoc.d.ts.map +1 -1
- package/dist/fields/hooks/beforeChange/cloneDataFromOriginalDoc.js.map +1 -1
- package/dist/fields/hooks/beforeChange/getExistingRowDoc.d.ts +2 -1
- package/dist/fields/hooks/beforeChange/getExistingRowDoc.d.ts.map +1 -1
- package/dist/fields/hooks/beforeChange/getExistingRowDoc.js.map +1 -1
- package/dist/fields/hooks/beforeChange/index.d.ts +6 -6
- package/dist/fields/hooks/beforeChange/index.d.ts.map +1 -1
- package/dist/fields/hooks/beforeChange/index.js +2 -2
- package/dist/fields/hooks/beforeChange/index.js.map +1 -1
- package/dist/fields/hooks/beforeChange/promise.d.ts +7 -7
- package/dist/fields/hooks/beforeChange/promise.d.ts.map +1 -1
- package/dist/fields/hooks/beforeChange/promise.js +3 -7
- package/dist/fields/hooks/beforeChange/promise.js.map +1 -1
- package/dist/fields/hooks/beforeChange/traverseFields.d.ts +7 -7
- package/dist/fields/hooks/beforeChange/traverseFields.d.ts.map +1 -1
- package/dist/fields/hooks/beforeChange/traverseFields.js.map +1 -1
- package/dist/fields/hooks/beforeValidate/index.d.ts +5 -5
- package/dist/fields/hooks/beforeValidate/index.d.ts.map +1 -1
- package/dist/fields/hooks/beforeValidate/index.js +2 -2
- package/dist/fields/hooks/beforeValidate/index.js.map +1 -1
- package/dist/fields/hooks/beforeValidate/promise.d.ts +3 -3
- package/dist/fields/hooks/beforeValidate/promise.d.ts.map +1 -1
- package/dist/fields/hooks/beforeValidate/promise.js +2 -2
- package/dist/fields/hooks/beforeValidate/promise.js.map +1 -1
- package/dist/fields/hooks/beforeValidate/traverseFields.d.ts +3 -3
- package/dist/fields/hooks/beforeValidate/traverseFields.d.ts.map +1 -1
- package/dist/fields/hooks/beforeValidate/traverseFields.js.map +1 -1
- package/dist/fields/mergeBaseFields.d.ts.map +1 -1
- package/dist/fields/mergeBaseFields.js +2 -2
- package/dist/fields/mergeBaseFields.js.map +1 -1
- package/dist/globals/operations/findOne.d.ts.map +1 -1
- package/dist/globals/operations/findOne.js.map +1 -1
- package/dist/globals/operations/findVersionByID.d.ts.map +1 -1
- package/dist/globals/operations/findVersionByID.js +2 -1
- package/dist/globals/operations/findVersionByID.js.map +1 -1
- package/dist/globals/operations/findVersions.js.map +1 -1
- package/dist/globals/operations/update.d.ts.map +1 -1
- package/dist/globals/operations/update.js +2 -1
- package/dist/globals/operations/update.js.map +1 -1
- package/dist/index.d.ts +11 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -12
- package/dist/index.js.map +1 -1
- package/dist/types/index.d.ts +8 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js.map +1 -1
- package/dist/uploads/imageResizer.d.ts.map +1 -1
- package/dist/uploads/imageResizer.js +16 -18
- package/dist/uploads/imageResizer.js.map +1 -1
- package/dist/utilities/deepCopyObject.d.ts +18 -1
- package/dist/utilities/deepCopyObject.d.ts.map +1 -1
- package/dist/utilities/deepCopyObject.js +147 -16
- package/dist/utilities/deepCopyObject.js.map +1 -1
- package/dist/utilities/deepMerge.d.ts +18 -1
- package/dist/utilities/deepMerge.d.ts.map +1 -1
- package/dist/utilities/deepMerge.js +38 -13
- package/dist/utilities/deepMerge.js.map +1 -1
- package/dist/utilities/isPlainObject.d.ts +1 -1
- package/dist/utilities/isPlainObject.d.ts.map +1 -1
- package/dist/utilities/isPlainObject.js +4 -18
- package/dist/utilities/isPlainObject.js.map +1 -1
- package/dist/utilities/logger.d.ts +5 -7
- package/dist/utilities/logger.d.ts.map +1 -1
- package/dist/utilities/logger.js +4 -7
- package/dist/utilities/logger.js.map +1 -1
- package/dist/utilities/telemetry/events/adminInit.d.ts.map +1 -1
- package/dist/utilities/telemetry/events/adminInit.js.map +1 -1
- package/dist/versions/baseFields.d.ts.map +1 -1
- package/dist/versions/baseFields.js +1 -0
- package/dist/versions/baseFields.js.map +1 -1
- package/dist/versions/drafts/replaceWithDraftIfAvailable.d.ts.map +1 -1
- package/dist/versions/drafts/replaceWithDraftIfAvailable.js +2 -1
- package/dist/versions/drafts/replaceWithDraftIfAvailable.js.map +1 -1
- package/dist/versions/saveVersion.d.ts.map +1 -1
- package/dist/versions/saveVersion.js +2 -2
- package/dist/versions/saveVersion.js.map +1 -1
- package/package.json +5 -7
- package/dist/collections/config/schema.d.ts +0 -4
- package/dist/collections/config/schema.d.ts.map +0 -1
- package/dist/collections/config/schema.js +0 -191
- package/dist/collections/config/schema.js.map +0 -1
- package/dist/config/schema.d.ts +0 -5
- package/dist/config/schema.d.ts.map +0 -1
- package/dist/config/schema.js +0 -179
- package/dist/config/schema.js.map +0 -1
- package/dist/config/shared/adminViewSchema.d.ts +0 -3
- package/dist/config/shared/adminViewSchema.d.ts.map +0 -1
- package/dist/config/shared/adminViewSchema.js +0 -11
- package/dist/config/shared/adminViewSchema.js.map +0 -1
- package/dist/config/shared/componentSchema.d.ts +0 -16
- package/dist/config/shared/componentSchema.d.ts.map +0 -1
- package/dist/config/shared/componentSchema.js +0 -27
- package/dist/config/shared/componentSchema.js.map +0 -1
- package/dist/config/shared/openGraphSchema.d.ts +0 -3
- package/dist/config/shared/openGraphSchema.d.ts.map +0 -1
- package/dist/config/shared/openGraphSchema.js +0 -16
- package/dist/config/shared/openGraphSchema.js.map +0 -1
- package/dist/config/validate.d.ts +0 -4
- package/dist/config/validate.d.ts.map +0 -1
- package/dist/config/validate.js +0 -89
- package/dist/config/validate.js.map +0 -1
- package/dist/fields/config/schema.d.ts +0 -29
- package/dist/fields/config/schema.d.ts.map +0 -1
- package/dist/fields/config/schema.js +0 -508
- package/dist/fields/config/schema.js.map +0 -1
- package/dist/globals/config/schema.d.ts +0 -4
- package/dist/globals/config/schema.d.ts.map +0 -1
- package/dist/globals/config/schema.js +0 -79
- package/dist/globals/config/schema.js.map +0 -1
- package/dist/utilities/combineMerge.d.ts +0 -2
- package/dist/utilities/combineMerge.d.ts.map +0 -1
- package/dist/utilities/combineMerge.js +0 -16
- package/dist/utilities/combineMerge.js.map +0 -1
- package/dist/utilities/convertData.d.ts +0 -5
- package/dist/utilities/convertData.d.ts.map +0 -1
- package/dist/utilities/convertData.js +0 -16
- package/dist/utilities/convertData.js.map +0 -1
- package/dist/utilities/getCSSVariable.d.ts +0 -3
- package/dist/utilities/getCSSVariable.d.ts.map +0 -1
- package/dist/utilities/getCSSVariable.js +0 -3
- package/dist/utilities/getCSSVariable.js.map +0 -1
- package/dist/utilities/overwriteMerge.d.ts +0 -3
- package/dist/utilities/overwriteMerge.d.ts.map +0 -1
- package/dist/utilities/overwriteMerge.js +0 -4
- package/dist/utilities/overwriteMerge.js.map +0 -1
package/dist/config/validate.js
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import collectionSchema from '../collections/config/schema.js';
|
|
2
|
-
import fieldSchema, { idField } from '../fields/config/schema.js';
|
|
3
|
-
import { fieldAffectsData } from '../fields/config/types.js';
|
|
4
|
-
import globalSchema from '../globals/config/schema.js';
|
|
5
|
-
import schema from './schema.js';
|
|
6
|
-
const validateFields = (context, entity)=>{
|
|
7
|
-
const errors = [];
|
|
8
|
-
entity.fields.forEach((field)=>{
|
|
9
|
-
let idResult = {
|
|
10
|
-
error: null
|
|
11
|
-
};
|
|
12
|
-
if (fieldAffectsData(field) && field.name === 'id') {
|
|
13
|
-
idResult = idField.validate(field, {
|
|
14
|
-
abortEarly: false
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
const result = fieldSchema.validate(field, {
|
|
18
|
-
abortEarly: false
|
|
19
|
-
});
|
|
20
|
-
if (idResult.error) {
|
|
21
|
-
idResult.error.details.forEach(({ message })=>{
|
|
22
|
-
errors.push(`${context} "${entity.slug}" > Field${fieldAffectsData(field) ? ` "${field.name}" >` : ''} ${message}`);
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
if (result.error) {
|
|
26
|
-
result.error.details.forEach(({ message })=>{
|
|
27
|
-
errors.push(`${context} "${entity.slug}" > Field${fieldAffectsData(field) ? ` "${field.name}" >` : ''} ${message}`);
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
return errors;
|
|
32
|
-
};
|
|
33
|
-
const validateCollections = (collections)=>{
|
|
34
|
-
const errors = [];
|
|
35
|
-
collections.forEach((collection)=>{
|
|
36
|
-
const result = collectionSchema.validate(collection, {
|
|
37
|
-
abortEarly: false
|
|
38
|
-
});
|
|
39
|
-
if (result.error) {
|
|
40
|
-
result.error.details.forEach(({ message })=>{
|
|
41
|
-
errors.push(`Collection "${collection.slug}" > ${message}`);
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
errors.push(...validateFields('Collection', collection));
|
|
45
|
-
});
|
|
46
|
-
return errors;
|
|
47
|
-
};
|
|
48
|
-
const validateGlobals = (globals)=>{
|
|
49
|
-
const errors = [];
|
|
50
|
-
globals.forEach((global)=>{
|
|
51
|
-
const result = globalSchema.validate(global, {
|
|
52
|
-
abortEarly: false
|
|
53
|
-
});
|
|
54
|
-
if (result.error) {
|
|
55
|
-
result.error.details.forEach(({ message })=>{
|
|
56
|
-
errors.push(`Globals "${global.slug}" > ${message}`);
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
errors.push(...validateFields('Global', global));
|
|
60
|
-
});
|
|
61
|
-
return errors;
|
|
62
|
-
};
|
|
63
|
-
export const validateSchema = (config, logger)=>{
|
|
64
|
-
const result = schema.validate(config, {
|
|
65
|
-
abortEarly: false
|
|
66
|
-
});
|
|
67
|
-
const nestedErrors = [
|
|
68
|
-
...validateCollections(config.collections),
|
|
69
|
-
...validateGlobals(config.globals)
|
|
70
|
-
];
|
|
71
|
-
if (result.error || nestedErrors.length > 0) {
|
|
72
|
-
logger.error(`There were ${(result.error?.details?.length || 0) + nestedErrors.length} errors validating your Payload config`);
|
|
73
|
-
let i = 0;
|
|
74
|
-
if (result.error) {
|
|
75
|
-
result.error.details.forEach(({ message })=>{
|
|
76
|
-
i += 1;
|
|
77
|
-
logger.error(`${i}: ${message}`);
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
nestedErrors.forEach((message)=>{
|
|
81
|
-
i += 1;
|
|
82
|
-
logger.error(`${i}: ${message}`);
|
|
83
|
-
});
|
|
84
|
-
process.exit(1);
|
|
85
|
-
}
|
|
86
|
-
return result.value;
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
//# sourceMappingURL=validate.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/config/validate.ts"],"sourcesContent":["import type { ValidationResult } from 'joi'\nimport type { Logger } from 'pino'\n\nimport type { SanitizedCollectionConfig } from '../collections/config/types.js'\nimport type { SanitizedGlobalConfig } from '../globals/config/types.js'\nimport type { SanitizedConfig } from './types.js'\n\nimport collectionSchema from '../collections/config/schema.js'\nimport fieldSchema, { idField } from '../fields/config/schema.js'\nimport { fieldAffectsData } from '../fields/config/types.js'\nimport globalSchema from '../globals/config/schema.js'\nimport schema from './schema.js'\n\nconst validateFields = (\n context: string,\n entity: SanitizedCollectionConfig | SanitizedGlobalConfig,\n): string[] => {\n const errors: string[] = []\n entity.fields.forEach((field) => {\n let idResult: Partial<ValidationResult> = { error: null }\n if (fieldAffectsData(field) && field.name === 'id') {\n idResult = idField.validate(field, { abortEarly: false })\n }\n\n const result = fieldSchema.validate(field, { abortEarly: false })\n if (idResult.error) {\n idResult.error.details.forEach(({ message }) => {\n errors.push(\n `${context} \"${entity.slug}\" > Field${\n fieldAffectsData(field) ? ` \"${field.name}\" >` : ''\n } ${message}`,\n )\n })\n }\n if (result.error) {\n result.error.details.forEach(({ message }) => {\n errors.push(\n `${context} \"${entity.slug}\" > Field${\n fieldAffectsData(field) ? ` \"${field.name}\" >` : ''\n } ${message}`,\n )\n })\n }\n })\n return errors\n}\n\nconst validateCollections = (collections: SanitizedCollectionConfig[]): string[] => {\n const errors: string[] = []\n collections.forEach((collection) => {\n const result = collectionSchema.validate(collection, { abortEarly: false })\n if (result.error) {\n result.error.details.forEach(({ message }) => {\n errors.push(`Collection \"${collection.slug}\" > ${message}`)\n })\n }\n errors.push(...validateFields('Collection', collection))\n })\n\n return errors\n}\n\nconst validateGlobals = (globals: SanitizedGlobalConfig[]): string[] => {\n const errors: string[] = []\n globals.forEach((global) => {\n const result = globalSchema.validate(global, { abortEarly: false })\n if (result.error) {\n result.error.details.forEach(({ message }) => {\n errors.push(`Globals \"${global.slug}\" > ${message}`)\n })\n }\n errors.push(...validateFields('Global', global))\n })\n\n return errors\n}\n\nexport const validateSchema = (config: SanitizedConfig, logger: Logger): SanitizedConfig => {\n const result = schema.validate(config, {\n abortEarly: false,\n })\n\n const nestedErrors = [\n ...validateCollections(config.collections),\n ...validateGlobals(config.globals),\n ]\n\n if (result.error || nestedErrors.length > 0) {\n logger.error(\n `There were ${\n (result.error?.details?.length || 0) + nestedErrors.length\n } errors validating your Payload config`,\n )\n\n let i = 0\n if (result.error) {\n result.error.details.forEach(({ message }) => {\n i += 1\n logger.error(`${i}: ${message}`)\n })\n }\n nestedErrors.forEach((message) => {\n i += 1\n logger.error(`${i}: ${message}`)\n })\n\n process.exit(1)\n }\n\n return result.value\n}\n"],"names":["collectionSchema","fieldSchema","idField","fieldAffectsData","globalSchema","schema","validateFields","context","entity","errors","fields","forEach","field","idResult","error","name","validate","abortEarly","result","details","message","push","slug","validateCollections","collections","collection","validateGlobals","globals","global","validateSchema","config","logger","nestedErrors","length","i","process","exit","value"],"mappings":"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"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import joi from 'joi';
|
|
2
|
-
export declare const baseAdminComponentFields: joi.ObjectSchema<any>;
|
|
3
|
-
export declare const baseAdminFields: joi.ObjectSchema<any>;
|
|
4
|
-
export declare const baseField: joi.ObjectSchema<any>;
|
|
5
|
-
export declare const idField: joi.ObjectSchema<any>;
|
|
6
|
-
export declare const text: joi.ObjectSchema<any>;
|
|
7
|
-
export declare const number: joi.ObjectSchema<any>;
|
|
8
|
-
export declare const textarea: joi.ObjectSchema<any>;
|
|
9
|
-
export declare const email: joi.ObjectSchema<any>;
|
|
10
|
-
export declare const code: joi.ObjectSchema<any>;
|
|
11
|
-
export declare const json: joi.ObjectSchema<any>;
|
|
12
|
-
export declare const select: joi.ObjectSchema<any>;
|
|
13
|
-
export declare const radio: joi.ObjectSchema<any>;
|
|
14
|
-
export declare const row: joi.ObjectSchema<any>;
|
|
15
|
-
export declare const collapsible: joi.ObjectSchema<any>;
|
|
16
|
-
export declare const tabs: joi.ObjectSchema<any>;
|
|
17
|
-
export declare const group: joi.ObjectSchema<any>;
|
|
18
|
-
export declare const array: joi.ObjectSchema<any>;
|
|
19
|
-
export declare const upload: joi.ObjectSchema<any>;
|
|
20
|
-
export declare const checkbox: joi.ObjectSchema<any>;
|
|
21
|
-
export declare const point: joi.ObjectSchema<any>;
|
|
22
|
-
export declare const relationship: joi.ObjectSchema<any>;
|
|
23
|
-
export declare const blocks: joi.ObjectSchema<any>;
|
|
24
|
-
export declare const richText: joi.ObjectSchema<any>;
|
|
25
|
-
export declare const date: joi.ObjectSchema<any>;
|
|
26
|
-
export declare const ui: joi.ObjectSchema<any>;
|
|
27
|
-
declare const fieldSchema: joi.AlternativesSchema<any>;
|
|
28
|
-
export default fieldSchema;
|
|
29
|
-
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/fields/config/schema.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,KAAK,CAAA;AAIrB,eAAO,MAAM,wBAAwB,uBAQvB,CAAA;AAEd,eAAO,MAAM,eAAe,uBAkB1B,CAAA;AAEF,eAAO,MAAM,SAAS,uBAqCV,CAAA;AAEZ,eAAO,MAAM,OAAO,uBAKlB,CAAA;AAEF,eAAO,MAAM,IAAI,uBAsBf,CAAA;AAEF,eAAO,MAAM,MAAM,uBAgCjB,CAAA;AAEF,eAAO,MAAM,QAAQ,uBAiBnB,CAAA;AAEF,eAAO,MAAM,KAAK,uBAgBhB,CAAA;AAEF,eAAO,MAAM,IAAI,uBAYf,CAAA;AAEF,eAAO,MAAM,IAAI,uBAYf,CAAA;AAEF,eAAO,MAAM,MAAM,uBAgCjB,CAAA;AAEF,eAAO,MAAM,KAAK,uBA4BhB,CAAA;AAEF,eAAO,MAAM,GAAG,uBAId,CAAA;AAEF,eAAO,MAAM,WAAW,uBAuBtB,CAAA;AAeF,eAAO,MAAM,IAAI,uBAQf,CAAA;AAEF,eAAO,MAAM,KAAK,uBAShB,CAAA;AAEF,eAAO,MAAM,KAAK,uBA2BhB,CAAA;AAEF,eAAO,MAAM,MAAM,uBAajB,CAAA;AAEF,eAAO,MAAM,QAAQ,uBAYnB,CAAA;AAEF,eAAO,MAAM,KAAK,uBAYhB,CAAA;AAEF,eAAO,MAAM,YAAY,uBA+BvB,CAAA;AAEF,eAAO,MAAM,MAAM,uBAkDjB,CAAA;AAEF,eAAO,MAAM,QAAQ,uBAsBnB,CAAA;AAEF,eAAO,MAAM,IAAI,uBAyBf,CAAA;AAEF,eAAO,MAAM,EAAE,uBAsBb,CAAA;AAEF,QAAA,MAAM,WAAW,6BAyBH,CAAA;AAEd,eAAe,WAAW,CAAA"}
|
|
@@ -1,508 +0,0 @@
|
|
|
1
|
-
import joi from 'joi';
|
|
2
|
-
import { componentSchema } from '../../config/shared/componentSchema.js';
|
|
3
|
-
export const baseAdminComponentFields = joi.object().keys({
|
|
4
|
-
Cell: componentSchema,
|
|
5
|
-
Description: componentSchema,
|
|
6
|
-
Field: componentSchema,
|
|
7
|
-
Filter: componentSchema
|
|
8
|
-
}).default({});
|
|
9
|
-
export const baseAdminFields = joi.object().keys({
|
|
10
|
-
className: joi.string(),
|
|
11
|
-
components: baseAdminComponentFields,
|
|
12
|
-
condition: joi.func(),
|
|
13
|
-
custom: joi.object().pattern(joi.string(), joi.any()),
|
|
14
|
-
description: joi.alternatives().try(joi.string(), joi.object().pattern(joi.string(), [
|
|
15
|
-
joi.string()
|
|
16
|
-
]), joi.function()),
|
|
17
|
-
disableBulkEdit: joi.boolean().default(false),
|
|
18
|
-
disableListColumn: joi.boolean().default(false),
|
|
19
|
-
disableListFilter: joi.boolean().default(false),
|
|
20
|
-
disabled: joi.boolean().default(false),
|
|
21
|
-
hidden: joi.boolean().default(false),
|
|
22
|
-
initCollapsed: joi.boolean().default(false),
|
|
23
|
-
position: joi.string().valid('sidebar'),
|
|
24
|
-
readOnly: joi.boolean().default(false),
|
|
25
|
-
style: joi.object().unknown(),
|
|
26
|
-
width: joi.string()
|
|
27
|
-
});
|
|
28
|
-
export const baseField = joi.object().keys({
|
|
29
|
-
access: joi.object().keys({
|
|
30
|
-
create: joi.func(),
|
|
31
|
-
read: joi.func(),
|
|
32
|
-
update: joi.func()
|
|
33
|
-
}),
|
|
34
|
-
admin: baseAdminFields.default(),
|
|
35
|
-
custom: joi.object().pattern(joi.string(), joi.any()),
|
|
36
|
-
hidden: joi.boolean().default(false),
|
|
37
|
-
hooks: joi.object().keys({
|
|
38
|
-
afterChange: joi.array().items(joi.func()).default([]),
|
|
39
|
-
afterRead: joi.array().items(joi.func()).default([]),
|
|
40
|
-
beforeChange: joi.array().items(joi.func()).default([]),
|
|
41
|
-
beforeDuplicate: joi.array().items(joi.func()).default([]),
|
|
42
|
-
beforeValidate: joi.array().items(joi.func()).default([])
|
|
43
|
-
}).default(),
|
|
44
|
-
index: joi.boolean().default(false),
|
|
45
|
-
label: joi.alternatives().try(joi.func(), joi.object().pattern(joi.string(), [
|
|
46
|
-
joi.string()
|
|
47
|
-
]), joi.string(), joi.valid(false)),
|
|
48
|
-
localized: joi.boolean().default(false),
|
|
49
|
-
required: joi.boolean().default(false),
|
|
50
|
-
saveToJWT: joi.alternatives().try(joi.boolean(), joi.string()).default(false),
|
|
51
|
-
typescriptSchema: joi.array().items(joi.func()),
|
|
52
|
-
unique: joi.boolean().default(false),
|
|
53
|
-
validate: joi.func()
|
|
54
|
-
}).default();
|
|
55
|
-
export const idField = baseField.keys({
|
|
56
|
-
name: joi.string().valid('id'),
|
|
57
|
-
type: joi.string().valid('text', 'number'),
|
|
58
|
-
localized: joi.invalid(true),
|
|
59
|
-
required: joi.not(false, 0).default(true)
|
|
60
|
-
});
|
|
61
|
-
export const text = baseField.keys({
|
|
62
|
-
name: joi.string().required(),
|
|
63
|
-
type: joi.string().valid('text').required(),
|
|
64
|
-
admin: baseAdminFields.keys({
|
|
65
|
-
autoComplete: joi.string(),
|
|
66
|
-
components: baseAdminComponentFields.keys({
|
|
67
|
-
Error: componentSchema,
|
|
68
|
-
Label: componentSchema,
|
|
69
|
-
afterInput: joi.array().items(componentSchema),
|
|
70
|
-
beforeInput: joi.array().items(componentSchema)
|
|
71
|
-
}),
|
|
72
|
-
placeholder: joi.alternatives().try(joi.object().pattern(joi.string(), [
|
|
73
|
-
joi.string()
|
|
74
|
-
]), joi.string()),
|
|
75
|
-
rtl: joi.boolean()
|
|
76
|
-
}),
|
|
77
|
-
defaultValue: joi.alternatives().try(joi.string().allow(''), joi.func()),
|
|
78
|
-
hasMany: joi.boolean().default(false),
|
|
79
|
-
maxLength: joi.number(),
|
|
80
|
-
maxRows: joi.number().when('hasMany', {
|
|
81
|
-
is: joi.not(true),
|
|
82
|
-
then: joi.forbidden()
|
|
83
|
-
}),
|
|
84
|
-
minLength: joi.number(),
|
|
85
|
-
minRows: joi.number().when('hasMany', {
|
|
86
|
-
is: joi.not(true),
|
|
87
|
-
then: joi.forbidden()
|
|
88
|
-
})
|
|
89
|
-
});
|
|
90
|
-
export const number = baseField.keys({
|
|
91
|
-
name: joi.string().required(),
|
|
92
|
-
type: joi.string().valid('number').required(),
|
|
93
|
-
admin: baseAdminFields.keys({
|
|
94
|
-
autoComplete: joi.string(),
|
|
95
|
-
components: baseAdminComponentFields.keys({
|
|
96
|
-
Error: componentSchema,
|
|
97
|
-
Label: componentSchema,
|
|
98
|
-
afterInput: joi.array().items(componentSchema).when('hasMany', {
|
|
99
|
-
not: true,
|
|
100
|
-
otherwise: joi.forbidden()
|
|
101
|
-
}),
|
|
102
|
-
beforeInput: joi.array().items(componentSchema).when('hasMany', {
|
|
103
|
-
not: true,
|
|
104
|
-
otherwise: joi.forbidden()
|
|
105
|
-
})
|
|
106
|
-
}),
|
|
107
|
-
placeholder: joi.string(),
|
|
108
|
-
step: joi.number()
|
|
109
|
-
}),
|
|
110
|
-
defaultValue: joi.alternatives().try(joi.number(), joi.func(), joi.array().when('hasMany', {
|
|
111
|
-
not: true,
|
|
112
|
-
then: joi.forbidden()
|
|
113
|
-
})),
|
|
114
|
-
hasMany: joi.boolean().default(false),
|
|
115
|
-
max: joi.number(),
|
|
116
|
-
maxRows: joi.number().when('hasMany', {
|
|
117
|
-
is: joi.not(true),
|
|
118
|
-
then: joi.forbidden()
|
|
119
|
-
}),
|
|
120
|
-
min: joi.number(),
|
|
121
|
-
minRows: joi.number().when('hasMany', {
|
|
122
|
-
is: joi.not(true),
|
|
123
|
-
then: joi.forbidden()
|
|
124
|
-
})
|
|
125
|
-
});
|
|
126
|
-
export const textarea = baseField.keys({
|
|
127
|
-
name: joi.string().required(),
|
|
128
|
-
type: joi.string().valid('textarea').required(),
|
|
129
|
-
admin: baseAdminFields.keys({
|
|
130
|
-
components: baseAdminComponentFields.keys({
|
|
131
|
-
Error: componentSchema,
|
|
132
|
-
Label: componentSchema,
|
|
133
|
-
afterInput: joi.array().items(componentSchema),
|
|
134
|
-
beforeInput: joi.array().items(componentSchema)
|
|
135
|
-
}),
|
|
136
|
-
placeholder: joi.string(),
|
|
137
|
-
rows: joi.number(),
|
|
138
|
-
rtl: joi.boolean()
|
|
139
|
-
}),
|
|
140
|
-
defaultValue: joi.alternatives().try(joi.string().allow(''), joi.func()),
|
|
141
|
-
maxLength: joi.number(),
|
|
142
|
-
minLength: joi.number()
|
|
143
|
-
});
|
|
144
|
-
export const email = baseField.keys({
|
|
145
|
-
name: joi.string().required(),
|
|
146
|
-
type: joi.string().valid('email').required(),
|
|
147
|
-
admin: baseAdminFields.keys({
|
|
148
|
-
autoComplete: joi.string(),
|
|
149
|
-
components: baseAdminComponentFields.keys({
|
|
150
|
-
Error: componentSchema,
|
|
151
|
-
Label: componentSchema,
|
|
152
|
-
afterInput: joi.array().items(componentSchema),
|
|
153
|
-
beforeInput: joi.array().items(componentSchema)
|
|
154
|
-
}),
|
|
155
|
-
placeholder: joi.string()
|
|
156
|
-
}),
|
|
157
|
-
defaultValue: joi.alternatives().try(joi.string().allow(''), joi.func()),
|
|
158
|
-
maxLength: joi.number(),
|
|
159
|
-
minLength: joi.number()
|
|
160
|
-
});
|
|
161
|
-
export const code = baseField.keys({
|
|
162
|
-
name: joi.string().required(),
|
|
163
|
-
type: joi.string().valid('code').required(),
|
|
164
|
-
admin: baseAdminFields.keys({
|
|
165
|
-
components: baseAdminComponentFields.keys({
|
|
166
|
-
Error: componentSchema,
|
|
167
|
-
Label: componentSchema
|
|
168
|
-
}),
|
|
169
|
-
editorOptions: joi.object().unknown(),
|
|
170
|
-
language: joi.string()
|
|
171
|
-
}),
|
|
172
|
-
defaultValue: joi.alternatives().try(joi.string().allow(''), joi.func())
|
|
173
|
-
});
|
|
174
|
-
export const json = baseField.keys({
|
|
175
|
-
name: joi.string().required(),
|
|
176
|
-
type: joi.string().valid('json').required(),
|
|
177
|
-
admin: baseAdminFields.keys({
|
|
178
|
-
components: baseAdminComponentFields.keys({
|
|
179
|
-
Error: componentSchema,
|
|
180
|
-
Label: componentSchema
|
|
181
|
-
}),
|
|
182
|
-
editorOptions: joi.object().unknown()
|
|
183
|
-
}),
|
|
184
|
-
defaultValue: joi.alternatives().try(joi.array(), joi.func(), joi.object()),
|
|
185
|
-
jsonSchema: joi.object().unknown()
|
|
186
|
-
});
|
|
187
|
-
export const select = baseField.keys({
|
|
188
|
-
name: joi.string().required(),
|
|
189
|
-
type: joi.string().valid('select').required(),
|
|
190
|
-
admin: baseAdminFields.keys({
|
|
191
|
-
components: baseAdminComponentFields.keys({
|
|
192
|
-
Error: componentSchema,
|
|
193
|
-
Label: componentSchema
|
|
194
|
-
}),
|
|
195
|
-
isClearable: joi.boolean().default(false),
|
|
196
|
-
isSortable: joi.boolean().default(false)
|
|
197
|
-
}),
|
|
198
|
-
dbName: joi.alternatives().try(joi.string(), joi.func()),
|
|
199
|
-
defaultValue: joi.alternatives().try(joi.string().allow(''), joi.array().items(joi.string().allow('')), joi.func()),
|
|
200
|
-
enumName: joi.alternatives().try(joi.string(), joi.func()),
|
|
201
|
-
hasMany: joi.boolean().default(false),
|
|
202
|
-
options: joi.array().min(1).items(joi.alternatives().try(joi.string(), joi.object({
|
|
203
|
-
label: joi.alternatives().try(joi.func(), joi.string(), joi.object().pattern(joi.string(), [
|
|
204
|
-
joi.string()
|
|
205
|
-
])),
|
|
206
|
-
value: joi.string().required().allow('')
|
|
207
|
-
}))).required()
|
|
208
|
-
});
|
|
209
|
-
export const radio = baseField.keys({
|
|
210
|
-
name: joi.string().required(),
|
|
211
|
-
type: joi.string().valid('radio').required(),
|
|
212
|
-
admin: baseAdminFields.keys({
|
|
213
|
-
components: baseAdminComponentFields.keys({
|
|
214
|
-
Error: componentSchema,
|
|
215
|
-
Label: componentSchema
|
|
216
|
-
}),
|
|
217
|
-
layout: joi.string().valid('vertical', 'horizontal')
|
|
218
|
-
}),
|
|
219
|
-
defaultValue: joi.alternatives().try(joi.string().allow(''), joi.func()),
|
|
220
|
-
enumName: joi.alternatives().try(joi.string(), joi.func()),
|
|
221
|
-
options: joi.array().min(1).items(joi.alternatives().try(joi.string(), joi.object({
|
|
222
|
-
label: joi.alternatives().try(joi.func(), joi.string(), joi.object().pattern(joi.string(), [
|
|
223
|
-
joi.string()
|
|
224
|
-
])).required(),
|
|
225
|
-
value: joi.string().required().allow('')
|
|
226
|
-
}))).required()
|
|
227
|
-
});
|
|
228
|
-
export const row = baseField.keys({
|
|
229
|
-
type: joi.string().valid('row').required(),
|
|
230
|
-
admin: baseAdminFields.default(),
|
|
231
|
-
fields: joi.array().items(joi.link('#field'))
|
|
232
|
-
});
|
|
233
|
-
export const collapsible = baseField.keys({
|
|
234
|
-
type: joi.string().valid('collapsible').required(),
|
|
235
|
-
admin: baseAdminFields.keys({
|
|
236
|
-
components: baseAdminComponentFields.keys({
|
|
237
|
-
RowLabel: componentSchema.optional()
|
|
238
|
-
}).default({})
|
|
239
|
-
}).default({}),
|
|
240
|
-
fields: joi.array().items(joi.link('#field')),
|
|
241
|
-
label: joi.alternatives().conditional('admin.components.RowLabel', {
|
|
242
|
-
is: joi.exist(),
|
|
243
|
-
otherwise: joi.alternatives().try(joi.string(), joi.object().pattern(joi.string(), [
|
|
244
|
-
joi.string()
|
|
245
|
-
]), joi.function()).required(),
|
|
246
|
-
then: joi.alternatives().try(joi.string(), joi.object().pattern(joi.string(), [
|
|
247
|
-
joi.string()
|
|
248
|
-
]), joi.function()).optional()
|
|
249
|
-
})
|
|
250
|
-
});
|
|
251
|
-
const tab = baseField.keys({
|
|
252
|
-
name: joi.string().when('localized', {
|
|
253
|
-
is: joi.exist(),
|
|
254
|
-
then: joi.required()
|
|
255
|
-
}),
|
|
256
|
-
description: joi.alternatives().try(joi.string(), componentSchema),
|
|
257
|
-
fields: joi.array().items(joi.link('#field')).required(),
|
|
258
|
-
interfaceName: joi.string().when('name', {
|
|
259
|
-
not: joi.exist(),
|
|
260
|
-
then: joi.forbidden()
|
|
261
|
-
}),
|
|
262
|
-
label: joi.alternatives().try(joi.string(), joi.object().pattern(joi.string(), [
|
|
263
|
-
joi.string()
|
|
264
|
-
])).when('name', {
|
|
265
|
-
is: joi.not(),
|
|
266
|
-
then: joi.required()
|
|
267
|
-
}),
|
|
268
|
-
localized: joi.boolean(),
|
|
269
|
-
saveToJWT: joi.alternatives().try(joi.boolean(), joi.string())
|
|
270
|
-
});
|
|
271
|
-
export const tabs = baseField.keys({
|
|
272
|
-
type: joi.string().valid('tabs').required(),
|
|
273
|
-
admin: baseAdminFields.keys({
|
|
274
|
-
description: joi.forbidden()
|
|
275
|
-
}),
|
|
276
|
-
fields: joi.forbidden(),
|
|
277
|
-
localized: joi.forbidden(),
|
|
278
|
-
tabs: joi.array().items(tab).required()
|
|
279
|
-
});
|
|
280
|
-
export const group = baseField.keys({
|
|
281
|
-
name: joi.string().required(),
|
|
282
|
-
type: joi.string().valid('group').required(),
|
|
283
|
-
admin: baseAdminFields.keys({
|
|
284
|
-
hideGutter: joi.boolean().default(true)
|
|
285
|
-
}),
|
|
286
|
-
defaultValue: joi.alternatives().try(joi.object(), joi.func()),
|
|
287
|
-
fields: joi.array().items(joi.link('#field')),
|
|
288
|
-
interfaceName: joi.string()
|
|
289
|
-
});
|
|
290
|
-
export const array = baseField.keys({
|
|
291
|
-
name: joi.string().required(),
|
|
292
|
-
type: joi.string().valid('array').required(),
|
|
293
|
-
admin: baseAdminFields.keys({
|
|
294
|
-
components: baseAdminComponentFields.keys({
|
|
295
|
-
RowLabel: componentSchema
|
|
296
|
-
}).default({}),
|
|
297
|
-
isSortable: joi.boolean()
|
|
298
|
-
}).default({}),
|
|
299
|
-
dbName: joi.alternatives().try(joi.string(), joi.func()),
|
|
300
|
-
defaultValue: joi.alternatives().try(joi.array().items(joi.object()), joi.func()),
|
|
301
|
-
fields: joi.array().items(joi.link('#field')).required(),
|
|
302
|
-
interfaceName: joi.string(),
|
|
303
|
-
labels: joi.object({
|
|
304
|
-
plural: joi.alternatives().try(joi.string(), joi.object().pattern(joi.string(), [
|
|
305
|
-
joi.string()
|
|
306
|
-
])),
|
|
307
|
-
singular: joi.alternatives().try(joi.string(), joi.object().pattern(joi.string(), [
|
|
308
|
-
joi.string()
|
|
309
|
-
]))
|
|
310
|
-
}),
|
|
311
|
-
maxRows: joi.number(),
|
|
312
|
-
minRows: joi.number()
|
|
313
|
-
});
|
|
314
|
-
export const upload = baseField.keys({
|
|
315
|
-
name: joi.string().required(),
|
|
316
|
-
type: joi.string().valid('upload').required(),
|
|
317
|
-
admin: baseAdminFields.keys({
|
|
318
|
-
components: baseAdminComponentFields.keys({
|
|
319
|
-
Error: componentSchema,
|
|
320
|
-
Label: componentSchema
|
|
321
|
-
})
|
|
322
|
-
}),
|
|
323
|
-
defaultValue: joi.alternatives().try(joi.object(), joi.func()),
|
|
324
|
-
filterOptions: joi.alternatives().try(joi.object(), joi.func()),
|
|
325
|
-
maxDepth: joi.number(),
|
|
326
|
-
relationTo: joi.string().required()
|
|
327
|
-
});
|
|
328
|
-
export const checkbox = baseField.keys({
|
|
329
|
-
name: joi.string().required(),
|
|
330
|
-
type: joi.string().valid('checkbox').required(),
|
|
331
|
-
admin: baseAdminFields.keys({
|
|
332
|
-
components: baseAdminComponentFields.keys({
|
|
333
|
-
Error: componentSchema,
|
|
334
|
-
Label: componentSchema,
|
|
335
|
-
afterInput: joi.array().items(componentSchema),
|
|
336
|
-
beforeInput: joi.array().items(componentSchema)
|
|
337
|
-
})
|
|
338
|
-
}),
|
|
339
|
-
defaultValue: joi.alternatives().try(joi.boolean(), joi.func())
|
|
340
|
-
});
|
|
341
|
-
export const point = baseField.keys({
|
|
342
|
-
name: joi.string().required(),
|
|
343
|
-
type: joi.string().valid('point').required(),
|
|
344
|
-
admin: baseAdminFields.keys({
|
|
345
|
-
components: baseAdminComponentFields.keys({
|
|
346
|
-
Error: componentSchema,
|
|
347
|
-
Label: componentSchema,
|
|
348
|
-
afterInput: joi.array().items(componentSchema),
|
|
349
|
-
beforeInput: joi.array().items(componentSchema)
|
|
350
|
-
})
|
|
351
|
-
}),
|
|
352
|
-
defaultValue: joi.alternatives().try(joi.array().items(joi.number()).max(2).min(2), joi.func())
|
|
353
|
-
});
|
|
354
|
-
export const relationship = baseField.keys({
|
|
355
|
-
name: joi.string().required(),
|
|
356
|
-
type: joi.string().valid('relationship').required(),
|
|
357
|
-
admin: baseAdminFields.keys({
|
|
358
|
-
allowCreate: joi.boolean().default(true),
|
|
359
|
-
components: baseAdminComponentFields.keys({
|
|
360
|
-
Error: componentSchema,
|
|
361
|
-
Label: componentSchema
|
|
362
|
-
}),
|
|
363
|
-
isSortable: joi.boolean().default(false),
|
|
364
|
-
sortOptions: joi.alternatives().conditional(joi.ref('...relationTo'), {
|
|
365
|
-
is: joi.string(),
|
|
366
|
-
otherwise: joi.object().pattern(joi.string(), joi.string()),
|
|
367
|
-
then: joi.string()
|
|
368
|
-
})
|
|
369
|
-
}),
|
|
370
|
-
defaultValue: joi.alternatives().try(joi.func()),
|
|
371
|
-
filterOptions: joi.alternatives().try(joi.object(), joi.func()),
|
|
372
|
-
hasMany: joi.boolean().default(false),
|
|
373
|
-
max: joi.number().when('hasMany', {
|
|
374
|
-
is: joi.not(true),
|
|
375
|
-
then: joi.forbidden()
|
|
376
|
-
}).warning('deprecated', {
|
|
377
|
-
message: 'Use maxRows instead.'
|
|
378
|
-
}),
|
|
379
|
-
maxDepth: joi.number(),
|
|
380
|
-
maxRows: joi.number().when('hasMany', {
|
|
381
|
-
is: joi.not(true),
|
|
382
|
-
then: joi.forbidden()
|
|
383
|
-
}),
|
|
384
|
-
min: joi.number().when('hasMany', {
|
|
385
|
-
is: joi.not(true),
|
|
386
|
-
then: joi.forbidden()
|
|
387
|
-
}).warning('deprecated', {
|
|
388
|
-
message: 'Use minRows instead.'
|
|
389
|
-
}),
|
|
390
|
-
minRows: joi.number().when('hasMany', {
|
|
391
|
-
is: joi.not(true),
|
|
392
|
-
then: joi.forbidden()
|
|
393
|
-
}),
|
|
394
|
-
relationTo: joi.alternatives().try(joi.string().required(), joi.array().items(joi.string()))
|
|
395
|
-
});
|
|
396
|
-
export const blocks = baseField.keys({
|
|
397
|
-
name: joi.string().required(),
|
|
398
|
-
type: joi.string().valid('blocks').required(),
|
|
399
|
-
admin: baseAdminFields.keys({
|
|
400
|
-
isSortable: joi.boolean()
|
|
401
|
-
}).default({}),
|
|
402
|
-
blocks: joi.array().items(joi.object({
|
|
403
|
-
slug: joi.string().required(),
|
|
404
|
-
admin: joi.object().keys({
|
|
405
|
-
components: joi.object().keys({
|
|
406
|
-
Label: componentSchema
|
|
407
|
-
}),
|
|
408
|
-
custom: joi.object().pattern(joi.string(), joi.any())
|
|
409
|
-
}),
|
|
410
|
-
custom: joi.object().pattern(joi.string(), joi.any()),
|
|
411
|
-
dbName: joi.alternatives().try(joi.string(), joi.func()),
|
|
412
|
-
fields: joi.array().items(joi.link('#field')),
|
|
413
|
-
graphQL: joi.object().keys({
|
|
414
|
-
singularName: joi.string()
|
|
415
|
-
}),
|
|
416
|
-
imageAltText: joi.string(),
|
|
417
|
-
imageURL: joi.string(),
|
|
418
|
-
interfaceName: joi.string(),
|
|
419
|
-
labels: joi.object({
|
|
420
|
-
plural: joi.alternatives().try(joi.string(), joi.object().pattern(joi.string(), [
|
|
421
|
-
joi.string()
|
|
422
|
-
])),
|
|
423
|
-
singular: joi.alternatives().try(joi.string(), joi.object().pattern(joi.string(), [
|
|
424
|
-
joi.string()
|
|
425
|
-
]))
|
|
426
|
-
})
|
|
427
|
-
})).required(),
|
|
428
|
-
defaultValue: joi.alternatives().try(joi.array().items(joi.object()), joi.func()),
|
|
429
|
-
labels: joi.object({
|
|
430
|
-
plural: joi.alternatives().try(joi.string(), joi.object().pattern(joi.string(), [
|
|
431
|
-
joi.string()
|
|
432
|
-
])),
|
|
433
|
-
singular: joi.alternatives().try(joi.string(), joi.object().pattern(joi.string(), [
|
|
434
|
-
joi.string()
|
|
435
|
-
]))
|
|
436
|
-
}),
|
|
437
|
-
maxRows: joi.number(),
|
|
438
|
-
minRows: joi.number()
|
|
439
|
-
});
|
|
440
|
-
export const richText = baseField.keys({
|
|
441
|
-
name: joi.string().required(),
|
|
442
|
-
type: joi.string().valid('richText').required(),
|
|
443
|
-
admin: baseAdminFields.keys({
|
|
444
|
-
components: baseAdminComponentFields.keys({
|
|
445
|
-
Error: componentSchema,
|
|
446
|
-
Label: componentSchema
|
|
447
|
-
})
|
|
448
|
-
}),
|
|
449
|
-
defaultValue: joi.alternatives().try(joi.array().items(joi.object()), joi.func(), joi.object()),
|
|
450
|
-
editor: joi.object().keys({
|
|
451
|
-
CellComponent: componentSchema.optional(),
|
|
452
|
-
FieldComponent: componentSchema.optional(),
|
|
453
|
-
afterReadPromise: joi.func().optional(),
|
|
454
|
-
graphQLPopulationPromises: joi.func().optional(),
|
|
455
|
-
outputSchema: joi.func().optional(),
|
|
456
|
-
validate: joi.func().required()
|
|
457
|
-
}).unknown(),
|
|
458
|
-
maxDepth: joi.number()
|
|
459
|
-
});
|
|
460
|
-
export const date = baseField.keys({
|
|
461
|
-
name: joi.string().required(),
|
|
462
|
-
type: joi.string().valid('date').required(),
|
|
463
|
-
admin: baseAdminFields.keys({
|
|
464
|
-
components: baseAdminComponentFields.keys({
|
|
465
|
-
Error: componentSchema,
|
|
466
|
-
Label: componentSchema,
|
|
467
|
-
afterInput: joi.array().items(componentSchema),
|
|
468
|
-
beforeInput: joi.array().items(componentSchema)
|
|
469
|
-
}),
|
|
470
|
-
date: joi.object({
|
|
471
|
-
displayFormat: joi.string(),
|
|
472
|
-
maxDate: joi.date(),
|
|
473
|
-
maxTime: joi.date(),
|
|
474
|
-
minDate: joi.date(),
|
|
475
|
-
minTime: joi.date(),
|
|
476
|
-
monthsToShow: joi.number(),
|
|
477
|
-
overrides: joi.object().unknown(),
|
|
478
|
-
pickerAppearance: joi.string(),
|
|
479
|
-
timeFormat: joi.string(),
|
|
480
|
-
timeIntervals: joi.number()
|
|
481
|
-
}),
|
|
482
|
-
placeholder: joi.string()
|
|
483
|
-
}),
|
|
484
|
-
defaultValue: joi.alternatives().try(joi.string(), joi.func())
|
|
485
|
-
});
|
|
486
|
-
export const ui = joi.object().keys({
|
|
487
|
-
name: joi.string().required(),
|
|
488
|
-
type: joi.string().valid('ui').required(),
|
|
489
|
-
admin: joi.object().keys({
|
|
490
|
-
components: joi.object().keys({
|
|
491
|
-
Cell: componentSchema,
|
|
492
|
-
Field: componentSchema
|
|
493
|
-
}).default({}),
|
|
494
|
-
condition: joi.func(),
|
|
495
|
-
custom: joi.object().pattern(joi.string(), joi.any()),
|
|
496
|
-
disableListColumn: joi.boolean().default(false),
|
|
497
|
-
position: joi.string().valid('sidebar'),
|
|
498
|
-
width: joi.string()
|
|
499
|
-
}).default(),
|
|
500
|
-
custom: joi.object().pattern(joi.string(), joi.any()),
|
|
501
|
-
label: joi.alternatives().try(joi.string(), joi.object().pattern(joi.string(), [
|
|
502
|
-
joi.string()
|
|
503
|
-
]))
|
|
504
|
-
});
|
|
505
|
-
const fieldSchema = joi.alternatives().try(text, number, textarea, email, code, json, select, group, array, row, collapsible, tabs, radio, relationship, checkbox, upload, richText, blocks, date, point, ui).id('field');
|
|
506
|
-
export default fieldSchema;
|
|
507
|
-
|
|
508
|
-
//# sourceMappingURL=schema.js.map
|