@webiny/api-headless-cms 6.3.0-beta.1 → 6.3.0-beta.3
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/entryDataFactories/createEntryData.js +1 -1
- package/crud/contentEntry/entryDataFactories/createEntryData.js.map +1 -1
- package/features/contentModel/ContentModelFeature.js +2 -0
- package/features/contentModel/ContentModelFeature.js.map +1 -1
- package/features/contentModel/CreateModel/CreateModelRepository.d.ts +11 -11
- package/features/contentModel/CreateModel/CreateModelRepository.js +12 -10
- package/features/contentModel/CreateModel/CreateModelRepository.js.map +1 -1
- package/features/contentModel/CreateModelFrom/CreateModelFromRepository.d.ts +11 -12
- package/features/contentModel/CreateModelFrom/CreateModelFromRepository.js +12 -11
- package/features/contentModel/CreateModelFrom/CreateModelFromRepository.js.map +1 -1
- package/features/contentModel/ModelFieldCompression/ModelFieldCompression.d.ts +15 -0
- package/features/contentModel/ModelFieldCompression/ModelFieldCompression.js +27 -0
- package/features/contentModel/ModelFieldCompression/ModelFieldCompression.js.map +1 -0
- package/features/contentModel/ModelFieldCompression/abstractions.d.ts +17 -0
- package/features/contentModel/ModelFieldCompression/abstractions.js +4 -0
- package/features/contentModel/ModelFieldCompression/abstractions.js.map +1 -0
- package/features/contentModel/ModelFieldCompression/feature.d.ts +4 -0
- package/features/contentModel/ModelFieldCompression/feature.js +10 -0
- package/features/contentModel/ModelFieldCompression/feature.js.map +1 -0
- package/features/contentModel/ModelFieldCompression/index.d.ts +1 -0
- package/features/contentModel/ModelFieldCompression/index.js +3 -0
- package/features/contentModel/ModelFieldCompression/index.js.map +1 -0
- package/features/contentModel/UpdateModel/UpdateModelRepository.d.ts +9 -9
- package/features/contentModel/UpdateModel/UpdateModelRepository.js +13 -10
- package/features/contentModel/UpdateModel/UpdateModelRepository.js.map +1 -1
- package/features/contentModel/shared/ModelsFetcher.d.ts +7 -5
- package/features/contentModel/shared/ModelsFetcher.js +13 -3
- package/features/contentModel/shared/ModelsFetcher.js.map +1 -1
- package/features/modelBuilder/fields/DateTimeFieldType.js +20 -0
- package/features/modelBuilder/fields/DateTimeFieldType.js.map +1 -1
- package/graphql/schema/cms/createEntryResolver.js +9 -0
- package/graphql/schema/cms/createEntryResolver.js.map +1 -1
- package/graphql/schema/cms/deleteEntryResolver.js +9 -0
- package/graphql/schema/cms/deleteEntryResolver.js.map +1 -1
- package/graphql/schema/cms/getEntryResolver.js +9 -0
- package/graphql/schema/cms/getEntryResolver.js.map +1 -1
- package/graphql/schema/cms/listEntriesResolver.js +14 -0
- package/graphql/schema/cms/listEntriesResolver.js.map +1 -1
- package/graphql/schema/cms/publishEntryResolver.js +9 -0
- package/graphql/schema/cms/publishEntryResolver.js.map +1 -1
- package/graphql/schema/cms/unpublishEntryResolver.js +9 -0
- package/graphql/schema/cms/unpublishEntryResolver.js.map +1 -1
- package/graphql/schema/cms/updateEntryResolver.js +9 -0
- package/graphql/schema/cms/updateEntryResolver.js.map +1 -1
- package/package.json +28 -25
- package/types/model.d.ts +7 -0
- package/types/model.js.map +1 -1
- package/types/types.d.ts +8 -8
- package/types/types.js.map +1 -1
- package/utils/toSlug.js +1 -1
- package/utils/toSlug.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getModel","getErrorMessage","buildFieldsSelection","createUpdateEntryRevisionResolver","args","context","modelId","revisionId","data","fields","model","apiType","executeSchema","cms","getExecutableSchema","fieldsSelection","query","singularApiName","result","variables","
|
|
1
|
+
{"version":3,"names":["getModel","getErrorMessage","buildFieldsSelection","createUpdateEntryRevisionResolver","args","context","modelId","revisionId","data","fields","model","apiType","executeSchema","cms","getExecutableSchema","fieldsSelection","query","singularApiName","result","variables","errors","length","error","message","map","e","join","code","operationName"],"sources":["updateEntryResolver.ts"],"sourcesContent":["import type { CmsContext } from \"~/types/index.js\";\nimport type { ApiEndpoint } from \"~/types/index.js\";\nimport type { ExecutionResult } from \"graphql\";\nimport { getModel, getErrorMessage, buildFieldsSelection } from \"./helpers.js\";\n\nexport interface UpdateEntryRevisionArgs {\n modelId: string;\n revisionId: string;\n data: Record<string, unknown>;\n fields: string[];\n}\n\nexport const createUpdateEntryRevisionResolver = () => {\n return async ({ args, context }: { args: UpdateEntryRevisionArgs; context: CmsContext }) => {\n const { modelId, revisionId, data, fields } = args;\n\n try {\n const model = await getModel(context, modelId);\n\n // Use manage API for updating entries.\n const apiType: ApiEndpoint = \"manage\";\n const executeSchema = await context.cms.getExecutableSchema(apiType);\n\n const fieldsSelection = buildFieldsSelection(fields);\n\n const query = /* GraphQL */ `\n mutation Update${model.singularApiName}($revisionId: ID!, $data: ${model.singularApiName}Input!) {\n update${model.singularApiName}(revision: $revisionId, data: $data) {\n data {\n ${fieldsSelection}\n }\n error {\n message\n code\n data\n }\n }\n }\n `;\n\n const result = (await executeSchema({\n query,\n variables: { revisionId, data }\n })) as ExecutionResult;\n\n if (result.errors && result.errors.length > 0) {\n return {\n data: null,\n error: {\n message: result.errors.map(e => e.message).join(\"; \"),\n code: \"UPDATE_ENTRY_ERROR\"\n }\n };\n }\n\n const operationName = `update${model.singularApiName}`;\n return result.data?.[operationName] || { data: null, error: null };\n } catch (error) {\n return {\n data: null,\n error: {\n message: getErrorMessage(error, \"Failed to update entry\"),\n code: \"UPDATE_ENTRY_ERROR\"\n }\n };\n }\n };\n};\n"],"mappings":"AAGA,SAASA,QAAQ,EAAEC,eAAe,EAAEC,oBAAoB;AASxD,OAAO,MAAMC,iCAAiC,GAAGA,CAAA,KAAM;EACnD,OAAO,OAAO;IAAEC,IAAI;IAAEC;EAAgE,CAAC,KAAK;IACxF,MAAM;MAAEC,OAAO;MAAEC,UAAU;MAAEC,IAAI;MAAEC;IAAO,CAAC,GAAGL,IAAI;IAElD,IAAI;MACA,MAAMM,KAAK,GAAG,MAAMV,QAAQ,CAACK,OAAO,EAAEC,OAAO,CAAC;;MAE9C;MACA,MAAMK,OAAoB,GAAG,QAAQ;MACrC,MAAMC,aAAa,GAAG,MAAMP,OAAO,CAACQ,GAAG,CAACC,mBAAmB,CAACH,OAAO,CAAC;MAEpE,MAAMI,eAAe,GAAGb,oBAAoB,CAACO,MAAM,CAAC;MAEpD,MAAMO,KAAK,GAAG,aAAc;AACxC,iCAAiCN,KAAK,CAACO,eAAe,6BAA6BP,KAAK,CAACO,eAAe;AACxG,4BAA4BP,KAAK,CAACO,eAAe;AACjD;AACA,8BAA8BF,eAAe;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;MAED,MAAMG,MAAM,GAAI,MAAMN,aAAa,CAAC;QAChCI,KAAK;QACLG,SAAS,EAAE;UAAEZ,UAAU;UAAEC;QAAK;MAClC,CAAC,CAAqB;MAEtB,IAAIU,MAAM,CAACE,MAAM,IAAIF,MAAM,CAACE,MAAM,CAACC,MAAM,GAAG,CAAC,EAAE;QAC3C,OAAO;UACHb,IAAI,EAAE,IAAI;UACVc,KAAK,EAAE;YACHC,OAAO,EAAEL,MAAM,CAACE,MAAM,CAACI,GAAG,CAACC,CAAC,IAAIA,CAAC,CAACF,OAAO,CAAC,CAACG,IAAI,CAAC,IAAI,CAAC;YACrDC,IAAI,EAAE;UACV;QACJ,CAAC;MACL;MAEA,MAAMC,aAAa,GAAG,SAASlB,KAAK,CAACO,eAAe,EAAE;MACtD,OAAOC,MAAM,CAACV,IAAI,GAAGoB,aAAa,CAAC,IAAI;QAAEpB,IAAI,EAAE,IAAI;QAAEc,KAAK,EAAE;MAAK,CAAC;IACtE,CAAC,CAAC,OAAOA,KAAK,EAAE;MACZ,OAAO;QACHd,IAAI,EAAE,IAAI;QACVc,KAAK,EAAE;UACHC,OAAO,EAAEtB,eAAe,CAACqB,KAAK,EAAE,wBAAwB,CAAC;UACzDK,IAAI,EAAE;QACV;MACJ,CAAC;IACL;EACJ,CAAC;AACL,CAAC","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/api-headless-cms",
|
|
3
|
-
"version": "6.3.0-beta.
|
|
3
|
+
"version": "6.3.0-beta.3",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"
|
|
5
|
+
"exports": {
|
|
6
|
+
".": "./index.js",
|
|
7
|
+
"./*": "./*"
|
|
8
|
+
},
|
|
6
9
|
"keywords": [
|
|
7
10
|
"cms:base"
|
|
8
11
|
],
|
|
@@ -20,21 +23,21 @@
|
|
|
20
23
|
"license": "MIT",
|
|
21
24
|
"dependencies": {
|
|
22
25
|
"@babel/code-frame": "7.29.0",
|
|
23
|
-
"@graphql-tools/merge": "9.1.
|
|
24
|
-
"@graphql-tools/schema": "10.0.
|
|
25
|
-
"@webiny/api": "6.3.0-beta.
|
|
26
|
-
"@webiny/api-core": "6.3.0-beta.
|
|
26
|
+
"@graphql-tools/merge": "9.1.9",
|
|
27
|
+
"@graphql-tools/schema": "10.0.33",
|
|
28
|
+
"@webiny/api": "6.3.0-beta.3",
|
|
29
|
+
"@webiny/api-core": "6.3.0-beta.3",
|
|
27
30
|
"@webiny/di": "0.2.3",
|
|
28
|
-
"@webiny/error": "6.3.0-beta.
|
|
29
|
-
"@webiny/feature": "6.3.0-beta.
|
|
30
|
-
"@webiny/handler": "6.3.0-beta.
|
|
31
|
-
"@webiny/handler-aws": "6.3.0-beta.
|
|
32
|
-
"@webiny/handler-db": "6.3.0-beta.
|
|
33
|
-
"@webiny/handler-graphql": "6.3.0-beta.
|
|
34
|
-
"@webiny/plugins": "6.3.0-beta.
|
|
35
|
-
"@webiny/project": "6.3.0-beta.
|
|
36
|
-
"@webiny/utils": "6.3.0-beta.
|
|
37
|
-
"@webiny/validation": "6.3.0-beta.
|
|
31
|
+
"@webiny/error": "6.3.0-beta.3",
|
|
32
|
+
"@webiny/feature": "6.3.0-beta.3",
|
|
33
|
+
"@webiny/handler": "6.3.0-beta.3",
|
|
34
|
+
"@webiny/handler-aws": "6.3.0-beta.3",
|
|
35
|
+
"@webiny/handler-db": "6.3.0-beta.3",
|
|
36
|
+
"@webiny/handler-graphql": "6.3.0-beta.3",
|
|
37
|
+
"@webiny/plugins": "6.3.0-beta.3",
|
|
38
|
+
"@webiny/project": "6.3.0-beta.3",
|
|
39
|
+
"@webiny/utils": "6.3.0-beta.3",
|
|
40
|
+
"@webiny/validation": "6.3.0-beta.3",
|
|
38
41
|
"dot-prop-immutable": "2.1.1",
|
|
39
42
|
"graphql": "16.13.2",
|
|
40
43
|
"graphql-tag": "2.12.6",
|
|
@@ -48,24 +51,24 @@
|
|
|
48
51
|
"devDependencies": {
|
|
49
52
|
"@types/babel__code-frame": "7.27.0",
|
|
50
53
|
"@types/pluralize": "0.0.33",
|
|
51
|
-
"@webiny/aws-sdk": "6.3.0-beta.
|
|
52
|
-
"@webiny/build-tools": "6.3.0-beta.
|
|
53
|
-
"@webiny/db-dynamodb": "6.3.0-beta.
|
|
54
|
+
"@webiny/aws-sdk": "6.3.0-beta.3",
|
|
55
|
+
"@webiny/build-tools": "6.3.0-beta.3",
|
|
56
|
+
"@webiny/db-dynamodb": "6.3.0-beta.3",
|
|
54
57
|
"@webiny/handler-db": "0.0.0",
|
|
55
|
-
"@webiny/project-utils": "6.3.0-beta.
|
|
56
|
-
"@webiny/sdk": "6.3.0-beta.
|
|
57
|
-
"@webiny/wcp": "6.3.0-beta.
|
|
58
|
+
"@webiny/project-utils": "6.3.0-beta.3",
|
|
59
|
+
"@webiny/sdk": "6.3.0-beta.3",
|
|
60
|
+
"@webiny/wcp": "6.3.0-beta.3",
|
|
58
61
|
"apollo-graphql": "0.9.7",
|
|
59
62
|
"graphql": "16.13.2",
|
|
60
|
-
"oxfmt": "0.
|
|
63
|
+
"oxfmt": "0.47.0",
|
|
61
64
|
"rimraf": "6.1.3",
|
|
62
65
|
"typescript": "6.0.3",
|
|
63
|
-
"vitest": "4.1.
|
|
66
|
+
"vitest": "4.1.5",
|
|
64
67
|
"write-json-file": "7.0.0"
|
|
65
68
|
},
|
|
66
69
|
"publishConfig": {
|
|
67
70
|
"access": "public",
|
|
68
71
|
"directory": "dist"
|
|
69
72
|
},
|
|
70
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "e154ec3326903876c357d35422dc60d29e061419"
|
|
71
74
|
}
|
package/types/model.d.ts
CHANGED
|
@@ -141,6 +141,13 @@ export interface CmsModel {
|
|
|
141
141
|
*/
|
|
142
142
|
isPlugin?: boolean;
|
|
143
143
|
}
|
|
144
|
+
export interface StorageCmsModelFields {
|
|
145
|
+
compression: string;
|
|
146
|
+
value: string;
|
|
147
|
+
}
|
|
148
|
+
export interface StorageCmsModel extends Omit<CmsModel, "fields"> {
|
|
149
|
+
fields: StorageCmsModelFields | CmsModelField[];
|
|
150
|
+
}
|
|
144
151
|
export interface CmsModelAuthorization {
|
|
145
152
|
permissions: boolean;
|
|
146
153
|
[key: string]: any;
|
package/types/model.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["model.ts"],"sourcesContent":["import type { CmsIdentity } from \"./identity.js\";\nimport type { CmsModelField, CmsModelFieldInput, FieldRule } from \"./modelField.js\";\nimport type { CmsIcon } from \"~/types/types.js\";\n\nexport interface CmsTabLayoutTab {\n id: string;\n label: string;\n icon?: CmsIcon | null;\n layout: CmsModelLayout;\n rules?: FieldRule[];\n}\n\nexport interface CmsTabLayoutDescriptor {\n type: \"tabs\";\n label: string;\n description?: string | null;\n help?: string | null;\n tabs: CmsTabLayoutTab[];\n rules?: FieldRule[];\n}\n\nexport interface CmsSeparatorLayoutDescriptor {\n type: \"separator\";\n label: string;\n description: string | null | undefined;\n rules?: FieldRule[];\n}\n\nexport interface CmsAlertLayoutDescriptor {\n type: \"alert\";\n label: string;\n alertType: \"info\" | \"success\" | \"warning\" | \"danger\";\n rules?: FieldRule[];\n}\n\nexport type CmsModelLayoutCell =\n | string\n | CmsTabLayoutDescriptor\n | CmsSeparatorLayoutDescriptor\n | CmsAlertLayoutDescriptor;\nexport type CmsModelLayout = CmsModelLayoutCell[][];\n\n/**\n * Base CMS Model. Should not be exported and used outside of this package.\n *\n * @category Database model\n * @category CmsModel\n */\nexport interface CmsModel {\n /**\n * Name of the content model.\n */\n name: string;\n /**\n * Unique ID for the content model. Created from name if not defined by user.\n */\n modelId: string;\n /**\n * Name of the content model in singular form to be used in the API.\n * example:\n * - Article\n * - Fruit\n * - Vegetable\n * - Car\n */\n singularApiName: string;\n /**\n * Name of the content model in plural form to be used in the API.\n * example:\n * - Articles\n * - Fruits\n * - Vegetables\n * - Cars\n */\n pluralApiName: string;\n /**\n * Model tenant.\n */\n tenant: string;\n /**\n * Model group slug.\n */\n group: string;\n /**\n * Icon for the content model.\n */\n icon: CmsIcon | null;\n /**\n * Description for the content model.\n */\n description: string | null;\n /**\n * Date created\n */\n createdOn?: string;\n /**\n * Date saved. Changes on both save and create.\n */\n savedOn?: string;\n /**\n * CreatedBy object wrapper. Contains id, name and type of the user.\n */\n createdBy?: CmsIdentity;\n /**\n * List of fields defining entry values.\n */\n fields: CmsModelField[];\n /**\n * Admin UI field layout\n *\n * ```ts\n * layout: [\n * [field1id, field2id],\n * [field3id]\n * ]\n * ```\n */\n layout: CmsModelLayout;\n /**\n * Models can be tagged to give them contextual meaning.\n */\n tags?: string[];\n /**\n * The field that is used as an entry title.\n * If not specified by the user, the system tries to assign the first available `text` field.\n */\n titleFieldId: string;\n /**\n * The field that is used as an entry description.\n * If not set by the user, the system will try to assign the first available `long-text` field.\n */\n descriptionFieldId?: string | null;\n /**\n * The field that is used as an entry image.\n * If not set by the user, the system will try to assign a `file` field which has `imagesOnly` enabled.\n */\n imageFieldId?: string | null;\n\n /**\n * Is model private?\n * This is meant to be used for some internal models - will not be visible in the schema.\n * Only available for the plugin constructed models.\n */\n isPrivate?: boolean;\n\n /**\n * Does this model require authorization to be performed?\n * Only available for models created via plugins.\n */\n authorization?: boolean | CmsModelAuthorization;\n\n /**\n * Is this model created via plugin?\n */\n isPlugin?: boolean;\n}\n\nexport interface CmsModelAuthorization {\n permissions: boolean;\n\n [key: string]: any;\n}\n\n/**\n * A GraphQL `params.data` parameter received when creating content model.\n *\n * @category GraphQL params\n * @category CmsModel\n */\nexport interface CmsModelCreateInput {\n /**\n * Name of the content model.\n */\n name: string;\n /**\n * Singular name of the content model to be used in the API.\n */\n singularApiName: string;\n /**\n * Plural name of the content model to be used in the API.\n */\n pluralApiName: string;\n /**\n * Unique ID of the content model. Created from name if not sent by the user. Cannot be changed.\n */\n modelId?: string;\n /**\n * Description of the content model.\n */\n description?: string | null;\n /**\n * Group where to put the content model in.\n */\n group: string;\n /**\n * A list of content model fields to define the entry values.\n */\n fields?: CmsModelFieldInput[];\n /**\n * Admin UI field layout\n *\n * ```ts\n * layout: [\n * [field1id, field2id],\n * [field3id]\n * ]\n * ```\n */\n layout?: CmsModelLayout;\n /**\n * Models can be tagged to give them contextual meaning.\n */\n tags?: string[];\n /**\n * Fields fieldId which are picked to represent the CMS entry.\n */\n titleFieldId?: string | null;\n descriptionFieldId?: string | null;\n imageFieldId?: string | null;\n icon?: CmsIcon | null;\n}\n\n/**\n * A GraphQL `params.data` parameter received when creating content model from existing model.\n *\n * @category GraphQL params\n * @category CmsModel\n */\nexport interface CmsModelCreateFromInput extends CmsModelCreateInput {}\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":[],"sources":["model.ts"],"sourcesContent":["import type { CmsIdentity } from \"./identity.js\";\nimport type { CmsModelField, CmsModelFieldInput, FieldRule } from \"./modelField.js\";\nimport type { CmsIcon } from \"~/types/types.js\";\n\nexport interface CmsTabLayoutTab {\n id: string;\n label: string;\n icon?: CmsIcon | null;\n layout: CmsModelLayout;\n rules?: FieldRule[];\n}\n\nexport interface CmsTabLayoutDescriptor {\n type: \"tabs\";\n label: string;\n description?: string | null;\n help?: string | null;\n tabs: CmsTabLayoutTab[];\n rules?: FieldRule[];\n}\n\nexport interface CmsSeparatorLayoutDescriptor {\n type: \"separator\";\n label: string;\n description: string | null | undefined;\n rules?: FieldRule[];\n}\n\nexport interface CmsAlertLayoutDescriptor {\n type: \"alert\";\n label: string;\n alertType: \"info\" | \"success\" | \"warning\" | \"danger\";\n rules?: FieldRule[];\n}\n\nexport type CmsModelLayoutCell =\n | string\n | CmsTabLayoutDescriptor\n | CmsSeparatorLayoutDescriptor\n | CmsAlertLayoutDescriptor;\nexport type CmsModelLayout = CmsModelLayoutCell[][];\n\n/**\n * Base CMS Model. Should not be exported and used outside of this package.\n *\n * @category Database model\n * @category CmsModel\n */\nexport interface CmsModel {\n /**\n * Name of the content model.\n */\n name: string;\n /**\n * Unique ID for the content model. Created from name if not defined by user.\n */\n modelId: string;\n /**\n * Name of the content model in singular form to be used in the API.\n * example:\n * - Article\n * - Fruit\n * - Vegetable\n * - Car\n */\n singularApiName: string;\n /**\n * Name of the content model in plural form to be used in the API.\n * example:\n * - Articles\n * - Fruits\n * - Vegetables\n * - Cars\n */\n pluralApiName: string;\n /**\n * Model tenant.\n */\n tenant: string;\n /**\n * Model group slug.\n */\n group: string;\n /**\n * Icon for the content model.\n */\n icon: CmsIcon | null;\n /**\n * Description for the content model.\n */\n description: string | null;\n /**\n * Date created\n */\n createdOn?: string;\n /**\n * Date saved. Changes on both save and create.\n */\n savedOn?: string;\n /**\n * CreatedBy object wrapper. Contains id, name and type of the user.\n */\n createdBy?: CmsIdentity;\n /**\n * List of fields defining entry values.\n */\n fields: CmsModelField[];\n /**\n * Admin UI field layout\n *\n * ```ts\n * layout: [\n * [field1id, field2id],\n * [field3id]\n * ]\n * ```\n */\n layout: CmsModelLayout;\n /**\n * Models can be tagged to give them contextual meaning.\n */\n tags?: string[];\n /**\n * The field that is used as an entry title.\n * If not specified by the user, the system tries to assign the first available `text` field.\n */\n titleFieldId: string;\n /**\n * The field that is used as an entry description.\n * If not set by the user, the system will try to assign the first available `long-text` field.\n */\n descriptionFieldId?: string | null;\n /**\n * The field that is used as an entry image.\n * If not set by the user, the system will try to assign a `file` field which has `imagesOnly` enabled.\n */\n imageFieldId?: string | null;\n\n /**\n * Is model private?\n * This is meant to be used for some internal models - will not be visible in the schema.\n * Only available for the plugin constructed models.\n */\n isPrivate?: boolean;\n\n /**\n * Does this model require authorization to be performed?\n * Only available for models created via plugins.\n */\n authorization?: boolean | CmsModelAuthorization;\n\n /**\n * Is this model created via plugin?\n */\n isPlugin?: boolean;\n}\n\nexport interface StorageCmsModelFields {\n compression: string;\n value: string;\n}\n\nexport interface StorageCmsModel extends Omit<CmsModel, \"fields\"> {\n fields: StorageCmsModelFields | CmsModelField[];\n}\n\nexport interface CmsModelAuthorization {\n permissions: boolean;\n\n [key: string]: any;\n}\n\n/**\n * A GraphQL `params.data` parameter received when creating content model.\n *\n * @category GraphQL params\n * @category CmsModel\n */\nexport interface CmsModelCreateInput {\n /**\n * Name of the content model.\n */\n name: string;\n /**\n * Singular name of the content model to be used in the API.\n */\n singularApiName: string;\n /**\n * Plural name of the content model to be used in the API.\n */\n pluralApiName: string;\n /**\n * Unique ID of the content model. Created from name if not sent by the user. Cannot be changed.\n */\n modelId?: string;\n /**\n * Description of the content model.\n */\n description?: string | null;\n /**\n * Group where to put the content model in.\n */\n group: string;\n /**\n * A list of content model fields to define the entry values.\n */\n fields?: CmsModelFieldInput[];\n /**\n * Admin UI field layout\n *\n * ```ts\n * layout: [\n * [field1id, field2id],\n * [field3id]\n * ]\n * ```\n */\n layout?: CmsModelLayout;\n /**\n * Models can be tagged to give them contextual meaning.\n */\n tags?: string[];\n /**\n * Fields fieldId which are picked to represent the CMS entry.\n */\n titleFieldId?: string | null;\n descriptionFieldId?: string | null;\n imageFieldId?: string | null;\n icon?: CmsIcon | null;\n}\n\n/**\n * A GraphQL `params.data` parameter received when creating content model from existing model.\n *\n * @category GraphQL params\n * @category CmsModel\n */\nexport interface CmsModelCreateFromInput extends CmsModelCreateInput {}\n"],"mappings":"","ignoreList":[]}
|
package/types/types.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ import type { CmsModelToAstConverter } from "../utils/contentModelAst/CmsModelTo
|
|
|
9
9
|
import type { ICmsModelFieldToGraphQLRegistry } from "../features/graphql/fields/abstractions/CmsModelFieldToGraphQLRegistry.js";
|
|
10
10
|
import type { CmsEntryContext } from "./context.js";
|
|
11
11
|
import type { CmsModelField, CmsModelFieldValidation, CmsModelUpdateInput } from "./modelField.js";
|
|
12
|
-
import type { CmsModel, CmsModelCreateFromInput, CmsModelCreateInput } from "./model.js";
|
|
12
|
+
import type { CmsModel, CmsModelCreateFromInput, CmsModelCreateInput, StorageCmsModel } from "./model.js";
|
|
13
13
|
import type { CmsGroup } from "./modelGroup.js";
|
|
14
14
|
import type { CmsIdentity } from "./identity.js";
|
|
15
15
|
import type { ApiCoreContext } from "@webiny/api-core/types/core.js";
|
|
@@ -890,10 +890,10 @@ export interface CmsModelStorageOperationsListParams {
|
|
|
890
890
|
where: CmsModelStorageOperationsListWhereParams;
|
|
891
891
|
}
|
|
892
892
|
export interface CmsModelStorageOperationsCreateParams {
|
|
893
|
-
model:
|
|
893
|
+
model: StorageCmsModel;
|
|
894
894
|
}
|
|
895
895
|
export interface CmsModelStorageOperationsUpdateParams {
|
|
896
|
-
model:
|
|
896
|
+
model: StorageCmsModel;
|
|
897
897
|
}
|
|
898
898
|
export interface CmsModelStorageOperationsDeleteParams {
|
|
899
899
|
model: CmsModel;
|
|
@@ -907,23 +907,23 @@ export interface CmsModelStorageOperations {
|
|
|
907
907
|
/**
|
|
908
908
|
* Gets content model by given id.
|
|
909
909
|
*/
|
|
910
|
-
get: (params: CmsModelStorageOperationsGetParams) => Promise<
|
|
910
|
+
get: (params: CmsModelStorageOperationsGetParams) => Promise<StorageCmsModel | null>;
|
|
911
911
|
/**
|
|
912
912
|
* List all content models. Filterable via params.
|
|
913
913
|
*/
|
|
914
|
-
list: (params: CmsModelStorageOperationsListParams) => Promise<
|
|
914
|
+
list: (params: CmsModelStorageOperationsListParams) => Promise<StorageCmsModel[]>;
|
|
915
915
|
/**
|
|
916
916
|
* Create a new content model.
|
|
917
917
|
*/
|
|
918
|
-
create: (params: CmsModelStorageOperationsCreateParams) => Promise<
|
|
918
|
+
create: (params: CmsModelStorageOperationsCreateParams) => Promise<StorageCmsModel>;
|
|
919
919
|
/**
|
|
920
920
|
* Update existing content model.
|
|
921
921
|
*/
|
|
922
|
-
update: (params: CmsModelStorageOperationsUpdateParams) => Promise<
|
|
922
|
+
update: (params: CmsModelStorageOperationsUpdateParams) => Promise<StorageCmsModel>;
|
|
923
923
|
/**
|
|
924
924
|
* Delete the content model.
|
|
925
925
|
*/
|
|
926
|
-
delete: (params: CmsModelStorageOperationsDeleteParams) => Promise<
|
|
926
|
+
delete: (params: CmsModelStorageOperationsDeleteParams) => Promise<void>;
|
|
927
927
|
}
|
|
928
928
|
export interface CmsEntryStorageOperationsGetParams {
|
|
929
929
|
where: CmsEntryListWhere;
|
package/types/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["CONTENT_ENTRY_STATUS"],"sources":["types.ts"],"sourcesContent":["import type { Context, GenericRecord } from \"@webiny/api/types.js\";\nimport type { GraphQLFieldResolver, GraphQLRequestBody } from \"@webiny/handler-graphql/types.js\";\nimport type { processRequestBody } from \"@webiny/handler-graphql\";\nimport type { DbContext } from \"@webiny/handler-db/types.js\";\nimport type { CmsModelConverterCallable } from \"~/utils/converters/ConverterCollection.js\";\nimport type { HeadlessCmsExport, HeadlessCmsImport } from \"~/export/types.js\";\nimport type { AccessControl } from \"~/crud/AccessControl/AccessControl.js\";\nimport type { CmsModelToAstConverter } from \"~/utils/contentModelAst/CmsModelToAstConverter.js\";\nimport type { ICmsModelFieldToGraphQLRegistry } from \"~/features/graphql/fields/abstractions/CmsModelFieldToGraphQLRegistry.js\";\nimport type { CmsEntryContext } from \"./context.js\";\nimport type { CmsModelField, CmsModelFieldValidation, CmsModelUpdateInput } from \"./modelField.js\";\nimport type { CmsModel, CmsModelCreateFromInput, CmsModelCreateInput } from \"./model.js\";\nimport type { CmsGroup } from \"./modelGroup.js\";\nimport type { CmsIdentity } from \"./identity.js\";\nimport type { ApiCoreContext } from \"@webiny/api-core/types/core.js\";\nimport type { SecurityPermission } from \"@webiny/api-core/types/security.js\";\nimport type {\n DateStringInterfaceGenerator,\n IdentityInterfaceGenerator,\n IdInterfaceGenerator,\n IdMixedInterfaceGenerator,\n NumericInterfaceGenerator,\n TruthfulInterfaceGenerator\n} from \"@webiny/api\";\n\nexport type CmsIcon = {\n type: string;\n name: string;\n value?: string;\n};\n\nexport interface CmsError {\n message: string;\n code: string;\n data: GenericRecord;\n stack?: string;\n}\n\nexport type ApiEndpoint = \"manage\" | \"preview\" | \"read\";\n\nexport interface HeadlessCms extends CmsGroupContext, CmsModelContext, CmsEntryContext {\n /**\n * API type\n */\n type: ApiEndpoint | null;\n /**\n * Means this request is a READ API\n */\n READ: boolean;\n /**\n * Means this request is a MANAGE API\n */\n MANAGE: boolean;\n /**\n * Means this request is a PREVIEW API\n */\n PREVIEW: boolean;\n /**\n * The storage operations loaded for current context.\n */\n storageOperations: HeadlessCmsStorageOperations;\n\n /**\n * Use to ensure perform authorization and ensure identities have access to the groups, models and entries.\n */\n accessControl: AccessControl;\n\n /**\n * Export operations.\n */\n export: HeadlessCmsExport;\n importing: HeadlessCmsImport;\n getExecutableSchema: GetExecutableSchema;\n}\n\nexport type GetExecutableSchema = (\n type: ApiEndpoint\n) => Promise<\n <TData = Record<string, any>, TExtensions = Record<string, any>>(\n input: GraphQLRequestBody | GraphQLRequestBody[]\n ) => ReturnType<typeof processRequestBody<TData, TExtensions>>\n>;\n\n/**\n * @description This combines all contexts used in the CMS into a single one.\n *\n * @category Context\n */\nexport interface CmsContext extends Context, DbContext, ApiCoreContext {\n cms: HeadlessCms;\n}\n\n/**\n * Used for our internal functionality.\n */\nexport interface CmsModelFieldWithParent extends CmsModelField {\n parent?: CmsModelFieldWithParent | null;\n}\n\n/**\n * A definition for dateTime field to show possible type of the field in settings.\n */\nexport interface CmsModelDateTimeField extends CmsModelField {\n /**\n * Settings object for the field. Contains `type` property.\n */\n settings: {\n type: \"time\" | \"date\" | \"dateTimeWithoutTimezone\" | \"dateTimeWithTimezone\";\n };\n}\n\n/**\n * Arguments for the field validator validate method.\n *\n * @category ModelField\n * @category FieldValidation\n */\nexport interface CmsModelFieldValidatorValidateParams<T extends CmsEntryValues = CmsEntryValues> {\n /**\n * A value to be validated.\n */\n value: T[keyof T];\n /**\n * Options from the CmsModelField validations.\n *\n * @see CmsModelField.validation\n * @see CmsModelField.listValidation\n */\n validator: CmsModelFieldValidation;\n /**\n * An instance of the current context.\n */\n context: CmsContext;\n /**\n * Field being validated.\n */\n field: CmsModelField;\n /**\n * An instance of the content model being validated.\n */\n model: CmsModel;\n /**\n * If entry is sent it means it is an update operation.\n * First usage is for the unique field value.\n */\n entry?: CmsEntry<T>;\n}\n\n/**\n * When sending model to the storage operations, it must contain createValueKeyToStorageConverter and createValueKeyFromStorageConverter\n *\n * @category CmsModel\n */\nexport interface StorageOperationsCmsModel<\n T extends CmsEntryValues = CmsEntryValues\n> extends CmsModel {\n convertValueKeyToStorage: CmsModelConverterCallable<T>;\n convertValueKeyFromStorage: CmsModelConverterCallable<T>;\n}\n\n/**\n * @category ModelField\n */\nexport interface CmsModelFieldDefinition {\n fields: string;\n typeDefs?: string;\n}\n\n/**\n * A GraphQL `params.data` parameter received when creating content model group.\n *\n * @category CmsGroup\n * @category GraphQL params\n */\nexport interface CmsGroupCreateInput {\n id?: string;\n name: string;\n slug?: string;\n description?: string | null;\n icon?: CmsIcon | null;\n}\n\n/**\n * A GraphQL `params.data` parameter received when updating content model group.\n *\n * @category CmsGroup\n * @category GraphQL params\n */\nexport interface CmsGroupUpdateInput {\n name?: string;\n slug?: string;\n description?: string;\n icon?: CmsIcon;\n}\n\n/**\n * A `data.where` parameter received when listing content model groups.\n *\n * @category CmsGroup\n * @category GraphQL params\n */\nexport interface CmsGroupListParams {\n where: {\n tenant: string;\n };\n}\n\n/**\n * Cms Group in context.\n *\n * @category Context\n * @category CmsGroup\n */\nexport interface CmsGroupContext {\n /**\n * Gets content model group by given id.\n */\n getGroup: (id: string) => Promise<CmsGroup>;\n /**\n * List all content model groups. Filterable via params.\n */\n listGroups: (params?: CmsGroupListParams) => Promise<CmsGroup[]>;\n /**\n * Create a new content model group.\n */\n createGroup: (data: CmsGroupCreateInput) => Promise<CmsGroup>;\n /**\n * Update existing content model group.\n */\n updateGroup: (id: string, data: CmsGroupUpdateInput) => Promise<CmsGroup>;\n /**\n * Delete content model group by given id.\n */\n deleteGroup: (id: string) => Promise<boolean>;\n /**\n * Clear the cached groups.\n */\n clearGroupsCache: () => void;\n}\n\n/**\n * A content entry values definition for and from the database.\n *\n * @category Database model\n * @category CmsEntry\n */\nexport interface CmsEntryValues {\n [key: string]: any;\n}\n\nexport interface ICmsEntryLocation {\n folderId?: string;\n}\n\nexport interface ICmsEntryLive {\n version: number;\n}\n\nexport interface ICmsEntrySystem {\n // to be extended\n}\n/**\n * A content entry definition for and from the database.\n *\n * @category Database model\n * @category CmsEntry\n */\nexport interface CmsEntry<TValues extends CmsEntryValues = CmsEntryValues> {\n /**\n * Tenant id which is this entry for. Can be used in case of shared storage.\n */\n tenant: string;\n /**\n * Generated ID of the entry. It is shared across all the records in the database that represent a single entry.\n * So version 1, 2, ..., 2371 will have the same value in this field to link them together.\n */\n entryId: string;\n /**\n * Generated ID + version of the entry.\n */\n id: string;\n\n /**\n * Revision-level meta fields. 👇\n */\n\n /**\n * An ISO 8601 date/time string.\n */\n revisionCreatedOn: string;\n /**\n * An ISO 8601 date/time string.\n */\n revisionSavedOn: string;\n /**\n * An ISO 8601 date/time string.\n */\n revisionModifiedOn: string | null;\n /**\n * An ISO 8601 date/time string.\n */\n revisionDeletedOn: string | null;\n /**\n * An ISO 8601 date/time string.\n */\n revisionRestoredOn: string | null;\n /**\n * An ISO 8601 date/time string.\n */\n revisionFirstPublishedOn: string | null;\n /**\n * An ISO 8601 date/time string.\n */\n revisionLastPublishedOn: string | null;\n\n /**\n * Identity that last ionCreated the entry.\n */\n revisionCreatedBy: CmsIdentity;\n /**\n * Identity that last ionSaved the entry.\n */\n revisionSavedBy: CmsIdentity;\n /**\n * Identity that last ionModified the entry.\n */\n revisionModifiedBy: CmsIdentity | null;\n /**\n * Identity that last deleted the revision.\n */\n revisionDeletedBy: CmsIdentity | null;\n /**\n * Identity that last restored the revision.\n */\n revisionRestoredBy: CmsIdentity | null;\n /**\n * Identity that first published the entry.\n */\n revisionFirstPublishedBy: CmsIdentity | null;\n /**\n * Identity that last published the entry.\n */\n revisionLastPublishedBy: CmsIdentity | null;\n\n /**\n * An ISO 8601 date/time string.\n */\n createdOn: string;\n /**\n * An ISO 8601 date/time string.\n */\n savedOn: string;\n /**\n * An ISO 8601 date/time string.\n */\n modifiedOn: string | null;\n /**\n * An ISO 8601 date/time string.\n */\n deletedOn: string | null;\n /**\n * An ISO 8601 date/time string.\n */\n restoredOn: string | null;\n /**\n * An ISO 8601 date/time string.\n */\n firstPublishedOn: string | null;\n /**\n * An ISO 8601 date/time string.\n */\n lastPublishedOn: string | null;\n\n /**\n * Identity that last created the entry.\n */\n createdBy: CmsIdentity;\n /**\n * Identity that last saved the entry.\n */\n savedBy: CmsIdentity;\n /**\n * Identity that last modified the entry.\n */\n modifiedBy: CmsIdentity | null;\n /**\n * Identity that last deleted the entry.\n */\n deletedBy: CmsIdentity | null;\n /**\n * Identity that last restored the entry.\n */\n restoredBy: CmsIdentity | null;\n /**\n * Identity that first published the entry.\n */\n firstPublishedBy: CmsIdentity | null;\n /**\n * Identity that last published the entry.\n */\n lastPublishedBy: CmsIdentity | null;\n\n /**\n * Model ID of the definition for the entry.\n * @see CmsModel\n */\n modelId: string;\n /**\n * A revision version of the entry.\n */\n version: number;\n /**\n * Is the entry locked?\n */\n locked: boolean;\n /**\n * Status type of the entry.\n */\n status: CmsEntryStatus;\n /**\n * A mapped storageId -> value object.\n *\n * @see CmsModelField\n */\n values: TValues;\n /**\n * Advanced Content Organization\n */\n location?: ICmsEntryLocation;\n /**\n * Settings for the given entry.\n *\n * Introduced with Advanced Publishing Workflow. Will always be inserted once this PR is merged.\n * Be aware that when accessing properties in it on old systems, it will break if not checked first.\n *\n * Available only on the Manage API in entry GraphQL type `meta.data` property.\n */\n meta?: GenericRecord;\n /**\n * Is the entry in the bin?\n */\n wbyDeleted?: boolean | null;\n /**\n * This field preserves the original folderId value, as the ROOT_FOLDER is set upon deletion.\n * The value is used when restoring the entry from the trash bin.\n */\n binOriginalFolderId?: string;\n\n system?: ICmsEntrySystem;\n /**\n * Is this CMS Entry live (no matter the revision).\n */\n live: ICmsEntryLive | null;\n}\n\nexport interface CmsStorageEntry<T extends CmsEntryValues = CmsEntryValues> extends CmsEntry<T> {\n [key: string]: any;\n}\n\nexport interface CmsEntryUniqueValue {\n value: string;\n count: number;\n}\n\nexport interface ICmsModelListParams {\n /**\n * Defaults to true.\n */\n includePrivate?: boolean;\n includePlugins?: boolean;\n}\n\n/**\n * Cms Model in the context.\n *\n * @category Context\n * @category CmsModel\n */\nexport interface CmsModelContext {\n /**\n * Get a single content model.\n *\n * @throws NotFoundError\n */\n getModel(modelId: string): Promise<CmsModel>;\n /**\n * Get model to AST converter.\n */\n getModelToAstConverter: () => CmsModelToAstConverter;\n /**\n * Get all content models.\n */\n listModels(params?: ICmsModelListParams): Promise<CmsModel[]>;\n /**\n * Create a content model.\n */\n createModel(data: CmsModelCreateInput): Promise<CmsModel>;\n /**\n * Create a content model from the given model - clone.\n */\n createModelFrom(modelId: string, data: CmsModelCreateFromInput): Promise<CmsModel>;\n /**\n * Update content model.\n */\n updateModel(modelId: string, data: CmsModelUpdateInput): Promise<CmsModel>;\n /**\n * Delete content model. Should not allow deletion if there are entries connected to it.\n */\n deleteModel(modelId: string): Promise<void>;\n /**\n * Clear all the model caches.\n */\n clearModelsCache(): void;\n}\n\n/**\n * Available statuses for content entry.\n *\n * @category CmsEntry\n */\nexport type CmsEntryStatus = \"published\" | \"unpublished\" | \"draft\";\n\nexport interface CmsEntryListWhereRef\n extends\n IdInterfaceGenerator<\"id\">,\n IdInterfaceGenerator<\"entryId\">,\n IdInterfaceGenerator<\"modelId\"> {}\n\nexport interface CmsEntryListWhereValues {\n /**\n * This is to allow querying by any content model field defined by the user.\n */\n [key: string]:\n | string\n | number\n | boolean\n | Date\n | undefined\n | string[]\n | number[]\n | null\n | CmsEntryListWhereValues[]\n | CmsEntryListWhereValues\n | CmsEntryListWhereRef;\n}\n/**\n * Entry listing where params.\n *\n * @category CmsEntry\n * @category GraphQL params\n */\n\nexport interface CmsEntryListWhere\n extends\n IdMixedInterfaceGenerator<\"id\">,\n IdMixedInterfaceGenerator<\"entryId\">,\n IdInterfaceGenerator<\"status\", CmsEntryStatus>,\n /**\n * Revision-level meta fields. 👇\n */\n IdentityInterfaceGenerator<\"revisionCreatedBy\">,\n IdentityInterfaceGenerator<\"revisionModifiedBy\">,\n IdentityInterfaceGenerator<\"revisionSavedBy\">,\n IdentityInterfaceGenerator<\"revisionFirstPublishedBy\">,\n IdentityInterfaceGenerator<\"revisionLastPublishedBy\">,\n /**\n * Entry-level meta fields. 👇\n */\n IdentityInterfaceGenerator<\"createdBy\">,\n IdentityInterfaceGenerator<\"modifiedBy\">,\n IdentityInterfaceGenerator<\"savedBy\">,\n IdentityInterfaceGenerator<\"firstPublishedBy\">,\n IdentityInterfaceGenerator<\"lastPublishedBy\">,\n DateStringInterfaceGenerator<\"createdOn\">,\n DateStringInterfaceGenerator<\"savedOn\">,\n DateStringInterfaceGenerator<\"deletedOn\">,\n /**\n * Version of the entry.\n *\n * It is not meant to be used via the API.\n * @internal\n */\n NumericInterfaceGenerator<\"version\">,\n /**\n * Each storage operations implementation MUST determine how to use this field.\n * In SQL, it can be a `published` field, and in DynamoDB it can be an SK.\n *\n * It is not meant to be used via the API.\n * @internal\n */\n TruthfulInterfaceGenerator<\"published\">,\n /**\n * Each storage operations implementation MUST determine how to use this field.\n * In SQL, it can be a `latest` field, and in DynamoDB it can be an SK.\n *\n * It is not meant to be used via the API.\n * @internal\n */\n TruthfulInterfaceGenerator<\"latest\"> {\n /**\n * ACO related parameters.\n */\n wbyAco_location?: {\n folderId?: string;\n folderId_not?: string;\n folderId_in?: string[];\n folderId_not_in?: string[];\n };\n location?: {\n folderId?: string;\n folderId_not?: string;\n folderId_in?: string[];\n folderId_not_in?: string[];\n };\n\n values?: CmsEntryListWhereValues;\n /**\n * Is the entry in the bin?\n */\n wbyDeleted?: boolean;\n wbyDeleted_not?: boolean;\n\n /**\n * To allow querying via nested queries, we added the AND / OR properties.\n */\n AND?: CmsEntryListWhere[];\n OR?: CmsEntryListWhere[];\n}\n\n/**\n * Entry listing sort.\n *\n * @category CmsEntry\n * @category GraphQL params\n */\nexport type CmsEntryListSortAsc = `${string}_ASC`;\nexport type CmsEntryListSortDesc = `${string}_DESC`;\nexport type CmsEntryListSort = (CmsEntryListSortAsc | CmsEntryListSortDesc)[];\n\n/**\n * Get entry GraphQL resolver params.\n *\n * @category CmsEntry\n * @category GraphQL params\n */\nexport interface CmsEntryGetParams {\n where: CmsEntryListWhere;\n sort?: CmsEntryListSort;\n}\n\n/**\n * List entries GraphQL resolver params.\n *\n * @category CmsEntry\n * @category GraphQL params\n */\nexport interface CmsEntryListParams {\n where?: CmsEntryListWhere;\n sort?: CmsEntryListSort;\n search?: string;\n fields?: string[];\n limit?: number;\n after?: string | null;\n}\n\n/**\n * Meta information for GraphQL output.\n *\n * @category CmsEntry\n * @category GraphQL output\n */\nexport interface CmsEntryMeta {\n /**\n * A cursor for pagination.\n */\n cursor: string | null;\n /**\n * Is there more items to load?\n */\n hasMoreItems: boolean;\n /**\n * Total count of the items in the storage.\n */\n totalCount: number;\n}\n\n/**\n * @category Context\n * @category CmsEntry\n */\nexport interface CreateCmsEntryInput<TValues extends CmsEntryValues = CmsEntryValues> {\n id?: string;\n status?: CmsEntryStatus;\n\n /**\n * Entry-level meta fields. 👇\n */\n createdOn?: Date | string;\n modifiedOn?: Date | string | null;\n savedOn?: Date | string;\n deletedOn?: Date | string | null;\n restoredOn?: Date | string | null;\n createdBy?: CmsIdentity;\n modifiedBy?: CmsIdentity;\n savedBy?: CmsIdentity;\n deletedBy?: CmsIdentity | null;\n restoredBy?: CmsIdentity | null;\n firstPublishedOn?: Date | string;\n lastPublishedOn?: Date | string;\n firstPublishedBy?: CmsIdentity;\n lastPublishedBy?: CmsIdentity;\n\n /**\n * Revision-level meta fields. 👇\n */\n revisionCreatedOn?: Date | string;\n revisionModifiedOn?: Date | string | null;\n revisionSavedOn?: Date | string;\n revisionDeletedOn?: Date | string | null;\n revisionRestoredOn?: Date | string | null;\n revisionCreatedBy?: CmsIdentity;\n revisionModifiedBy?: CmsIdentity | null;\n revisionSavedBy?: CmsIdentity;\n revisionDeletedBy?: CmsIdentity | null;\n revisionRestoredBy?: CmsIdentity | null;\n revisionFirstPublishedOn?: Date | string;\n revisionLastPublishedOn?: Date | string;\n revisionFirstPublishedBy?: CmsIdentity;\n revisionLastPublishedBy?: CmsIdentity;\n // TODO remove wbyAco_location\n wbyAco_location?: {\n folderId?: string | null;\n };\n location?: {\n folderId?: string | null;\n };\n\n system?: Partial<ICmsEntrySystem>;\n\n values: TValues | undefined;\n}\n\nexport interface CreateCmsEntryOptionsInput {\n skipValidators?: string[];\n}\n\n/**\n * @category Context\n * @category CmsEntry\n */\nexport interface CreateFromCmsEntryInput<TValues extends CmsEntryValues = CmsEntryValues> {\n /**\n * Revision-level meta fields. 👇\n */\n revisionCreatedOn?: Date;\n revisionSavedOn?: Date;\n revisionModifiedOn?: Date;\n revisionCreatedBy?: CmsIdentity;\n revisionModifiedBy?: CmsIdentity;\n revisionSavedBy?: CmsIdentity;\n revisionFirstPublishedOn?: Date | string;\n revisionLastPublishedOn?: Date | string;\n revisionFirstPublishedBy?: CmsIdentity;\n revisionLastPublishedBy?: CmsIdentity;\n\n /**\n * Entry-level meta fields. 👇\n */\n createdOn?: Date;\n savedOn?: Date;\n modifiedOn?: Date;\n createdBy?: CmsIdentity;\n modifiedBy?: CmsIdentity;\n savedBy?: CmsIdentity;\n firstPublishedOn?: Date | string;\n lastPublishedOn?: Date | string;\n firstPublishedBy?: CmsIdentity;\n lastPublishedBy?: CmsIdentity;\n\n system?: Partial<ICmsEntrySystem>;\n\n values: TValues;\n}\n\nexport interface CreateRevisionCmsEntryOptionsInput {\n skipValidators?: string[];\n}\n\n/**\n * @category Context\n * @category CmsEntry\n */\nexport interface UpdateCmsEntryInput<TValues extends CmsEntryValues = CmsEntryValues> {\n /**\n * Revision-level meta fields. 👇\n */\n revisionCreatedOn?: Date | string | null;\n revisionModifiedOn?: Date | string | null;\n revisionSavedOn?: Date | string | null;\n revisionDeletedOn?: Date | string | null;\n revisionRestoredOn?: Date | string | null;\n revisionFirstPublishedOn?: Date | string | null;\n revisionLastPublishedOn?: Date | string | null;\n revisionModifiedBy?: CmsIdentity | null;\n revisionCreatedBy?: CmsIdentity | null;\n revisionSavedBy?: CmsIdentity | null;\n revisionDeletedBy?: CmsIdentity | null;\n revisionRestoredBy?: CmsIdentity | null;\n revisionFirstPublishedBy?: CmsIdentity | null;\n revisionLastPublishedBy?: CmsIdentity | null;\n\n /**\n * Entry-level meta fields. 👇\n */\n createdOn?: Date | string | null;\n modifiedOn?: Date | string | null;\n savedOn?: Date | string | null;\n deletedOn?: Date | string | null;\n restoredOn?: Date | string | null;\n firstPublishedOn?: Date | string | null;\n lastPublishedOn?: Date | string | null;\n createdBy?: CmsIdentity | null;\n modifiedBy?: CmsIdentity | null;\n savedBy?: CmsIdentity | null;\n deletedBy?: CmsIdentity | null;\n restoredBy?: CmsIdentity | null;\n firstPublishedBy?: CmsIdentity | null;\n lastPublishedBy?: CmsIdentity | null;\n\n wbyAco_location?: {\n folderId?: string | null;\n };\n\n location?: {\n folderId?: string | null;\n };\n\n system?: Partial<ICmsEntrySystem>;\n\n values?: Partial<TValues>;\n}\n\nexport interface UpdateCmsEntryOptionsInput {\n skipValidators?: string[];\n}\n\n/**\n * @category Context\n * @category CmsEntry\n */\nexport interface GetUniqueFieldValuesParams {\n where: CmsEntryListWhere;\n fieldId: string;\n}\n\n/**\n * @category CmsEntry\n */\nexport interface CmsDeleteEntryOptions {\n /**\n * Runs the delete commands even if the entry is not found in the DynamoDB.\n * This is to force clean the entry records that might have been left behind a failed delete.\n */\n force?: boolean;\n /**\n * Destroying the entry directly, without moving it to the bin.\n */\n permanently?: boolean;\n}\n\n/**\n * @category Context\n * @category CmsEntry\n */\nexport interface DeleteMultipleEntriesParams {\n entries: string[];\n}\n\nexport type DeleteMultipleEntriesResponse = {\n id: string;\n}[];\n\nexport interface CmsEntryValidateResponse {\n [key: string]: any;\n}\n\n/**\n * Parameters for CmsEntryResolverFactory.\n *\n * @category GraphQL resolver\n * @category CmsEntry\n */\ninterface CmsEntryResolverFactoryParams {\n model: CmsModel;\n fieldRegistry: ICmsModelFieldToGraphQLRegistry;\n}\n\n/**\n * A type for EntryResolvers. Used when creating get, list, update, publish, ...etc.\n *\n * @category GraphQL resolver\n * @category CmsEntry\n */\nexport type CmsEntryResolverFactory<TSource = any, TArgs = any, TContext = CmsContext> = {\n (params: CmsEntryResolverFactoryParams): GraphQLFieldResolver<TSource, TArgs, TContext>;\n};\n\n/**\n * A base security permission for CMS.\n *\n * @category SecurityPermission\n */\nexport interface BaseCmsSecurityPermission extends SecurityPermission {\n own?: boolean;\n rwd: string;\n}\n\n/**\n * A security permission for content model.\n *\n * @category SecurityPermission\n * @category CmsModel\n */\nexport interface CmsModelPermission extends BaseCmsSecurityPermission {\n models?: string[];\n groups?: string[];\n}\n\n/**\n * The security permission for content model groups.\n *\n * @category SecurityPermission\n * @category CmsGroup\n */\nexport interface CmsGroupPermission extends BaseCmsSecurityPermission {\n groups?: string[];\n}\n\n/**\n * The security permission for content entry.\n *\n * @category SecurityPermission\n * @category CmsEntry\n */\nexport interface CmsEntryPermission extends BaseCmsSecurityPermission {\n pw?: string;\n models?: string[];\n groups?: string[];\n}\n\nexport interface CmsGroupStorageOperationsGetParams {\n id: string;\n tenant: string;\n}\n\nexport interface CmsGroupStorageOperationsListWhereParams {\n tenant: string;\n\n [key: string]: any;\n}\n\nexport interface CmsGroupStorageOperationsListParams {\n where: CmsGroupStorageOperationsListWhereParams;\n sort?: string[];\n}\n\nexport interface CmsGroupStorageOperationsCreateParams {\n group: CmsGroup;\n}\n\nexport interface CmsGroupStorageOperationsUpdateParams {\n group: CmsGroup;\n}\n\nexport interface CmsGroupStorageOperationsDeleteParams {\n group: CmsGroup;\n}\n\n/**\n * Description of the CmsGroup CRUD operations.\n * If user wants to add another database to the application, this is how it is done.\n * This is just plain read, update, write, delete and list - no authentication or permission checks.\n */\nexport interface CmsGroupStorageOperations {\n /**\n * Gets content model group by given id.\n */\n get: (params: CmsGroupStorageOperationsGetParams) => Promise<CmsGroup | null>;\n /**\n * List all content model groups. Filterable via params.\n */\n list: (params: CmsGroupStorageOperationsListParams) => Promise<CmsGroup[]>;\n /**\n * Create a new content model group.\n */\n create: (params: CmsGroupStorageOperationsCreateParams) => Promise<void>;\n /**\n * Update existing content model group.\n */\n update: (params: CmsGroupStorageOperationsUpdateParams) => Promise<void>;\n /**\n * Delete the content model group.\n */\n delete: (params: CmsGroupStorageOperationsDeleteParams) => Promise<void>;\n}\n\nexport interface CmsModelStorageOperationsGetParams {\n tenant: string;\n modelId: string;\n}\n\nexport interface CmsModelStorageOperationsListWhereParams {\n tenant: string;\n\n [key: string]: string;\n}\n\nexport interface CmsModelStorageOperationsListParams {\n where: CmsModelStorageOperationsListWhereParams;\n}\n\nexport interface CmsModelStorageOperationsCreateParams {\n model: CmsModel;\n}\n\nexport interface CmsModelStorageOperationsUpdateParams {\n model: CmsModel;\n}\n\nexport interface CmsModelStorageOperationsDeleteParams {\n model: CmsModel;\n}\n\n/**\n * Description of the CmsModel storage operations.\n * If user wants to add another database to the application, this is how it is done.\n * This is just plain read, update, write, delete and list - no authentication or permission checks.\n */\nexport interface CmsModelStorageOperations {\n /**\n * Gets content model by given id.\n */\n get: (params: CmsModelStorageOperationsGetParams) => Promise<CmsModel | null>;\n /**\n * List all content models. Filterable via params.\n */\n list: (params: CmsModelStorageOperationsListParams) => Promise<CmsModel[]>;\n /**\n * Create a new content model.\n */\n create: (params: CmsModelStorageOperationsCreateParams) => Promise<CmsModel>;\n /**\n * Update existing content model.\n */\n update: (params: CmsModelStorageOperationsUpdateParams) => Promise<CmsModel>;\n /**\n * Delete the content model.\n */\n delete: (params: CmsModelStorageOperationsDeleteParams) => Promise<CmsModel>;\n}\n\nexport interface CmsEntryStorageOperationsGetParams {\n where: CmsEntryListWhere;\n sort?: CmsEntryListSort;\n limit?: number;\n}\n\nexport interface CmsEntryStorageOperationsListParams {\n where: CmsEntryListWhere;\n sort?: CmsEntryListSort;\n search?: string;\n fields?: string[];\n limit: number;\n after?: string | null;\n}\n\nexport interface CmsEntryStorageOperationsCreateParams<T extends CmsEntryValues = CmsEntryValues> {\n /**\n * Real entry, with no transformations on it.\n */\n entry: CmsEntry<T>;\n /**\n * Entry prepared for the storage.\n */\n storageEntry: CmsStorageEntry<T>;\n}\n\nexport interface CmsEntryStorageOperationsCreateRevisionFromParams<\n T extends CmsEntryValues = CmsEntryValues\n> {\n /**\n * Real entry, with no transformations on it.\n */\n entry: CmsEntry<T>;\n /**\n * Entry prepared for the storage.\n */\n storageEntry: CmsStorageEntry<T>;\n}\n\nexport interface CmsEntryStorageOperationsUpdateParams<T extends CmsEntryValues = CmsEntryValues> {\n /**\n * Real entry, with no transformations on it.\n */\n entry: CmsEntry<T>;\n /**\n * Entry prepared for the storage.\n */\n storageEntry: CmsStorageEntry<T>;\n}\n\nexport interface CmsEntryStorageOperationsDeleteRevisionParams<\n T extends CmsEntryValues = CmsEntryValues\n> {\n /**\n * Entry that was deleted.\n */\n entry: CmsEntry<T>;\n /**\n * Entry that was deleted, directly from storage, with transformations.\n */\n storageEntry: CmsStorageEntry<T>;\n /**\n * Entry that was set as latest.\n */\n latestEntry: CmsEntry | null;\n /**\n * Entry that was set as latest, directly from storage, with transformations.\n */\n latestStorageEntry: CmsStorageEntry<T> | null;\n}\n\nexport interface CmsEntryStorageOperationsDeleteParams<T extends CmsEntryValues = CmsEntryValues> {\n entry: CmsEntry<T>;\n}\n\nexport interface CmsEntryStorageOperationsMoveToBinParams<\n T extends CmsEntryValues = CmsEntryValues\n> {\n /**\n * The modified entry that is going to be saved as published.\n * Entry is in its original form.\n */\n entry: CmsEntry<T>;\n /**\n * The modified entry and prepared for the storage.\n */\n storageEntry: CmsStorageEntry<T>;\n}\n\nexport interface CmsEntryStorageOperationsRestoreFromBinParams<\n T extends CmsEntryValues = CmsEntryValues\n> {\n /**\n * The modified entry that is going to be saved as restored.\n * Entry is in its original form.\n */\n entry: CmsEntry<T>;\n /**\n * The modified entry and prepared for the storage.\n */\n storageEntry: CmsStorageEntry<T>;\n}\n\nexport interface CmsEntryStorageOperationsDeleteEntriesParams {\n entries: string[];\n}\n\nexport interface CmsEntryStorageOperationsPublishParams<T extends CmsEntryValues = CmsEntryValues> {\n /**\n * The modified entry that is going to be saved as published.\n * Entry is in its original form.\n */\n entry: CmsEntry<T>;\n /**\n * The modified entry and prepared for the storage.\n */\n storageEntry: CmsStorageEntry<T>;\n}\n\nexport interface CmsEntryStorageOperationsUnpublishParams<\n T extends CmsEntryValues = CmsEntryValues\n> {\n /**\n * The modified entry that is going to be saved as unpublished.\n */\n entry: CmsEntry<T>;\n /**\n * The modified entry that is going to be saved as unpublished, with transformations on it.\n */\n storageEntry: CmsStorageEntry<T>;\n}\n\nexport interface CmsEntryStorageOperationsGetUniqueFieldValuesParams {\n where: CmsEntryListWhere;\n fieldId: string;\n}\n\nexport interface CmsEntryStorageOperationsGetByIdsParams {\n ids: readonly string[];\n}\n\nexport interface CmsEntryStorageOperationsGetLatestByIdsParams {\n ids: readonly string[];\n}\n\nexport interface CmsEntryStorageOperationsGetPublishedByIdsParams {\n ids: readonly string[];\n}\n\nexport interface CmsEntryStorageOperationsGetRevisionsParams {\n id: string;\n}\n\nexport interface CmsEntryStorageOperationsGetRevisionParams {\n id: string;\n}\n\nexport interface CmsEntryStorageOperationsGetPublishedRevisionParams {\n id: string;\n}\n\nexport interface CmsEntryStorageOperationsGetLatestRevisionParams {\n id: string;\n}\n\nexport interface CmsEntryStorageOperationsGetPreviousRevisionParams {\n entryId: string;\n version: number;\n}\n\nexport interface CmsEntryStorageOperationsListResponse<\n T extends CmsStorageEntry = CmsStorageEntry\n> {\n /**\n * Has more items to load with the current filtering?\n */\n hasMoreItems: boolean;\n /**\n * Items loaded with current filtering.\n */\n items: T[];\n /**\n * Pointer for where to start the new item set.\n */\n cursor: string | null;\n /**\n * Total amount of items with the current filter.\n */\n totalCount: number;\n}\n\n/**\n * Description of the CmsModel storage operations.\n * If user wants to add another database to the application, this is how it is done.\n * This is just plain read, update, write, delete and list - no authentication or permission checks.\n *\n *\n * @category StorageOperations\n * @category CmsEntry\n */\nexport interface CmsEntryStorageOperations {\n /**\n * Get all the entries of the ids.\n */\n getByIds: <T extends CmsEntryValues = CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsGetByIdsParams\n ) => Promise<CmsEntry<T>[]>;\n /**\n * Get all the published entries of the ids.\n */\n getPublishedByIds: <T extends CmsEntryValues = CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsGetPublishedByIdsParams\n ) => Promise<CmsEntry<T>[]>;\n /**\n * Get all the latest entries of the ids.\n */\n getLatestByIds: <T extends CmsEntryValues = CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsGetLatestByIdsParams\n ) => Promise<CmsEntry<T>[]>;\n /**\n * Get all revisions of the given entry id.\n */\n getRevisions: <T extends CmsEntryValues = CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsGetRevisionsParams\n ) => Promise<CmsEntry<T>[]>;\n /**\n * Get the entry by the given revision id.\n */\n getRevisionById: <T extends CmsEntryValues = CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsGetRevisionParams\n ) => Promise<CmsEntry<T> | null>;\n /**\n * Get the published entry by given entryId.\n */\n getPublishedRevisionByEntryId: <T extends CmsEntryValues = CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsGetPublishedRevisionParams\n ) => Promise<CmsEntry<T> | null>;\n /**\n * Get the latest entry by given entryId.\n */\n getLatestRevisionByEntryId: <T extends CmsEntryValues = CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsGetLatestRevisionParams\n ) => Promise<CmsEntry<T> | null>;\n /**\n * Get the revision of the entry before given one.\n */\n getPreviousRevision: <T extends CmsEntryValues = CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsGetPreviousRevisionParams\n ) => Promise<CmsEntry<T> | null>;\n /**\n * Gets entry by given params.\n */\n get: <T extends CmsEntryValues = CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsGetParams\n ) => Promise<CmsEntry<T> | null>;\n /**\n * List all entries. Filterable via params.\n */\n list: <T extends CmsEntryValues = CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsListParams\n ) => Promise<CmsEntryStorageOperationsListResponse<CmsEntry<T>>>;\n /**\n * Create a new entry.\n */\n create: <T extends CmsEntryValues = CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsCreateParams<T>\n ) => Promise<CmsEntry<T>>;\n /**\n * Create a new entry from existing one.\n */\n createRevisionFrom: <T extends CmsEntryValues = CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsCreateRevisionFromParams<T>\n ) => Promise<CmsEntry<T>>;\n /**\n * Update existing entry.\n */\n update: <T extends CmsEntryValues = CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsUpdateParams<T>\n ) => Promise<CmsEntry<T>>;\n /**\n * Move entry and all its entries into a new folder.\n */\n move: (model: CmsModel, id: string, folderId: string) => Promise<void>;\n /**\n * Delete the entry revision.\n */\n deleteRevision: <T extends CmsEntryValues = CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsDeleteRevisionParams<T>\n ) => Promise<void>;\n /**\n * Delete the entry.\n */\n delete: (model: CmsModel, params: CmsEntryStorageOperationsDeleteParams) => Promise<void>;\n /**\n * Move the entry to bin.\n */\n moveToBin: (model: CmsModel, params: CmsEntryStorageOperationsMoveToBinParams) => Promise<void>;\n /**\n * Restore the entry from the bin.\n */\n restoreFromBin: <T extends CmsEntryValues = CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsRestoreFromBinParams<T>\n ) => Promise<CmsEntry<T>>;\n /**\n * Delete multiple entries, with a limit on how much can be deleted in one call.\n */\n deleteMultipleEntries: (\n model: CmsModel,\n params: CmsEntryStorageOperationsDeleteEntriesParams\n ) => Promise<void>;\n /**\n * Publish the entry.\n */\n publish: <T extends CmsEntryValues = CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsPublishParams<T>\n ) => Promise<CmsEntry<T>>;\n /**\n * Unpublish the entry.\n */\n unpublish: <T extends CmsEntryValues = CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsUnpublishParams<T>\n ) => Promise<CmsEntry<T>>;\n /**\n * Method to list all the unique values for the given field id.\n * Simplest use case would be to aggregate tags for some content.\n * @internal\n */\n getUniqueFieldValues: (\n model: CmsModel,\n params: CmsEntryStorageOperationsGetUniqueFieldValuesParams\n ) => Promise<CmsEntryUniqueValue[]>;\n}\n\nexport enum CONTENT_ENTRY_STATUS {\n DRAFT = \"draft\",\n PUBLISHED = \"published\",\n UNPUBLISHED = \"unpublished\"\n}\n\nexport interface HeadlessCmsStorageOperations<C extends CmsContext = CmsContext> {\n name: string;\n groups: CmsGroupStorageOperations;\n models: CmsModelStorageOperations;\n entries: CmsEntryStorageOperations;\n /**\n * Either attach something from the storage operations or run something in it.\n */\n beforeInit: (context: C) => Promise<void>;\n init?: (context: C) => Promise<void>;\n}\n"],"mappings":"AAmFA;AACA;AACA;AACA;AACA;;AAKA;AACA;AACA;;AAKA;AACA;AACA;;AAUA;AACA;AACA;AACA;AACA;AACA;;AAgCA;AACA;AACA;AACA;AACA;;AAQA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;;AASA;AACA;AACA;AACA;AACA;AACA;;AAQA;AACA;AACA;AACA;AACA;AACA;;AAOA;AACA;AACA;AACA;AACA;AACA;;AA4BA;AACA;AACA;AACA;AACA;AACA;;AAgBA;AACA;AACA;AACA;AACA;AACA;;AA8MA;AACA;AACA;AACA;AACA;AACA;;AAsCA;AACA;AACA;AACA;AACA;;AA0BA;AACA;AACA;AACA;AACA;AACA;;AA+EA;AACA;AACA;AACA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;;AAUA;AACA;AACA;AACA;AACA;AACA;;AAgBA;AACA;AACA;AACA;;AAyDA;AACA;AACA;AACA;;AAuCA;AACA;AACA;AACA;;AAuDA;AACA;AACA;AACA;;AAMA;AACA;AACA;;AAaA;AACA;AACA;AACA;;AAaA;AACA;AACA;AACA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;;AAmCA;AACA;AACA;AACA;AACA;;AAmDA;AACA;AACA;AACA;AACA;;AAuNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAuJA,WAAYA,oBAAoB,0BAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAAA,OAApBA,oBAAoB;AAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["CONTENT_ENTRY_STATUS"],"sources":["types.ts"],"sourcesContent":["import type { Context, GenericRecord } from \"@webiny/api/types.js\";\nimport type { GraphQLFieldResolver, GraphQLRequestBody } from \"@webiny/handler-graphql/types.js\";\nimport type { processRequestBody } from \"@webiny/handler-graphql\";\nimport type { DbContext } from \"@webiny/handler-db/types.js\";\nimport type { CmsModelConverterCallable } from \"~/utils/converters/ConverterCollection.js\";\nimport type { HeadlessCmsExport, HeadlessCmsImport } from \"~/export/types.js\";\nimport type { AccessControl } from \"~/crud/AccessControl/AccessControl.js\";\nimport type { CmsModelToAstConverter } from \"~/utils/contentModelAst/CmsModelToAstConverter.js\";\nimport type { ICmsModelFieldToGraphQLRegistry } from \"~/features/graphql/fields/abstractions/CmsModelFieldToGraphQLRegistry.js\";\nimport type { CmsEntryContext } from \"./context.js\";\nimport type { CmsModelField, CmsModelFieldValidation, CmsModelUpdateInput } from \"./modelField.js\";\nimport type {\n CmsModel,\n CmsModelCreateFromInput,\n CmsModelCreateInput,\n StorageCmsModel\n} from \"./model.js\";\nimport type { CmsGroup } from \"./modelGroup.js\";\nimport type { CmsIdentity } from \"./identity.js\";\nimport type { ApiCoreContext } from \"@webiny/api-core/types/core.js\";\nimport type { SecurityPermission } from \"@webiny/api-core/types/security.js\";\nimport type {\n DateStringInterfaceGenerator,\n IdentityInterfaceGenerator,\n IdInterfaceGenerator,\n IdMixedInterfaceGenerator,\n NumericInterfaceGenerator,\n TruthfulInterfaceGenerator\n} from \"@webiny/api\";\n\nexport type CmsIcon = {\n type: string;\n name: string;\n value?: string;\n};\n\nexport interface CmsError {\n message: string;\n code: string;\n data: GenericRecord;\n stack?: string;\n}\n\nexport type ApiEndpoint = \"manage\" | \"preview\" | \"read\";\n\nexport interface HeadlessCms extends CmsGroupContext, CmsModelContext, CmsEntryContext {\n /**\n * API type\n */\n type: ApiEndpoint | null;\n /**\n * Means this request is a READ API\n */\n READ: boolean;\n /**\n * Means this request is a MANAGE API\n */\n MANAGE: boolean;\n /**\n * Means this request is a PREVIEW API\n */\n PREVIEW: boolean;\n /**\n * The storage operations loaded for current context.\n */\n storageOperations: HeadlessCmsStorageOperations;\n\n /**\n * Use to ensure perform authorization and ensure identities have access to the groups, models and entries.\n */\n accessControl: AccessControl;\n\n /**\n * Export operations.\n */\n export: HeadlessCmsExport;\n importing: HeadlessCmsImport;\n getExecutableSchema: GetExecutableSchema;\n}\n\nexport type GetExecutableSchema = (\n type: ApiEndpoint\n) => Promise<\n <TData = Record<string, any>, TExtensions = Record<string, any>>(\n input: GraphQLRequestBody | GraphQLRequestBody[]\n ) => ReturnType<typeof processRequestBody<TData, TExtensions>>\n>;\n\n/**\n * @description This combines all contexts used in the CMS into a single one.\n *\n * @category Context\n */\nexport interface CmsContext extends Context, DbContext, ApiCoreContext {\n cms: HeadlessCms;\n}\n\n/**\n * Used for our internal functionality.\n */\nexport interface CmsModelFieldWithParent extends CmsModelField {\n parent?: CmsModelFieldWithParent | null;\n}\n\n/**\n * A definition for dateTime field to show possible type of the field in settings.\n */\nexport interface CmsModelDateTimeField extends CmsModelField {\n /**\n * Settings object for the field. Contains `type` property.\n */\n settings: {\n type: \"time\" | \"date\" | \"dateTimeWithoutTimezone\" | \"dateTimeWithTimezone\";\n };\n}\n\n/**\n * Arguments for the field validator validate method.\n *\n * @category ModelField\n * @category FieldValidation\n */\nexport interface CmsModelFieldValidatorValidateParams<T extends CmsEntryValues = CmsEntryValues> {\n /**\n * A value to be validated.\n */\n value: T[keyof T];\n /**\n * Options from the CmsModelField validations.\n *\n * @see CmsModelField.validation\n * @see CmsModelField.listValidation\n */\n validator: CmsModelFieldValidation;\n /**\n * An instance of the current context.\n */\n context: CmsContext;\n /**\n * Field being validated.\n */\n field: CmsModelField;\n /**\n * An instance of the content model being validated.\n */\n model: CmsModel;\n /**\n * If entry is sent it means it is an update operation.\n * First usage is for the unique field value.\n */\n entry?: CmsEntry<T>;\n}\n\n/**\n * When sending model to the storage operations, it must contain createValueKeyToStorageConverter and createValueKeyFromStorageConverter\n *\n * @category CmsModel\n */\nexport interface StorageOperationsCmsModel<\n T extends CmsEntryValues = CmsEntryValues\n> extends CmsModel {\n convertValueKeyToStorage: CmsModelConverterCallable<T>;\n convertValueKeyFromStorage: CmsModelConverterCallable<T>;\n}\n\n/**\n * @category ModelField\n */\nexport interface CmsModelFieldDefinition {\n fields: string;\n typeDefs?: string;\n}\n\n/**\n * A GraphQL `params.data` parameter received when creating content model group.\n *\n * @category CmsGroup\n * @category GraphQL params\n */\nexport interface CmsGroupCreateInput {\n id?: string;\n name: string;\n slug?: string;\n description?: string | null;\n icon?: CmsIcon | null;\n}\n\n/**\n * A GraphQL `params.data` parameter received when updating content model group.\n *\n * @category CmsGroup\n * @category GraphQL params\n */\nexport interface CmsGroupUpdateInput {\n name?: string;\n slug?: string;\n description?: string;\n icon?: CmsIcon;\n}\n\n/**\n * A `data.where` parameter received when listing content model groups.\n *\n * @category CmsGroup\n * @category GraphQL params\n */\nexport interface CmsGroupListParams {\n where: {\n tenant: string;\n };\n}\n\n/**\n * Cms Group in context.\n *\n * @category Context\n * @category CmsGroup\n */\nexport interface CmsGroupContext {\n /**\n * Gets content model group by given id.\n */\n getGroup: (id: string) => Promise<CmsGroup>;\n /**\n * List all content model groups. Filterable via params.\n */\n listGroups: (params?: CmsGroupListParams) => Promise<CmsGroup[]>;\n /**\n * Create a new content model group.\n */\n createGroup: (data: CmsGroupCreateInput) => Promise<CmsGroup>;\n /**\n * Update existing content model group.\n */\n updateGroup: (id: string, data: CmsGroupUpdateInput) => Promise<CmsGroup>;\n /**\n * Delete content model group by given id.\n */\n deleteGroup: (id: string) => Promise<boolean>;\n /**\n * Clear the cached groups.\n */\n clearGroupsCache: () => void;\n}\n\n/**\n * A content entry values definition for and from the database.\n *\n * @category Database model\n * @category CmsEntry\n */\nexport interface CmsEntryValues {\n [key: string]: any;\n}\n\nexport interface ICmsEntryLocation {\n folderId?: string;\n}\n\nexport interface ICmsEntryLive {\n version: number;\n}\n\nexport interface ICmsEntrySystem {\n // to be extended\n}\n/**\n * A content entry definition for and from the database.\n *\n * @category Database model\n * @category CmsEntry\n */\nexport interface CmsEntry<TValues extends CmsEntryValues = CmsEntryValues> {\n /**\n * Tenant id which is this entry for. Can be used in case of shared storage.\n */\n tenant: string;\n /**\n * Generated ID of the entry. It is shared across all the records in the database that represent a single entry.\n * So version 1, 2, ..., 2371 will have the same value in this field to link them together.\n */\n entryId: string;\n /**\n * Generated ID + version of the entry.\n */\n id: string;\n\n /**\n * Revision-level meta fields. 👇\n */\n\n /**\n * An ISO 8601 date/time string.\n */\n revisionCreatedOn: string;\n /**\n * An ISO 8601 date/time string.\n */\n revisionSavedOn: string;\n /**\n * An ISO 8601 date/time string.\n */\n revisionModifiedOn: string | null;\n /**\n * An ISO 8601 date/time string.\n */\n revisionDeletedOn: string | null;\n /**\n * An ISO 8601 date/time string.\n */\n revisionRestoredOn: string | null;\n /**\n * An ISO 8601 date/time string.\n */\n revisionFirstPublishedOn: string | null;\n /**\n * An ISO 8601 date/time string.\n */\n revisionLastPublishedOn: string | null;\n\n /**\n * Identity that last ionCreated the entry.\n */\n revisionCreatedBy: CmsIdentity;\n /**\n * Identity that last ionSaved the entry.\n */\n revisionSavedBy: CmsIdentity;\n /**\n * Identity that last ionModified the entry.\n */\n revisionModifiedBy: CmsIdentity | null;\n /**\n * Identity that last deleted the revision.\n */\n revisionDeletedBy: CmsIdentity | null;\n /**\n * Identity that last restored the revision.\n */\n revisionRestoredBy: CmsIdentity | null;\n /**\n * Identity that first published the entry.\n */\n revisionFirstPublishedBy: CmsIdentity | null;\n /**\n * Identity that last published the entry.\n */\n revisionLastPublishedBy: CmsIdentity | null;\n\n /**\n * An ISO 8601 date/time string.\n */\n createdOn: string;\n /**\n * An ISO 8601 date/time string.\n */\n savedOn: string;\n /**\n * An ISO 8601 date/time string.\n */\n modifiedOn: string | null;\n /**\n * An ISO 8601 date/time string.\n */\n deletedOn: string | null;\n /**\n * An ISO 8601 date/time string.\n */\n restoredOn: string | null;\n /**\n * An ISO 8601 date/time string.\n */\n firstPublishedOn: string | null;\n /**\n * An ISO 8601 date/time string.\n */\n lastPublishedOn: string | null;\n\n /**\n * Identity that last created the entry.\n */\n createdBy: CmsIdentity;\n /**\n * Identity that last saved the entry.\n */\n savedBy: CmsIdentity;\n /**\n * Identity that last modified the entry.\n */\n modifiedBy: CmsIdentity | null;\n /**\n * Identity that last deleted the entry.\n */\n deletedBy: CmsIdentity | null;\n /**\n * Identity that last restored the entry.\n */\n restoredBy: CmsIdentity | null;\n /**\n * Identity that first published the entry.\n */\n firstPublishedBy: CmsIdentity | null;\n /**\n * Identity that last published the entry.\n */\n lastPublishedBy: CmsIdentity | null;\n\n /**\n * Model ID of the definition for the entry.\n * @see CmsModel\n */\n modelId: string;\n /**\n * A revision version of the entry.\n */\n version: number;\n /**\n * Is the entry locked?\n */\n locked: boolean;\n /**\n * Status type of the entry.\n */\n status: CmsEntryStatus;\n /**\n * A mapped storageId -> value object.\n *\n * @see CmsModelField\n */\n values: TValues;\n /**\n * Advanced Content Organization\n */\n location?: ICmsEntryLocation;\n /**\n * Settings for the given entry.\n *\n * Introduced with Advanced Publishing Workflow. Will always be inserted once this PR is merged.\n * Be aware that when accessing properties in it on old systems, it will break if not checked first.\n *\n * Available only on the Manage API in entry GraphQL type `meta.data` property.\n */\n meta?: GenericRecord;\n /**\n * Is the entry in the bin?\n */\n wbyDeleted?: boolean | null;\n /**\n * This field preserves the original folderId value, as the ROOT_FOLDER is set upon deletion.\n * The value is used when restoring the entry from the trash bin.\n */\n binOriginalFolderId?: string;\n\n system?: ICmsEntrySystem;\n /**\n * Is this CMS Entry live (no matter the revision).\n */\n live: ICmsEntryLive | null;\n}\n\nexport interface CmsStorageEntry<T extends CmsEntryValues = CmsEntryValues> extends CmsEntry<T> {\n [key: string]: any;\n}\n\nexport interface CmsEntryUniqueValue {\n value: string;\n count: number;\n}\n\nexport interface ICmsModelListParams {\n /**\n * Defaults to true.\n */\n includePrivate?: boolean;\n includePlugins?: boolean;\n}\n\n/**\n * Cms Model in the context.\n *\n * @category Context\n * @category CmsModel\n */\nexport interface CmsModelContext {\n /**\n * Get a single content model.\n *\n * @throws NotFoundError\n */\n getModel(modelId: string): Promise<CmsModel>;\n /**\n * Get model to AST converter.\n */\n getModelToAstConverter: () => CmsModelToAstConverter;\n /**\n * Get all content models.\n */\n listModels(params?: ICmsModelListParams): Promise<CmsModel[]>;\n /**\n * Create a content model.\n */\n createModel(data: CmsModelCreateInput): Promise<CmsModel>;\n /**\n * Create a content model from the given model - clone.\n */\n createModelFrom(modelId: string, data: CmsModelCreateFromInput): Promise<CmsModel>;\n /**\n * Update content model.\n */\n updateModel(modelId: string, data: CmsModelUpdateInput): Promise<CmsModel>;\n /**\n * Delete content model. Should not allow deletion if there are entries connected to it.\n */\n deleteModel(modelId: string): Promise<void>;\n /**\n * Clear all the model caches.\n */\n clearModelsCache(): void;\n}\n\n/**\n * Available statuses for content entry.\n *\n * @category CmsEntry\n */\nexport type CmsEntryStatus = \"published\" | \"unpublished\" | \"draft\";\n\nexport interface CmsEntryListWhereRef\n extends\n IdInterfaceGenerator<\"id\">,\n IdInterfaceGenerator<\"entryId\">,\n IdInterfaceGenerator<\"modelId\"> {}\n\nexport interface CmsEntryListWhereValues {\n /**\n * This is to allow querying by any content model field defined by the user.\n */\n [key: string]:\n | string\n | number\n | boolean\n | Date\n | undefined\n | string[]\n | number[]\n | null\n | CmsEntryListWhereValues[]\n | CmsEntryListWhereValues\n | CmsEntryListWhereRef;\n}\n/**\n * Entry listing where params.\n *\n * @category CmsEntry\n * @category GraphQL params\n */\n\nexport interface CmsEntryListWhere\n extends\n IdMixedInterfaceGenerator<\"id\">,\n IdMixedInterfaceGenerator<\"entryId\">,\n IdInterfaceGenerator<\"status\", CmsEntryStatus>,\n /**\n * Revision-level meta fields. 👇\n */\n IdentityInterfaceGenerator<\"revisionCreatedBy\">,\n IdentityInterfaceGenerator<\"revisionModifiedBy\">,\n IdentityInterfaceGenerator<\"revisionSavedBy\">,\n IdentityInterfaceGenerator<\"revisionFirstPublishedBy\">,\n IdentityInterfaceGenerator<\"revisionLastPublishedBy\">,\n /**\n * Entry-level meta fields. 👇\n */\n IdentityInterfaceGenerator<\"createdBy\">,\n IdentityInterfaceGenerator<\"modifiedBy\">,\n IdentityInterfaceGenerator<\"savedBy\">,\n IdentityInterfaceGenerator<\"firstPublishedBy\">,\n IdentityInterfaceGenerator<\"lastPublishedBy\">,\n DateStringInterfaceGenerator<\"createdOn\">,\n DateStringInterfaceGenerator<\"savedOn\">,\n DateStringInterfaceGenerator<\"deletedOn\">,\n /**\n * Version of the entry.\n *\n * It is not meant to be used via the API.\n * @internal\n */\n NumericInterfaceGenerator<\"version\">,\n /**\n * Each storage operations implementation MUST determine how to use this field.\n * In SQL, it can be a `published` field, and in DynamoDB it can be an SK.\n *\n * It is not meant to be used via the API.\n * @internal\n */\n TruthfulInterfaceGenerator<\"published\">,\n /**\n * Each storage operations implementation MUST determine how to use this field.\n * In SQL, it can be a `latest` field, and in DynamoDB it can be an SK.\n *\n * It is not meant to be used via the API.\n * @internal\n */\n TruthfulInterfaceGenerator<\"latest\"> {\n /**\n * ACO related parameters.\n */\n wbyAco_location?: {\n folderId?: string;\n folderId_not?: string;\n folderId_in?: string[];\n folderId_not_in?: string[];\n };\n location?: {\n folderId?: string;\n folderId_not?: string;\n folderId_in?: string[];\n folderId_not_in?: string[];\n };\n\n values?: CmsEntryListWhereValues;\n /**\n * Is the entry in the bin?\n */\n wbyDeleted?: boolean;\n wbyDeleted_not?: boolean;\n\n /**\n * To allow querying via nested queries, we added the AND / OR properties.\n */\n AND?: CmsEntryListWhere[];\n OR?: CmsEntryListWhere[];\n}\n\n/**\n * Entry listing sort.\n *\n * @category CmsEntry\n * @category GraphQL params\n */\nexport type CmsEntryListSortAsc = `${string}_ASC`;\nexport type CmsEntryListSortDesc = `${string}_DESC`;\nexport type CmsEntryListSort = (CmsEntryListSortAsc | CmsEntryListSortDesc)[];\n\n/**\n * Get entry GraphQL resolver params.\n *\n * @category CmsEntry\n * @category GraphQL params\n */\nexport interface CmsEntryGetParams {\n where: CmsEntryListWhere;\n sort?: CmsEntryListSort;\n}\n\n/**\n * List entries GraphQL resolver params.\n *\n * @category CmsEntry\n * @category GraphQL params\n */\nexport interface CmsEntryListParams {\n where?: CmsEntryListWhere;\n sort?: CmsEntryListSort;\n search?: string;\n fields?: string[];\n limit?: number;\n after?: string | null;\n}\n\n/**\n * Meta information for GraphQL output.\n *\n * @category CmsEntry\n * @category GraphQL output\n */\nexport interface CmsEntryMeta {\n /**\n * A cursor for pagination.\n */\n cursor: string | null;\n /**\n * Is there more items to load?\n */\n hasMoreItems: boolean;\n /**\n * Total count of the items in the storage.\n */\n totalCount: number;\n}\n\n/**\n * @category Context\n * @category CmsEntry\n */\nexport interface CreateCmsEntryInput<TValues extends CmsEntryValues = CmsEntryValues> {\n id?: string;\n status?: CmsEntryStatus;\n\n /**\n * Entry-level meta fields. 👇\n */\n createdOn?: Date | string;\n modifiedOn?: Date | string | null;\n savedOn?: Date | string;\n deletedOn?: Date | string | null;\n restoredOn?: Date | string | null;\n createdBy?: CmsIdentity;\n modifiedBy?: CmsIdentity;\n savedBy?: CmsIdentity;\n deletedBy?: CmsIdentity | null;\n restoredBy?: CmsIdentity | null;\n firstPublishedOn?: Date | string;\n lastPublishedOn?: Date | string;\n firstPublishedBy?: CmsIdentity;\n lastPublishedBy?: CmsIdentity;\n\n /**\n * Revision-level meta fields. 👇\n */\n revisionCreatedOn?: Date | string;\n revisionModifiedOn?: Date | string | null;\n revisionSavedOn?: Date | string;\n revisionDeletedOn?: Date | string | null;\n revisionRestoredOn?: Date | string | null;\n revisionCreatedBy?: CmsIdentity;\n revisionModifiedBy?: CmsIdentity | null;\n revisionSavedBy?: CmsIdentity;\n revisionDeletedBy?: CmsIdentity | null;\n revisionRestoredBy?: CmsIdentity | null;\n revisionFirstPublishedOn?: Date | string;\n revisionLastPublishedOn?: Date | string;\n revisionFirstPublishedBy?: CmsIdentity;\n revisionLastPublishedBy?: CmsIdentity;\n // TODO remove wbyAco_location\n wbyAco_location?: {\n folderId?: string | null;\n };\n location?: {\n folderId?: string | null;\n };\n\n system?: Partial<ICmsEntrySystem>;\n\n values: TValues | undefined;\n}\n\nexport interface CreateCmsEntryOptionsInput {\n skipValidators?: string[];\n}\n\n/**\n * @category Context\n * @category CmsEntry\n */\nexport interface CreateFromCmsEntryInput<TValues extends CmsEntryValues = CmsEntryValues> {\n /**\n * Revision-level meta fields. 👇\n */\n revisionCreatedOn?: Date;\n revisionSavedOn?: Date;\n revisionModifiedOn?: Date;\n revisionCreatedBy?: CmsIdentity;\n revisionModifiedBy?: CmsIdentity;\n revisionSavedBy?: CmsIdentity;\n revisionFirstPublishedOn?: Date | string;\n revisionLastPublishedOn?: Date | string;\n revisionFirstPublishedBy?: CmsIdentity;\n revisionLastPublishedBy?: CmsIdentity;\n\n /**\n * Entry-level meta fields. 👇\n */\n createdOn?: Date;\n savedOn?: Date;\n modifiedOn?: Date;\n createdBy?: CmsIdentity;\n modifiedBy?: CmsIdentity;\n savedBy?: CmsIdentity;\n firstPublishedOn?: Date | string;\n lastPublishedOn?: Date | string;\n firstPublishedBy?: CmsIdentity;\n lastPublishedBy?: CmsIdentity;\n\n system?: Partial<ICmsEntrySystem>;\n\n values: TValues;\n}\n\nexport interface CreateRevisionCmsEntryOptionsInput {\n skipValidators?: string[];\n}\n\n/**\n * @category Context\n * @category CmsEntry\n */\nexport interface UpdateCmsEntryInput<TValues extends CmsEntryValues = CmsEntryValues> {\n /**\n * Revision-level meta fields. 👇\n */\n revisionCreatedOn?: Date | string | null;\n revisionModifiedOn?: Date | string | null;\n revisionSavedOn?: Date | string | null;\n revisionDeletedOn?: Date | string | null;\n revisionRestoredOn?: Date | string | null;\n revisionFirstPublishedOn?: Date | string | null;\n revisionLastPublishedOn?: Date | string | null;\n revisionModifiedBy?: CmsIdentity | null;\n revisionCreatedBy?: CmsIdentity | null;\n revisionSavedBy?: CmsIdentity | null;\n revisionDeletedBy?: CmsIdentity | null;\n revisionRestoredBy?: CmsIdentity | null;\n revisionFirstPublishedBy?: CmsIdentity | null;\n revisionLastPublishedBy?: CmsIdentity | null;\n\n /**\n * Entry-level meta fields. 👇\n */\n createdOn?: Date | string | null;\n modifiedOn?: Date | string | null;\n savedOn?: Date | string | null;\n deletedOn?: Date | string | null;\n restoredOn?: Date | string | null;\n firstPublishedOn?: Date | string | null;\n lastPublishedOn?: Date | string | null;\n createdBy?: CmsIdentity | null;\n modifiedBy?: CmsIdentity | null;\n savedBy?: CmsIdentity | null;\n deletedBy?: CmsIdentity | null;\n restoredBy?: CmsIdentity | null;\n firstPublishedBy?: CmsIdentity | null;\n lastPublishedBy?: CmsIdentity | null;\n\n wbyAco_location?: {\n folderId?: string | null;\n };\n\n location?: {\n folderId?: string | null;\n };\n\n system?: Partial<ICmsEntrySystem>;\n\n values?: Partial<TValues>;\n}\n\nexport interface UpdateCmsEntryOptionsInput {\n skipValidators?: string[];\n}\n\n/**\n * @category Context\n * @category CmsEntry\n */\nexport interface GetUniqueFieldValuesParams {\n where: CmsEntryListWhere;\n fieldId: string;\n}\n\n/**\n * @category CmsEntry\n */\nexport interface CmsDeleteEntryOptions {\n /**\n * Runs the delete commands even if the entry is not found in the DynamoDB.\n * This is to force clean the entry records that might have been left behind a failed delete.\n */\n force?: boolean;\n /**\n * Destroying the entry directly, without moving it to the bin.\n */\n permanently?: boolean;\n}\n\n/**\n * @category Context\n * @category CmsEntry\n */\nexport interface DeleteMultipleEntriesParams {\n entries: string[];\n}\n\nexport type DeleteMultipleEntriesResponse = {\n id: string;\n}[];\n\nexport interface CmsEntryValidateResponse {\n [key: string]: any;\n}\n\n/**\n * Parameters for CmsEntryResolverFactory.\n *\n * @category GraphQL resolver\n * @category CmsEntry\n */\ninterface CmsEntryResolverFactoryParams {\n model: CmsModel;\n fieldRegistry: ICmsModelFieldToGraphQLRegistry;\n}\n\n/**\n * A type for EntryResolvers. Used when creating get, list, update, publish, ...etc.\n *\n * @category GraphQL resolver\n * @category CmsEntry\n */\nexport type CmsEntryResolverFactory<TSource = any, TArgs = any, TContext = CmsContext> = {\n (params: CmsEntryResolverFactoryParams): GraphQLFieldResolver<TSource, TArgs, TContext>;\n};\n\n/**\n * A base security permission for CMS.\n *\n * @category SecurityPermission\n */\nexport interface BaseCmsSecurityPermission extends SecurityPermission {\n own?: boolean;\n rwd: string;\n}\n\n/**\n * A security permission for content model.\n *\n * @category SecurityPermission\n * @category CmsModel\n */\nexport interface CmsModelPermission extends BaseCmsSecurityPermission {\n models?: string[];\n groups?: string[];\n}\n\n/**\n * The security permission for content model groups.\n *\n * @category SecurityPermission\n * @category CmsGroup\n */\nexport interface CmsGroupPermission extends BaseCmsSecurityPermission {\n groups?: string[];\n}\n\n/**\n * The security permission for content entry.\n *\n * @category SecurityPermission\n * @category CmsEntry\n */\nexport interface CmsEntryPermission extends BaseCmsSecurityPermission {\n pw?: string;\n models?: string[];\n groups?: string[];\n}\n\nexport interface CmsGroupStorageOperationsGetParams {\n id: string;\n tenant: string;\n}\n\nexport interface CmsGroupStorageOperationsListWhereParams {\n tenant: string;\n\n [key: string]: any;\n}\n\nexport interface CmsGroupStorageOperationsListParams {\n where: CmsGroupStorageOperationsListWhereParams;\n sort?: string[];\n}\n\nexport interface CmsGroupStorageOperationsCreateParams {\n group: CmsGroup;\n}\n\nexport interface CmsGroupStorageOperationsUpdateParams {\n group: CmsGroup;\n}\n\nexport interface CmsGroupStorageOperationsDeleteParams {\n group: CmsGroup;\n}\n\n/**\n * Description of the CmsGroup CRUD operations.\n * If user wants to add another database to the application, this is how it is done.\n * This is just plain read, update, write, delete and list - no authentication or permission checks.\n */\nexport interface CmsGroupStorageOperations {\n /**\n * Gets content model group by given id.\n */\n get: (params: CmsGroupStorageOperationsGetParams) => Promise<CmsGroup | null>;\n /**\n * List all content model groups. Filterable via params.\n */\n list: (params: CmsGroupStorageOperationsListParams) => Promise<CmsGroup[]>;\n /**\n * Create a new content model group.\n */\n create: (params: CmsGroupStorageOperationsCreateParams) => Promise<void>;\n /**\n * Update existing content model group.\n */\n update: (params: CmsGroupStorageOperationsUpdateParams) => Promise<void>;\n /**\n * Delete the content model group.\n */\n delete: (params: CmsGroupStorageOperationsDeleteParams) => Promise<void>;\n}\n\nexport interface CmsModelStorageOperationsGetParams {\n tenant: string;\n modelId: string;\n}\n\nexport interface CmsModelStorageOperationsListWhereParams {\n tenant: string;\n\n [key: string]: string;\n}\n\nexport interface CmsModelStorageOperationsListParams {\n where: CmsModelStorageOperationsListWhereParams;\n}\n\nexport interface CmsModelStorageOperationsCreateParams {\n model: StorageCmsModel;\n}\n\nexport interface CmsModelStorageOperationsUpdateParams {\n model: StorageCmsModel;\n}\n\nexport interface CmsModelStorageOperationsDeleteParams {\n model: CmsModel;\n}\n\n/**\n * Description of the CmsModel storage operations.\n * If user wants to add another database to the application, this is how it is done.\n * This is just plain read, update, write, delete and list - no authentication or permission checks.\n */\nexport interface CmsModelStorageOperations {\n /**\n * Gets content model by given id.\n */\n get: (params: CmsModelStorageOperationsGetParams) => Promise<StorageCmsModel | null>;\n /**\n * List all content models. Filterable via params.\n */\n list: (params: CmsModelStorageOperationsListParams) => Promise<StorageCmsModel[]>;\n /**\n * Create a new content model.\n */\n create: (params: CmsModelStorageOperationsCreateParams) => Promise<StorageCmsModel>;\n /**\n * Update existing content model.\n */\n update: (params: CmsModelStorageOperationsUpdateParams) => Promise<StorageCmsModel>;\n /**\n * Delete the content model.\n */\n delete: (params: CmsModelStorageOperationsDeleteParams) => Promise<void>;\n}\n\nexport interface CmsEntryStorageOperationsGetParams {\n where: CmsEntryListWhere;\n sort?: CmsEntryListSort;\n limit?: number;\n}\n\nexport interface CmsEntryStorageOperationsListParams {\n where: CmsEntryListWhere;\n sort?: CmsEntryListSort;\n search?: string;\n fields?: string[];\n limit: number;\n after?: string | null;\n}\n\nexport interface CmsEntryStorageOperationsCreateParams<T extends CmsEntryValues = CmsEntryValues> {\n /**\n * Real entry, with no transformations on it.\n */\n entry: CmsEntry<T>;\n /**\n * Entry prepared for the storage.\n */\n storageEntry: CmsStorageEntry<T>;\n}\n\nexport interface CmsEntryStorageOperationsCreateRevisionFromParams<\n T extends CmsEntryValues = CmsEntryValues\n> {\n /**\n * Real entry, with no transformations on it.\n */\n entry: CmsEntry<T>;\n /**\n * Entry prepared for the storage.\n */\n storageEntry: CmsStorageEntry<T>;\n}\n\nexport interface CmsEntryStorageOperationsUpdateParams<T extends CmsEntryValues = CmsEntryValues> {\n /**\n * Real entry, with no transformations on it.\n */\n entry: CmsEntry<T>;\n /**\n * Entry prepared for the storage.\n */\n storageEntry: CmsStorageEntry<T>;\n}\n\nexport interface CmsEntryStorageOperationsDeleteRevisionParams<\n T extends CmsEntryValues = CmsEntryValues\n> {\n /**\n * Entry that was deleted.\n */\n entry: CmsEntry<T>;\n /**\n * Entry that was deleted, directly from storage, with transformations.\n */\n storageEntry: CmsStorageEntry<T>;\n /**\n * Entry that was set as latest.\n */\n latestEntry: CmsEntry | null;\n /**\n * Entry that was set as latest, directly from storage, with transformations.\n */\n latestStorageEntry: CmsStorageEntry<T> | null;\n}\n\nexport interface CmsEntryStorageOperationsDeleteParams<T extends CmsEntryValues = CmsEntryValues> {\n entry: CmsEntry<T>;\n}\n\nexport interface CmsEntryStorageOperationsMoveToBinParams<\n T extends CmsEntryValues = CmsEntryValues\n> {\n /**\n * The modified entry that is going to be saved as published.\n * Entry is in its original form.\n */\n entry: CmsEntry<T>;\n /**\n * The modified entry and prepared for the storage.\n */\n storageEntry: CmsStorageEntry<T>;\n}\n\nexport interface CmsEntryStorageOperationsRestoreFromBinParams<\n T extends CmsEntryValues = CmsEntryValues\n> {\n /**\n * The modified entry that is going to be saved as restored.\n * Entry is in its original form.\n */\n entry: CmsEntry<T>;\n /**\n * The modified entry and prepared for the storage.\n */\n storageEntry: CmsStorageEntry<T>;\n}\n\nexport interface CmsEntryStorageOperationsDeleteEntriesParams {\n entries: string[];\n}\n\nexport interface CmsEntryStorageOperationsPublishParams<T extends CmsEntryValues = CmsEntryValues> {\n /**\n * The modified entry that is going to be saved as published.\n * Entry is in its original form.\n */\n entry: CmsEntry<T>;\n /**\n * The modified entry and prepared for the storage.\n */\n storageEntry: CmsStorageEntry<T>;\n}\n\nexport interface CmsEntryStorageOperationsUnpublishParams<\n T extends CmsEntryValues = CmsEntryValues\n> {\n /**\n * The modified entry that is going to be saved as unpublished.\n */\n entry: CmsEntry<T>;\n /**\n * The modified entry that is going to be saved as unpublished, with transformations on it.\n */\n storageEntry: CmsStorageEntry<T>;\n}\n\nexport interface CmsEntryStorageOperationsGetUniqueFieldValuesParams {\n where: CmsEntryListWhere;\n fieldId: string;\n}\n\nexport interface CmsEntryStorageOperationsGetByIdsParams {\n ids: readonly string[];\n}\n\nexport interface CmsEntryStorageOperationsGetLatestByIdsParams {\n ids: readonly string[];\n}\n\nexport interface CmsEntryStorageOperationsGetPublishedByIdsParams {\n ids: readonly string[];\n}\n\nexport interface CmsEntryStorageOperationsGetRevisionsParams {\n id: string;\n}\n\nexport interface CmsEntryStorageOperationsGetRevisionParams {\n id: string;\n}\n\nexport interface CmsEntryStorageOperationsGetPublishedRevisionParams {\n id: string;\n}\n\nexport interface CmsEntryStorageOperationsGetLatestRevisionParams {\n id: string;\n}\n\nexport interface CmsEntryStorageOperationsGetPreviousRevisionParams {\n entryId: string;\n version: number;\n}\n\nexport interface CmsEntryStorageOperationsListResponse<\n T extends CmsStorageEntry = CmsStorageEntry\n> {\n /**\n * Has more items to load with the current filtering?\n */\n hasMoreItems: boolean;\n /**\n * Items loaded with current filtering.\n */\n items: T[];\n /**\n * Pointer for where to start the new item set.\n */\n cursor: string | null;\n /**\n * Total amount of items with the current filter.\n */\n totalCount: number;\n}\n\n/**\n * Description of the CmsModel storage operations.\n * If user wants to add another database to the application, this is how it is done.\n * This is just plain read, update, write, delete and list - no authentication or permission checks.\n *\n *\n * @category StorageOperations\n * @category CmsEntry\n */\nexport interface CmsEntryStorageOperations {\n /**\n * Get all the entries of the ids.\n */\n getByIds: <T extends CmsEntryValues = CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsGetByIdsParams\n ) => Promise<CmsEntry<T>[]>;\n /**\n * Get all the published entries of the ids.\n */\n getPublishedByIds: <T extends CmsEntryValues = CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsGetPublishedByIdsParams\n ) => Promise<CmsEntry<T>[]>;\n /**\n * Get all the latest entries of the ids.\n */\n getLatestByIds: <T extends CmsEntryValues = CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsGetLatestByIdsParams\n ) => Promise<CmsEntry<T>[]>;\n /**\n * Get all revisions of the given entry id.\n */\n getRevisions: <T extends CmsEntryValues = CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsGetRevisionsParams\n ) => Promise<CmsEntry<T>[]>;\n /**\n * Get the entry by the given revision id.\n */\n getRevisionById: <T extends CmsEntryValues = CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsGetRevisionParams\n ) => Promise<CmsEntry<T> | null>;\n /**\n * Get the published entry by given entryId.\n */\n getPublishedRevisionByEntryId: <T extends CmsEntryValues = CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsGetPublishedRevisionParams\n ) => Promise<CmsEntry<T> | null>;\n /**\n * Get the latest entry by given entryId.\n */\n getLatestRevisionByEntryId: <T extends CmsEntryValues = CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsGetLatestRevisionParams\n ) => Promise<CmsEntry<T> | null>;\n /**\n * Get the revision of the entry before given one.\n */\n getPreviousRevision: <T extends CmsEntryValues = CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsGetPreviousRevisionParams\n ) => Promise<CmsEntry<T> | null>;\n /**\n * Gets entry by given params.\n */\n get: <T extends CmsEntryValues = CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsGetParams\n ) => Promise<CmsEntry<T> | null>;\n /**\n * List all entries. Filterable via params.\n */\n list: <T extends CmsEntryValues = CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsListParams\n ) => Promise<CmsEntryStorageOperationsListResponse<CmsEntry<T>>>;\n /**\n * Create a new entry.\n */\n create: <T extends CmsEntryValues = CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsCreateParams<T>\n ) => Promise<CmsEntry<T>>;\n /**\n * Create a new entry from existing one.\n */\n createRevisionFrom: <T extends CmsEntryValues = CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsCreateRevisionFromParams<T>\n ) => Promise<CmsEntry<T>>;\n /**\n * Update existing entry.\n */\n update: <T extends CmsEntryValues = CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsUpdateParams<T>\n ) => Promise<CmsEntry<T>>;\n /**\n * Move entry and all its entries into a new folder.\n */\n move: (model: CmsModel, id: string, folderId: string) => Promise<void>;\n /**\n * Delete the entry revision.\n */\n deleteRevision: <T extends CmsEntryValues = CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsDeleteRevisionParams<T>\n ) => Promise<void>;\n /**\n * Delete the entry.\n */\n delete: (model: CmsModel, params: CmsEntryStorageOperationsDeleteParams) => Promise<void>;\n /**\n * Move the entry to bin.\n */\n moveToBin: (model: CmsModel, params: CmsEntryStorageOperationsMoveToBinParams) => Promise<void>;\n /**\n * Restore the entry from the bin.\n */\n restoreFromBin: <T extends CmsEntryValues = CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsRestoreFromBinParams<T>\n ) => Promise<CmsEntry<T>>;\n /**\n * Delete multiple entries, with a limit on how much can be deleted in one call.\n */\n deleteMultipleEntries: (\n model: CmsModel,\n params: CmsEntryStorageOperationsDeleteEntriesParams\n ) => Promise<void>;\n /**\n * Publish the entry.\n */\n publish: <T extends CmsEntryValues = CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsPublishParams<T>\n ) => Promise<CmsEntry<T>>;\n /**\n * Unpublish the entry.\n */\n unpublish: <T extends CmsEntryValues = CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsUnpublishParams<T>\n ) => Promise<CmsEntry<T>>;\n /**\n * Method to list all the unique values for the given field id.\n * Simplest use case would be to aggregate tags for some content.\n * @internal\n */\n getUniqueFieldValues: (\n model: CmsModel,\n params: CmsEntryStorageOperationsGetUniqueFieldValuesParams\n ) => Promise<CmsEntryUniqueValue[]>;\n}\n\nexport enum CONTENT_ENTRY_STATUS {\n DRAFT = \"draft\",\n PUBLISHED = \"published\",\n UNPUBLISHED = \"unpublished\"\n}\n\nexport interface HeadlessCmsStorageOperations<C extends CmsContext = CmsContext> {\n name: string;\n groups: CmsGroupStorageOperations;\n models: CmsModelStorageOperations;\n entries: CmsEntryStorageOperations;\n /**\n * Either attach something from the storage operations or run something in it.\n */\n beforeInit: (context: C) => Promise<void>;\n init?: (context: C) => Promise<void>;\n}\n"],"mappings":"AAwFA;AACA;AACA;AACA;AACA;;AAKA;AACA;AACA;;AAKA;AACA;AACA;;AAUA;AACA;AACA;AACA;AACA;AACA;;AAgCA;AACA;AACA;AACA;AACA;;AAQA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;;AASA;AACA;AACA;AACA;AACA;AACA;;AAQA;AACA;AACA;AACA;AACA;AACA;;AAOA;AACA;AACA;AACA;AACA;AACA;;AA4BA;AACA;AACA;AACA;AACA;AACA;;AAgBA;AACA;AACA;AACA;AACA;AACA;;AA8MA;AACA;AACA;AACA;AACA;AACA;;AAsCA;AACA;AACA;AACA;AACA;;AA0BA;AACA;AACA;AACA;AACA;AACA;;AA+EA;AACA;AACA;AACA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;;AAUA;AACA;AACA;AACA;AACA;AACA;;AAgBA;AACA;AACA;AACA;;AAyDA;AACA;AACA;AACA;;AAuCA;AACA;AACA;AACA;;AAuDA;AACA;AACA;AACA;;AAMA;AACA;AACA;;AAaA;AACA;AACA;AACA;;AAaA;AACA;AACA;AACA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;;AAmCA;AACA;AACA;AACA;AACA;;AAmDA;AACA;AACA;AACA;AACA;;AAuNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAuJA,WAAYA,oBAAoB,0BAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAAA,OAApBA,oBAAoB;AAAA","ignoreList":[]}
|
package/utils/toSlug.js
CHANGED
package/utils/toSlug.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["slugify","toSlug","text","replacement","lower","remove"],"sources":["toSlug.ts"],"sourcesContent":["import slugify from \"slugify\";\n\nexport const toSlug = (text: string): string => {\n return slugify(text, {\n replacement: \"-\",\n lower: true,\n remove: /[
|
|
1
|
+
{"version":3,"names":["slugify","toSlug","text","replacement","lower","remove"],"sources":["toSlug.ts"],"sourcesContent":["import slugify from \"slugify\";\n\nexport const toSlug = (text: string): string => {\n return slugify(text, {\n replacement: \"-\",\n lower: true,\n remove: /[*#?<>_{}[\\]+~.()'\"!:;@]/g\n });\n};\n"],"mappings":"AAAA,OAAOA,OAAO,MAAM,SAAS;AAE7B,OAAO,MAAMC,MAAM,GAAIC,IAAY,IAAa;EAC5C,OAAOF,OAAO,CAACE,IAAI,EAAE;IACjBC,WAAW,EAAE,GAAG;IAChBC,KAAK,EAAE,IAAI;IACXC,MAAM,EAAE;EACZ,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
|