@webiny/api-headless-cms-ddb 0.0.0-mt-3 → 0.0.0-unstable.5e7233243f

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 (70) hide show
  1. package/definitions/entry.d.ts +2 -1
  2. package/definitions/entry.js +5 -2
  3. package/definitions/entry.js.map +1 -0
  4. package/definitions/group.d.ts +2 -1
  5. package/definitions/group.js +2 -2
  6. package/definitions/group.js.map +1 -0
  7. package/definitions/model.d.ts +2 -1
  8. package/definitions/model.js +2 -2
  9. package/definitions/model.js.map +1 -0
  10. package/definitions/settings.d.ts +2 -1
  11. package/definitions/settings.js +2 -2
  12. package/definitions/settings.js.map +1 -0
  13. package/definitions/system.d.ts +2 -1
  14. package/definitions/system.js +2 -2
  15. package/definitions/system.js.map +1 -0
  16. package/definitions/table.d.ts +2 -1
  17. package/definitions/table.js.map +1 -0
  18. package/dynamoDb/index.d.ts +1 -1
  19. package/dynamoDb/index.js +6 -10
  20. package/dynamoDb/index.js.map +1 -0
  21. package/dynamoDb/path/plainObject.d.ts +2 -3
  22. package/dynamoDb/path/plainObject.js +28 -21
  23. package/dynamoDb/path/plainObject.js.map +1 -0
  24. package/dynamoDb/storage/date.d.ts +2 -3
  25. package/dynamoDb/storage/date.js +79 -45
  26. package/dynamoDb/storage/date.js.map +1 -0
  27. package/dynamoDb/storage/longText.d.ts +7 -4
  28. package/dynamoDb/storage/longText.js +71 -53
  29. package/dynamoDb/storage/longText.js.map +1 -0
  30. package/dynamoDb/storage/richText.d.ts +2 -8
  31. package/dynamoDb/storage/richText.js +69 -66
  32. package/dynamoDb/storage/richText.js.map +1 -0
  33. package/dynamoDb/transformValue/datetime.d.ts +4 -2
  34. package/dynamoDb/transformValue/datetime.js +31 -26
  35. package/dynamoDb/transformValue/datetime.js.map +1 -0
  36. package/index.js +20 -19
  37. package/index.js.map +1 -0
  38. package/operations/entry/dataLoaders.d.ts +12 -8
  39. package/operations/entry/dataLoaders.js +26 -6
  40. package/operations/entry/dataLoaders.js.map +1 -0
  41. package/operations/entry/index.d.ts +2 -2
  42. package/operations/entry/index.js +264 -103
  43. package/operations/entry/index.js.map +1 -0
  44. package/operations/entry/keys.js +11 -0
  45. package/operations/entry/keys.js.map +1 -0
  46. package/operations/entry/systemFields.js +18 -0
  47. package/operations/entry/systemFields.js.map +1 -0
  48. package/operations/entry/utils.d.ts +10 -5
  49. package/operations/entry/utils.js +373 -95
  50. package/operations/entry/utils.js.map +1 -0
  51. package/operations/group/index.d.ts +3 -2
  52. package/operations/group/index.js +3 -5
  53. package/operations/group/index.js.map +1 -0
  54. package/operations/model/index.d.ts +3 -2
  55. package/operations/model/index.js +15 -10
  56. package/operations/model/index.js.map +1 -0
  57. package/operations/settings/index.d.ts +3 -2
  58. package/operations/settings/index.js +3 -5
  59. package/operations/settings/index.js.map +1 -0
  60. package/operations/system/index.d.ts +3 -2
  61. package/operations/system/index.js +3 -5
  62. package/operations/system/index.js.map +1 -0
  63. package/package.json +23 -23
  64. package/plugins/CmsEntryFieldFilterPathPlugin.d.ts +22 -0
  65. package/plugins/CmsEntryFieldFilterPathPlugin.js +55 -0
  66. package/plugins/CmsEntryFieldFilterPathPlugin.js.map +1 -0
  67. package/types.d.ts +1 -32
  68. package/types.js.map +1 -0
  69. package/dynamoDb/path/ref.d.ts +0 -3
  70. package/dynamoDb/path/ref.js +0 -27
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createType","createLatestType","createPublishedType","convertToStorageEntry","params","model","storageEntry","values","convertValueKeyToStorage","fields","convertFromStorageEntry","convertValueKeyFromStorage","createEntriesStorageOperations","entity","plugins","dataLoaders","DataLoadersHandler","storageTransformPlugins","byType","StorageTransformPlugin","type","reduce","collection","plugin","fieldType","createStorageTransformCallable","field","value","fromStorage","getStoragePlugin","create","entry","initialStorageEntry","partitionKey","createPartitionKey","id","locale","tenant","isPublished","status","locked","items","putBatch","PK","SK","createRevisionSortKey","TYPE","GSI1_PK","createGSIPartitionKey","GSI1_SK","createGSISortKey","createLatestSortKey","push","createPublishedSortKey","batchWriteAll","table","clearAll","ex","WebinyError","message","code","error","createRevisionFrom","update","latestStorageEntry","getLatestRevisionByEntryId","deleteEntry","queryAllParams","options","gte","records","queryAll","map","item","deleteBatch","deleteRevision","latestEntry","initialLatestStorageEntry","publishedStorageEntry","getPublishedRevisionByEntryId","ids","shift","getRevisionById","getRevisions","getAllEntryRevisions","getByIds","getLatestByIds","getPublishedByIds","getPreviousRevision","entryId","version","queryParams","lt","zeroPad","filters","attr","eq","reverse","result","queryOne","cleanupItem","list","limit","initialLimit","where","initialWhere","after","sort","search","published","index","length","hasMoreItems","totalCount","cursor","modelFields","buildModelFields","filteredItems","filterItems","record","fullTextSearch","term","sortedItems","sortEntryItems","start","parseInt","decodeCursor","end","undefined","slicedItems","slice","encodeCursor","cleanupItems","get","requestChanges","requestReview","publish","initialPublishedStorageEntry","CONTENT_ENTRY_STATUS","UNPUBLISHED","unpublish","delete"],"sources":["index.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { DataLoadersHandler } from \"./dataLoaders\";\nimport {\n CmsEntry,\n CmsEntryListWhere,\n CmsEntryStorageOperations,\n CmsEntryStorageOperationsCreateParams,\n CmsEntryStorageOperationsCreateRevisionFromParams,\n CmsEntryStorageOperationsDeleteParams,\n CmsEntryStorageOperationsDeleteRevisionParams,\n CmsEntryStorageOperationsGetByIdsParams,\n CmsEntryStorageOperationsGetLatestByIdsParams,\n CmsEntryStorageOperationsGetLatestRevisionParams,\n CmsEntryStorageOperationsGetParams,\n CmsEntryStorageOperationsGetPreviousRevisionParams,\n CmsEntryStorageOperationsGetPublishedByIdsParams,\n CmsEntryStorageOperationsGetRevisionParams,\n CmsEntryStorageOperationsGetRevisionsParams,\n CmsEntryStorageOperationsListParams,\n CmsEntryStorageOperationsPublishParams,\n CmsEntryStorageOperationsRequestChangesParams,\n CmsEntryStorageOperationsRequestReviewParams,\n CmsEntryStorageOperationsUnpublishParams,\n CmsEntryStorageOperationsUpdateParams,\n StorageOperationsCmsModel,\n CONTENT_ENTRY_STATUS,\n CmsStorageEntry\n} from \"@webiny/api-headless-cms/types\";\nimport { Entity } from \"dynamodb-toolbox\";\nimport { filterItems, buildModelFields, sortEntryItems, FilterItemFromStorage } from \"./utils\";\nimport {\n createGSIPartitionKey,\n createGSISortKey,\n createLatestSortKey,\n createPartitionKey,\n createPublishedSortKey,\n createRevisionSortKey\n} from \"~/operations/entry/keys\";\nimport { batchWriteAll } from \"@webiny/db-dynamodb/utils/batchWrite\";\nimport {\n queryAll,\n QueryAllParams,\n queryOne,\n QueryOneParams\n} from \"@webiny/db-dynamodb/utils/query\";\nimport { cleanupItem, cleanupItems } from \"@webiny/db-dynamodb/utils/cleanup\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport { decodeCursor, encodeCursor } from \"@webiny/utils/cursor\";\nimport { zeroPad } from \"@webiny/utils/zeroPad\";\nimport { StorageTransformPlugin } from \"@webiny/api-headless-cms\";\n\nconst createType = (): string => {\n return \"cms.entry\";\n};\nconst createLatestType = (): string => {\n return `${createType()}.l`;\n};\nconst createPublishedType = (): string => {\n return `${createType()}.p`;\n};\n\ninterface ConvertStorageEntryParams {\n storageEntry: CmsStorageEntry;\n model: StorageOperationsCmsModel;\n}\nconst convertToStorageEntry = (params: ConvertStorageEntryParams): CmsStorageEntry => {\n const { model, storageEntry } = params;\n\n const values = model.convertValueKeyToStorage({\n fields: model.fields,\n values: storageEntry.values\n });\n return {\n ...storageEntry,\n values\n };\n};\n\nconst convertFromStorageEntry = (params: ConvertStorageEntryParams): CmsStorageEntry => {\n const { model, storageEntry } = params;\n\n const values = model.convertValueKeyFromStorage({\n fields: model.fields,\n values: storageEntry.values\n });\n return {\n ...storageEntry,\n values\n };\n};\n\nexport interface CreateEntriesStorageOperationsParams {\n entity: Entity<any>;\n plugins: PluginsContainer;\n}\nexport const createEntriesStorageOperations = (\n params: CreateEntriesStorageOperationsParams\n): CmsEntryStorageOperations => {\n const { entity, plugins } = params;\n\n const dataLoaders = new DataLoadersHandler({\n entity\n });\n\n const storageTransformPlugins = plugins\n .byType<StorageTransformPlugin>(StorageTransformPlugin.type)\n .reduce((collection, plugin) => {\n collection[plugin.fieldType] = plugin;\n return collection;\n }, {} as Record<string, StorageTransformPlugin>);\n\n const createStorageTransformCallable = (\n model: StorageOperationsCmsModel\n ): FilterItemFromStorage => {\n return (field, value) => {\n const plugin: StorageTransformPlugin = storageTransformPlugins[field.type];\n if (!plugin) {\n return value;\n }\n return plugin.fromStorage({\n model,\n field,\n value,\n getStoragePlugin(fieldType: string): StorageTransformPlugin {\n return storageTransformPlugins[fieldType] || storageTransformPlugins[\"*\"];\n },\n plugins\n });\n };\n };\n\n const create = async (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsCreateParams\n ) => {\n const { entry, storageEntry: initialStorageEntry } = params;\n\n const partitionKey = createPartitionKey({\n id: entry.id,\n locale: model.locale,\n tenant: model.tenant\n });\n\n const isPublished = entry.status === \"published\";\n\n const locked = isPublished ? true : entry.locked;\n\n const storageEntry = convertToStorageEntry({\n model,\n storageEntry: initialStorageEntry\n });\n /**\n * We need to:\n * - create new main entry item\n * - create new or update latest entry item\n */\n const items = [\n entity.putBatch({\n ...storageEntry,\n locked,\n PK: partitionKey,\n SK: createRevisionSortKey(entry),\n TYPE: createType(),\n GSI1_PK: createGSIPartitionKey(model, \"A\"),\n GSI1_SK: createGSISortKey(storageEntry)\n }),\n entity.putBatch({\n ...storageEntry,\n locked,\n PK: partitionKey,\n SK: createLatestSortKey(),\n TYPE: createLatestType(),\n GSI1_PK: createGSIPartitionKey(model, \"L\"),\n GSI1_SK: createGSISortKey(storageEntry)\n })\n ];\n\n /**\n * We need to create published entry if\n */\n if (isPublished) {\n items.push(\n entity.putBatch({\n ...storageEntry,\n locked,\n PK: partitionKey,\n SK: createPublishedSortKey(),\n TYPE: createLatestType(),\n GSI1_PK: createGSIPartitionKey(model, \"P\"),\n GSI1_SK: createGSISortKey(storageEntry)\n })\n );\n }\n\n try {\n await batchWriteAll({\n table: entity.table,\n items\n });\n dataLoaders.clearAll({\n model\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not insert data into the DynamoDB.\",\n ex.code || \"CREATE_ENTRY_ERROR\",\n {\n error: ex,\n entry\n }\n );\n }\n\n return initialStorageEntry;\n };\n\n const createRevisionFrom = async (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsCreateRevisionFromParams\n ) => {\n const { entry, storageEntry: initialStorageEntry } = params;\n\n const partitionKey = createPartitionKey({\n id: entry.id,\n locale: model.locale,\n tenant: model.tenant\n });\n\n const storageEntry = convertToStorageEntry({\n storageEntry: initialStorageEntry,\n model\n });\n /**\n * We need to:\n * - create the main entry item\n * - update the last entry item to a current one\n */\n const items = [\n entity.putBatch({\n ...storageEntry,\n PK: partitionKey,\n SK: createRevisionSortKey(storageEntry),\n TYPE: createType(),\n GSI1_PK: createGSIPartitionKey(model, \"A\"),\n GSI1_SK: createGSISortKey(storageEntry)\n }),\n entity.putBatch({\n ...storageEntry,\n PK: partitionKey,\n SK: createLatestSortKey(),\n TYPE: createLatestType(),\n GSI1_PK: createGSIPartitionKey(model, \"L\"),\n GSI1_SK: createGSISortKey(storageEntry)\n })\n ];\n try {\n await batchWriteAll({\n table: entity.table,\n items\n });\n dataLoaders.clearAll({\n model\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not create revision from given entry.\",\n ex.code || \"CREATE_REVISION_ERROR\",\n {\n error: ex,\n entry,\n storageEntry\n }\n );\n }\n /**\n * There are no modifications on the entry created so just return the data.\n */\n return initialStorageEntry;\n };\n\n const update = async (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsUpdateParams\n ) => {\n const { entry, storageEntry: initialStorageEntry } = params;\n const partitionKey = createPartitionKey({\n id: entry.id,\n locale: model.locale,\n tenant: model.tenant\n });\n\n const isPublished = entry.status === \"published\";\n const locked = isPublished ? true : entry.locked;\n\n const items = [];\n\n const storageEntry = convertToStorageEntry({\n model,\n storageEntry: initialStorageEntry\n });\n /**\n * We need to:\n * - update the current entry\n * - update the latest entry if the current entry is the latest one\n */\n items.push(\n entity.putBatch({\n ...storageEntry,\n locked,\n PK: partitionKey,\n SK: createRevisionSortKey(storageEntry),\n TYPE: createType(),\n GSI1_PK: createGSIPartitionKey(model, \"A\"),\n GSI1_SK: createGSISortKey(storageEntry)\n })\n );\n\n if (isPublished) {\n items.push(\n entity.putBatch({\n ...storageEntry,\n locked,\n PK: partitionKey,\n SK: createPublishedSortKey(),\n TYPE: createPublishedType(),\n GSI1_PK: createGSIPartitionKey(model, \"P\"),\n GSI1_SK: createGSISortKey(storageEntry)\n })\n );\n }\n\n /**\n * We need the latest entry to update it as well if neccessary.\n */\n const latestStorageEntry = await getLatestRevisionByEntryId(model, entry);\n\n if (latestStorageEntry && latestStorageEntry.id === entry.id) {\n items.push(\n entity.putBatch({\n ...storageEntry,\n locked,\n PK: partitionKey,\n SK: createLatestSortKey(),\n TYPE: createLatestType(),\n GSI1_PK: createGSIPartitionKey(model, \"L\"),\n GSI1_SK: createGSISortKey(entry)\n })\n );\n }\n\n try {\n await batchWriteAll({\n table: entity.table,\n items\n });\n dataLoaders.clearAll({\n model\n });\n return initialStorageEntry;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not update entry.\",\n ex.code || \"UPDATE_ERROR\",\n {\n error: ex,\n entry,\n latestStorageEntry\n }\n );\n }\n };\n\n const deleteEntry = async (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsDeleteParams\n ) => {\n const { entry } = params;\n\n const queryAllParams: QueryAllParams = {\n entity,\n partitionKey: createPartitionKey({\n id: entry.id,\n locale: model.locale,\n tenant: model.tenant\n }),\n options: {\n gte: \" \"\n }\n };\n\n let records = [];\n try {\n records = await queryAll(queryAllParams);\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not load all records.\",\n ex.code || \"LOAD_ALL_RECORDS_ERROR\",\n {\n error: ex,\n entry\n }\n );\n }\n const items = records.map(item => {\n return entity.deleteBatch({\n PK: item.PK,\n SK: item.SK\n });\n });\n\n try {\n await batchWriteAll({\n table: entity.table,\n items\n });\n dataLoaders.clearAll({\n model\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not delete the entry.\",\n ex.code || \"DELETE_ENTRY_ERROR\",\n {\n error: ex,\n partitionKey: queryAllParams.partitionKey,\n entry\n }\n );\n }\n };\n\n const deleteRevision = async (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsDeleteRevisionParams\n ) => {\n const { entry, latestEntry, latestStorageEntry: initialLatestStorageEntry } = params;\n const partitionKey = createPartitionKey({\n id: entry.id,\n locale: model.locale,\n tenant: model.tenant\n });\n\n const items = [\n entity.deleteBatch({\n PK: partitionKey,\n SK: createRevisionSortKey(entry)\n })\n ];\n\n const publishedStorageEntry = await getPublishedRevisionByEntryId(model, entry);\n\n /**\n * If revision we are deleting is the published one as well, we need to delete those records as well.\n */\n if (publishedStorageEntry && entry.id === publishedStorageEntry.id) {\n items.push(\n entity.deleteBatch({\n PK: partitionKey,\n SK: createPublishedSortKey()\n })\n );\n }\n if (initialLatestStorageEntry) {\n const latestStorageEntry = convertToStorageEntry({\n storageEntry: initialLatestStorageEntry,\n model\n });\n items.push(\n entity.putBatch({\n ...latestStorageEntry,\n PK: partitionKey,\n SK: createLatestSortKey(),\n TYPE: createLatestType(),\n GSI1_PK: createGSIPartitionKey(model, \"L\"),\n GSI1_SK: createGSISortKey(latestStorageEntry)\n })\n );\n }\n try {\n await batchWriteAll({\n table: entity.table,\n items\n });\n dataLoaders.clearAll({\n model\n });\n } catch (ex) {\n throw new WebinyError(ex.message, ex.code, {\n error: ex,\n entry,\n latestEntry\n });\n }\n };\n\n const getLatestRevisionByEntryId = async (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsGetLatestRevisionParams\n ) => {\n const items = await dataLoaders.getLatestRevisionByEntryId({\n model,\n ids: [params.id]\n });\n const item = items.shift() || null;\n if (!item) {\n return null;\n }\n return convertFromStorageEntry({\n storageEntry: item,\n model\n });\n };\n const getPublishedRevisionByEntryId = async (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsGetLatestRevisionParams\n ) => {\n const items = await dataLoaders.getPublishedRevisionByEntryId({\n model,\n ids: [params.id]\n });\n const item = items.shift() || null;\n if (!item) {\n return null;\n }\n return convertFromStorageEntry({\n storageEntry: item,\n model\n });\n };\n\n const getRevisionById = async (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsGetRevisionParams\n ) => {\n const items = await dataLoaders.getRevisionById({\n model,\n ids: [params.id]\n });\n const item = items.shift() || null;\n if (!item) {\n return null;\n }\n return convertFromStorageEntry({\n storageEntry: item,\n model\n });\n };\n\n const getRevisions = async (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsGetRevisionsParams\n ) => {\n const items = await dataLoaders.getAllEntryRevisions({\n model,\n ids: [params.id]\n });\n\n return items.map(item => {\n return convertFromStorageEntry({\n storageEntry: item,\n model\n });\n });\n };\n\n const getByIds = async (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsGetByIdsParams\n ) => {\n const items = await dataLoaders.getRevisionById({\n model,\n ids: params.ids\n });\n\n return items.map(item => {\n return convertFromStorageEntry({\n storageEntry: item,\n model\n });\n });\n };\n\n const getLatestByIds = async (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsGetLatestByIdsParams\n ) => {\n const items = await dataLoaders.getLatestRevisionByEntryId({\n model,\n ids: params.ids\n });\n\n return items.map(item => {\n return convertFromStorageEntry({\n storageEntry: item,\n model\n });\n });\n };\n\n const getPublishedByIds = async (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsGetPublishedByIdsParams\n ) => {\n const items = await dataLoaders.getPublishedRevisionByEntryId({\n model,\n ids: params.ids\n });\n\n return items.map(item => {\n return convertFromStorageEntry({\n storageEntry: item,\n model\n });\n });\n };\n\n const getPreviousRevision = async (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsGetPreviousRevisionParams\n ) => {\n const { entryId, version } = params;\n const queryParams: QueryOneParams = {\n entity,\n partitionKey: createPartitionKey({\n tenant: model.tenant,\n locale: model.locale,\n id: entryId\n }),\n options: {\n lt: `REV#${zeroPad(version)}`,\n /**\n * We need to have extra checks because DynamoDB will return published or latest record if there is no REV# record.\n */\n filters: [\n {\n attr: \"TYPE\",\n eq: createType()\n },\n {\n attr: \"version\",\n lt: version\n }\n ],\n reverse: true\n }\n };\n\n try {\n const result = await queryOne<CmsEntry>(queryParams);\n\n const storageEntry = cleanupItem(entity, result);\n if (!storageEntry) {\n return null;\n }\n return convertFromStorageEntry({\n storageEntry,\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 const list = async (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsListParams\n ) => {\n const {\n limit: initialLimit = 10,\n where: initialWhere,\n after,\n sort,\n fields,\n search\n } = params;\n const limit = initialLimit <= 0 || initialLimit >= 10000 ? 10000 : initialLimit;\n\n const type = initialWhere.published ? \"P\" : \"L\";\n\n const queryAllParams: QueryAllParams = {\n entity,\n partitionKey: createGSIPartitionKey(model, type),\n options: {\n index: \"GSI1\",\n gte: \" \"\n }\n };\n let records = [];\n try {\n records = await queryAll(queryAllParams);\n } catch (ex) {\n throw new WebinyError(ex.message, \"QUERY_ENTRIES_ERROR\", {\n error: ex,\n partitionKey: queryAllParams.partitionKey,\n options: queryAllParams.options\n });\n }\n if (records.length === 0) {\n return {\n hasMoreItems: false,\n totalCount: 0,\n cursor: null,\n items: []\n };\n }\n const where: Partial<CmsEntryListWhere> = {\n ...initialWhere\n };\n delete where[\"published\"];\n delete where[\"latest\"];\n /**\n * We need a object containing field, transformers and paths.\n * Just build it here and pass on into other methods that require it to avoid mapping multiple times.\n */\n const modelFields = buildModelFields({\n plugins,\n model\n });\n /**\n * Filter the read items via the code.\n * It will build the filters out of the where input and transform the values it is using.\n */\n const filteredItems = await filterItems({\n items: records.map(record => {\n return convertFromStorageEntry({\n storageEntry: record,\n model\n });\n }),\n where,\n plugins,\n fields: modelFields,\n fromStorage: createStorageTransformCallable(model),\n fullTextSearch: {\n term: search,\n fields: fields || []\n }\n });\n\n const totalCount = filteredItems.length;\n\n /**\n * Sorting is also done via the code.\n * It takes the sort input and sorts by it via the lodash sortBy method.\n */\n const sortedItems = sortEntryItems({\n items: filteredItems,\n sort,\n fields: modelFields\n });\n\n const start = parseInt((decodeCursor(after) as string) || \"0\") || 0;\n const hasMoreItems = totalCount > start + limit;\n const end = limit > totalCount + start + limit ? undefined : start + limit;\n const slicedItems = sortedItems.slice(start, end);\n /**\n * Although we do not need a cursor here, we will use it as such to keep it standardized.\n * Number is simply encoded.\n */\n const cursor = totalCount > start + limit ? encodeCursor(`${start + limit}`) : null;\n return {\n hasMoreItems,\n totalCount,\n cursor,\n items: cleanupItems(entity, slicedItems)\n };\n };\n\n const get = async (\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 requestChanges = async (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsRequestChangesParams\n ) => {\n const { entry, storageEntry: initialStorageEntry } = params;\n\n const partitionKey = createPartitionKey({\n id: entry.id,\n locale: model.locale,\n tenant: model.tenant\n });\n\n const storageEntry = convertToStorageEntry({\n storageEntry: initialStorageEntry,\n model\n });\n\n /**\n * We need to:\n * - update the existing entry\n * - update latest version - if existing entry is the latest version\n */\n const items = [\n entity.putBatch({\n ...storageEntry,\n TYPE: createType(),\n PK: partitionKey,\n SK: createRevisionSortKey(entry),\n GSI1_PK: createGSIPartitionKey(model, \"A\"),\n GSI1_SK: createGSISortKey(entry)\n })\n ];\n\n /**\n * We need the latest entry to see if something needs to be updated along side the request changes one.\n */\n const latestStorageEntry = await getLatestRevisionByEntryId(model, entry);\n\n if (latestStorageEntry && latestStorageEntry.id === entry.id) {\n items.push(\n entity.putBatch({\n ...storageEntry,\n PK: partitionKey,\n SK: createLatestSortKey(),\n TYPE: createLatestType(),\n GSI1_PK: createGSIPartitionKey(model, \"L\"),\n GSI1_SK: createGSISortKey(entry)\n })\n );\n }\n\n try {\n await batchWriteAll({\n table: entity.table,\n items\n });\n dataLoaders.clearAll({\n model\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not execute the request changes batch.\",\n ex.code || \"REQUEST_CHANGES_ERROR\",\n {\n entry\n }\n );\n }\n return entry;\n };\n\n const requestReview = async (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsRequestReviewParams\n ) => {\n const { entry, storageEntry: initialStorageEntry } = params;\n\n const partitionKey = createPartitionKey({\n id: entry.id,\n locale: model.locale,\n tenant: model.tenant\n });\n\n const storageEntry = convertToStorageEntry({\n storageEntry: initialStorageEntry,\n model\n });\n /**\n * We need to:\n * - update existing entry\n * - update latest entry - if existing entry is the latest entry\n */\n const items = [\n entity.putBatch({\n ...storageEntry,\n TYPE: createType(),\n PK: partitionKey,\n SK: createRevisionSortKey(entry),\n GSI1_PK: createGSIPartitionKey(model, \"A\"),\n GSI1_SK: createGSISortKey(entry)\n })\n ];\n\n /**\n * We need the latest entry to see if something needs to be updated along side the request review one.\n */\n const latestStorageEntry = await getLatestRevisionByEntryId(model, entry);\n\n if (latestStorageEntry && latestStorageEntry.id === entry.id) {\n items.push(\n entity.putBatch({\n ...storageEntry,\n PK: partitionKey,\n SK: createLatestSortKey(),\n TYPE: createLatestType(),\n GSI1_PK: createGSIPartitionKey(model, \"L\"),\n GSI1_SK: createGSISortKey(entry)\n })\n );\n }\n\n try {\n await batchWriteAll({\n table: entity.table,\n items\n });\n dataLoaders.clearAll({\n model\n });\n return initialStorageEntry;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not execute request review batch.\",\n ex.code || \"REQUEST_REVIEW_ERROR\",\n {\n entry,\n storageEntry\n }\n );\n }\n };\n\n const publish = async (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsPublishParams\n ) => {\n const { entry, storageEntry: initialStorageEntry } = params;\n\n const partitionKey = createPartitionKey({\n id: entry.id,\n locale: model.locale,\n tenant: model.tenant\n });\n\n /**\n * We need the latest and published entries to see if something needs to be updated along side the publishing one.\n */\n const initialLatestStorageEntry = await getLatestRevisionByEntryId(model, entry);\n const initialPublishedStorageEntry = await getPublishedRevisionByEntryId(model, entry);\n\n const storageEntry = convertToStorageEntry({\n model,\n storageEntry: initialStorageEntry\n });\n /**\n * We need to update:\n * - current entry revision sort key\n * - published sort key\n * - latest sort key - if entry updated is actually latest\n * - previous published entry to unpublished status - if any previously published entry\n */\n const items = [\n entity.putBatch({\n ...storageEntry,\n PK: partitionKey,\n SK: createRevisionSortKey(entry),\n TYPE: createType(),\n GSI1_PK: createGSIPartitionKey(model, \"A\"),\n GSI1_SK: createGSISortKey(entry)\n }),\n entity.putBatch({\n ...storageEntry,\n PK: partitionKey,\n SK: createPublishedSortKey(),\n TYPE: createPublishedType(),\n GSI1_PK: createGSIPartitionKey(model, \"P\"),\n GSI1_SK: createGSISortKey(entry)\n })\n ];\n if (initialLatestStorageEntry && entry.id === initialLatestStorageEntry.id) {\n items.push(\n entity.putBatch({\n ...storageEntry,\n PK: partitionKey,\n SK: createLatestSortKey(),\n TYPE: createLatestType(),\n GSI1_PK: createGSIPartitionKey(model, \"L\"),\n GSI1_SK: createGSISortKey(entry)\n })\n );\n }\n if (initialPublishedStorageEntry && initialPublishedStorageEntry.id !== entry.id) {\n const publishedStorageEntry = convertToStorageEntry({\n storageEntry: initialPublishedStorageEntry,\n model\n });\n items.push(\n entity.putBatch({\n ...publishedStorageEntry,\n PK: partitionKey,\n SK: createRevisionSortKey(publishedStorageEntry),\n TYPE: createType(),\n status: CONTENT_ENTRY_STATUS.UNPUBLISHED,\n GSI1_PK: createGSIPartitionKey(model, \"A\"),\n GSI1_SK: createGSISortKey(publishedStorageEntry)\n })\n );\n }\n\n try {\n await batchWriteAll({\n table: entity.table,\n items\n });\n dataLoaders.clearAll({\n model\n });\n return initialStorageEntry;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not execute the publishing batch.\",\n ex.code || \"PUBLISH_ERROR\",\n {\n entry,\n latestStorageEntry: initialLatestStorageEntry,\n publishedStorageEntry: initialPublishedStorageEntry\n }\n );\n }\n };\n\n const unpublish = async (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsUnpublishParams\n ) => {\n const { entry, storageEntry: initialStorageEntry } = params;\n\n const partitionKey = createPartitionKey({\n id: entry.id,\n locale: model.locale,\n tenant: model.tenant\n });\n\n const storageEntry = convertToStorageEntry({\n storageEntry: initialStorageEntry,\n model\n });\n /**\n * We need to:\n * - delete currently published entry\n * - update current entry revision with new data\n * - update latest entry status - if entry being unpublished is latest\n */\n const items = [\n entity.deleteBatch({\n PK: partitionKey,\n SK: createPublishedSortKey()\n }),\n entity.putBatch({\n ...storageEntry,\n PK: partitionKey,\n SK: createRevisionSortKey(entry),\n TYPE: createType(),\n GSI1_PK: createGSIPartitionKey(model, \"A\"),\n GSI1_SK: createGSISortKey(entry)\n })\n ];\n\n /**\n * We need the latest entry to see if something needs to be updated along side the unpublishing one.\n */\n const latestStorageEntry = await getLatestRevisionByEntryId(model, entry);\n\n if (latestStorageEntry && entry.id === latestStorageEntry.id) {\n items.push(\n entity.putBatch({\n ...storageEntry,\n PK: partitionKey,\n SK: createLatestSortKey(),\n TYPE: createLatestType(),\n GSI1_PK: createGSIPartitionKey(model, \"L\"),\n GSI1_SK: createGSISortKey(entry)\n })\n );\n }\n\n try {\n await batchWriteAll({\n table: entity.table,\n items\n });\n dataLoaders.clearAll({\n model\n });\n return initialStorageEntry;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not execute unpublish batch.\",\n ex.code || \"UNPUBLISH_ERROR\",\n {\n entry,\n storageEntry\n }\n );\n }\n };\n\n return {\n create,\n createRevisionFrom,\n update,\n delete: deleteEntry,\n deleteRevision,\n getPreviousRevision,\n getPublishedByIds,\n getLatestByIds,\n getByIds,\n getRevisionById,\n getPublishedRevisionByEntryId,\n getLatestRevisionByEntryId,\n get,\n getRevisions,\n requestChanges,\n requestReview,\n publish,\n list,\n unpublish\n };\n};\n"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AACA;;AA2BA;;AACA;;AAQA;;AACA;;AAMA;;AAEA;;AACA;;AACA;;;;;;AAEA,MAAMA,UAAU,GAAG,MAAc;EAC7B,OAAO,WAAP;AACH,CAFD;;AAGA,MAAMC,gBAAgB,GAAG,MAAc;EACnC,OAAQ,GAAED,UAAU,EAAG,IAAvB;AACH,CAFD;;AAGA,MAAME,mBAAmB,GAAG,MAAc;EACtC,OAAQ,GAAEF,UAAU,EAAG,IAAvB;AACH,CAFD;;AAQA,MAAMG,qBAAqB,GAAIC,MAAD,IAAwD;EAClF,MAAM;IAAEC,KAAF;IAASC;EAAT,IAA0BF,MAAhC;EAEA,MAAMG,MAAM,GAAGF,KAAK,CAACG,wBAAN,CAA+B;IAC1CC,MAAM,EAAEJ,KAAK,CAACI,MAD4B;IAE1CF,MAAM,EAAED,YAAY,CAACC;EAFqB,CAA/B,CAAf;EAIA,uCACOD,YADP;IAEIC;EAFJ;AAIH,CAXD;;AAaA,MAAMG,uBAAuB,GAAIN,MAAD,IAAwD;EACpF,MAAM;IAAEC,KAAF;IAASC;EAAT,IAA0BF,MAAhC;EAEA,MAAMG,MAAM,GAAGF,KAAK,CAACM,0BAAN,CAAiC;IAC5CF,MAAM,EAAEJ,KAAK,CAACI,MAD8B;IAE5CF,MAAM,EAAED,YAAY,CAACC;EAFuB,CAAjC,CAAf;EAIA,uCACOD,YADP;IAEIC;EAFJ;AAIH,CAXD;;AAiBO,MAAMK,8BAA8B,GACvCR,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strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
3
5
  Object.defineProperty(exports, "__esModule", {
4
6
  value: true
5
7
  });
