@webiny/api-headless-cms 0.0.0-unstable.c2780f51fe → 0.0.0-unstable.c59b9cc5b9
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/crud/contentEntry/referenceFieldsMapping.js +34 -5
- package/crud/contentEntry/referenceFieldsMapping.js.map +1 -1
- package/crud/contentEntry.crud.d.ts +4 -4
- package/crud/contentEntry.crud.js +183 -18
- package/crud/contentEntry.crud.js.map +1 -1
- package/crud/contentModelGroup.crud.js +1 -7
- package/crud/contentModelGroup.crud.js.map +1 -1
- package/graphql/schema/baseSchema.js +15 -0
- package/graphql/schema/baseSchema.js.map +1 -1
- package/graphql/schema/createFieldResolvers.d.ts +1 -1
- package/graphql/schema/createFieldResolvers.js +6 -12
- package/graphql/schema/createFieldResolvers.js.map +1 -1
- package/graphql/schema/createFieldTypePluginRecords.d.ts +3 -0
- package/graphql/schema/createFieldTypePluginRecords.js +13 -0
- package/graphql/schema/createFieldTypePluginRecords.js.map +1 -0
- package/graphql/schema/createManageResolvers.js +4 -0
- package/graphql/schema/createManageResolvers.js.map +1 -1
- package/graphql/schema/createManageSDL.js +34 -26
- package/graphql/schema/createManageSDL.js.map +1 -1
- package/graphql/schema/createReadSDL.js +22 -19
- package/graphql/schema/createReadSDL.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveDelete.d.ts +2 -1
- package/graphql/schema/resolvers/manage/resolveDelete.js +13 -3
- package/graphql/schema/resolvers/manage/resolveDelete.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveDeleteMultiple.d.ts +7 -0
- package/graphql/schema/resolvers/manage/resolveDeleteMultiple.js +20 -0
- package/graphql/schema/resolvers/manage/resolveDeleteMultiple.js.map +1 -0
- package/graphql/schema/resolvers/manage/resolveGetUniqueFieldValues.d.ts +4 -0
- package/graphql/schema/resolvers/manage/resolveGetUniqueFieldValues.js +18 -0
- package/graphql/schema/resolvers/manage/resolveGetUniqueFieldValues.js.map +1 -0
- package/graphql/schema/schemaPlugins.js +2 -11
- package/graphql/schema/schemaPlugins.js.map +1 -1
- package/graphqlFields/dynamicZone/dynamicZoneField.js +43 -28
- package/graphqlFields/dynamicZone/dynamicZoneField.js.map +1 -1
- package/graphqlFields/object.js.map +1 -1
- package/package.json +35 -35
- package/plugins/CmsModelPlugin.d.ts +3 -1
- package/plugins/CmsModelPlugin.js.map +1 -1
- package/types.d.ts +82 -31
- package/types.js +11 -0
- package/types.js.map +1 -1
- package/utils/converters/valueKeyStorageConverter.js +5 -2
- package/utils/converters/valueKeyStorageConverter.js.map +1 -1
- package/utils/getBaseFieldType.d.ts +1 -3
- package/utils/getBaseFieldType.js.map +1 -1
- package/utils/getEntryDescription.d.ts +1 -1
- package/utils/getEntryDescription.js.map +1 -1
- package/utils/getEntryImage.d.ts +1 -1
- package/utils/getEntryImage.js.map +1 -1
- package/utils/getEntryTitle.d.ts +1 -1
- package/utils/getEntryTitle.js.map +1 -1
- package/utils/renderFields.d.ts +2 -1
- package/utils/renderFields.js +2 -1
- package/utils/renderFields.js.map +1 -1
- package/utils/renderGetFilterFields.d.ts +2 -2
- package/utils/renderGetFilterFields.js +7 -20
- package/utils/renderGetFilterFields.js.map +1 -1
- package/utils/renderInputFields.d.ts +2 -1
- package/utils/renderInputFields.js +14 -6
- package/utils/renderInputFields.js.map +1 -1
- package/utils/renderListFilterFields.d.ts +2 -1
- package/utils/renderListFilterFields.js +9 -20
- package/utils/renderListFilterFields.js.map +1 -1
- package/utils/renderSortEnum.d.ts +2 -1
- package/utils/renderSortEnum.js +2 -1
- package/utils/renderSortEnum.js.map +1 -1
- package/crud/contentModel/createFieldModels.d.ts +0 -2
- package/crud/contentModel/createFieldModels.js +0 -26
- package/crud/contentModel/createFieldModels.js.map +0 -1
- package/crud/contentModel/fieldIdValidation.d.ts +0 -1
- package/crud/contentModel/fieldIdValidation.js +0 -25
- package/crud/contentModel/fieldIdValidation.js.map +0 -1
- package/crud/contentModel/idValidation.d.ts +0 -1
- package/crud/contentModel/idValidation.js +0 -22
- package/crud/contentModel/idValidation.js.map +0 -1
- package/crud/contentModel/models.d.ts +0 -4
- package/crud/contentModel/models.js +0 -192
- package/crud/contentModel/models.js.map +0 -1
- package/crud/contentModel/systemFields.d.ts +0 -1
- package/crud/contentModel/systemFields.js +0 -8
- package/crud/contentModel/systemFields.js.map +0 -1
- package/upgrades/5.33.0/index.d.ts +0 -3
- package/upgrades/5.33.0/index.js +0 -182
- package/upgrades/5.33.0/index.js.map +0 -1
- package/upgrades/index.d.ts +0 -1
- package/upgrades/index.js +0 -12
- package/upgrades/index.js.map +0 -1
- package/utils/pluralizedTypeName.d.ts +0 -1
- package/utils/pluralizedTypeName.js +0 -26
- package/utils/pluralizedTypeName.js.map +0 -1
|
@@ -5,41 +5,28 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.renderGetFilterFields = void 0;
|
|
7
7
|
var _getBaseFieldType = require("./getBaseFieldType");
|
|
8
|
-
const getCreateFilters = (plugins, fieldType) => {
|
|
9
|
-
if (!plugins[fieldType] || !plugins[fieldType].read.createGetFilters) {
|
|
10
|
-
return null;
|
|
11
|
-
}
|
|
12
|
-
return plugins[fieldType].read.createGetFilters;
|
|
13
|
-
};
|
|
14
8
|
const renderGetFilterFields = ({
|
|
15
|
-
|
|
9
|
+
fields,
|
|
16
10
|
fieldTypePlugins
|
|
17
11
|
}) => {
|
|
18
|
-
const
|
|
12
|
+
const filters = ["id: ID", "entryId: String"];
|
|
13
|
+
for (const field of fields) {
|
|
14
|
+
var _plugin$read;
|
|
19
15
|
// Every time a client updates content model's fields, we check the type of each field. If a field plugin
|
|
20
16
|
// for a particular "field.type" doesn't exist on the backend yet, we throw an error. But still, we also
|
|
21
17
|
// want to be careful when accessing the field plugin here too. It is still possible to have a content model
|
|
22
18
|
// that contains a field, for which we don't have a plugin registered on the backend. For example, user
|
|
23
19
|
// could've just removed the plugin from the backend.
|
|
24
20
|
const baseType = (0, _getBaseFieldType.getBaseFieldType)(field);
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
return fieldTypePlugins[baseType].isSearchable;
|
|
29
|
-
}).map(f => f.fieldId);
|
|
30
|
-
const filters = ["id: ID", "entryId: String"];
|
|
31
|
-
for (const fieldId of fieldIdList) {
|
|
32
|
-
const field = model.fields.find(item => item.fieldId === fieldId);
|
|
33
|
-
if (!field) {
|
|
21
|
+
const plugin = fieldTypePlugins[baseType];
|
|
22
|
+
if (!(plugin !== null && plugin !== void 0 && plugin.isSearchable)) {
|
|
34
23
|
continue;
|
|
35
24
|
}
|
|
36
|
-
const
|
|
37
|
-
const createGetFilters = getCreateFilters(fieldTypePlugins, baseType);
|
|
25
|
+
const createGetFilters = (_plugin$read = plugin.read) === null || _plugin$read === void 0 ? void 0 : _plugin$read.createGetFilters;
|
|
38
26
|
if (typeof createGetFilters !== "function") {
|
|
39
27
|
continue;
|
|
40
28
|
}
|
|
41
29
|
filters.push(createGetFilters({
|
|
42
|
-
model,
|
|
43
30
|
field
|
|
44
31
|
}));
|
|
45
32
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["renderGetFilterFields","fields","fieldTypePlugins","filters","field","baseType","getBaseFieldType","plugin","isSearchable","createGetFilters","read","push","filter","Boolean","join"],"sources":["renderGetFilterFields.ts"],"sourcesContent":["import { CmsFieldTypePlugins, CmsModelField } from \"~/types\";\nimport { getBaseFieldType } from \"~/utils/getBaseFieldType\";\n\ninterface RenderGetFilterFieldsParams {\n fields: CmsModelField[];\n fieldTypePlugins: CmsFieldTypePlugins;\n}\ninterface RenderGetFilterFields {\n (params: RenderGetFilterFieldsParams): string;\n}\n\nexport const renderGetFilterFields: RenderGetFilterFields = ({ fields, fieldTypePlugins }) => {\n const filters: string[] = [\"id: ID\", \"entryId: String\"];\n\n for (const field of fields) {\n // Every time a client updates content model's fields, we check the type of each field. If a field plugin\n // for a particular \"field.type\" doesn't exist on the backend yet, we throw an error. But still, we also\n // want to be careful when accessing the field plugin here too. It is still possible to have a content model\n // that contains a field, for which we don't have a plugin registered on the backend. For example, user\n // could've just removed the plugin from the backend.\n const baseType = getBaseFieldType(field);\n const plugin = fieldTypePlugins[baseType];\n if (!plugin?.isSearchable) {\n continue;\n }\n const createGetFilters = plugin.read?.createGetFilters;\n if (typeof createGetFilters !== \"function\") {\n continue;\n }\n filters.push(createGetFilters({ field }));\n }\n\n return filters.filter(Boolean).join(\"\\n\");\n};\n"],"mappings":";;;;;;AACA;AAUO,MAAMA,qBAA4C,GAAG,CAAC;EAAEC,MAAM;EAAEC;AAAiB,CAAC,KAAK;EAC1F,MAAMC,OAAiB,GAAG,CAAC,QAAQ,EAAE,iBAAiB,CAAC;EAEvD,KAAK,MAAMC,KAAK,IAAIH,MAAM,EAAE;IAAA;IACxB;IACA;IACA;IACA;IACA;IACA,MAAMI,QAAQ,GAAG,IAAAC,kCAAgB,EAACF,KAAK,CAAC;IACxC,MAAMG,MAAM,GAAGL,gBAAgB,CAACG,QAAQ,CAAC;IACzC,IAAI,EAACE,MAAM,aAANA,MAAM,eAANA,MAAM,CAAEC,YAAY,GAAE;MACvB;IACJ;IACA,MAAMC,gBAAgB,mBAAGF,MAAM,CAACG,IAAI,iDAAX,aAAaD,gBAAgB;IACtD,IAAI,OAAOA,gBAAgB,KAAK,UAAU,EAAE;MACxC;IACJ;IACAN,OAAO,CAACQ,IAAI,CAACF,gBAAgB,CAAC;MAAEL;IAAM,CAAC,CAAC,CAAC;EAC7C;EAEA,OAAOD,OAAO,CAACS,MAAM,CAACC,OAAO,CAAC,CAACC,IAAI,CAAC,IAAI,CAAC;AAC7C,CAAC;AAAC"}
|
|
@@ -2,9 +2,10 @@ import { CmsFieldTypePlugins, CmsModel, CmsModelField, CmsModelFieldDefinition }
|
|
|
2
2
|
interface RenderInputFieldsParams {
|
|
3
3
|
models: CmsModel[];
|
|
4
4
|
model: CmsModel;
|
|
5
|
+
fields: CmsModelField[];
|
|
5
6
|
fieldTypePlugins: CmsFieldTypePlugins;
|
|
6
7
|
}
|
|
7
|
-
interface RenderInputFieldParams extends RenderInputFieldsParams {
|
|
8
|
+
interface RenderInputFieldParams extends Omit<RenderInputFieldsParams, "fields"> {
|
|
8
9
|
field: CmsModelField;
|
|
9
10
|
}
|
|
10
11
|
interface RenderInputFields {
|
|
@@ -8,14 +8,22 @@ var _getBaseFieldType = require("./getBaseFieldType");
|
|
|
8
8
|
const renderInputFields = ({
|
|
9
9
|
models,
|
|
10
10
|
model,
|
|
11
|
+
fields,
|
|
11
12
|
fieldTypePlugins
|
|
12
13
|
}) => {
|
|
13
|
-
return
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
return fields.reduce((result, field) => {
|
|
15
|
+
const input = renderInputField({
|
|
16
|
+
models,
|
|
17
|
+
model,
|
|
18
|
+
field,
|
|
19
|
+
fieldTypePlugins
|
|
20
|
+
});
|
|
21
|
+
if (!input) {
|
|
22
|
+
return result;
|
|
23
|
+
}
|
|
24
|
+
result.push(input);
|
|
25
|
+
return result;
|
|
26
|
+
}, []);
|
|
19
27
|
};
|
|
20
28
|
exports.renderInputFields = renderInputFields;
|
|
21
29
|
const renderInputField = ({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["renderInputFields","models","model","fieldTypePlugins","
|
|
1
|
+
{"version":3,"names":["renderInputFields","models","model","fields","fieldTypePlugins","reduce","result","field","input","renderInputField","push","plugin","getBaseFieldType","def","manage","createInputField"],"sources":["renderInputFields.ts"],"sourcesContent":["import { CmsFieldTypePlugins, CmsModel, CmsModelField, CmsModelFieldDefinition } from \"~/types\";\nimport { getBaseFieldType } from \"~/utils/getBaseFieldType\";\n\ninterface RenderInputFieldsParams {\n models: CmsModel[];\n model: CmsModel;\n fields: CmsModelField[];\n fieldTypePlugins: CmsFieldTypePlugins;\n}\n\ninterface RenderInputFieldParams extends Omit<RenderInputFieldsParams, \"fields\"> {\n field: CmsModelField;\n}\n\ninterface RenderInputFields {\n (params: RenderInputFieldsParams): CmsModelFieldDefinition[];\n}\n\nexport const renderInputFields: RenderInputFields = ({\n models,\n model,\n fields,\n fieldTypePlugins\n}): CmsModelFieldDefinition[] => {\n return fields.reduce<CmsModelFieldDefinition[]>((result, field) => {\n const input = renderInputField({ models, model, field, fieldTypePlugins });\n if (!input) {\n return result;\n }\n result.push(input);\n return result;\n }, []);\n};\n\nexport const renderInputField = ({\n models,\n model,\n field,\n fieldTypePlugins\n}: RenderInputFieldParams): CmsModelFieldDefinition | null => {\n // Every time a client updates content model's fields, we check the type of each field. If a field plugin\n // for a particular \"field.type\" doesn't exist on the backend yet, we throw an error. But still, we also\n // want to be careful when accessing the field plugin here too. It is still possible to have a content model\n // that contains a field, for which we don't have a plugin registered on the backend. For example, user\n // could've just removed the plugin from the backend.\n const plugin = fieldTypePlugins[getBaseFieldType(field)];\n\n if (!plugin) {\n // Let's not render the field if it does not exist in the field plugins.\n return null;\n }\n\n const def = plugin.manage.createInputField({\n models,\n model,\n field,\n fieldTypePlugins\n });\n if (typeof def === \"string\") {\n return {\n fields: def\n };\n }\n\n return def;\n};\n"],"mappings":";;;;;;AACA;AAiBO,MAAMA,iBAAoC,GAAG,CAAC;EACjDC,MAAM;EACNC,KAAK;EACLC,MAAM;EACNC;AACJ,CAAC,KAAgC;EAC7B,OAAOD,MAAM,CAACE,MAAM,CAA4B,CAACC,MAAM,EAAEC,KAAK,KAAK;IAC/D,MAAMC,KAAK,GAAGC,gBAAgB,CAAC;MAAER,MAAM;MAAEC,KAAK;MAAEK,KAAK;MAAEH;IAAiB,CAAC,CAAC;IAC1E,IAAI,CAACI,KAAK,EAAE;MACR,OAAOF,MAAM;IACjB;IACAA,MAAM,CAACI,IAAI,CAACF,KAAK,CAAC;IAClB,OAAOF,MAAM;EACjB,CAAC,EAAE,EAAE,CAAC;AACV,CAAC;AAAC;AAEK,MAAMG,gBAAgB,GAAG,CAAC;EAC7BR,MAAM;EACNC,KAAK;EACLK,KAAK;EACLH;AACoB,CAAC,KAAqC;EAC1D;EACA;EACA;EACA;EACA;EACA,MAAMO,MAAM,GAAGP,gBAAgB,CAAC,IAAAQ,kCAAgB,EAACL,KAAK,CAAC,CAAC;EAExD,IAAI,CAACI,MAAM,EAAE;IACT;IACA,OAAO,IAAI;EACf;EAEA,MAAME,GAAG,GAAGF,MAAM,CAACG,MAAM,CAACC,gBAAgB,CAAC;IACvCd,MAAM;IACNC,KAAK;IACLK,KAAK;IACLH;EACJ,CAAC,CAAC;EACF,IAAI,OAAOS,GAAG,KAAK,QAAQ,EAAE;IACzB,OAAO;MACHV,MAAM,EAAEU;IACZ,CAAC;EACL;EAEA,OAAOA,GAAG;AACd,CAAC;AAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { ApiEndpoint, CmsFieldTypePlugins, CmsModel } from "../types";
|
|
1
|
+
import { ApiEndpoint, CmsFieldTypePlugins, CmsModel, CmsModelField } from "../types";
|
|
2
2
|
interface RenderListFilterFieldsParams {
|
|
3
3
|
model: CmsModel;
|
|
4
|
+
fields: CmsModelField[];
|
|
4
5
|
type: ApiEndpoint;
|
|
5
6
|
fieldTypePlugins: CmsFieldTypePlugins;
|
|
6
7
|
}
|
|
@@ -5,49 +5,38 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.renderListFilterFields = void 0;
|
|
7
7
|
var _getBaseFieldType = require("./getBaseFieldType");
|
|
8
|
-
/**
|
|
9
|
-
* We cast as read type, because input and output of read and manage are same. This way we ease things.
|
|
10
|
-
* Internal stuff so it should be ok.
|
|
11
|
-
* TODO note that if changing read/manage types, change this as well.
|
|
12
|
-
*/
|
|
13
|
-
const getCreateListFilters = (plugins, fieldType, type) => {
|
|
14
|
-
if (!plugins[fieldType]) {
|
|
15
|
-
return null;
|
|
16
|
-
} else if (!plugins[fieldType][type]) {
|
|
17
|
-
return null;
|
|
18
|
-
}
|
|
19
|
-
return plugins[fieldType][type].createListFilters;
|
|
20
|
-
};
|
|
21
8
|
const renderListFilterFields = params => {
|
|
22
9
|
const {
|
|
23
10
|
model,
|
|
11
|
+
fields,
|
|
24
12
|
type,
|
|
25
13
|
fieldTypePlugins
|
|
26
14
|
} = params;
|
|
27
|
-
const
|
|
15
|
+
const result = [["id: ID", "id_not: ID", "id_in: [ID!]", "id_not_in: [ID!]", "entryId: String", "entryId_not: String", "entryId_in: [String!]", "entryId_not_in: [String!]", "createdOn: DateTime", "createdOn_gt: DateTime", "createdOn_gte: DateTime", "createdOn_lt: DateTime", "createdOn_lte: DateTime", "createdOn_between: [DateTime!]", "createdOn_not_between: [DateTime!]", "savedOn: DateTime", "savedOn_gt: DateTime", "savedOn_gte: DateTime", "savedOn_lt: DateTime", "savedOn_lte: DateTime", "savedOn_between: [DateTime!]", "savedOn_not_between: [DateTime!]", "createdBy: String", "createdBy_not: String", "createdBy_in: [String!]", "createdBy_not_in: [String!]", "ownedBy: String", "ownedBy_not: String", "ownedBy_in: [String!]", "ownedBy_not_in: [String!]"].join("\n")];
|
|
28
16
|
/**
|
|
29
17
|
* We can find different statuses only in the manage API endpoint.
|
|
30
18
|
*/
|
|
31
19
|
if (type === "manage") {
|
|
32
|
-
|
|
20
|
+
result.push("status: String", "status_not: String", "status_in: [String!]", "status_not_in: [String!]");
|
|
33
21
|
}
|
|
34
|
-
for (const field of
|
|
22
|
+
for (const field of fields) {
|
|
23
|
+
var _fieldTypePlugins$bas, _fieldTypePlugins$bas2;
|
|
35
24
|
// Every time a client updates content model's fields, we check the type of each field. If a field plugin
|
|
36
25
|
// for a particular "field.type" doesn't exist on the backend yet, we throw an error. But still, we also
|
|
37
26
|
// want to be careful when accessing the field plugin here too. It is still possible to have a content model
|
|
38
27
|
// that contains a field, for which we don't have a plugin registered on the backend. For example, user
|
|
39
28
|
// could've just removed the plugin from the backend.
|
|
40
|
-
|
|
41
|
-
const createListFilters =
|
|
29
|
+
const baseType = (0, _getBaseFieldType.getBaseFieldType)(field);
|
|
30
|
+
const createListFilters = (_fieldTypePlugins$bas = fieldTypePlugins[baseType]) === null || _fieldTypePlugins$bas === void 0 ? void 0 : (_fieldTypePlugins$bas2 = _fieldTypePlugins$bas[type]) === null || _fieldTypePlugins$bas2 === void 0 ? void 0 : _fieldTypePlugins$bas2.createListFilters;
|
|
42
31
|
if (typeof createListFilters !== "function") {
|
|
43
32
|
continue;
|
|
44
33
|
}
|
|
45
|
-
|
|
34
|
+
result.push(createListFilters({
|
|
46
35
|
model,
|
|
47
36
|
field,
|
|
48
37
|
plugins: fieldTypePlugins
|
|
49
38
|
}));
|
|
50
39
|
}
|
|
51
|
-
return
|
|
40
|
+
return result.filter(Boolean).join("\n");
|
|
52
41
|
};
|
|
53
42
|
exports.renderListFilterFields = renderListFilterFields;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["renderListFilterFields","params","model","fields","type","fieldTypePlugins","result","join","push","field","baseType","getBaseFieldType","createListFilters","plugins","filter","Boolean"],"sources":["renderListFilterFields.ts"],"sourcesContent":["import {\n ApiEndpoint,\n CmsFieldTypePlugins,\n CmsModel,\n CmsModelField,\n CmsModelFieldToGraphQLPlugin\n} from \"~/types\";\nimport { getBaseFieldType } from \"~/utils/getBaseFieldType\";\n\ninterface RenderListFilterFieldsParams {\n model: CmsModel;\n fields: CmsModelField[];\n type: ApiEndpoint;\n fieldTypePlugins: CmsFieldTypePlugins;\n}\ninterface RenderListFilterFields {\n (params: RenderListFilterFieldsParams): string;\n}\n\ntype CreateListFiltersType =\n | CmsModelFieldToGraphQLPlugin[\"read\"][\"createListFilters\"]\n | CmsModelFieldToGraphQLPlugin[\"manage\"][\"createListFilters\"];\n\nexport const renderListFilterFields: RenderListFilterFields = (params): string => {\n const { model, fields, type, fieldTypePlugins } = params;\n const result: string[] = [\n [\n \"id: ID\",\n \"id_not: ID\",\n \"id_in: [ID!]\",\n \"id_not_in: [ID!]\",\n \"entryId: String\",\n \"entryId_not: String\",\n \"entryId_in: [String!]\",\n \"entryId_not_in: [String!]\",\n \"createdOn: DateTime\",\n \"createdOn_gt: DateTime\",\n \"createdOn_gte: DateTime\",\n \"createdOn_lt: DateTime\",\n \"createdOn_lte: DateTime\",\n \"createdOn_between: [DateTime!]\",\n \"createdOn_not_between: [DateTime!]\",\n \"savedOn: DateTime\",\n \"savedOn_gt: DateTime\",\n \"savedOn_gte: DateTime\",\n \"savedOn_lt: DateTime\",\n \"savedOn_lte: DateTime\",\n \"savedOn_between: [DateTime!]\",\n \"savedOn_not_between: [DateTime!]\",\n \"createdBy: String\",\n \"createdBy_not: String\",\n \"createdBy_in: [String!]\",\n \"createdBy_not_in: [String!]\",\n \"ownedBy: String\",\n \"ownedBy_not: String\",\n \"ownedBy_in: [String!]\",\n \"ownedBy_not_in: [String!]\"\n ].join(\"\\n\")\n ];\n /**\n * We can find different statuses only in the manage API endpoint.\n */\n if (type === \"manage\") {\n result.push(\n \"status: String\",\n \"status_not: String\",\n \"status_in: [String!]\",\n \"status_not_in: [String!]\"\n );\n }\n\n for (const field of fields) {\n // Every time a client updates content model's fields, we check the type of each field. If a field plugin\n // for a particular \"field.type\" doesn't exist on the backend yet, we throw an error. But still, we also\n // want to be careful when accessing the field plugin here too. It is still possible to have a content model\n // that contains a field, for which we don't have a plugin registered on the backend. For example, user\n // could've just removed the plugin from the backend.\n const baseType = getBaseFieldType(field);\n const createListFilters: CreateListFiltersType | undefined =\n fieldTypePlugins[baseType]?.[type]?.createListFilters;\n if (typeof createListFilters !== \"function\") {\n continue;\n }\n result.push(createListFilters({ model, field, plugins: fieldTypePlugins }));\n }\n\n return result.filter(Boolean).join(\"\\n\");\n};\n"],"mappings":";;;;;;AAOA;AAgBO,MAAMA,sBAA8C,GAAIC,MAAM,IAAa;EAC9E,MAAM;IAAEC,KAAK;IAAEC,MAAM;IAAEC,IAAI;IAAEC;EAAiB,CAAC,GAAGJ,MAAM;EACxD,MAAMK,MAAgB,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|
|
1
|
+
import { CmsFieldTypePlugins, CmsModel, CmsModelField } from "../types";
|
|
2
2
|
import { CmsGraphQLSchemaSorterPlugin } from "../plugins/CmsGraphQLSchemaSorterPlugin";
|
|
3
3
|
interface RenderSortEnumParams {
|
|
4
4
|
model: CmsModel;
|
|
5
|
+
fields: CmsModelField[];
|
|
5
6
|
fieldTypePlugins: CmsFieldTypePlugins;
|
|
6
7
|
sorterPlugins: CmsGraphQLSchemaSorterPlugin[];
|
|
7
8
|
}
|
package/utils/renderSortEnum.js
CHANGED
|
@@ -7,11 +7,12 @@ exports.renderSortEnum = void 0;
|
|
|
7
7
|
var _getBaseFieldType = require("./getBaseFieldType");
|
|
8
8
|
const renderSortEnum = ({
|
|
9
9
|
model,
|
|
10
|
+
fields,
|
|
10
11
|
fieldTypePlugins,
|
|
11
12
|
sorterPlugins
|
|
12
13
|
}) => {
|
|
13
14
|
let sorters = [`id_ASC`, `id_DESC`, "savedOn_ASC", "savedOn_DESC", "createdOn_ASC", "createdOn_DESC"];
|
|
14
|
-
for (const field of
|
|
15
|
+
for (const field of fields) {
|
|
15
16
|
const plugin = fieldTypePlugins[(0, _getBaseFieldType.getBaseFieldType)(field)];
|
|
16
17
|
if (!plugin) {
|
|
17
18
|
continue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["renderSortEnum","model","fieldTypePlugins","sorterPlugins","sorters","field","
|
|
1
|
+
{"version":3,"names":["renderSortEnum","model","fields","fieldTypePlugins","sorterPlugins","sorters","field","plugin","getBaseFieldType","createSorters","result","isSortable","push","fieldId","reduce","createSorter","join"],"sources":["renderSortEnum.ts"],"sourcesContent":["import { CmsFieldTypePlugins, CmsModel, CmsModelField } from \"~/types\";\nimport { getBaseFieldType } from \"~/utils/getBaseFieldType\";\nimport { CmsGraphQLSchemaSorterPlugin } from \"~/plugins/CmsGraphQLSchemaSorterPlugin\";\n\ninterface RenderSortEnumParams {\n model: CmsModel;\n fields: CmsModelField[];\n fieldTypePlugins: CmsFieldTypePlugins;\n sorterPlugins: CmsGraphQLSchemaSorterPlugin[];\n}\ninterface RenderSortEnum {\n (params: RenderSortEnumParams): string;\n}\n\nexport const renderSortEnum: RenderSortEnum = ({\n model,\n fields,\n fieldTypePlugins,\n sorterPlugins\n}): string => {\n let sorters: string[] = [\n `id_ASC`,\n `id_DESC`,\n \"savedOn_ASC\",\n \"savedOn_DESC\",\n \"createdOn_ASC\",\n \"createdOn_DESC\"\n ];\n\n for (const field of fields) {\n const plugin = fieldTypePlugins[getBaseFieldType(field)];\n if (!plugin) {\n continue;\n } else if (plugin.createSorters) {\n const result = plugin.createSorters({\n model,\n field,\n sorters\n });\n if (result) {\n sorters = result;\n continue;\n }\n }\n if (!plugin.isSortable) {\n continue;\n }\n sorters.push(`${field.fieldId}_ASC`);\n sorters.push(`${field.fieldId}_DESC`);\n }\n\n return sorterPlugins\n .reduce((result, plugin) => {\n return plugin.createSorter({\n model,\n sorters: result\n });\n }, sorters)\n .join(\"\\n\");\n};\n"],"mappings":";;;;;;AACA;AAaO,MAAMA,cAA8B,GAAG,CAAC;EAC3CC,KAAK;EACLC,MAAM;EACNC,gBAAgB;EAChBC;AACJ,CAAC,KAAa;EACV,IAAIC,OAAiB,GAAG,CACnB,QAAO,EACP,SAAQ,EACT,aAAa,EACb,cAAc,EACd,eAAe,EACf,gBAAgB,CACnB;EAED,KAAK,MAAMC,KAAK,IAAIJ,MAAM,EAAE;IACxB,MAAMK,MAAM,GAAGJ,gBAAgB,CAAC,IAAAK,kCAAgB,EAACF,KAAK,CAAC,CAAC;IACxD,IAAI,CAACC,MAAM,EAAE;MACT;IACJ,CAAC,MAAM,IAAIA,MAAM,CAACE,aAAa,EAAE;MAC7B,MAAMC,MAAM,GAAGH,MAAM,CAACE,aAAa,CAAC;QAChCR,KAAK;QACLK,KAAK;QACLD;MACJ,CAAC,CAAC;MACF,IAAIK,MAAM,EAAE;QACRL,OAAO,GAAGK,MAAM;QAChB;MACJ;IACJ;IACA,IAAI,CAACH,MAAM,CAACI,UAAU,EAAE;MACpB;IACJ;IACAN,OAAO,CAACO,IAAI,CAAE,GAAEN,KAAK,CAACO,OAAQ,MAAK,CAAC;IACpCR,OAAO,CAACO,IAAI,CAAE,GAAEN,KAAK,CAACO,OAAQ,OAAM,CAAC;EACzC;EAEA,OAAOT,aAAa,CACfU,MAAM,CAAC,CAACJ,MAAM,EAAEH,MAAM,KAAK;IACxB,OAAOA,MAAM,CAACQ,YAAY,CAAC;MACvBd,KAAK;MACLI,OAAO,EAAEK;IACb,CAAC,CAAC;EACN,CAAC,EAAEL,OAAO,CAAC,CACVW,IAAI,CAAC,IAAI,CAAC;AACnB,CAAC;AAAC"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.createFieldModels = void 0;
|
|
7
|
-
|
|
8
|
-
var _models = require("./models");
|
|
9
|
-
|
|
10
|
-
const createFieldModels = async input => {
|
|
11
|
-
if (!input || input.length === 0) {
|
|
12
|
-
return [];
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const fields = [];
|
|
16
|
-
|
|
17
|
-
for (const field of input) {
|
|
18
|
-
const fieldData = new _models.ContentModelFieldModel().populate(field);
|
|
19
|
-
await fieldData.validate();
|
|
20
|
-
fields.push(await fieldData.toJSON());
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
return fields;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
exports.createFieldModels = createFieldModels;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["createFieldModels","input","length","fields","field","fieldData","ContentModelFieldModel","populate","validate","push","toJSON"],"sources":["createFieldModels.ts"],"sourcesContent":["import { CmsModelField, CmsModelFieldInput } from \"~/types\";\nimport { ContentModelFieldModel } from \"./models\";\n\nexport const createFieldModels = async (input?: CmsModelFieldInput[]): Promise<CmsModelField[]> => {\n if (!input || input.length === 0) {\n return [];\n }\n const fields: CmsModelField[] = [];\n for (const field of input) {\n const fieldData = new ContentModelFieldModel().populate(field);\n await fieldData.validate();\n fields.push(await fieldData.toJSON());\n }\n return fields;\n};\n"],"mappings":";;;;;;;AACA;;AAEO,MAAMA,iBAAiB,GAAG,MAAOC,KAAP,IAAkE;EAC/F,IAAI,CAACA,KAAD,IAAUA,KAAK,CAACC,MAAN,KAAiB,CAA/B,EAAkC;IAC9B,OAAO,EAAP;EACH;;EACD,MAAMC,MAAuB,GAAG,EAAhC;;EACA,KAAK,MAAMC,KAAX,IAAoBH,KAApB,EAA2B;IACvB,MAAMI,SAAS,GAAG,IAAIC,8BAAJ,GAA6BC,QAA7B,CAAsCH,KAAtC,CAAlB;IACA,MAAMC,SAAS,CAACG,QAAV,EAAN;IACAL,MAAM,CAACM,IAAP,CAAY,MAAMJ,SAAS,CAACK,MAAV,EAAlB;EACH;;EACD,OAAOP,MAAP;AACH,CAXM"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const validateFieldId: (input: string) => Promise<void>;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.validateFieldId = void 0;
|
|
7
|
-
|
|
8
|
-
var _validation = require("@webiny/validation");
|
|
9
|
-
|
|
10
|
-
var _systemFields = require("./systemFields");
|
|
11
|
-
|
|
12
|
-
const validateFieldId = async input => {
|
|
13
|
-
await _validation.validation.validate(input, "required,maxLength:100");
|
|
14
|
-
const value = String(input || "").trim();
|
|
15
|
-
|
|
16
|
-
if (!value.charAt(0).match(/^[a-zA-Z]/)) {
|
|
17
|
-
throw new Error(`Provided ${value} is not valid - must not start with a number.`);
|
|
18
|
-
} else if (value.match(/^([a-zA-Z0-9]+)$/) === null) {
|
|
19
|
-
throw new Error(`Provided ${value} is not valid - must be alphanumeric string.`);
|
|
20
|
-
} else if (_systemFields.fieldSystemFields.includes(value)) {
|
|
21
|
-
throw new Error(`Provided ${value} is not valid - "${value}" is an auto-generated field.`);
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
exports.validateFieldId = validateFieldId;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["validateFieldId","input","validation","validate","value","String","trim","charAt","match","Error","fieldSystemFields","includes"],"sources":["fieldIdValidation.ts"],"sourcesContent":["import { validation } from \"@webiny/validation\";\nimport { fieldSystemFields } from \"~/crud/contentModel/systemFields\";\n\nexport const validateFieldId = async (input: string): Promise<void> => {\n await validation.validate(input, \"required,maxLength:100\");\n\n const value = String(input || \"\").trim();\n\n if (!value.charAt(0).match(/^[a-zA-Z]/)) {\n throw new Error(`Provided ${value} is not valid - must not start with a number.`);\n } else if (value.match(/^([a-zA-Z0-9]+)$/) === null) {\n throw new Error(`Provided ${value} is not valid - must be alphanumeric string.`);\n } else if (fieldSystemFields.includes(value)) {\n throw new Error(`Provided ${value} is not valid - \"${value}\" is an auto-generated field.`);\n }\n};\n"],"mappings":";;;;;;;AAAA;;AACA;;AAEO,MAAMA,eAAe,GAAG,MAAOC,KAAP,IAAwC;EACnE,MAAMC,sBAAA,CAAWC,QAAX,CAAoBF,KAApB,EAA2B,wBAA3B,CAAN;EAEA,MAAMG,KAAK,GAAGC,MAAM,CAACJ,KAAK,IAAI,EAAV,CAAN,CAAoBK,IAApB,EAAd;;EAEA,IAAI,CAACF,KAAK,CAACG,MAAN,CAAa,CAAb,EAAgBC,KAAhB,CAAsB,WAAtB,CAAL,EAAyC;IACrC,MAAM,IAAIC,KAAJ,CAAW,YAAWL,KAAM,+CAA5B,CAAN;EACH,CAFD,MAEO,IAAIA,KAAK,CAACI,KAAN,CAAY,kBAAZ,MAAoC,IAAxC,EAA8C;IACjD,MAAM,IAAIC,KAAJ,CAAW,YAAWL,KAAM,8CAA5B,CAAN;EACH,CAFM,MAEA,IAAIM,+BAAA,CAAkBC,QAAlB,CAA2BP,KAA3B,CAAJ,EAAuC;IAC1C,MAAM,IAAIK,KAAJ,CAAW,YAAWL,KAAM,oBAAmBA,KAAM,+BAArD,CAAN;EACH;AACJ,CAZM"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const validateId: (value: string) => Promise<void>;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.validateId = void 0;
|
|
7
|
-
|
|
8
|
-
var _validation = require("@webiny/validation");
|
|
9
|
-
|
|
10
|
-
const validateId = async value => {
|
|
11
|
-
await _validation.validation.validate(value, "required,maxLength:100");
|
|
12
|
-
|
|
13
|
-
if (!value.charAt(0).match(/[a-zA-Z]/)) {
|
|
14
|
-
throw new Error(`Provided ID ${value} is not valid - must not start with a number.`);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
if (value.trim().toLowerCase() === "id") {
|
|
18
|
-
throw new Error(`Provided ID ${value} is not valid - "id" is an auto-generated field.`);
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
exports.validateId = validateId;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["validateId","value","validation","validate","charAt","match","Error","trim","toLowerCase"],"sources":["idValidation.ts"],"sourcesContent":["import { validation } from \"@webiny/validation\";\n\nexport const validateId = async (value: string): Promise<void> => {\n await validation.validate(value, \"required,maxLength:100\");\n if (!value.charAt(0).match(/[a-zA-Z]/)) {\n throw new Error(`Provided ID ${value} is not valid - must not start with a number.`);\n }\n if (value.trim().toLowerCase() === \"id\") {\n throw new Error(`Provided ID ${value} is not valid - \"id\" is an auto-generated field.`);\n }\n};\n"],"mappings":";;;;;;;AAAA;;AAEO,MAAMA,UAAU,GAAG,MAAOC,KAAP,IAAwC;EAC9D,MAAMC,sBAAA,CAAWC,QAAX,CAAoBF,KAApB,EAA2B,wBAA3B,CAAN;;EACA,IAAI,CAACA,KAAK,CAACG,MAAN,CAAa,CAAb,EAAgBC,KAAhB,CAAsB,UAAtB,CAAL,EAAwC;IACpC,MAAM,IAAIC,KAAJ,CAAW,eAAcL,KAAM,+CAA/B,CAAN;EACH;;EACD,IAAIA,KAAK,CAACM,IAAN,GAAaC,WAAb,OAA+B,IAAnC,EAAyC;IACrC,MAAM,IAAIF,KAAJ,CAAW,eAAcL,KAAM,kDAA/B,CAAN;EACH;AACJ,CARM"}
|
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.UpdateContentModelModel = exports.CreateContentModelModelFrom = exports.CreateContentModelModel = exports.ContentModelFieldModel = void 0;
|
|
7
|
-
|
|
8
|
-
var _validation = require("@webiny/validation");
|
|
9
|
-
|
|
10
|
-
var _commodoFieldsObject = require("commodo-fields-object");
|
|
11
|
-
|
|
12
|
-
var _fields = require("@commodo/fields");
|
|
13
|
-
|
|
14
|
-
var _fieldIdValidation = require("./fieldIdValidation");
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Package commodo-fields-object does not have types
|
|
18
|
-
*/
|
|
19
|
-
// @ts-ignore
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Package commodo-fields does not have object.
|
|
23
|
-
*/
|
|
24
|
-
// @ts-ignore
|
|
25
|
-
const requiredShortString = _validation.validation.create("required,maxLength:255");
|
|
26
|
-
|
|
27
|
-
const shortString = _validation.validation.create("maxLength:255");
|
|
28
|
-
|
|
29
|
-
const RendererModel = (0, _fields.withFields)({
|
|
30
|
-
name: (0, _fields.string)({
|
|
31
|
-
validation: requiredShortString
|
|
32
|
-
})
|
|
33
|
-
})();
|
|
34
|
-
const ContentModelFieldModel = (0, _fields.withFields)({
|
|
35
|
-
id: (0, _fields.string)({
|
|
36
|
-
validation: requiredShortString
|
|
37
|
-
}),
|
|
38
|
-
fieldId: (0, _fields.string)({
|
|
39
|
-
validation: _fieldIdValidation.validateFieldId
|
|
40
|
-
}),
|
|
41
|
-
label: (0, _fields.string)({
|
|
42
|
-
validation: requiredShortString
|
|
43
|
-
}),
|
|
44
|
-
helpText: (0, _fields.string)({
|
|
45
|
-
validation: shortString
|
|
46
|
-
}),
|
|
47
|
-
placeholderText: (0, _fields.string)({
|
|
48
|
-
validation: shortString
|
|
49
|
-
}),
|
|
50
|
-
type: (0, _fields.setOnce)()((0, _fields.string)({
|
|
51
|
-
validation: requiredShortString
|
|
52
|
-
})),
|
|
53
|
-
tags: (0, _commodoFieldsObject.object)({
|
|
54
|
-
value: [],
|
|
55
|
-
required: false
|
|
56
|
-
}),
|
|
57
|
-
multipleValues: (0, _fields.boolean)({
|
|
58
|
-
value: false
|
|
59
|
-
}),
|
|
60
|
-
predefinedValues: (0, _fields.fields)({
|
|
61
|
-
value: {},
|
|
62
|
-
instanceOf: (0, _fields.withFields)({
|
|
63
|
-
enabled: (0, _fields.boolean)(),
|
|
64
|
-
values: (0, _fields.fields)({
|
|
65
|
-
value: [],
|
|
66
|
-
list: true,
|
|
67
|
-
instanceOf: (0, _fields.withFields)({
|
|
68
|
-
label: (0, _fields.string)(),
|
|
69
|
-
value: (0, _fields.string)(),
|
|
70
|
-
selected: (0, _fields.boolean)()
|
|
71
|
-
})()
|
|
72
|
-
})
|
|
73
|
-
})()
|
|
74
|
-
}),
|
|
75
|
-
renderer: (0, _fields.fields)({
|
|
76
|
-
instanceOf: RendererModel,
|
|
77
|
-
validation: shortString
|
|
78
|
-
}),
|
|
79
|
-
validation: (0, _fields.fields)({
|
|
80
|
-
list: true,
|
|
81
|
-
value: [],
|
|
82
|
-
instanceOf: (0, _fields.withFields)({
|
|
83
|
-
name: (0, _fields.string)({
|
|
84
|
-
validation: requiredShortString
|
|
85
|
-
}),
|
|
86
|
-
message: (0, _fields.string)({
|
|
87
|
-
validation: shortString
|
|
88
|
-
}),
|
|
89
|
-
settings: (0, _commodoFieldsObject.object)({
|
|
90
|
-
value: {}
|
|
91
|
-
})
|
|
92
|
-
})()
|
|
93
|
-
}),
|
|
94
|
-
listValidation: (0, _fields.fields)({
|
|
95
|
-
list: true,
|
|
96
|
-
value: [],
|
|
97
|
-
instanceOf: (0, _fields.withFields)({
|
|
98
|
-
name: (0, _fields.string)({
|
|
99
|
-
validation: requiredShortString
|
|
100
|
-
}),
|
|
101
|
-
message: (0, _fields.string)({
|
|
102
|
-
validation: shortString
|
|
103
|
-
}),
|
|
104
|
-
settings: (0, _commodoFieldsObject.object)({
|
|
105
|
-
value: {}
|
|
106
|
-
})
|
|
107
|
-
})()
|
|
108
|
-
}),
|
|
109
|
-
settings: (0, _commodoFieldsObject.object)({
|
|
110
|
-
value: {}
|
|
111
|
-
})
|
|
112
|
-
/**
|
|
113
|
-
* By the default, field is not deleted.
|
|
114
|
-
*/
|
|
115
|
-
// isDeleted: boolean({ value: false })
|
|
116
|
-
|
|
117
|
-
})();
|
|
118
|
-
exports.ContentModelFieldModel = ContentModelFieldModel;
|
|
119
|
-
const CreateContentModelModel = (0, _fields.withFields)({
|
|
120
|
-
name: (0, _fields.string)({
|
|
121
|
-
validation: requiredShortString
|
|
122
|
-
}),
|
|
123
|
-
modelId: (0, _fields.string)({
|
|
124
|
-
validation: shortString
|
|
125
|
-
}),
|
|
126
|
-
description: (0, _fields.string)({
|
|
127
|
-
validation: shortString
|
|
128
|
-
}),
|
|
129
|
-
group: (0, _fields.string)({
|
|
130
|
-
validation: requiredShortString
|
|
131
|
-
}),
|
|
132
|
-
fields: (0, _fields.fields)({
|
|
133
|
-
instanceOf: ContentModelFieldModel,
|
|
134
|
-
value: [],
|
|
135
|
-
list: true,
|
|
136
|
-
required: true
|
|
137
|
-
}),
|
|
138
|
-
layout: (0, _commodoFieldsObject.object)({
|
|
139
|
-
value: [],
|
|
140
|
-
required: true
|
|
141
|
-
}),
|
|
142
|
-
tags: (0, _commodoFieldsObject.object)({
|
|
143
|
-
value: [],
|
|
144
|
-
required: false
|
|
145
|
-
})
|
|
146
|
-
})();
|
|
147
|
-
exports.CreateContentModelModel = CreateContentModelModel;
|
|
148
|
-
const CreateContentModelModelFrom = (0, _fields.withFields)({
|
|
149
|
-
name: (0, _fields.string)({
|
|
150
|
-
validation: requiredShortString
|
|
151
|
-
}),
|
|
152
|
-
modelId: (0, _fields.string)({
|
|
153
|
-
validation: shortString
|
|
154
|
-
}),
|
|
155
|
-
description: (0, _fields.string)({
|
|
156
|
-
validation: shortString
|
|
157
|
-
}),
|
|
158
|
-
group: (0, _fields.string)({
|
|
159
|
-
validation: requiredShortString
|
|
160
|
-
}),
|
|
161
|
-
locale: (0, _fields.string)({
|
|
162
|
-
validation: shortString
|
|
163
|
-
})
|
|
164
|
-
})();
|
|
165
|
-
exports.CreateContentModelModelFrom = CreateContentModelModelFrom;
|
|
166
|
-
const UpdateContentModelModel = (0, _fields.withFields)({
|
|
167
|
-
name: (0, _fields.string)({
|
|
168
|
-
validation: shortString
|
|
169
|
-
}),
|
|
170
|
-
description: (0, _fields.string)({
|
|
171
|
-
validation: shortString
|
|
172
|
-
}),
|
|
173
|
-
group: (0, _fields.string)({
|
|
174
|
-
validation: shortString
|
|
175
|
-
}),
|
|
176
|
-
titleFieldId: (0, _fields.string)(),
|
|
177
|
-
fields: (0, _fields.fields)({
|
|
178
|
-
instanceOf: ContentModelFieldModel,
|
|
179
|
-
value: [],
|
|
180
|
-
list: true,
|
|
181
|
-
required: true
|
|
182
|
-
}),
|
|
183
|
-
layout: (0, _commodoFieldsObject.object)({
|
|
184
|
-
value: [],
|
|
185
|
-
required: true
|
|
186
|
-
}),
|
|
187
|
-
tags: (0, _commodoFieldsObject.object)({
|
|
188
|
-
value: [],
|
|
189
|
-
required: false
|
|
190
|
-
})
|
|
191
|
-
})();
|
|
192
|
-
exports.UpdateContentModelModel = UpdateContentModelModel;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["requiredShortString","validation","create","shortString","RendererModel","withFields","name","string","ContentModelFieldModel","id","fieldId","validateFieldId","label","helpText","placeholderText","type","setOnce","tags","object","value","required","multipleValues","boolean","predefinedValues","fields","instanceOf","enabled","values","list","selected","renderer","message","settings","listValidation","CreateContentModelModel","modelId","description","group","layout","CreateContentModelModelFrom","locale","UpdateContentModelModel","titleFieldId"],"sources":["models.ts"],"sourcesContent":["import { validation } from \"@webiny/validation\";\n/**\n * Package commodo-fields-object does not have types\n */\n// @ts-ignore\nimport { object } from \"commodo-fields-object\";\n/**\n * Package commodo-fields does not have object.\n */\n// @ts-ignore\nimport { withFields, string, setOnce, boolean, fields } from \"@commodo/fields\";\nimport { validateFieldId } from \"./fieldIdValidation\";\n\nconst requiredShortString = validation.create(\"required,maxLength:255\");\nconst shortString = validation.create(\"maxLength:255\");\n\nconst RendererModel = withFields({\n name: string({ validation: requiredShortString })\n})();\n\nexport const ContentModelFieldModel = withFields({\n id: string({ validation: requiredShortString }),\n fieldId: string({\n validation: validateFieldId\n }),\n label: string({ validation: requiredShortString }),\n helpText: string({ validation: shortString }),\n placeholderText: string({ validation: shortString }),\n type: setOnce()(string({ validation: requiredShortString })),\n tags: object({ value: [], required: false }),\n multipleValues: boolean({ value: false }),\n predefinedValues: fields({\n value: {},\n instanceOf: withFields({\n enabled: boolean(),\n values: fields({\n value: [],\n list: true,\n instanceOf: withFields({\n label: string(),\n value: string(),\n selected: boolean()\n })()\n })\n })()\n }),\n renderer: fields({ instanceOf: RendererModel, validation: shortString }),\n validation: fields({\n list: true,\n value: [],\n instanceOf: withFields({\n name: string({ validation: requiredShortString }),\n message: string({ validation: shortString }),\n settings: object({ value: {} })\n })()\n }),\n listValidation: fields({\n list: true,\n value: [],\n instanceOf: withFields({\n name: string({ validation: requiredShortString }),\n message: string({ validation: shortString }),\n settings: object({ value: {} })\n })()\n }),\n settings: object({ value: {} })\n /**\n * By the default, field is not deleted.\n */\n // isDeleted: boolean({ value: false })\n})();\n\nexport const CreateContentModelModel = withFields({\n name: string({ validation: requiredShortString }),\n modelId: string({ validation: shortString }),\n description: string({ validation: shortString }),\n group: string({ validation: requiredShortString }),\n fields: fields({ instanceOf: ContentModelFieldModel, value: [], list: true, required: true }),\n layout: object({ value: [], required: true }),\n tags: object({ value: [], required: false })\n})();\n\nexport const CreateContentModelModelFrom = withFields({\n name: string({ validation: requiredShortString }),\n modelId: string({ validation: shortString }),\n description: string({ validation: shortString }),\n group: string({ validation: requiredShortString }),\n locale: string({ validation: shortString })\n})();\n\nexport const UpdateContentModelModel = withFields({\n name: string({ validation: shortString }),\n description: string({ validation: shortString }),\n group: string({ validation: shortString }),\n titleFieldId: string(),\n fields: fields({ instanceOf: ContentModelFieldModel, value: [], list: true, required: true }),\n layout: object({ value: [], required: true }),\n tags: object({ value: [], required: false })\n})();\n"],"mappings":";;;;;;;AAAA;;AAKA;;AAKA;;AACA;;AAVA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AAIA,MAAMA,mBAAmB,GAAGC,sBAAA,CAAWC,MAAX,CAAkB,wBAAlB,CAA5B;;AACA,MAAMC,WAAW,GAAGF,sBAAA,CAAWC,MAAX,CAAkB,eAAlB,CAApB;;AAEA,MAAME,aAAa,GAAG,IAAAC,kBAAA,EAAW;EAC7BC,IAAI,EAAE,IAAAC,cAAA,EAAO;IAAEN,UAAU,EAAED;EAAd,CAAP;AADuB,CAAX,GAAtB;AAIO,MAAMQ,sBAAsB,GAAG,IAAAH,kBAAA,EAAW;EAC7CI,EAAE,EAAE,IAAAF,cAAA,EAAO;IAAEN,UAAU,EAAED;EAAd,CAAP,CADyC;EAE7CU,OAAO,EAAE,IAAAH,cAAA,EAAO;IACZN,UAAU,EAAEU;EADA,CAAP,CAFoC;EAK7CC,KAAK,EAAE,IAAAL,cAAA,EAAO;IAAEN,UAAU,EAAED;EAAd,CAAP,CALsC;EAM7Ca,QAAQ,EAAE,IAAAN,cAAA,EAAO;IAAEN,UAAU,EA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;EAO9CH,IAAI,EAAE,IAAAC,2BAAA,EAAO;IAAEC,KAAK,EAAE,EAAT;IAAaC,QAAQ,EAAE;EAAvB,CAAP;AAPwC,CAAX,GAAhC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const fieldSystemFields: string[];
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.fieldSystemFields = void 0;
|
|
7
|
-
const fieldSystemFields = ["id", "fieldId", "storageId", "label", "helpText", "placeholderText", "type", "multipleValues", "predefinedValues", "renderer", "validation", "listValidation", "settings"];
|
|
8
|
-
exports.fieldSystemFields = fieldSystemFields;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["fieldSystemFields"],"sources":["systemFields.ts"],"sourcesContent":["export const fieldSystemFields: string[] = [\n \"id\",\n \"fieldId\",\n \"storageId\",\n \"label\",\n \"helpText\",\n \"placeholderText\",\n \"type\",\n \"multipleValues\",\n \"predefinedValues\",\n \"renderer\",\n \"validation\",\n \"listValidation\",\n \"settings\"\n];\n"],"mappings":";;;;;;AAAO,MAAMA,iBAA2B,GAAG,CACvC,IADuC,EAEvC,SAFuC,EAGvC,WAHuC,EAIvC,OAJuC,EAKvC,UALuC,EAMvC,iBANuC,EAOvC,MAPuC,EAQvC,gBARuC,EASvC,kBATuC,EAUvC,UAVuC,EAWvC,YAXuC,EAYvC,gBAZuC,EAavC,UAbuC,CAApC"}
|