@webiny/api-headless-cms-ddb-es 5.33.1 → 5.33.2-beta.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.
Files changed (39) hide show
  1. package/elasticsearch/createElasticsearchIndex.js +2 -2
  2. package/elasticsearch/createElasticsearchIndex.js.map +1 -1
  3. package/elasticsearch/index.d.ts +1 -1
  4. package/elasticsearch/indices/base.js +2 -10
  5. package/elasticsearch/indices/base.js.map +1 -1
  6. package/elasticsearch/indices/index.d.ts +1 -1
  7. package/elasticsearch/indices/japanese.js +2 -10
  8. package/elasticsearch/indices/japanese.js.map +1 -1
  9. package/helpers/createElasticsearchQueryBody.js +7 -15
  10. package/helpers/createElasticsearchQueryBody.js.map +1 -1
  11. package/index.d.ts +1 -0
  12. package/index.js +42 -7
  13. package/index.js.map +1 -1
  14. package/operations/entry/index.js +6 -10
  15. package/operations/entry/index.js.map +1 -1
  16. package/package.json +14 -14
  17. package/plugins/CmsEntryElasticsearchBodyModifierPlugin.d.ts +1 -1
  18. package/plugins/CmsEntryElasticsearchBodyModifierPlugin.js +2 -2
  19. package/plugins/CmsEntryElasticsearchBodyModifierPlugin.js.map +1 -1
  20. package/plugins/CmsEntryElasticsearchFieldPlugin.d.ts +1 -1
  21. package/plugins/CmsEntryElasticsearchFieldPlugin.js +2 -2
  22. package/plugins/CmsEntryElasticsearchFieldPlugin.js.map +1 -1
  23. package/plugins/CmsEntryElasticsearchIndexPlugin.d.ts +1 -1
  24. package/plugins/CmsEntryElasticsearchIndexPlugin.js +2 -2
  25. package/plugins/CmsEntryElasticsearchIndexPlugin.js.map +1 -1
  26. package/plugins/CmsEntryElasticsearchQueryModifierPlugin.d.ts +1 -1
  27. package/plugins/CmsEntryElasticsearchQueryModifierPlugin.js +2 -2
  28. package/plugins/CmsEntryElasticsearchQueryModifierPlugin.js.map +1 -1
  29. package/plugins/CmsEntryElasticsearchSortModifierPlugin.d.ts +1 -1
  30. package/plugins/CmsEntryElasticsearchSortModifierPlugin.js +2 -2
  31. package/plugins/CmsEntryElasticsearchSortModifierPlugin.js.map +1 -1
  32. package/plugins/index.d.ts +6 -0
  33. package/plugins/index.js +83 -0
  34. package/plugins/index.js.map +1 -0
  35. package/types.d.ts +5 -2
  36. package/types.js.map +1 -1
  37. package/upgrades/index.d.ts +0 -2
  38. package/upgrades/index.js +0 -10
  39. package/upgrades/index.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"names":["createType","createLatestType","createPublishedType","getEntryData","entry","lodashOmit","TYPE","__type","getESLatestEntryData","plugins","compress","latest","getESPublishedEntryData","published","convertToStorageEntry","params","model","values","convertValueKeyToStorage","fields","convertFromStorageEntry","convertValueKeyFromStorage","createEntriesStorageOperations","entity","esEntity","elasticsearch","dataLoaders","DataLoadersHandler","create","initialEntry","storageEntry","initialStorageEntry","isPublished","status","locked","esEntry","prepareEntryToIndex","lodashCloneDeep","index","esIndex","configurations","es","esLatestData","esPublishedData","revisionKeys","PK","createPartitionKey","id","locale","tenant","SK","createRevisionSortKey","latestKeys","createLatestSortKey","publishedKeys","createPublishedSortKey","items","putBatch","push","batchWriteAll","table","clearAll","ex","WebinyError","message","code","error","esItems","data","createRevisionFrom","put","update","latestStorageEntry","getLatestRevisionByEntryId","ids","publishedStorageEntry","getPublishedRevisionByEntryId","undefined","elasticsearchLatestData","elasticsearchPublishedData","length","deleteEntry","partitionKey","queryAll","options","gte","deleteItems","map","item","deleteBatch","deleteEsItems","deleteRevision","latestEntry","list","limit","createLimit","result","indices","exists","body","hasMoreItems","totalCount","cursor","createElasticsearchQueryBody","args","parentPath","response","search","hits","total","extractEntriesFromIndex","entries","_source","pop","encodeCursor","sort","value","get","shift","publish","latestEsEntry","getRecord","keys","previouslyPublishedEntry","getRevisionById","CONTENT_ENTRY_STATUS","UNPUBLISHED","savedOn","latestEsEntryDataDecompressed","decompress","PUBLISHED","publishedOn","preparedEntryData","unpublish","requestReview","requestChanges","getRevisions","getAllEntryRevisions","getByIds","getLatestByIds","getPublishedByIds","getPreviousRevision","entryId","version","queryParams","lt","zeroPad","filters","attr","eq","reverse","queryOne","cleanupItem","delete"],"sources":["index.ts"],"sourcesContent":["import {\n CmsEntry,\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 CmsStorageEntry,\n CONTENT_ENTRY_STATUS,\n StorageOperationsCmsModel\n} from \"@webiny/api-headless-cms/types\";\nimport {\n createElasticsearchQueryBody,\n extractEntriesFromIndex,\n prepareEntryToIndex\n} from \"~/helpers\";\nimport { configurations } from \"~/configurations\";\nimport WebinyError from \"@webiny/error\";\nimport lodashCloneDeep from \"lodash/cloneDeep\";\nimport lodashOmit from \"lodash/omit\";\nimport { Entity } from \"dynamodb-toolbox\";\nimport { Client } from \"@elastic/elasticsearch\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport { compress, decompress } from \"@webiny/api-elasticsearch/compression\";\nimport { batchWriteAll } from \"@webiny/db-dynamodb/utils/batchWrite\";\nimport { DataLoadersHandler } from \"~/operations/entry/dataLoaders\";\nimport {\n createLatestSortKey,\n createPartitionKey,\n createPublishedSortKey,\n createRevisionSortKey\n} from \"~/operations/entry/keys\";\nimport { queryAll, queryOne, QueryOneParams } from \"@webiny/db-dynamodb/utils/query\";\nimport { createLimit } from \"@webiny/api-elasticsearch/limit\";\nimport { encodeCursor } from \"@webiny/api-elasticsearch/cursors\";\nimport { get as getRecord } from \"@webiny/db-dynamodb/utils/get\";\nimport { zeroPad } from \"@webiny/utils\";\nimport { cleanupItem } from \"@webiny/db-dynamodb/utils/cleanup\";\nimport { ElasticsearchSearchResponse } from \"@webiny/api-elasticsearch/types\";\nimport { CmsIndexEntry } from \"~/types\";\n\nconst createType = (): string => {\n return \"cms.entry\";\n};\nexport const createLatestType = (): string => {\n return `${createType()}.l`;\n};\nexport const createPublishedType = (): string => {\n return `${createType()}.p`;\n};\n\nconst getEntryData = (entry: CmsEntry) => {\n return {\n ...lodashOmit(entry, [\"PK\", \"SK\", \"published\", \"latest\"]),\n TYPE: createType(),\n __type: createType()\n };\n};\n\nconst getESLatestEntryData = async (plugins: PluginsContainer, entry: CmsEntry) => {\n return compress(plugins, {\n ...getEntryData(entry),\n latest: true,\n TYPE: createLatestType(),\n __type: createLatestType()\n });\n};\n\nconst getESPublishedEntryData = async (plugins: PluginsContainer, entry: CmsEntry) => {\n return compress(plugins, {\n ...getEntryData(entry),\n published: true,\n TYPE: createPublishedType(),\n __type: createPublishedType()\n });\n};\n\ninterface ConvertStorageEntryParams {\n entry: CmsStorageEntry;\n model: StorageOperationsCmsModel;\n}\nconst convertToStorageEntry = (params: ConvertStorageEntryParams): CmsStorageEntry => {\n const { model, entry } = params;\n\n const values = model.convertValueKeyToStorage({\n fields: model.fields,\n values: entry.values\n });\n return {\n ...entry,\n values\n };\n};\n\nconst convertFromStorageEntry = (params: ConvertStorageEntryParams): CmsStorageEntry => {\n const { model, entry } = params;\n\n const values = model.convertValueKeyFromStorage({\n fields: model.fields,\n values: entry.values\n });\n return {\n ...entry,\n values\n };\n};\n\ninterface ElasticsearchDbRecord {\n index: string;\n data: Record<string, string>;\n}\n\nexport interface CreateEntriesStorageOperationsParams {\n entity: Entity<any>;\n esEntity: Entity<any>;\n elasticsearch: Client;\n plugins: PluginsContainer;\n}\nexport const createEntriesStorageOperations = (\n params: CreateEntriesStorageOperationsParams\n): CmsEntryStorageOperations => {\n const { entity, esEntity, elasticsearch, plugins } = params;\n\n const dataLoaders = new DataLoadersHandler({\n entity\n });\n\n const create = async (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsCreateParams\n ) => {\n const { entry: initialEntry, storageEntry: initialStorageEntry } = params;\n const isPublished = initialEntry.status === \"published\";\n const locked = isPublished ? true : initialEntry.locked;\n\n const entry = convertToStorageEntry({\n model,\n entry: initialEntry\n });\n const storageEntry = convertToStorageEntry({\n model,\n entry: initialStorageEntry\n });\n\n const esEntry = prepareEntryToIndex({\n plugins,\n model,\n entry: lodashCloneDeep({ ...entry, locked }),\n storageEntry: lodashCloneDeep({ ...storageEntry, locked })\n });\n\n const { index: esIndex } = configurations.es({\n model\n });\n\n const esLatestData = await getESLatestEntryData(plugins, esEntry);\n const esPublishedData = await getESPublishedEntryData(plugins, esEntry);\n\n const revisionKeys = {\n PK: createPartitionKey({\n id: entry.id,\n locale: model.locale,\n tenant: model.tenant\n }),\n SK: createRevisionSortKey(entry)\n };\n\n const latestKeys = {\n PK: createPartitionKey({\n id: entry.id,\n locale: model.locale,\n tenant: model.tenant\n }),\n SK: createLatestSortKey()\n };\n\n const publishedKeys = {\n PK: createPartitionKey({\n id: entry.id,\n locale: model.locale,\n tenant: model.tenant\n }),\n SK: createPublishedSortKey()\n };\n\n const items = [\n entity.putBatch({\n ...storageEntry,\n locked,\n ...revisionKeys,\n TYPE: createType()\n }),\n entity.putBatch({\n ...storageEntry,\n locked,\n ...latestKeys,\n TYPE: createLatestType()\n })\n ];\n\n if (isPublished) {\n items.push(\n entity.putBatch({\n ...storageEntry,\n locked,\n ...publishedKeys,\n TYPE: createPublishedType()\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 entry data into the DynamoDB table.\",\n ex.code || \"CREATE_ENTRY_ERROR\",\n {\n error: ex,\n entry,\n storageEntry\n }\n );\n }\n\n const esItems = [\n esEntity.putBatch({\n ...latestKeys,\n index: esIndex,\n data: esLatestData\n })\n ];\n if (isPublished) {\n esItems.push(\n esEntity.putBatch({\n ...publishedKeys,\n index: esIndex,\n data: esPublishedData\n })\n );\n }\n\n try {\n await batchWriteAll({\n table: esEntity.table,\n items: esItems\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not insert entry data into the Elasticsearch DynamoDB table.\",\n ex.code || \"CREATE_ES_ENTRY_ERROR\",\n {\n error: ex,\n entry,\n esEntry\n }\n );\n }\n\n return initialStorageEntry;\n };\n\n const createRevisionFrom = async (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsCreateRevisionFromParams\n ) => {\n const { entry: initialEntry, storageEntry: initialStorageEntry } = params;\n\n const entry = convertToStorageEntry({\n model,\n entry: initialEntry\n });\n const storageEntry = convertToStorageEntry({\n model,\n entry: initialStorageEntry\n });\n\n const revisionKeys = {\n PK: createPartitionKey({\n id: entry.id,\n locale: model.locale,\n tenant: model.tenant\n }),\n SK: createRevisionSortKey(entry)\n };\n const latestKeys = {\n PK: createPartitionKey({\n id: entry.id,\n locale: model.locale,\n tenant: model.tenant\n }),\n SK: createLatestSortKey()\n };\n\n const esEntry = prepareEntryToIndex({\n plugins,\n model,\n entry: lodashCloneDeep(entry),\n storageEntry: lodashCloneDeep(storageEntry)\n });\n\n const esLatestData = await getESLatestEntryData(plugins, esEntry);\n\n const items = [\n entity.putBatch({\n ...storageEntry,\n TYPE: createType(),\n ...revisionKeys\n }),\n entity.putBatch({\n ...storageEntry,\n TYPE: createLatestType(),\n ...latestKeys\n })\n ];\n\n const { index } = configurations.es({\n model\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 in the DynamoDB table.\",\n ex.code || \"CREATE_REVISION_ERROR\",\n {\n error: ex,\n entry,\n storageEntry\n }\n );\n }\n /**\n * Update the \"latest\" entry item in the Elasticsearch\n */\n try {\n await esEntity.put({\n ...latestKeys,\n index,\n data: esLatestData\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not update latest entry in the DynamoDB Elasticsearch table.\",\n ex.code || \"CREATE_REVISION_ERROR\",\n {\n error: ex,\n entry\n }\n );\n }\n /**\n * There are no modifications on the entry created so just return the data.\n */\n return initialStorageEntry;\n };\n\n const update = async (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsUpdateParams\n ) => {\n const { entry: initialEntry, storageEntry: initialStorageEntry } = params;\n\n const entry = convertToStorageEntry({\n model,\n entry: initialEntry\n });\n const storageEntry = convertToStorageEntry({\n model,\n entry: initialStorageEntry\n });\n\n const isPublished = entry.status === \"published\";\n const locked = isPublished ? true : entry.locked;\n\n const revisionKeys = {\n PK: createPartitionKey({\n id: entry.id,\n locale: model.locale,\n tenant: model.tenant\n }),\n SK: createRevisionSortKey(entry)\n };\n const latestKeys = {\n PK: createPartitionKey({\n id: entry.id,\n locale: model.locale,\n tenant: model.tenant\n }),\n SK: createLatestSortKey()\n };\n\n const publishedKeys = {\n PK: createPartitionKey({\n id: entry.id,\n locale: model.locale,\n tenant: model.tenant\n }),\n SK: createPublishedSortKey()\n };\n\n /**\n * We need the latest entry to check if it needs to be updated.\n */\n const [latestStorageEntry] = await dataLoaders.getLatestRevisionByEntryId({\n model,\n ids: [entry.id]\n });\n\n const [publishedStorageEntry] = await dataLoaders.getPublishedRevisionByEntryId({\n model,\n ids: [entry.id]\n });\n\n const items = [\n entity.putBatch({\n ...storageEntry,\n locked,\n ...revisionKeys,\n TYPE: createType()\n })\n ];\n if (isPublished) {\n items.push(\n entity.putBatch({\n ...storageEntry,\n locked,\n ...publishedKeys,\n TYPE: createPublishedType()\n })\n );\n }\n\n const esItems = [];\n\n const { index: esIndex } = configurations.es({\n model\n });\n /**\n * Variable for the elasticsearch entry so we do not convert it more than once\n */\n let esEntry: CmsIndexEntry | undefined = undefined;\n /**\n * If the latest entry is the one being updated, we need to create a new latest entry records.\n */\n let elasticsearchLatestData: any = null;\n if (latestStorageEntry?.id === entry.id) {\n /**\n * First we update the regular DynamoDB table\n */\n items.push(\n entity.putBatch({\n ...storageEntry,\n ...latestKeys,\n TYPE: createLatestSortKey()\n })\n );\n /**\n * And then update the Elasticsearch table to propagate changes to the Elasticsearch\n */\n esEntry = prepareEntryToIndex({\n plugins,\n model,\n entry: lodashCloneDeep({\n ...entry,\n locked\n }),\n storageEntry: lodashCloneDeep({\n ...storageEntry,\n locked\n })\n });\n\n elasticsearchLatestData = await getESLatestEntryData(plugins, esEntry);\n\n esItems.push(\n esEntity.putBatch({\n ...latestKeys,\n index: esIndex,\n data: elasticsearchLatestData\n })\n );\n }\n let elasticsearchPublishedData = null;\n if (isPublished && publishedStorageEntry?.id === entry.id) {\n if (!elasticsearchLatestData) {\n /**\n * And then update the Elasticsearch table to propagate changes to the Elasticsearch\n */\n if (!esEntry) {\n esEntry = prepareEntryToIndex({\n plugins,\n model,\n entry: lodashCloneDeep({\n ...entry,\n locked\n }),\n storageEntry: lodashCloneDeep({\n ...storageEntry,\n locked\n })\n });\n }\n elasticsearchPublishedData = await getESPublishedEntryData(plugins, esEntry);\n } else {\n elasticsearchPublishedData = {\n ...elasticsearchLatestData,\n published: true,\n TYPE: createPublishedType(),\n __type: createPublishedType()\n };\n delete elasticsearchPublishedData.latest;\n }\n esItems.push(\n esEntity.putBatch({\n ...publishedKeys,\n index: esIndex,\n data: elasticsearchPublishedData\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 update entry DynamoDB records.\",\n ex.code || \"UPDATE_ENTRY_ERROR\",\n {\n error: ex,\n entry,\n storageEntry\n }\n );\n }\n if (esItems.length === 0) {\n return initialStorageEntry;\n }\n\n try {\n await batchWriteAll({\n table: esEntity.table,\n items: esItems\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not update entry DynamoDB Elasticsearch records.\",\n ex.code || \"UPDATE_ES_ENTRY_ERROR\",\n {\n error: ex,\n entry\n }\n );\n }\n return initialStorageEntry;\n };\n\n const deleteEntry = async (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsDeleteParams\n ) => {\n const { entry } = params;\n\n const partitionKey = createPartitionKey({\n id: entry.id,\n locale: model.locale,\n tenant: model.tenant\n });\n\n const items = await queryAll<CmsEntry>({\n entity,\n partitionKey,\n options: {\n gte: \" \"\n }\n });\n\n const esItems = await queryAll<CmsEntry>({\n entity: esEntity,\n partitionKey,\n options: {\n gte: \" \"\n }\n });\n\n const deleteItems = items.map(item => {\n return entity.deleteBatch({\n PK: item.PK,\n SK: item.SK\n });\n });\n\n const deleteEsItems = esItems.map(item => {\n return esEntity.deleteBatch({\n PK: item.PK,\n SK: item.SK\n });\n });\n\n try {\n await batchWriteAll({\n table: entity.table,\n items: deleteItems\n });\n dataLoaders.clearAll({\n model\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not delete entry records from DynamoDB table.\",\n ex.code || \"DELETE_ENTRY_ERROR\",\n {\n error: ex,\n entry\n }\n );\n }\n\n try {\n await batchWriteAll({\n table: esEntity.table,\n items: deleteEsItems\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not delete entry records from DynamoDB Elasticsearch table.\",\n ex.code || \"DELETE_ENTRY_ERROR\",\n {\n error: ex,\n entry\n }\n );\n }\n };\n\n const deleteRevision = async (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsDeleteRevisionParams\n ) => {\n const { entry, latestEntry, latestStorageEntry } = params;\n\n const partitionKey = createPartitionKey({\n id: entry.id,\n locale: model.locale,\n tenant: model.tenant\n });\n\n const { index } = configurations.es({\n model\n });\n /**\n * We need published entry to delete it if necessary.\n */\n const [publishedStorageEntry] = await dataLoaders.getPublishedRevisionByEntryId({\n model,\n ids: [entry.id]\n });\n /**\n * We need to delete all existing records of the given entry revision.\n */\n const items = [\n /**\n * Delete records of given entry revision.\n */\n entity.deleteBatch({\n PK: partitionKey,\n SK: createRevisionSortKey(entry)\n })\n ];\n\n const esItems = [];\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?.id === entry.id) {\n items.push(\n entity.deleteBatch({\n PK: partitionKey,\n SK: createPublishedSortKey()\n })\n );\n esItems.push(\n entity.deleteBatch({\n PK: partitionKey,\n SK: createPublishedSortKey()\n })\n );\n }\n if (latestEntry && latestStorageEntry) {\n const esEntry = prepareEntryToIndex({\n plugins,\n model,\n entry: lodashCloneDeep(latestEntry),\n storageEntry: lodashCloneDeep(latestStorageEntry)\n });\n\n const esLatestData = await getESLatestEntryData(plugins, esEntry);\n /**\n * In the end we need to set the new latest entry\n */\n items.push(\n entity.putBatch({\n ...latestStorageEntry,\n PK: partitionKey,\n SK: createLatestSortKey(),\n TYPE: createLatestType()\n })\n );\n esItems.push(\n esEntity.putBatch({\n PK: partitionKey,\n SK: createLatestSortKey(),\n index,\n data: esLatestData\n })\n );\n }\n\n try {\n await batchWriteAll({\n table: entity.table,\n items\n });\n\n dataLoaders.clearAll({\n model\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not batch write entry records to DynamoDB table.\",\n ex.code || \"DELETE_REVISION_ERROR\",\n {\n error: ex,\n entry,\n latestEntry,\n latestStorageEntry\n }\n );\n }\n\n if (esItems.length === 0) {\n return;\n }\n\n try {\n await batchWriteAll({\n table: esEntity.table,\n items: esItems\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message ||\n \"Could not batch write entry records to DynamoDB Elasticsearch table.\",\n ex.code || \"DELETE_REVISION_ERROR\",\n {\n error: ex,\n entry,\n latestEntry,\n latestStorageEntry\n }\n );\n }\n };\n\n const list = async (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsListParams\n ) => {\n const limit = createLimit(params.limit, 50);\n const { index } = configurations.es({\n model\n });\n\n try {\n const result = await elasticsearch.indices.exists({\n index\n });\n if (!result || !result.body) {\n return {\n hasMoreItems: false,\n totalCount: 0,\n cursor: null,\n items: []\n };\n }\n } catch (ex) {\n throw new WebinyError(\n \"Could not determine if Elasticsearch index exists.\",\n \"ELASTICSEARCH_INDEX_CHECK_ERROR\",\n {\n error: ex,\n index\n }\n );\n }\n\n const body = createElasticsearchQueryBody({\n model,\n args: {\n ...params,\n limit\n },\n plugins,\n parentPath: \"values\"\n });\n\n let response: ElasticsearchSearchResponse;\n try {\n response = await elasticsearch.search({\n index,\n body\n });\n } catch (ex) {\n throw new WebinyError(ex.message, ex.code || \"ELASTICSEARCH_ERROR\", {\n error: ex,\n index,\n body,\n model\n });\n }\n\n const { hits, total } = response.body.hits;\n\n const items = extractEntriesFromIndex({\n plugins,\n model,\n entries: hits.map(item => item._source)\n }).map(item => {\n return convertFromStorageEntry({\n model,\n entry: item\n });\n });\n\n const hasMoreItems = items.length > limit;\n if (hasMoreItems) {\n /**\n * Remove the last item from results, we don't want to include it.\n */\n items.pop();\n }\n /**\n * Cursor is the `sort` value of the last item in the array.\n * https://www.elastic.co/guide/en/elasticsearch/reference/current/paginate-search-results.html#search-after\n */\n const cursor = items.length > 0 ? encodeCursor(hits[items.length - 1].sort) || null : null;\n return {\n hasMoreItems,\n totalCount: total.value,\n cursor,\n items\n };\n };\n\n const get = async (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsGetParams\n ) => {\n const { items } = await list(model, {\n ...params,\n limit: 1\n });\n return items.shift() || null;\n };\n\n const publish = async (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsPublishParams\n ) => {\n const { entry: initialEntry, storageEntry: initialStorageEntry } = params;\n\n const entry = convertToStorageEntry({\n model,\n entry: initialEntry\n });\n const storageEntry = convertToStorageEntry({\n model,\n entry: initialStorageEntry\n });\n\n /**\n * We need currently published entry to check if need to remove it.\n */\n const [publishedStorageEntry] = await dataLoaders.getPublishedRevisionByEntryId({\n model,\n ids: [entry.id]\n });\n\n const revisionKeys = {\n PK: createPartitionKey({\n id: entry.id,\n locale: model.locale,\n tenant: model.tenant\n }),\n SK: createRevisionSortKey(entry)\n };\n const latestKeys = {\n PK: createPartitionKey({\n id: entry.id,\n locale: model.locale,\n tenant: model.tenant\n }),\n SK: createLatestSortKey()\n };\n const publishedKeys = {\n PK: createPartitionKey({\n id: entry.id,\n locale: model.locale,\n tenant: model.tenant\n }),\n SK: createPublishedSortKey()\n };\n\n let latestEsEntry: ElasticsearchDbRecord | null = null;\n try {\n latestEsEntry = await getRecord<ElasticsearchDbRecord>({\n entity: esEntity,\n keys: latestKeys\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not read Elasticsearch latest or published data.\",\n ex.code || \"PUBLISH_BATCH_READ\",\n {\n error: ex,\n latestKeys: latestKeys,\n publishedKeys: publishedKeys\n }\n );\n }\n\n const items = [\n entity.putBatch({\n ...storageEntry,\n ...revisionKeys,\n TYPE: createType()\n })\n ];\n const esItems = [];\n\n const { index } = configurations.es({\n model\n });\n\n if (publishedStorageEntry && publishedStorageEntry.id !== entry.id) {\n /**\n * If there is a `published` entry already, we need to set it to `unpublished`. We need to\n * execute two updates: update the previously published entry's status and the published entry record.\n * DynamoDB does not support `batchUpdate` - so here we load the previously published\n * entry's data to update its status within a batch operation. If, hopefully,\n * they introduce a true update batch operation, remove this `read` call.\n */\n const [previouslyPublishedEntry] = await dataLoaders.getRevisionById({\n model,\n ids: [publishedStorageEntry.id]\n });\n //\n // const previouslyPublishedEntry = convertToStorageEntry({\n // model,\n // entry: initialPreviouslyPublishedEntry\n // });\n\n items.push(\n /**\n * Update currently published entry (unpublish it)\n */\n entity.putBatch({\n ...previouslyPublishedEntry,\n status: CONTENT_ENTRY_STATUS.UNPUBLISHED,\n savedOn: entry.savedOn,\n TYPE: createType(),\n PK: createPartitionKey(publishedStorageEntry),\n SK: createRevisionSortKey(publishedStorageEntry)\n })\n );\n }\n /**\n * Update the helper item in DB with the new published entry\n */\n items.push(\n entity.putBatch({\n ...storageEntry,\n ...publishedKeys,\n TYPE: createPublishedType()\n })\n );\n\n /**\n * We need the latest entry to check if it needs to be updated as well in the Elasticsearch.\n */\n const [latestStorageEntry] = await dataLoaders.getLatestRevisionByEntryId({\n model,\n ids: [entry.id]\n });\n\n if (latestStorageEntry?.id === entry.id) {\n items.push(\n entity.putBatch({\n ...storageEntry,\n ...latestKeys\n })\n );\n }\n /**\n * If we are publishing the latest revision, let's also update the latest revision's status in ES.\n */\n if (latestEsEntry && latestStorageEntry?.id === entry.id) {\n /**\n * Need to decompress the data from Elasticsearch DynamoDB table.\n *\n * No need to transform it for the storage because it was fetched directly from the Elasticsearch table, where it sits transformed.\n */\n const latestEsEntryDataDecompressed: CmsEntry = (await decompress(\n plugins,\n latestEsEntry.data\n )) as any;\n\n esItems.push(\n esEntity.putBatch({\n index,\n PK: createPartitionKey(latestEsEntryDataDecompressed),\n SK: createLatestSortKey(),\n data: {\n ...latestEsEntryDataDecompressed,\n status: CONTENT_ENTRY_STATUS.PUBLISHED,\n locked: true,\n savedOn: entry.savedOn,\n publishedOn: entry.publishedOn\n }\n })\n );\n }\n\n const preparedEntryData = prepareEntryToIndex({\n plugins,\n model,\n entry: lodashCloneDeep(entry),\n storageEntry: lodashCloneDeep(storageEntry)\n });\n /**\n * Update the published revision entry in ES.\n */\n const esLatestData = await getESPublishedEntryData(plugins, preparedEntryData);\n\n esItems.push(\n esEntity.putBatch({\n ...publishedKeys,\n index,\n data: esLatestData\n })\n );\n\n /**\n * Finally, execute regular table batch.\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 store publish entry records in DynamoDB table.\",\n ex.code || \"PUBLISH_ERROR\",\n {\n error: ex,\n entry,\n latestStorageEntry,\n publishedStorageEntry\n }\n );\n }\n /**\n * And Elasticsearch table batch.\n */\n try {\n await batchWriteAll({\n table: esEntity.table,\n items: esItems\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message ||\n \"Could not store publish entry records in DynamoDB Elasticsearch table.\",\n ex.code || \"PUBLISH_ES_ERROR\",\n {\n error: ex,\n entry,\n latestStorageEntry,\n publishedStorageEntry\n }\n );\n }\n return initialStorageEntry;\n };\n\n const unpublish = async (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsUnpublishParams\n ) => {\n const { entry: initialEntry, storageEntry: initialStorageEntry } = params;\n\n const entry = convertToStorageEntry({\n model,\n entry: initialEntry\n });\n const storageEntry = convertToStorageEntry({\n model,\n entry: initialStorageEntry\n });\n\n /**\n * We need the latest entry to check if it needs to be updated.\n */\n const [latestStorageEntry] = await dataLoaders.getLatestRevisionByEntryId({\n model,\n ids: [entry.id]\n });\n\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: createPublishedSortKey()\n }),\n entity.putBatch({\n ...storageEntry,\n PK: partitionKey,\n SK: createRevisionSortKey(entry),\n TYPE: createType()\n })\n ];\n\n const esItems = [\n esEntity.deleteBatch({\n PK: partitionKey,\n SK: createPublishedSortKey()\n })\n ];\n /**\n * If we are unpublishing the latest revision, let's also update the latest revision entry's status in ES.\n */\n if (latestStorageEntry?.id === entry.id) {\n const { index } = configurations.es({\n model\n });\n\n const preparedEntryData = prepareEntryToIndex({\n plugins,\n model,\n entry: lodashCloneDeep(entry),\n storageEntry: lodashCloneDeep(storageEntry)\n });\n\n const esLatestData = await getESLatestEntryData(plugins, preparedEntryData);\n esItems.push(\n esEntity.putBatch({\n PK: partitionKey,\n SK: createLatestSortKey(),\n index,\n data: esLatestData\n })\n );\n }\n\n /**\n * Finally, execute regular table batch.\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 store unpublished entry records in DynamoDB table.\",\n ex.code || \"UNPUBLISH_ERROR\",\n {\n entry,\n storageEntry\n }\n );\n }\n /**\n * And Elasticsearch table batch.\n */\n try {\n await batchWriteAll({\n table: esEntity.table,\n items: esItems\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message ||\n \"Could not store unpublished entry records in DynamoDB Elasticsearch table.\",\n ex.code || \"UNPUBLISH_ERROR\",\n {\n entry,\n storageEntry\n }\n );\n }\n return initialStorageEntry;\n };\n\n const requestReview = async (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsRequestReviewParams\n ) => {\n const { entry: initialEntry, storageEntry: initialStorageEntry } = params;\n\n const entry = convertToStorageEntry({\n model,\n entry: initialEntry\n });\n const storageEntry = convertToStorageEntry({\n model,\n entry: initialStorageEntry\n });\n\n /**\n * We need the latest entry to check if it needs to be updated.\n */\n const [latestStorageEntry] = await dataLoaders.getLatestRevisionByEntryId({\n model,\n ids: [entry.id]\n });\n\n const partitionKey = createPartitionKey({\n id: entry.id,\n locale: model.locale,\n tenant: model.tenant\n });\n\n /**\n * If we updated the latest version, then make sure the changes are propagated to ES too.\n */\n let esLatestData = null;\n const { index } = configurations.es({\n model\n });\n if (latestStorageEntry?.id === entry.id) {\n const preparedEntryData = prepareEntryToIndex({\n plugins,\n model,\n entry: lodashCloneDeep(entry),\n storageEntry: lodashCloneDeep(storageEntry)\n });\n\n esLatestData = await getESLatestEntryData(plugins, preparedEntryData);\n }\n\n try {\n await entity.put({\n ...storageEntry,\n PK: partitionKey,\n SK: createRevisionSortKey(entry),\n TYPE: createType()\n });\n dataLoaders.clearAll({\n model\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not store request review entry record into DynamoDB table.\",\n ex.code || \"REQUEST_REVIEW_ERROR\",\n {\n entry,\n storageEntry,\n latestStorageEntry\n }\n );\n }\n /**\n * No need to proceed further if nothing to put into Elasticsearch.\n */\n if (!esLatestData) {\n return initialStorageEntry;\n }\n\n try {\n await esEntity.put({\n PK: partitionKey,\n SK: createLatestSortKey(),\n index,\n data: esLatestData\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message ||\n \"Could not store request review entry record into DynamoDB Elasticsearch table.\",\n ex.code || \"REQUEST_REVIEW_ERROR\",\n {\n entry,\n storageEntry,\n latestStorageEntry\n }\n );\n }\n return initialStorageEntry;\n };\n\n const requestChanges = async (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsRequestChangesParams\n ) => {\n const { entry: initialEntry, storageEntry: initialStorageEntry } = params;\n\n const entry = convertToStorageEntry({\n model,\n entry: initialEntry\n });\n const storageEntry = convertToStorageEntry({\n model,\n entry: initialStorageEntry\n });\n\n /**\n * We need the latest entry to check if it needs to be updated.\n */\n const [latestStorageEntry] = await dataLoaders.getLatestRevisionByEntryId({\n model,\n ids: [entry.id]\n });\n\n const partitionKey = createPartitionKey({\n id: entry.id,\n locale: model.locale,\n tenant: model.tenant\n });\n\n const items = [\n entity.putBatch({\n ...storageEntry,\n PK: partitionKey,\n SK: createRevisionSortKey(entry),\n TYPE: createType()\n })\n ];\n /**\n * If we updated the latest version, then make sure the changes are propagated to ES too.\n */\n const { index } = configurations.es({\n model\n });\n let esLatestData = null;\n if (latestStorageEntry?.id === entry.id) {\n items.push(\n entity.putBatch({\n ...storageEntry,\n PK: partitionKey,\n SK: createLatestSortKey(),\n TYPE: createLatestType()\n })\n );\n\n const preparedEntryData = prepareEntryToIndex({\n plugins,\n model,\n entry: lodashCloneDeep(entry),\n storageEntry: lodashCloneDeep(storageEntry)\n });\n\n esLatestData = await getESLatestEntryData(plugins, preparedEntryData);\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 store request changes entry record into DynamoDB table.\",\n ex.code || \"REQUEST_CHANGES_ERROR\",\n {\n entry,\n latestStorageEntry\n }\n );\n }\n /**\n * No need to proceed further if nothing to put into Elasticsearch.\n */\n if (!esLatestData) {\n return initialStorageEntry;\n }\n\n try {\n await esEntity.put({\n PK: partitionKey,\n SK: createLatestSortKey(),\n index,\n data: esLatestData\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message ||\n \"Could not store request changes entry record into DynamoDB Elasticsearch table.\",\n ex.code || \"REQUEST_CHANGES_ERROR\",\n {\n entry,\n latestStorageEntry\n }\n );\n }\n return initialStorageEntry;\n };\n\n const getLatestRevisionByEntryId = async (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsGetLatestRevisionParams\n ) => {\n const [entry] = await dataLoaders.getLatestRevisionByEntryId({\n model,\n ids: [params.id]\n });\n if (!entry) {\n return null;\n }\n return convertFromStorageEntry({\n model,\n entry\n });\n };\n const getPublishedRevisionByEntryId = async (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsGetLatestRevisionParams\n ) => {\n const [entry] = await dataLoaders.getPublishedRevisionByEntryId({\n model,\n ids: [params.id]\n });\n if (!entry) {\n return null;\n }\n return convertFromStorageEntry({\n model,\n entry\n });\n };\n\n const getRevisionById = async (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsGetRevisionParams\n ) => {\n const [entry] = await dataLoaders.getRevisionById({\n model,\n ids: [params.id]\n });\n if (!entry) {\n return null;\n }\n return convertFromStorageEntry({\n model,\n entry\n });\n };\n\n const getRevisions = async (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsGetRevisionsParams\n ) => {\n const entries = await dataLoaders.getAllEntryRevisions({\n model,\n ids: [params.id]\n });\n\n return entries.map(entry => {\n return convertFromStorageEntry({\n model,\n entry\n });\n });\n };\n\n const getByIds = async (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsGetByIdsParams\n ) => {\n const entries = await dataLoaders.getRevisionById({\n model,\n ids: params.ids\n });\n return entries.map(entry => {\n return convertFromStorageEntry({\n model,\n entry\n });\n });\n };\n\n const getLatestByIds = async (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsGetLatestByIdsParams\n ) => {\n const entries = await dataLoaders.getLatestRevisionByEntryId({\n model,\n ids: params.ids\n });\n return entries.map(entry => {\n return convertFromStorageEntry({\n model,\n entry\n });\n });\n };\n\n const getPublishedByIds = async (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsGetPublishedByIdsParams\n ) => {\n const entries = await dataLoaders.getPublishedRevisionByEntryId({\n model,\n ids: params.ids\n });\n\n return entries.map(entry => {\n return convertFromStorageEntry({\n model,\n entry\n });\n });\n };\n\n const getPreviousRevision = async (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsGetPreviousRevisionParams\n ) => {\n const { tenant, locale } = model;\n const { entryId, version } = params;\n const queryParams: QueryOneParams = {\n entity,\n partitionKey: createPartitionKey({\n tenant,\n 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 const entry = cleanupItem(entity, result);\n\n if (!entry) {\n return null;\n }\n return convertFromStorageEntry({\n entry,\n model\n });\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 return {\n create,\n createRevisionFrom,\n update,\n delete: deleteEntry,\n deleteRevision,\n get,\n publish,\n unpublish,\n requestReview,\n requestChanges,\n list,\n getLatestRevisionByEntryId,\n getPublishedRevisionByEntryId,\n getRevisionById,\n getRevisions,\n getByIds,\n getLatestByIds,\n getPublishedByIds,\n getPreviousRevision\n };\n};\n"],"mappings":";;;;;;;;;;;AAAA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EAAY;QACR,OAAO,IAAP;MACH;;MACD,OAAOgB,uBAAuB,CAAC;QAC3BhB,KAD2B;QAE3BY;MAF2B,CAAD,CAA9B;IAIH,CAZD,CAYE,OAAO8C,EAAP,EAAW;MACT,MAAM,IAAIC,cAAJ,CACFD,EAAE,CAACE,OAAH,IAAc,gDADZ,EAEFF,EAAE,CAACG,IAAH,IAAW,4BAFT,kCAIKlD,MAJL;QAKEmD,KAAK,EAAEJ,EALT;QAMEoB,YAAY,EAAE8D,WAAW,CAAC9D,YAN5B;QAOEE,OAAO,EAAE4D,WAAW,CAAC5D,OAPvB;QAQEpE;MARF,GAAN;IAWH;EACJ,CAzDD;;EA2DA,OAAO;IACHY,MADG;IAEHyC,kBAFG;IAGHE,MAHG;IAIHkF,MAAM,EAAExE,WAJL;IAKHU,cALG;IAMH0B,GANG;IAOHE,OAPG;IAQHc,SARG;IASHC,aATG;IAUHC,cAVG;IAWH1C,IAXG;IAYHpB,0BAZG;IAaHG,6BAbG;IAcHgD,eAdG;IAeHY,YAfG;IAgBHE,QAhBG;IAiBHC,cAjBG;IAkBHC,iBAlBG;IAmBHC;EAnBG,CAAP;AAqBH,CA/+CM"}