@@ -7,11 +9,20 @@ exports.createRevisionSortKey = exports.createPublishedSortKey = exports.createP
7
9
 
8
10
  var _utils = require("@webiny/utils");
9
11
 
12
+ var _error = _interopRequireDefault(require("@webiny/error"));
13
+
10
14
  const createBasePartitionKey = params => {
11
15
  const {
12
16
  tenant,
13
17
  locale
14
18
  } = params;
19
+
20
+ if (!tenant) {
21
+ throw new _error.default(`Missing tenant variable when creating entry basePartitionKey`);
22
+ } else if (!locale) {
23
+ throw new _error.default(`Missing tenant variable when creating entry basePartitionKey`);
24
+ }
25
+
15
26
  return `T#${tenant}#L#${locale}#CMS#CME`;
16
27
  };
17
28
 
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createBasePartitionKey","params","tenant","locale","WebinyError","createPartitionKey","id","initialId","parseIdentifier","createRevisionSortKey","zeroPad","version","createLatestSortKey","createPublishedSortKey","createGSIPartitionKey","type","modelId","partitionKey","createGSISortKey"],"sources":["keys.ts"],"sourcesContent":["import { parseIdentifier, zeroPad } from \"@webiny/utils\";\nimport WebinyError from \"@webiny/error\";\n\ninterface BasePartitionKeyParams {\n tenant: string;\n locale: string;\n}\nconst createBasePartitionKey = (params: BasePartitionKeyParams): string => {\n const { tenant, locale } = params;\n if (!tenant) {\n throw new WebinyError(`Missing tenant variable when creating entry basePartitionKey`);\n } else if (!locale) {\n throw new WebinyError(`Missing tenant variable when creating entry basePartitionKey`);\n }\n return `T#${tenant}#L#${locale}#CMS#CME`;\n};\n\nexport interface PartitionKeyParams extends BasePartitionKeyParams {\n id: string;\n}\nexport const createPartitionKey = (params: PartitionKeyParams): string => {\n const { id: initialId } = params;\n const { id } = parseIdentifier(initialId);\n return `${createBasePartitionKey(params)}#CME#${id}`;\n};\n\nexport interface SortKeyParams {\n version: number;\n}\nexport const createRevisionSortKey = (params: SortKeyParams): string => {\n return `REV#${zeroPad(params.version)}`;\n};\n\nexport const createLatestSortKey = (): string => {\n return \"L\";\n};\n\nexport const createPublishedSortKey = (): string => {\n return \"P\";\n};\n\nexport interface GSIPartitionKeyParams {\n tenant: string;\n locale: string;\n modelId: string;\n}\nexport const createGSIPartitionKey = (params: GSIPartitionKeyParams, type: \"A\" | \"L\" | \"P\") => {\n const { modelId } = params;\n const partitionKey = createBasePartitionKey(params);\n return `${partitionKey}#M#${modelId}#${type}`;\n};\n\nexport interface GSISortKeyParams {\n id: string;\n}\nexport const createGSISortKey = (params: GSISortKeyParams): string => {\n return params.id;\n};\n"],"mappings":";;;;;;;;;AAAA;;AACA;;AAMA,MAAMA,sBAAsB,GAAIC,MAAD,IAA4C;EACvE,MAAM;IAAEC,MAAF;IAAUC;EAAV,IAAqBF,MAA3B;;EACA,IAAI,CAACC,MAAL,EAAa;IACT,MAAM,IAAIE,cAAJ,CAAiB,8DAAjB,CAAN;EACH,CAFD,MAEO,IAAI,CAACD,MAAL,EAAa;IAChB,MAAM,IAAIC,cAAJ,CAAiB,8DAAjB,CAAN;EACH;;EACD,OAAQ,KAAIF,MAAO,MAAKC,MAAO,UAA/B;AACH,CARD;;AAaO,MAAME,kBAAkB,GAAIJ,MAAD,IAAwC;EACtE,MAAM;IAAEK,EAAE,EAAEC;EAAN,IAAoBN,MAA1B;EACA,MAAM;IAAEK;EAAF,IAAS,IAAAE,sBAAA,EAAgBD,SAAhB,CAAf;EACA,OAAQ,GAAEP,sBAAsB,CAACC,MAAD,CAAS,QAAOK,EAAG,EAAnD;AACH,CAJM;;;;AASA,MAAMG,qBAAqB,GAAIR,MAAD,IAAmC;EACpE,OAAQ,OAAM,IAAAS,cAAA,EAAQT,MAAM,CAACU,OAAf,CAAwB,EAAtC;AACH,CAFM;;;;AAIA,MAAMC,mBAAmB,GAAG,MAAc;EAC7C,OAAO,GAAP;AACH,CAFM;;;;AAIA,MAAMC,sBAAsB,GAAG,MAAc;EAChD,OAAO,GAAP;AACH,CAFM;;;;AASA,MAAMC,qBAAqB,GAAG,CAACb,MAAD,EAAgCc,IAAhC,KAA0D;EAC3F,MAAM;IAAEC;EAAF,IAAcf,MAApB;EACA,MAAMgB,YAAY,GAAGjB,sBAAsB,CAACC,MAAD,CAA3C;EACA,OAAQ,GAAEgB,YAAa,MAAKD,OAAQ,IAAGD,IAAK,EAA5C;AACH,CAJM;;;;AASA,MAAMG,gBAAgB,GAAIjB,MAAD,IAAsC;EAClE,OAAOA,MAAM,CAACK,EAAd;AACH,CAFM"}
@@ -13,38 +13,56 @@ const systemFields = {
13
13
  id: createSystemField({
14
14
  id: "id",
15
15
  type: "text",
16
+ storageId: "id",
16
17
  fieldId: "id"
17
18
  }),
18
19
  entryId: createSystemField({
19
20
  id: "entryId",
20
21
  type: "text",
22
+ storageId: "entryId",
21
23
  fieldId: "entryId"
22
24
  }),
23
25
  createdOn: createSystemField({
24
26
  id: "createdOn",
25
27
  type: "datetime",
28
+ storageId: "createdOn",
26
29
  fieldId: "createdOn"
27
30
  }),
28
31
  savedOn: createSystemField({
29
32
  id: "savedOn",
30
33
  type: "datetime",
34
+ storageId: "savedOn",
31
35
  fieldId: "savedOn"
32
36
  }),
33
37
  createdBy: createSystemField({
34
38
  id: "createdBy",
35
39
  type: "plainObject",
40
+ storageId: "createdBy",
36
41
  fieldId: "createdBy",
37
42
  settings: {
38
43
  path: "createdBy.id"
39
44
  }
40
45
  }),
46
+ meta: createSystemField({
47
+ id: "meta",
48
+ type: "plainObject",
49
+ storageId: "meta",
50
+ fieldId: "meta"
51
+ }),
41
52
  ownedBy: createSystemField({
42
53
  id: "ownedBy",
43
54
  type: "plainObject",
55
+ storageId: "ownedBy",
44
56
  fieldId: "ownedBy",
45
57
  settings: {
46
58
  path: "ownedBy.id"
47
59
  }
60
+ }),
61
+ version: createSystemField({
62
+ id: "version",
63
+ type: "number",
64
+ storageId: "version",
65
+ fieldId: "version"
48
66
  })
49
67
  };
