@webiny/app-headless-cms-common 5.41.0-dbt.0 → 5.41.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/constants.d.ts +1 -0
- package/constants.js +9 -0
- package/constants.js.map +1 -0
- package/entries.graphql.d.ts +29 -0
- package/entries.graphql.js +48 -16
- package/entries.graphql.js.map +1 -1
- package/index.d.ts +1 -0
- package/index.js +11 -0
- package/index.js.map +1 -1
- package/package.json +8 -8
- package/types/index.d.ts +6 -6
- package/types/index.js.map +1 -1
package/constants.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const CMS_MODEL_SINGLETON_TAG = "singleton";
|
package/constants.js
ADDED
package/constants.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["CMS_MODEL_SINGLETON_TAG","exports"],"sources":["constants.ts"],"sourcesContent":["export const CMS_MODEL_SINGLETON_TAG = \"singleton\";\n"],"mappings":";;;;;;AAAO,IAAMA,uBAAuB,GAAAC,OAAA,CAAAD,uBAAA,GAAG,WAAW","ignoreList":[]}
|
package/entries.graphql.d.ts
CHANGED
|
@@ -15,6 +15,17 @@ export interface CmsEntryGetQueryVariables {
|
|
|
15
15
|
entryId?: string;
|
|
16
16
|
}
|
|
17
17
|
export declare const createReadQuery: (model: CmsEditorContentModel) => import("graphql").DocumentNode;
|
|
18
|
+
/**
|
|
19
|
+
* ############################################
|
|
20
|
+
* Get CMS Singleton Entry Query
|
|
21
|
+
*/
|
|
22
|
+
export interface CmsEntryGetSingletonQueryResponse {
|
|
23
|
+
content: {
|
|
24
|
+
data: CmsContentEntry;
|
|
25
|
+
error: CmsErrorResponse | null;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export declare const createReadSingletonQuery: (model: CmsEditorContentModel) => import("graphql").DocumentNode;
|
|
18
29
|
/**
|
|
19
30
|
* ############################################
|
|
20
31
|
* List CMS Entry Revisions Query
|
|
@@ -136,6 +147,24 @@ export interface CmsEntryUpdateMutationVariables {
|
|
|
136
147
|
options?: FormValidationOptions;
|
|
137
148
|
}
|
|
138
149
|
export declare const createUpdateMutation: (model: CmsEditorContentModel) => import("graphql").DocumentNode;
|
|
150
|
+
/**
|
|
151
|
+
* ############################################
|
|
152
|
+
* Update Singleton Mutation
|
|
153
|
+
*/
|
|
154
|
+
export interface CmsEntryUpdateSingletonMutationResponse {
|
|
155
|
+
content: {
|
|
156
|
+
data?: CmsContentEntry;
|
|
157
|
+
error?: CmsErrorResponse;
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
export interface CmsEntryUpdateSingletonMutationVariables {
|
|
161
|
+
/**
|
|
162
|
+
* We have any here because we do not know which fields does entry have
|
|
163
|
+
*/
|
|
164
|
+
data: Record<string, any>;
|
|
165
|
+
options?: FormValidationOptions;
|
|
166
|
+
}
|
|
167
|
+
export declare const createUpdateSingletonMutation: (model: CmsEditorContentModel) => import("graphql").DocumentNode;
|
|
139
168
|
/**
|
|
140
169
|
* ############################################
|
|
141
170
|
* Publish Mutation
|
package/entries.graphql.js
CHANGED
|
@@ -4,14 +4,22 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.createUpdateMutation = exports.createUnpublishMutation = exports.createRevisionsQuery = exports.createRestoreFromBinMutation = exports.createReadQuery = exports.createPublishMutation = exports.createListQueryDataSelection = exports.createListQuery = exports.createDeleteMutation = exports.createCreateMutation = exports.createCreateFromMutation = exports.createBulkActionMutation = void 0;
|
|
7
|
+
exports.createUpdateSingletonMutation = exports.createUpdateMutation = exports.createUnpublishMutation = exports.createRevisionsQuery = exports.createRestoreFromBinMutation = exports.createReadSingletonQuery = exports.createReadQuery = exports.createPublishMutation = exports.createListQueryDataSelection = exports.createListQuery = exports.createDeleteMutation = exports.createCreateMutation = exports.createCreateFromMutation = exports.createBulkActionMutation = void 0;
|
|
8
8
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
9
9
|
var _graphqlTag = _interopRequireDefault(require("graphql-tag"));
|
|
10
10
|
var _createFieldsList = require("./createFieldsList");
|
|
11
11
|
var _getModelTitleFieldId = require("./getModelTitleFieldId");
|
|
12
|
-
var
|
|
13
|
-
var
|
|
14
|
-
var
|
|
12
|
+
var _constants = require("./constants");
|
|
13
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13;
|
|
14
|
+
var CONTENT_META_FIELDS = /* GraphQL */"\n title\n description\n image\n version\n locked\n status\n";
|
|
15
|
+
var createEntrySystemFields = function createEntrySystemFields(model) {
|
|
16
|
+
var isSingletonModel = model.tags.includes(_constants.CMS_MODEL_SINGLETON_TAG);
|
|
17
|
+
var optionalFields = "";
|
|
18
|
+
if (!isSingletonModel) {
|
|
19
|
+
optionalFields = "\n wbyAco_location {\n folderId\n }\n meta {\n ".concat(CONTENT_META_FIELDS, "\n }\n ");
|
|
20
|
+
}
|
|
21
|
+
return /* GraphQL */"\n id\n entryId\n createdOn\n savedOn\n modifiedOn,\n deletedOn\n firstPublishedOn\n lastPublishedOn\n createdBy {\n id\n type\n displayName\n }\n savedBy {\n id\n type\n displayName\n }\n modifiedBy {\n id\n type\n displayName\n }\n deletedBy {\n id\n type\n displayName\n }\n firstPublishedBy {\n id\n type\n displayName\n }\n lastPublishedBy {\n id\n type\n displayName\n }\n revisionCreatedOn\n revisionSavedOn\n revisionModifiedOn\n revisionDeletedOn\n revisionFirstPublishedOn\n revisionLastPublishedOn\n revisionCreatedBy {\n id\n type\n displayName\n }\n revisionSavedBy {\n id\n type\n displayName\n }\n revisionModifiedBy {\n id\n type\n displayName\n }\n revisionDeletedBy {\n id\n type\n displayName\n }\n revisionFirstPublishedBy {\n id\n type\n displayName\n }\n revisionLastPublishedBy {\n id\n type\n displayName\n }\n revisionCreatedOn\n revisionSavedOn\n revisionModifiedOn\n revisionFirstPublishedOn\n revisionLastPublishedOn\n revisionCreatedBy {\n id\n type\n displayName\n }\n revisionSavedBy {\n id\n type\n displayName\n }\n revisionModifiedBy {\n id\n type\n displayName\n }\n revisionFirstPublishedBy {\n id\n type\n displayName\n }\n revisionLastPublishedBy {\n id\n type\n displayName\n }\n ".concat(optionalFields, "\n ");
|
|
22
|
+
};
|
|
15
23
|
var ERROR_FIELD = /* GraphQL */"\n {\n message\n code\n data\n }\n";
|
|
16
24
|
|
|
17
25
|
/**
|
|
@@ -23,7 +31,19 @@ var createReadQuery = exports.createReadQuery = function createReadQuery(model)
|
|
|
23
31
|
/**
|
|
24
32
|
* This query now accepts both revision or entryId as we can load exact revision or latest (if entryId was sent).
|
|
25
33
|
*/
|
|
26
|
-
return (0, _graphqlTag.default)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n query CmsEntriesGet", "($revision: ID, $entryId: ID) {\n content: get", "(revision: $revision, entryId: $entryId) {\n data {\n ", "\n ", "\n }\n error ", "\n }\n }\n "])), model.singularApiName, model.singularApiName,
|
|
34
|
+
return (0, _graphqlTag.default)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n query CmsEntriesGet", "($revision: ID, $entryId: ID) {\n content: get", "(revision: $revision, entryId: $entryId) {\n data {\n ", "\n ", "\n }\n error ", "\n }\n }\n "])), model.singularApiName, model.singularApiName, createEntrySystemFields(model), (0, _createFieldsList.createFieldsList)({
|
|
35
|
+
model: model,
|
|
36
|
+
fields: model.fields
|
|
37
|
+
}), ERROR_FIELD);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* ############################################
|
|
42
|
+
* Get CMS Singleton Entry Query
|
|
43
|
+
*/
|
|
44
|
+
|
|
45
|
+
var createReadSingletonQuery = exports.createReadSingletonQuery = function createReadSingletonQuery(model) {
|
|
46
|
+
return (0, _graphqlTag.default)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n query CmsEntryGetSingleton", " {\n content: get", " {\n data {\n ", "\n ", "\n }\n error ", "\n }\n }\n "])), model.singularApiName, model.singularApiName, createEntrySystemFields(model), (0, _createFieldsList.createFieldsList)({
|
|
27
47
|
model: model,
|
|
28
48
|
fields: model.fields
|
|
29
49
|
}), ERROR_FIELD);
|
|
@@ -35,7 +55,7 @@ var createReadQuery = exports.createReadQuery = function createReadQuery(model)
|
|
|
35
55
|
*/
|
|
36
56
|
|
|
37
57
|
var createRevisionsQuery = exports.createRevisionsQuery = function createRevisionsQuery(model) {
|
|
38
|
-
return (0, _graphqlTag.default)(
|
|
58
|
+
return (0, _graphqlTag.default)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n query CmsEntriesGet", "Revisions($id: ID!) {\n revisions: get", "Revisions(id: $id) {\n data {\n ", "\n }\n error ", "\n }\n }\n "])), model.singularApiName, model.singularApiName, createEntrySystemFields(model), ERROR_FIELD);
|
|
39
59
|
};
|
|
40
60
|
|
|
41
61
|
/**
|
|
@@ -44,14 +64,14 @@ var createRevisionsQuery = exports.createRevisionsQuery = function createRevisio
|
|
|
44
64
|
*/
|
|
45
65
|
|
|
46
66
|
var createListQueryDataSelection = exports.createListQueryDataSelection = function createListQueryDataSelection(model, fields) {
|
|
47
|
-
return "\n ".concat(
|
|
67
|
+
return "\n ".concat(createEntrySystemFields(model), "\n ").concat(fields ? (0, _createFieldsList.createFieldsList)({
|
|
48
68
|
model: model,
|
|
49
69
|
fields: fields
|
|
50
70
|
}) : "", "\n ").concat(!fields ? (0, _getModelTitleFieldId.getModelTitleFieldId)(model) : "", "\n ");
|
|
51
71
|
};
|
|
52
72
|
var createListQuery = exports.createListQuery = function createListQuery(model, fields, deleted) {
|
|
53
73
|
var queryName = deleted ? "Deleted".concat(model.pluralApiName) : model.pluralApiName;
|
|
54
|
-
return (0, _graphqlTag.default)(
|
|
74
|
+
return (0, _graphqlTag.default)(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n query CmsEntriesList", "($where: ", "ListWhereInput, $sort: [", "ListSorter], $limit: Int, $after: String, $search: String) {\n content: list", "(\n where: $where\n sort: $sort\n limit: $limit\n after: $after\n search: $search\n ) {\n data {\n ", "\n }\n meta {\n cursor\n hasMoreItems\n totalCount\n }\n error ", "\n }\n }\n "])), queryName, model.singularApiName, model.singularApiName, queryName, createListQueryDataSelection(model, fields), ERROR_FIELD);
|
|
55
75
|
};
|
|
56
76
|
|
|
57
77
|
/**
|
|
@@ -60,7 +80,7 @@ var createListQuery = exports.createListQuery = function createListQuery(model,
|
|
|
60
80
|
*/
|
|
61
81
|
|
|
62
82
|
var createDeleteMutation = exports.createDeleteMutation = function createDeleteMutation(model) {
|
|
63
|
-
return (0, _graphqlTag.default)(
|
|
83
|
+
return (0, _graphqlTag.default)(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n mutation CmsEntriesDelete", "($revision: ID!, $permanently: Boolean) {\n content: delete", "(revision: $revision, options: {permanently: $permanently}) {\n data\n error ", "\n }\n }\n "])), model.singularApiName, model.singularApiName, ERROR_FIELD);
|
|
64
84
|
};
|
|
65
85
|
|
|
66
86
|
/**
|
|
@@ -69,7 +89,7 @@ var createDeleteMutation = exports.createDeleteMutation = function createDeleteM
|
|
|
69
89
|
*/
|
|
70
90
|
|
|
71
91
|
var createRestoreFromBinMutation = exports.createRestoreFromBinMutation = function createRestoreFromBinMutation(model) {
|
|
72
|
-
return (0, _graphqlTag.default)(
|
|
92
|
+
return (0, _graphqlTag.default)(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2.default)(["\n mutation CmsEntriesRestore", "FromBin($revision: ID!) {\n content: restore", "FromBin(revision: $revision) {\n data {\n ", "\n ", "\n }\n error ", "\n }\n }\n "])), model.singularApiName, model.singularApiName, createEntrySystemFields(model), (0, _createFieldsList.createFieldsList)({
|
|
73
93
|
model: model,
|
|
74
94
|
fields: model.fields
|
|
75
95
|
}), ERROR_FIELD);
|
|
@@ -85,7 +105,7 @@ var createCreateMutation = exports.createCreateMutation = function createCreateM
|
|
|
85
105
|
model: model,
|
|
86
106
|
fields: model.fields
|
|
87
107
|
});
|
|
88
|
-
return (0, _graphqlTag.default)(
|
|
108
|
+
return (0, _graphqlTag.default)(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2.default)(["\n mutation CmsEntriesCreate", "($data: ", "Input!, $options: CreateCmsEntryOptionsInput) {\n content: create", "(data: $data, options: $options) {\n data {\n ", "\n ", "\n }\n error ", "\n }\n }\n "])), model.singularApiName, model.singularApiName, model.singularApiName, createEntrySystemFields(model), createFields, ERROR_FIELD);
|
|
89
109
|
};
|
|
90
110
|
|
|
91
111
|
/**
|
|
@@ -94,7 +114,7 @@ var createCreateMutation = exports.createCreateMutation = function createCreateM
|
|
|
94
114
|
*/
|
|
95
115
|
|
|
96
116
|
var createCreateFromMutation = exports.createCreateFromMutation = function createCreateFromMutation(model) {
|
|
97
|
-
return (0, _graphqlTag.default)(
|
|
117
|
+
return (0, _graphqlTag.default)(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2.default)(["\n mutation CmsCreate", "From($revision: ID!, $data: ", "Input, $options: CreateRevisionCmsEntryOptionsInput) {\n content: create", "From(revision: $revision, data: $data, options: $options) {\n data {\n ", "\n ", "\n }\n error ", "\n }\n }"])), model.singularApiName, model.singularApiName, model.singularApiName, createEntrySystemFields(model), (0, _createFieldsList.createFieldsList)({
|
|
98
118
|
model: model,
|
|
99
119
|
fields: model.fields
|
|
100
120
|
}), ERROR_FIELD);
|
|
@@ -106,7 +126,19 @@ var createCreateFromMutation = exports.createCreateFromMutation = function creat
|
|
|
106
126
|
*/
|
|
107
127
|
|
|
108
128
|
var createUpdateMutation = exports.createUpdateMutation = function createUpdateMutation(model) {
|
|
109
|
-
return (0, _graphqlTag.default)(
|
|
129
|
+
return (0, _graphqlTag.default)(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2.default)(["\n mutation CmsUpdate", "($revision: ID!, $data: ", "Input!, $options: UpdateCmsEntryOptionsInput) {\n content: update", "(revision: $revision, data: $data, options: $options) {\n data {\n ", "\n ", "\n }\n error ", "\n }\n }\n "])), model.singularApiName, model.singularApiName, model.singularApiName, createEntrySystemFields(model), (0, _createFieldsList.createFieldsList)({
|
|
130
|
+
model: model,
|
|
131
|
+
fields: model.fields
|
|
132
|
+
}), ERROR_FIELD);
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* ############################################
|
|
137
|
+
* Update Singleton Mutation
|
|
138
|
+
*/
|
|
139
|
+
|
|
140
|
+
var createUpdateSingletonMutation = exports.createUpdateSingletonMutation = function createUpdateSingletonMutation(model) {
|
|
141
|
+
return (0, _graphqlTag.default)(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2.default)(["\n mutation CmsUpdate", "($data: ", "Input!, $options: UpdateCmsEntryOptionsInput) {\n content: update", "(data: $data, options: $options) {\n data {\n ", "\n ", "\n }\n error ", "\n }\n }\n "])), model.singularApiName, model.singularApiName, model.singularApiName, createEntrySystemFields(model), (0, _createFieldsList.createFieldsList)({
|
|
110
142
|
model: model,
|
|
111
143
|
fields: model.fields
|
|
112
144
|
}), ERROR_FIELD);
|
|
@@ -118,7 +150,7 @@ var createUpdateMutation = exports.createUpdateMutation = function createUpdateM
|
|
|
118
150
|
*/
|
|
119
151
|
|
|
120
152
|
var createPublishMutation = exports.createPublishMutation = function createPublishMutation(model) {
|
|
121
|
-
return (0, _graphqlTag.default)(
|
|
153
|
+
return (0, _graphqlTag.default)(_templateObject11 || (_templateObject11 = (0, _taggedTemplateLiteral2.default)(["\n mutation CmsPublish", "($revision: ID!) {\n content: publish", "(revision: $revision) {\n data {\n ", "\n ", "\n }\n error ", "\n }\n }"])), model.singularApiName, model.singularApiName, createEntrySystemFields(model), (0, _createFieldsList.createFieldsList)({
|
|
122
154
|
model: model,
|
|
123
155
|
fields: model.fields
|
|
124
156
|
}), ERROR_FIELD);
|
|
@@ -130,7 +162,7 @@ var createPublishMutation = exports.createPublishMutation = function createPubli
|
|
|
130
162
|
*/
|
|
131
163
|
|
|
132
164
|
var createUnpublishMutation = exports.createUnpublishMutation = function createUnpublishMutation(model) {
|
|
133
|
-
return (0, _graphqlTag.default)(
|
|
165
|
+
return (0, _graphqlTag.default)(_templateObject12 || (_templateObject12 = (0, _taggedTemplateLiteral2.default)(["\n mutation CmsUnpublish", "($revision: ID!) {\n content: unpublish", "(revision: $revision) {\n data {\n ", "\n ", "\n }\n error ", "\n }\n }"])), model.singularApiName, model.singularApiName, createEntrySystemFields(model), (0, _createFieldsList.createFieldsList)({
|
|
134
166
|
model: model,
|
|
135
167
|
fields: model.fields
|
|
136
168
|
}), ERROR_FIELD);
|
|
@@ -142,7 +174,7 @@ var createUnpublishMutation = exports.createUnpublishMutation = function createU
|
|
|
142
174
|
*/
|
|
143
175
|
|
|
144
176
|
var createBulkActionMutation = exports.createBulkActionMutation = function createBulkActionMutation(model) {
|
|
145
|
-
return (0, _graphqlTag.default)(
|
|
177
|
+
return (0, _graphqlTag.default)(_templateObject13 || (_templateObject13 = (0, _taggedTemplateLiteral2.default)(["\n mutation CmsBulkAction", "($action: BulkAction", "Name!, $where: ", "ListWhereInput, $search: String, $data: JSON) {\n content: bulkAction", "(action: $action, where: $where, search: $search, data: $data) {\n data {\n id\n }\n error ", "\n }\n }"])), model.singularApiName, model.singularApiName, model.singularApiName, model.singularApiName, ERROR_FIELD);
|
|
146
178
|
};
|
|
147
179
|
|
|
148
180
|
//# sourceMappingURL=entries.graphql.js.map
|
package/entries.graphql.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_graphqlTag","_interopRequireDefault","require","_createFieldsList","_getModelTitleFieldId","_templateObject","_templateObject2","_templateObject3","_templateObject4","_templateObject5","_templateObject6","_templateObject7","_templateObject8","_templateObject9","_templateObject10","_templateObject11","CONTENT_META_FIELDS","CONTENT_ENTRY_SYSTEM_FIELDS","concat","ERROR_FIELD","createReadQuery","exports","model","gql","_taggedTemplateLiteral2","default","singularApiName","createFieldsList","fields","createRevisionsQuery","createListQueryDataSelection","getModelTitleFieldId","createListQuery","deleted","queryName","pluralApiName","createDeleteMutation","createRestoreFromBinMutation","createCreateMutation","createFields","createCreateFromMutation","createUpdateMutation","createPublishMutation","createUnpublishMutation","createBulkActionMutation"],"sources":["entries.graphql.ts"],"sourcesContent":["import gql from \"graphql-tag\";\nimport {\n CmsContentEntryRevision,\n CmsContentEntry,\n CmsEditorContentModel,\n CmsErrorResponse,\n CmsMetaResponse,\n CmsModelField\n} from \"~/types\";\nimport { createFieldsList } from \"./createFieldsList\";\nimport { getModelTitleFieldId } from \"./getModelTitleFieldId\";\nimport { FormValidationOptions } from \"@webiny/form\";\n\nconst CONTENT_META_FIELDS = /* GraphQL */ `\n meta {\n title\n description\n image\n version\n locked\n status\n }\n`;\n\nconst CONTENT_ENTRY_SYSTEM_FIELDS = /* GraphQL */ `\n id\n entryId\n createdOn\n savedOn\n modifiedOn,\n deletedOn\n firstPublishedOn\n lastPublishedOn\n createdBy {\n id\n type\n displayName\n }\n savedBy {\n id\n type\n displayName\n }\n modifiedBy {\n id\n type\n displayName\n }\n deletedBy {\n id\n type\n displayName\n }\n firstPublishedBy {\n id\n type\n displayName\n }\n lastPublishedBy {\n id\n type\n displayName\n }\n revisionCreatedOn\n revisionSavedOn\n revisionModifiedOn\n revisionDeletedOn\n revisionFirstPublishedOn\n revisionLastPublishedOn\n revisionCreatedBy {\n id\n type\n displayName\n }\n revisionSavedBy {\n id\n type\n displayName\n }\n revisionModifiedBy {\n id\n type\n displayName\n }\n revisionDeletedBy {\n id\n type\n displayName\n }\n revisionFirstPublishedBy {\n id\n type\n displayName\n }\n revisionLastPublishedBy {\n id\n type\n displayName\n }\n revisionCreatedOn\n revisionSavedOn\n revisionModifiedOn\n revisionFirstPublishedOn\n revisionLastPublishedOn\n revisionCreatedBy {\n id\n type\n displayName\n }\n revisionSavedBy {\n id\n type\n displayName\n }\n revisionModifiedBy {\n id\n type\n displayName\n }\n revisionFirstPublishedBy {\n id\n type\n displayName\n }\n revisionLastPublishedBy {\n id\n type\n displayName\n }\n wbyAco_location {\n folderId\n }\n ${CONTENT_META_FIELDS}\n`;\n\nconst ERROR_FIELD = /* GraphQL */ `\n {\n message\n code\n data\n }\n`;\n\n/**\n * ############################################\n * Get CMS Entry Query\n */\nexport interface CmsEntryGetQueryResponse {\n content: {\n data: CmsContentEntry;\n error: CmsErrorResponse | null;\n };\n}\n\nexport interface CmsEntryGetQueryVariables {\n revision?: string;\n entryId?: string;\n}\n\nexport const createReadQuery = (model: CmsEditorContentModel) => {\n /**\n * This query now accepts both revision or entryId as we can load exact revision or latest (if entryId was sent).\n */\n return gql`\n query CmsEntriesGet${model.singularApiName}($revision: ID, $entryId: ID) {\n content: get${model.singularApiName}(revision: $revision, entryId: $entryId) {\n data {\n ${CONTENT_ENTRY_SYSTEM_FIELDS}\n ${createFieldsList({ model, fields: model.fields })}\n }\n error ${ERROR_FIELD}\n }\n }\n `;\n};\n\n/**\n * ############################################\n * List CMS Entry Revisions Query\n */\nexport interface CmsEntriesListRevisionsQueryResponse {\n revisions: {\n data: CmsContentEntryRevision[];\n error: CmsErrorResponse | null;\n meta: CmsMetaResponse;\n };\n}\n\nexport interface CmsEntriesListRevisionsQueryVariables {\n id: string;\n}\n\nexport const createRevisionsQuery = (model: CmsEditorContentModel) => {\n return gql`\n query CmsEntriesGet${model.singularApiName}Revisions($id: ID!) {\n revisions: get${model.singularApiName}Revisions(id: $id) {\n data {\n ${CONTENT_ENTRY_SYSTEM_FIELDS}\n }\n error ${ERROR_FIELD}\n }\n }\n `;\n};\n\n/**\n * ############################################\n * List CMS Entries Query\n */\nexport interface CmsEntriesListQueryResponse {\n content: {\n data: CmsContentEntry[];\n error: CmsErrorResponse | null;\n meta: CmsMetaResponse;\n };\n}\n\nexport interface CmsEntriesListQueryVariables {\n // TODO @ts-refactor better list types\n where?: {\n [key: string]: any;\n };\n sort?: string[];\n limit?: number;\n after?: string;\n}\n\nexport const createListQueryDataSelection = (\n model: CmsEditorContentModel,\n fields?: CmsModelField[]\n) => {\n return `\n ${CONTENT_ENTRY_SYSTEM_FIELDS}\n ${fields ? createFieldsList({ model, fields }) : \"\"}\n ${!fields ? getModelTitleFieldId(model) : \"\"}\n `;\n};\n\nexport const createListQuery = (\n model: CmsEditorContentModel,\n fields?: CmsModelField[],\n deleted?: boolean\n) => {\n const queryName = deleted ? `Deleted${model.pluralApiName}` : model.pluralApiName;\n\n return gql`\n query CmsEntriesList${queryName}($where: ${model.singularApiName}ListWhereInput, $sort: [${\n model.singularApiName\n }ListSorter], $limit: Int, $after: String, $search: String) {\n content: list${queryName}(\n where: $where\n sort: $sort\n limit: $limit\n after: $after\n search: $search\n ) {\n data {\n ${createListQueryDataSelection(model, fields)}\n }\n meta {\n cursor\n hasMoreItems\n totalCount\n }\n error ${ERROR_FIELD}\n }\n }\n `;\n};\n\n/**\n * ############################################\n * Delete Mutation\n */\nexport interface CmsEntryDeleteMutationResponse {\n content: {\n data: CmsContentEntry | null;\n error: CmsErrorResponse | null;\n };\n}\n\nexport interface CmsEntryDeleteMutationVariables {\n revision: string;\n permanently?: boolean;\n}\n\nexport const createDeleteMutation = (model: CmsEditorContentModel) => {\n return gql`\n mutation CmsEntriesDelete${model.singularApiName}($revision: ID!, $permanently: Boolean) {\n content: delete${model.singularApiName}(revision: $revision, options: {permanently: $permanently}) {\n data\n error ${ERROR_FIELD}\n }\n }\n `;\n};\n\n/**\n * ############################################\n * Restore from bin Mutation\n */\nexport interface CmsEntryRestoreFromBinMutationResponse {\n content: {\n data: CmsContentEntry | null;\n error: CmsErrorResponse | null;\n };\n}\n\nexport interface CmsEntryRestoreFromBinMutationVariables {\n revision: string;\n}\n\nexport const createRestoreFromBinMutation = (model: CmsEditorContentModel) => {\n return gql`\n mutation CmsEntriesRestore${model.singularApiName}FromBin($revision: ID!) {\n content: restore${model.singularApiName}FromBin(revision: $revision) {\n data {\n ${CONTENT_ENTRY_SYSTEM_FIELDS}\n ${createFieldsList({ model, fields: model.fields })}\n }\n error ${ERROR_FIELD}\n }\n }\n `;\n};\n\n/**\n * ############################################\n * Create Mutation\n */\nexport interface CmsEntryCreateMutationResponse {\n content: {\n data: CmsContentEntry | null;\n error: CmsErrorResponse | null;\n };\n}\n\nexport interface CmsEntryCreateMutationVariables {\n /**\n * We have any here because we do not know which fields does entry have\n */\n data: Record<string, any>;\n options?: FormValidationOptions;\n}\n\nexport const createCreateMutation = (model: CmsEditorContentModel) => {\n const createFields = createFieldsList({ model, fields: model.fields });\n\n return gql`\n mutation CmsEntriesCreate${model.singularApiName}($data: ${model.singularApiName}Input!, $options: CreateCmsEntryOptionsInput) {\n content: create${model.singularApiName}(data: $data, options: $options) {\n data {\n ${CONTENT_ENTRY_SYSTEM_FIELDS}\n ${createFields}\n }\n error ${ERROR_FIELD}\n }\n }\n `;\n};\n\n/**\n * ############################################\n * Create From Mutation\n */\nexport interface CmsEntryCreateFromMutationResponse {\n content: {\n data?: CmsContentEntry;\n error?: CmsErrorResponse;\n };\n}\n\nexport interface CmsEntryCreateFromMutationVariables {\n revision: string;\n /**\n * We have any here because we do not know which fields does entry have\n */\n data?: Record<string, any>;\n options?: FormValidationOptions;\n}\n\nexport const createCreateFromMutation = (model: CmsEditorContentModel) => {\n return gql`\n mutation CmsCreate${model.singularApiName}From($revision: ID!, $data: ${\n model.singularApiName\n }Input, $options: CreateRevisionCmsEntryOptionsInput) {\n content: create${\n model.singularApiName\n }From(revision: $revision, data: $data, options: $options) {\n data {\n ${CONTENT_ENTRY_SYSTEM_FIELDS}\n ${createFieldsList({ model, fields: model.fields })}\n }\n error ${ERROR_FIELD}\n }\n }`;\n};\n\n/**\n * ############################################\n * Update Mutation\n */\nexport interface CmsEntryUpdateMutationResponse {\n content: {\n data?: CmsContentEntry;\n error?: CmsErrorResponse;\n };\n}\n\nexport interface CmsEntryUpdateMutationVariables {\n revision: string;\n /**\n * We have any here because we do not know which fields does entry have\n */\n data: Record<string, any>;\n options?: FormValidationOptions;\n}\n\nexport const createUpdateMutation = (model: CmsEditorContentModel) => {\n return gql`\n mutation CmsUpdate${model.singularApiName}($revision: ID!, $data: ${\n model.singularApiName\n }Input!, $options: UpdateCmsEntryOptionsInput) {\n content: update${\n model.singularApiName\n }(revision: $revision, data: $data, options: $options) {\n data {\n ${CONTENT_ENTRY_SYSTEM_FIELDS}\n ${createFieldsList({ model, fields: model.fields })}\n }\n error ${ERROR_FIELD}\n }\n }\n `;\n};\n\n/**\n * ############################################\n * Publish Mutation\n */\nexport interface CmsEntryPublishMutationResponse {\n content: {\n data?: CmsContentEntry;\n error?: CmsErrorResponse;\n };\n}\n\nexport interface CmsEntryPublishMutationVariables {\n revision: string;\n}\n\nexport const createPublishMutation = (model: CmsEditorContentModel) => {\n return gql`\n mutation CmsPublish${model.singularApiName}($revision: ID!) {\n content: publish${model.singularApiName}(revision: $revision) {\n data {\n ${CONTENT_ENTRY_SYSTEM_FIELDS}\n ${createFieldsList({ model, fields: model.fields })}\n }\n error ${ERROR_FIELD}\n }\n }`;\n};\n\n/**\n * ############################################\n * Unpublish Mutation\n */\nexport interface CmsEntryUnpublishMutationResponse {\n content: {\n data?: CmsContentEntry;\n error?: CmsErrorResponse;\n };\n}\n\nexport interface CmsEntryUnpublishMutationVariables {\n revision: string;\n}\n\nexport const createUnpublishMutation = (model: CmsEditorContentModel) => {\n return gql`\n mutation CmsUnpublish${model.singularApiName}($revision: ID!) {\n content: unpublish${model.singularApiName}(revision: $revision) {\n data {\n ${CONTENT_ENTRY_SYSTEM_FIELDS}\n ${createFieldsList({ model, fields: model.fields })}\n }\n error ${ERROR_FIELD}\n }\n }`;\n};\n\n/**\n * ############################################\n * Bulk Action Mutation\n */\nexport interface CmsEntryBulkActionMutationResponse {\n content: {\n data?: {\n id: string;\n };\n error?: CmsErrorResponse;\n };\n}\n\nexport interface CmsEntryBulkActionMutationVariables {\n action: string;\n where?: {\n [key: string]: any;\n };\n search?: string;\n data?: {\n [key: string]: any;\n };\n}\n\nexport const createBulkActionMutation = (model: CmsEditorContentModel) => {\n return gql`\n mutation CmsBulkAction${model.singularApiName}($action: BulkAction${model.singularApiName}Name!, $where: ${model.singularApiName}ListWhereInput, $search: String, $data: JSON) {\n content: bulkAction${model.singularApiName}(action: $action, where: $where, search: $search, data: $data) {\n data {\n id\n }\n error ${ERROR_FIELD}\n }\n }`;\n};\n"],"mappings":";;;;;;;;AAAA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AASA,IAAAC,iBAAA,GAAAD,OAAA;AACA,IAAAE,qBAAA,GAAAF,OAAA;AAA8D,IAAAG,eAAA,EAAAC,gBAAA,EAAAC,gBAAA,EAAAC,gBAAA,EAAAC,gBAAA,EAAAC,gBAAA,EAAAC,gBAAA,EAAAC,gBAAA,EAAAC,gBAAA,EAAAC,iBAAA,EAAAC,iBAAA;AAG9D,IAAMC,mBAAmB,GAAG,wIAS3B;AAED,IAAMC,2BAA2B,GAAG,0wDAAAC,MAAA,CA4G9BF,mBAAmB,OACxB;AAED,IAAMG,WAAW,GAAG,4EAMnB;;AAED;AACA;AACA;AACA;;AAaO,IAAMC,eAAe,GAAAC,OAAA,CAAAD,eAAA,GAAG,SAAlBA,eAAeA,CAAIE,KAA4B,EAAK;EAC7D;AACJ;AACA;EACI,WAAOC,mBAAG,EAAAlB,eAAA,KAAAA,eAAA,OAAAmB,uBAAA,CAAAC,OAAA,6SACeH,KAAK,CAACI,eAAe,EACxBJ,KAAK,CAACI,eAAe,EAEzBT,2BAA2B,EAC3B,IAAAU,kCAAgB,EAAC;IAAEL,KAAK,EAALA,KAAK;IAAEM,MAAM,EAAEN,KAAK,CAACM;EAAO,CAAC,CAAC,EAE/CT,WAAW;AAInC,CAAC;;AAED;AACA;AACA;AACA;;AAaO,IAAMU,oBAAoB,GAAAR,OAAA,CA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AAK,CAACI,eAAe,EAE/BT,2BAA2B,EAC3B,IAAAU,kCAAgB,EAAC;IAAEL,KAAK,EAALA,KAAK;IAAEM,MAAM,EAAEN,KAAK,CAACM;EAAO,CAAC,CAAC,EAE/CT,WAAW;AAGnC,CAAC;;AAED;AACA;AACA;AACA;;AAqBO,IAAMyB,wBAAwB,GAAAvB,OAAA,CAAAuB,wBAAA,GAAG,SAA3BA,wBAAwBA,CAAItB,KAA4B,EAAK;EACtE,WAAOC,mBAAG,EAAAR,iBAAA,KAAAA,iBAAA,OAAAS,uBAAA,CAAAC,OAAA,uWACkBH,KAAK,CAACI,eAAe,EAAuBJ,KAAK,CAACI,eAAe,EAAkBJ,KAAK,CAACI,eAAe,EACvGJ,KAAK,CAACI,eAAe,EAI9BP,WAAW;AAGnC,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_graphqlTag","_interopRequireDefault","require","_createFieldsList","_getModelTitleFieldId","_constants","_templateObject","_templateObject2","_templateObject3","_templateObject4","_templateObject5","_templateObject6","_templateObject7","_templateObject8","_templateObject9","_templateObject10","_templateObject11","_templateObject12","_templateObject13","CONTENT_META_FIELDS","createEntrySystemFields","model","isSingletonModel","tags","includes","CMS_MODEL_SINGLETON_TAG","optionalFields","concat","ERROR_FIELD","createReadQuery","exports","gql","_taggedTemplateLiteral2","default","singularApiName","createFieldsList","fields","createReadSingletonQuery","createRevisionsQuery","createListQueryDataSelection","getModelTitleFieldId","createListQuery","deleted","queryName","pluralApiName","createDeleteMutation","createRestoreFromBinMutation","createCreateMutation","createFields","createCreateFromMutation","createUpdateMutation","createUpdateSingletonMutation","createPublishMutation","createUnpublishMutation","createBulkActionMutation"],"sources":["entries.graphql.ts"],"sourcesContent":["import gql from \"graphql-tag\";\nimport {\n CmsContentEntryRevision,\n CmsContentEntry,\n CmsEditorContentModel,\n CmsErrorResponse,\n CmsMetaResponse,\n CmsModelField,\n CmsModel\n} from \"~/types\";\nimport { createFieldsList } from \"./createFieldsList\";\nimport { getModelTitleFieldId } from \"./getModelTitleFieldId\";\nimport { FormValidationOptions } from \"@webiny/form\";\nimport { CMS_MODEL_SINGLETON_TAG } from \"./constants\";\n\nconst CONTENT_META_FIELDS = /* GraphQL */ `\n title\n description\n image\n version\n locked\n status\n`;\n\nconst createEntrySystemFields = (model: CmsModel) => {\n const isSingletonModel = model.tags.includes(CMS_MODEL_SINGLETON_TAG);\n\n let optionalFields = \"\";\n if (!isSingletonModel) {\n optionalFields = `\n wbyAco_location {\n folderId\n }\n meta {\n ${CONTENT_META_FIELDS}\n }\n `;\n }\n\n return /* GraphQL */ `\n id\n entryId\n createdOn\n savedOn\n modifiedOn,\n deletedOn\n firstPublishedOn\n lastPublishedOn\n createdBy {\n id\n type\n displayName\n }\n savedBy {\n id\n type\n displayName\n }\n modifiedBy {\n id\n type\n displayName\n }\n deletedBy {\n id\n type\n displayName\n }\n firstPublishedBy {\n id\n type\n displayName\n }\n lastPublishedBy {\n id\n type\n displayName\n }\n revisionCreatedOn\n revisionSavedOn\n revisionModifiedOn\n revisionDeletedOn\n revisionFirstPublishedOn\n revisionLastPublishedOn\n revisionCreatedBy {\n id\n type\n displayName\n }\n revisionSavedBy {\n id\n type\n displayName\n }\n revisionModifiedBy {\n id\n type\n displayName\n }\n revisionDeletedBy {\n id\n type\n displayName\n }\n revisionFirstPublishedBy {\n id\n type\n displayName\n }\n revisionLastPublishedBy {\n id\n type\n displayName\n }\n revisionCreatedOn\n revisionSavedOn\n revisionModifiedOn\n revisionFirstPublishedOn\n revisionLastPublishedOn\n revisionCreatedBy {\n id\n type\n displayName\n }\n revisionSavedBy {\n id\n type\n displayName\n }\n revisionModifiedBy {\n id\n type\n displayName\n }\n revisionFirstPublishedBy {\n id\n type\n displayName\n }\n revisionLastPublishedBy {\n id\n type\n displayName\n }\n ${optionalFields}\n `;\n};\n\nconst ERROR_FIELD = /* GraphQL */ `\n {\n message\n code\n data\n }\n`;\n\n/**\n * ############################################\n * Get CMS Entry Query\n */\nexport interface CmsEntryGetQueryResponse {\n content: {\n data: CmsContentEntry;\n error: CmsErrorResponse | null;\n };\n}\n\nexport interface CmsEntryGetQueryVariables {\n revision?: string;\n entryId?: string;\n}\n\nexport const createReadQuery = (model: CmsEditorContentModel) => {\n /**\n * This query now accepts both revision or entryId as we can load exact revision or latest (if entryId was sent).\n */\n return gql`\n query CmsEntriesGet${model.singularApiName}($revision: ID, $entryId: ID) {\n content: get${model.singularApiName}(revision: $revision, entryId: $entryId) {\n data {\n ${createEntrySystemFields(model)}\n ${createFieldsList({ model, fields: model.fields })}\n }\n error ${ERROR_FIELD}\n }\n }\n `;\n};\n\n/**\n * ############################################\n * Get CMS Singleton Entry Query\n */\nexport interface CmsEntryGetSingletonQueryResponse {\n content: {\n data: CmsContentEntry;\n error: CmsErrorResponse | null;\n };\n}\n\nexport const createReadSingletonQuery = (model: CmsEditorContentModel) => {\n return gql`\n query CmsEntryGetSingleton${model.singularApiName} {\n content: get${model.singularApiName} {\n data {\n ${createEntrySystemFields(model)}\n ${createFieldsList({ model, fields: model.fields })}\n }\n error ${ERROR_FIELD}\n }\n }\n `;\n};\n\n/**\n * ############################################\n * List CMS Entry Revisions Query\n */\nexport interface CmsEntriesListRevisionsQueryResponse {\n revisions: {\n data: CmsContentEntryRevision[];\n error: CmsErrorResponse | null;\n meta: CmsMetaResponse;\n };\n}\n\nexport interface CmsEntriesListRevisionsQueryVariables {\n id: string;\n}\n\nexport const createRevisionsQuery = (model: CmsEditorContentModel) => {\n return gql`\n query CmsEntriesGet${model.singularApiName}Revisions($id: ID!) {\n revisions: get${model.singularApiName}Revisions(id: $id) {\n data {\n ${createEntrySystemFields(model)}\n }\n error ${ERROR_FIELD}\n }\n }\n `;\n};\n\n/**\n * ############################################\n * List CMS Entries Query\n */\nexport interface CmsEntriesListQueryResponse {\n content: {\n data: CmsContentEntry[];\n error: CmsErrorResponse | null;\n meta: CmsMetaResponse;\n };\n}\n\nexport interface CmsEntriesListQueryVariables {\n // TODO @ts-refactor better list types\n where?: {\n [key: string]: any;\n };\n sort?: string[];\n limit?: number;\n after?: string;\n}\n\nexport const createListQueryDataSelection = (\n model: CmsEditorContentModel,\n fields?: CmsModelField[]\n) => {\n return `\n ${createEntrySystemFields(model)}\n ${fields ? createFieldsList({ model, fields }) : \"\"}\n ${!fields ? getModelTitleFieldId(model) : \"\"}\n `;\n};\n\nexport const createListQuery = (\n model: CmsEditorContentModel,\n fields?: CmsModelField[],\n deleted?: boolean\n) => {\n const queryName = deleted ? `Deleted${model.pluralApiName}` : model.pluralApiName;\n\n return gql`\n query CmsEntriesList${queryName}($where: ${model.singularApiName}ListWhereInput, $sort: [${\n model.singularApiName\n }ListSorter], $limit: Int, $after: String, $search: String) {\n content: list${queryName}(\n where: $where\n sort: $sort\n limit: $limit\n after: $after\n search: $search\n ) {\n data {\n ${createListQueryDataSelection(model, fields)}\n }\n meta {\n cursor\n hasMoreItems\n totalCount\n }\n error ${ERROR_FIELD}\n }\n }\n `;\n};\n\n/**\n * ############################################\n * Delete Mutation\n */\nexport interface CmsEntryDeleteMutationResponse {\n content: {\n data: CmsContentEntry | null;\n error: CmsErrorResponse | null;\n };\n}\n\nexport interface CmsEntryDeleteMutationVariables {\n revision: string;\n permanently?: boolean;\n}\n\nexport const createDeleteMutation = (model: CmsEditorContentModel) => {\n return gql`\n mutation CmsEntriesDelete${model.singularApiName}($revision: ID!, $permanently: Boolean) {\n content: delete${model.singularApiName}(revision: $revision, options: {permanently: $permanently}) {\n data\n error ${ERROR_FIELD}\n }\n }\n `;\n};\n\n/**\n * ############################################\n * Restore from bin Mutation\n */\nexport interface CmsEntryRestoreFromBinMutationResponse {\n content: {\n data: CmsContentEntry | null;\n error: CmsErrorResponse | null;\n };\n}\n\nexport interface CmsEntryRestoreFromBinMutationVariables {\n revision: string;\n}\n\nexport const createRestoreFromBinMutation = (model: CmsEditorContentModel) => {\n return gql`\n mutation CmsEntriesRestore${model.singularApiName}FromBin($revision: ID!) {\n content: restore${model.singularApiName}FromBin(revision: $revision) {\n data {\n ${createEntrySystemFields(model)}\n ${createFieldsList({ model, fields: model.fields })}\n }\n error ${ERROR_FIELD}\n }\n }\n `;\n};\n\n/**\n * ############################################\n * Create Mutation\n */\nexport interface CmsEntryCreateMutationResponse {\n content: {\n data: CmsContentEntry | null;\n error: CmsErrorResponse | null;\n };\n}\n\nexport interface CmsEntryCreateMutationVariables {\n /**\n * We have any here because we do not know which fields does entry have\n */\n data: Record<string, any>;\n options?: FormValidationOptions;\n}\n\nexport const createCreateMutation = (model: CmsEditorContentModel) => {\n const createFields = createFieldsList({ model, fields: model.fields });\n\n return gql`\n mutation CmsEntriesCreate${model.singularApiName}($data: ${\n model.singularApiName\n }Input!, $options: CreateCmsEntryOptionsInput) {\n content: create${model.singularApiName}(data: $data, options: $options) {\n data {\n ${createEntrySystemFields(model)}\n ${createFields}\n }\n error ${ERROR_FIELD}\n }\n }\n `;\n};\n\n/**\n * ############################################\n * Create From Mutation\n */\nexport interface CmsEntryCreateFromMutationResponse {\n content: {\n data?: CmsContentEntry;\n error?: CmsErrorResponse;\n };\n}\n\nexport interface CmsEntryCreateFromMutationVariables {\n revision: string;\n /**\n * We have any here because we do not know which fields does entry have\n */\n data?: Record<string, any>;\n options?: FormValidationOptions;\n}\n\nexport const createCreateFromMutation = (model: CmsEditorContentModel) => {\n return gql`\n mutation CmsCreate${model.singularApiName}From($revision: ID!, $data: ${\n model.singularApiName\n }Input, $options: CreateRevisionCmsEntryOptionsInput) {\n content: create${\n model.singularApiName\n }From(revision: $revision, data: $data, options: $options) {\n data {\n ${createEntrySystemFields(model)}\n ${createFieldsList({ model, fields: model.fields })}\n }\n error ${ERROR_FIELD}\n }\n }`;\n};\n\n/**\n * ############################################\n * Update Mutation\n */\nexport interface CmsEntryUpdateMutationResponse {\n content: {\n data?: CmsContentEntry;\n error?: CmsErrorResponse;\n };\n}\n\nexport interface CmsEntryUpdateMutationVariables {\n revision: string;\n /**\n * We have any here because we do not know which fields does entry have\n */\n data: Record<string, any>;\n options?: FormValidationOptions;\n}\n\nexport const createUpdateMutation = (model: CmsEditorContentModel) => {\n return gql`\n mutation CmsUpdate${model.singularApiName}($revision: ID!, $data: ${\n model.singularApiName\n }Input!, $options: UpdateCmsEntryOptionsInput) {\n content: update${\n model.singularApiName\n }(revision: $revision, data: $data, options: $options) {\n data {\n ${createEntrySystemFields(model)}\n ${createFieldsList({ model, fields: model.fields })}\n }\n error ${ERROR_FIELD}\n }\n }\n `;\n};\n\n/**\n * ############################################\n * Update Singleton Mutation\n */\nexport interface CmsEntryUpdateSingletonMutationResponse {\n content: {\n data?: CmsContentEntry;\n error?: CmsErrorResponse;\n };\n}\n\nexport interface CmsEntryUpdateSingletonMutationVariables {\n /**\n * We have any here because we do not know which fields does entry have\n */\n data: Record<string, any>;\n options?: FormValidationOptions;\n}\n\nexport const createUpdateSingletonMutation = (model: CmsEditorContentModel) => {\n return gql`\n mutation CmsUpdate${model.singularApiName}($data: ${\n model.singularApiName\n }Input!, $options: UpdateCmsEntryOptionsInput) {\n content: update${model.singularApiName}(data: $data, options: $options) {\n data {\n ${createEntrySystemFields(model)}\n ${createFieldsList({ model, fields: model.fields })}\n }\n error ${ERROR_FIELD}\n }\n }\n `;\n};\n\n/**\n * ############################################\n * Publish Mutation\n */\nexport interface CmsEntryPublishMutationResponse {\n content: {\n data?: CmsContentEntry;\n error?: CmsErrorResponse;\n };\n}\n\nexport interface CmsEntryPublishMutationVariables {\n revision: string;\n}\n\nexport const createPublishMutation = (model: CmsEditorContentModel) => {\n return gql`\n mutation CmsPublish${model.singularApiName}($revision: ID!) {\n content: publish${model.singularApiName}(revision: $revision) {\n data {\n ${createEntrySystemFields(model)}\n ${createFieldsList({ model, fields: model.fields })}\n }\n error ${ERROR_FIELD}\n }\n }`;\n};\n\n/**\n * ############################################\n * Unpublish Mutation\n */\nexport interface CmsEntryUnpublishMutationResponse {\n content: {\n data?: CmsContentEntry;\n error?: CmsErrorResponse;\n };\n}\n\nexport interface CmsEntryUnpublishMutationVariables {\n revision: string;\n}\n\nexport const createUnpublishMutation = (model: CmsEditorContentModel) => {\n return gql`\n mutation CmsUnpublish${model.singularApiName}($revision: ID!) {\n content: unpublish${model.singularApiName}(revision: $revision) {\n data {\n ${createEntrySystemFields(model)}\n ${createFieldsList({ model, fields: model.fields })}\n }\n error ${ERROR_FIELD}\n }\n }`;\n};\n\n/**\n * ############################################\n * Bulk Action Mutation\n */\nexport interface CmsEntryBulkActionMutationResponse {\n content: {\n data?: {\n id: string;\n };\n error?: CmsErrorResponse;\n };\n}\n\nexport interface CmsEntryBulkActionMutationVariables {\n action: string;\n where?: {\n [key: string]: any;\n };\n search?: string;\n data?: {\n [key: string]: any;\n };\n}\n\nexport const createBulkActionMutation = (model: CmsEditorContentModel) => {\n return gql`\n mutation CmsBulkAction${model.singularApiName}($action: BulkAction${model.singularApiName}Name!, $where: ${model.singularApiName}ListWhereInput, $search: String, $data: JSON) {\n content: bulkAction${model.singularApiName}(action: $action, where: $where, search: $search, data: $data) {\n data {\n id\n }\n error ${ERROR_FIELD}\n }\n }`;\n};\n"],"mappings":";;;;;;;;AAAA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAUA,IAAAC,iBAAA,GAAAD,OAAA;AACA,IAAAE,qBAAA,GAAAF,OAAA;AAEA,IAAAG,UAAA,GAAAH,OAAA;AAAsD,IAAAI,eAAA,EAAAC,gBAAA,EAAAC,gBAAA,EAAAC,gBAAA,EAAAC,gBAAA,EAAAC,gBAAA,EAAAC,gBAAA,EAAAC,gBAAA,EAAAC,gBAAA,EAAAC,iBAAA,EAAAC,iBAAA,EAAAC,iBAAA,EAAAC,iBAAA;AAEtD,IAAMC,mBAAmB,GAAG,6FAO3B;AAED,IAAMC,uBAAuB,GAAG,SAA1BA,uBAAuBA,CAAIC,KAAe,EAAK;EACjD,IAAMC,gBAAgB,GAAGD,KAAK,CAACE,IAAI,CAACC,QAAQ,CAACC,kCAAuB,CAAC;EAErE,IAAIC,cAAc,GAAG,EAAE;EAC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eAAe,EACpBb,KAAK,CAACa,eAAe,EAE7Bd,uBAAuB,CAACC,KAAK,CAAC,EAC9B,IAAAc,kCAAgB,EAAC;IAAEd,KAAK,EAALA,KAAK;IAAEe,MAAM,EAAEf,KAAK,CAACe;EAAO,CAAC,CAAC,EAE/CR,WAAW;AAGnC,CAAC;;AAED;AACA;AACA;AACA;;AAYO,IAAMyB,uBAAuB,GAAAvB,OAAA,CAAAuB,uBAAA,GAAG,SAA1BA,uBAAuBA,CAAIhC,KAA4B,EAAK;EACrE,WAAOU,mBAAG,EAAAd,iBAAA,KAAAA,iBAAA,OAAAe,uBAAA,CAAAC,OAAA,gRACiBZ,KAAK,CAACa,eAAe,EACpBb,KAAK,CAACa,eAAe,EAE/Bd,uBAAuB,CAACC,KAAK,CAAC,EAC9B,IAAAc,kCAAgB,EAAC;IAAEd,KAAK,EAALA,KAAK;IAAEe,MAAM,EAAEf,KAAK,CAACe;EAAO,CAAC,CAAC,EAE/CR,WAAW;AAGnC,CAAC;;AAED;AACA;AACA;AACA;;AAqBO,IAAM0B,wBAAwB,GAAAxB,OAAA,CAAAwB,wBAAA,GAAG,SAA3BA,wBAAwBA,CAAIjC,KAA4B,EAAK;EACtE,WAAOU,mBAAG,EAAAb,iBAAA,KAAAA,iBAAA,OAAAc,uBAAA,CAAAC,OAAA,uWACkBZ,KAAK,CAACa,eAAe,EAAuBb,KAAK,CAACa,eAAe,EAAkBb,KAAK,CAACa,eAAe,EACvGb,KAAK,CAACa,eAAe,EAI9BN,WAAW;AAGnC,CAAC","ignoreList":[]}
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -47,5 +47,16 @@ Object.keys(_prepareFormData).forEach(function (key) {
|
|
|
47
47
|
}
|
|
48
48
|
});
|
|
49
49
|
});
|
|
50
|
+
var _constants = require("./constants");
|
|
51
|
+
Object.keys(_constants).forEach(function (key) {
|
|
52
|
+
if (key === "default" || key === "__esModule") return;
|
|
53
|
+
if (key in exports && exports[key] === _constants[key]) return;
|
|
54
|
+
Object.defineProperty(exports, key, {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function get() {
|
|
57
|
+
return _constants[key];
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
});
|
|
50
61
|
|
|
51
62
|
//# sourceMappingURL=index.js.map
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_entries","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_getModelTitleFieldId","_createFieldsList","_prepareFormData"],"sources":["index.ts"],"sourcesContent":["export * from \"./entries.graphql\";\nexport * from \"./getModelTitleFieldId\";\nexport * from \"./createFieldsList\";\nexport * from \"./prepareFormData\";\n"],"mappings":";;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,QAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,QAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,IAAA;MAAA,OAAAT,QAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,qBAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,qBAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,qBAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,IAAA;MAAA,OAAAC,qBAAA,CAAAL,GAAA;IAAA;EAAA;AAAA;AACA,IAAAM,iBAAA,GAAAV,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAQ,iBAAA,EAAAP,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAM,iBAAA,CAAAN,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,IAAA;MAAA,OAAAE,iBAAA,CAAAN,GAAA;IAAA;EAAA;AAAA;AACA,IAAAO,gBAAA,GAAAX,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAS,gBAAA,EAAAR,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAO,gBAAA,CAAAP,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,IAAA;MAAA,OAAAG,gBAAA,CAAAP,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_entries","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_getModelTitleFieldId","_createFieldsList","_prepareFormData","_constants"],"sources":["index.ts"],"sourcesContent":["export * from \"./entries.graphql\";\nexport * from \"./getModelTitleFieldId\";\nexport * from \"./createFieldsList\";\nexport * from \"./prepareFormData\";\nexport * from \"./constants\";\n"],"mappings":";;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,QAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,QAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,IAA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A,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAQ,UAAA,CAAAR,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,IAAA;MAAA,OAAAI,UAAA,CAAAR,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/app-headless-cms-common",
|
|
3
|
-
"version": "5.41.0
|
|
3
|
+
"version": "5.41.0",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -16,10 +16,10 @@
|
|
|
16
16
|
"@babel/runtime": "7.24.1",
|
|
17
17
|
"@fortawesome/fontawesome-svg-core": "1.3.0",
|
|
18
18
|
"@types/react": "18.2.79",
|
|
19
|
-
"@webiny/app-security": "5.41.0
|
|
20
|
-
"@webiny/form": "5.41.0
|
|
21
|
-
"@webiny/plugins": "5.41.0
|
|
22
|
-
"@webiny/validation": "5.41.0
|
|
19
|
+
"@webiny/app-security": "5.41.0",
|
|
20
|
+
"@webiny/form": "5.41.0",
|
|
21
|
+
"@webiny/plugins": "5.41.0",
|
|
22
|
+
"@webiny/validation": "5.41.0",
|
|
23
23
|
"dnd-core": "16.0.1",
|
|
24
24
|
"graphql": "15.8.0",
|
|
25
25
|
"graphql-tag": "2.12.6",
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
"@babel/preset-react": "7.24.1",
|
|
34
34
|
"@babel/preset-typescript": "7.24.1",
|
|
35
35
|
"@emotion/babel-plugin": "11.11.0",
|
|
36
|
-
"@webiny/cli": "5.41.0
|
|
37
|
-
"@webiny/project-utils": "5.41.0
|
|
36
|
+
"@webiny/cli": "5.41.0",
|
|
37
|
+
"@webiny/project-utils": "5.41.0",
|
|
38
38
|
"babel-plugin-module-resolver": "5.0.0",
|
|
39
39
|
"rimraf": "5.0.5",
|
|
40
40
|
"ttypescript": "1.5.15",
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"build": "yarn webiny run build",
|
|
49
49
|
"watch": "yarn webiny run watch"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "a542f4d0806744c5e2333b3786478c4af3b6b750"
|
|
52
52
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -379,16 +379,16 @@ export interface CmsContentEntryRevision {
|
|
|
379
379
|
deletedBy: CmsIdentity | null;
|
|
380
380
|
revisionCreatedOn: string;
|
|
381
381
|
revisionSavedOn: string;
|
|
382
|
-
revisionModifiedOn: string;
|
|
382
|
+
revisionModifiedOn: string | null;
|
|
383
383
|
revisionDeletedOn: string | null;
|
|
384
|
-
revisionFirstPublishedOn: string;
|
|
385
|
-
revisionLastPublishedOn: string;
|
|
384
|
+
revisionFirstPublishedOn: string | null;
|
|
385
|
+
revisionLastPublishedOn: string | null;
|
|
386
386
|
revisionCreatedBy: CmsIdentity;
|
|
387
387
|
revisionSavedBy: CmsIdentity;
|
|
388
|
-
revisionModifiedBy: CmsIdentity;
|
|
388
|
+
revisionModifiedBy: CmsIdentity | null;
|
|
389
389
|
revisionDeletedBy: CmsIdentity | null;
|
|
390
|
-
revisionFirstPublishedBy: CmsIdentity;
|
|
391
|
-
revisionLastPublishedBy: CmsIdentity;
|
|
390
|
+
revisionFirstPublishedBy: CmsIdentity | null;
|
|
391
|
+
revisionLastPublishedBy: CmsIdentity | null;
|
|
392
392
|
wbyAco_location: Location;
|
|
393
393
|
meta: {
|
|
394
394
|
title: string;
|
package/types/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_validation","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_model","_shared"],"sources":["index.ts"],"sourcesContent":["import * as React from \"react\";\nimport { ReactElement, ReactNode } from \"react\";\nimport { Plugin } from \"@webiny/plugins/types\";\nimport {\n BindComponent as BaseBindComponent,\n BindComponentProps as BaseBindComponentProps,\n BindComponentRenderProp as BaseBindComponentRenderProp,\n FormAPI\n} from \"@webiny/form\";\nimport { IconName, IconPrefix } from \"@fortawesome/fontawesome-svg-core\";\nimport { SecurityPermission } from \"@webiny/app-security/types\";\nimport {\n CmsModelFieldValidator,\n CmsModelFieldValidatorsFactory,\n CmsModelFieldValidatorsGroup\n} from \"./validation\";\nimport { CmsModel, CmsModelField } from \"./model\";\nimport { CmsIdentity } from \"~/types/shared\";\nimport type { SourceType } from \"dnd-core\";\n\nexport type DragObjectWithType = {\n type: SourceType;\n};\n\nexport * from \"./validation\";\nexport * from \"./model\";\nexport * from \"./shared\";\n\ninterface QueryFieldParams {\n model: CmsModel;\n field: CmsModelField;\n graphQLTypePrefix: string;\n}\n\ninterface Position {\n row: number;\n index: number;\n}\n\ninterface Location {\n folderId: string;\n}\n\nexport interface DragSource extends DragObjectWithType {\n parent?: string;\n pos?: Partial<Position>;\n type: \"row\" | \"field\" | \"newField\";\n fieldType?: string;\n field?: CmsModelField | null;\n fields?: CmsModelField[];\n}\n\n/**\n * @deprecated Use `CmsModelFieldTypePlugin`.\n */\nexport type CmsEditorFieldTypePlugin = CmsModelFieldTypePlugin;\n\nexport interface CmsModelFieldTypePlugin extends Plugin {\n /**\n * a plugin type\n */\n type: \"cms-editor-field-type\";\n field: {\n /**\n * A unique identifier of the field type (text, number, json, myField, ...).\n *\n * ```ts\n * type: \"myField\"\n * ```\n */\n type: string;\n /**\n * A display name for the field.\n *\n * ```ts\n * label: \"Field name\"\n * ```\n */\n label: string;\n /**\n * A list of available validators for the model field.\n *\n * ```ts\n * validators: [\n * \"required\",\n * \"gte\",\n * \"lte\"\n * ]\n * ```\n */\n validators?: string[] | CmsModelFieldValidatorsGroup | CmsModelFieldValidatorsFactory;\n /**\n * A list of available validators when a model field accepts a list (array) of values.\n *\n * ```ts\n * listValidators: [\n * \"minLength\",\n * \"maxLength\"\n * ]\n * ```\n */\n listValidators?: string[] | CmsModelFieldValidatorsGroup | CmsModelFieldValidatorsFactory;\n /**\n * An explanation of the field displayed beneath the label.\n *\n * ```ts\n * description: \"A short description of the field\"\n * ```\n */\n description: string;\n /**\n * A ReactNode to display the icon for the field.\n *\n * ```tsx\n * icon: <MyIconComponent />\n * ```\n */\n icon: React.ReactNode;\n /**\n * Is it allowed to have multiple values in this field?\n *\n * ```ts\n * allowMultipleValues: true\n * ```\n */\n allowMultipleValues?: boolean;\n /**\n * Does this field type have a fixed list of values that can be selected?\n *\n * ```ts\n * allowPredefinedValues: false\n * ```\n */\n allowPredefinedValues?: boolean;\n /**\n * A ReactNode label when multiple values are enabled.\n */\n multipleValuesLabel?: React.ReactNode;\n /**\n * These are default values when the field is first created. This is a representation of the field that is stored in the database.\n *\n * ```ts\n * createField: () => ({\n * type: \"fieldType\",\n * validation: [],\n * renderer: {\n * name: \"fieldTypeRenderer\"\n * }\n * })\n * ```\n */\n createField: () => Pick<CmsModelField, \"type\" | \"validation\" | \"renderer\" | \"settings\">;\n /**\n * If `true` (default), this field will be configurable via a settings dialog.\n * If `false`, a user will not be able to open the settings dialog, not will the dialog be opened on field drop.\n */\n canEditSettings?: boolean;\n /**\n * Determine if a `draggable` can be dropped into this field.\n * NOTE: This is only applicable to nested field types.\n */\n canAccept?(field: CmsModelField, draggable: DragSource): boolean;\n /**\n * If `true` (default), will allow fields to be laid out into columns (next to each other).\n * If `false`, horizontal layout will not be allowed.\n * NOTE: This is only applicable to nested field types.\n */\n allowLayout?: boolean;\n /**\n * A ReactNode that you can add in the section below the help text when creating/editing field.\n *\n * ```tsx\n * renderSettings: (params) => {\n * return <FieldSettingsComponent />;\n * }\n * ```\n */\n renderSettings?: (params: {\n afterChangeLabel: (value: string) => void;\n uniqueFieldIdValidator: (fieldId: string) => void;\n contentModel: CmsModel;\n }) => React.ReactNode;\n /**\n * A ReactNode that renders in the Predefined values tab.\n *\n * ```tsx\n * renderPredefinedValues: (params) => {\n * const {form: {Bind}} = params;\n * return (\n * <Bind name=\"fieldProperty\">\n * <InputComponent />\n * </Bind>\n * );\n * }\n * ```\n */\n renderPredefinedValues?: (params: {\n getBind: (index?: number) => any;\n }) => React.ReactElement;\n /**\n * Object wrapper for GraphQL stuff\n */\n graphql?: {\n /**\n * Define field selection.\n *\n * ```ts\n * graphql: {\n * queryField: `\n * {\n * id\n * title\n * createdOn\n * }\n * `,\n * }\n * ```\n */\n queryField?: string | ((params: QueryFieldParams) => string | null);\n };\n render?(params: any): React.ReactElement;\n tags?: string[];\n /**\n * Render additional information in the Admin UI Model edit view\n */\n renderInfo?: (params: { field: CmsModelField; model: CmsModel }) => React.ReactElement;\n };\n}\n\nexport interface CmsModelFieldRendererSettingsProps {\n field: CmsModelField;\n}\n\nexport interface CmsModelFieldRendererProps {\n field: CmsModelField;\n Label: React.ComponentType<React.PropsWithChildren>;\n getBind: <T = any>(index?: number, key?: string) => BindComponent<T>;\n contentModel: CmsModel;\n}\n\n/**\n * @deprecated Use `CmsModelFieldRendererProps`.\n */\nexport type CmsEditorFieldRendererProps = CmsModelFieldRendererProps;\n\n/**\n * @deprecated Use `CmsModelFieldRendererPlugin`.\n */\nexport type CmsEditorFieldRendererPlugin = CmsModelFieldRendererPlugin;\n\nexport interface CmsModelFieldRendererPlugin extends Plugin {\n /**\n * a plugin type\n */\n type: \"cms-editor-field-renderer\";\n renderer: {\n /**\n * Name of the renderer to match the one from `createField()` method in `CmsModelFieldTypePlugin`.\n *\n * ```ts\n * renderName: \"myFieldTypeRenderer\"\n * ```\n */\n rendererName: string;\n /**\n * A display name for the field in the UI. It is a `ReactNode` type, so you can use a JSX element.\n *\n * ```tsx\n * name: <MyFieldNameComponent />\n * ```\n */\n name: React.ReactNode;\n /**\n * A description for the field in the UI. Works exactly like the `name` property.\n *\n * ```tsx\n * name: <MyFieldDescriptionComponent />\n * ```\n */\n description: React.ReactNode;\n /**\n * A method that determines if the field can be rendered by this plugin.\n *\n * ```ts\n * canUse({ field }) {\n * return (\n * field.type === \"myType\" && !field.multipleValues\n * );\n * }\n * ```\n */\n canUse(props: {\n field: CmsModelField;\n fieldPlugin: CmsModelFieldTypePlugin;\n model: CmsModel;\n }): boolean;\n /**\n * Renders a field in the UI.\n *\n * ```tsx\n * render({ field, getBind }) {\n * const Bind = getBind();\n *\n * return (\n * <Bind>\n * {bind => {\n * return (\n * <Input\n * value={bind.value}\n * onChange={bind.onChange}\n * />\n * )\n * }}\n * </Bind>\n * );\n * }\n * ```\n */\n render(props: CmsModelFieldRendererProps): React.ReactNode;\n renderSettings?: (props: CmsModelFieldRendererSettingsProps) => React.ReactNode;\n };\n}\n\nexport interface CmsEditorFieldPredefinedValuesEntry {\n label: string;\n value: string;\n selected?: boolean;\n}\n\nexport interface CmsEditorFieldPredefinedValues {\n enabled: boolean;\n values: CmsEditorFieldPredefinedValuesEntry[];\n}\n\nexport interface CmsDynamicZoneTemplate {\n id: string;\n name: string;\n gqlTypeName: string;\n description: string;\n icon: string;\n fields: CmsModelField[];\n layout: string[][];\n validation: CmsModelFieldValidator[];\n tags?: string[];\n}\n\nexport interface CmsDynamicZoneTemplateWithTypename extends CmsDynamicZoneTemplate {\n __typename: string;\n}\n\nexport type CmsContentEntryStatusType = \"draft\" | \"published\" | \"unpublished\";\n\n/**\n * @deprecated Use `CmsContentEntry`.\n */\nexport type CmsEditorContentEntry = CmsContentEntry;\n\nexport interface CmsContentEntry {\n id: string;\n entryId: string;\n modelId: string;\n createdOn: string;\n createdBy: CmsIdentity;\n savedOn: string;\n savedBy: CmsIdentity;\n modifiedOn: string | null;\n modifiedBy: CmsIdentity | null;\n deletedOn: string | null;\n deletedBy: CmsIdentity | null;\n firstPublishedOn: string | null;\n firstPublishedBy: CmsIdentity | null;\n lastPublishedOn: string | null;\n lastPublishedBy: CmsIdentity | null;\n revisionCreatedOn: string;\n revisionCreatedBy: CmsIdentity;\n revisionSavedOn: string;\n revisionSavedBy: CmsIdentity;\n revisionModifiedOn: string | null;\n revisionModifiedBy: CmsIdentity | null;\n revisionDeletedOn: string | null;\n revisionDeletedBy: CmsIdentity | null;\n revisionFirstPublishedOn: string | null;\n revisionFirstPublishedBy: CmsIdentity | null;\n revisionLastPublishedOn: string | null;\n revisionLastPublishedBy: CmsIdentity | null;\n wbyAco_location: Location;\n meta: {\n title: string;\n description?: string;\n image?: string;\n locked: boolean;\n status: CmsContentEntryStatusType;\n version: number;\n };\n [key: string]: any;\n}\n\nexport interface CmsContentEntryRevision {\n id: string;\n modelId: string;\n savedOn: string;\n deletedOn: string | null;\n firstPublishedOn: string | null;\n lastPublishedOn: string | null;\n createdBy: CmsIdentity;\n deletedBy: CmsIdentity | null;\n revisionCreatedOn: string;\n revisionSavedOn: string;\n revisionModifiedOn: string;\n revisionDeletedOn: string | null;\n revisionFirstPublishedOn: string;\n revisionLastPublishedOn: string;\n revisionCreatedBy: CmsIdentity;\n revisionSavedBy: CmsIdentity;\n revisionModifiedBy: CmsIdentity;\n revisionDeletedBy: CmsIdentity | null;\n revisionFirstPublishedBy: CmsIdentity;\n revisionLastPublishedBy: CmsIdentity;\n wbyAco_location: Location;\n meta: {\n title: string;\n locked: boolean;\n status: CmsContentEntryStatusType;\n version: number;\n };\n}\n\nexport type CmsEditorContentTab = React.ComponentType<{ activeTab: boolean }>;\n\n// ------------------------------------------------------------------------------------------------------------\nexport interface CmsEditorFieldOptionPlugin extends Plugin {\n type: \"cms-editor-field-option\";\n render(): ReactElement;\n}\n\nexport interface CmsContentDetailsPlugin extends Plugin {\n render: (params: any) => ReactNode;\n}\n\nexport interface FieldLayoutPosition {\n row: number;\n index: number | null;\n}\n\nexport interface CmsEditorFormSettingsPlugin extends Plugin {\n type: \"cms-editor-form-settings\";\n title: string;\n description: string;\n icon: React.ReactElement;\n render(props: { Bind: BaseBindComponent; form: FormAPI; formData: any }): React.ReactNode;\n renderHeaderActions?(props: {\n Bind: BaseBindComponent;\n form: FormAPI;\n formData: any;\n }): React.ReactNode;\n}\n\nexport interface CmsIcon {\n /**\n * [ pack, icon ], ex: [\"fab\", \"cog\"]\n */\n id: [IconPrefix, IconName];\n /**\n * Icon name\n */\n name: string;\n /**\n * SVG element\n */\n svg: ReactElement;\n}\n\nexport interface CmsIconsPlugin extends Plugin {\n type: \"cms-icons\";\n getIcons(): CmsIcon[];\n}\n\n/**\n * Transform field value when sending data to the API.\n */\nexport interface CmsFieldValueTransformer<TField extends CmsModelField = CmsModelField>\n extends Plugin {\n /**\n * A plugin type.\n */\n type: \"cms-field-value-transformer\";\n /**\n * A field type for the value transformer. Or a list of field types.\n */\n fieldType: string | string[];\n /**\n * A transformer function that takes a value and returns a new one.\n */\n transform: (value: any, field: TField) => any;\n}\n\n/**\n * Define a custom form layout renderer for a specific content model.\n */\nexport interface CmsContentFormRendererPlugin extends Plugin {\n /**\n * A plugin type.\n */\n type: \"cms-content-form-renderer\";\n /**\n * Content model ID that will use this renderer.\n */\n modelId: string;\n\n /**\n * A function that will render a custom form layout.\n */\n render(props: {\n /**\n * Content model that is being rendered.\n */\n contentModel: CmsModel;\n /**\n * Content entry data handled by the Form element.\n */\n data: Record<string, any>;\n /**\n * A component to bind data to the Form.\n */\n Bind: BindComponent;\n /**\n * Content model fields to render.\n */\n fields: Record<string, React.ReactElement>;\n }): React.ReactNode;\n}\n/**\n * #########################\n * Data types\n * #########################\n */\nexport interface CmsSecurityPermission extends SecurityPermission {\n accessLevel?: \"full\" | \"no\" | \"custom\";\n models?: Record<string, string>;\n groups?: Record<string, string>;\n endpoints?: string[];\n locales?: string[];\n rwd?: string;\n own?: boolean;\n pw?: string;\n}\n\n/**\n * @category GraphQL\n * @category Error\n */\nexport interface CmsErrorResponse {\n message: string;\n code: string;\n data: Record<string, any>;\n}\n/**\n * @category GraphQL\n * @category Meta\n */\nexport interface CmsMetaResponse {\n totalCount: number;\n cursor: string | null;\n hasMoreItems: boolean;\n}\n\n/***\n * ###### FORM ########\n */\nexport interface BindComponentRenderProp<T = any> extends BaseBindComponentRenderProp<T> {\n parentName: string;\n appendValue: (value: any, index?: number) => void;\n prependValue: (value: any) => void;\n appendValues: (values: any[]) => void;\n removeValue: (index: number) => void;\n moveValueUp: (index: number) => void;\n moveValueDown: (index: number) => void;\n}\n\ninterface BindComponentProps<T = any> extends Omit<BaseBindComponentProps, \"children\" | \"name\"> {\n name?: string;\n children?: ((props: BindComponentRenderProp<T>) => React.ReactElement) | React.ReactElement;\n}\n\nexport type BindComponent<T = any> = React.ComponentType<BindComponentProps<T>> & {\n parentName: string;\n};\n\n/**\n * After RequestReview and RequestChanges was removed, we need an option to add new status filters\n */\nexport interface CmsEntryFilterStatusPlugin extends Plugin {\n type: \"cms.entry.filter.status\";\n label: string;\n value: string;\n}\n"],"mappings":";;;;;AAwBA,IAAAA,WAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,WAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,WAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,IAAA;MAAA,OAAAT,WAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,MAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,MAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,MAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,IAAA;MAAA,OAAAC,MAAA,CAAAL,GAAA;IAAA;EAAA;AAAA;AACA,IAAAM,OAAA,GAAAV,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAQ,OAAA,EAAAP,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAM,OAAA,CAAAN,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,IAAA;MAAA,OAAAE,OAAA,CAAAN,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_validation","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_model","_shared"],"sources":["index.ts"],"sourcesContent":["import * as React from \"react\";\nimport { ReactElement, ReactNode } from \"react\";\nimport { Plugin } from \"@webiny/plugins/types\";\nimport {\n BindComponent as BaseBindComponent,\n BindComponentProps as BaseBindComponentProps,\n BindComponentRenderProp as BaseBindComponentRenderProp,\n FormAPI\n} from \"@webiny/form\";\nimport { IconName, IconPrefix } from \"@fortawesome/fontawesome-svg-core\";\nimport { SecurityPermission } from \"@webiny/app-security/types\";\nimport {\n CmsModelFieldValidator,\n CmsModelFieldValidatorsFactory,\n CmsModelFieldValidatorsGroup\n} from \"./validation\";\nimport { CmsModel, CmsModelField } from \"./model\";\nimport { CmsIdentity } from \"~/types/shared\";\nimport type { SourceType } from \"dnd-core\";\n\nexport type DragObjectWithType = {\n type: SourceType;\n};\n\nexport * from \"./validation\";\nexport * from \"./model\";\nexport * from \"./shared\";\n\ninterface QueryFieldParams {\n model: CmsModel;\n field: CmsModelField;\n graphQLTypePrefix: string;\n}\n\ninterface Position {\n row: number;\n index: number;\n}\n\ninterface Location {\n folderId: string;\n}\n\nexport interface DragSource extends DragObjectWithType {\n parent?: string;\n pos?: Partial<Position>;\n type: \"row\" | \"field\" | \"newField\";\n fieldType?: string;\n field?: CmsModelField | null;\n fields?: CmsModelField[];\n}\n\n/**\n * @deprecated Use `CmsModelFieldTypePlugin`.\n */\nexport type CmsEditorFieldTypePlugin = CmsModelFieldTypePlugin;\n\nexport interface CmsModelFieldTypePlugin extends Plugin {\n /**\n * a plugin type\n */\n type: \"cms-editor-field-type\";\n field: {\n /**\n * A unique identifier of the field type (text, number, json, myField, ...).\n *\n * ```ts\n * type: \"myField\"\n * ```\n */\n type: string;\n /**\n * A display name for the field.\n *\n * ```ts\n * label: \"Field name\"\n * ```\n */\n label: string;\n /**\n * A list of available validators for the model field.\n *\n * ```ts\n * validators: [\n * \"required\",\n * \"gte\",\n * \"lte\"\n * ]\n * ```\n */\n validators?: string[] | CmsModelFieldValidatorsGroup | CmsModelFieldValidatorsFactory;\n /**\n * A list of available validators when a model field accepts a list (array) of values.\n *\n * ```ts\n * listValidators: [\n * \"minLength\",\n * \"maxLength\"\n * ]\n * ```\n */\n listValidators?: string[] | CmsModelFieldValidatorsGroup | CmsModelFieldValidatorsFactory;\n /**\n * An explanation of the field displayed beneath the label.\n *\n * ```ts\n * description: \"A short description of the field\"\n * ```\n */\n description: string;\n /**\n * A ReactNode to display the icon for the field.\n *\n * ```tsx\n * icon: <MyIconComponent />\n * ```\n */\n icon: React.ReactNode;\n /**\n * Is it allowed to have multiple values in this field?\n *\n * ```ts\n * allowMultipleValues: true\n * ```\n */\n allowMultipleValues?: boolean;\n /**\n * Does this field type have a fixed list of values that can be selected?\n *\n * ```ts\n * allowPredefinedValues: false\n * ```\n */\n allowPredefinedValues?: boolean;\n /**\n * A ReactNode label when multiple values are enabled.\n */\n multipleValuesLabel?: React.ReactNode;\n /**\n * These are default values when the field is first created. This is a representation of the field that is stored in the database.\n *\n * ```ts\n * createField: () => ({\n * type: \"fieldType\",\n * validation: [],\n * renderer: {\n * name: \"fieldTypeRenderer\"\n * }\n * })\n * ```\n */\n createField: () => Pick<CmsModelField, \"type\" | \"validation\" | \"renderer\" | \"settings\">;\n /**\n * If `true` (default), this field will be configurable via a settings dialog.\n * If `false`, a user will not be able to open the settings dialog, not will the dialog be opened on field drop.\n */\n canEditSettings?: boolean;\n /**\n * Determine if a `draggable` can be dropped into this field.\n * NOTE: This is only applicable to nested field types.\n */\n canAccept?(field: CmsModelField, draggable: DragSource): boolean;\n /**\n * If `true` (default), will allow fields to be laid out into columns (next to each other).\n * If `false`, horizontal layout will not be allowed.\n * NOTE: This is only applicable to nested field types.\n */\n allowLayout?: boolean;\n /**\n * A ReactNode that you can add in the section below the help text when creating/editing field.\n *\n * ```tsx\n * renderSettings: (params) => {\n * return <FieldSettingsComponent />;\n * }\n * ```\n */\n renderSettings?: (params: {\n afterChangeLabel: (value: string) => void;\n uniqueFieldIdValidator: (fieldId: string) => void;\n contentModel: CmsModel;\n }) => React.ReactNode;\n /**\n * A ReactNode that renders in the Predefined values tab.\n *\n * ```tsx\n * renderPredefinedValues: (params) => {\n * const {form: {Bind}} = params;\n * return (\n * <Bind name=\"fieldProperty\">\n * <InputComponent />\n * </Bind>\n * );\n * }\n * ```\n */\n renderPredefinedValues?: (params: {\n getBind: (index?: number) => any;\n }) => React.ReactElement;\n /**\n * Object wrapper for GraphQL stuff\n */\n graphql?: {\n /**\n * Define field selection.\n *\n * ```ts\n * graphql: {\n * queryField: `\n * {\n * id\n * title\n * createdOn\n * }\n * `,\n * }\n * ```\n */\n queryField?: string | ((params: QueryFieldParams) => string | null);\n };\n render?(params: any): React.ReactElement;\n tags?: string[];\n /**\n * Render additional information in the Admin UI Model edit view\n */\n renderInfo?: (params: { field: CmsModelField; model: CmsModel }) => React.ReactElement;\n };\n}\n\nexport interface CmsModelFieldRendererSettingsProps {\n field: CmsModelField;\n}\n\nexport interface CmsModelFieldRendererProps {\n field: CmsModelField;\n Label: React.ComponentType<React.PropsWithChildren>;\n getBind: <T = any>(index?: number, key?: string) => BindComponent<T>;\n contentModel: CmsModel;\n}\n\n/**\n * @deprecated Use `CmsModelFieldRendererProps`.\n */\nexport type CmsEditorFieldRendererProps = CmsModelFieldRendererProps;\n\n/**\n * @deprecated Use `CmsModelFieldRendererPlugin`.\n */\nexport type CmsEditorFieldRendererPlugin = CmsModelFieldRendererPlugin;\n\nexport interface CmsModelFieldRendererPlugin extends Plugin {\n /**\n * a plugin type\n */\n type: \"cms-editor-field-renderer\";\n renderer: {\n /**\n * Name of the renderer to match the one from `createField()` method in `CmsModelFieldTypePlugin`.\n *\n * ```ts\n * renderName: \"myFieldTypeRenderer\"\n * ```\n */\n rendererName: string;\n /**\n * A display name for the field in the UI. It is a `ReactNode` type, so you can use a JSX element.\n *\n * ```tsx\n * name: <MyFieldNameComponent />\n * ```\n */\n name: React.ReactNode;\n /**\n * A description for the field in the UI. Works exactly like the `name` property.\n *\n * ```tsx\n * name: <MyFieldDescriptionComponent />\n * ```\n */\n description: React.ReactNode;\n /**\n * A method that determines if the field can be rendered by this plugin.\n *\n * ```ts\n * canUse({ field }) {\n * return (\n * field.type === \"myType\" && !field.multipleValues\n * );\n * }\n * ```\n */\n canUse(props: {\n field: CmsModelField;\n fieldPlugin: CmsModelFieldTypePlugin;\n model: CmsModel;\n }): boolean;\n /**\n * Renders a field in the UI.\n *\n * ```tsx\n * render({ field, getBind }) {\n * const Bind = getBind();\n *\n * return (\n * <Bind>\n * {bind => {\n * return (\n * <Input\n * value={bind.value}\n * onChange={bind.onChange}\n * />\n * )\n * }}\n * </Bind>\n * );\n * }\n * ```\n */\n render(props: CmsModelFieldRendererProps): React.ReactNode;\n renderSettings?: (props: CmsModelFieldRendererSettingsProps) => React.ReactNode;\n };\n}\n\nexport interface CmsEditorFieldPredefinedValuesEntry {\n label: string;\n value: string;\n selected?: boolean;\n}\n\nexport interface CmsEditorFieldPredefinedValues {\n enabled: boolean;\n values: CmsEditorFieldPredefinedValuesEntry[];\n}\n\nexport interface CmsDynamicZoneTemplate {\n id: string;\n name: string;\n gqlTypeName: string;\n description: string;\n icon: string;\n fields: CmsModelField[];\n layout: string[][];\n validation: CmsModelFieldValidator[];\n tags?: string[];\n}\n\nexport interface CmsDynamicZoneTemplateWithTypename extends CmsDynamicZoneTemplate {\n __typename: string;\n}\n\nexport type CmsContentEntryStatusType = \"draft\" | \"published\" | \"unpublished\";\n\n/**\n * @deprecated Use `CmsContentEntry`.\n */\nexport type CmsEditorContentEntry = CmsContentEntry;\n\nexport interface CmsContentEntry {\n id: string;\n entryId: string;\n modelId: string;\n createdOn: string;\n createdBy: CmsIdentity;\n savedOn: string;\n savedBy: CmsIdentity;\n modifiedOn: string | null;\n modifiedBy: CmsIdentity | null;\n deletedOn: string | null;\n deletedBy: CmsIdentity | null;\n firstPublishedOn: string | null;\n firstPublishedBy: CmsIdentity | null;\n lastPublishedOn: string | null;\n lastPublishedBy: CmsIdentity | null;\n revisionCreatedOn: string;\n revisionCreatedBy: CmsIdentity;\n revisionSavedOn: string;\n revisionSavedBy: CmsIdentity;\n revisionModifiedOn: string | null;\n revisionModifiedBy: CmsIdentity | null;\n revisionDeletedOn: string | null;\n revisionDeletedBy: CmsIdentity | null;\n revisionFirstPublishedOn: string | null;\n revisionFirstPublishedBy: CmsIdentity | null;\n revisionLastPublishedOn: string | null;\n revisionLastPublishedBy: CmsIdentity | null;\n wbyAco_location: Location;\n meta: {\n title: string;\n description?: string;\n image?: string;\n locked: boolean;\n status: CmsContentEntryStatusType;\n version: number;\n };\n [key: string]: any;\n}\n\nexport interface CmsContentEntryRevision {\n id: string;\n modelId: string;\n savedOn: string;\n deletedOn: string | null;\n firstPublishedOn: string | null;\n lastPublishedOn: string | null;\n createdBy: CmsIdentity;\n deletedBy: CmsIdentity | null;\n revisionCreatedOn: string;\n revisionSavedOn: string;\n revisionModifiedOn: string | null;\n revisionDeletedOn: string | null;\n revisionFirstPublishedOn: string | null;\n revisionLastPublishedOn: string | null;\n revisionCreatedBy: CmsIdentity;\n revisionSavedBy: CmsIdentity;\n revisionModifiedBy: CmsIdentity | null;\n revisionDeletedBy: CmsIdentity | null;\n revisionFirstPublishedBy: CmsIdentity | null;\n revisionLastPublishedBy: CmsIdentity | null;\n wbyAco_location: Location;\n meta: {\n title: string;\n locked: boolean;\n status: CmsContentEntryStatusType;\n version: number;\n };\n}\n\nexport type CmsEditorContentTab = React.ComponentType<{ activeTab: boolean }>;\n\n// ------------------------------------------------------------------------------------------------------------\nexport interface CmsEditorFieldOptionPlugin extends Plugin {\n type: \"cms-editor-field-option\";\n render(): ReactElement;\n}\n\nexport interface CmsContentDetailsPlugin extends Plugin {\n render: (params: any) => ReactNode;\n}\n\nexport interface FieldLayoutPosition {\n row: number;\n index: number | null;\n}\n\nexport interface CmsEditorFormSettingsPlugin extends Plugin {\n type: \"cms-editor-form-settings\";\n title: string;\n description: string;\n icon: React.ReactElement;\n render(props: { Bind: BaseBindComponent; form: FormAPI; formData: any }): React.ReactNode;\n renderHeaderActions?(props: {\n Bind: BaseBindComponent;\n form: FormAPI;\n formData: any;\n }): React.ReactNode;\n}\n\nexport interface CmsIcon {\n /**\n * [ pack, icon ], ex: [\"fab\", \"cog\"]\n */\n id: [IconPrefix, IconName];\n /**\n * Icon name\n */\n name: string;\n /**\n * SVG element\n */\n svg: ReactElement;\n}\n\nexport interface CmsIconsPlugin extends Plugin {\n type: \"cms-icons\";\n getIcons(): CmsIcon[];\n}\n\n/**\n * Transform field value when sending data to the API.\n */\nexport interface CmsFieldValueTransformer<TField extends CmsModelField = CmsModelField>\n extends Plugin {\n /**\n * A plugin type.\n */\n type: \"cms-field-value-transformer\";\n /**\n * A field type for the value transformer. Or a list of field types.\n */\n fieldType: string | string[];\n /**\n * A transformer function that takes a value and returns a new one.\n */\n transform: (value: any, field: TField) => any;\n}\n\n/**\n * Define a custom form layout renderer for a specific content model.\n */\nexport interface CmsContentFormRendererPlugin extends Plugin {\n /**\n * A plugin type.\n */\n type: \"cms-content-form-renderer\";\n /**\n * Content model ID that will use this renderer.\n */\n modelId: string;\n\n /**\n * A function that will render a custom form layout.\n */\n render(props: {\n /**\n * Content model that is being rendered.\n */\n contentModel: CmsModel;\n /**\n * Content entry data handled by the Form element.\n */\n data: Record<string, any>;\n /**\n * A component to bind data to the Form.\n */\n Bind: BindComponent;\n /**\n * Content model fields to render.\n */\n fields: Record<string, React.ReactElement>;\n }): React.ReactNode;\n}\n/**\n * #########################\n * Data types\n * #########################\n */\nexport interface CmsSecurityPermission extends SecurityPermission {\n accessLevel?: \"full\" | \"no\" | \"custom\";\n models?: Record<string, string>;\n groups?: Record<string, string>;\n endpoints?: string[];\n locales?: string[];\n rwd?: string;\n own?: boolean;\n pw?: string;\n}\n\n/**\n * @category GraphQL\n * @category Error\n */\nexport interface CmsErrorResponse {\n message: string;\n code: string;\n data: Record<string, any>;\n}\n/**\n * @category GraphQL\n * @category Meta\n */\nexport interface CmsMetaResponse {\n totalCount: number;\n cursor: string | null;\n hasMoreItems: boolean;\n}\n\n/***\n * ###### FORM ########\n */\nexport interface BindComponentRenderProp<T = any> extends BaseBindComponentRenderProp<T> {\n parentName: string;\n appendValue: (value: any, index?: number) => void;\n prependValue: (value: any) => void;\n appendValues: (values: any[]) => void;\n removeValue: (index: number) => void;\n moveValueUp: (index: number) => void;\n moveValueDown: (index: number) => void;\n}\n\ninterface BindComponentProps<T = any> extends Omit<BaseBindComponentProps, \"children\" | \"name\"> {\n name?: string;\n children?: ((props: BindComponentRenderProp<T>) => React.ReactElement) | React.ReactElement;\n}\n\nexport type BindComponent<T = any> = React.ComponentType<BindComponentProps<T>> & {\n parentName: string;\n};\n\n/**\n * After RequestReview and RequestChanges was removed, we need an option to add new status filters\n */\nexport interface CmsEntryFilterStatusPlugin extends Plugin {\n type: \"cms.entry.filter.status\";\n label: string;\n value: string;\n}\n"],"mappings":";;;;;AAwBA,IAAAA,WAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,WAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,WAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,IAAA;MAAA,OAAAT,WAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,MAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,MAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,MAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,IAAA;MAAA,OAAAC,MAAA,CAAAL,GAAA;IAAA;EAAA;AAAA;AACA,IAAAM,OAAA,GAAAV,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAQ,OAAA,EAAAP,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAM,OAAA,CAAAN,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,IAAA;MAAA,OAAAE,OAAA,CAAAN,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
|