@webiny/api-headless-cms-ddb 5.29.0 → 5.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/definitions/entry.js +3 -0
- package/definitions/entry.js.map +1 -1
- package/dynamoDb/storage/date.d.ts +1 -1
- package/dynamoDb/storage/date.js +2 -2
- package/dynamoDb/storage/date.js.map +1 -1
- package/dynamoDb/storage/longText.d.ts +1 -1
- package/dynamoDb/storage/longText.js +2 -2
- package/dynamoDb/storage/longText.js.map +1 -1
- package/dynamoDb/storage/richText.d.ts +1 -1
- package/dynamoDb/storage/richText.js +2 -2
- package/dynamoDb/storage/richText.js.map +1 -1
- package/index.js +9 -10
- package/index.js.map +1 -1
- package/operations/entry/index.js.map +1 -1
- package/operations/entry/systemFields.js +5 -0
- package/operations/entry/systemFields.js.map +1 -1
- package/package.json +14 -14
- package/types.d.ts +1 -2
- package/types.js.map +1 -1
package/definitions/entry.js
CHANGED
package/definitions/entry.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createEntryEntity","params","table","entityName","attributes","Entity","name","PK","type","partitionKey","SK","sortKey","GSI1_PK","GSI1_SK","TYPE","__type","webinyVersion","tenant","entryId","id","createdBy","ownedBy","createdOn","savedOn","modelId","locale","publishedOn","version","locked","status","values"],"sources":["entry.ts"],"sourcesContent":["import { Entity, Table } from \"dynamodb-toolbox\";\nimport { Attributes } from \"~/types\";\n\ninterface Params {\n table: Table;\n entityName: string;\n attributes: Attributes;\n}\nexport const createEntryEntity = (params: Params): Entity<any> => {\n const { table, entityName, attributes } = params;\n return new Entity({\n name: entityName,\n table,\n attributes: {\n PK: {\n type: \"string\",\n partitionKey: true\n },\n SK: {\n type: \"string\",\n sortKey: true\n },\n GSI1_PK: {\n type: \"string\"\n },\n GSI1_SK: {\n type: \"string\"\n },\n TYPE: {\n type: \"string\"\n },\n __type: {\n type: \"string\"\n },\n webinyVersion: {\n type: \"string\"\n },\n tenant: {\n type: \"string\"\n },\n entryId: {\n type: \"string\"\n },\n id: {\n type: \"string\"\n },\n createdBy: {\n type: \"map\"\n },\n ownedBy: {\n type: \"map\"\n },\n createdOn: {\n type: \"string\"\n },\n savedOn: {\n type: \"string\"\n },\n modelId: {\n type: \"string\"\n },\n locale: {\n type: \"string\"\n },\n publishedOn: {\n type: \"string\"\n },\n version: {\n type: \"number\"\n },\n locked: {\n type: \"boolean\"\n },\n status: {\n type: \"string\"\n },\n values: {\n type: \"map\"\n },\n ...(attributes || {})\n }\n });\n};\n"],"mappings":";;;;;;;;;;;AAAA;;;;;;AAQO,MAAMA,iBAAiB,GAAIC,MAAD,IAAiC;EAC9D,MAAM;IAAEC,KAAF;IAASC,UAAT;IAAqBC;EAArB,IAAoCH,MAA1C;EACA,OAAO,IAAII,uBAAJ,CAAW;IACdC,IAAI,EAAEH,UADQ;IAEdD,KAFc;IAGdE,UAAU;MACNG,EAAE,EAAE;QACAC,IAAI,EAAE,QADN;QAEAC,YAAY,EAAE;MAFd,CADE;MAKNC,EAAE,EAAE;QACAF,IAAI,EAAE,QADN;QAEAG,OAAO,EAAE;MAFT,CALE;MASNC,OAAO,EAAE;QACLJ,IAAI,EAAE;MADD,CATH;MAYNK,OAAO,EAAE;QACLL,IAAI,EAAE;MADD,CAZH;MAeNM,IAAI,EAAE;QACFN,IAAI,EAAE;MADJ,CAfA;MAkBNO,MAAM,EAAE;QACJP,IAAI,EAAE;MADF,CAlBF;MAqBNQ,aAAa,EAAE;QACXR,IAAI,EAAE;MADK,CArBT;MAwBNS,MAAM,EAAE;QACJT,IAAI,EAAE;MADF,CAxBF;MA2BNU,OAAO,EAAE;QACLV,IAAI,EAAE;MADD,CA3BH;MA8BNW,EAAE,EAAE;QACAX,IAAI,EAAE;MADN,CA9BE;MAiCNY,SAAS,EAAE;QACPZ,IAAI,EAAE;MADC,CAjCL;MAoCNa,OAAO,EAAE;QACLb,IAAI,EAAE;MADD,CApCH;MAuCNc,SAAS,EAAE;QACPd,IAAI,EAAE;MADC,CAvCL;MA0CNe,OAAO,EAAE;QACLf,IAAI,EAAE;MADD,CA1CH;MA6CNgB,OAAO,EAAE;QACLhB,IAAI,EAAE;MADD,CA7CH;MAgDNiB,MAAM,EAAE;QACJjB,IAAI,EAAE;MADF,CAhDF;MAmDNkB,WAAW,EAAE;QACTlB,IAAI,EAAE;MADG,CAnDP;MAsDNmB,OAAO,EAAE;QACLnB,IAAI,EAAE;MADD,CAtDH;MAyDNoB,MAAM,EAAE;QACJpB,IAAI,EAAE;MADF,CAzDF;MA4DNqB,MAAM,EAAE;QACJrB,IAAI,EAAE;MADF,CA5DF;MA+DNsB,MAAM,EAAE;QACJtB,IAAI,EAAE;MADF
|
|
1
|
+
{"version":3,"names":["createEntryEntity","params","table","entityName","attributes","Entity","name","PK","type","partitionKey","SK","sortKey","GSI1_PK","GSI1_SK","TYPE","__type","webinyVersion","tenant","entryId","id","createdBy","ownedBy","createdOn","savedOn","modelId","locale","publishedOn","version","locked","status","values","meta"],"sources":["entry.ts"],"sourcesContent":["import { Entity, Table } from \"dynamodb-toolbox\";\nimport { Attributes } from \"~/types\";\n\ninterface Params {\n table: Table;\n entityName: string;\n attributes: Attributes;\n}\nexport const createEntryEntity = (params: Params): Entity<any> => {\n const { table, entityName, attributes } = params;\n return new Entity({\n name: entityName,\n table,\n attributes: {\n PK: {\n type: \"string\",\n partitionKey: true\n },\n SK: {\n type: \"string\",\n sortKey: true\n },\n GSI1_PK: {\n type: \"string\"\n },\n GSI1_SK: {\n type: \"string\"\n },\n TYPE: {\n type: \"string\"\n },\n __type: {\n type: \"string\"\n },\n webinyVersion: {\n type: \"string\"\n },\n tenant: {\n type: \"string\"\n },\n entryId: {\n type: \"string\"\n },\n id: {\n type: \"string\"\n },\n createdBy: {\n type: \"map\"\n },\n ownedBy: {\n type: \"map\"\n },\n createdOn: {\n type: \"string\"\n },\n savedOn: {\n type: \"string\"\n },\n modelId: {\n type: \"string\"\n },\n locale: {\n type: \"string\"\n },\n publishedOn: {\n type: \"string\"\n },\n version: {\n type: \"number\"\n },\n locked: {\n type: \"boolean\"\n },\n status: {\n type: \"string\"\n },\n values: {\n type: \"map\"\n },\n meta: {\n type: \"map\"\n },\n ...(attributes || {})\n }\n });\n};\n"],"mappings":";;;;;;;;;;;AAAA;;;;;;AAQO,MAAMA,iBAAiB,GAAIC,MAAD,IAAiC;EAC9D,MAAM;IAAEC,KAAF;IAASC,UAAT;IAAqBC;EAArB,IAAoCH,MAA1C;EACA,OAAO,IAAII,uBAAJ,CAAW;IACdC,IAAI,EAAEH,UADQ;IAEdD,KAFc;IAGdE,UAAU;MACNG,EAAE,EAAE;QACAC,IAAI,EAAE,QADN;QAEAC,YAAY,EAAE;MAFd,CADE;MAKNC,EAAE,EAAE;QACAF,IAAI,EAAE,QADN;QAEAG,OAAO,EAAE;MAFT,CALE;MASNC,OAAO,EAAE;QACLJ,IAAI,EAAE;MADD,CATH;MAYNK,OAAO,EAAE;QACLL,IAAI,EAAE;MADD,CAZH;MAeNM,IAAI,EAAE;QACFN,IAAI,EAAE;MADJ,CAfA;MAkBNO,MAAM,EAAE;QACJP,IAAI,EAAE;MADF,CAlBF;MAqBNQ,aAAa,EAAE;QACXR,IAAI,EAAE;MADK,CArBT;MAwBNS,MAAM,EAAE;QACJT,IAAI,EAAE;MADF,CAxBF;MA2BNU,OAAO,EAAE;QACLV,IAAI,EAAE;MADD,CA3BH;MA8BNW,EAAE,EAAE;QACAX,IAAI,EAAE;MADN,CA9BE;MAiCNY,SAAS,EAAE;QACPZ,IAAI,EAAE;MADC,CAjCL;MAoCNa,OAAO,EAAE;QACLb,IAAI,EAAE;MADD,CApCH;MAuCNc,SAAS,EAAE;QACPd,IAAI,EAAE;MADC,CAvCL;MA0CNe,OAAO,EAAE;QACLf,IAAI,EAAE;MADD,CA1CH;MA6CNgB,OAAO,EAAE;QACLhB,IAAI,EAAE;MADD,CA7CH;MAgDNiB,MAAM,EAAE;QACJjB,IAAI,EAAE;MADF,CAhDF;MAmDNkB,WAAW,EAAE;QACTlB,IAAI,EAAE;MADG,CAnDP;MAsDNmB,OAAO,EAAE;QACLnB,IAAI,EAAE;MADD,CAtDH;MAyDNoB,MAAM,EAAE;QACJpB,IAAI,EAAE;MADF,CAzDF;MA4DNqB,MAAM,EAAE;QACJrB,IAAI,EAAE;MADF,CA5DF;MA+DNsB,MAAM,EAAE;QACJtB,IAAI,EAAE;MADF,CA/DF;MAkENuB,IAAI,EAAE;QACFvB,IAAI,EAAE;MADJ;IAlEA,GAqEFJ,UAAU,IAAI,EArEZ;EAHI,CAAX,CAAP;AA2EH,CA7EM"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { StorageTransformPlugin } from "@webiny/api-headless-cms
|
|
1
|
+
import { StorageTransformPlugin } from "@webiny/api-headless-cms";
|
|
2
2
|
declare const _default: () => StorageTransformPlugin<any, any>;
|
|
3
3
|
export default _default;
|
package/dynamoDb/storage/date.js
CHANGED
|
@@ -9,10 +9,10 @@ exports.default = void 0;
|
|
|
9
9
|
|
|
10
10
|
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _apiHeadlessCms = require("@webiny/api-headless-cms");
|
|
13
13
|
|
|
14
14
|
const excludeTypes = ["time", "dateTimeWithTimezone"];
|
|
15
|
-
const plugin = new
|
|
15
|
+
const plugin = new _apiHeadlessCms.StorageTransformPlugin({
|
|
16
16
|
fieldType: "datetime",
|
|
17
17
|
fromStorage: async ({
|
|
18
18
|
value,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["excludeTypes","plugin","StorageTransformPlugin","fieldType","fromStorage","value","field","type","settings","includes","Date","console","log","toStorage","toISOString","WebinyError","fieldId"],"sources":["date.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { StorageTransformPlugin } from \"@webiny/api-headless-cms
|
|
1
|
+
{"version":3,"names":["excludeTypes","plugin","StorageTransformPlugin","fieldType","fromStorage","value","field","type","settings","includes","Date","console","log","toStorage","toISOString","WebinyError","fieldId"],"sources":["date.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { StorageTransformPlugin } from \"@webiny/api-headless-cms\";\n\nconst excludeTypes = [\"time\", \"dateTimeWithTimezone\"];\n\nconst plugin = new StorageTransformPlugin({\n fieldType: \"datetime\",\n fromStorage: async ({ value, field }) => {\n const { type } = field.settings || {};\n if (!value || !type || excludeTypes.includes(type)) {\n return value;\n }\n try {\n return new Date(value);\n } catch {\n console.log(`Could not transform from storage for field type`);\n return value;\n }\n },\n toStorage: async ({ value, field }) => {\n const { type } = field.settings || {};\n if (!value || !type || excludeTypes.includes(type)) {\n return value;\n }\n if ((value as any).toISOString) {\n return (value as Date).toISOString();\n } else if (typeof value === \"string\") {\n return value as string;\n }\n throw new WebinyError(\"Error converting value to a storage type.\", \"TO_STORAGE_ERROR\", {\n value,\n fieldId: field.fieldId\n });\n }\n});\n\nexport default () => {\n return plugin;\n};\n"],"mappings":";;;;;;;;;AAAA;;AACA;;AAEA,MAAMA,YAAY,GAAG,CAAC,MAAD,EAAS,sBAAT,CAArB;AAEA,MAAMC,MAAM,GAAG,IAAIC,sCAAJ,CAA2B;EACtCC,SAAS,EAAE,UAD2B;EAEtCC,WAAW,EAAE,OAAO;IAAEC,KAAF;IAASC;EAAT,CAAP,KAA4B;IACrC,MAAM;MAAEC;IAAF,IAAWD,KAAK,CAACE,QAAN,IAAkB,EAAnC;;IACA,IAAI,CAACH,KAAD,IAAU,CAACE,IAAX,IAAmBP,YAAY,CAACS,QAAb,CAAsBF,IAAtB,CAAvB,EAAoD;MAChD,OAAOF,KAAP;IACH;;IACD,IAAI;MACA,OAAO,IAAIK,IAAJ,CAASL,KAAT,CAAP;IACH,CAFD,CAEE,MAAM;MACJM,OAAO,CAACC,GAAR,CAAa,iDAAb;MACA,OAAOP,KAAP;IACH;EACJ,CAbqC;EActCQ,SAAS,EAAE,OAAO;IAAER,KAAF;IAASC;EAAT,CAAP,KAA4B;IACnC,MAAM;MAAEC;IAAF,IAAWD,KAAK,CAACE,QAAN,IAAkB,EAAnC;;IACA,IAAI,CAACH,KAAD,IAAU,CAACE,IAAX,IAAmBP,YAAY,CAACS,QAAb,CAAsBF,IAAtB,CAAvB,EAAoD;MAChD,OAAOF,KAAP;IACH;;IACD,IAAKA,KAAD,CAAeS,WAAnB,EAAgC;MAC5B,OAAQT,KAAD,CAAgBS,WAAhB,EAAP;IACH,CAFD,MAEO,IAAI,OAAOT,KAAP,KAAiB,QAArB,EAA+B;MAClC,OAAOA,KAAP;IACH;;IACD,MAAM,IAAIU,cAAJ,CAAgB,2CAAhB,EAA6D,kBAA7D,EAAiF;MACnFV,KADmF;MAEnFW,OAAO,EAAEV,KAAK,CAACU;IAFoE,CAAjF,CAAN;EAIH;AA5BqC,CAA3B,CAAf;;eA+Be,MAAM;EACjB,OAAOf,MAAP;AACH,C"}
|
|
@@ -11,7 +11,7 @@ var _error = _interopRequireDefault(require("@webiny/error"));
|
|
|
11
11
|
|
|
12
12
|
var _gzip = require("@webiny/utils/compression/gzip");
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _apiHeadlessCms = require("@webiny/api-headless-cms");
|
|
15
15
|
|
|
16
16
|
const GZIP = "gzip";
|
|
17
17
|
const TO_STORAGE_ENCODING = "base64";
|
|
@@ -25,7 +25,7 @@ const convertToBuffer = value => {
|
|
|
25
25
|
return value;
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
-
const plugin = new
|
|
28
|
+
const plugin = new _apiHeadlessCms.StorageTransformPlugin({
|
|
29
29
|
fieldType: "long-text",
|
|
30
30
|
fromStorage: async ({
|
|
31
31
|
field,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["GZIP","TO_STORAGE_ENCODING","FROM_STORAGE_ENCODING","convertToBuffer","value","Buffer","from","plugin","StorageTransformPlugin","fieldType","fromStorage","field","storageValue","typeOf","WebinyError","fieldId","compression","JSON","stringify","buf","ungzip","toString","ex","console","log","message","toStorage","compressedValue","gzip"],"sources":["longText.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { compress as gzip, decompress as ungzip } from \"@webiny/utils/compression/gzip\";\nimport { StorageTransformPlugin } from \"@webiny/api-headless-cms
|
|
1
|
+
{"version":3,"names":["GZIP","TO_STORAGE_ENCODING","FROM_STORAGE_ENCODING","convertToBuffer","value","Buffer","from","plugin","StorageTransformPlugin","fieldType","fromStorage","field","storageValue","typeOf","WebinyError","fieldId","compression","JSON","stringify","buf","ungzip","toString","ex","console","log","message","toStorage","compressedValue","gzip"],"sources":["longText.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { compress as gzip, decompress as ungzip } from \"@webiny/utils/compression/gzip\";\nimport { StorageTransformPlugin } from \"@webiny/api-headless-cms\";\n\nconst GZIP = \"gzip\";\nconst TO_STORAGE_ENCODING = \"base64\";\nconst FROM_STORAGE_ENCODING = \"utf8\";\n\nconst convertToBuffer = (value: string | Buffer): Buffer => {\n if (typeof value === \"string\") {\n return Buffer.from(value, TO_STORAGE_ENCODING);\n }\n return value;\n};\n\nexport interface StorageValue {\n compression: string;\n value: string;\n}\n\nconst plugin = new StorageTransformPlugin<string, StorageValue>({\n fieldType: \"long-text\",\n fromStorage: async ({ field, value: storageValue }) => {\n const typeOf = typeof storageValue;\n if (!storageValue || typeOf === \"string\" || typeOf === \"number\") {\n return storageValue as unknown as string;\n } else if (typeof storageValue !== \"object\") {\n throw new WebinyError(\n `LongText value received in \"fromStorage\" function is not an object in field \"${field.fieldId}\".`\n );\n }\n const { compression, value } = storageValue;\n /**\n * Check if possibly undefined, null, empty...\n */\n if (!compression) {\n throw new WebinyError(\n `Missing compression in \"fromStorage\" function in field \"${\n field.fieldId\n }\": ${JSON.stringify(storageValue)}.`,\n \"MISSING_COMPRESSION\",\n {\n value: storageValue\n }\n );\n } else if (compression !== GZIP) {\n throw new WebinyError(\n `This plugin cannot transform something not compressed with \"GZIP\".`,\n \"WRONG_COMPRESSION\",\n {\n compression\n }\n );\n }\n try {\n const buf = await ungzip(convertToBuffer(value));\n return buf.toString(FROM_STORAGE_ENCODING);\n } catch (ex) {\n console.log(\"Error while transforming long-text.\");\n console.log(ex.message);\n return \"\";\n }\n },\n toStorage: async ({ value }) => {\n const compressedValue = await gzip(value);\n\n return {\n compression: GZIP,\n value: compressedValue.toString(TO_STORAGE_ENCODING)\n };\n }\n});\n\nexport default () => {\n return plugin;\n};\n"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AAEA,MAAMA,IAAI,GAAG,MAAb;AACA,MAAMC,mBAAmB,GAAG,QAA5B;AACA,MAAMC,qBAAqB,GAAG,MAA9B;;AAEA,MAAMC,eAAe,GAAIC,KAAD,IAAoC;EACxD,IAAI,OAAOA,KAAP,KAAiB,QAArB,EAA+B;IAC3B,OAAOC,MAAM,CAACC,IAAP,CAAYF,KAAZ,EAAmBH,mBAAnB,CAAP;EACH;;EACD,OAAOG,KAAP;AACH,CALD;;AAYA,MAAMG,MAAM,GAAG,IAAIC,sCAAJ,CAAiD;EAC5DC,SAAS,EAAE,WADiD;EAE5DC,WAAW,EAAE,OAAO;IAAEC,KAAF;IAASP,KAAK,EAAEQ;EAAhB,CAAP,KAA0C;IACnD,MAAMC,MAAM,GAAG,OAAOD,YAAtB;;IACA,IAAI,CAACA,YAAD,IAAiBC,MAAM,KAAK,QAA5B,IAAwCA,MAAM,KAAK,QAAvD,EAAiE;MAC7D,OAAOD,YAAP;IACH,CAFD,MAEO,IAAI,OAAOA,YAAP,KAAwB,QAA5B,EAAsC;MACzC,MAAM,IAAIE,cAAJ,CACD,gFAA+EH,KAAK,CAACI,OAAQ,IAD5F,CAAN;IAGH;;IACD,MAAM;MAAEC,WAAF;MAAeZ;IAAf,IAAyBQ,YAA/B;IACA;AACR;AACA;;IACQ,IAAI,CAACI,WAAL,EAAkB;MACd,MAAM,IAAIF,cAAJ,CACD,2DACGH,KAAK,CAACI,OACT,MAAKE,IAAI,CAACC,SAAL,CAAeN,YAAf,CAA6B,GAHjC,EAIF,qBAJE,EAKF;QACIR,KAAK,EAAEQ;MADX,CALE,CAAN;IASH,CAVD,MAUO,IAAII,WAAW,KAAKhB,IAApB,EAA0B;MAC7B,MAAM,IAAIc,cAAJ,CACD,oEADC,EAEF,mBAFE,EAGF;QACIE;MADJ,CAHE,CAAN;IAOH;;IACD,IAAI;MACA,MAAMG,GAAG,GAAG,MAAM,IAAAC,gBAAA,EAAOjB,eAAe,CAACC,KAAD,CAAtB,CAAlB;MACA,OAAOe,GAAG,CAACE,QAAJ,CAAanB,qBAAb,CAAP;IACH,CAHD,CAGE,OAAOoB,EAAP,EAAW;MACTC,OAAO,CAACC,GAAR,CAAY,qCAAZ;MACAD,OAAO,CAACC,GAAR,CAAYF,EAAE,CAACG,OAAf;MACA,OAAO,EAAP;IACH;EACJ,CA1C2D;EA2C5DC,SAAS,EAAE,OAAO;IAAEtB;EAAF,CAAP,KAAqB;IAC5B,MAAMuB,eAAe,GAAG,MAAM,IAAAC,cAAA,EAAKxB,KAAL,CAA9B;IAEA,OAAO;MACHY,WAAW,EAAEhB,IADV;MAEHI,KAAK,EAAEuB,eAAe,CAACN,QAAhB,CAAyBpB,mBAAzB;IAFJ,CAAP;EAIH;AAlD2D,CAAjD,CAAf;;eAqDe,MAAM;EACjB,OAAOM,MAAP;AACH,C"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { StorageTransformPlugin } from "@webiny/api-headless-cms
|
|
1
|
+
import { StorageTransformPlugin } from "@webiny/api-headless-cms";
|
|
2
2
|
declare const _default: () => StorageTransformPlugin<any, any>;
|
|
3
3
|
export default _default;
|
|
@@ -11,7 +11,7 @@ var _jsonpack = _interopRequireDefault(require("jsonpack"));
|
|
|
11
11
|
|
|
12
12
|
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _apiHeadlessCms = require("@webiny/api-headless-cms");
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* Remove when jsonpack gets PR with a fix merged
|
|
@@ -41,7 +41,7 @@ const transformArray = value => {
|
|
|
41
41
|
return value;
|
|
42
42
|
};
|
|
43
43
|
|
|
44
|
-
const plugin = new
|
|
44
|
+
const plugin = new _apiHeadlessCms.StorageTransformPlugin({
|
|
45
45
|
fieldType: "rich-text",
|
|
46
46
|
fromStorage: async ({
|
|
47
47
|
field,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["transformArray","value","isArray","Array","shouldBeArray","from","k","plugin","StorageTransformPlugin","fieldType","fromStorage","field","storageValue","WebinyError","fieldId","hasOwnProperty","compression","JSON","stringify","jsonpack","unpack","toStorage","pack"],"sources":["richText.ts"],"sourcesContent":["import jsonpack from \"jsonpack\";\nimport WebinyError from \"@webiny/error\";\nimport { StorageTransformPlugin } from \"@webiny/api-headless-cms
|
|
1
|
+
{"version":3,"names":["transformArray","value","isArray","Array","shouldBeArray","from","k","plugin","StorageTransformPlugin","fieldType","fromStorage","field","storageValue","WebinyError","fieldId","hasOwnProperty","compression","JSON","stringify","jsonpack","unpack","toStorage","pack"],"sources":["richText.ts"],"sourcesContent":["import jsonpack from \"jsonpack\";\nimport WebinyError from \"@webiny/error\";\nimport { StorageTransformPlugin } from \"@webiny/api-headless-cms\";\n\n/**\n * Remove when jsonpack gets PR with a fix merged\n * https://github.com/rgcl/jsonpack/pull/25/files\n * NOTE 2021-07-28: it seems PR is not going to be merged so keep this.\n */\n// TODO @ts-refactor figure better type\nconst transformArray = (value: any) => {\n if (!value) {\n return value;\n }\n let isArray = Array.isArray(value);\n const shouldBeArray = value instanceof Array === false && isArray;\n if (shouldBeArray) {\n value = Array.from(value as any);\n isArray = true;\n }\n if (typeof value === \"object\" || isArray) {\n for (const k in value) {\n value[k] = transformArray(value[k]);\n }\n }\n return value;\n};\n\nconst plugin = new StorageTransformPlugin({\n fieldType: \"rich-text\",\n fromStorage: async ({ field, value: storageValue }) => {\n if (!storageValue) {\n return storageValue;\n } else if (typeof storageValue !== \"object\") {\n throw new WebinyError(\n `RichText value received in \"fromStorage\" function is not an object in field \"${field.fieldId}\".`\n );\n }\n /**\n * This is to circumvent a bug introduced with 5.8.0 storage operations.\n * Do not remove.\n */\n if (storageValue.hasOwnProperty(\"compression\") === false) {\n return storageValue;\n }\n const { compression, value } = storageValue;\n if (!compression) {\n throw new WebinyError(\n `Missing compression in \"fromStorage\" function in field \"${\n field.fieldId\n }\": ${JSON.stringify(storageValue)}.`,\n \"MISSING_COMPRESSION\",\n {\n value: storageValue\n }\n );\n }\n if (compression !== \"jsonpack\") {\n throw new WebinyError(\n `This plugin cannot transform something not packed with \"jsonpack\".`,\n \"WRONG_COMPRESSION\",\n {\n compression\n }\n );\n }\n try {\n return jsonpack.unpack(value);\n } catch {\n return null;\n }\n },\n toStorage: async ({ value }) => {\n /**\n * There is a possibility that we are trying to compress already compressed value.\n * Introduced a bug with 5.8.0 storage operations, so just return the value to correct it.\n */\n if (value && value.hasOwnProperty(\"compression\") === true) {\n return value as any;\n }\n value = transformArray(value);\n return {\n compression: \"jsonpack\",\n value: value ? jsonpack.pack(value) : value\n };\n }\n});\n\nexport default () => {\n return plugin;\n};\n"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,cAAc,GAAIC,KAAD,IAAgB;EACnC,IAAI,CAACA,KAAL,EAAY;IACR,OAAOA,KAAP;EACH;;EACD,IAAIC,OAAO,GAAGC,KAAK,CAACD,OAAN,CAAcD,KAAd,CAAd;EACA,MAAMG,aAAa,GAAGH,KAAK,YAAYE,KAAjB,KAA2B,KAA3B,IAAoCD,OAA1D;;EACA,IAAIE,aAAJ,EAAmB;IACfH,KAAK,GAAGE,KAAK,CAACE,IAAN,CAAWJ,KAAX,CAAR;IACAC,OAAO,GAAG,IAAV;EACH;;EACD,IAAI,OAAOD,KAAP,KAAiB,QAAjB,IAA6BC,OAAjC,EAA0C;IACtC,KAAK,MAAMI,CAAX,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B,aAArB,MAAwC,IAArD,EAA2D;MACvD,OAAOd,KAAP;IACH;;IACDA,KAAK,GAAGD,cAAc,CAACC,KAAD,CAAtB;IACA,OAAO;MACHe,WAAW,EAAE,UADV;MAEHf,KAAK,EAAEA,KAAK,GAAGkB,iBAAA,CAASG,IAAT,CAAcrB,KAAd,CAAH,GAA0BA;IAFnC,CAAP;EAIH;AAzDqC,CAA3B,CAAf;;eA4De,MAAM;EACjB,OAAOM,MAAP;AACH,C"}
|
package/index.js
CHANGED
|
@@ -42,8 +42,7 @@ const createStorageOperations = params => {
|
|
|
42
42
|
attributes,
|
|
43
43
|
table,
|
|
44
44
|
documentClient,
|
|
45
|
-
plugins: userPlugins
|
|
46
|
-
modelFieldToGraphQLPlugins
|
|
45
|
+
plugins: userPlugins
|
|
47
46
|
} = params;
|
|
48
47
|
const tableInstance = (0, _table.createTable)({
|
|
49
48
|
table,
|
|
@@ -81,10 +80,6 @@ const createStorageOperations = params => {
|
|
|
81
80
|
* User defined custom plugins.
|
|
82
81
|
*/
|
|
83
82
|
...(userPlugins || []),
|
|
84
|
-
/**
|
|
85
|
-
* Plugins of type CmsModelFieldToGraphQLPlugin.
|
|
86
|
-
*/
|
|
87
|
-
modelFieldToGraphQLPlugins,
|
|
88
83
|
/**
|
|
89
84
|
* DynamoDB filter plugins for the where conditions.
|
|
90
85
|
*/
|
|
@@ -95,12 +90,16 @@ const createStorageOperations = params => {
|
|
|
95
90
|
(0, _dynamoDb.default)()]);
|
|
96
91
|
return {
|
|
97
92
|
beforeInit: async context => {
|
|
98
|
-
context.plugins.register([
|
|
99
93
|
/**
|
|
100
|
-
*
|
|
101
|
-
* We must pass them to the base application.
|
|
94
|
+
* Collect all required plugins from parent context.
|
|
102
95
|
*/
|
|
103
|
-
|
|
96
|
+
const fieldPlugins = context.plugins.byType("cms-model-field-to-graphql");
|
|
97
|
+
plugins.register(fieldPlugins);
|
|
98
|
+
/**
|
|
99
|
+
* Pass the plugins to the parent context.
|
|
100
|
+
*/
|
|
101
|
+
|
|
102
|
+
context.plugins.register([(0, _dynamoDb.default)()]);
|
|
104
103
|
},
|
|
105
104
|
getEntities: () => entities,
|
|
106
105
|
getTable: () => tableInstance,
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createStorageOperations","params","attributes","table","documentClient","plugins","userPlugins","
|
|
1
|
+
{"version":3,"names":["createStorageOperations","params","attributes","table","documentClient","plugins","userPlugins","tableInstance","createTable","entities","settings","createSettingsEntity","entityName","ENTITIES","SETTINGS","system","createSystemEntity","SYSTEM","groups","createGroupEntity","GROUPS","models","createModelEntity","MODELS","entries","createEntryEntity","ENTRIES","PluginsContainer","dynamoDbValueFilters","dynamoDbPlugins","beforeInit","context","fieldPlugins","byType","register","getEntities","getTable","createSystemStorageOperations","entity","createSettingsStorageOperations","createGroupsStorageOperations","createModelsStorageOperations","createEntriesStorageOperations"],"sources":["index.ts"],"sourcesContent":["import dynamoDbValueFilters from \"@webiny/db-dynamodb/plugins/filters\";\nimport dynamoDbPlugins from \"./dynamoDb\";\nimport { ENTITIES, StorageOperationsFactory } from \"~/types\";\nimport { createTable } from \"~/definitions/table\";\nimport { createSettingsEntity } from \"~/definitions/settings\";\nimport { createSystemEntity } from \"~/definitions/system\";\nimport { createGroupEntity } from \"~/definitions/group\";\nimport { createModelEntity } from \"~/definitions/model\";\nimport { createEntryEntity } from \"~/definitions/entry\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport { createSystemStorageOperations } from \"~/operations/system\";\nimport { createSettingsStorageOperations } from \"~/operations/settings\";\nimport { createGroupsStorageOperations } from \"~/operations/group\";\nimport { createModelsStorageOperations } from \"~/operations/model\";\nimport { createEntriesStorageOperations } from \"./operations/entry\";\nimport { CmsModelFieldToGraphQLPlugin } from \"@webiny/api-headless-cms/types\";\n\nexport const createStorageOperations: StorageOperationsFactory = params => {\n const { attributes, table, documentClient, plugins: userPlugins } = params;\n\n const tableInstance = createTable({\n table,\n documentClient\n });\n\n const entities = {\n settings: createSettingsEntity({\n entityName: ENTITIES.SETTINGS,\n table: tableInstance,\n attributes: attributes ? attributes[ENTITIES.SETTINGS] : {}\n }),\n system: createSystemEntity({\n entityName: ENTITIES.SYSTEM,\n table: tableInstance,\n attributes: attributes ? attributes[ENTITIES.SYSTEM] : {}\n }),\n groups: createGroupEntity({\n entityName: ENTITIES.GROUPS,\n table: tableInstance,\n attributes: attributes ? attributes[ENTITIES.GROUPS] : {}\n }),\n models: createModelEntity({\n entityName: ENTITIES.MODELS,\n table: tableInstance,\n attributes: attributes ? attributes[ENTITIES.MODELS] : {}\n }),\n entries: createEntryEntity({\n entityName: ENTITIES.ENTRIES,\n table: tableInstance,\n attributes: attributes ? attributes[ENTITIES.ENTRIES] : {}\n })\n };\n\n const plugins = new PluginsContainer([\n /**\n * User defined custom plugins.\n */\n ...(userPlugins || []),\n /**\n * DynamoDB filter plugins for the where conditions.\n */\n dynamoDbValueFilters(),\n /**\n * Field plugins for DynamoDB.\n */\n dynamoDbPlugins()\n ]);\n\n return {\n beforeInit: async context => {\n /**\n * Collect all required plugins from parent context.\n */\n const fieldPlugins = context.plugins.byType<CmsModelFieldToGraphQLPlugin>(\n \"cms-model-field-to-graphql\"\n );\n plugins.register(fieldPlugins);\n\n /**\n * Pass the plugins to the parent context.\n */\n context.plugins.register([dynamoDbPlugins()]);\n },\n getEntities: () => entities,\n getTable: () => tableInstance,\n system: createSystemStorageOperations({\n entity: entities.system\n }),\n settings: createSettingsStorageOperations({\n entity: entities.settings\n }),\n groups: createGroupsStorageOperations({\n entity: entities.groups,\n plugins\n }),\n models: createModelsStorageOperations({\n entity: entities.models\n }),\n entries: createEntriesStorageOperations({\n entity: entities.entries,\n plugins\n })\n };\n};\n"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAGO,MAAMA,uBAAiD,GAAGC,MAAM,IAAI;EACv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orageOperations","params","entity","plugins","dataLoaders","DataLoadersHandler","storageTransformPlugins","byType","StorageTransformPlugin","type","reduce","collection","plugin","fieldType","createStorageTransformCallable","model","field","value","fromStorage","getStoragePlugin","create","args","entry","storageEntry","partitionKey","createPartitionKey","id","locale","tenant","isPublished","status","locked","items","putBatch","PK","SK","createRevisionSortKey","TYPE","GSI1_PK","createGSIPartitionKey","GSI1_SK","createGSISortKey","createLatestSortKey","push","createPublishedSortKey","batchWriteAll","table","clearAll","ex","WebinyError","message","code","error","createRevisionFrom","update","latestStorageEntry","getLatestRevisionByEntryId","deleteEntry","queryAllParams","options","gte","records","queryAll","map","item","deleteBatch","deleteRevision","latestEntry","publishedStorageEntry","getPublishedRevisionByEntryId","result","ids","shift","getRevisionById","getRevisions","getAllEntryRevisions","getByIds","getLatestByIds","getPublishedByIds","getPreviousRevision","entryId","version","queryParams","lt","zeroPad","filters","attr","eq","reverse","queryOne","cleanupItem","list","limit","initialLimit","where","initialWhere","after","sort","fields","search","published","index","length","hasMoreItems","totalCount","cursor","modelFields","buildModelFields","filteredItems","filterItems","fullTextSearch","term","sortedItems","sortEntryItems","start","parseInt","decodeCursor","end","undefined","slicedItems","slice","encodeCursor","cleanupItems","get","requestChanges","requestReview","publish","CONTENT_ENTRY_STATUS","UNPUBLISHED","unpublish","delete"],"sources":["index.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { DataLoadersHandler } from \"./dataLoaders\";\nimport {\n CmsEntry,\n CmsEntryListWhere,\n CmsEntryStorageOperations,\n CmsEntryStorageOperationsCreateParams,\n CmsEntryStorageOperationsCreateRevisionFromParams,\n CmsEntryStorageOperationsDeleteParams,\n CmsEntryStorageOperationsDeleteRevisionParams,\n CmsEntryStorageOperationsGetByIdsParams,\n CmsEntryStorageOperationsGetLatestByIdsParams,\n CmsEntryStorageOperationsGetLatestRevisionParams,\n CmsEntryStorageOperationsGetParams,\n CmsEntryStorageOperationsGetPreviousRevisionParams,\n CmsEntryStorageOperationsGetPublishedByIdsParams,\n CmsEntryStorageOperationsGetRevisionParams,\n CmsEntryStorageOperationsGetRevisionsParams,\n CmsEntryStorageOperationsListParams,\n CmsEntryStorageOperationsPublishParams,\n CmsEntryStorageOperationsRequestChangesParams,\n CmsEntryStorageOperationsRequestReviewParams,\n CmsEntryStorageOperationsUnpublishParams,\n CmsEntryStorageOperationsUpdateParams,\n CmsModel,\n CONTENT_ENTRY_STATUS\n} from \"@webiny/api-headless-cms/types\";\nimport { Entity } from \"dynamodb-toolbox\";\nimport { filterItems, buildModelFields, sortEntryItems, FilterItemFromStorage } from \"./utils\";\nimport {\n createGSIPartitionKey,\n createGSISortKey,\n createLatestSortKey,\n createPartitionKey,\n createPublishedSortKey,\n createRevisionSortKey\n} from \"~/operations/entry/keys\";\nimport { batchWriteAll } from \"@webiny/db-dynamodb/utils/batchWrite\";\nimport {\n queryAll,\n QueryAllParams,\n queryOne,\n QueryOneParams\n} from \"@webiny/db-dynamodb/utils/query\";\nimport { cleanupItem, cleanupItems } from \"@webiny/db-dynamodb/utils/cleanup\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport { decodeCursor, encodeCursor } from \"@webiny/utils/cursor\";\nimport { zeroPad } from \"@webiny/utils/zeroPad\";\nimport { StorageTransformPlugin } from \"@webiny/api-headless-cms\";\n\nconst createType = (): string => {\n return \"cms.entry\";\n};\nconst createLatestType = (): string => {\n return `${createType()}.l`;\n};\nconst createPublishedType = (): string => {\n return `${createType()}.p`;\n};\n\nexport interface CreateEntriesStorageOperationsParams {\n entity: Entity<any>;\n plugins: PluginsContainer;\n}\nexport const createEntriesStorageOperations = (\n params: CreateEntriesStorageOperationsParams\n): CmsEntryStorageOperations => {\n const { entity, plugins } = params;\n\n const dataLoaders = new DataLoadersHandler({\n entity\n });\n\n const storageTransformPlugins = plugins\n .byType<StorageTransformPlugin>(StorageTransformPlugin.type)\n .reduce((collection, plugin) => {\n collection[plugin.fieldType] = plugin;\n return collection;\n }, {} as Record<string, StorageTransformPlugin>);\n\n const createStorageTransformCallable = (model: CmsModel): FilterItemFromStorage => {\n return (field, value) => {\n const plugin: StorageTransformPlugin = storageTransformPlugins[field.type];\n if (!plugin) {\n return value;\n }\n return plugin.fromStorage({\n model,\n field,\n value,\n getStoragePlugin(fieldType: string): StorageTransformPlugin {\n return storageTransformPlugins[fieldType] || storageTransformPlugins[\"*\"];\n },\n plugins\n });\n };\n };\n\n const create = async (model: CmsModel, args: CmsEntryStorageOperationsCreateParams) => {\n const { entry, storageEntry } = args;\n\n const partitionKey = createPartitionKey({\n id: entry.id,\n locale: model.locale,\n tenant: model.tenant\n });\n\n const isPublished = entry.status === \"published\";\n\n const locked = isPublished ? true : entry.locked;\n /**\n * We need to:\n * - create new main entry item\n * - create new or update latest entry item\n */\n const items = [\n entity.putBatch({\n ...storageEntry,\n locked,\n PK: partitionKey,\n SK: createRevisionSortKey(entry),\n TYPE: createType(),\n GSI1_PK: createGSIPartitionKey(model, \"A\"),\n GSI1_SK: createGSISortKey(storageEntry)\n }),\n entity.putBatch({\n ...storageEntry,\n locked,\n PK: partitionKey,\n SK: createLatestSortKey(),\n TYPE: createLatestType(),\n GSI1_PK: createGSIPartitionKey(model, \"L\"),\n GSI1_SK: createGSISortKey(storageEntry)\n })\n ];\n\n /**\n * We need to create published entry if\n */\n if (isPublished) {\n items.push(\n entity.putBatch({\n ...storageEntry,\n locked,\n PK: partitionKey,\n SK: createPublishedSortKey(),\n TYPE: createLatestType(),\n GSI1_PK: createGSIPartitionKey(model, \"P\"),\n GSI1_SK: createGSISortKey(storageEntry)\n })\n );\n }\n\n try {\n await batchWriteAll({\n table: entity.table,\n items\n });\n dataLoaders.clearAll({\n model\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not insert data into the DynamoDB.\",\n ex.code || \"CREATE_ENTRY_ERROR\",\n {\n error: ex,\n entry\n }\n );\n }\n\n return storageEntry;\n };\n\n const createRevisionFrom = async (\n model: CmsModel,\n params: CmsEntryStorageOperationsCreateRevisionFromParams\n ) => {\n const { entry, storageEntry } = params;\n\n const partitionKey = createPartitionKey({\n id: entry.id,\n locale: model.locale,\n tenant: model.tenant\n });\n /**\n * We need to:\n * - create the main entry item\n * - update the last entry item to a current one\n */\n const items = [\n entity.putBatch({\n ...storageEntry,\n PK: partitionKey,\n SK: createRevisionSortKey(storageEntry),\n TYPE: createType(),\n GSI1_PK: createGSIPartitionKey(model, \"A\"),\n GSI1_SK: createGSISortKey(storageEntry)\n }),\n entity.putBatch({\n ...storageEntry,\n PK: partitionKey,\n SK: createLatestSortKey(),\n TYPE: createLatestType(),\n GSI1_PK: createGSIPartitionKey(model, \"L\"),\n GSI1_SK: createGSISortKey(storageEntry)\n })\n ];\n try {\n await batchWriteAll({\n table: entity.table,\n items\n });\n dataLoaders.clearAll({\n model\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not create revision from given entry.\",\n ex.code || \"CREATE_REVISION_ERROR\",\n {\n error: ex,\n entry,\n storageEntry\n }\n );\n }\n /**\n * There are no modifications on the entry created so just return the data.\n */\n return storageEntry;\n };\n\n const update = async (model: CmsModel, params: CmsEntryStorageOperationsUpdateParams) => {\n const { entry, storageEntry } = params;\n const partitionKey = createPartitionKey({\n id: entry.id,\n locale: model.locale,\n tenant: model.tenant\n });\n\n const isPublished = entry.status === \"published\";\n const locked = isPublished ? true : entry.locked;\n\n const items = [];\n /**\n * We need to:\n * - update the current entry\n * - update the latest entry if the current entry is the latest one\n */\n items.push(\n entity.putBatch({\n ...storageEntry,\n locked,\n PK: partitionKey,\n SK: createRevisionSortKey(storageEntry),\n TYPE: createType(),\n GSI1_PK: createGSIPartitionKey(model, \"A\"),\n GSI1_SK: createGSISortKey(storageEntry)\n })\n );\n\n if (isPublished) {\n items.push(\n entity.putBatch({\n ...storageEntry,\n locked,\n PK: partitionKey,\n SK: createPublishedSortKey(),\n TYPE: createPublishedType(),\n GSI1_PK: createGSIPartitionKey(model, \"P\"),\n GSI1_SK: createGSISortKey(storageEntry)\n })\n );\n }\n\n /**\n * We need the latest entry to update it as well if neccessary.\n */\n const latestStorageEntry = await getLatestRevisionByEntryId(model, entry);\n\n if (latestStorageEntry && latestStorageEntry.id === entry.id) {\n items.push(\n entity.putBatch({\n ...storageEntry,\n locked,\n PK: partitionKey,\n SK: createLatestSortKey(),\n TYPE: createLatestType(),\n GSI1_PK: createGSIPartitionKey(model, \"L\"),\n GSI1_SK: createGSISortKey(entry)\n })\n );\n }\n\n try {\n await batchWriteAll({\n table: entity.table,\n items\n });\n dataLoaders.clearAll({\n model\n });\n return storageEntry;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not update entry.\",\n ex.code || \"UPDATE_ERROR\",\n {\n error: ex,\n entry,\n latestStorageEntry\n }\n );\n }\n };\n\n const deleteEntry = async (model: CmsModel, params: CmsEntryStorageOperationsDeleteParams) => {\n const { entry } = params;\n\n const queryAllParams: QueryAllParams = {\n entity,\n partitionKey: createPartitionKey({\n id: entry.id,\n locale: model.locale,\n tenant: model.tenant\n }),\n options: {\n gte: \" \"\n }\n };\n\n let records = [];\n try {\n records = await queryAll(queryAllParams);\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not load all records.\",\n ex.code || \"LOAD_ALL_RECORDS_ERROR\",\n {\n error: ex,\n entry\n }\n );\n }\n const items = records.map(item => {\n return entity.deleteBatch({\n PK: item.PK,\n SK: item.SK\n });\n });\n\n try {\n await batchWriteAll({\n table: entity.table,\n items\n });\n dataLoaders.clearAll({\n model\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not delete the entry.\",\n ex.code || \"DELETE_ENTRY_ERROR\",\n {\n error: ex,\n partitionKey: queryAllParams.partitionKey,\n entry\n }\n );\n }\n };\n\n const deleteRevision = async (\n model: CmsModel,\n params: CmsEntryStorageOperationsDeleteRevisionParams\n ) => {\n const { entry, latestEntry, latestStorageEntry } = params;\n const partitionKey = createPartitionKey({\n id: entry.id,\n locale: model.locale,\n tenant: model.tenant\n });\n\n const items = [\n entity.deleteBatch({\n PK: partitionKey,\n SK: createRevisionSortKey(entry)\n })\n ];\n\n const publishedStorageEntry = await getPublishedRevisionByEntryId(model, entry);\n\n /**\n * If revision we are deleting is the published one as well, we need to delete those records as well.\n */\n if (publishedStorageEntry && entry.id === publishedStorageEntry.id) {\n items.push(\n entity.deleteBatch({\n PK: partitionKey,\n SK: createPublishedSortKey()\n })\n );\n }\n if (latestStorageEntry) {\n items.push(\n entity.putBatch({\n ...latestStorageEntry,\n PK: partitionKey,\n SK: createLatestSortKey(),\n TYPE: createLatestType(),\n GSI1_PK: createGSIPartitionKey(model, \"L\"),\n GSI1_SK: createGSISortKey(latestStorageEntry)\n })\n );\n }\n try {\n await batchWriteAll({\n table: entity.table,\n items\n });\n dataLoaders.clearAll({\n model\n });\n } catch (ex) {\n throw new WebinyError(ex.message, ex.code, {\n error: ex,\n entry,\n latestEntry\n });\n }\n };\n\n const getLatestRevisionByEntryId = async (\n model: CmsModel,\n params: CmsEntryStorageOperationsGetLatestRevisionParams\n ) => {\n const result = await dataLoaders.getLatestRevisionByEntryId({\n model,\n ids: [params.id]\n });\n return result.shift() || null;\n };\n const getPublishedRevisionByEntryId = async (\n model: CmsModel,\n params: CmsEntryStorageOperationsGetLatestRevisionParams\n ) => {\n const result = await dataLoaders.getPublishedRevisionByEntryId({\n model,\n ids: [params.id]\n });\n return result.shift() || null;\n };\n\n const getRevisionById = async (\n model: CmsModel,\n params: CmsEntryStorageOperationsGetRevisionParams\n ) => {\n const result = await dataLoaders.getRevisionById({\n model,\n ids: [params.id]\n });\n return result.shift() || null;\n };\n\n const getRevisions = async (\n model: CmsModel,\n params: CmsEntryStorageOperationsGetRevisionsParams\n ) => {\n return await dataLoaders.getAllEntryRevisions({\n model,\n ids: [params.id]\n });\n };\n\n const getByIds = async (model: CmsModel, params: CmsEntryStorageOperationsGetByIdsParams) => {\n return dataLoaders.getRevisionById({\n model,\n ids: params.ids\n });\n };\n\n const getLatestByIds = async (\n model: CmsModel,\n params: CmsEntryStorageOperationsGetLatestByIdsParams\n ) => {\n return dataLoaders.getLatestRevisionByEntryId({\n model,\n ids: params.ids\n });\n };\n\n const getPublishedByIds = async (\n model: CmsModel,\n params: CmsEntryStorageOperationsGetPublishedByIdsParams\n ) => {\n return dataLoaders.getPublishedRevisionByEntryId({\n model,\n ids: params.ids\n });\n };\n\n const getPreviousRevision = async (\n model: CmsModel,\n params: CmsEntryStorageOperationsGetPreviousRevisionParams\n ) => {\n const { entryId, version } = params;\n const queryParams: QueryOneParams = {\n entity,\n partitionKey: createPartitionKey({\n tenant: model.tenant,\n locale: model.locale,\n id: entryId\n }),\n options: {\n lt: `REV#${zeroPad(version)}`,\n /**\n * We need to have extra checks because DynamoDB will return published or latest record if there is no REV# record.\n */\n filters: [\n {\n attr: \"TYPE\",\n eq: createType()\n },\n {\n attr: \"version\",\n lt: version\n }\n ],\n reverse: true\n }\n };\n\n try {\n const result = await queryOne<CmsEntry>(queryParams);\n\n return cleanupItem(entity, result);\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not get previous version of given entry.\",\n ex.code || \"GET_PREVIOUS_VERSION_ERROR\",\n {\n ...params,\n error: ex,\n partitionKey: queryParams.partitionKey,\n options: queryParams.options,\n model\n }\n );\n }\n };\n\n const list = async (model: CmsModel, params: CmsEntryStorageOperationsListParams) => {\n const {\n limit: initialLimit = 10,\n where: initialWhere,\n after,\n sort,\n fields,\n search\n } = params;\n const limit = initialLimit <= 0 || initialLimit >= 10000 ? 10000 : initialLimit;\n\n const type = initialWhere.published ? \"P\" : \"L\";\n\n const queryAllParams: QueryAllParams = {\n entity,\n partitionKey: createGSIPartitionKey(model, type),\n options: {\n index: \"GSI1\",\n gte: \" \"\n }\n };\n let records = [];\n try {\n records = await queryAll(queryAllParams);\n } catch (ex) {\n throw new WebinyError(ex.message, \"QUERY_ENTRIES_ERROR\", {\n error: ex,\n partitionKey: queryAllParams.partitionKey,\n options: queryAllParams.options\n });\n }\n if (records.length === 0) {\n return {\n hasMoreItems: false,\n totalCount: 0,\n cursor: null,\n items: []\n };\n }\n const where: Partial<CmsEntryListWhere> = {\n ...initialWhere\n };\n delete where[\"published\"];\n delete where[\"latest\"];\n /**\n * We need a object containing field, transformers and paths.\n * Just build it here and pass on into other methods that require it to avoid mapping multiple times.\n */\n const modelFields = buildModelFields({\n plugins,\n model\n });\n /**\n * Filter the read items via the code.\n * It will build the filters out of the where input and transform the values it is using.\n */\n const filteredItems = await filterItems({\n items: records,\n where,\n plugins,\n fields: modelFields,\n fromStorage: createStorageTransformCallable(model),\n fullTextSearch: {\n term: search,\n fields: fields || []\n }\n });\n\n const totalCount = filteredItems.length;\n /**\n * Sorting is also done via the code.\n * It takes the sort input and sorts by it via the lodash sortBy method.\n */\n const sortedItems = sortEntryItems({\n items: filteredItems,\n sort,\n fields: modelFields\n });\n\n const start = parseInt(decodeCursor(after) || \"0\") || 0;\n const hasMoreItems = totalCount > start + limit;\n const end = limit > totalCount + start + limit ? undefined : start + limit;\n const slicedItems = sortedItems.slice(start, end);\n /**\n * Although we do not need a cursor here, we will use it as such to keep it standardized.\n * Number is simply encoded.\n */\n const cursor = totalCount > start + limit ? encodeCursor(`${start + limit}`) : null;\n return {\n hasMoreItems,\n totalCount,\n cursor,\n items: cleanupItems(entity, slicedItems)\n };\n };\n\n const get = async (model: CmsModel, params: CmsEntryStorageOperationsGetParams) => {\n const { items } = await list(model, {\n ...params,\n limit: 1\n });\n return items.shift() || null;\n };\n\n const requestChanges = async (\n model: CmsModel,\n params: CmsEntryStorageOperationsRequestChangesParams\n ) => {\n const { entry, storageEntry } = params;\n\n const partitionKey = createPartitionKey({\n id: entry.id,\n locale: model.locale,\n tenant: model.tenant\n });\n\n /**\n * We need to:\n * - update the existing entry\n * - update latest version - if existing entry is the latest version\n */\n const items = [\n entity.putBatch({\n ...storageEntry,\n TYPE: createType(),\n PK: partitionKey,\n SK: createRevisionSortKey(entry),\n GSI1_PK: createGSIPartitionKey(model, \"A\"),\n GSI1_SK: createGSISortKey(entry)\n })\n ];\n\n /**\n * We need the latest entry to see if something needs to be updated along side the request changes one.\n */\n const latestStorageEntry = await getLatestRevisionByEntryId(model, entry);\n\n if (latestStorageEntry && latestStorageEntry.id === entry.id) {\n items.push(\n entity.putBatch({\n ...storageEntry,\n PK: partitionKey,\n SK: createLatestSortKey(),\n TYPE: createLatestType(),\n GSI1_PK: createGSIPartitionKey(model, \"L\"),\n GSI1_SK: createGSISortKey(entry)\n })\n );\n }\n\n try {\n await batchWriteAll({\n table: entity.table,\n items\n });\n dataLoaders.clearAll({\n model\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not execute the request changes batch.\",\n ex.code || \"REQUEST_CHANGES_ERROR\",\n {\n entry\n }\n );\n }\n return entry;\n };\n\n const requestReview = async (\n model: CmsModel,\n params: CmsEntryStorageOperationsRequestReviewParams\n ) => {\n const { entry, storageEntry } = params;\n\n const partitionKey = createPartitionKey({\n id: entry.id,\n locale: model.locale,\n tenant: model.tenant\n });\n /**\n * We need to:\n * - update existing entry\n * - update latest entry - if existing entry is the latest entry\n */\n const items = [\n entity.putBatch({\n ...storageEntry,\n TYPE: createType(),\n PK: partitionKey,\n SK: createRevisionSortKey(entry),\n GSI1_PK: createGSIPartitionKey(model, \"A\"),\n GSI1_SK: createGSISortKey(entry)\n })\n ];\n\n /**\n * We need the latest entry to see if something needs to be updated along side the request review one.\n */\n const latestStorageEntry = await getLatestRevisionByEntryId(model, entry);\n\n if (latestStorageEntry && latestStorageEntry.id === entry.id) {\n items.push(\n entity.putBatch({\n ...storageEntry,\n PK: partitionKey,\n SK: createLatestSortKey(),\n TYPE: createLatestType(),\n GSI1_PK: createGSIPartitionKey(model, \"L\"),\n GSI1_SK: createGSISortKey(entry)\n })\n );\n }\n\n try {\n await batchWriteAll({\n table: entity.table,\n items\n });\n dataLoaders.clearAll({\n model\n });\n return entry;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not execute request review batch.\",\n ex.code || \"REQUEST_REVIEW_ERROR\",\n {\n entry,\n storageEntry\n }\n );\n }\n };\n\n const publish = async (model: CmsModel, params: CmsEntryStorageOperationsPublishParams) => {\n const { entry, storageEntry } = params;\n\n const partitionKey = createPartitionKey({\n id: entry.id,\n locale: model.locale,\n tenant: model.tenant\n });\n\n /**\n * We need the latest and published entries to see if something needs to be updated along side the publishing one.\n */\n const latestStorageEntry = await getLatestRevisionByEntryId(model, entry);\n const publishedStorageEntry = await getPublishedRevisionByEntryId(model, entry);\n /**\n * We need to update:\n * - current entry revision sort key\n * - published sort key\n * - latest sort key - if entry updated is actually latest\n * - previous published entry to unpublished status - if any previously published entry\n */\n const items = [\n entity.putBatch({\n ...storageEntry,\n PK: partitionKey,\n SK: createRevisionSortKey(entry),\n TYPE: createType(),\n GSI1_PK: createGSIPartitionKey(model, \"A\"),\n GSI1_SK: createGSISortKey(entry)\n }),\n entity.putBatch({\n ...storageEntry,\n PK: partitionKey,\n SK: createPublishedSortKey(),\n TYPE: createPublishedType(),\n GSI1_PK: createGSIPartitionKey(model, \"P\"),\n GSI1_SK: createGSISortKey(entry)\n })\n ];\n if (latestStorageEntry && entry.id === latestStorageEntry.id) {\n items.push(\n entity.putBatch({\n ...storageEntry,\n PK: partitionKey,\n SK: createLatestSortKey(),\n TYPE: createLatestType(),\n GSI1_PK: createGSIPartitionKey(model, \"L\"),\n GSI1_SK: createGSISortKey(entry)\n })\n );\n }\n if (publishedStorageEntry && publishedStorageEntry.id !== entry.id) {\n items.push(\n entity.putBatch({\n ...publishedStorageEntry,\n PK: partitionKey,\n SK: createRevisionSortKey(publishedStorageEntry),\n TYPE: createType(),\n status: CONTENT_ENTRY_STATUS.UNPUBLISHED,\n GSI1_PK: createGSIPartitionKey(model, \"A\"),\n GSI1_SK: createGSISortKey(publishedStorageEntry)\n })\n );\n }\n\n try {\n await batchWriteAll({\n table: entity.table,\n items\n });\n dataLoaders.clearAll({\n model\n });\n return entry;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not execute the publishing batch.\",\n ex.code || \"PUBLISH_ERROR\",\n {\n entry,\n latestStorageEntry,\n publishedStorageEntry\n }\n );\n }\n };\n\n const unpublish = async (model: CmsModel, params: CmsEntryStorageOperationsUnpublishParams) => {\n const { entry, storageEntry } = params;\n\n const partitionKey = createPartitionKey({\n id: entry.id,\n locale: model.locale,\n tenant: model.tenant\n });\n /**\n * We need to:\n * - delete currently published entry\n * - update current entry revision with new data\n * - update latest entry status - if entry being unpublished is latest\n */\n const items = [\n entity.deleteBatch({\n PK: partitionKey,\n SK: createPublishedSortKey()\n }),\n entity.putBatch({\n ...storageEntry,\n PK: partitionKey,\n SK: createRevisionSortKey(entry),\n TYPE: createType(),\n GSI1_PK: createGSIPartitionKey(model, \"A\"),\n GSI1_SK: createGSISortKey(entry)\n })\n ];\n\n /**\n * We need the latest entry to see if something needs to be updated along side the unpublishing one.\n */\n const latestStorageEntry = await getLatestRevisionByEntryId(model, entry);\n\n if (latestStorageEntry && entry.id === latestStorageEntry.id) {\n items.push(\n entity.putBatch({\n ...storageEntry,\n PK: partitionKey,\n SK: createLatestSortKey(),\n TYPE: createLatestType(),\n GSI1_PK: createGSIPartitionKey(model, \"L\"),\n GSI1_SK: createGSISortKey(entry)\n })\n );\n }\n\n try {\n await batchWriteAll({\n table: entity.table,\n items\n });\n dataLoaders.clearAll({\n model\n });\n return storageEntry;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not execute unpublish batch.\",\n ex.code || \"UNPUBLISH_ERROR\",\n {\n entry,\n storageEntry\n }\n );\n }\n };\n\n return {\n create,\n createRevisionFrom,\n update,\n delete: deleteEntry,\n deleteRevision,\n getPreviousRevision,\n getPublishedByIds,\n getLatestByIds,\n getByIds,\n getRevisionById,\n getPublishedRevisionByEntryId,\n getLatestRevisionByEntryId,\n get,\n getRevisions,\n requestChanges,\n requestReview,\n publish,\n list,\n unpublish\n };\n};\n"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AACA;;AA0BA;;AACA;;AAQA;;AACA;;AAMA;;AAEA;;A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IAlBG;IAmBHsC;EAnBG,CAAP;AAqBH,CAr4BM"}
|
|
1
|
+
{"version":3,"names":["createType","createLatestType","createPublishedType","createEntriesStorageOperations","params","entity","plugins","dataLoaders","DataLoadersHandler","storageTransformPlugins","byType","StorageTransformPlugin","type","reduce","collection","plugin","fieldType","createStorageTransformCallable","model","field","value","fromStorage","getStoragePlugin","create","args","entry","storageEntry","partitionKey","createPartitionKey","id","locale","tenant","isPublished","status","locked","items","putBatch","PK","SK","createRevisionSortKey","TYPE","GSI1_PK","createGSIPartitionKey","GSI1_SK","createGSISortKey","createLatestSortKey","push","createPublishedSortKey","batchWriteAll","table","clearAll","ex","WebinyError","message","code","error","createRevisionFrom","update","latestStorageEntry","getLatestRevisionByEntryId","deleteEntry","queryAllParams","options","gte","records","queryAll","map","item","deleteBatch","deleteRevision","latestEntry","publishedStorageEntry","getPublishedRevisionByEntryId","result","ids","shift","getRevisionById","getRevisions","getAllEntryRevisions","getByIds","getLatestByIds","getPublishedByIds","getPreviousRevision","entryId","version","queryParams","lt","zeroPad","filters","attr","eq","reverse","queryOne","cleanupItem","list","limit","initialLimit","where","initialWhere","after","sort","fields","search","published","index","length","hasMoreItems","totalCount","cursor","modelFields","buildModelFields","filteredItems","filterItems","fullTextSearch","term","sortedItems","sortEntryItems","start","parseInt","decodeCursor","end","undefined","slicedItems","slice","encodeCursor","cleanupItems","get","requestChanges","requestReview","publish","CONTENT_ENTRY_STATUS","UNPUBLISHED","unpublish","delete"],"sources":["index.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { DataLoadersHandler } from \"./dataLoaders\";\nimport {\n CmsEntry,\n CmsEntryListWhere,\n CmsEntryStorageOperations,\n CmsEntryStorageOperationsCreateParams,\n CmsEntryStorageOperationsCreateRevisionFromParams,\n CmsEntryStorageOperationsDeleteParams,\n CmsEntryStorageOperationsDeleteRevisionParams,\n CmsEntryStorageOperationsGetByIdsParams,\n CmsEntryStorageOperationsGetLatestByIdsParams,\n CmsEntryStorageOperationsGetLatestRevisionParams,\n CmsEntryStorageOperationsGetParams,\n CmsEntryStorageOperationsGetPreviousRevisionParams,\n CmsEntryStorageOperationsGetPublishedByIdsParams,\n CmsEntryStorageOperationsGetRevisionParams,\n CmsEntryStorageOperationsGetRevisionsParams,\n CmsEntryStorageOperationsListParams,\n CmsEntryStorageOperationsPublishParams,\n CmsEntryStorageOperationsRequestChangesParams,\n CmsEntryStorageOperationsRequestReviewParams,\n CmsEntryStorageOperationsUnpublishParams,\n CmsEntryStorageOperationsUpdateParams,\n CmsModel,\n CONTENT_ENTRY_STATUS\n} from \"@webiny/api-headless-cms/types\";\nimport { Entity } from \"dynamodb-toolbox\";\nimport { filterItems, buildModelFields, sortEntryItems, FilterItemFromStorage } from \"./utils\";\nimport {\n createGSIPartitionKey,\n createGSISortKey,\n createLatestSortKey,\n createPartitionKey,\n createPublishedSortKey,\n createRevisionSortKey\n} from \"~/operations/entry/keys\";\nimport { batchWriteAll } from \"@webiny/db-dynamodb/utils/batchWrite\";\nimport {\n queryAll,\n QueryAllParams,\n queryOne,\n QueryOneParams\n} from \"@webiny/db-dynamodb/utils/query\";\nimport { cleanupItem, cleanupItems } from \"@webiny/db-dynamodb/utils/cleanup\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport { decodeCursor, encodeCursor } from \"@webiny/utils/cursor\";\nimport { zeroPad } from \"@webiny/utils/zeroPad\";\nimport { StorageTransformPlugin } from \"@webiny/api-headless-cms\";\n\nconst createType = (): string => {\n return \"cms.entry\";\n};\nconst createLatestType = (): string => {\n return `${createType()}.l`;\n};\nconst createPublishedType = (): string => {\n return `${createType()}.p`;\n};\n\nexport interface CreateEntriesStorageOperationsParams {\n entity: Entity<any>;\n plugins: PluginsContainer;\n}\nexport const createEntriesStorageOperations = (\n params: CreateEntriesStorageOperationsParams\n): CmsEntryStorageOperations => {\n const { entity, plugins } = params;\n\n const dataLoaders = new DataLoadersHandler({\n entity\n });\n\n const storageTransformPlugins = plugins\n .byType<StorageTransformPlugin>(StorageTransformPlugin.type)\n .reduce((collection, plugin) => {\n collection[plugin.fieldType] = plugin;\n return collection;\n }, {} as Record<string, StorageTransformPlugin>);\n\n const createStorageTransformCallable = (model: CmsModel): FilterItemFromStorage => {\n return (field, value) => {\n const plugin: StorageTransformPlugin = storageTransformPlugins[field.type];\n if (!plugin) {\n return value;\n }\n return plugin.fromStorage({\n model,\n field,\n value,\n getStoragePlugin(fieldType: string): StorageTransformPlugin {\n return storageTransformPlugins[fieldType] || storageTransformPlugins[\"*\"];\n },\n plugins\n });\n };\n };\n\n const create = async (model: CmsModel, args: CmsEntryStorageOperationsCreateParams) => {\n const { entry, storageEntry } = args;\n\n const partitionKey = createPartitionKey({\n id: entry.id,\n locale: model.locale,\n tenant: model.tenant\n });\n\n const isPublished = entry.status === \"published\";\n\n const locked = isPublished ? true : entry.locked;\n /**\n * We need to:\n * - create new main entry item\n * - create new or update latest entry item\n */\n const items = [\n entity.putBatch({\n ...storageEntry,\n locked,\n PK: partitionKey,\n SK: createRevisionSortKey(entry),\n TYPE: createType(),\n GSI1_PK: createGSIPartitionKey(model, \"A\"),\n GSI1_SK: createGSISortKey(storageEntry)\n }),\n entity.putBatch({\n ...storageEntry,\n locked,\n PK: partitionKey,\n SK: createLatestSortKey(),\n TYPE: createLatestType(),\n GSI1_PK: createGSIPartitionKey(model, \"L\"),\n GSI1_SK: createGSISortKey(storageEntry)\n })\n ];\n\n /**\n * We need to create published entry if\n */\n if (isPublished) {\n items.push(\n entity.putBatch({\n ...storageEntry,\n locked,\n PK: partitionKey,\n SK: createPublishedSortKey(),\n TYPE: createLatestType(),\n GSI1_PK: createGSIPartitionKey(model, \"P\"),\n GSI1_SK: createGSISortKey(storageEntry)\n })\n );\n }\n\n try {\n await batchWriteAll({\n table: entity.table,\n items\n });\n dataLoaders.clearAll({\n model\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not insert data into the DynamoDB.\",\n ex.code || \"CREATE_ENTRY_ERROR\",\n {\n error: ex,\n entry\n }\n );\n }\n\n return storageEntry;\n };\n\n const createRevisionFrom = async (\n model: CmsModel,\n params: CmsEntryStorageOperationsCreateRevisionFromParams\n ) => {\n const { entry, storageEntry } = params;\n\n const partitionKey = createPartitionKey({\n id: entry.id,\n locale: model.locale,\n tenant: model.tenant\n });\n /**\n * We need to:\n * - create the main entry item\n * - update the last entry item to a current one\n */\n const items = [\n entity.putBatch({\n ...storageEntry,\n PK: partitionKey,\n SK: createRevisionSortKey(storageEntry),\n TYPE: createType(),\n GSI1_PK: createGSIPartitionKey(model, \"A\"),\n GSI1_SK: createGSISortKey(storageEntry)\n }),\n entity.putBatch({\n ...storageEntry,\n PK: partitionKey,\n SK: createLatestSortKey(),\n TYPE: createLatestType(),\n GSI1_PK: createGSIPartitionKey(model, \"L\"),\n GSI1_SK: createGSISortKey(storageEntry)\n })\n ];\n try {\n await batchWriteAll({\n table: entity.table,\n items\n });\n dataLoaders.clearAll({\n model\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not create revision from given entry.\",\n ex.code || \"CREATE_REVISION_ERROR\",\n {\n error: ex,\n entry,\n storageEntry\n }\n );\n }\n /**\n * There are no modifications on the entry created so just return the data.\n */\n return storageEntry;\n };\n\n const update = async (model: CmsModel, params: CmsEntryStorageOperationsUpdateParams) => {\n const { entry, storageEntry } = params;\n const partitionKey = createPartitionKey({\n id: entry.id,\n locale: model.locale,\n tenant: model.tenant\n });\n\n const isPublished = entry.status === \"published\";\n const locked = isPublished ? true : entry.locked;\n\n const items = [];\n /**\n * We need to:\n * - update the current entry\n * - update the latest entry if the current entry is the latest one\n */\n items.push(\n entity.putBatch({\n ...storageEntry,\n locked,\n PK: partitionKey,\n SK: createRevisionSortKey(storageEntry),\n TYPE: createType(),\n GSI1_PK: createGSIPartitionKey(model, \"A\"),\n GSI1_SK: createGSISortKey(storageEntry)\n })\n );\n\n if (isPublished) {\n items.push(\n entity.putBatch({\n ...storageEntry,\n locked,\n PK: partitionKey,\n SK: createPublishedSortKey(),\n TYPE: createPublishedType(),\n GSI1_PK: createGSIPartitionKey(model, \"P\"),\n GSI1_SK: createGSISortKey(storageEntry)\n })\n );\n }\n\n /**\n * We need the latest entry to update it as well if neccessary.\n */\n const latestStorageEntry = await getLatestRevisionByEntryId(model, entry);\n\n if (latestStorageEntry && latestStorageEntry.id === entry.id) {\n items.push(\n entity.putBatch({\n ...storageEntry,\n locked,\n PK: partitionKey,\n SK: createLatestSortKey(),\n TYPE: createLatestType(),\n GSI1_PK: createGSIPartitionKey(model, \"L\"),\n GSI1_SK: createGSISortKey(entry)\n })\n );\n }\n\n try {\n await batchWriteAll({\n table: entity.table,\n items\n });\n dataLoaders.clearAll({\n model\n });\n return storageEntry;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not update entry.\",\n ex.code || \"UPDATE_ERROR\",\n {\n error: ex,\n entry,\n latestStorageEntry\n }\n );\n }\n };\n\n const deleteEntry = async (model: CmsModel, params: CmsEntryStorageOperationsDeleteParams) => {\n const { entry } = params;\n\n const queryAllParams: QueryAllParams = {\n entity,\n partitionKey: createPartitionKey({\n id: entry.id,\n locale: model.locale,\n tenant: model.tenant\n }),\n options: {\n gte: \" \"\n }\n };\n\n let records = [];\n try {\n records = await queryAll(queryAllParams);\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not load all records.\",\n ex.code || \"LOAD_ALL_RECORDS_ERROR\",\n {\n error: ex,\n entry\n }\n );\n }\n const items = records.map(item => {\n return entity.deleteBatch({\n PK: item.PK,\n SK: item.SK\n });\n });\n\n try {\n await batchWriteAll({\n table: entity.table,\n items\n });\n dataLoaders.clearAll({\n model\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not delete the entry.\",\n ex.code || \"DELETE_ENTRY_ERROR\",\n {\n error: ex,\n partitionKey: queryAllParams.partitionKey,\n entry\n }\n );\n }\n };\n\n const deleteRevision = async (\n model: CmsModel,\n params: CmsEntryStorageOperationsDeleteRevisionParams\n ) => {\n const { entry, latestEntry, latestStorageEntry } = params;\n const partitionKey = createPartitionKey({\n id: entry.id,\n locale: model.locale,\n tenant: model.tenant\n });\n\n const items = [\n entity.deleteBatch({\n PK: partitionKey,\n SK: createRevisionSortKey(entry)\n })\n ];\n\n const publishedStorageEntry = await getPublishedRevisionByEntryId(model, entry);\n\n /**\n * If revision we are deleting is the published one as well, we need to delete those records as well.\n */\n if (publishedStorageEntry && entry.id === publishedStorageEntry.id) {\n items.push(\n entity.deleteBatch({\n PK: partitionKey,\n SK: createPublishedSortKey()\n })\n );\n }\n if (latestStorageEntry) {\n items.push(\n entity.putBatch({\n ...latestStorageEntry,\n PK: partitionKey,\n SK: createLatestSortKey(),\n TYPE: createLatestType(),\n GSI1_PK: createGSIPartitionKey(model, \"L\"),\n GSI1_SK: createGSISortKey(latestStorageEntry)\n })\n );\n }\n try {\n await batchWriteAll({\n table: entity.table,\n items\n });\n dataLoaders.clearAll({\n model\n });\n } catch (ex) {\n throw new WebinyError(ex.message, ex.code, {\n error: ex,\n entry,\n latestEntry\n });\n }\n };\n\n const getLatestRevisionByEntryId = async (\n model: CmsModel,\n params: CmsEntryStorageOperationsGetLatestRevisionParams\n ) => {\n const result = await dataLoaders.getLatestRevisionByEntryId({\n model,\n ids: [params.id]\n });\n return result.shift() || null;\n };\n const getPublishedRevisionByEntryId = async (\n model: CmsModel,\n params: CmsEntryStorageOperationsGetLatestRevisionParams\n ) => {\n const result = await dataLoaders.getPublishedRevisionByEntryId({\n model,\n ids: [params.id]\n });\n return result.shift() || null;\n };\n\n const getRevisionById = async (\n model: CmsModel,\n params: CmsEntryStorageOperationsGetRevisionParams\n ) => {\n const result = await dataLoaders.getRevisionById({\n model,\n ids: [params.id]\n });\n return result.shift() || null;\n };\n\n const getRevisions = async (\n model: CmsModel,\n params: CmsEntryStorageOperationsGetRevisionsParams\n ) => {\n return await dataLoaders.getAllEntryRevisions({\n model,\n ids: [params.id]\n });\n };\n\n const getByIds = async (model: CmsModel, params: CmsEntryStorageOperationsGetByIdsParams) => {\n return dataLoaders.getRevisionById({\n model,\n ids: params.ids\n });\n };\n\n const getLatestByIds = async (\n model: CmsModel,\n params: CmsEntryStorageOperationsGetLatestByIdsParams\n ) => {\n return dataLoaders.getLatestRevisionByEntryId({\n model,\n ids: params.ids\n });\n };\n\n const getPublishedByIds = async (\n model: CmsModel,\n params: CmsEntryStorageOperationsGetPublishedByIdsParams\n ) => {\n return dataLoaders.getPublishedRevisionByEntryId({\n model,\n ids: params.ids\n });\n };\n\n const getPreviousRevision = async (\n model: CmsModel,\n params: CmsEntryStorageOperationsGetPreviousRevisionParams\n ) => {\n const { entryId, version } = params;\n const queryParams: QueryOneParams = {\n entity,\n partitionKey: createPartitionKey({\n tenant: model.tenant,\n locale: model.locale,\n id: entryId\n }),\n options: {\n lt: `REV#${zeroPad(version)}`,\n /**\n * We need to have extra checks because DynamoDB will return published or latest record if there is no REV# record.\n */\n filters: [\n {\n attr: \"TYPE\",\n eq: createType()\n },\n {\n attr: \"version\",\n lt: version\n }\n ],\n reverse: true\n }\n };\n\n try {\n const result = await queryOne<CmsEntry>(queryParams);\n\n return cleanupItem(entity, result);\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not get previous version of given entry.\",\n ex.code || \"GET_PREVIOUS_VERSION_ERROR\",\n {\n ...params,\n error: ex,\n partitionKey: queryParams.partitionKey,\n options: queryParams.options,\n model\n }\n );\n }\n };\n\n const list = async (model: CmsModel, params: CmsEntryStorageOperationsListParams) => {\n const {\n limit: initialLimit = 10,\n where: initialWhere,\n after,\n sort,\n fields,\n search\n } = params;\n const limit = initialLimit <= 0 || initialLimit >= 10000 ? 10000 : initialLimit;\n\n const type = initialWhere.published ? \"P\" : \"L\";\n\n const queryAllParams: QueryAllParams = {\n entity,\n partitionKey: createGSIPartitionKey(model, type),\n options: {\n index: \"GSI1\",\n gte: \" \"\n }\n };\n let records = [];\n try {\n records = await queryAll(queryAllParams);\n } catch (ex) {\n throw new WebinyError(ex.message, \"QUERY_ENTRIES_ERROR\", {\n error: ex,\n partitionKey: queryAllParams.partitionKey,\n options: queryAllParams.options\n });\n }\n if (records.length === 0) {\n return {\n hasMoreItems: false,\n totalCount: 0,\n cursor: null,\n items: []\n };\n }\n const where: Partial<CmsEntryListWhere> = {\n ...initialWhere\n };\n delete where[\"published\"];\n delete where[\"latest\"];\n /**\n * We need a object containing field, transformers and paths.\n * Just build it here and pass on into other methods that require it to avoid mapping multiple times.\n */\n const modelFields = buildModelFields({\n plugins,\n model\n });\n /**\n * Filter the read items via the code.\n * It will build the filters out of the where input and transform the values it is using.\n */\n const filteredItems = await filterItems({\n items: records,\n where,\n plugins,\n fields: modelFields,\n fromStorage: createStorageTransformCallable(model),\n fullTextSearch: {\n term: search,\n fields: fields || []\n }\n });\n\n const totalCount = filteredItems.length;\n /**\n * Sorting is also done via the code.\n * It takes the sort input and sorts by it via the lodash sortBy method.\n */\n const sortedItems = sortEntryItems({\n items: filteredItems,\n sort,\n fields: modelFields\n });\n\n const start = parseInt((decodeCursor(after) as string) || \"0\") || 0;\n const hasMoreItems = totalCount > start + limit;\n const end = limit > totalCount + start + limit ? undefined : start + limit;\n const slicedItems = sortedItems.slice(start, end);\n /**\n * Although we do not need a cursor here, we will use it as such to keep it standardized.\n * Number is simply encoded.\n */\n const cursor = totalCount > start + limit ? encodeCursor(`${start + limit}`) : null;\n return {\n hasMoreItems,\n totalCount,\n cursor,\n items: cleanupItems(entity, slicedItems)\n };\n };\n\n const get = async (model: CmsModel, params: CmsEntryStorageOperationsGetParams) => {\n const { items } = await list(model, {\n ...params,\n limit: 1\n });\n return items.shift() || null;\n };\n\n const requestChanges = async (\n model: CmsModel,\n params: CmsEntryStorageOperationsRequestChangesParams\n ) => {\n const { entry, storageEntry } = params;\n\n const partitionKey = createPartitionKey({\n id: entry.id,\n locale: model.locale,\n tenant: model.tenant\n });\n\n /**\n * We need to:\n * - update the existing entry\n * - update latest version - if existing entry is the latest version\n */\n const items = [\n entity.putBatch({\n ...storageEntry,\n TYPE: createType(),\n PK: partitionKey,\n SK: createRevisionSortKey(entry),\n GSI1_PK: createGSIPartitionKey(model, \"A\"),\n GSI1_SK: createGSISortKey(entry)\n })\n ];\n\n /**\n * We need the latest entry to see if something needs to be updated along side the request changes one.\n */\n const latestStorageEntry = await getLatestRevisionByEntryId(model, entry);\n\n if (latestStorageEntry && latestStorageEntry.id === entry.id) {\n items.push(\n entity.putBatch({\n ...storageEntry,\n PK: partitionKey,\n SK: createLatestSortKey(),\n TYPE: createLatestType(),\n GSI1_PK: createGSIPartitionKey(model, \"L\"),\n GSI1_SK: createGSISortKey(entry)\n })\n );\n }\n\n try {\n await batchWriteAll({\n table: entity.table,\n items\n });\n dataLoaders.clearAll({\n model\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not execute the request changes batch.\",\n ex.code || \"REQUEST_CHANGES_ERROR\",\n {\n entry\n }\n );\n }\n return entry;\n };\n\n const requestReview = async (\n model: CmsModel,\n params: CmsEntryStorageOperationsRequestReviewParams\n ) => {\n const { entry, storageEntry } = params;\n\n const partitionKey = createPartitionKey({\n id: entry.id,\n locale: model.locale,\n tenant: model.tenant\n });\n /**\n * We need to:\n * - update existing entry\n * - update latest entry - if existing entry is the latest entry\n */\n const items = [\n entity.putBatch({\n ...storageEntry,\n TYPE: createType(),\n PK: partitionKey,\n SK: createRevisionSortKey(entry),\n GSI1_PK: createGSIPartitionKey(model, \"A\"),\n GSI1_SK: createGSISortKey(entry)\n })\n ];\n\n /**\n * We need the latest entry to see if something needs to be updated along side the request review one.\n */\n const latestStorageEntry = await getLatestRevisionByEntryId(model, entry);\n\n if (latestStorageEntry && latestStorageEntry.id === entry.id) {\n items.push(\n entity.putBatch({\n ...storageEntry,\n PK: partitionKey,\n SK: createLatestSortKey(),\n TYPE: createLatestType(),\n GSI1_PK: createGSIPartitionKey(model, \"L\"),\n GSI1_SK: createGSISortKey(entry)\n })\n );\n }\n\n try {\n await batchWriteAll({\n table: entity.table,\n items\n });\n dataLoaders.clearAll({\n model\n });\n return entry;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not execute request review batch.\",\n ex.code || \"REQUEST_REVIEW_ERROR\",\n {\n entry,\n storageEntry\n }\n );\n }\n };\n\n const publish = async (model: CmsModel, params: CmsEntryStorageOperationsPublishParams) => {\n const { entry, storageEntry } = params;\n\n const partitionKey = createPartitionKey({\n id: entry.id,\n locale: model.locale,\n tenant: model.tenant\n });\n\n /**\n * We need the latest and published entries to see if something needs to be updated along side the publishing one.\n */\n const latestStorageEntry = await getLatestRevisionByEntryId(model, entry);\n const publishedStorageEntry = await getPublishedRevisionByEntryId(model, entry);\n /**\n * We need to update:\n * - current entry revision sort key\n * - published sort key\n * - latest sort key - if entry updated is actually latest\n * - previous published entry to unpublished status - if any previously published entry\n */\n const items = [\n entity.putBatch({\n ...storageEntry,\n PK: partitionKey,\n SK: createRevisionSortKey(entry),\n TYPE: createType(),\n GSI1_PK: createGSIPartitionKey(model, \"A\"),\n GSI1_SK: createGSISortKey(entry)\n }),\n entity.putBatch({\n ...storageEntry,\n PK: partitionKey,\n SK: createPublishedSortKey(),\n TYPE: createPublishedType(),\n GSI1_PK: createGSIPartitionKey(model, \"P\"),\n GSI1_SK: createGSISortKey(entry)\n })\n ];\n if (latestStorageEntry && entry.id === latestStorageEntry.id) {\n items.push(\n entity.putBatch({\n ...storageEntry,\n PK: partitionKey,\n SK: createLatestSortKey(),\n TYPE: createLatestType(),\n GSI1_PK: createGSIPartitionKey(model, \"L\"),\n GSI1_SK: createGSISortKey(entry)\n })\n );\n }\n if (publishedStorageEntry && publishedStorageEntry.id !== entry.id) {\n items.push(\n entity.putBatch({\n ...publishedStorageEntry,\n PK: partitionKey,\n SK: createRevisionSortKey(publishedStorageEntry),\n TYPE: createType(),\n status: CONTENT_ENTRY_STATUS.UNPUBLISHED,\n GSI1_PK: createGSIPartitionKey(model, \"A\"),\n GSI1_SK: createGSISortKey(publishedStorageEntry)\n })\n );\n }\n\n try {\n await batchWriteAll({\n table: entity.table,\n items\n });\n dataLoaders.clearAll({\n model\n });\n return entry;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not execute the publishing batch.\",\n ex.code || \"PUBLISH_ERROR\",\n {\n entry,\n latestStorageEntry,\n publishedStorageEntry\n }\n );\n }\n };\n\n const unpublish = async (model: CmsModel, params: CmsEntryStorageOperationsUnpublishParams) => {\n const { entry, storageEntry } = params;\n\n const partitionKey = createPartitionKey({\n id: entry.id,\n locale: model.locale,\n tenant: model.tenant\n });\n /**\n * We need to:\n * - delete currently published entry\n * - update current entry revision with new data\n * - update latest entry status - if entry being unpublished is latest\n */\n const items = [\n entity.deleteBatch({\n PK: partitionKey,\n SK: createPublishedSortKey()\n }),\n entity.putBatch({\n ...storageEntry,\n PK: partitionKey,\n SK: createRevisionSortKey(entry),\n TYPE: createType(),\n GSI1_PK: createGSIPartitionKey(model, \"A\"),\n GSI1_SK: createGSISortKey(entry)\n })\n ];\n\n /**\n * We need the latest entry to see if something needs to be updated along side the unpublishing one.\n */\n const latestStorageEntry = await getLatestRevisionByEntryId(model, entry);\n\n if (latestStorageEntry && entry.id === latestStorageEntry.id) {\n items.push(\n entity.putBatch({\n ...storageEntry,\n PK: partitionKey,\n SK: createLatestSortKey(),\n TYPE: createLatestType(),\n GSI1_PK: createGSIPartitionKey(model, \"L\"),\n GSI1_SK: createGSISortKey(entry)\n })\n );\n }\n\n try {\n await batchWriteAll({\n table: entity.table,\n items\n });\n dataLoaders.clearAll({\n model\n });\n return storageEntry;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not execute unpublish batch.\",\n ex.code || \"UNPUBLISH_ERROR\",\n {\n entry,\n storageEntry\n }\n );\n }\n };\n\n return {\n create,\n createRevisionFrom,\n update,\n delete: deleteEntry,\n deleteRevision,\n getPreviousRevision,\n getPublishedByIds,\n getLatestByIds,\n getByIds,\n getRevisionById,\n getPublishedRevisionByEntryId,\n getLatestRevisionByEntryId,\n get,\n getRevisions,\n requestChanges,\n requestReview,\n publish,\n list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,6BAXG;IAYHb,0BAZG;IAaHmE,GAbG;IAcHjD,YAdG;IAeHkD,cAfG;IAgBHC,aAhBG;IAiBHC,OAjBG;IAkBHnC,IAlBG;IAmBHsC;EAnBG,CAAP;AAqBH,CAr4BM"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createSystemField","field","systemFields","id","type","fieldId","entryId","createdOn","savedOn","createdBy","settings","path","ownedBy","version"],"sources":["systemFields.ts"],"sourcesContent":["import { CmsModelField } from \"@webiny/api-headless-cms/types\";\n\nconst createSystemField = (field: Partial<CmsModelField>): CmsModelField => {\n return field as CmsModelField;\n};\n\nexport const systemFields: Record<string, CmsModelField> = {\n id: createSystemField({\n id: \"id\",\n type: \"text\",\n fieldId: \"id\"\n }),\n entryId: createSystemField({\n id: \"entryId\",\n type: \"text\",\n fieldId: \"entryId\"\n }),\n createdOn: createSystemField({\n id: \"createdOn\",\n type: \"datetime\",\n fieldId: \"createdOn\"\n }),\n savedOn: createSystemField({\n id: \"savedOn\",\n type: \"datetime\",\n fieldId: \"savedOn\"\n }),\n createdBy: createSystemField({\n id: \"createdBy\",\n type: \"plainObject\",\n fieldId: \"createdBy\",\n settings: {\n path: \"createdBy.id\"\n }\n }),\n ownedBy: createSystemField({\n id: \"ownedBy\",\n type: \"plainObject\",\n fieldId: \"ownedBy\",\n settings: {\n path: \"ownedBy.id\"\n }\n }),\n version: createSystemField({\n id: \"version\",\n type: \"number\",\n fieldId: \"version\"\n })\n};\n"],"mappings":";;;;;;;AAEA,MAAMA,iBAAiB,GAAIC,KAAD,IAAkD;EACxE,OAAOA,KAAP;AACH,CAFD;;AAIO,MAAMC,YAA2C,GAAG;EACvDC,EAAE,EAAEH,iBAAiB,CAAC;IAClBG,EAAE,EAAE,IADc;IAElBC,IAAI,EAAE,MAFY;IAGlBC,OAAO,EAAE;EAHS,CAAD,CADkC;EAMvDC,OAAO,EAAEN,iBAAiB,CAAC;IACvBG,EAAE,EAAE,SADmB;IAEvBC,IAAI,EAAE,MAFiB;IAGvBC,OAAO,EAAE;EAHc,CAAD,CAN6B;EAWvDE,SAAS,EAAEP,iBAAiB,CAAC;IACzBG,EAAE,EAAE,WADqB;IAEzBC,IAAI,EAAE,UAFmB;IAGzBC,OAAO,EAAE;EAHgB,CAAD,CAX2B;EAgBvDG,OAAO,EAAER,iBAAiB,CAAC;IACvBG,EAAE,EAAE,SADmB;IAEvBC,IAAI,EAAE,UAFiB;IAGvBC,OAAO,EAAE;EAHc,CAAD,CAhB6B;EAqBvDI,SAAS,EAAET,iBAAiB,CAAC;IACzBG,EAAE,EAAE,WADqB;IAEzBC,IAAI,EAAE,aAFmB;IAGzBC,OAAO,EAAE,WAHgB;IAIzBK,QAAQ,EAAE;MACNC,IAAI,EAAE;IADA;EAJe,CAAD,CArB2B;EA6BvDC,
|
|
1
|
+
{"version":3,"names":["createSystemField","field","systemFields","id","type","fieldId","entryId","createdOn","savedOn","createdBy","settings","path","meta","ownedBy","version"],"sources":["systemFields.ts"],"sourcesContent":["import { CmsModelField } from \"@webiny/api-headless-cms/types\";\n\nconst createSystemField = (field: Partial<CmsModelField>): CmsModelField => {\n return field as CmsModelField;\n};\n\nexport const systemFields: Record<string, CmsModelField> = {\n id: createSystemField({\n id: \"id\",\n type: \"text\",\n fieldId: \"id\"\n }),\n entryId: createSystemField({\n id: \"entryId\",\n type: \"text\",\n fieldId: \"entryId\"\n }),\n createdOn: createSystemField({\n id: \"createdOn\",\n type: \"datetime\",\n fieldId: \"createdOn\"\n }),\n savedOn: createSystemField({\n id: \"savedOn\",\n type: \"datetime\",\n fieldId: \"savedOn\"\n }),\n createdBy: createSystemField({\n id: \"createdBy\",\n type: \"plainObject\",\n fieldId: \"createdBy\",\n settings: {\n path: \"createdBy.id\"\n }\n }),\n meta: createSystemField({\n id: \"meta\",\n type: \"plainObject\",\n fieldId: \"meta\"\n }),\n ownedBy: createSystemField({\n id: \"ownedBy\",\n type: \"plainObject\",\n fieldId: \"ownedBy\",\n settings: {\n path: \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CAAC;IACvBG,EAAE,EAAE,SADmB;IAEvBC,IAAI,EAAE,QAFiB;IAGvBC,OAAO,EAAE;EAHc,CAAD;AA1C6B,CAApD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/api-headless-cms-ddb",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.30.0",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"@webiny/api-headless-cms",
|
|
@@ -21,13 +21,13 @@
|
|
|
21
21
|
],
|
|
22
22
|
"license": "MIT",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@babel/runtime": "7.18.
|
|
25
|
-
"@webiny/api-headless-cms": "5.
|
|
26
|
-
"@webiny/db-dynamodb": "5.
|
|
27
|
-
"@webiny/error": "5.
|
|
28
|
-
"@webiny/handler-db": "5.
|
|
29
|
-
"@webiny/utils": "5.
|
|
30
|
-
"aws-sdk": "2.
|
|
24
|
+
"@babel/runtime": "7.18.6",
|
|
25
|
+
"@webiny/api-headless-cms": "5.30.0",
|
|
26
|
+
"@webiny/db-dynamodb": "5.30.0",
|
|
27
|
+
"@webiny/error": "5.30.0",
|
|
28
|
+
"@webiny/handler-db": "5.30.0",
|
|
29
|
+
"@webiny/utils": "5.30.0",
|
|
30
|
+
"aws-sdk": "2.1173.0",
|
|
31
31
|
"dataloader": "2.1.0",
|
|
32
32
|
"dot-prop": "5.3.0",
|
|
33
33
|
"dynamodb-toolbox": "0.3.5",
|
|
@@ -40,14 +40,14 @@
|
|
|
40
40
|
"@babel/preset-env": "^7.16.4",
|
|
41
41
|
"@babel/preset-flow": "^7.16.0",
|
|
42
42
|
"@types/jsonpack": "^1.1.0",
|
|
43
|
-
"@webiny/cli": "^5.
|
|
44
|
-
"@webiny/plugins": "^5.
|
|
45
|
-
"@webiny/project-utils": "^5.
|
|
46
|
-
"jest": "^
|
|
43
|
+
"@webiny/cli": "^5.30.0",
|
|
44
|
+
"@webiny/plugins": "^5.30.0",
|
|
45
|
+
"@webiny/project-utils": "^5.30.0",
|
|
46
|
+
"jest": "^28.1.0",
|
|
47
47
|
"jest-dynalite": "^3.2.0",
|
|
48
48
|
"jest-environment-node": "^26.6.2",
|
|
49
49
|
"ttypescript": "^1.5.12",
|
|
50
|
-
"typescript": "4.
|
|
50
|
+
"typescript": "4.7.4"
|
|
51
51
|
},
|
|
52
52
|
"publishConfig": {
|
|
53
53
|
"access": "public",
|
|
@@ -57,5 +57,5 @@
|
|
|
57
57
|
"build": "yarn webiny run build",
|
|
58
58
|
"watch": "yarn webiny run watch"
|
|
59
59
|
},
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "3cadc5d26e565586b28772afbc18ae554ce7b782"
|
|
61
61
|
}
|
package/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Plugin } from "@webiny/plugins/types";
|
|
2
|
-
import { CmsModelField,
|
|
2
|
+
import { CmsModelField, HeadlessCmsStorageOperations as BaseHeadlessCmsStorageOperations } from "@webiny/api-headless-cms/types";
|
|
3
3
|
import { DynamoDBTypes, TableConstructor } from "dynamodb-toolbox/dist/classes/Table";
|
|
4
4
|
import { EntityAttributeConfig, EntityCompositeAttributes } from "dynamodb-toolbox/dist/classes/Entity";
|
|
5
5
|
import { DocumentClient } from "aws-sdk/clients/dynamodb";
|
|
@@ -40,7 +40,6 @@ export interface TableModifier {
|
|
|
40
40
|
export interface StorageOperationsFactoryParams {
|
|
41
41
|
documentClient: DocumentClient;
|
|
42
42
|
table?: TableModifier;
|
|
43
|
-
modelFieldToGraphQLPlugins: CmsModelFieldToGraphQLPlugin[];
|
|
44
43
|
attributes?: Record<ENTITIES, Attributes>;
|
|
45
44
|
plugins?: Plugin[] | Plugin[][];
|
|
46
45
|
}
|
package/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ENTITIES"],"sources":["types.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins/types\";\nimport {\n CmsModelField,\n
|
|
1
|
+
{"version":3,"names":["ENTITIES"],"sources":["types.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins/types\";\nimport {\n CmsModelField,\n HeadlessCmsStorageOperations as BaseHeadlessCmsStorageOperations\n} from \"@webiny/api-headless-cms/types\";\nimport { DynamoDBTypes, TableConstructor } from \"dynamodb-toolbox/dist/classes/Table\";\nimport {\n EntityAttributeConfig,\n EntityCompositeAttributes\n} from \"dynamodb-toolbox/dist/classes/Entity\";\nimport { DocumentClient } from \"aws-sdk/clients/dynamodb\";\nimport { Entity, Table } from \"dynamodb-toolbox\";\n\ninterface CmsFieldFilterValueTransformParams {\n /**\n * A field which value we are transforming.\n */\n field: CmsModelField;\n value: any;\n}\n\nexport interface CmsFieldFilterValueTransformPlugin extends Plugin {\n /**\n * A plugin type.\n */\n type: \"cms-field-filter-value-transform\";\n /**\n * A field type this plugin is for.\n */\n fieldType: string;\n /**\n * Transform method which expect field definition and value to transform.\n */\n transform: (params: CmsFieldFilterValueTransformParams) => any;\n}\n\nexport type AttributeDefinition = DynamoDBTypes | EntityAttributeConfig | EntityCompositeAttributes;\n\nexport type Attributes = Record<string, AttributeDefinition>;\n\nexport enum ENTITIES {\n SYSTEM = \"CmsSystem\",\n SETTINGS = \"CmsSettings\",\n GROUPS = \"CmsGroups\",\n MODELS = \"CmsModels\",\n ENTRIES = \"CmsEntries\"\n}\n\nexport interface TableModifier {\n (table: TableConstructor): TableConstructor;\n}\n\nexport interface StorageOperationsFactoryParams {\n documentClient: DocumentClient;\n table?: TableModifier;\n attributes?: Record<ENTITIES, Attributes>;\n plugins?: Plugin[] | Plugin[][];\n}\n\nexport interface HeadlessCmsStorageOperations extends BaseHeadlessCmsStorageOperations {\n getTable: () => Table;\n getEntities: () => Record<\"system\" | \"settings\" | \"groups\" | \"models\" | \"entries\", Entity<any>>;\n}\n\nexport interface StorageOperationsFactory {\n (params: StorageOperationsFactoryParams): HeadlessCmsStorageOperations;\n}\n"],"mappings":";;;;;;IAwCYA,Q;;;WAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;GAAAA,Q,wBAAAA,Q"}
|