50
68
  exports.systemFields = systemFields;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createSystemField","field","systemFields","id","type","storageId","fieldId","entryId","createdOn","savedOn","createdBy","settings","path","meta","ownedBy","version"],"sources":["systemFields.ts"],"sourcesContent":["import { CmsModelField } from \"@webiny/api-headless-cms/types\";\n\ntype CmsModelFieldInput = Partial<CmsModelField> &\n Pick<CmsModelField, \"id\" | \"type\" | \"storageId\" | \"fieldId\">;\nconst createSystemField = (field: CmsModelFieldInput): CmsModelField => {\n return field as CmsModelField;\n};\n\nexport const systemFields: Record<string, CmsModelField> = {\n id: createSystemField({\n id: \"id\",\n type: \"text\",\n storageId: \"id\",\n fieldId: \"id\"\n }),\n entryId: createSystemField({\n id: \"entryId\",\n type: \"text\",\n storageId: \"entryId\",\n fieldId: \"entryId\"\n }),\n createdOn: createSystemField({\n id: \"createdOn\",\n type: \"datetime\",\n storageId: \"createdOn\",\n fieldId: \"createdOn\"\n }),\n savedOn: createSystemField({\n id: \"savedOn\",\n type: \"datetime\",\n storageId: \"savedOn\",\n fieldId: \"savedOn\"\n }),\n createdBy: createSystemField({\n id: \"createdBy\",\n type: \"plainObject\",\n storageId: \"createdBy\",\n fieldId: \"createdBy\",\n settings: {\n path: \"createdBy.id\"\n }\n }),\n meta: createSystemField({\n id: \"meta\",\n type: \"plainObject\",\n storageId: \"meta\",\n fieldId: \"meta\"\n }),\n ownedBy: createSystemField({\n id: \"ownedBy\",\n type: \"plainObject\",\n storageId: \"ownedBy\",\n fieldId: \"ownedBy\",\n settings: {\n path: \"ownedBy.id\"\n }\n }),\n version: createSystemField({\n id: \"version\",\n type: \"number\",\n storageId: \"version\",\n fieldId: \"version\"\n })\n};\n"],"mappings":";;;;;;;AAIA,MAAMA,iBAAiB,GAAIC,KAAD,IAA8C;EACpE,OAAOA,KAAP;AACH,CAFD;;AAIO,MAAMC,YAA2C,GAAG;EACvDC,EAAE,EAAEH,iBAAiB,CAAC;IAClBG,EAAE,EAAE,IADc;IAElBC,IAAI,EAAE,MAFY;IAGlBC,SAAS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,CAAD;AAjD6B,CAApD"}