1
+ {"version":3,"names":["createType","createLatestType","createPublishedType","getEntryData","entry","lodashOmit","TYPE","__type","getESLatestEntryData","plugins","compress","latest","getESPublishedEntryData","published","convertToStorageEntry","params","model","values","convertValueKeyToStorage","fields","convertFromStorageEntry","convertValueKeyFromStorage","createEntriesStorageOperations","entity","esEntity","elasticsearch","dataLoaders","DataLoadersHandler","create","initialEntry","storageEntry","initialStorageEntry","isPublished","status","locked","esEntry","prepareEntryToIndex","lodashCloneDeep","index","esIndex","configurations","es","esLatestData","esPublishedData","revisionKeys","PK","createPartitionKey","id","locale","tenant","SK","createRevisionSortKey","latestKeys","createLatestSortKey","publishedKeys","createPublishedSortKey","items","putBatch","push","batchWriteAll","table","clearAll","ex","WebinyError","message","code","error","esItems","data","createRevisionFrom","put","update","latestStorageEntry","getLatestRevisionByEntryId","ids","publishedStorageEntry","getPublishedRevisionByEntryId","undefined","elasticsearchLatestData","elasticsearchPublishedData","length","deleteEntry","partitionKey","queryAll","options","gte","deleteItems","map","item","deleteBatch","deleteEsItems","deleteRevision","latestEntry","list","limit","createLimit","result","indices","exists","body","hasMoreItems","totalCount","cursor","createElasticsearchQueryBody","args","parentPath","response","search","hits","total","extractEntriesFromIndex","entries","_source","pop","encodeCursor","sort","value","get","shift","publish","latestEsEntry","getRecord","keys","previouslyPublishedEntry","getRevisionById","CONTENT_ENTRY_STATUS","UNPUBLISHED","savedOn","latestEsEntryDataDecompressed","decompress","PUBLISHED","publishedOn","preparedEntryData","unpublish","requestReview","requestChanges","getRevisions","getAllEntryRevisions","getByIds","getLatestByIds","getPublishedByIds","getPreviousRevision","entryId","version","queryParams","lt","zeroPad","filters","attr","eq","reverse","queryOne","cleanupItem","delete"],"sources":["index.ts"],"sourcesContent":["import {\n CmsEntry,\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 CmsStorageEntry,\n CONTENT_ENTRY_STATUS,\n StorageOperationsCmsModel\n} from \"@webiny/api-headless-cms/types\";\nimport {\n createElasticsearchQueryBody,\n extractEntriesFromIndex,\n prepareEntryToIndex\n} from \"~/helpers\";\nimport { configurations } from \"~/configurations\";\nimport WebinyError from \"@webiny/error\";\nimport lodashCloneDeep from \"lodash/cloneDeep\";\nimport lodashOmit from \"lodash/omit\";\nimport { Entity } from \"dynamodb-toolbox\";\nimport { Client } from \"@elastic/elasticsearch\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport { batchWriteAll } from \"@webiny/db-dynamodb/utils/batchWrite\";\nimport { DataLoadersHandler } from \"~/operations/entry/dataLoaders\";\nimport {\n createLatestSortKey,\n createPartitionKey,\n createPublishedSortKey,\n createRevisionSortKey\n} from \"~/operations/entry/keys\";\nimport { queryAll, queryOne, QueryOneParams } from \"@webiny/db-dynamodb/utils/query\";\nimport { createLimit, encodeCursor, compress, decompress } from \"@webiny/api-elasticsearch\";\nimport { get as getRecord } from \"@webiny/db-dynamodb/utils/get\";\nimport { zeroPad } from \"@webiny/utils\";\nimport { cleanupItem } from \"@webiny/db-dynamodb/utils/cleanup\";\nimport { ElasticsearchSearchResponse } from \"@webiny/api-elasticsearch/types\";\nimport { CmsIndexEntry } from \"~/types\";\n\nconst createType = (): string => {\n return \"cms.entry\";\n};\nexport const createLatestType = (): string => {\n return `${createType()}.l`;\n};\nexport const createPublishedType = (): string => {\n return `${createType()}.p`;\n};\n\nconst getEntryData = (entry: CmsEntry) => {\n return {\n ...lodashOmit(entry, [\"PK\", \"SK\", \"published\", \"latest\"]),\n TYPE: createType(),\n __type: createType()\n };\n};\n\nconst getESLatestEntryData = async (plugins: PluginsContainer, entry: CmsEntry) => {\n return compress(plugins, {\n ...getEntryData(entry),\n latest: true,\n TYPE: createLatestType(),\n __type: createLatestType()\n });\n};\n\nconst getESPublishedEntryData = async (plugins: PluginsContainer, entry: CmsEntry) => {\n return compress(plugins, {\n ...getEntryData(entry),\n published: true,\n TYPE: createPublishedType(),\n __type: createPublishedType()\n });\n};\n\ninterface ConvertStorageEntryParams {\n entry: CmsStorageEntry;\n model: StorageOperationsCmsModel;\n}\nconst convertToStorageEntry = (params: ConvertStorageEntryParams): CmsStorageEntry => {\n const { model, entry } = params;\n\n const values = model.convertValueKeyToStorage({\n fields: model.fields,\n values: entry.values\n });\n return {\n ...entry,\n values\n };\n};\n\nconst convertFromStorageEntry = (params: ConvertStorageEntryParams): CmsStorageEntry => {\n const { model, entry } = params;\n\n const values = model.convertValueKeyFromStorage({\n fields: model.fields,\n values: entry.values\n });\n return {\n ...entry,\n values\n };\n};\n\ninterface ElasticsearchDbRecord {\n index: string;\n data: Record<string, string>;\n}\n\nexport interface CreateEntriesStorageOperationsParams {\n entity: Entity<any>;\n esEntity: Entity<any>;\n elasticsearch: Client;\n plugins: PluginsContainer;\n}\nexport const createEntriesStorageOperations = (\n params: CreateEntriesStorageOperationsParams\n): CmsEntryStorageOperations => {\n const { entity, esEntity, elasticsearch, plugins } = params;\n\n const dataLoaders = new DataLoadersHandler({\n entity\n });\n\n const create = async (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsCreateParams\n ) => {\n const { entry: initialEntry, storageEntry: initialStorageEntry } = params;\n const isPublished = initialEntry.status === \"published\";\n const locked = isPublished ? true : initialEntry.locked;\n\n const entry = convertToStorageEntry({\n model,\n entry: initialEntry\n });\n const storageEntry = convertToStorageEntry({\n model,\n entry: initialStorageEntry\n });\n\n const esEntry = prepareEntryToIndex({\n plugins,\n model,\n entry: lodashCloneDeep({ ...entry, locked }),\n storageEntry: lodashCloneDeep({ ...storageEntry, locked })\n });\n\n const { index: esIndex } = configurations.es({\n model\n });\n\n const esLatestData = await getESLatestEntryData(plugins, esEntry);\n const esPublishedData = await getESPublishedEntryData(plugins, esEntry);\n\n const revisionKeys = {\n PK: createPartitionKey({\n id: entry.id,\n locale: model.locale,\n tenant: model.tenant\n }),\n SK: createRevisionSortKey(entry)\n };\n\n const latestKeys = {\n PK: createPartitionKey({\n id: entry.id,\n locale: model.locale,\n tenant: model.tenant\n }),\n SK: createLatestSortKey()\n };\n\n const publishedKeys = {\n PK: createPartitionKey({\n id: entry.id,\n locale: model.locale,\n tenant: model.tenant\n }),\n SK: createPublishedSortKey()\n };\n\n const items = [\n entity.putBatch({\n ...storageEntry,\n locked,\n ...revisionKeys,\n TYPE: createType()\n }),\n entity.putBatch({\n ...storageEntry,\n locked,\n ...latestKeys,\n TYPE: createLatestType()\n })\n ];\n\n if (isPublished) {\n items.push(\n entity.putBatch({\n ...storageEntry,\n locked,\n ...publishedKeys,\n TYPE: createPublishedType()\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 entry data into the DynamoDB table.\",\n ex.code || \"CREATE_ENTRY_ERROR\",\n {\n error: ex,\n entry,\n storageEntry\n }\n );\n }\n\n const esItems = [\n esEntity.putBatch({\n ...latestKeys,\n index: esIndex,\n data: esLatestData\n })\n ];\n if (isPublished) {\n esItems.push(\n esEntity.putBatch({\n ...publishedKeys,\n index: esIndex,\n data: esPublishedData\n })\n );\n }\n\n try {\n await batchWriteAll({\n table: esEntity.table,\n items: esItems\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not insert entry data into the Elasticsearch DynamoDB table.\",\n ex.code || \"CREATE_ES_ENTRY_ERROR\",\n {\n error: ex,\n entry,\n esEntry\n }\n );\n }\n\n return initialStorageEntry;\n };\n\n const createRevisionFrom = async (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsCreateRevisionFromParams\n ) => {\n const { entry: initialEntry, storageEntry: initialStorageEntry } = params;\n\n const entry = convertToStorageEntry({\n model,\n entry: initialEntry\n });\n const storageEntry = convertToStorageEntry({\n model,\n entry: initialStorageEntry\n });\n\n const revisionKeys = {\n PK: createPartitionKey({\n id: entry.id,\n locale: model.locale,\n tenant: model.tenant\n }),\n SK: createRevisionSortKey(entry)\n };\n const latestKeys = {\n PK: createPartitionKey({\n id: entry.id,\n locale: model.locale,\n tenant: model.tenant\n }),\n SK: createLatestSortKey()\n };\n\n const esEntry = prepareEntryToIndex({\n plugins,\n model,\n entry: lodashCloneDeep(entry),\n storageEntry: lodashCloneDeep(storageEntry)\n });\n\n const esLatestData = await getESLatestEntryData(plugins, esEntry);\n\n const items = [\n entity.putBatch({\n ...storageEntry,\n TYPE: createType(),\n ...revisionKeys\n }),\n entity.putBatch({\n ...storageEntry,\n TYPE: createLatestType(),\n ...latestKeys\n })\n ];\n\n const { index } = configurations.es({\n model\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 in the DynamoDB table.\",\n ex.code || \"CREATE_REVISION_ERROR\",\n {\n error: ex,\n entry,\n storageEntry\n }\n );\n }\n /**\n * Update the \"latest\" entry item in the Elasticsearch\n */\n try {\n await esEntity.put({\n ...latestKeys,\n index,\n data: esLatestData\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not update latest entry in the DynamoDB Elasticsearch table.\",\n ex.code || \"CREATE_REVISION_ERROR\",\n {\n error: ex,\n entry\n }\n );\n }\n /**\n * There are no modifications on the entry created so just return the data.\n */\n return initialStorageEntry;\n };\n\n const update = async (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsUpdateParams\n ) => {\n const { entry: initialEntry, storageEntry: initialStorageEntry } = params;\n\n const entry = convertToStorageEntry({\n model,\n entry: initialEntry\n });\n const storageEntry = convertToStorageEntry({\n model,\n entry: initialStorageEntry\n });\n\n const isPublished = entry.status === \"published\";\n const locked = isPublished ? true : entry.locked;\n\n const revisionKeys = {\n PK: createPartitionKey({\n id: entry.id,\n locale: model.locale,\n tenant: model.tenant\n }),\n SK: createRevisionSortKey(entry)\n };\n const latestKeys = {\n PK: createPartitionKey({\n id: entry.id,\n locale: model.locale,\n tenant: model.tenant\n }),\n SK: createLatestSortKey()\n };\n\n const publishedKeys = {\n PK: createPartitionKey({\n id: entry.id,\n locale: model.locale,\n tenant: model.tenant\n }),\n SK: createPublishedSortKey()\n };\n\n /**\n * We need the latest entry to check if it needs to be updated.\n */\n const [latestStorageEntry] = await dataLoaders.getLatestRevisionByEntryId({\n model,\n ids: [entry.id]\n });\n\n const [publishedStorageEntry] = await dataLoaders.getPublishedRevisionByEntryId({\n model,\n ids: [entry.id]\n });\n\n const items = [\n entity.putBatch({\n ...storageEntry,\n locked,\n ...revisionKeys,\n TYPE: createType()\n })\n ];\n if (isPublished) {\n items.push(\n entity.putBatch({\n ...storageEntry,\n locked,\n ...publishedKeys,\n TYPE: createPublishedType()\n })\n );\n }\n\n const esItems = [];\n\n const { index: esIndex } = configurations.es({\n model\n });\n /**\n * Variable for the elasticsearch entry so we do not convert it more than once\n */\n let esEntry: CmsIndexEntry | undefined = undefined;\n /**\n * If the latest entry is the one being updated, we need to create a new latest entry records.\n */\n let elasticsearchLatestData: any = null;\n if (latestStorageEntry?.id === entry.id) {\n /**\n * First we update the regular DynamoDB table\n */\n items.push(\n entity.putBatch({\n ...storageEntry,\n ...latestKeys,\n TYPE: createLatestSortKey()\n })\n );\n /**\n * And then update the Elasticsearch table to propagate changes to the Elasticsearch\n */\n esEntry = prepareEntryToIndex({\n plugins,\n model,\n entry: lodashCloneDeep({\n ...entry,\n locked\n }),\n storageEntry: lodashCloneDeep({\n ...storageEntry,\n locked\n })\n });\n\n elasticsearchLatestData = await getESLatestEntryData(plugins, esEntry);\n\n esItems.push(\n esEntity.putBatch({\n ...latestKeys,\n index: esIndex,\n data: elasticsearchLatestData\n })\n );\n }\n let elasticsearchPublishedData = null;\n if (isPublished && publishedStorageEntry?.id === entry.id) {\n if (!elasticsearchLatestData) {\n /**\n * And then update the Elasticsearch table to propagate changes to the Elasticsearch\n */\n if (!esEntry) {\n esEntry = prepareEntryToIndex({\n plugins,\n model,\n entry: lodashCloneDeep({\n ...entry,\n locked\n }),\n storageEntry: lodashCloneDeep({\n ...storageEntry,\n locked\n })\n });\n }\n elasticsearchPublishedData = await getESPublishedEntryData(plugins, esEntry);\n } else {\n elasticsearchPublishedData = {\n ...elasticsearchLatestData,\n published: true,\n TYPE: createPublishedType(),\n __type: createPublishedType()\n };\n delete elasticsearchPublishedData.latest;\n }\n esItems.push(\n esEntity.putBatch({\n ...publishedKeys,\n index: esIndex,\n data: elasticsearchPublishedData\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 update entry DynamoDB records.\",\n ex.code || \"UPDATE_ENTRY_ERROR\",\n {\n error: ex,\n entry,\n storageEntry\n }\n );\n }\n if (esItems.length === 0) {\n return initialStorageEntry;\n }\n\n try {\n await batchWriteAll({\n table: esEntity.table,\n items: esItems\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not update entry DynamoDB Elasticsearch records.\",\n ex.code || \"UPDATE_ES_ENTRY_ERROR\",\n {\n error: ex,\n entry\n }\n );\n }\n return initialStorageEntry;\n };\n\n const deleteEntry = async (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsDeleteParams\n ) => {\n const { entry } = params;\n\n const partitionKey = createPartitionKey({\n id: entry.id,\n locale: model.locale,\n tenant: model.tenant\n });\n\n const items = await queryAll<CmsEntry>({\n entity,\n partitionKey,\n options: {\n gte: \" \"\n }\n });\n\n const esItems = await queryAll<CmsEntry>({\n entity: esEntity,\n partitionKey,\n options: {\n gte: \" \"\n }\n });\n\n const deleteItems = items.map(item => {\n return entity.deleteBatch({\n PK: item.PK,\n SK: item.SK\n });\n });\n\n const deleteEsItems = esItems.map(item => {\n return esEntity.deleteBatch({\n PK: item.PK,\n SK: item.SK\n });\n });\n\n try {\n await batchWriteAll({\n table: entity.table,\n items: deleteItems\n });\n dataLoaders.clearAll({\n model\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not delete entry records from DynamoDB table.\",\n ex.code || \"DELETE_ENTRY_ERROR\",\n {\n error: ex,\n entry\n }\n );\n }\n\n try {\n await batchWriteAll({\n table: esEntity.table,\n items: deleteEsItems\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not delete entry records from DynamoDB Elasticsearch table.\",\n ex.code || \"DELETE_ENTRY_ERROR\",\n {\n error: ex,\n entry\n }\n );\n }\n };\n\n const deleteRevision = async (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsDeleteRevisionParams\n ) => {\n const { entry, latestEntry, latestStorageEntry } = params;\n\n const partitionKey = createPartitionKey({\n id: entry.id,\n locale: model.locale,\n tenant: model.tenant\n });\n\n const { index } = configurations.es({\n model\n });\n /**\n * We need published entry to delete it if necessary.\n */\n const [publishedStorageEntry] = await dataLoaders.getPublishedRevisionByEntryId({\n model,\n ids: [entry.id]\n });\n /**\n * We need to delete all existing records of the given entry revision.\n */\n const items = [\n /**\n * Delete records of given entry revision.\n */\n entity.deleteBatch({\n PK: partitionKey,\n SK: createRevisionSortKey(entry)\n })\n ];\n\n const esItems = [];\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?.id === entry.id) {\n items.push(\n entity.deleteBatch({\n PK: partitionKey,\n SK: createPublishedSortKey()\n })\n );\n esItems.push(\n entity.deleteBatch({\n PK: partitionKey,\n SK: createPublishedSortKey()\n })\n );\n }\n if (latestEntry && latestStorageEntry) {\n const esEntry = prepareEntryToIndex({\n plugins,\n model,\n entry: lodashCloneDeep(latestEntry),\n storageEntry: lodashCloneDeep(latestStorageEntry)\n });\n\n const esLatestData = await getESLatestEntryData(plugins, esEntry);\n /**\n * In the end we need to set the new latest entry\n */\n items.push(\n entity.putBatch({\n ...latestStorageEntry,\n PK: partitionKey,\n SK: createLatestSortKey(),\n TYPE: createLatestType()\n })\n );\n esItems.push(\n esEntity.putBatch({\n PK: partitionKey,\n SK: createLatestSortKey(),\n index,\n data: esLatestData\n })\n );\n }\n\n try {\n await batchWriteAll({\n table: entity.table,\n items\n });\n\n dataLoaders.clearAll({\n model\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not batch write entry records to DynamoDB table.\",\n ex.code || \"DELETE_REVISION_ERROR\",\n {\n error: ex,\n entry,\n latestEntry,\n latestStorageEntry\n }\n );\n }\n\n if (esItems.length === 0) {\n return;\n }\n\n try {\n await batchWriteAll({\n table: esEntity.table,\n items: esItems\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message ||\n \"Could not batch write entry records to DynamoDB Elasticsearch table.\",\n ex.code || \"DELETE_REVISION_ERROR\",\n {\n error: ex,\n entry,\n latestEntry,\n latestStorageEntry\n }\n );\n }\n };\n\n const list = async (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsListParams\n ) => {\n const limit = createLimit(params.limit, 50);\n const { index } = configurations.es({\n model\n });\n\n try {\n const result = await elasticsearch.indices.exists({\n index\n });\n if (!result || !result.body) {\n return {\n hasMoreItems: false,\n totalCount: 0,\n cursor: null,\n items: []\n };\n }\n } catch (ex) {\n throw new WebinyError(\n \"Could not determine if Elasticsearch index exists.\",\n \"ELASTICSEARCH_INDEX_CHECK_ERROR\",\n {\n error: ex,\n index\n }\n );\n }\n\n const body = createElasticsearchQueryBody({\n model,\n args: {\n ...params,\n limit\n },\n plugins,\n parentPath: \"values\"\n });\n\n let response: ElasticsearchSearchResponse;\n try {\n response = await elasticsearch.search({\n index,\n body\n });\n } catch (ex) {\n throw new WebinyError(ex.message, ex.code || \"ELASTICSEARCH_ERROR\", {\n error: ex,\n index,\n body,\n model\n });\n }\n\n const { hits, total } = response.body.hits;\n\n const items = extractEntriesFromIndex({\n plugins,\n model,\n entries: hits.map(item => item._source)\n }).map(item => {\n return convertFromStorageEntry({\n model,\n entry: item\n });\n });\n\n const hasMoreItems = items.length > limit;\n if (hasMoreItems) {\n /**\n * Remove the last item from results, we don't want to include it.\n */\n items.pop();\n }\n /**\n * Cursor is the `sort` value of the last item in the array.\n * https://www.elastic.co/guide/en/elasticsearch/reference/current/paginate-search-results.html#search-after\n */\n const cursor = items.length > 0 ? encodeCursor(hits[items.length - 1].sort) || null : null;\n return {\n hasMoreItems,\n totalCount: total.value,\n cursor,\n items\n };\n };\n\n const get = async (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsGetParams\n ) => {\n const { items } = await list(model, {\n ...params,\n limit: 1\n });\n return items.shift() || null;\n };\n\n const publish = async (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsPublishParams\n ) => {\n const { entry: initialEntry, storageEntry: initialStorageEntry } = params;\n\n const entry = convertToStorageEntry({\n model,\n entry: initialEntry\n });\n const storageEntry = convertToStorageEntry({\n model,\n entry: initialStorageEntry\n });\n\n /**\n * We need currently published entry to check if need to remove it.\n */\n const [publishedStorageEntry] = await dataLoaders.getPublishedRevisionByEntryId({\n model,\n ids: [entry.id]\n });\n\n const revisionKeys = {\n PK: createPartitionKey({\n id: entry.id,\n locale: model.locale,\n tenant: model.tenant\n }),\n SK: createRevisionSortKey(entry)\n };\n const latestKeys = {\n PK: createPartitionKey({\n id: entry.id,\n locale: model.locale,\n tenant: model.tenant\n }),\n SK: createLatestSortKey()\n };\n const publishedKeys = {\n PK: createPartitionKey({\n id: entry.id,\n locale: model.locale,\n tenant: model.tenant\n }),\n SK: createPublishedSortKey()\n };\n\n let latestEsEntry: ElasticsearchDbRecord | null = null;\n try {\n latestEsEntry = await getRecord<ElasticsearchDbRecord>({\n entity: esEntity,\n keys: latestKeys\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not read Elasticsearch latest or published data.\",\n ex.code || \"PUBLISH_BATCH_READ\",\n {\n error: ex,\n latestKeys: latestKeys,\n publishedKeys: publishedKeys\n }\n );\n }\n\n const items = [\n entity.putBatch({\n ...storageEntry,\n ...revisionKeys,\n TYPE: createType()\n })\n ];\n const esItems = [];\n\n const { index } = configurations.es({\n model\n });\n\n if (publishedStorageEntry && publishedStorageEntry.id !== entry.id) {\n /**\n * If there is a `published` entry already, we need to set it to `unpublished`. We need to\n * execute two updates: update the previously published entry's status and the published entry record.\n * DynamoDB does not support `batchUpdate` - so here we load the previously published\n * entry's data to update its status within a batch operation. If, hopefully,\n * they introduce a true update batch operation, remove this `read` call.\n */\n const [previouslyPublishedEntry] = await dataLoaders.getRevisionById({\n model,\n ids: [publishedStorageEntry.id]\n });\n //\n // const previouslyPublishedEntry = convertToStorageEntry({\n // model,\n // entry: initialPreviouslyPublishedEntry\n // });\n\n items.push(\n /**\n * Update currently published entry (unpublish it)\n */\n entity.putBatch({\n ...previouslyPublishedEntry,\n status: CONTENT_ENTRY_STATUS.UNPUBLISHED,\n savedOn: entry.savedOn,\n TYPE: createType(),\n PK: createPartitionKey(publishedStorageEntry),\n SK: createRevisionSortKey(publishedStorageEntry)\n })\n );\n }\n /**\n * Update the helper item in DB with the new published entry\n */\n items.push(\n entity.putBatch({\n ...storageEntry,\n ...publishedKeys,\n TYPE: createPublishedType()\n })\n );\n\n /**\n * We need the latest entry to check if it needs to be updated as well in the Elasticsearch.\n */\n const [latestStorageEntry] = await dataLoaders.getLatestRevisionByEntryId({\n model,\n ids: [entry.id]\n });\n\n if (latestStorageEntry?.id === entry.id) {\n items.push(\n entity.putBatch({\n ...storageEntry,\n ...latestKeys\n })\n );\n }\n /**\n * If we are publishing the latest revision, let's also update the latest revision's status in ES.\n */\n if (latestEsEntry && latestStorageEntry?.id === entry.id) {\n /**\n * Need to decompress the data from Elasticsearch DynamoDB table.\n *\n * No need to transform it for the storage because it was fetched directly from the Elasticsearch table, where it sits transformed.\n */\n const latestEsEntryDataDecompressed: CmsEntry = (await decompress(\n plugins,\n latestEsEntry.data\n )) as any;\n\n esItems.push(\n esEntity.putBatch({\n index,\n PK: createPartitionKey(latestEsEntryDataDecompressed),\n SK: createLatestSortKey(),\n data: {\n ...latestEsEntryDataDecompressed,\n status: CONTENT_ENTRY_STATUS.PUBLISHED,\n locked: true,\n savedOn: entry.savedOn,\n publishedOn: entry.publishedOn\n }\n })\n );\n }\n\n const preparedEntryData = prepareEntryToIndex({\n plugins,\n model,\n entry: lodashCloneDeep(entry),\n storageEntry: lodashCloneDeep(storageEntry)\n });\n /**\n * Update the published revision entry in ES.\n */\n const esLatestData = await getESPublishedEntryData(plugins, preparedEntryData);\n\n esItems.push(\n esEntity.putBatch({\n ...publishedKeys,\n index,\n data: esLatestData\n })\n );\n\n /**\n * Finally, execute regular table batch.\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 store publish entry records in DynamoDB table.\",\n ex.code || \"PUBLISH_ERROR\",\n {\n error: ex,\n entry,\n latestStorageEntry,\n publishedStorageEntry\n }\n );\n }\n /**\n * And Elasticsearch table batch.\n */\n try {\n await batchWriteAll({\n table: esEntity.table,\n items: esItems\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message ||\n \"Could not store publish entry records in DynamoDB Elasticsearch table.\",\n ex.code || \"PUBLISH_ES_ERROR\",\n {\n error: ex,\n entry,\n latestStorageEntry,\n publishedStorageEntry\n }\n );\n }\n return initialStorageEntry;\n };\n\n const unpublish = async (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsUnpublishParams\n ) => {\n const { entry: initialEntry, storageEntry: initialStorageEntry } = params;\n\n const entry = convertToStorageEntry({\n model,\n entry: initialEntry\n });\n const storageEntry = convertToStorageEntry({\n model,\n entry: initialStorageEntry\n });\n\n /**\n * We need the latest entry to check if it needs to be updated.\n */\n const [latestStorageEntry] = await dataLoaders.getLatestRevisionByEntryId({\n model,\n ids: [entry.id]\n });\n\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: createPublishedSortKey()\n }),\n entity.putBatch({\n ...storageEntry,\n PK: partitionKey,\n SK: createRevisionSortKey(entry),\n TYPE: createType()\n })\n ];\n\n const esItems = [\n esEntity.deleteBatch({\n PK: partitionKey,\n SK: createPublishedSortKey()\n })\n ];\n /**\n * If we are unpublishing the latest revision, let's also update the latest revision entry's status in ES.\n */\n if (latestStorageEntry?.id === entry.id) {\n const { index } = configurations.es({\n model\n });\n\n const preparedEntryData = prepareEntryToIndex({\n plugins,\n model,\n entry: lodashCloneDeep(entry),\n storageEntry: lodashCloneDeep(storageEntry)\n });\n\n const esLatestData = await getESLatestEntryData(plugins, preparedEntryData);\n esItems.push(\n esEntity.putBatch({\n PK: partitionKey,\n SK: createLatestSortKey(),\n index,\n data: esLatestData\n })\n );\n }\n\n /**\n * Finally, execute regular table batch.\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 store unpublished entry records in DynamoDB table.\",\n ex.code || \"UNPUBLISH_ERROR\",\n {\n entry,\n storageEntry\n }\n );\n }\n /**\n * And Elasticsearch table batch.\n */\n try {\n await batchWriteAll({\n table: esEntity.table,\n items: esItems\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message ||\n \"Could not store unpublished entry records in DynamoDB Elasticsearch table.\",\n ex.code || \"UNPUBLISH_ERROR\",\n {\n entry,\n storageEntry\n }\n );\n }\n return initialStorageEntry;\n };\n\n const requestReview = async (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsRequestReviewParams\n ) => {\n const { entry: initialEntry, storageEntry: initialStorageEntry } = params;\n\n const entry = convertToStorageEntry({\n model,\n entry: initialEntry\n });\n const storageEntry = convertToStorageEntry({\n model,\n entry: initialStorageEntry\n });\n\n /**\n * We need the latest entry to check if it needs to be updated.\n */\n const [latestStorageEntry] = await dataLoaders.getLatestRevisionByEntryId({\n model,\n ids: [entry.id]\n });\n\n const partitionKey = createPartitionKey({\n id: entry.id,\n locale: model.locale,\n tenant: model.tenant\n });\n\n /**\n * If we updated the latest version, then make sure the changes are propagated to ES too.\n */\n let esLatestData = null;\n const { index } = configurations.es({\n model\n });\n if (latestStorageEntry?.id === entry.id) {\n const preparedEntryData = prepareEntryToIndex({\n plugins,\n model,\n entry: lodashCloneDeep(entry),\n storageEntry: lodashCloneDeep(storageEntry)\n });\n\n esLatestData = await getESLatestEntryData(plugins, preparedEntryData);\n }\n\n try {\n await entity.put({\n ...storageEntry,\n PK: partitionKey,\n SK: createRevisionSortKey(entry),\n TYPE: createType()\n });\n dataLoaders.clearAll({\n model\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not store request review entry record into DynamoDB table.\",\n ex.code || \"REQUEST_REVIEW_ERROR\",\n {\n entry,\n storageEntry,\n latestStorageEntry\n }\n );\n }\n /**\n * No need to proceed further if nothing to put into Elasticsearch.\n */\n if (!esLatestData) {\n return initialStorageEntry;\n }\n\n try {\n await esEntity.put({\n PK: partitionKey,\n SK: createLatestSortKey(),\n index,\n data: esLatestData\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message ||\n \"Could not store request review entry record into DynamoDB Elasticsearch table.\",\n ex.code || \"REQUEST_REVIEW_ERROR\",\n {\n entry,\n storageEntry,\n latestStorageEntry\n }\n );\n }\n return initialStorageEntry;\n };\n\n const requestChanges = async (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsRequestChangesParams\n ) => {\n const { entry: initialEntry, storageEntry: initialStorageEntry } = params;\n\n const entry = convertToStorageEntry({\n model,\n entry: initialEntry\n });\n const storageEntry = convertToStorageEntry({\n model,\n entry: initialStorageEntry\n });\n\n /**\n * We need the latest entry to check if it needs to be updated.\n */\n const [latestStorageEntry] = await dataLoaders.getLatestRevisionByEntryId({\n model,\n ids: [entry.id]\n });\n\n const partitionKey = createPartitionKey({\n id: entry.id,\n locale: model.locale,\n tenant: model.tenant\n });\n\n const items = [\n entity.putBatch({\n ...storageEntry,\n PK: partitionKey,\n SK: createRevisionSortKey(entry),\n TYPE: createType()\n })\n ];\n /**\n * If we updated the latest version, then make sure the changes are propagated to ES too.\n */\n const { index } = configurations.es({\n model\n });\n let esLatestData = null;\n if (latestStorageEntry?.id === entry.id) {\n items.push(\n entity.putBatch({\n ...storageEntry,\n PK: partitionKey,\n SK: createLatestSortKey(),\n TYPE: createLatestType()\n })\n );\n\n const preparedEntryData = prepareEntryToIndex({\n plugins,\n model,\n entry: lodashCloneDeep(entry),\n storageEntry: lodashCloneDeep(storageEntry)\n });\n\n esLatestData = await getESLatestEntryData(plugins, preparedEntryData);\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 store request changes entry record into DynamoDB table.\",\n ex.code || \"REQUEST_CHANGES_ERROR\",\n {\n entry,\n latestStorageEntry\n }\n );\n }\n /**\n * No need to proceed further if nothing to put into Elasticsearch.\n */\n if (!esLatestData) {\n return initialStorageEntry;\n }\n\n try {\n await esEntity.put({\n PK: partitionKey,\n SK: createLatestSortKey(),\n index,\n data: esLatestData\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message ||\n \"Could not store request changes entry record into DynamoDB Elasticsearch table.\",\n ex.code || \"REQUEST_CHANGES_ERROR\",\n {\n entry,\n latestStorageEntry\n }\n );\n }\n return initialStorageEntry;\n };\n\n const getLatestRevisionByEntryId = async (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsGetLatestRevisionParams\n ) => {\n const [entry] = await dataLoaders.getLatestRevisionByEntryId({\n model,\n ids: [params.id]\n });\n if (!entry) {\n return null;\n }\n return convertFromStorageEntry({\n model,\n entry\n });\n };\n const getPublishedRevisionByEntryId = async (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsGetLatestRevisionParams\n ) => {\n const [entry] = await dataLoaders.getPublishedRevisionByEntryId({\n model,\n ids: [params.id]\n });\n if (!entry) {\n return null;\n }\n return convertFromStorageEntry({\n model,\n entry\n });\n };\n\n const getRevisionById = async (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsGetRevisionParams\n ) => {\n const [entry] = await dataLoaders.getRevisionById({\n model,\n ids: [params.id]\n });\n if (!entry) {\n return null;\n }\n return convertFromStorageEntry({\n model,\n entry\n });\n };\n\n const getRevisions = async (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsGetRevisionsParams\n ) => {\n const entries = await dataLoaders.getAllEntryRevisions({\n model,\n ids: [params.id]\n });\n\n return entries.map(entry => {\n return convertFromStorageEntry({\n model,\n entry\n });\n });\n };\n\n const getByIds = async (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsGetByIdsParams\n ) => {\n const entries = await dataLoaders.getRevisionById({\n model,\n ids: params.ids\n });\n return entries.map(entry => {\n return convertFromStorageEntry({\n model,\n entry\n });\n });\n };\n\n const getLatestByIds = async (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsGetLatestByIdsParams\n ) => {\n const entries = await dataLoaders.getLatestRevisionByEntryId({\n model,\n ids: params.ids\n });\n return entries.map(entry => {\n return convertFromStorageEntry({\n model,\n entry\n });\n });\n };\n\n const getPublishedByIds = async (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsGetPublishedByIdsParams\n ) => {\n const entries = await dataLoaders.getPublishedRevisionByEntryId({\n model,\n ids: params.ids\n });\n\n return entries.map(entry => {\n return convertFromStorageEntry({\n model,\n entry\n });\n });\n };\n\n const getPreviousRevision = async (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsGetPreviousRevisionParams\n ) => {\n const { tenant, locale } = model;\n const { entryId, version } = params;\n const queryParams: QueryOneParams = {\n entity,\n partitionKey: createPartitionKey({\n tenant,\n 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 const entry = cleanupItem(entity, result);\n\n if (!entry) {\n return null;\n }\n return convertFromStorageEntry({\n entry,\n model\n });\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 return {\n create,\n createRevisionFrom,\n update,\n delete: deleteEntry,\n deleteRevision,\n get,\n publish,\n unpublish,\n requestReview,\n requestChanges,\n list,\n getLatestRevisionByEntryId,\n getPublishedRevisionByEntryId,\n getRevisionById,\n getRevisions,\n getByIds,\n getLatestByIds,\n getPublishedByIds,\n getPreviousRevision\n };\n};\n"],"mappings":";;;;;;;;;;;AAAA;;AAyBA;;AAKA;;AACA;;AACA;;AACA;;AAIA;;AACA;;AACA;;AAMA;;AACA;;AACA;;AACA;;AACA;;;;;;AAIA,MAAMA,UAAU,GAAG,MAAc;EAC7B,OAAO,WAAP;AACH,CAFD;;AAGO,MAAMC,gBAAgB,GAAG,MAAc;EAC1C,OAAQ,GAAED,UAAU,EAAG,IAAvB;AACH,CAFM;;;;AAGA,MAAME,mBAAmB,GAAG,MAAc;EAC7C,OAAQ,GAAEF,UAAU,EAAG,IAAvB;AACH,CAFM;;;;AAIP,MAAMG,YAAY,GAAIC,KAAD,IAAqB;EACtC,uCACO,IAAAC,aAAA,EAAWD,KAAX,EAAkB,CAAC,IAAD,EAAO,IAAP,EAAa,WAAb,EAA0B,QAA1B,CAAlB,CADP;IAEIE,IAAI,EAAEN,UAAU,EAFpB;IAGIO,MAAM,EAAEP,UAAU;EAHtB;AAKH,CAND;;AAQA,MAAMQ,oBAAoB,GAAG,OAAOC,OAAP,EAAkCL,KAAlC,KAAsD;EAC/E,OAAO,IAAAM,0BAAA,EAASD,OAAT,kCACAN,YAAY,CAACC,KAAD,CADZ;IAEHO,MAAM,EAAE,IAFL;IAGHL,IAAI,EAAEL,gBAAgB,EAHnB;IAIHM,MAAM,EAAEN,gBAAgB;EAJrB,GAAP;AAMH,CAPD;;AASA,MAAMW,uBAAuB,GAAG,OAAOH,OA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js",
5
5
  "keywords": [
6
6
  "@webiny/api-headless-cms",
@@ -23,14 +23,14 @@
23
23
  "license": "MIT",
24
24
  "dependencies": {
25
25
  "@babel/runtime": "7.18.9",
26
- "@webiny/api": "5.33.1",
27
- "@webiny/api-elasticsearch": "5.33.1",
28
- "@webiny/api-headless-cms": "5.33.1",
29
- "@webiny/db-dynamodb": "5.33.1",
30
- "@webiny/error": "5.33.1",
31
- "@webiny/handler-db": "5.33.1",
32
- "@webiny/plugins": "5.33.1",
33
- "@webiny/utils": "5.33.1",
26
+ "@webiny/api": "5.33.2-beta.0",
27
+ "@webiny/api-elasticsearch": "5.33.2-beta.0",
28
+ "@webiny/api-headless-cms": "5.33.2-beta.0",
29
+ "@webiny/db-dynamodb": "5.33.2-beta.0",
30
+ "@webiny/error": "5.33.2-beta.0",
31
+ "@webiny/handler-db": "5.33.2-beta.0",
32
+ "@webiny/plugins": "5.33.2-beta.0",
33
+ "@webiny/utils": "5.33.2-beta.0",
34
34
  "dataloader": "2.1.0",
35
35
  "dynamodb-toolbox": "0.3.5",
36
36
  "jsonpack": "1.1.5",
@@ -43,10 +43,10 @@
43
43
  "@babel/preset-flow": "^7.16.0",
44
44
  "@elastic/elasticsearch": "7.12.0",
45
45
  "@types/jsonpack": "^1.1.0",
46
- "@webiny/api-dynamodb-to-elasticsearch": "^5.33.1",
47
- "@webiny/cli": "^5.33.1",
48
- "@webiny/handler-aws": "^5.33.1",
49
- "@webiny/project-utils": "^5.33.1",
46
+ "@webiny/api-dynamodb-to-elasticsearch": "^5.33.2-beta.0",
47
+ "@webiny/cli": "^5.33.2-beta.0",
48
+ "@webiny/handler-aws": "^5.33.2-beta.0",
49
+ "@webiny/project-utils": "^5.33.2-beta.0",
50
50
  "jest": "^28.1.0",
51
51
  "jest-dynalite": "^3.2.0",
52
52
  "jest-environment-node": "^27.2.4",
@@ -65,5 +65,5 @@
65
65
  "build": "yarn webiny run build",
66
66
  "watch": "yarn webiny run watch"
67
67
  },
68
- "gitHead": "2d4636192c4bc05f6e7eaccac743922200176f0a"
68
+ "gitHead": "fe536f893f26e4830e97d67368a9a9dd2b016fda"
69
69
  }
@@ -1,4 +1,4 @@
1
- import { ElasticsearchBodyModifierPlugin, ModifyBodyCallable, ModifyBodyParams as BaseModifyBodyParams } from "@webiny/api-elasticsearch/plugins/definition/ElasticsearchBodyModifierPlugin";
1
+ import { ElasticsearchBodyModifierPlugin, ModifyBodyCallable, ModifyBodyParams as BaseModifyBodyParams } from "@webiny/api-elasticsearch";
2
2
  import { CmsModel } from "@webiny/api-headless-cms/types";
3
3
  export interface ModifyBodyParams extends BaseModifyBodyParams {
4
4
  model: CmsModel;
@@ -9,9 +9,9 @@ exports.CmsEntryElasticsearchBodyModifierPlugin = void 0;
9
9
 
10
10
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
11
 
12
- var _ElasticsearchBodyModifierPlugin = require("@webiny/api-elasticsearch/plugins/definition/ElasticsearchBodyModifierPlugin");
12
+ var _apiElasticsearch = require("@webiny/api-elasticsearch");
13
13
 
14
- class CmsEntryElasticsearchBodyModifierPlugin extends _ElasticsearchBodyModifierPlugin.ElasticsearchBodyModifierPlugin {
14
+ class CmsEntryElasticsearchBodyModifierPlugin extends _apiElasticsearch.ElasticsearchBodyModifierPlugin {
15
15
  constructor(config) {
16
16
  super(config.modifyBody);
17
17
  (0, _defineProperty2.default)(this, "modelId", void 0);
@@ -1 +1 @@
1
- {"version":3,"names":["CmsEntryElasticsearchBodyModifierPlugin","ElasticsearchBodyModifierPlugin","constructor","config","modifyBody","modelId"],"sources":["CmsEntryElasticsearchBodyModifierPlugin.ts"],"sourcesContent":["import {\n ElasticsearchBodyModifierPlugin,\n ModifyBodyCallable,\n ModifyBodyParams as BaseModifyBodyParams\n} from \"@webiny/api-elasticsearch/plugins/definition/ElasticsearchBodyModifierPlugin\";\nimport { CmsModel } from \"@webiny/api-headless-cms/types\";\n\nexport interface ModifyBodyParams extends BaseModifyBodyParams {\n model: CmsModel;\n}\n\nexport interface CmsEntryElasticsearchBodyModifierPluginConfig {\n modifyBody: ModifyBodyCallable<ModifyBodyParams>;\n /**\n * If modelId is not passed, there is no filtering of plugins by it when plugin is applied during the runtime.\n */\n modelId?: string;\n}\n\nexport class CmsEntryElasticsearchBodyModifierPlugin extends ElasticsearchBodyModifierPlugin<ModifyBodyParams> {\n public static override readonly type: string = \"cms.elasticsearch.modifier.body.entry\";\n\n public readonly modelId?: string;\n\n public constructor(config: CmsEntryElasticsearchBodyModifierPluginConfig) {\n super(config.modifyBody);\n\n this.modelId = config.modelId;\n }\n}\n"],"mappings":";;;;;;;;;;;AAAA;;AAmBO,MAAMA,uCAAN,SAAsDC,gEAAtD,CAAwG;EAKpGC,WAAW,CAACC,MAAD,EAAwD;IACtE,MAAMA,MAAM,CAACC,UAAb;IADsE;IAGtE,KAAKC,OAAL,GAAeF,MAAM,CAACE,OAAtB;EACH;;AAT0G;;;8BAAlGL,uC,UACsC,uC"}
1
+ {"version":3,"names":["CmsEntryElasticsearchBodyModifierPlugin","ElasticsearchBodyModifierPlugin","constructor","config","modifyBody","modelId"],"sources":["CmsEntryElasticsearchBodyModifierPlugin.ts"],"sourcesContent":["import {\n ElasticsearchBodyModifierPlugin,\n ModifyBodyCallable,\n ModifyBodyParams as BaseModifyBodyParams\n} from \"@webiny/api-elasticsearch\";\nimport { CmsModel } from \"@webiny/api-headless-cms/types\";\n\nexport interface ModifyBodyParams extends BaseModifyBodyParams {\n model: CmsModel;\n}\n\nexport interface CmsEntryElasticsearchBodyModifierPluginConfig {\n modifyBody: ModifyBodyCallable<ModifyBodyParams>;\n /**\n * If modelId is not passed, there is no filtering of plugins by it when plugin is applied during the runtime.\n */\n modelId?: string;\n}\n\nexport class CmsEntryElasticsearchBodyModifierPlugin extends ElasticsearchBodyModifierPlugin<ModifyBodyParams> {\n public static override readonly type: string = \"cms.elasticsearch.modifier.body.entry\";\n\n public readonly modelId?: string;\n\n public constructor(config: CmsEntryElasticsearchBodyModifierPluginConfig) {\n super(config.modifyBody);\n\n this.modelId = config.modelId;\n }\n}\n"],"mappings":";;;;;;;;;;;AAAA;;AAmBO,MAAMA,uCAAN,SAAsDC,iDAAtD,CAAwG;EAKpGC,WAAW,CAACC,MAAD,EAAwD;IACtE,MAAMA,MAAM,CAACC,UAAb;IADsE;IAGtE,KAAKC,OAAL,GAAeF,MAAM,CAACE,OAAtB;EACH;;AAT0G;;;8BAAlGL,uC,UACsC,uC"}
@@ -1,4 +1,4 @@
1
- import { ElasticsearchFieldPlugin, ElasticsearchFieldPluginParams as ElasticsearchFieldPluginParamsBaseParams } from "@webiny/api-elasticsearch/plugins/definition/ElasticsearchFieldPlugin";
1
+ import { ElasticsearchFieldPlugin, ElasticsearchFieldPluginParams as ElasticsearchFieldPluginParamsBaseParams } from "@webiny/api-elasticsearch";
2
2
  export interface CmsEntryElasticsearchFieldPluginParams extends ElasticsearchFieldPluginParamsBaseParams {
3
3
  /**
4
4
  * If modelId is not passed, there is no filtering of plugins by it when plugin is applied during the runtime.
@@ -9,9 +9,9 @@ exports.CmsEntryElasticsearchFieldPlugin = void 0;
9
9
 
10
10
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
11
 
12
- var _ElasticsearchFieldPlugin = require("@webiny/api-elasticsearch/plugins/definition/ElasticsearchFieldPlugin");
12
+ var _apiElasticsearch = require("@webiny/api-elasticsearch");
13
13
 
14
- class CmsEntryElasticsearchFieldPlugin extends _ElasticsearchFieldPlugin.ElasticsearchFieldPlugin {
14
+ class CmsEntryElasticsearchFieldPlugin extends _apiElasticsearch.ElasticsearchFieldPlugin {
15
15
  constructor(params) {
16
16
  super(params);
17
17
  (0, _defineProperty2.default)(this, "modelId", void 0);
@@ -1 +1 @@
1
- {"version":3,"names":["CmsEntryElasticsearchFieldPlugin","ElasticsearchFieldPlugin","constructor","params","modelId"],"sources":["CmsEntryElasticsearchFieldPlugin.ts"],"sourcesContent":["import {\n ElasticsearchFieldPlugin,\n ElasticsearchFieldPluginParams as ElasticsearchFieldPluginParamsBaseParams\n} from \"@webiny/api-elasticsearch/plugins/definition/ElasticsearchFieldPlugin\";\n\nexport interface CmsEntryElasticsearchFieldPluginParams\n extends ElasticsearchFieldPluginParamsBaseParams {\n /**\n * If modelId is not passed, there is no filtering of plugins by it when plugin is applied during the runtime.\n */\n modelId?: string;\n}\nexport class CmsEntryElasticsearchFieldPlugin extends ElasticsearchFieldPlugin {\n public static override readonly type: string = \"elasticsearch.fieldDefinition.cms.entry\";\n\n public readonly modelId?: string;\n\n public constructor(params: CmsEntryElasticsearchFieldPluginParams) {\n super(params);\n\n this.modelId = params.modelId;\n }\n}\n"],"mappings":";;;;;;;;;;;AAAA;;AAYO,MAAMA,gCAAN,SAA+CC,kDAA/C,CAAwE;EAKpEC,WAAW,CAACC,MAAD,EAAiD;IAC/D,MAAMA,MAAN;IAD+D;IAG/D,KAAKC,OAAL,GAAeD,MAAM,CAACC,OAAtB;EACH;;AAT0E;;;8BAAlEJ,gC,UACsC,yC"}
1
+ {"version":3,"names":["CmsEntryElasticsearchFieldPlugin","ElasticsearchFieldPlugin","constructor","params","modelId"],"sources":["CmsEntryElasticsearchFieldPlugin.ts"],"sourcesContent":["import {\n ElasticsearchFieldPlugin,\n ElasticsearchFieldPluginParams as ElasticsearchFieldPluginParamsBaseParams\n} from \"@webiny/api-elasticsearch\";\n\nexport interface CmsEntryElasticsearchFieldPluginParams\n extends ElasticsearchFieldPluginParamsBaseParams {\n /**\n * If modelId is not passed, there is no filtering of plugins by it when plugin is applied during the runtime.\n */\n modelId?: string;\n}\nexport class CmsEntryElasticsearchFieldPlugin extends ElasticsearchFieldPlugin {\n public static override readonly type: string = \"elasticsearch.fieldDefinition.cms.entry\";\n\n public readonly modelId?: string;\n\n public constructor(params: CmsEntryElasticsearchFieldPluginParams) {\n super(params);\n\n this.modelId = params.modelId;\n }\n}\n"],"mappings":";;;;;;;;;;;AAAA;;AAYO,MAAMA,gCAAN,SAA+CC,0CAA/C,CAAwE;EAKpEC,WAAW,CAACC,MAAD,EAAiD;IAC/D,MAAMA,MAAN;IAD+D;IAG/D,KAAKC,OAAL,GAAeD,MAAM,CAACC,OAAtB;EACH;;AAT0E;;;8BAAlEJ,gC,UACsC,yC"}
@@ -1,4 +1,4 @@
1
- import { ElasticsearchIndexPlugin } from "@webiny/api-elasticsearch/plugins/definition/ElasticsearchIndexPlugin";
1
+ import { ElasticsearchIndexPlugin } from "@webiny/api-elasticsearch";
2
2
  export declare class CmsEntryElasticsearchIndexPlugin extends ElasticsearchIndexPlugin {
3
3
  static readonly type: string;
4
4
  }
@@ -9,9 +9,9 @@ exports.CmsEntryElasticsearchIndexPlugin = void 0;
9
9
 
10
10
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
11
 
12
- var _ElasticsearchIndexPlugin = require("@webiny/api-elasticsearch/plugins/definition/ElasticsearchIndexPlugin");
12
+ var _apiElasticsearch = require("@webiny/api-elasticsearch");
13
13
 
14
- class CmsEntryElasticsearchIndexPlugin extends _ElasticsearchIndexPlugin.ElasticsearchIndexPlugin {}
14
+ class CmsEntryElasticsearchIndexPlugin extends _apiElasticsearch.ElasticsearchIndexPlugin {}
15
15
 
16
16
  exports.CmsEntryElasticsearchIndexPlugin = CmsEntryElasticsearchIndexPlugin;
17
17
  (0, _defineProperty2.default)(CmsEntryElasticsearchIndexPlugin, "type", "cms.entry.elasticsearch.index");
@@ -1 +1 @@
1
- {"version":3,"names":["CmsEntryElasticsearchIndexPlugin","ElasticsearchIndexPlugin"],"sources":["CmsEntryElasticsearchIndexPlugin.ts"],"sourcesContent":["import { ElasticsearchIndexPlugin } from \"@webiny/api-elasticsearch/plugins/definition/ElasticsearchIndexPlugin\";\n\nexport class CmsEntryElasticsearchIndexPlugin extends ElasticsearchIndexPlugin {\n public static override readonly type: string = \"cms.entry.elasticsearch.index\";\n}\n"],"mappings":";;;;;;;;;;;AAAA;;AAEO,MAAMA,gCAAN,SAA+CC,kDAA/C,CAAwE;;;8BAAlED,gC,UACsC,+B"}
1
+ {"version":3,"names":["CmsEntryElasticsearchIndexPlugin","ElasticsearchIndexPlugin"],"sources":["CmsEntryElasticsearchIndexPlugin.ts"],"sourcesContent":["import { ElasticsearchIndexPlugin } from \"@webiny/api-elasticsearch\";\n\nexport class CmsEntryElasticsearchIndexPlugin extends ElasticsearchIndexPlugin {\n public static override readonly type: string = \"cms.entry.elasticsearch.index\";\n}\n"],"mappings":";;;;;;;;;;;AAAA;;AAEO,MAAMA,gCAAN,SAA+CC,0CAA/C,CAAwE;;;8BAAlED,gC,UACsC,+B"}
@@ -1,4 +1,4 @@
1
- import { ElasticsearchQueryModifierPlugin, ModifyQueryCallable, ModifyQueryParams as BaseModifyQueryParams } from "@webiny/api-elasticsearch/plugins/definition/ElasticsearchQueryModifierPlugin";
1
+ import { ElasticsearchQueryModifierPlugin, ModifyQueryCallable, ModifyQueryParams as BaseModifyQueryParams } from "@webiny/api-elasticsearch";
2
2
  import { CmsModel } from "@webiny/api-headless-cms/types";
3
3
  export interface ModifyQueryParams extends BaseModifyQueryParams {
4
4
  model: CmsModel;
@@ -9,9 +9,9 @@ exports.CmsEntryElasticsearchQueryModifierPlugin = void 0;
9
9
 
10
10
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
11
 
12
- var _ElasticsearchQueryModifierPlugin = require("@webiny/api-elasticsearch/plugins/definition/ElasticsearchQueryModifierPlugin");
12
+ var _apiElasticsearch = require("@webiny/api-elasticsearch");
13
13
 
14
- class CmsEntryElasticsearchQueryModifierPlugin extends _ElasticsearchQueryModifierPlugin.ElasticsearchQueryModifierPlugin {
14
+ class CmsEntryElasticsearchQueryModifierPlugin extends _apiElasticsearch.ElasticsearchQueryModifierPlugin {
15
15
  constructor(config) {
16
16
  super(config.modifyQuery);
17
17
  (0, _defineProperty2.default)(this, "modelId", void 0);
@@ -1 +1 @@
1
- {"version":3,"names":["CmsEntryElasticsearchQueryModifierPlugin","ElasticsearchQueryModifierPlugin","constructor","config","modifyQuery","modelId"],"sources":["CmsEntryElasticsearchQueryModifierPlugin.ts"],"sourcesContent":["import {\n ElasticsearchQueryModifierPlugin,\n ModifyQueryCallable,\n ModifyQueryParams as BaseModifyQueryParams\n} from \"@webiny/api-elasticsearch/plugins/definition/ElasticsearchQueryModifierPlugin\";\nimport { CmsModel } from \"@webiny/api-headless-cms/types\";\n\nexport interface ModifyQueryParams extends BaseModifyQueryParams {\n model: CmsModel;\n}\n\nexport interface CmsEntryElasticsearchQueryModifierPluginConfig {\n modifyQuery: ModifyQueryCallable<ModifyQueryParams>;\n /**\n * If modelId is not passed, there is no filtering of plugins by it when plugin is applied during the runtime.\n */\n modelId?: string;\n}\n\nexport class CmsEntryElasticsearchQueryModifierPlugin extends ElasticsearchQueryModifierPlugin<ModifyQueryParams> {\n public static override readonly type: string = \"cms.elasticsearch.modifier.query.entry\";\n\n public readonly modelId?: string;\n\n public constructor(config: CmsEntryElasticsearchQueryModifierPluginConfig) {\n super(config.modifyQuery);\n\n this.modelId = config.modelId;\n }\n}\n"],"mappings":";;;;;;;;;;;AAAA;;AAmBO,MAAMA,wCAAN,SAAuDC,kEAAvD,CAA2G;EAKvGC,WAAW,CAACC,MAAD,EAAyD;IACvE,MAAMA,MAAM,CAACC,WAAb;IADuE;IAGvE,KAAKC,OAAL,GAAeF,MAAM,CAACE,OAAtB;EACH;;AAT6G;;;8BAArGL,wC,UACsC,wC"}
1
+ {"version":3,"names":["CmsEntryElasticsearchQueryModifierPlugin","ElasticsearchQueryModifierPlugin","constructor","config","modifyQuery","modelId"],"sources":["CmsEntryElasticsearchQueryModifierPlugin.ts"],"sourcesContent":["import {\n ElasticsearchQueryModifierPlugin,\n ModifyQueryCallable,\n ModifyQueryParams as BaseModifyQueryParams\n} from \"@webiny/api-elasticsearch\";\nimport { CmsModel } from \"@webiny/api-headless-cms/types\";\n\nexport interface ModifyQueryParams extends BaseModifyQueryParams {\n model: CmsModel;\n}\n\nexport interface CmsEntryElasticsearchQueryModifierPluginConfig {\n modifyQuery: ModifyQueryCallable<ModifyQueryParams>;\n /**\n * If modelId is not passed, there is no filtering of plugins by it when plugin is applied during the runtime.\n */\n modelId?: string;\n}\n\nexport class CmsEntryElasticsearchQueryModifierPlugin extends ElasticsearchQueryModifierPlugin<ModifyQueryParams> {\n public static override readonly type: string = \"cms.elasticsearch.modifier.query.entry\";\n\n public readonly modelId?: string;\n\n public constructor(config: CmsEntryElasticsearchQueryModifierPluginConfig) {\n super(config.modifyQuery);\n\n this.modelId = config.modelId;\n }\n}\n"],"mappings":";;;;;;;;;;;AAAA;;AAmBO,MAAMA,wCAAN,SAAuDC,kDAAvD,CAA2G;EAKvGC,WAAW,CAACC,MAAD,EAAyD;IACvE,MAAMA,MAAM,CAACC,WAAb;IADuE;IAGvE,KAAKC,OAAL,GAAeF,MAAM,CAACE,OAAtB;EACH;;AAT6G;;;8BAArGL,wC,UACsC,wC"}
@@ -1,4 +1,4 @@
1
- import { ElasticsearchSortModifierPlugin, ModifySortCallable, ModifySortParams as BaseModifySortParams } from "@webiny/api-elasticsearch/plugins/definition/ElasticsearchSortModifierPlugin";
1
+ import { ElasticsearchSortModifierPlugin, ModifySortCallable, ModifySortParams as BaseModifySortParams } from "@webiny/api-elasticsearch";
2
2
  import { CmsModel } from "@webiny/api-headless-cms/types";
3
3
  export interface ModifySortParams extends BaseModifySortParams {
4
4
  model: CmsModel;
@@ -9,9 +9,9 @@ exports.CmsEntryElasticsearchSortModifierPlugin = void 0;
9
9
 
10
10
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
11
 
12
- var _ElasticsearchSortModifierPlugin = require("@webiny/api-elasticsearch/plugins/definition/ElasticsearchSortModifierPlugin");
12
+ var _apiElasticsearch = require("@webiny/api-elasticsearch");
13
13
 
14
- class CmsEntryElasticsearchSortModifierPlugin extends _ElasticsearchSortModifierPlugin.ElasticsearchSortModifierPlugin {
14
+ class CmsEntryElasticsearchSortModifierPlugin extends _apiElasticsearch.ElasticsearchSortModifierPlugin {
15
15
  constructor(config) {
16
16
  super(config.modifySort);
17
17
  (0, _defineProperty2.default)(this, "modelId", void 0);