@webiny/api-headless-cms-ddb 5.43.3 → 6.0.0-alpha.1
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.d.ts +3 -2
- package/definitions/entry.js.map +1 -1
- package/definitions/group.d.ts +3 -2
- package/definitions/group.js.map +1 -1
- package/definitions/model.d.ts +3 -2
- package/definitions/model.js.map +1 -1
- package/definitions/system.d.ts +3 -2
- package/definitions/system.js.map +1 -1
- package/definitions/table.d.ts +2 -2
- package/definitions/table.js.map +1 -1
- package/dynamoDb/path/locationFolderId.js.map +1 -1
- package/dynamoDb/path/plainObject.js.map +1 -1
- package/dynamoDb/storage/richText.js +1 -8
- package/dynamoDb/storage/richText.js.map +1 -1
- package/dynamoDb/transformValue/datetime.d.ts +1 -1
- package/dynamoDb/transformValue/datetime.js.map +1 -1
- package/index.d.ts +1 -1
- package/index.js.map +1 -1
- package/operations/entry/dataLoader/DataLoaderCache.d.ts +1 -1
- package/operations/entry/dataLoader/DataLoaderCache.js.map +1 -1
- package/operations/entry/dataLoader/getAllEntryRevisions.d.ts +2 -2
- package/operations/entry/dataLoader/getAllEntryRevisions.js.map +1 -1
- package/operations/entry/dataLoader/getLatestRevisionByEntryId.d.ts +2 -2
- package/operations/entry/dataLoader/getLatestRevisionByEntryId.js.map +1 -1
- package/operations/entry/dataLoader/getPublishedRevisionByEntryId.d.ts +2 -2
- package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js.map +1 -1
- package/operations/entry/dataLoader/getRevisionById.d.ts +2 -2
- package/operations/entry/dataLoader/getRevisionById.js.map +1 -1
- package/operations/entry/dataLoader/index.d.ts +2 -2
- package/operations/entry/dataLoader/index.js.map +1 -1
- package/operations/entry/dataLoader/types.d.ts +1 -1
- package/operations/entry/dataLoader/types.js.map +1 -1
- package/operations/entry/dataLoaders.d.ts +3 -3
- package/operations/entry/dataLoaders.js.map +1 -1
- package/operations/entry/filtering/createExpressions.d.ts +3 -3
- package/operations/entry/filtering/createExpressions.js.map +1 -1
- package/operations/entry/filtering/createFields.d.ts +3 -3
- package/operations/entry/filtering/createFields.js.map +1 -1
- package/operations/entry/filtering/extractSort.d.ts +3 -3
- package/operations/entry/filtering/extractSort.js.map +1 -1
- package/operations/entry/filtering/filter.d.ts +3 -3
- package/operations/entry/filtering/filter.js.map +1 -1
- package/operations/entry/filtering/fullTextSearch.d.ts +3 -3
- package/operations/entry/filtering/fullTextSearch.js.map +1 -1
- package/operations/entry/filtering/mapPlugins.d.ts +1 -1
- package/operations/entry/filtering/mapPlugins.js.map +1 -1
- package/operations/entry/filtering/plugins/index.js +2 -1
- package/operations/entry/filtering/plugins/index.js.map +1 -1
- package/operations/entry/filtering/plugins/objectFilterCreate.js.map +1 -1
- package/operations/entry/filtering/plugins/refFilterCreate.d.ts +1 -1
- package/operations/entry/filtering/plugins/refFilterCreate.js.map +1 -1
- package/operations/entry/filtering/plugins/searchableJsonFilterCreate.d.ts +2 -0
- package/operations/entry/filtering/plugins/searchableJsonFilterCreate.js +65 -0
- package/operations/entry/filtering/plugins/searchableJsonFilterCreate.js.map +1 -0
- package/operations/entry/filtering/sort.d.ts +3 -3
- package/operations/entry/filtering/sort.js.map +1 -1
- package/operations/entry/filtering/systemFields.d.ts +1 -1
- package/operations/entry/filtering/systemFields.js.map +1 -1
- package/operations/entry/filtering/transform.d.ts +1 -1
- package/operations/entry/filtering/transform.js.map +1 -1
- package/operations/entry/filtering/types.d.ts +2 -2
- package/operations/entry/filtering/types.js.map +1 -1
- package/operations/entry/filtering/values.d.ts +1 -1
- package/operations/entry/filtering/values.js.map +1 -1
- package/operations/entry/index.js +1 -1
- package/operations/entry/index.js.map +1 -1
- package/operations/group/index.d.ts +3 -3
- package/operations/group/index.js.map +1 -1
- package/operations/model/index.d.ts +2 -2
- package/operations/model/index.js.map +1 -1
- package/operations/system/index.d.ts +2 -2
- package/operations/system/index.js.map +1 -1
- package/package.json +13 -11
- package/plugins/CmsEntryFieldFilterPathPlugin.d.ts +1 -1
- package/plugins/CmsEntryFieldFilterPathPlugin.js.map +1 -1
- package/plugins/CmsEntryFieldFilterPlugin.d.ts +3 -3
- package/plugins/CmsEntryFieldFilterPlugin.js.map +1 -1
- package/plugins/CmsEntryFieldSortingPlugin.d.ts +2 -2
- package/plugins/CmsEntryFieldSortingPlugin.js.map +1 -1
- package/plugins/CmsFieldFilterValueTransformPlugin.d.ts +1 -1
- package/plugins/CmsFieldFilterValueTransformPlugin.js.map +1 -1
- package/types.d.ts +6 -6
- package/types.js.map +1 -1
package/definitions/entry.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { Table } from "@webiny/db-dynamodb/toolbox";
|
|
2
|
+
import { Entity } from "@webiny/db-dynamodb/toolbox";
|
|
3
|
+
import type { Attributes } from "../types";
|
|
3
4
|
interface Params {
|
|
4
5
|
table: Table<string, string, string>;
|
|
5
6
|
entityName: string;
|
package/definitions/entry.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_toolbox","require","createEntryEntity","params","table","entityName","attributes","Entity","name","PK","type","partitionKey","SK","sortKey","GSI1_PK","GSI1_SK","TYPE","__type","webinyVersion","tenant","entryId","id","modelId","locale","revisionCreatedOn","revisionModifiedOn","revisionSavedOn","revisionDeletedOn","revisionRestoredOn","revisionFirstPublishedOn","revisionLastPublishedOn","revisionCreatedBy","revisionModifiedBy","revisionSavedBy","revisionDeletedBy","revisionRestoredBy","revisionFirstPublishedBy","revisionLastPublishedBy","createdOn","modifiedOn","savedOn","deletedOn","restoredOn","firstPublishedOn","lastPublishedOn","createdBy","modifiedBy","savedBy","deletedBy","restoredBy","firstPublishedBy","lastPublishedBy","ownedBy","publishedOn","version","locked","status","location","wbyDeleted","binOriginalFolderId","values","meta","exports"],"sources":["entry.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"names":["_toolbox","require","createEntryEntity","params","table","entityName","attributes","Entity","name","PK","type","partitionKey","SK","sortKey","GSI1_PK","GSI1_SK","TYPE","__type","webinyVersion","tenant","entryId","id","modelId","locale","revisionCreatedOn","revisionModifiedOn","revisionSavedOn","revisionDeletedOn","revisionRestoredOn","revisionFirstPublishedOn","revisionLastPublishedOn","revisionCreatedBy","revisionModifiedBy","revisionSavedBy","revisionDeletedBy","revisionRestoredBy","revisionFirstPublishedBy","revisionLastPublishedBy","createdOn","modifiedOn","savedOn","deletedOn","restoredOn","firstPublishedOn","lastPublishedOn","createdBy","modifiedBy","savedBy","deletedBy","restoredBy","firstPublishedBy","lastPublishedBy","ownedBy","publishedOn","version","locked","status","location","wbyDeleted","binOriginalFolderId","values","meta","exports"],"sources":["entry.ts"],"sourcesContent":["import type { Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { Entity } from \"@webiny/db-dynamodb/toolbox\";\nimport type { Attributes } from \"~/types\";\n\ninterface Params {\n table: Table<string, string, string>;\n entityName: string;\n attributes: Attributes;\n}\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 modelId: {\n type: \"string\"\n },\n locale: {\n type: \"string\"\n },\n\n /**\n * Revision-level meta fields. 👇\n */\n revisionCreatedOn: { type: \"string\" },\n revisionModifiedOn: { type: \"string\" },\n revisionSavedOn: { type: \"string\" },\n revisionDeletedOn: { type: \"string\" },\n revisionRestoredOn: { type: \"string\" },\n revisionFirstPublishedOn: { type: \"string\" },\n revisionLastPublishedOn: { type: \"string\" },\n revisionCreatedBy: { type: \"map\" },\n revisionModifiedBy: { type: \"map\" },\n revisionSavedBy: { type: \"map\" },\n revisionDeletedBy: { type: \"map\" },\n revisionRestoredBy: { type: \"map\" },\n revisionFirstPublishedBy: { type: \"map\" },\n revisionLastPublishedBy: { type: \"map\" },\n\n /**\n * Entry-level meta fields. 👇\n */\n createdOn: { type: \"string\" },\n modifiedOn: { type: \"string\" },\n savedOn: { type: \"string\" },\n deletedOn: { type: \"string\" },\n restoredOn: { type: \"string\" },\n firstPublishedOn: { type: \"string\" },\n lastPublishedOn: { type: \"string\" },\n createdBy: { type: \"map\" },\n modifiedBy: { type: \"map\" },\n savedBy: { type: \"map\" },\n deletedBy: { type: \"map\" },\n restoredBy: { type: \"map\" },\n firstPublishedBy: { type: \"map\" },\n lastPublishedBy: { type: \"map\" },\n\n /**\n * Deprecated fields. 👇\n */\n ownedBy: {\n type: \"map\"\n },\n publishedOn: {\n type: \"string\"\n },\n\n /**\n * The rest. 👇\n */\n version: {\n type: \"number\"\n },\n locked: {\n type: \"boolean\"\n },\n status: {\n type: \"string\"\n },\n location: {\n type: \"map\"\n },\n wbyDeleted: {\n type: \"boolean\"\n },\n binOriginalFolderId: {\n type: \"string\"\n },\n values: {\n type: \"map\"\n },\n meta: {\n type: \"map\"\n },\n ...(attributes || {})\n }\n });\n};\n"],"mappings":";;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AASO,MAAMC,iBAAiB,GAAIC,MAAc,IAAkB;EAC9D,MAAM;IAAEC,KAAK;IAAEC,UAAU;IAAEC;EAAW,CAAC,GAAGH,MAAM;EAChD,OAAO,IAAII,eAAM,CAAC;IACdC,IAAI,EAAEH,UAAU;IAChBD,KAAK;IACLE,UAAU,EAAE;MACRG,EAAE,EAAE;QACAC,IAAI,EAAE,QAAQ;QACdC,YAAY,EAAE;MAClB,CAAC;MACDC,EAAE,EAAE;QACAF,IAAI,EAAE,QAAQ;QACdG,OAAO,EAAE;MACb,CAAC;MACDC,OAAO,EAAE;QACLJ,IAAI,EA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,CAAC;MACDmD,IAAI,EAAE;QACFnD,IAAI,EAAE;MACV,CAAC;MACD,IAAIJ,UAAU,IAAI,CAAC,CAAC;IACxB;EACJ,CAAC,CAAC;AACN,CAAC;AAACwD,OAAA,CAAA5D,iBAAA,GAAAA,iBAAA","ignoreList":[]}
|
package/definitions/group.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { Table } from "@webiny/db-dynamodb/toolbox";
|
|
2
|
+
import { Entity } from "@webiny/db-dynamodb/toolbox";
|
|
3
|
+
import type { Attributes } from "../types";
|
|
3
4
|
interface Params {
|
|
4
5
|
table: Table<string, string, string>;
|
|
5
6
|
entityName: string;
|
package/definitions/group.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_toolbox","require","createGroupEntity","params","table","attributes","entityName","Entity","name","PK","partitionKey","SK","sortKey","TYPE","type","webinyVersion","id","slug","locale","description","icon","createdBy","createdOn","savedOn","tenant","exports"],"sources":["group.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"names":["_toolbox","require","createGroupEntity","params","table","attributes","entityName","Entity","name","PK","partitionKey","SK","sortKey","TYPE","type","webinyVersion","id","slug","locale","description","icon","createdBy","createdOn","savedOn","tenant","exports"],"sources":["group.ts"],"sourcesContent":["import type { Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { Entity } from \"@webiny/db-dynamodb/toolbox\";\nimport type { Attributes } from \"~/types\";\n\ninterface Params {\n table: Table<string, string, string>;\n entityName: string;\n attributes: Attributes;\n}\nexport const createGroupEntity = (params: Params): Entity<any> => {\n const { table, attributes, entityName } = params;\n return new Entity({\n name: entityName,\n table,\n attributes: {\n PK: {\n partitionKey: true\n },\n SK: {\n sortKey: true\n },\n TYPE: {\n type: \"string\"\n },\n webinyVersion: {\n type: \"string\"\n },\n id: {\n type: \"string\"\n },\n name: {\n type: \"string\"\n },\n slug: {\n type: \"string\"\n },\n locale: {\n type: \"string\"\n },\n description: {\n type: \"string\"\n },\n icon: {\n type: \"string\"\n },\n\n createdBy: {\n type: \"map\"\n },\n createdOn: {\n type: \"string\"\n },\n savedOn: {\n type: \"string\"\n },\n tenant: {\n type: \"string\"\n },\n ...(attributes || {})\n }\n });\n};\n"],"mappings":";;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AAQO,MAAMC,iBAAiB,GAAIC,MAAc,IAAkB;EAC9D,MAAM;IAAEC,KAAK;IAAEC,UAAU;IAAEC;EAAW,CAAC,GAAGH,MAAM;EAChD,OAAO,IAAII,eAAM,CAAC;IACdC,IAAI,EAAEF,UAAU;IAChBF,KAAK;IACLC,UAAU,EAAE;MACRI,EAAE,EAAE;QACAC,YAAY,EAAE;MAClB,CAAC;MACDC,EAAE,EAAE;QACAC,OAAO,EAAE;MACb,CAAC;MACDC,IAAI,EAAE;QACFC,IAAI,EAAE;MACV,CAAC;MACDC,aAAa,EAAE;QACXD,IAAI,EAAE;MACV,CAAC;MACDE,EAAE,EAAE;QACAF,IAAI,EAAE;MACV,CAAC;MACDN,IAAI,EAAE;QACFM,IAAI,EAAE;MACV,CAAC;MACDG,IAAI,EAAE;QACFH,IAAI,EAAE;MACV,CAAC;MACDI,MAAM,EAAE;QACJJ,IAAI,EAAE;MACV,CAAC;MACDK,WAAW,EAAE;QACTL,IAAI,EAAE;MACV,CAAC;MACDM,IAAI,EAAE;QACFN,IAAI,EAAE;MACV,CAAC;MAEDO,SAAS,EAAE;QACPP,IAAI,EAAE;MACV,CAAC;MACDQ,SAAS,EAAE;QACPR,IAAI,EAAE;MACV,CAAC;MACDS,OAAO,EAAE;QACLT,IAAI,EAAE;MACV,CAAC;MACDU,MAAM,EAAE;QACJV,IAAI,EAAE;MACV,CAAC;MACD,IAAIT,UAAU,IAAI,CAAC,CAAC;IACxB;EACJ,CAAC,CAAC;AACN,CAAC;AAACoB,OAAA,CAAAvB,iBAAA,GAAAA,iBAAA","ignoreList":[]}
|
package/definitions/model.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { Table } from "@webiny/db-dynamodb/toolbox";
|
|
2
|
+
import { Entity } from "@webiny/db-dynamodb/toolbox";
|
|
3
|
+
import type { Attributes } from "../types";
|
|
3
4
|
interface Params {
|
|
4
5
|
table: Table<string, string, string>;
|
|
5
6
|
entityName: string;
|
package/definitions/model.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_toolbox","require","createModelEntity","params","table","attributes","entityName","Entity","name","PK","partitionKey","SK","sortKey","TYPE","type","required","webinyVersion","modelId","singularApiName","pluralApiName","locale","group","icon","description","createdOn","savedOn","createdBy","fields","layout","tags","default","lockedFields","titleFieldId","descriptionFieldId","imageFieldId","tenant","exports"],"sources":["model.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"names":["_toolbox","require","createModelEntity","params","table","attributes","entityName","Entity","name","PK","partitionKey","SK","sortKey","TYPE","type","required","webinyVersion","modelId","singularApiName","pluralApiName","locale","group","icon","description","createdOn","savedOn","createdBy","fields","layout","tags","default","lockedFields","titleFieldId","descriptionFieldId","imageFieldId","tenant","exports"],"sources":["model.ts"],"sourcesContent":["import type { Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { Entity } from \"@webiny/db-dynamodb/toolbox\";\nimport type { Attributes } from \"~/types\";\n\ninterface Params {\n table: Table<string, string, string>;\n entityName: string;\n attributes: Attributes;\n}\n\nexport const createModelEntity = (params: Params): Entity<any> => {\n const { table, attributes, entityName } = params;\n return new Entity({\n name: entityName,\n table,\n attributes: {\n PK: {\n partitionKey: true\n },\n SK: {\n sortKey: true\n },\n TYPE: {\n type: \"string\",\n required: true\n },\n webinyVersion: {\n type: \"string\",\n required: true\n },\n name: {\n type: \"string\",\n required: true\n },\n modelId: {\n type: \"string\",\n required: true\n },\n singularApiName: {\n type: \"string\",\n required: true\n },\n pluralApiName: {\n type: \"string\",\n required: true\n },\n locale: {\n type: \"string\",\n required: true\n },\n group: {\n type: \"map\",\n required: true\n },\n icon: {\n type: \"string\"\n },\n description: {\n type: \"string\"\n },\n createdOn: {\n type: \"string\",\n required: true\n },\n savedOn: {\n type: \"string\",\n required: true\n },\n createdBy: {\n type: \"map\",\n required: true\n },\n fields: {\n type: \"list\",\n required: true\n },\n layout: {\n type: \"list\",\n required: true\n },\n tags: {\n type: \"list\",\n required: false,\n default: []\n },\n lockedFields: {\n type: \"list\",\n required: true\n },\n titleFieldId: {\n type: \"string\"\n },\n descriptionFieldId: {\n type: \"string\"\n },\n imageFieldId: {\n type: \"string\"\n },\n tenant: {\n type: \"string\",\n required: true\n },\n ...(attributes || {})\n }\n });\n};\n"],"mappings":";;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AASO,MAAMC,iBAAiB,GAAIC,MAAc,IAAkB;EAC9D,MAAM;IAAEC,KAAK;IAAEC,UAAU;IAAEC;EAAW,CAAC,GAAGH,MAAM;EAChD,OAAO,IAAII,eAAM,CAAC;IACdC,IAAI,EAAEF,UAAU;IAChBF,KAAK;IACLC,UAAU,EAAE;MACRI,EAAE,EAAE;QACAC,YAAY,EAAE;MAClB,CAAC;MACDC,EAAE,EAAE;QACAC,OAAO,EAAE;MACb,CAAC;MACDC,IAAI,EAAE;QACFC,IAAI,EAAE,QAAQ;QACdC,QAAQ,EAAE;MACd,CAAC;MACDC,aAAa,EAAE;QACXF,IAAI,EAAE,QAAQ;QACdC,QAAQ,EAAE;MACd,CAAC;MACDP,IAAI,EAAE;QACFM,IAAI,EAAE,QAAQ;QACdC,QAAQ,EAAE;MACd,CAAC;MACDE,OAAO,EAAE;QACLH,IAAI,EAAE,QAAQ;QACdC,QAAQ,EAAE;MACd,CAAC;MACDG,eAAe,EAAE;QACbJ,IAAI,EAAE,QAAQ;QACdC,QAAQ,EAAE;MACd,CAAC;MACDI,aAAa,EAAE;QACXL,IAAI,EAAE,QAAQ;QACdC,QAAQ,EAAE;MACd,CAAC;MACDK,MAAM,EAAE;QACJN,IAAI,EAAE,QAAQ;QACdC,QAAQ,EAAE;MACd,CAAC;MACDM,KAAK,EAAE;QACHP,IAAI,EAAE,KAAK;QACXC,QAAQ,EAAE;MACd,CAAC;MACDO,IAAI,EAAE;QACFR,IAAI,EAAE;MACV,CAAC;MACDS,WAAW,EAAE;QACTT,IAAI,EAAE;MACV,CAAC;MACDU,SAAS,EAAE;QACPV,IAAI,EAAE,QAAQ;QACdC,QAAQ,EAAE;MACd,CAAC;MACDU,OAAO,EAAE;QACLX,IAAI,EAAE,QAAQ;QACdC,QAAQ,EAAE;MACd,CAAC;MACDW,SAAS,EAAE;QACPZ,IAAI,EAAE,KAAK;QACXC,QAAQ,EAAE;MACd,CAAC;MACDY,MAAM,EAAE;QACJb,IAAI,EAAE,MAAM;QACZC,QAAQ,EAAE;MACd,CAAC;MACDa,MAAM,EAAE;QACJd,IAAI,EAAE,MAAM;QACZC,QAAQ,EAAE;MACd,CAAC;MACDc,IAAI,EAAE;QACFf,IAAI,EAAE,MAAM;QACZC,QAAQ,EAAE,KAAK;QACfe,OAAO,EAAE;MACb,CAAC;MACDC,YAAY,EAAE;QACVjB,IAAI,EAAE,MAAM;QACZC,QAAQ,EAAE;MACd,CAAC;MACDiB,YAAY,EAAE;QACVlB,IAAI,EAAE;MACV,CAAC;MACDmB,kBAAkB,EAAE;QAChBnB,IAAI,EAAE;MACV,CAAC;MACDoB,YAAY,EAAE;QACVpB,IAAI,EAAE;MACV,CAAC;MACDqB,MAAM,EAAE;QACJrB,IAAI,EAAE,QAAQ;QACdC,QAAQ,EAAE;MACd,CAAC;MACD,IAAIV,UAAU,IAAI,CAAC,CAAC;IACxB;EACJ,CAAC,CAAC;AACN,CAAC;AAAC+B,OAAA,CAAAlC,iBAAA,GAAAA,iBAAA","ignoreList":[]}
|
package/definitions/system.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { Table } from "@webiny/db-dynamodb/toolbox";
|
|
2
|
+
import { Entity } from "@webiny/db-dynamodb/toolbox";
|
|
3
|
+
import type { Attributes } from "../types";
|
|
3
4
|
interface Params {
|
|
4
5
|
table: Table<string, string, string>;
|
|
5
6
|
entityName: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_toolbox","require","createSystemEntity","params","entityName","attributes","table","Entity","name","PK","partitionKey","SK","sortKey","version","type","locale","tenant","readAPIKey","exports"],"sources":["system.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"names":["_toolbox","require","createSystemEntity","params","entityName","attributes","table","Entity","name","PK","partitionKey","SK","sortKey","version","type","locale","tenant","readAPIKey","exports"],"sources":["system.ts"],"sourcesContent":["import type { Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { Entity } from \"@webiny/db-dynamodb/toolbox\";\nimport type { Attributes } from \"~/types\";\n\ninterface Params {\n table: Table<string, string, string>;\n entityName: string;\n attributes: Attributes;\n}\n\nexport const createSystemEntity = (params: Params): Entity<any> => {\n const { entityName, attributes, table } = params;\n return new Entity({\n name: entityName,\n table,\n attributes: {\n PK: {\n partitionKey: true\n },\n SK: {\n sortKey: true\n },\n version: {\n type: \"string\"\n },\n locale: {\n type: \"string\"\n },\n tenant: {\n type: \"string\"\n },\n readAPIKey: {\n type: \"string\"\n },\n ...(attributes || {})\n }\n });\n};\n"],"mappings":";;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AASO,MAAMC,kBAAkB,GAAIC,MAAc,IAAkB;EAC/D,MAAM;IAAEC,UAAU;IAAEC,UAAU;IAAEC;EAAM,CAAC,GAAGH,MAAM;EAChD,OAAO,IAAII,eAAM,CAAC;IACdC,IAAI,EAAEJ,UAAU;IAChBE,KAAK;IACLD,UAAU,EAAE;MACRI,EAAE,EAAE;QACAC,YAAY,EAAE;MAClB,CAAC;MACDC,EAAE,EAAE;QACAC,OAAO,EAAE;MACb,CAAC;MACDC,OAAO,EAAE;QACLC,IAAI,EAAE;MACV,CAAC;MACDC,MAAM,EAAE;QACJD,IAAI,EAAE;MACV,CAAC;MACDE,MAAM,EAAE;QACJF,IAAI,EAAE;MACV,CAAC;MACDG,UAAU,EAAE;QACRH,IAAI,EAAE;MACV,CAAC;MACD,IAAIT,UAAU,IAAI,CAAC,CAAC;IACxB;EACJ,CAAC,CAAC;AACN,CAAC;AAACa,OAAA,CAAAhB,kBAAA,GAAAA,kBAAA","ignoreList":[]}
|
package/definitions/table.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { TableModifier } from "../types";
|
|
2
|
-
import { DynamoDBDocument } from "@webiny/aws-sdk/client-dynamodb";
|
|
1
|
+
import type { TableModifier } from "../types";
|
|
2
|
+
import type { DynamoDBDocument } from "@webiny/aws-sdk/client-dynamodb";
|
|
3
3
|
import { Table } from "@webiny/db-dynamodb/toolbox";
|
|
4
4
|
interface Params {
|
|
5
5
|
table?: TableModifier;
|
package/definitions/table.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_toolbox","require","createTable","table","documentClient","tableConfig","name","process","env","DB_TABLE_HEADLESS_CMS","DB_TABLE","partitionKey","sortKey","DocumentClient","indexes","GSI1","autoExecute","autoParse","config","Table","exports"],"sources":["table.ts"],"sourcesContent":["import { TableModifier } from \"~/types\";\nimport { DynamoDBDocument } from \"@webiny/aws-sdk/client-dynamodb\";\nimport { Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { TableConstructor } from \"@webiny/db-dynamodb/toolbox\";\n\ninterface Params {\n table?: TableModifier;\n documentClient: DynamoDBDocument;\n}\nexport const createTable = ({ table, documentClient }: Params): Table<string, string, string> => {\n const tableConfig: TableConstructor<string, string, string> = {\n name: process.env.DB_TABLE_HEADLESS_CMS || (process.env.DB_TABLE as string),\n partitionKey: \"PK\",\n sortKey: \"SK\",\n DocumentClient: documentClient,\n indexes: {\n GSI1: {\n partitionKey: \"GSI1_PK\",\n sortKey: \"GSI1_SK\"\n }\n },\n autoExecute: true,\n autoParse: true\n };\n\n const config = typeof table === \"function\" ? table(tableConfig) : tableConfig;\n\n return new Table(config);\n};\n"],"mappings":";;;;;;AAEA,IAAAA,QAAA,GAAAC,OAAA;AAOO,MAAMC,WAAW,GAAGA,CAAC;EAAEC,KAAK;EAAEC;AAAuB,CAAC,KAAoC;EAC7F,MAAMC,WAAqD,GAAG;IAC1DC,IAAI,EAAEC,OAAO,CAACC,GAAG,CAACC,qBAAqB,IAAKF,OAAO,CAACC,GAAG,CAACE,QAAmB;IAC3EC,YAAY,EAAE,IAAI;IAClBC,OAAO,EAAE,IAAI;IACbC,cAAc,EAAET,cAAc;IAC9BU,OAAO,EAAE;MACLC,IAAI,EAAE;QACFJ,YAAY,EAAE,SAAS;QACvBC,OAAO,EAAE;MACb;IACJ,CAAC;IACDI,WAAW,EAAE,IAAI;IACjBC,SAAS,EAAE;EACf,CAAC;EAED,MAAMC,MAAM,GAAG,OAAOf,KAAK,KAAK,UAAU,GAAGA,KAAK,CAACE,WAAW,CAAC,GAAGA,WAAW;EAE7E,OAAO,IAAIc,cAAK,CAACD,MAAM,CAAC;AAC5B,CAAC;AAACE,OAAA,CAAAlB,WAAA,GAAAA,WAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_toolbox","require","createTable","table","documentClient","tableConfig","name","process","env","DB_TABLE_HEADLESS_CMS","DB_TABLE","partitionKey","sortKey","DocumentClient","indexes","GSI1","autoExecute","autoParse","config","Table","exports"],"sources":["table.ts"],"sourcesContent":["import type { TableModifier } from \"~/types\";\nimport type { DynamoDBDocument } from \"@webiny/aws-sdk/client-dynamodb\";\nimport { Table } from \"@webiny/db-dynamodb/toolbox\";\nimport type { TableConstructor } from \"@webiny/db-dynamodb/toolbox\";\n\ninterface Params {\n table?: TableModifier;\n documentClient: DynamoDBDocument;\n}\nexport const createTable = ({ table, documentClient }: Params): Table<string, string, string> => {\n const tableConfig: TableConstructor<string, string, string> = {\n name: process.env.DB_TABLE_HEADLESS_CMS || (process.env.DB_TABLE as string),\n partitionKey: \"PK\",\n sortKey: \"SK\",\n DocumentClient: documentClient,\n indexes: {\n GSI1: {\n partitionKey: \"GSI1_PK\",\n sortKey: \"GSI1_SK\"\n }\n },\n autoExecute: true,\n autoParse: true\n };\n\n const config = typeof table === \"function\" ? table(tableConfig) : tableConfig;\n\n return new Table(config);\n};\n"],"mappings":";;;;;;AAEA,IAAAA,QAAA,GAAAC,OAAA;AAOO,MAAMC,WAAW,GAAGA,CAAC;EAAEC,KAAK;EAAEC;AAAuB,CAAC,KAAoC;EAC7F,MAAMC,WAAqD,GAAG;IAC1DC,IAAI,EAAEC,OAAO,CAACC,GAAG,CAACC,qBAAqB,IAAKF,OAAO,CAACC,GAAG,CAACE,QAAmB;IAC3EC,YAAY,EAAE,IAAI;IAClBC,OAAO,EAAE,IAAI;IACbC,cAAc,EAAET,cAAc;IAC9BU,OAAO,EAAE;MACLC,IAAI,EAAE;QACFJ,YAAY,EAAE,SAAS;QACvBC,OAAO,EAAE;MACb;IACJ,CAAC;IACDI,WAAW,EAAE,IAAI;IACjBC,SAAS,EAAE;EACf,CAAC;EAED,MAAMC,MAAM,GAAG,OAAOf,KAAK,KAAK,UAAU,GAAGA,KAAK,CAACE,WAAW,CAAC,GAAGA,WAAW;EAE7E,OAAO,IAAIc,cAAK,CAACD,MAAM,CAAC;AAC5B,CAAC;AAACE,OAAA,CAAAlB,WAAA,GAAAA,WAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_error","_interopRequireDefault","require","_CmsEntryFieldFilterPathPlugin","createPath","field","path","settings","WebinyError","createLocationFolderIdPathPlugin","CmsEntryFieldFilterPathPlugin","fieldType","canUse","parents","fieldId","length","exports"],"sources":["locationFolderId.ts"],"sourcesContent":["/**\n * File is @internal\n */\nimport WebinyError from \"@webiny/error\";\nimport {\
|
|
1
|
+
{"version":3,"names":["_error","_interopRequireDefault","require","_CmsEntryFieldFilterPathPlugin","createPath","field","path","settings","WebinyError","createLocationFolderIdPathPlugin","CmsEntryFieldFilterPathPlugin","fieldType","canUse","parents","fieldId","length","exports"],"sources":["locationFolderId.ts"],"sourcesContent":["/**\n * File is @internal\n */\nimport WebinyError from \"@webiny/error\";\nimport type { CreatePathCallable } from \"~/plugins/CmsEntryFieldFilterPathPlugin\";\nimport { CmsEntryFieldFilterPathPlugin } from \"~/plugins/CmsEntryFieldFilterPathPlugin\";\n\nconst createPath: CreatePathCallable = ({ field }) => {\n const { path } = field.settings || {};\n if (!path) {\n throw new WebinyError(\"Missing path settings value.\", \"FIELD_SETTINGS_ERROR\", {\n field\n });\n }\n return path;\n};\n\nexport const createLocationFolderIdPathPlugin = (): CmsEntryFieldFilterPathPlugin => {\n return new CmsEntryFieldFilterPathPlugin({\n fieldType: \"text\",\n path: createPath,\n canUse: (field, parents) => {\n if (field.fieldId !== \"folderId\") {\n return false;\n } else if (!parents?.length) {\n return false;\n }\n return parents[0] === \"wbyAco_location\";\n }\n });\n};\n"],"mappings":";;;;;;;AAGA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,8BAAA,GAAAD,OAAA;AALA;AACA;AACA;;AAKA,MAAME,UAA8B,GAAGA,CAAC;EAAEC;AAAM,CAAC,KAAK;EAClD,MAAM;IAAEC;EAAK,CAAC,GAAGD,KAAK,CAACE,QAAQ,IAAI,CAAC,CAAC;EACrC,IAAI,CAACD,IAAI,EAAE;IACP,MAAM,IAAIE,cAAW,CAAC,8BAA8B,EAAE,sBAAsB,EAAE;MAC1EH;IACJ,CAAC,CAAC;EACN;EACA,OAAOC,IAAI;AACf,CAAC;AAEM,MAAMG,gCAAgC,GAAGA,CAAA,KAAqC;EACjF,OAAO,IAAIC,4DAA6B,CAAC;IACrCC,SAAS,EAAE,MAAM;IACjBL,IAAI,EAAEF,UAAU;IAChBQ,MAAM,EAAEA,CAACP,KAAK,EAAEQ,OAAO,KAAK;MACxB,IAAIR,KAAK,CAACS,OAAO,KAAK,UAAU,EAAE;QAC9B,OAAO,KAAK;MAChB,CAAC,MAAM,IAAI,CAACD,OAAO,EAAEE,MAAM,EAAE;QACzB,OAAO,KAAK;MAChB;MACA,OAAOF,OAAO,CAAC,CAAC,CAAC,KAAK,iBAAiB;IAC3C;EACJ,CAAC,CAAC;AACN,CAAC;AAACG,OAAA,CAAAP,gCAAA,GAAAA,gCAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_error","_interopRequireDefault","require","_CmsEntryFieldFilterPathPlugin","createPath","field","path","settings","WebinyError","createPlainObjectPathPlugin","CmsEntryFieldFilterPathPlugin","fieldType","exports"],"sources":["plainObject.ts"],"sourcesContent":["/**\n * File is @internal\n */\nimport WebinyError from \"@webiny/error\";\nimport {\
|
|
1
|
+
{"version":3,"names":["_error","_interopRequireDefault","require","_CmsEntryFieldFilterPathPlugin","createPath","field","path","settings","WebinyError","createPlainObjectPathPlugin","CmsEntryFieldFilterPathPlugin","fieldType","exports"],"sources":["plainObject.ts"],"sourcesContent":["/**\n * File is @internal\n */\nimport WebinyError from \"@webiny/error\";\nimport type { CreatePathCallable } from \"~/plugins/CmsEntryFieldFilterPathPlugin\";\nimport { CmsEntryFieldFilterPathPlugin } from \"~/plugins/CmsEntryFieldFilterPathPlugin\";\n\nconst createPath: CreatePathCallable = ({ field }) => {\n const { path } = field.settings || {};\n if (!path) {\n throw new WebinyError(\"Missing path settings value.\", \"FIELD_SETTINGS_ERROR\", {\n field\n });\n }\n return path;\n};\n\nexport const createPlainObjectPathPlugin = (): CmsEntryFieldFilterPathPlugin => {\n return new CmsEntryFieldFilterPathPlugin({\n fieldType: \"plainObject\",\n path: createPath\n });\n};\n"],"mappings":";;;;;;;AAGA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,8BAAA,GAAAD,OAAA;AALA;AACA;AACA;;AAKA,MAAME,UAA8B,GAAGA,CAAC;EAAEC;AAAM,CAAC,KAAK;EAClD,MAAM;IAAEC;EAAK,CAAC,GAAGD,KAAK,CAACE,QAAQ,IAAI,CAAC,CAAC;EACrC,IAAI,CAACD,IAAI,EAAE;IACP,MAAM,IAAIE,cAAW,CAAC,8BAA8B,EAAE,sBAAsB,EAAE;MAC1EH;IACJ,CAAC,CAAC;EACN;EACA,OAAOC,IAAI;AACf,CAAC;AAEM,MAAMG,2BAA2B,GAAGA,CAAA,KAAqC;EAC5E,OAAO,IAAIC,4DAA6B,CAAC;IACrCC,SAAS,EAAE,aAAa;IACxBL,IAAI,EAAEF;EACV,CAAC,CAAC;AACN,CAAC;AAACQ,OAAA,CAAAH,2BAAA,GAAAA,2BAAA","ignoreList":[]}
|
|
@@ -33,14 +33,7 @@ const createRichTextStorageTransformPlugin = () => {
|
|
|
33
33
|
return storageValue;
|
|
34
34
|
}
|
|
35
35
|
try {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
// We must make sure the rich text value is an object.
|
|
39
|
-
// It is possible that it is a string if developers call the API with an already stringified value.
|
|
40
|
-
if (typeof uncompressed === "string") {
|
|
41
|
-
return JSON.parse(uncompressed);
|
|
42
|
-
}
|
|
43
|
-
return uncompressed;
|
|
36
|
+
return await compressor.getCompressor().decompress(storageValue);
|
|
44
37
|
} catch {
|
|
45
38
|
return storageValue;
|
|
46
39
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_error","_interopRequireDefault","require","_apiHeadlessCms","_api","createRichTextStorageTransformPlugin","StorageTransformPlugin","name","fieldType","fromStorage","field","value","storageValue","plugins","WebinyError","storageId","fieldId","compressor","oneByType","CompressorPlugin","type","ex","
|
|
1
|
+
{"version":3,"names":["_error","_interopRequireDefault","require","_apiHeadlessCms","_api","createRichTextStorageTransformPlugin","StorageTransformPlugin","name","fieldType","fromStorage","field","value","storageValue","plugins","WebinyError","storageId","fieldId","compressor","oneByType","CompressorPlugin","type","ex","getCompressor","decompress","toStorage","compress","exports"],"sources":["richText.ts"],"sourcesContent":["/**\n * File is @internal\n */\nimport WebinyError from \"@webiny/error\";\nimport { StorageTransformPlugin } from \"@webiny/api-headless-cms\";\nimport { CompressorPlugin } from \"@webiny/api\";\n\nexport const createRichTextStorageTransformPlugin = () => {\n return new StorageTransformPlugin({\n name: \"headless-cms.storage-transform.rich-text.default\",\n fieldType: \"rich-text\",\n fromStorage: async ({ field, value: storageValue, plugins }) => {\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.storageId}\" - ${field.fieldId}.`\n );\n }\n\n let compressor: CompressorPlugin;\n\n try {\n compressor = plugins.oneByType<CompressorPlugin>(CompressorPlugin.type);\n } catch (ex) {\n return storageValue;\n }\n\n try {\n return await compressor.getCompressor().decompress(storageValue);\n } catch {\n return storageValue;\n }\n },\n toStorage: async ({ value, plugins }) => {\n let compressor: CompressorPlugin;\n\n try {\n compressor = plugins.oneByType<CompressorPlugin>(CompressorPlugin.type);\n } catch (ex) {\n return value;\n }\n try {\n return await compressor.getCompressor().compress(value);\n } catch {\n return value;\n }\n }\n });\n};\n"],"mappings":";;;;;;;AAGA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,eAAA,GAAAD,OAAA;AACA,IAAAE,IAAA,GAAAF,OAAA;AALA;AACA;AACA;;AAKO,MAAMG,oCAAoC,GAAGA,CAAA,KAAM;EACtD,OAAO,IAAIC,sCAAsB,CAAC;IAC9BC,IAAI,EAAE,kDAAkD;IACxDC,SAAS,EAAE,WAAW;IACtBC,WAAW,EAAE,MAAAA,CAAO;MAAEC,KAAK;MAAEC,KAAK,EAAEC,YAAY;MAAEC;IAAQ,CAAC,KAAK;MAC5D,IAAI,CAACD,YAAY,EAAE;QACf,OAAOA,YAAY;MACvB,CAAC,MAAM,IAAI,OAAOA,YAAY,KAAK,QAAQ,EAAE;QACzC,MAAM,IAAIE,cAAW,CACjB,gFAAgFJ,KAAK,CAACK,SAAS,OAAOL,KAAK,CAACM,OAAO,GACvH,CAAC;MACL;MAEA,IAAIC,UAA4B;MAEhC,IAAI;QACAA,UAAU,GAAGJ,OAAO,CAACK,SAAS,CAAmBC,qBAAgB,CAACC,IAAI,CAAC;MAC3E,CAAC,CAAC,OAAOC,EAAE,EAAE;QACT,OAAOT,YAAY;MACvB;MAEA,IAAI;QACA,OAAO,MAAMK,UAAU,CAACK,aAAa,CAAC,CAAC,CAACC,UAAU,CAACX,YAAY,CAAC;MACpE,CAAC,CAAC,MAAM;QACJ,OAAOA,YAAY;MACvB;IACJ,CAAC;IACDY,SAAS,EAAE,MAAAA,CAAO;MAAEb,KAAK;MAAEE;IAAQ,CAAC,KAAK;MACrC,IAAII,UAA4B;MAEhC,IAAI;QACAA,UAAU,GAAGJ,OAAO,CAACK,SAAS,CAAmBC,qBAAgB,CAACC,IAAI,CAAC;MAC3E,CAAC,CAAC,OAAOC,EAAE,EAAE;QACT,OAAOV,KAAK;MAChB;MACA,IAAI;QACA,OAAO,MAAMM,UAAU,CAACK,aAAa,CAAC,CAAC,CAACG,QAAQ,CAACd,KAAK,CAAC;MAC3D,CAAC,CAAC,MAAM;QACJ,OAAOA,KAAK;MAChB;IACJ;EACJ,CAAC,CAAC;AACN,CAAC;AAACe,OAAA,CAAArB,oCAAA,GAAAA,oCAAA","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* File is @internal
|
|
3
3
|
*/
|
|
4
|
-
import { CmsFieldFilterValueTransformPlugin } from "../../types";
|
|
4
|
+
import type { CmsFieldFilterValueTransformPlugin } from "../../types";
|
|
5
5
|
export declare const createDatetimeTransformValuePlugin: () => CmsFieldFilterValueTransformPlugin;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_TimeTransformPlugin","require","_DateTimeTransformPlugin","timeTransformer","TimeTransformPlugin","fields","dateTimeTransformer","DateTimeTransformPlugin","createDatetimeTransformValuePlugin","type","name","fieldType","transform","field","value","settings","exports"],"sources":["datetime.ts"],"sourcesContent":["/**\n * File is @internal\n */\nimport { CmsFieldFilterValueTransformPlugin } from \"~/types\";\nimport { TimeTransformPlugin } from \"@webiny/db-dynamodb/plugins/definitions/TimeTransformPlugin\";\nimport { DateTimeTransformPlugin } from \"@webiny/db-dynamodb/plugins/definitions/DateTimeTransformPlugin\";\n\nconst timeTransformer = new TimeTransformPlugin({\n fields: [\"*\"]\n});\nconst dateTimeTransformer = new DateTimeTransformPlugin({\n fields: [\"*\"]\n});\n\nexport const createDatetimeTransformValuePlugin = (): CmsFieldFilterValueTransformPlugin => {\n return {\n type: \"cms-field-filter-value-transform\",\n name: \"cms-field-value-filter-transform-datetime\",\n fieldType: \"datetime\",\n /**\n * Always transform into the milliseconds.\n */\n transform: ({ field, value }) => {\n const { type } = field.settings || {};\n if (type === \"time\") {\n return timeTransformer.transform({\n value\n });\n }\n return dateTimeTransformer.transform({\n value\n });\n }\n };\n};\n"],"mappings":";;;;;;AAIA,IAAAA,oBAAA,GAAAC,OAAA;AACA,IAAAC,wBAAA,GAAAD,OAAA;AALA;AACA;AACA;;AAKA,MAAME,eAAe,GAAG,IAAIC,wCAAmB,CAAC;EAC5CC,MAAM,EAAE,CAAC,GAAG;AAChB,CAAC,CAAC;AACF,MAAMC,mBAAmB,GAAG,IAAIC,gDAAuB,CAAC;EACpDF,MAAM,EAAE,CAAC,GAAG;AAChB,CAAC,CAAC;AAEK,MAAMG,kCAAkC,GAAGA,CAAA,KAA0C;EACxF,OAAO;IACHC,IAAI,EAAE,kCAAkC;IACxCC,IAAI,EAAE,2CAA2C;IACjDC,SAAS,EAAE,UAAU;IACrB;AACR;AACA;IACQC,SAAS,EAAEA,CAAC;MAAEC,KAAK;MAAEC;IAAM,CAAC,KAAK;MAC7B,MAAM;QAAEL;MAAK,CAAC,GAAGI,KAAK,CAACE,QAAQ,IAAI,CAAC,CAAC;MACrC,IAAIN,IAAI,KAAK,MAAM,EAAE;QACjB,OAAON,eAAe,CAACS,SAAS,CAAC;UAC7BE;QACJ,CAAC,CAAC;MACN;MACA,OAAOR,mBAAmB,CAACM,SAAS,CAAC;QACjCE;MACJ,CAAC,CAAC;IACN;EACJ,CAAC;AACL,CAAC;AAACE,OAAA,CAAAR,kCAAA,GAAAA,kCAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_TimeTransformPlugin","require","_DateTimeTransformPlugin","timeTransformer","TimeTransformPlugin","fields","dateTimeTransformer","DateTimeTransformPlugin","createDatetimeTransformValuePlugin","type","name","fieldType","transform","field","value","settings","exports"],"sources":["datetime.ts"],"sourcesContent":["/**\n * File is @internal\n */\nimport type { CmsFieldFilterValueTransformPlugin } from \"~/types\";\nimport { TimeTransformPlugin } from \"@webiny/db-dynamodb/plugins/definitions/TimeTransformPlugin\";\nimport { DateTimeTransformPlugin } from \"@webiny/db-dynamodb/plugins/definitions/DateTimeTransformPlugin\";\n\nconst timeTransformer = new TimeTransformPlugin({\n fields: [\"*\"]\n});\nconst dateTimeTransformer = new DateTimeTransformPlugin({\n fields: [\"*\"]\n});\n\nexport const createDatetimeTransformValuePlugin = (): CmsFieldFilterValueTransformPlugin => {\n return {\n type: \"cms-field-filter-value-transform\",\n name: \"cms-field-value-filter-transform-datetime\",\n fieldType: \"datetime\",\n /**\n * Always transform into the milliseconds.\n */\n transform: ({ field, value }) => {\n const { type } = field.settings || {};\n if (type === \"time\") {\n return timeTransformer.transform({\n value\n });\n }\n return dateTimeTransformer.transform({\n value\n });\n }\n };\n};\n"],"mappings":";;;;;;AAIA,IAAAA,oBAAA,GAAAC,OAAA;AACA,IAAAC,wBAAA,GAAAD,OAAA;AALA;AACA;AACA;;AAKA,MAAME,eAAe,GAAG,IAAIC,wCAAmB,CAAC;EAC5CC,MAAM,EAAE,CAAC,GAAG;AAChB,CAAC,CAAC;AACF,MAAMC,mBAAmB,GAAG,IAAIC,gDAAuB,CAAC;EACpDF,MAAM,EAAE,CAAC,GAAG;AAChB,CAAC,CAAC;AAEK,MAAMG,kCAAkC,GAAGA,CAAA,KAA0C;EACxF,OAAO;IACHC,IAAI,EAAE,kCAAkC;IACxCC,IAAI,EAAE,2CAA2C;IACjDC,SAAS,EAAE,UAAU;IACrB;AACR;AACA;IACQC,SAAS,EAAEA,CAAC;MAAEC,KAAK;MAAEC;IAAM,CAAC,KAAK;MAC7B,MAAM;QAAEL;MAAK,CAAC,GAAGI,KAAK,CAACE,QAAQ,IAAI,CAAC,CAAC;MACrC,IAAIN,IAAI,KAAK,MAAM,EAAE;QACjB,OAAON,eAAe,CAACS,SAAS,CAAC;UAC7BE;QACJ,CAAC,CAAC;MACN;MACA,OAAOR,mBAAmB,CAACM,SAAS,CAAC;QACjCE;MACJ,CAAC,CAAC;IACN;EACJ,CAAC;AACL,CAAC;AAACE,OAAA,CAAAR,kCAAA,GAAAA,kCAAA","ignoreList":[]}
|
package/index.d.ts
CHANGED
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_filters","_interopRequireDefault","require","_dynamoDb","_types","_table","_system","_group","_model","_entry","_plugins","_system2","_group2","_model2","_entry2","_plugins2","_plugins3","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_ValueFilterPlugin","_apiHeadlessCms","_api","createStorageOperations","params","attributes","table","documentClient","plugins","userPlugins","tableInstance","createTable","entities","system","createSystemEntity","entityName","ENTITIES","SYSTEM","groups","createGroupEntity","GROUPS","models","createModelEntity","MODELS","entries","createEntryEntity","ENTRIES","PluginsContainer","dynamoDbValueFilters","dynamoDbPlugins","createFilterCreatePlugins","createEntriesStorageOperations","entity","name","beforeInit","context","types","CmsEntryFieldFilterPathPlugin","type","CmsFieldFilterValueTransformPlugin","CmsEntryFieldFilterPlugin","CmsEntryFieldSortingPlugin","ValueFilterPlugin","StorageOperationsCmsModelPlugin","StorageTransformPlugin","CompressorPlugin","mergeByType","register","dataLoaders","clearAll","getEntities","getTable","createSystemStorageOperations","createGroupsStorageOperations","createModelsStorageOperations"],"sources":["index.ts"],"sourcesContent":["import dynamoDbValueFilters from \"@webiny/db-dynamodb/plugins/filters\";\nimport dynamoDbPlugins from \"./dynamoDb\";\nimport {
|
|
1
|
+
{"version":3,"names":["_filters","_interopRequireDefault","require","_dynamoDb","_types","_table","_system","_group","_model","_entry","_plugins","_system2","_group2","_model2","_entry2","_plugins2","_plugins3","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_ValueFilterPlugin","_apiHeadlessCms","_api","createStorageOperations","params","attributes","table","documentClient","plugins","userPlugins","tableInstance","createTable","entities","system","createSystemEntity","entityName","ENTITIES","SYSTEM","groups","createGroupEntity","GROUPS","models","createModelEntity","MODELS","entries","createEntryEntity","ENTRIES","PluginsContainer","dynamoDbValueFilters","dynamoDbPlugins","createFilterCreatePlugins","createEntriesStorageOperations","entity","name","beforeInit","context","types","CmsEntryFieldFilterPathPlugin","type","CmsFieldFilterValueTransformPlugin","CmsEntryFieldFilterPlugin","CmsEntryFieldSortingPlugin","ValueFilterPlugin","StorageOperationsCmsModelPlugin","StorageTransformPlugin","CompressorPlugin","mergeByType","register","dataLoaders","clearAll","getEntities","getTable","createSystemStorageOperations","createGroupsStorageOperations","createModelsStorageOperations"],"sources":["index.ts"],"sourcesContent":["import dynamoDbValueFilters from \"@webiny/db-dynamodb/plugins/filters\";\nimport dynamoDbPlugins from \"./dynamoDb\";\nimport type { StorageOperationsFactory } from \"~/types\";\nimport { ENTITIES } from \"~/types\";\nimport { createTable } from \"~/definitions/table\";\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 { createGroupsStorageOperations } from \"~/operations/group\";\nimport { createModelsStorageOperations } from \"~/operations/model\";\nimport { createEntriesStorageOperations } from \"./operations/entry\";\n\nimport { createFilterCreatePlugins } from \"~/operations/entry/filtering/plugins\";\nimport {\n CmsEntryFieldFilterPathPlugin,\n CmsEntryFieldFilterPlugin,\n CmsEntryFieldSortingPlugin,\n CmsFieldFilterValueTransformPlugin\n} from \"~/plugins\";\nimport { ValueFilterPlugin } from \"@webiny/db-dynamodb/plugins/definitions/ValueFilterPlugin\";\nimport { StorageOperationsCmsModelPlugin, StorageTransformPlugin } from \"@webiny/api-headless-cms\";\nimport { CompressorPlugin } from \"@webiny/api\";\n\nexport * from \"./plugins\";\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 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 * DynamoDB filter plugins for the where conditions.\n */\n dynamoDbValueFilters(),\n /**\n * Field plugins for DynamoDB.\n */\n dynamoDbPlugins(),\n /**\n * Filter create plugins.\n */\n createFilterCreatePlugins(),\n /**\n * User defined custom plugins.\n */\n ...(userPlugins || [])\n ]);\n\n const entries = createEntriesStorageOperations({\n entity: entities.entries,\n plugins\n });\n\n return {\n name: \"dynamodb\",\n beforeInit: async context => {\n const types: string[] = [\n \"cms-model-field-to-graphql\",\n CmsEntryFieldFilterPathPlugin.type,\n CmsFieldFilterValueTransformPlugin.type,\n CmsEntryFieldFilterPlugin.type,\n CmsEntryFieldSortingPlugin.type,\n ValueFilterPlugin.type,\n StorageOperationsCmsModelPlugin.type,\n StorageTransformPlugin.type,\n CompressorPlugin.type\n ];\n /**\n * Collect all required plugins from parent context.\n */\n for (const type of types) {\n plugins.mergeByType(context.plugins, type);\n }\n /**\n * Pass the plugins to the parent context.\n */\n context.plugins.register([dynamoDbPlugins()]);\n\n entries.dataLoaders.clearAll();\n },\n getEntities: () => entities,\n getTable: () => tableInstance,\n system: createSystemStorageOperations({\n entity: entities.system\n }),\n groups: createGroupsStorageOperations({\n entity: entities.groups,\n plugins\n }),\n models: createModelsStorageOperations({\n entity: entities.models\n }),\n entries\n };\n};\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,QAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,SAAA,GAAAF,sBAAA,CAAAC,OAAA;AAEA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AACA,IAAAQ,QAAA,GAAAR,OAAA;AACA,IAAAS,QAAA,GAAAT,OAAA;AACA,IAAAU,OAAA,GAAAV,OAAA;AACA,IAAAW,OAAA,GAAAX,OAAA;AACA,IAAAY,OAAA,GAAAZ,OAAA;AAEA,IAAAa,SAAA,GAAAb,OAAA;AACA,IAAAc,SAAA,GAAAd,OAAA;AAUAe,MAAA,CAAAC,IAAA,CAAAF,SAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,SAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,O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sCAA6B,EAAC;MAClCpB,MAAM,EAAEpB,QAAQ,CAACC;IACrB,CAAC,CAAC;IACFK,MAAM,EAAE,IAAAmC,qCAA6B,EAAC;MAClCrB,MAAM,EAAEpB,QAAQ,CAACM,MAAM;MACvBV;IACJ,CAAC,CAAC;IACFa,MAAM,EAAE,IAAAiC,qCAA6B,EAAC;MAClCtB,MAAM,EAAEpB,QAAQ,CAACS;IACrB,CAAC,CAAC;IACFG;EACJ,CAAC;AACL,CAAC;AAAC5B,OAAA,CAAAO,uBAAA,GAAAA,uBAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["DataLoaderCache","cache","getDataLoader","params","key","createKey","setDataLoader","dataLoader","clearAll","current","name","startsWith","tenant","locale","exports"],"sources":["DataLoaderCache.ts"],"sourcesContent":["import DataLoader from \"dataloader\";\n\nexport interface CacheKeyParams {\n name: string;\n tenant: string;\n locale: string;\n}\n\nexport interface ClearAllParams {\n tenant: string;\n locale: string;\n}\n\nexport class DataLoaderCache {\n private readonly cache: Record<string, DataLoader<any, any>> = {};\n\n public getDataLoader<I = any, R = any>(params: CacheKeyParams): DataLoader<I, R> | null {\n const key = this.createKey(params);\n\n return this.cache[key] || null;\n }\n\n public setDataLoader(params: CacheKeyParams, dataLoader: DataLoader<any, any>): void {\n const key = this.createKey(params);\n this.cache[key] = dataLoader;\n }\n\n public clearAll(params?: ClearAllParams): void {\n if (!params) {\n for (const current in this.cache) {\n this.cache[current].clearAll();\n }\n return;\n }\n const key = this.createKey({\n ...params,\n name: \"\"\n });\n for (const current in this.cache) {\n if (current.startsWith(key) === false) {\n continue;\n }\n this.cache[current].clearAll();\n }\n }\n\n private createKey(params: CacheKeyParams): string {\n return `${params.tenant}_${params.locale}_${params.name}`;\n }\n}\n"],"mappings":";;;;;;AAaO,MAAMA,eAAe,CAAC;EACRC,KAAK,GAAyC,CAAC,CAAC;EAE1DC,aAAaA,CAAmBC,MAAsB,EAA2B;IACpF,MAAMC,GAAG,GAAG,IAAI,CAACC,SAAS,CAACF,MAAM,CAAC;IAElC,OAAO,IAAI,CAACF,KAAK,CAACG,GAAG,CAAC,IAAI,IAAI;EAClC;EAEOE,aAAaA,CAACH,MAAsB,EAAEI,UAAgC,EAAQ;IACjF,MAAMH,GAAG,GAAG,IAAI,CAACC,SAAS,CAACF,MAAM,CAAC;IAClC,IAAI,CAACF,KAAK,CAACG,GAAG,CAAC,GAAGG,UAAU;EAChC;EAEOC,QAAQA,CAACL,MAAuB,EAAQ;IAC3C,IAAI,CAACA,MAAM,EAAE;MACT,KAAK,MAAMM,OAAO,IAAI,IAAI,CAACR,KAAK,EAAE;QAC9B,IAAI,CAACA,KAAK,CAACQ,OAAO,CAAC,CAACD,QAAQ,CAAC,CAAC;MAClC;MACA;IACJ;IACA,MAAMJ,GAAG,GAAG,IAAI,CAACC,SAAS,CAAC;MACvB,GAAGF,MAAM;MACTO,IAAI,EAAE;IACV,CAAC,CAAC;IACF,KAAK,MAAMD,OAAO,IAAI,IAAI,CAACR,KAAK,EAAE;MAC9B,IAAIQ,OAAO,CAACE,UAAU,CAACP,GAAG,CAAC,KAAK,KAAK,EAAE;QACnC;MACJ;MACA,IAAI,CAACH,KAAK,CAACQ,OAAO,CAAC,CAACD,QAAQ,CAAC,CAAC;IAClC;EACJ;EAEQH,SAASA,CAACF,MAAsB,EAAU;IAC9C,OAAO,GAAGA,MAAM,CAACS,MAAM,IAAIT,MAAM,CAACU,MAAM,IAAIV,MAAM,CAACO,IAAI,EAAE;EAC7D;AACJ;AAACI,OAAA,CAAAd,eAAA,GAAAA,eAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["DataLoaderCache","cache","getDataLoader","params","key","createKey","setDataLoader","dataLoader","clearAll","current","name","startsWith","tenant","locale","exports"],"sources":["DataLoaderCache.ts"],"sourcesContent":["import type DataLoader from \"dataloader\";\n\nexport interface CacheKeyParams {\n name: string;\n tenant: string;\n locale: string;\n}\n\nexport interface ClearAllParams {\n tenant: string;\n locale: string;\n}\n\nexport class DataLoaderCache {\n private readonly cache: Record<string, DataLoader<any, any>> = {};\n\n public getDataLoader<I = any, R = any>(params: CacheKeyParams): DataLoader<I, R> | null {\n const key = this.createKey(params);\n\n return this.cache[key] || null;\n }\n\n public setDataLoader(params: CacheKeyParams, dataLoader: DataLoader<any, any>): void {\n const key = this.createKey(params);\n this.cache[key] = dataLoader;\n }\n\n public clearAll(params?: ClearAllParams): void {\n if (!params) {\n for (const current in this.cache) {\n this.cache[current].clearAll();\n }\n return;\n }\n const key = this.createKey({\n ...params,\n name: \"\"\n });\n for (const current in this.cache) {\n if (current.startsWith(key) === false) {\n continue;\n }\n this.cache[current].clearAll();\n }\n }\n\n private createKey(params: CacheKeyParams): string {\n return `${params.tenant}_${params.locale}_${params.name}`;\n }\n}\n"],"mappings":";;;;;;AAaO,MAAMA,eAAe,CAAC;EACRC,KAAK,GAAyC,CAAC,CAAC;EAE1DC,aAAaA,CAAmBC,MAAsB,EAA2B;IACpF,MAAMC,GAAG,GAAG,IAAI,CAACC,SAAS,CAACF,MAAM,CAAC;IAElC,OAAO,IAAI,CAACF,KAAK,CAACG,GAAG,CAAC,IAAI,IAAI;EAClC;EAEOE,aAAaA,CAACH,MAAsB,EAAEI,UAAgC,EAAQ;IACjF,MAAMH,GAAG,GAAG,IAAI,CAACC,SAAS,CAACF,MAAM,CAAC;IAClC,IAAI,CAACF,KAAK,CAACG,GAAG,CAAC,GAAGG,UAAU;EAChC;EAEOC,QAAQA,CAACL,MAAuB,EAAQ;IAC3C,IAAI,CAACA,MAAM,EAAE;MACT,KAAK,MAAMM,OAAO,IAAI,IAAI,CAACR,KAAK,EAAE;QAC9B,IAAI,CAACA,KAAK,CAACQ,OAAO,CAAC,CAACD,QAAQ,CAAC,CAAC;MAClC;MACA;IACJ;IACA,MAAMJ,GAAG,GAAG,IAAI,CAACC,SAAS,CAAC;MACvB,GAAGF,MAAM;MACTO,IAAI,EAAE;IACV,CAAC,CAAC;IACF,KAAK,MAAMD,OAAO,IAAI,IAAI,CAACR,KAAK,EAAE;MAC9B,IAAIQ,OAAO,CAACE,UAAU,CAACP,GAAG,CAAC,KAAK,KAAK,EAAE;QACnC;MACJ;MACA,IAAI,CAACH,KAAK,CAACQ,OAAO,CAAC,CAACD,QAAQ,CAAC,CAAC;IAClC;EACJ;EAEQH,SAASA,CAACF,MAAsB,EAAU;IAC9C,OAAO,GAAGA,MAAM,CAACS,MAAM,IAAIT,MAAM,CAACU,MAAM,IAAIV,MAAM,CAACO,IAAI,EAAE;EAC7D;AACJ;AAACI,OAAA,CAAAd,eAAA,GAAAA,eAAA","ignoreList":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import DataLoader from "dataloader";
|
|
2
|
-
import { CmsStorageEntry } from "@webiny/api-headless-cms/types";
|
|
3
|
-
import { DataLoaderParams } from "./types";
|
|
2
|
+
import type { CmsStorageEntry } from "@webiny/api-headless-cms/types";
|
|
3
|
+
import type { DataLoaderParams } from "./types";
|
|
4
4
|
export declare const createGetAllEntryRevisions: (params: DataLoaderParams) => DataLoader<string, CmsStorageEntry[], string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_dataloader","_interopRequireDefault","require","_query","_keys","_cleanup","_createBatchScheduleFn","createGetAllEntryRevisions","params","entity","locale","tenant","DataLoader","ids","results","id","queryAllParams","partitionKey","createPartitionKey","options","beginsWith","items","queryAll","cleanupItems","map","batchScheduleFn","createBatchScheduleFn","exports"],"sources":["getAllEntryRevisions.ts"],"sourcesContent":["import DataLoader from \"dataloader\";\nimport { CmsStorageEntry } from \"@webiny/api-headless-cms/types\";\nimport {
|
|
1
|
+
{"version":3,"names":["_dataloader","_interopRequireDefault","require","_query","_keys","_cleanup","_createBatchScheduleFn","createGetAllEntryRevisions","params","entity","locale","tenant","DataLoader","ids","results","id","queryAllParams","partitionKey","createPartitionKey","options","beginsWith","items","queryAll","cleanupItems","map","batchScheduleFn","createBatchScheduleFn","exports"],"sources":["getAllEntryRevisions.ts"],"sourcesContent":["import DataLoader from \"dataloader\";\nimport type { CmsStorageEntry } from \"@webiny/api-headless-cms/types\";\nimport type { QueryAllParams } from \"@webiny/db-dynamodb/utils/query\";\nimport { queryAll } from \"@webiny/db-dynamodb/utils/query\";\nimport { createPartitionKey } from \"~/operations/entry/keys\";\nimport { cleanupItems } from \"@webiny/db-dynamodb/utils/cleanup\";\nimport type { DataLoaderParams } from \"./types\";\nimport { createBatchScheduleFn } from \"./createBatchScheduleFn\";\n\nexport const createGetAllEntryRevisions = (params: DataLoaderParams) => {\n const { entity, locale, tenant } = params;\n return new DataLoader<string, CmsStorageEntry[]>(\n async (ids: readonly string[]) => {\n const results: Record<string, CmsStorageEntry[]> = {};\n for (const id of ids) {\n const queryAllParams: QueryAllParams = {\n entity,\n partitionKey: createPartitionKey({\n tenant,\n locale,\n id\n }),\n options: {\n beginsWith: \"REV#\"\n }\n };\n const items = await queryAll<CmsStorageEntry>(queryAllParams);\n results[id] = cleanupItems(entity, items);\n }\n\n return ids.map(id => {\n return results[id] || [];\n });\n },\n {\n batchScheduleFn: createBatchScheduleFn()\n }\n );\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAGA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAEA,IAAAI,sBAAA,GAAAJ,OAAA;AAEO,MAAMK,0BAA0B,GAAIC,MAAwB,IAAK;EACpE,MAAM;IAAEC,MAAM;IAAEC,MAAM;IAAEC;EAAO,CAAC,GAAGH,MAAM;EACzC,OAAO,IAAII,mBAAU,CACjB,MAAOC,GAAsB,IAAK;IAC9B,MAAMC,OAA0C,GAAG,CAAC,CAAC;IACrD,KAAK,MAAMC,EAAE,IAAIF,GAAG,EAAE;MAClB,MAAMG,cAA8B,GAAG;QACnCP,MAAM;QACNQ,YAAY,EAAE,IAAAC,wBAAkB,EAAC;UAC7BP,MAAM;UACND,MAAM;UACNK;QACJ,CAAC,CAAC;QACFI,OAAO,EAAE;UACLC,UAAU,EAAE;QAChB;MACJ,CAAC;MACD,MAAMC,KAAK,GAAG,MAAM,IAAAC,eAAQ,EAAkBN,cAAc,CAAC;MAC7DF,OAAO,CAACC,EAAE,CAAC,GAAG,IAAAQ,qBAAY,EAACd,MAAM,EAAEY,KAAK,CAAC;IAC7C;IAEA,OAAOR,GAAG,CAACW,GAAG,CAACT,EAAE,IAAI;MACjB,OAAOD,OAAO,CAACC,EAAE,CAAC,IAAI,EAAE;IAC5B,CAAC,CAAC;EACN,CAAC,EACD;IACIU,eAAe,EAAE,IAAAC,4CAAqB,EAAC;EAC3C,CACJ,CAAC;AACL,CAAC;AAACC,OAAA,CAAApB,0BAAA,GAAAA,0BAAA","ignoreList":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import DataLoader from "dataloader";
|
|
2
|
-
import { CmsStorageEntry } from "@webiny/api-headless-cms/types";
|
|
3
|
-
import { DataLoaderParams } from "./types";
|
|
2
|
+
import type { CmsStorageEntry } from "@webiny/api-headless-cms/types";
|
|
3
|
+
import type { DataLoaderParams } from "./types";
|
|
4
4
|
export declare const createGetLatestRevisionByEntryId: (params: DataLoaderParams) => DataLoader<string, CmsStorageEntry[], string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_dataloader","_interopRequireDefault","require","_dbDynamodb","_cleanup","_createBatchScheduleFn","_keys","_utils","createGetLatestRevisionByEntryId","params","entity","locale","tenant","latestKey","createLatestSortKey","DataLoader","ids","queries","reduce","collection","id","partitionKey","createPartitionKey","getBatch","PK","SK","records","batchReadAll","table","items","Object","values","cleanupItems","map","entryId","parseIdentifier","filter","item","batchScheduleFn","createBatchScheduleFn","exports"],"sources":["getLatestRevisionByEntryId.ts"],"sourcesContent":["import DataLoader from \"dataloader\";\nimport { batchReadAll } from \"@webiny/db-dynamodb\";\nimport { cleanupItems } from \"@webiny/db-dynamodb/utils/cleanup\";\nimport { CmsStorageEntry } from \"@webiny/api-headless-cms/types\";\nimport { createBatchScheduleFn } from \"./createBatchScheduleFn\";\nimport { createLatestSortKey, createPartitionKey } from \"~/operations/entry/keys\";\nimport { DataLoaderParams } from \"./types\";\nimport { parseIdentifier } from \"@webiny/utils\";\n\nexport const createGetLatestRevisionByEntryId = (params: DataLoaderParams) => {\n const { entity, locale, tenant } = params;\n\n const latestKey = createLatestSortKey();\n\n return new DataLoader<string, CmsStorageEntry[]>(\n async (ids: readonly string[]) => {\n const queries = ids.reduce<Record<string, any>>((collection, id) => {\n const partitionKey = createPartitionKey({\n tenant,\n locale,\n id\n });\n if (collection[partitionKey]) {\n return collection;\n }\n collection[partitionKey] = entity.getBatch({\n PK: partitionKey,\n SK: latestKey\n });\n return collection;\n }, {});\n\n const records = await batchReadAll<CmsStorageEntry>({\n table: entity.table,\n items: Object.values(queries)\n });\n const items = cleanupItems(entity, records);\n\n return ids.map(id => {\n const { id: entryId } = parseIdentifier(id);\n return items.filter(item => {\n return entryId === item.entryId;\n });\n });\n },\n {\n batchScheduleFn: createBatchScheduleFn()\n }\n );\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAEA,IAAAG,sBAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AAEA,IAAAK,MAAA,GAAAL,OAAA;AAEO,MAAMM,gCAAgC,GAAIC,MAAwB,IAAK;EAC1E,MAAM;IAAEC,MAAM;IAAEC,MAAM;IAAEC;EAAO,CAAC,GAAGH,MAAM;EAEzC,MAAMI,SAAS,GAAG,IAAAC,yBAAmB,EAAC,CAAC;EAEvC,OAAO,IAAIC,mBAAU,CACjB,MAAOC,GAAsB,IAAK;IAC9B,MAAMC,OAAO,GAAGD,GAAG,CAACE,MAAM,CAAsB,CAACC,UAAU,EAAEC,EAAE,KAAK;MAChE,MAAMC,YAAY,GAAG,IAAAC,wBAAkB,EAAC;QACpCV,MAAM;QACND,MAAM;QACNS;MACJ,CAAC,CAAC;MACF,IAAID,UAAU,CAACE,YAAY,CAAC,EAAE;QAC1B,OAAOF,UAAU;MACrB;MACAA,UAAU,CAACE,YAAY,CAAC,GAAGX,MAAM,CAACa,QAAQ,CAAC;QACvCC,EAAE,EAAEH,YAAY;QAChBI,EAAE,EAAEZ;MACR,CAAC,CAAC;MACF,OAAOM,UAAU;IACrB,CAAC,EAAE,CAAC,CAAC,CAAC;IAEN,MAAMO,OAAO,GAAG,MAAM,IAAAC,wBAAY,EAAkB;MAChDC,KAAK,EAAElB,MAAM,CAACkB,KAAK;MACnBC,KAAK,EAAEC,MAAM,CAACC,MAAM,CAACd,OAAO;IAChC,CAAC,CAAC;IACF,MAAMY,KAAK,GAAG,IAAAG,qBAAY,EAACtB,MAAM,EAAEgB,OAAO,CAAC;IAE3C,OAAOV,GAAG,CAACiB,GAAG,CAACb,EAAE,IAAI;MACjB,MAAM;QAAEA,EAAE,EAAEc;MAAQ,CAAC,GAAG,IAAAC,sBAAe,EAACf,EAAE,CAAC;MAC3C,OAAOS,KAAK,CAACO,MAAM,CAACC,IAAI,IAAI;QACxB,OAAOH,OAAO,KAAKG,IAAI,CAACH,OAAO;MACnC,CAAC,CAAC;IACN,CAAC,CAAC;EACN,CAAC,EACD;IACII,eAAe,EAAE,IAAAC,4CAAqB,EAAC;EAC3C,CACJ,CAAC;AACL,CAAC;AAACC,OAAA,CAAAhC,gCAAA,GAAAA,gCAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_dataloader","_interopRequireDefault","require","_dbDynamodb","_cleanup","_createBatchScheduleFn","_keys","_utils","createGetLatestRevisionByEntryId","params","entity","locale","tenant","latestKey","createLatestSortKey","DataLoader","ids","queries","reduce","collection","id","partitionKey","createPartitionKey","getBatch","PK","SK","records","batchReadAll","table","items","Object","values","cleanupItems","map","entryId","parseIdentifier","filter","item","batchScheduleFn","createBatchScheduleFn","exports"],"sources":["getLatestRevisionByEntryId.ts"],"sourcesContent":["import DataLoader from \"dataloader\";\nimport { batchReadAll } from \"@webiny/db-dynamodb\";\nimport { cleanupItems } from \"@webiny/db-dynamodb/utils/cleanup\";\nimport type { CmsStorageEntry } from \"@webiny/api-headless-cms/types\";\nimport { createBatchScheduleFn } from \"./createBatchScheduleFn\";\nimport { createLatestSortKey, createPartitionKey } from \"~/operations/entry/keys\";\nimport type { DataLoaderParams } from \"./types\";\nimport { parseIdentifier } from \"@webiny/utils\";\n\nexport const createGetLatestRevisionByEntryId = (params: DataLoaderParams) => {\n const { entity, locale, tenant } = params;\n\n const latestKey = createLatestSortKey();\n\n return new DataLoader<string, CmsStorageEntry[]>(\n async (ids: readonly string[]) => {\n const queries = ids.reduce<Record<string, any>>((collection, id) => {\n const partitionKey = createPartitionKey({\n tenant,\n locale,\n id\n });\n if (collection[partitionKey]) {\n return collection;\n }\n collection[partitionKey] = entity.getBatch({\n PK: partitionKey,\n SK: latestKey\n });\n return collection;\n }, {});\n\n const records = await batchReadAll<CmsStorageEntry>({\n table: entity.table,\n items: Object.values(queries)\n });\n const items = cleanupItems(entity, records);\n\n return ids.map(id => {\n const { id: entryId } = parseIdentifier(id);\n return items.filter(item => {\n return entryId === item.entryId;\n });\n });\n },\n {\n batchScheduleFn: createBatchScheduleFn()\n }\n );\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAEA,IAAAG,sBAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AAEA,IAAAK,MAAA,GAAAL,OAAA;AAEO,MAAMM,gCAAgC,GAAIC,MAAwB,IAAK;EAC1E,MAAM;IAAEC,MAAM;IAAEC,MAAM;IAAEC;EAAO,CAAC,GAAGH,MAAM;EAEzC,MAAMI,SAAS,GAAG,I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webiny/api-headless-cms/types";
|
|
3
|
-
import { DataLoaderParams } from "./types";
|
|
2
|
+
import type { CmsStorageEntry } from "@webiny/api-headless-cms/types";
|
|
3
|
+
import type { DataLoaderParams } from "./types";
|
|
4
4
|
export declare const createGetPublishedRevisionByEntryId: (params: DataLoaderParams) => DataLoader<string, CmsStorageEntry[], string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_dataloader","_interopRequireDefault","require","_dbDynamodb","_cleanup","_keys","_utils","_createBatchScheduleFn","createGetPublishedRevisionByEntryId","params","entity","locale","tenant","publishedKey","createPublishedSortKey","DataLoader","ids","queries","reduce","collection","id","partitionKey","createPartitionKey","getBatch","PK","SK","records","batchReadAll","table","items","Object","values","cleanupItems","map","entryId","parseIdentifier","filter","item","batchScheduleFn","createBatchScheduleFn","exports"],"sources":["getPublishedRevisionByEntryId.ts"],"sourcesContent":["import DataLoader from \"dataloader\";\nimport { batchReadAll } from \"@webiny/db-dynamodb\";\nimport { cleanupItems } from \"@webiny/db-dynamodb/utils/cleanup\";\nimport { CmsStorageEntry } from \"@webiny/api-headless-cms/types\";\nimport { createPartitionKey, createPublishedSortKey } from \"~/operations/entry/keys\";\nimport { DataLoaderParams } from \"./types\";\nimport { parseIdentifier } from \"@webiny/utils\";\nimport { createBatchScheduleFn } from \"./createBatchScheduleFn\";\n\nexport const createGetPublishedRevisionByEntryId = (params: DataLoaderParams) => {\n const { entity, locale, tenant } = params;\n\n const publishedKey = createPublishedSortKey();\n return new DataLoader<string, CmsStorageEntry[]>(\n async (ids: readonly string[]) => {\n const queries = ids.reduce<Record<string, ReturnType<typeof entity.getBatch>>>(\n (collection, id) => {\n const partitionKey = createPartitionKey({\n tenant,\n locale,\n id\n });\n if (collection[partitionKey]) {\n return collection;\n }\n collection[partitionKey] = entity.getBatch({\n PK: partitionKey,\n SK: publishedKey\n });\n return collection;\n },\n {}\n );\n\n const records = await batchReadAll<CmsStorageEntry>({\n table: entity.table,\n items: Object.values(queries)\n });\n const items = cleanupItems(entity, records);\n\n return ids.map(id => {\n const { id: entryId } = parseIdentifier(id);\n return items.filter(item => {\n return entryId === item.entryId;\n });\n });\n },\n {\n batchScheduleFn: createBatchScheduleFn()\n }\n );\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAEA,IAAAG,KAAA,GAAAH,OAAA;AAEA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,sBAAA,GAAAL,OAAA;AAEO,MAAMM,mCAAmC,GAAIC,MAAwB,IAAK;EAC7E,MAAM;IAAEC,MAAM;IAAEC,MAAM;IAAEC;EAAO,CAAC,GAAGH,MAAM;EAEzC,MAAMI,YAAY,GAAG,IAAAC,4BAAsB,EAAC,CAAC;EAC7C,OAAO,IAAIC,mBAAU,CACjB,MAAOC,GAAsB,IAAK;IAC9B,MAAMC,OAAO,GAAGD,GAAG,CAACE,MAAM,CACtB,CAACC,UAAU,EAAEC,EAAE,KAAK;MAChB,MAAMC,YAAY,GAAG,IAAAC,wBAAkB,EAAC;QACpCV,MAAM;QACND,MAAM;QACNS;MACJ,CAAC,CAAC;MACF,IAAID,UAAU,CAACE,YAAY,CAAC,EAAE;QAC1B,OAAOF,UAAU;MACrB;MACAA,UAAU,CAACE,YAAY,CAAC,GAAGX,MAAM,CAACa,QAAQ,CAAC;QACvCC,EAAE,EAAEH,YAAY;QAChBI,EAAE,EAAEZ;MACR,CAAC,CAAC;MACF,OAAOM,UAAU;IACrB,CAAC,EACD,CAAC,CACL,CAAC;IAED,MAAMO,OAAO,GAAG,MAAM,IAAAC,wBAAY,EAAkB;MAChDC,KAAK,EAAElB,MAAM,CAACkB,KAAK;MACnBC,KAAK,EAAEC,MAAM,CAACC,MAAM,CAACd,OAAO;IAChC,CAAC,CAAC;IACF,MAAMY,KAAK,GAAG,IAAAG,qBAAY,EAACtB,MAAM,EAAEgB,OAAO,CAAC;IAE3C,OAAOV,GAAG,CAACiB,GAAG,CAACb,EAAE,IAAI;MACjB,MAAM;QAAEA,EAAE,EAAEc;MAAQ,CAAC,GAAG,IAAAC,sBAAe,EAACf,EAAE,CAAC;MAC3C,OAAOS,KAAK,CAACO,MAAM,CAACC,IAAI,IAAI;QACxB,OAAOH,OAAO,KAAKG,IAAI,CAACH,OAAO;MACnC,CAAC,CAAC;IACN,CAAC,CAAC;EACN,CAAC,EACD;IACII,eAAe,EAAE,IAAAC,4CAAqB,EAAC;EAC3C,CACJ,CAAC;AACL,CAAC;AAACC,OAAA,CAAAhC,mCAAA,GAAAA,mCAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_dataloader","_interopRequireDefault","require","_dbDynamodb","_cleanup","_keys","_utils","_createBatchScheduleFn","createGetPublishedRevisionByEntryId","params","entity","locale","tenant","publishedKey","createPublishedSortKey","DataLoader","ids","queries","reduce","collection","id","partitionKey","createPartitionKey","getBatch","PK","SK","records","batchReadAll","table","items","Object","values","cleanupItems","map","entryId","parseIdentifier","filter","item","batchScheduleFn","createBatchScheduleFn","exports"],"sources":["getPublishedRevisionByEntryId.ts"],"sourcesContent":["import DataLoader from \"dataloader\";\nimport { batchReadAll } from \"@webiny/db-dynamodb\";\nimport { cleanupItems } from \"@webiny/db-dynamodb/utils/cleanup\";\nimport type { CmsStorageEntry } from \"@webiny/api-headless-cms/types\";\nimport { createPartitionKey, createPublishedSortKey } from \"~/operations/entry/keys\";\nimport type { DataLoaderParams } from \"./types\";\nimport { parseIdentifier } from \"@webiny/utils\";\nimport { createBatchScheduleFn } from \"./createBatchScheduleFn\";\n\nexport const createGetPublishedRevisionByEntryId = (params: DataLoaderParams) => {\n const { entity, locale, tenant } = params;\n\n const publishedKey = createPublishedSortKey();\n return new DataLoader<string, CmsStorageEntry[]>(\n async (ids: readonly string[]) => {\n const queries = ids.reduce<Record<string, ReturnType<typeof entity.getBatch>>>(\n (collection, id) => {\n const partitionKey = createPartitionKey({\n tenant,\n locale,\n id\n });\n if (collection[partitionKey]) {\n return collection;\n }\n collection[partitionKey] = entity.getBatch({\n PK: partitionKey,\n SK: publishedKey\n });\n return collection;\n },\n {}\n );\n\n const records = await batchReadAll<CmsStorageEntry>({\n table: entity.table,\n items: Object.values(queries)\n });\n const items = cleanupItems(entity, records);\n\n return ids.map(id => {\n const { id: entryId } = parseIdentifier(id);\n return items.filter(item => {\n return entryId === item.entryId;\n });\n });\n },\n {\n batchScheduleFn: createBatchScheduleFn()\n }\n );\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAEA,IAAAG,KAAA,GAAAH,OAAA;AAEA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,sBAAA,GAAAL,OAAA;AAEO,MAAMM,mCAAmC,GAAIC,MAAwB,IAAK;EAC7E,MAAM;IAAEC,MAAM;IAAEC,MAAM;IAAEC;EAAO,CAAC,GAAGH,MAAM;EAEzC,MAAMI,YAAY,GAAG,IAAAC,4BAAsB,EAAC,CAAC;EAC7C,OAAO,IAAIC,mBAAU,CACjB,MAAOC,GAAsB,IAAK;IAC9B,MAAMC,OAAO,GAAGD,GAAG,CAACE,MAAM,CACtB,CAACC,UAAU,EAAEC,EAAE,KAAK;MAChB,MAAMC,YAAY,GAAG,IAAAC,wBAAkB,EAAC;QACpCV,MAAM;QACND,MAAM;QACNS;MACJ,CAAC,CAAC;MACF,IAAID,UAAU,CAACE,YAAY,CAAC,EAAE;QAC1B,OAAOF,UAAU;MACrB;MACAA,UAAU,CAACE,YAAY,CAAC,GAAGX,MAAM,CAACa,QAAQ,CAAC;QACvCC,EAAE,EAAEH,YAAY;QAChBI,EAAE,EAAEZ;MACR,CAAC,CAAC;MACF,OAAOM,UAAU;IACrB,CAAC,EACD,CAAC,CACL,CAAC;IAED,MAAMO,OAAO,GAAG,MAAM,IAAAC,wBAAY,EAAkB;MAChDC,KAAK,EAAElB,MAAM,CAACkB,KAAK;MACnBC,KAAK,EAAEC,MAAM,CAACC,MAAM,CAACd,OAAO;IAChC,CAAC,CAAC;IACF,MAAMY,KAAK,GAAG,IAAAG,qBAAY,EAACtB,MAAM,EAAEgB,OAAO,CAAC;IAE3C,OAAOV,GAAG,CAACiB,GAAG,CAACb,EAAE,IAAI;MACjB,MAAM;QAAEA,EAAE,EAAEc;MAAQ,CAAC,GAAG,IAAAC,sBAAe,EAACf,EAAE,CAAC;MAC3C,OAAOS,KAAK,CAACO,MAAM,CAACC,IAAI,IAAI;QACxB,OAAOH,OAAO,KAAKG,IAAI,CAACH,OAAO;MACnC,CAAC,CAAC;IACN,CAAC,CAAC;EACN,CAAC,EACD;IACII,eAAe,EAAE,IAAAC,4CAAqB,EAAC;EAC3C,CACJ,CAAC;AACL,CAAC;AAACC,OAAA,CAAAhC,mCAAA,GAAAA,mCAAA","ignoreList":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import DataLoader from "dataloader";
|
|
2
|
-
import { CmsStorageEntry } from "@webiny/api-headless-cms/types";
|
|
3
|
-
import { DataLoaderParams } from "./types";
|
|
2
|
+
import type { CmsStorageEntry } from "@webiny/api-headless-cms/types";
|
|
3
|
+
import type { DataLoaderParams } from "./types";
|
|
4
4
|
export declare const createGetRevisionById: (params: DataLoaderParams) => DataLoader<string, CmsStorageEntry[], string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_dataloader","_interopRequireDefault","require","_dbDynamodb","_cleanup","_keys","_utils","_createBatchScheduleFn","createGetRevisionById","params","entity","locale","tenant","DataLoader","ids","queries","reduce","collection","id","partitionKey","createPartitionKey","version","parseIdentifier","sortKey","createRevisionSortKey","keys","getBatch","PK","SK","records","batchReadAll","table","items","Object","values","cleanupItems","map","filter","item","batchScheduleFn","createBatchScheduleFn","exports"],"sources":["getRevisionById.ts"],"sourcesContent":["import DataLoader from \"dataloader\";\nimport { batchReadAll } from \"@webiny/db-dynamodb\";\nimport { CmsStorageEntry } from \"@webiny/api-headless-cms/types\";\nimport { cleanupItems } from \"@webiny/db-dynamodb/utils/cleanup\";\nimport { createPartitionKey, createRevisionSortKey } from \"~/operations/entry/keys\";\nimport { DataLoaderParams } from \"./types\";\nimport { parseIdentifier } from \"@webiny/utils\";\nimport { createBatchScheduleFn } from \"./createBatchScheduleFn\";\n\nexport const createGetRevisionById = (params: DataLoaderParams) => {\n const { entity, locale, tenant } = params;\n\n return new DataLoader<string, CmsStorageEntry[]>(\n async (ids: readonly string[]) => {\n const queries = ids.reduce<Record<string, ReturnType<typeof entity.getBatch>>>(\n (collection, id) => {\n const partitionKey = createPartitionKey({\n tenant,\n locale,\n id\n });\n const { version } = parseIdentifier(id);\n if (version === null) {\n return collection;\n }\n const sortKey = createRevisionSortKey({\n version\n });\n const keys = `${partitionKey}__${sortKey}`;\n if (collection[keys]) {\n return collection;\n }\n\n collection[keys] = entity.getBatch({\n PK: partitionKey,\n SK: sortKey\n });\n\n return collection;\n },\n {}\n );\n\n const records = await batchReadAll<CmsStorageEntry>({\n table: entity.table,\n items: Object.values(queries)\n });\n const items = cleanupItems(entity, records);\n\n return ids.map(id => {\n return items.filter(item => {\n return id === item.id;\n });\n });\n },\n {\n batchScheduleFn: createBatchScheduleFn()\n }\n );\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAEA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAEA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,sBAAA,GAAAL,OAAA;AAEO,MAAMM,qBAAqB,GAAIC,MAAwB,IAAK;EAC/D,MAAM;IAAEC,MAAM;IAAEC,MAAM;IAAEC;EAAO,CAAC,GAAGH,MAAM;EAEzC,OAAO,IAAII,mBAAU,CACjB,MAAOC,GAAsB,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,GAAAA,qBAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_dataloader","_interopRequireDefault","require","_dbDynamodb","_cleanup","_keys","_utils","_createBatchScheduleFn","createGetRevisionById","params","entity","locale","tenant","DataLoader","ids","queries","reduce","collection","id","partitionKey","createPartitionKey","version","parseIdentifier","sortKey","createRevisionSortKey","keys","getBatch","PK","SK","records","batchReadAll","table","items","Object","values","cleanupItems","map","filter","item","batchScheduleFn","createBatchScheduleFn","exports"],"sources":["getRevisionById.ts"],"sourcesContent":["import DataLoader from \"dataloader\";\nimport { batchReadAll } from \"@webiny/db-dynamodb\";\nimport type { CmsStorageEntry } from \"@webiny/api-headless-cms/types\";\nimport { cleanupItems } from \"@webiny/db-dynamodb/utils/cleanup\";\nimport { createPartitionKey, createRevisionSortKey } from \"~/operations/entry/keys\";\nimport type { DataLoaderParams } from \"./types\";\nimport { parseIdentifier } from \"@webiny/utils\";\nimport { createBatchScheduleFn } from \"./createBatchScheduleFn\";\n\nexport const createGetRevisionById = (params: DataLoaderParams) => {\n const { entity, locale, tenant } = params;\n\n return new DataLoader<string, CmsStorageEntry[]>(\n async (ids: readonly string[]) => {\n const queries = ids.reduce<Record<string, ReturnType<typeof entity.getBatch>>>(\n (collection, id) => {\n const partitionKey = createPartitionKey({\n tenant,\n locale,\n id\n });\n const { version } = parseIdentifier(id);\n if (version === null) {\n return collection;\n }\n const sortKey = createRevisionSortKey({\n version\n });\n const keys = `${partitionKey}__${sortKey}`;\n if (collection[keys]) {\n return collection;\n }\n\n collection[keys] = entity.getBatch({\n PK: partitionKey,\n SK: sortKey\n });\n\n return collection;\n },\n {}\n );\n\n const records = await batchReadAll<CmsStorageEntry>({\n table: entity.table,\n items: Object.values(queries)\n });\n const items = cleanupItems(entity, records);\n\n return ids.map(id => {\n return items.filter(item => {\n return id === item.id;\n });\n });\n },\n {\n batchScheduleFn: createBatchScheduleFn()\n }\n );\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,WAAA,GAAAC,sBA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qBAAY,EAACzB,MAAM,EAAEmB,OAAO,CAAC;IAE3C,OAAOf,GAAG,CAACsB,GAAG,CAAClB,EAAE,IAAI;MACjB,OAAOc,KAAK,CAACK,MAAM,CAACC,IAAI,IAAI;QACxB,OAAOpB,EAAE,KAAKoB,IAAI,CAACpB,EAAE;MACzB,CAAC,CAAC;IACN,CAAC,CAAC;EACN,CAAC,EACD;IACIqB,eAAe,EAAE,IAAAC,4CAAqB,EAAC;EAC3C,CACJ,CAAC;AACL,CAAC;AAACC,OAAA,CAAAjC,qBAAA,GAAAA,qBAAA","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import DataLoader from "dataloader";
|
|
2
|
-
import { DataLoaderParams } from "./types";
|
|
1
|
+
import type DataLoader from "dataloader";
|
|
2
|
+
import type { DataLoaderParams } from "./types";
|
|
3
3
|
export * from "./DataLoaderCache";
|
|
4
4
|
interface Callable {
|
|
5
5
|
(params: DataLoaderParams): DataLoader<any, any>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_getAllEntryRevisions","require","_getLatestRevisionByEntryId","_getPublishedRevisionByEntryId","_getRevisionById","_DataLoaderCache","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","dataLoaders","getAllEntryRevisions","createGetAllEntryRevisions","getLatestRevisionByEntryId","createGetLatestRevisionByEntryId","getPublishedRevisionByEntryId","createGetPublishedRevisionByEntryId","getRevisionById","createGetRevisionById","getDataLoaderFactory","name","Error"],"sources":["index.ts"],"sourcesContent":["import DataLoader from \"dataloader\";\nimport { DataLoaderParams } from \"./types\";\nimport { createGetAllEntryRevisions } from \"./getAllEntryRevisions\";\nimport { createGetLatestRevisionByEntryId } from \"./getLatestRevisionByEntryId\";\nimport { createGetPublishedRevisionByEntryId } from \"./getPublishedRevisionByEntryId\";\nimport { createGetRevisionById } from \"./getRevisionById\";\n\nexport * from \"./DataLoaderCache\";\n\ninterface Callable {\n (params: DataLoaderParams): DataLoader<any, any>;\n}\n\nconst dataLoaders: Record<string, Callable> = {\n getAllEntryRevisions: createGetAllEntryRevisions,\n getLatestRevisionByEntryId: createGetLatestRevisionByEntryId,\n getPublishedRevisionByEntryId: createGetPublishedRevisionByEntryId,\n getRevisionById: createGetRevisionById\n};\n\nexport type DataLoaders =\n | \"getAllEntryRevisions\"\n | \"getRevisionById\"\n | \"getPublishedRevisionByEntryId\"\n | \"getLatestRevisionByEntryId\";\n\nexport const getDataLoaderFactory = (name: string) => {\n if (!dataLoaders[name]) {\n throw new Error(`Missing data loader \"${name}\".`);\n }\n return dataLoaders[name];\n};\n"],"mappings":";;;;;;;;;AAEA,IAAAA,qBAAA,GAAAC,OAAA;AACA,IAAAC,2BAAA,GAAAD,OAAA;AACA,IAAAE,8BAAA,GAAAF,OAAA;AACA,IAAAG,gBAAA,GAAAH,OAAA;AAEA,IAAAI,gBAAA,GAAAJ,OAAA;AAAAK,MAAA,CAAAC,IAAA,CAAAF,gBAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,gBAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAZ,gBAAA,CAAAI,GAAA;IAAA;EAAA;AAAA;AAMA,MAAMS,WAAqC,GAAG;EAC1CC,oBAAoB,EAAEC,gDAA0B;EAChDC,0BAA0B,EAAEC,4DAAgC;EAC5DC,6BAA6B,EAAEC,kEAAmC;EAClEC,eAAe,EAAEC;AACrB,CAAC;AAQM,MAAMC,oBAAoB,GAAIC,IAAY,IAAK;EAClD,IAAI,CAACV,WAAW,CAACU,IAAI,CAAC,EAAE;IACpB,MAAM,IAAIC,KAAK,CAAC,wBAAwBD,IAAI,IAAI,CAAC;EACrD;EACA,OAAOV,WAAW,CAACU,IAAI,CAAC;AAC5B,CAAC;AAACd,OAAA,CAAAa,oBAAA,GAAAA,oBAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_getAllEntryRevisions","require","_getLatestRevisionByEntryId","_getPublishedRevisionByEntryId","_getRevisionById","_DataLoaderCache","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","dataLoaders","getAllEntryRevisions","createGetAllEntryRevisions","getLatestRevisionByEntryId","createGetLatestRevisionByEntryId","getPublishedRevisionByEntryId","createGetPublishedRevisionByEntryId","getRevisionById","createGetRevisionById","getDataLoaderFactory","name","Error"],"sources":["index.ts"],"sourcesContent":["import type DataLoader from \"dataloader\";\nimport type { DataLoaderParams } from \"./types\";\nimport { createGetAllEntryRevisions } from \"./getAllEntryRevisions\";\nimport { createGetLatestRevisionByEntryId } from \"./getLatestRevisionByEntryId\";\nimport { createGetPublishedRevisionByEntryId } from \"./getPublishedRevisionByEntryId\";\nimport { createGetRevisionById } from \"./getRevisionById\";\n\nexport * from \"./DataLoaderCache\";\n\ninterface Callable {\n (params: DataLoaderParams): DataLoader<any, any>;\n}\n\nconst dataLoaders: Record<string, Callable> = {\n getAllEntryRevisions: createGetAllEntryRevisions,\n getLatestRevisionByEntryId: createGetLatestRevisionByEntryId,\n getPublishedRevisionByEntryId: createGetPublishedRevisionByEntryId,\n getRevisionById: createGetRevisionById\n};\n\nexport type DataLoaders =\n | \"getAllEntryRevisions\"\n | \"getRevisionById\"\n | \"getPublishedRevisionByEntryId\"\n | \"getLatestRevisionByEntryId\";\n\nexport const getDataLoaderFactory = (name: string) => {\n if (!dataLoaders[name]) {\n throw new Error(`Missing data loader \"${name}\".`);\n }\n return dataLoaders[name];\n};\n"],"mappings":";;;;;;;;;AAEA,IAAAA,qBAAA,GAAAC,OAAA;AACA,IAAAC,2BAAA,GAAAD,OAAA;AACA,IAAAE,8BAAA,GAAAF,OAAA;AACA,IAAAG,gBAAA,GAAAH,OAAA;AAEA,IAAAI,gBAAA,GAAAJ,OAAA;AAAAK,MAAA,CAAAC,IAAA,CAAAF,gBAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,gBAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAZ,gBAAA,CAAAI,GAAA;IAAA;EAAA;AAAA;AAMA,MAAMS,WAAqC,GAAG;EAC1CC,oBAAoB,EAAEC,gDAA0B;EAChDC,0BAA0B,EAAEC,4DAAgC;EAC5DC,6BAA6B,EAAEC,kEAAmC;EAClEC,eAAe,EAAEC;AACrB,CAAC;AAQM,MAAMC,oBAAoB,GAAIC,IAAY,IAAK;EAClD,IAAI,CAACV,WAAW,CAACU,IAAI,CAAC,EAAE;IACpB,MAAM,IAAIC,KAAK,CAAC,wBAAwBD,IAAI,IAAI,CAAC;EACrD;EACA,OAAOV,WAAW,CAACU,IAAI,CAAC;AAC5B,CAAC;AAACd,OAAA,CAAAa,oBAAA,GAAAA,oBAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import { Entity } from \"@webiny/db-dynamodb/toolbox\";\n\nexport interface DataLoaderParams {\n entity: Entity<any>;\n tenant: string;\n locale: string;\n}\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type { Entity } from \"@webiny/db-dynamodb/toolbox\";\n\nexport interface DataLoaderParams {\n entity: Entity<any>;\n tenant: string;\n locale: string;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { CmsModel, CmsStorageEntry } from "@webiny/api-headless-cms/types";
|
|
2
|
-
import { Entity } from "@webiny/db-dynamodb/toolbox";
|
|
3
|
-
import { DataLoadersHandlerInterface, DataLoadersHandlerInterfaceClearAllParams } from "../../types";
|
|
1
|
+
import type { CmsModel, CmsStorageEntry } from "@webiny/api-headless-cms/types";
|
|
2
|
+
import type { Entity } from "@webiny/db-dynamodb/toolbox";
|
|
3
|
+
import type { DataLoadersHandlerInterface, DataLoadersHandlerInterfaceClearAllParams } from "../../types";
|
|
4
4
|
interface DataLoaderParams {
|
|
5
5
|
model: Pick<CmsModel, "tenant" | "locale" | "modelId">;
|
|
6
6
|
ids: readonly string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_error","_interopRequireDefault","require","_DataLoaderCache","_dataLoader","_utils","DataLoadersHandler","cache","DataLoaderCache","constructor","params","entity","getAllEntryRevisions","ids","map","id","entryId","parseIdentifier","loadMany","getRevisionById","getPublishedRevisionByEntryId","getLatestRevisionByEntryId","getLoader","name","model","cacheParams","tenant","locale","loader","getDataLoader","factory","getDataLoaderFactory","setDataLoader","results","Array","isArray","reduce","acc","res","message","WebinyError","code","data","JSON","stringify","push","ex","error","clearAll","exports"],"sources":["dataLoaders.ts"],"sourcesContent":["import DataLoader from \"dataloader\";\nimport WebinyError from \"@webiny/error\";\nimport { CmsModel, CmsStorageEntry } from \"@webiny/api-headless-cms/types\";\nimport { CacheKeyParams
|
|
1
|
+
{"version":3,"names":["_error","_interopRequireDefault","require","_DataLoaderCache","_dataLoader","_utils","DataLoadersHandler","cache","DataLoaderCache","constructor","params","entity","getAllEntryRevisions","ids","map","id","entryId","parseIdentifier","loadMany","getRevisionById","getPublishedRevisionByEntryId","getLatestRevisionByEntryId","getLoader","name","model","cacheParams","tenant","locale","loader","getDataLoader","factory","getDataLoaderFactory","setDataLoader","results","Array","isArray","reduce","acc","res","message","WebinyError","code","data","JSON","stringify","push","ex","error","clearAll","exports"],"sources":["dataLoaders.ts"],"sourcesContent":["import type DataLoader from \"dataloader\";\nimport WebinyError from \"@webiny/error\";\nimport type { CmsModel, CmsStorageEntry } from \"@webiny/api-headless-cms/types\";\nimport type { CacheKeyParams } from \"~/operations/entry/dataLoader/DataLoaderCache\";\nimport { DataLoaderCache } from \"~/operations/entry/dataLoader/DataLoaderCache\";\nimport type { Entity } from \"@webiny/db-dynamodb/toolbox\";\nimport type { DataLoaders } from \"~/operations/entry/dataLoader\";\nimport { getDataLoaderFactory } from \"~/operations/entry/dataLoader\";\nimport { parseIdentifier } from \"@webiny/utils\";\nimport type {\n DataLoadersHandlerInterface,\n DataLoadersHandlerInterfaceClearAllParams\n} from \"~/types\";\n\ninterface DataLoaderParams {\n model: Pick<CmsModel, \"tenant\" | \"locale\" | \"modelId\">;\n ids: readonly string[];\n}\n\ninterface GetLoaderParams {\n model: Pick<CmsModel, \"tenant\" | \"locale\" | \"modelId\">;\n}\n\ninterface DataLoadersHandlerParams {\n entity: Entity<any>;\n}\n\nexport class DataLoadersHandler implements DataLoadersHandlerInterface {\n private readonly entity: Entity<any>;\n private readonly cache: DataLoaderCache = new DataLoaderCache();\n\n public constructor(params: DataLoadersHandlerParams) {\n this.entity = params.entity;\n }\n\n public async getAllEntryRevisions(params: DataLoaderParams): Promise<CmsStorageEntry[]> {\n const ids = params.ids.map(id => {\n const { id: entryId } = parseIdentifier(id);\n return entryId;\n });\n return await this.loadMany(\"getAllEntryRevisions\", params, ids);\n }\n\n public async getRevisionById(params: DataLoaderParams): Promise<CmsStorageEntry[]> {\n return await this.loadMany(\"getRevisionById\", params, params.ids);\n }\n\n public async getPublishedRevisionByEntryId(\n params: DataLoaderParams\n ): Promise<CmsStorageEntry[]> {\n const ids = params.ids.map(id => {\n const { id: entryId } = parseIdentifier(id);\n return entryId;\n });\n return await this.loadMany(\"getPublishedRevisionByEntryId\", params, ids);\n }\n\n public async getLatestRevisionByEntryId(params: DataLoaderParams): Promise<CmsStorageEntry[]> {\n const ids = params.ids.map(id => {\n const { id: entryId } = parseIdentifier(id);\n return entryId;\n });\n return await this.loadMany(\"getLatestRevisionByEntryId\", params, ids);\n }\n\n /**\n * TODO @ts-refactor\n * Maybe pass on the generics to DataLoader definition?\n */\n private getLoader(name: DataLoaders, params: GetLoaderParams): DataLoader<any, any> {\n const { model } = params;\n const cacheParams: CacheKeyParams = {\n tenant: model.tenant,\n locale: model.locale,\n name\n };\n let loader = this.cache.getDataLoader(cacheParams);\n if (loader) {\n return loader;\n }\n const factory = getDataLoaderFactory(name);\n loader = factory({\n entity: this.entity,\n tenant: model.tenant,\n locale: model.locale\n });\n this.cache.setDataLoader(cacheParams, loader);\n return loader;\n }\n\n private async loadMany(\n loader: DataLoaders,\n params: GetLoaderParams,\n ids: readonly string[]\n ): Promise<CmsStorageEntry[]> {\n let results: any[] = [];\n try {\n results = await this.getLoader(loader, params).loadMany(ids);\n if (Array.isArray(results) === true) {\n return results.reduce((acc, res) => {\n if (Array.isArray(res) === false) {\n if (res && res.message) {\n throw new WebinyError(res.message, res.code, {\n ...res,\n data: JSON.stringify(res.data || {})\n });\n }\n throw new WebinyError(\n \"Result from the data loader must be an array of arrays which contain requested items.\",\n \"DATA_LOADER_RESULTS_ERROR\",\n {\n ...params,\n loader\n }\n );\n }\n acc.push(...res);\n return acc;\n }, []);\n }\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Data loader error.\",\n ex.code || \"DATA_LOADER_ERROR\",\n {\n error: ex,\n ...params,\n loader,\n ids\n }\n );\n }\n throw new WebinyError(\n `Data loader did not return array of items or empty array.`,\n \"INVALID_DATA_LOADER_RESULT\",\n {\n loader,\n ids,\n results\n }\n );\n }\n\n public clearAll(params?: DataLoadersHandlerInterfaceClearAllParams): void {\n this.cache.clearAll(params?.model);\n }\n}\n"],"mappings":";;;;;;;AACA,IAAAA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,KAAK;UAChC,IAAIJ,KAAK,CAACC,OAAO,CAACG,GAAG,CAAC,KAAK,KAAK,EAAE;YAC9B,IAAIA,GAAG,IAAIA,GAAG,CAACC,OAAO,EAAE;cACpB,MAAM,IAAIC,cAAW,CAACF,GAAG,CAACC,OAAO,EAAED,GAAG,CAACG,IAAI,EAAE;gBACzC,GAAGH,GAAG;gBACNI,IAAI,EAAEC,IAAI,CAACC,SAAS,CAACN,GAAG,CAACI,IAAI,IAAI,CAAC,CAAC;cACvC,CAAC,CAAC;YACN;YACA,MAAM,IAAIF,cAAW,CACjB,uFAAuF,EACvF,2BAA2B,EAC3B;cACI,GAAG9B,MAAM;cACTkB;YACJ,CACJ,CAAC;UACL;UACAS,GAAG,CAACQ,IAAI,CAAC,GAAGP,GAAG,CAAC;UAChB,OAAOD,GAAG;QACd,CAAC,EAAE,EAAE,CAAC;MACV;IACJ,CAAC,CAAC,OAAOS,EAAE,EAAE;MACT,MAAM,IAAIN,cAAW,CACjBM,EAAE,CAACP,OAAO,IAAI,oBAAoB,EAClCO,EAAE,CAACL,IAAI,IAAI,mBAAmB,EAC9B;QACIM,KAAK,EAAED,EAAE;QACT,GAAGpC,MAAM;QACTkB,MAAM;QACNf;MACJ,CACJ,CAAC;IACL;IACA,MAAM,IAAI2B,cAAW,CACjB,2DAA2D,EAC3D,4BAA4B,EAC5B;MACIZ,MAAM;MACNf,GAAG;MACHoB;IACJ,CACJ,CAAC;EACL;EAEOe,QAAQA,CAACtC,MAAkD,EAAQ;IACtE,IAAI,CAACH,KAAK,CAACyC,QAAQ,CAACtC,MAAM,EAAEc,KAAK,CAAC;EACtC;AACJ;AAACyB,OAAA,CAAA3C,kBAAA,GAAAA,kBAAA","ignoreList":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { CmsEntryListWhere } from "@webiny/api-headless-cms/types";
|
|
1
|
+
import type { CmsEntryListWhere } from "@webiny/api-headless-cms/types";
|
|
2
2
|
import { ValueFilterPlugin } from "@webiny/db-dynamodb/plugins/definitions/ValueFilterPlugin";
|
|
3
|
-
import { PluginsContainer } from "@webiny/plugins";
|
|
4
|
-
import { Field } from "./types";
|
|
3
|
+
import type { PluginsContainer } from "@webiny/plugins";
|
|
4
|
+
import type { Field } from "./types";
|
|
5
5
|
interface Params {
|
|
6
6
|
plugins: PluginsContainer;
|
|
7
7
|
where: Partial<CmsEntryListWhere>;
|