@@ -1,31 +1,36 @@
1
1
  import { CmsEntry, CmsEntryListWhere, CmsModel, CmsModelField } from "@webiny/api-headless-cms/types";
2
2
  import { PluginsContainer } from "@webiny/plugins";
3
+ import { CreatePathCallable as CmsEntryFieldFieldCreatePathCallable } from "../../plugins/CmsEntryFieldFilterPathPlugin";
3
4
  interface ModelField {
4
5
  def: CmsModelField;
5
6
  valueTransformer: (value: any) => any;
6
- valuePath: string;
7
+ createPath: CmsEntryFieldFieldCreatePathCallable;
7
8
  isSystemField?: boolean;
8
9
  }
9
10
  declare type ModelFieldRecords = Record<string, ModelField>;
10
11
  export interface FilterItemFromStorage {
11
- (field: CmsModelField, value: any): Promise<any>;
12
+ <T = any>(field: CmsModelField, value: any): Promise<T>;
12
13
  }
13
14
  interface FilterItemsParams {
14
15
  items: CmsEntry[];
15
- where: CmsEntryListWhere;
16
+ where: Partial<CmsEntryListWhere>;
16
17
  plugins: PluginsContainer;
17
18
  fields: ModelFieldRecords;
18
19
  fromStorage: FilterItemFromStorage;
20
+ fullTextSearch?: {
21
+ term?: string;
22
+ fields?: string[];
23
+ };
19
24
  }
20
25
  export declare const filterItems: (params: FilterItemsParams) => Promise<CmsEntry[]>;
21
26
  interface SortEntryItemsArgs {
22
27
  items: CmsEntry[];
23
- sort: string[];
28
+ sort?: string[];
24
29
  fields: ModelFieldRecords;
25
30
  }
26
31
  export declare const sortEntryItems: (params: SortEntryItemsArgs) => CmsEntry[];
27
32
  export declare const buildModelFields: ({ plugins, model }: {
28
33
  plugins: PluginsContainer;
29
34
  model: CmsModel;
30
- }) => Record<string, ModelField>;
35
+ }) => ModelFieldRecords;
31
36
  export {};