@webiny/api-headless-cms 0.0.0-unstable.e53eceafb5 → 0.0.0-unstable.eb196ccd2f

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 (78) hide show
  1. package/crud/contentEntry/entryDataFactories/createPublishEntryData.d.ts +3 -3
  2. package/crud/contentEntry/entryDataFactories/createPublishEntryData.js.map +1 -1
  3. package/crud/contentEntry/entryDataFactories/createUnpublishEntryData.d.ts +3 -3
  4. package/crud/contentEntry/entryDataFactories/createUnpublishEntryData.js.map +1 -1
  5. package/crud/contentEntry/useCases/GetEntriesByIds/GetEntriesByIds.d.ts +5 -3
  6. package/crud/contentEntry/useCases/GetEntriesByIds/GetEntriesByIds.js +6 -2
  7. package/crud/contentEntry/useCases/GetEntriesByIds/GetEntriesByIds.js.map +1 -1
  8. package/crud/contentEntry/useCases/GetEntriesByIds/index.d.ts +2 -0
  9. package/crud/contentEntry/useCases/GetEntriesByIds/index.js +1 -1
  10. package/crud/contentEntry/useCases/GetEntriesByIds/index.js.map +1 -1
  11. package/crud/contentEntry/useCases/GetLatestEntriesByIds/GetLatestEntriesByIds.d.ts +5 -3
  12. package/crud/contentEntry/useCases/GetLatestEntriesByIds/GetLatestEntriesByIds.js +6 -2
  13. package/crud/contentEntry/useCases/GetLatestEntriesByIds/GetLatestEntriesByIds.js.map +1 -1
  14. package/crud/contentEntry/useCases/GetLatestEntriesByIds/index.d.ts +2 -0
  15. package/crud/contentEntry/useCases/GetLatestEntriesByIds/index.js +1 -1
  16. package/crud/contentEntry/useCases/GetLatestEntriesByIds/index.js.map +1 -1
  17. package/crud/contentEntry/useCases/GetLatestRevisionByEntryId/GetLatestRevisionByEntryId.d.ts +5 -3
  18. package/crud/contentEntry/useCases/GetLatestRevisionByEntryId/GetLatestRevisionByEntryId.js +7 -2
  19. package/crud/contentEntry/useCases/GetLatestRevisionByEntryId/GetLatestRevisionByEntryId.js.map +1 -1
  20. package/crud/contentEntry/useCases/GetLatestRevisionByEntryId/index.d.ts +2 -0
  21. package/crud/contentEntry/useCases/GetLatestRevisionByEntryId/index.js +1 -1
  22. package/crud/contentEntry/useCases/GetLatestRevisionByEntryId/index.js.map +1 -1
  23. package/crud/contentEntry/useCases/GetPreviousRevisionByEntryId/GetPreviousRevisionByEntryId.d.ts +5 -3
  24. package/crud/contentEntry/useCases/GetPreviousRevisionByEntryId/GetPreviousRevisionByEntryId.js +7 -2
  25. package/crud/contentEntry/useCases/GetPreviousRevisionByEntryId/GetPreviousRevisionByEntryId.js.map +1 -1
  26. package/crud/contentEntry/useCases/GetPreviousRevisionByEntryId/index.d.ts +2 -0
  27. package/crud/contentEntry/useCases/GetPreviousRevisionByEntryId/index.js +1 -1
  28. package/crud/contentEntry/useCases/GetPreviousRevisionByEntryId/index.js.map +1 -1
  29. package/crud/contentEntry/useCases/GetPublishedEntriesByIds/GetPublishedEntriesByIds.d.ts +5 -3
  30. package/crud/contentEntry/useCases/GetPublishedEntriesByIds/GetPublishedEntriesByIds.js +6 -2
  31. package/crud/contentEntry/useCases/GetPublishedEntriesByIds/GetPublishedEntriesByIds.js.map +1 -1
  32. package/crud/contentEntry/useCases/GetPublishedEntriesByIds/index.d.ts +2 -0
  33. package/crud/contentEntry/useCases/GetPublishedEntriesByIds/index.js +1 -1
  34. package/crud/contentEntry/useCases/GetPublishedEntriesByIds/index.js.map +1 -1
  35. package/crud/contentEntry/useCases/GetPublishedRevisionByEntryId/GetPublishedRevisionByEntryId.d.ts +5 -3
  36. package/crud/contentEntry/useCases/GetPublishedRevisionByEntryId/GetPublishedRevisionByEntryId.js +7 -2
  37. package/crud/contentEntry/useCases/GetPublishedRevisionByEntryId/GetPublishedRevisionByEntryId.js.map +1 -1
  38. package/crud/contentEntry/useCases/GetPublishedRevisionByEntryId/index.d.ts +2 -0
  39. package/crud/contentEntry/useCases/GetPublishedRevisionByEntryId/index.js +1 -1
  40. package/crud/contentEntry/useCases/GetPublishedRevisionByEntryId/index.js.map +1 -1
  41. package/crud/contentEntry/useCases/GetRevisionById/GetRevisionById.d.ts +5 -3
  42. package/crud/contentEntry/useCases/GetRevisionById/GetRevisionById.js +7 -2
  43. package/crud/contentEntry/useCases/GetRevisionById/GetRevisionById.js.map +1 -1
  44. package/crud/contentEntry/useCases/GetRevisionById/index.d.ts +2 -0
  45. package/crud/contentEntry/useCases/GetRevisionById/index.js +1 -1
  46. package/crud/contentEntry/useCases/GetRevisionById/index.js.map +1 -1
  47. package/crud/contentEntry/useCases/GetRevisionsByEntryId/GetRevisionsByEntryId.d.ts +5 -3
  48. package/crud/contentEntry/useCases/GetRevisionsByEntryId/GetRevisionsByEntryId.js +6 -2
  49. package/crud/contentEntry/useCases/GetRevisionsByEntryId/GetRevisionsByEntryId.js.map +1 -1
  50. package/crud/contentEntry/useCases/GetRevisionsByEntryId/index.d.ts +2 -0
  51. package/crud/contentEntry/useCases/GetRevisionsByEntryId/index.js +1 -1
  52. package/crud/contentEntry/useCases/GetRevisionsByEntryId/index.js.map +1 -1
  53. package/crud/contentEntry/useCases/ListEntries/ListEntriesOperation.d.ts +10 -3
  54. package/crud/contentEntry/useCases/ListEntries/ListEntriesOperation.js +9 -2
  55. package/crud/contentEntry/useCases/ListEntries/ListEntriesOperation.js.map +1 -1
  56. package/crud/contentEntry/useCases/ListEntries/index.d.ts +2 -0
  57. package/crud/contentEntry/useCases/ListEntries/index.js +1 -1
  58. package/crud/contentEntry/useCases/ListEntries/index.js.map +1 -1
  59. package/crud/contentEntry/useCases/RestoreEntryFromBin/RestoreEntryFromBinOperation.d.ts +5 -3
  60. package/crud/contentEntry/useCases/RestoreEntryFromBin/RestoreEntryFromBinOperation.js +4 -2
  61. package/crud/contentEntry/useCases/RestoreEntryFromBin/RestoreEntryFromBinOperation.js.map +1 -1
  62. package/crud/contentEntry/useCases/RestoreEntryFromBin/index.d.ts +2 -0
  63. package/crud/contentEntry/useCases/RestoreEntryFromBin/index.js +1 -1
  64. package/crud/contentEntry/useCases/RestoreEntryFromBin/index.js.map +1 -1
  65. package/crud/contentEntry.crud.js +15 -3
  66. package/crud/contentEntry.crud.js.map +1 -1
  67. package/crud/contentModel/validation.d.ts +132 -132
  68. package/crud/contentModelGroup/validation.d.ts +2 -2
  69. package/crud/system.crud.js +10 -0
  70. package/crud/system.crud.js.map +1 -1
  71. package/graphqlFields/searchableJson.js +5 -0
  72. package/graphqlFields/searchableJson.js.map +1 -1
  73. package/package.json +21 -21
  74. package/types/context.d.ts +2 -2
  75. package/types/context.js.map +1 -1
  76. package/utils/entryStorage.d.ts +8 -1
  77. package/utils/entryStorage.js +37 -4
  78. package/utils/entryStorage.js.map +1 -1
@@ -1,4 +1,4 @@
1
- import type { CmsContext, CmsEntry, CmsModel } from "../../../types";
1
+ import type { CmsContext, CmsEntry, CmsEntryValues, CmsModel } from "../../../types";
2
2
  import type { SecurityIdentity } from "@webiny/api-security/types";
3
3
  type CreatePublishEntryDataParams = {
4
4
  model: CmsModel;
@@ -7,7 +7,7 @@ type CreatePublishEntryDataParams = {
7
7
  originalEntry: CmsEntry;
8
8
  latestEntry: CmsEntry;
9
9
  };
10
- export declare const createPublishEntryData: ({ model, context, getIdentity: getSecurityIdentity, originalEntry, latestEntry }: CreatePublishEntryDataParams) => Promise<{
11
- entry: CmsEntry;
10
+ export declare const createPublishEntryData: <T extends CmsEntryValues = CmsEntryValues>({ model, context, getIdentity: getSecurityIdentity, originalEntry, latestEntry }: CreatePublishEntryDataParams) => Promise<{
11
+ entry: CmsEntry<T>;
12
12
  }>;
13
13
  export {};
@@ -1 +1 @@
1
- {"version":3,"names":["_statuses","require","_entryDataValidation","_identity","_date","createPublishEntryData","model","context","getIdentity","getSecurityIdentity","originalEntry","latestEntry","validateModelEntryDataOrThrow","data","values","entry","currentDateTime","Date","toISOString","currentIdentity","status","STATUS_PUBLISHED","locked","createdOn","getDate","modifiedOn","savedOn","firstPublishedOn","lastPublishedOn","createdBy","modifiedBy","savedBy","firstPublishedBy","lastPublishedBy","revisionCreatedOn","revisionSavedOn","revisionModifiedOn","revisionFirstPublishedOn","revisionLastPublishedOn","revisionCreatedBy","revisionSavedBy","revisionModifiedBy","revisionFirstPublishedBy","revisionLastPublishedBy","exports"],"sources":["createPublishEntryData.ts"],"sourcesContent":["import type { CmsContext, CmsEntry, CmsModel } from \"~/types\";\nimport { STATUS_PUBLISHED } from \"./statuses\";\nimport type { SecurityIdentity } from \"@webiny/api-security/types\";\nimport { validateModelEntryDataOrThrow } from \"~/crud/contentEntry/entryDataValidation\";\nimport { getIdentity } from \"~/utils/identity\";\nimport { getDate } from \"~/utils/date\";\n\ntype CreatePublishEntryDataParams = {\n model: CmsModel;\n context: CmsContext;\n getIdentity: () => SecurityIdentity;\n originalEntry: CmsEntry;\n latestEntry: CmsEntry;\n};\n\nexport const createPublishEntryData = async ({\n model,\n context,\n getIdentity: getSecurityIdentity,\n originalEntry,\n latestEntry\n}: CreatePublishEntryDataParams): Promise<{\n entry: CmsEntry;\n}> => {\n await validateModelEntryDataOrThrow({\n context,\n model,\n data: originalEntry.values,\n entry: originalEntry\n });\n\n const currentDateTime = new Date().toISOString();\n const currentIdentity = getSecurityIdentity();\n\n const entry: CmsEntry = {\n ...originalEntry,\n status: STATUS_PUBLISHED,\n locked: true,\n\n /**\n * Entry-level meta fields. 👇\n */\n createdOn: getDate(latestEntry.createdOn),\n modifiedOn: getDate(currentDateTime),\n savedOn: getDate(currentDateTime),\n firstPublishedOn: getDate(latestEntry.firstPublishedOn, currentDateTime),\n lastPublishedOn: getDate(currentDateTime),\n createdBy: getIdentity(latestEntry.createdBy),\n modifiedBy: getIdentity(currentIdentity),\n savedBy: getIdentity(currentIdentity),\n firstPublishedBy: getIdentity(latestEntry.firstPublishedBy, currentIdentity),\n lastPublishedBy: getIdentity(currentIdentity),\n\n /**\n * Revision-level meta fields. 👇\n */\n revisionCreatedOn: getDate(originalEntry.revisionCreatedOn),\n revisionSavedOn: getDate(currentDateTime),\n revisionModifiedOn: getDate(currentDateTime),\n revisionFirstPublishedOn: getDate(originalEntry.revisionFirstPublishedOn, currentDateTime),\n revisionLastPublishedOn: getDate(currentDateTime),\n revisionCreatedBy: getIdentity(originalEntry.revisionCreatedBy),\n revisionSavedBy: getIdentity(currentIdentity),\n revisionModifiedBy: getIdentity(currentIdentity),\n revisionFirstPublishedBy: getIdentity(\n originalEntry.revisionFirstPublishedBy,\n currentIdentity\n ),\n revisionLastPublishedBy: getIdentity(currentIdentity)\n };\n\n return { entry };\n};\n"],"mappings":";;;;;;AACA,IAAAA,SAAA,GAAAC,OAAA;AAEA,IAAAC,oBAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAUO,MAAMI,sBAAsB,GAAG,MAAAA,CAAO;EACzCC,KAAK;EACLC,OAAO;EACPC,WAAW,EAAEC,mBAAmB;EAChCC,aAAa;EACbC;AAC0B,CAAC,KAEzB;EACF,MAAM,IAAAC,kDAA6B,EAAC;IAChCL,OAAO;IACPD,KAAK;IACLO,IAAI,EAAEH,aAAa,CAACI,MAAM;IAC1BC,KAAK,EAAEL;EACX,CAAC,CAAC;EAEF,MAAMM,eAAe,GAAG,IAAIC,IAAI,CAAC,CAAC,CAACC,WAAW,CAAC,CAAC;EAChD,MAAMC,eAAe,GAAGV,mBAAmB,CAAC,CAAC;EAE7C,MAAMM,KAAe,GAAG;IACpB,GAAGL,aAAa;IAChBU,MAAM,EAAEC,0BAAgB;IACxBC,MAAM,EAAE,IAAI;IAEZ;AACR;AACA;IACQC,SAAS,EAAE,IAAAC,aAAO,EAACb,WAAW,CAACY,SAAS,CAAC;IACzCE,UAAU,EAAE,IAAAD,aAAO,EAACR,eAAe,CAAC;IACpCU,OAAO,EAAE,IAAAF,aAAO,EAACR,eAAe,CAAC;IACjCW,gBAAgB,EAAE,IAAAH,aAAO,EAACb,WAAW,CAACgB,gBAAgB,EAAEX,eAAe,CAAC;IACxEY,eAAe,EAAE,IAAAJ,aAAO,EAACR,eAAe,CAAC;IACzCa,SAAS,EAAE,IAAArB,qBAAW,EAACG,WAAW,CAACkB,SAAS,CAAC;IAC7CC,UAAU,EAAE,IAAAtB,qBAAW,EAACW,eAAe,CAAC;IACxCY,OAAO,EAAE,IAAAvB,qBAAW,EAACW,eAAe,CAAC;IACrCa,gBAAgB,EAAE,IAAAxB,qBAAW,EAACG,WAAW,CAACqB,gBAAgB,EAAEb,eAAe,CAAC;IAC5Ec,eAAe,EAAE,IAAAzB,qBAAW,EAACW,eAAe,CAAC;IAE7C;AACR;AACA;IACQe,iBAAiB,EAAE,IAAAV,aAAO,EAACd,aAAa,CAACwB,iBAAiB,CAAC;IAC3DC,eAAe,EAAE,IAAAX,aAAO,EAACR,eAAe,CAAC;IACzCoB,kBAAkB,EAAE,IAAAZ,aAAO,EAACR,eAAe,CAAC;IAC5CqB,wBAAwB,EAAE,IAAAb,aAAO,EAACd,aAAa,CAAC2B,wBAAwB,EAAErB,eAAe,CAAC;IAC1FsB,uBAAuB,EAAE,IAAAd,aAAO,EAACR,eAAe,CAAC;IACjDuB,iBAAiB,EAAE,IAAA/B,qBAAW,EAACE,aAAa,CAAC6B,iBAAiB,CAAC;IAC/DC,eAAe,EAAE,IAAAhC,qBAAW,EAACW,eAAe,CAAC;IAC7CsB,kBAAkB,EAAE,IAAAjC,qBAAW,EAACW,eAAe,CAAC;IAChDuB,wBAAwB,EAAE,IAAAlC,qBAAW,EACjCE,aAAa,CAACgC,wBAAwB,EACtCvB,eACJ,CAAC;IACDwB,uBAAuB,EAAE,IAAAnC,qBAAW,EAACW,eAAe;EACxD,CAAC;EAED,OAAO;IAAEJ;EAAM,CAAC;AACpB,CAAC;AAAC6B,OAAA,CAAAvC,sBAAA,GAAAA,sBAAA","ignoreList":[]}
1
+ {"version":3,"names":["_statuses","require","_entryDataValidation","_identity","_date","createPublishEntryData","model","context","getIdentity","getSecurityIdentity","originalEntry","latestEntry","validateModelEntryDataOrThrow","data","values","entry","currentDateTime","Date","toISOString","currentIdentity","status","STATUS_PUBLISHED","locked","createdOn","getDate","modifiedOn","savedOn","firstPublishedOn","lastPublishedOn","createdBy","modifiedBy","savedBy","firstPublishedBy","lastPublishedBy","revisionCreatedOn","revisionSavedOn","revisionModifiedOn","revisionFirstPublishedOn","revisionLastPublishedOn","revisionCreatedBy","revisionSavedBy","revisionModifiedBy","revisionFirstPublishedBy","revisionLastPublishedBy","exports"],"sources":["createPublishEntryData.ts"],"sourcesContent":["import type { CmsContext, CmsEntry, CmsEntryValues, CmsModel } from \"~/types\";\nimport { STATUS_PUBLISHED } from \"./statuses\";\nimport type { SecurityIdentity } from \"@webiny/api-security/types\";\nimport { validateModelEntryDataOrThrow } from \"~/crud/contentEntry/entryDataValidation\";\nimport { getIdentity } from \"~/utils/identity\";\nimport { getDate } from \"~/utils/date\";\n\ntype CreatePublishEntryDataParams = {\n model: CmsModel;\n context: CmsContext;\n getIdentity: () => SecurityIdentity;\n originalEntry: CmsEntry;\n latestEntry: CmsEntry;\n};\n\nexport const createPublishEntryData = async <T extends CmsEntryValues = CmsEntryValues>({\n model,\n context,\n getIdentity: getSecurityIdentity,\n originalEntry,\n latestEntry\n}: CreatePublishEntryDataParams): Promise<{\n entry: CmsEntry<T>;\n}> => {\n await validateModelEntryDataOrThrow({\n context,\n model,\n data: originalEntry.values,\n entry: originalEntry\n });\n\n const currentDateTime = new Date().toISOString();\n const currentIdentity = getSecurityIdentity();\n\n const entry: CmsEntry<T> = {\n ...originalEntry,\n status: STATUS_PUBLISHED,\n locked: true,\n\n /**\n * Entry-level meta fields. 👇\n */\n createdOn: getDate(latestEntry.createdOn),\n modifiedOn: getDate(currentDateTime),\n savedOn: getDate(currentDateTime),\n firstPublishedOn: getDate(latestEntry.firstPublishedOn, currentDateTime),\n lastPublishedOn: getDate(currentDateTime),\n createdBy: getIdentity(latestEntry.createdBy),\n modifiedBy: getIdentity(currentIdentity),\n savedBy: getIdentity(currentIdentity),\n firstPublishedBy: getIdentity(latestEntry.firstPublishedBy, currentIdentity),\n lastPublishedBy: getIdentity(currentIdentity),\n\n /**\n * Revision-level meta fields. 👇\n */\n revisionCreatedOn: getDate(originalEntry.revisionCreatedOn),\n revisionSavedOn: getDate(currentDateTime),\n revisionModifiedOn: getDate(currentDateTime),\n revisionFirstPublishedOn: getDate(originalEntry.revisionFirstPublishedOn, currentDateTime),\n revisionLastPublishedOn: getDate(currentDateTime),\n revisionCreatedBy: getIdentity(originalEntry.revisionCreatedBy),\n revisionSavedBy: getIdentity(currentIdentity),\n revisionModifiedBy: getIdentity(currentIdentity),\n revisionFirstPublishedBy: getIdentity(\n originalEntry.revisionFirstPublishedBy,\n currentIdentity\n ),\n revisionLastPublishedBy: getIdentity(currentIdentity)\n } as CmsEntry<T>;\n\n return { entry };\n};\n"],"mappings":";;;;;;AACA,IAAAA,SAAA,GAAAC,OAAA;AAEA,IAAAC,oBAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAUO,MAAMI,sBAAsB,GAAG,MAAAA,CAAkD;EACpFC,KAAK;EACLC,OAAO;EACPC,WAAW,EAAEC,mBAAmB;EAChCC,aAAa;EACbC;AAC0B,CAAC,KAEzB;EACF,MAAM,IAAAC,kDAA6B,EAAC;IAChCL,OAAO;IACPD,KAAK;IACLO,IAAI,EAAEH,aAAa,CAACI,MAAM;IAC1BC,KAAK,EAAEL;EACX,CAAC,CAAC;EAEF,MAAMM,eAAe,GAAG,IAAIC,IAAI,CAAC,CAAC,CAACC,WAAW,CAAC,CAAC;EAChD,MAAMC,eAAe,GAAGV,mBAAmB,CAAC,CAAC;EAE7C,MAAMM,KAAkB,GAAG;IACvB,GAAGL,aAAa;IAChBU,MAAM,EAAEC,0BAAgB;IACxBC,MAAM,EAAE,IAAI;IAEZ;AACR;AACA;IACQC,SAAS,EAAE,IAAAC,aAAO,EAACb,WAAW,CAACY,SAAS,CAAC;IACzCE,UAAU,EAAE,IAAAD,aAAO,EAACR,eAAe,CAAC;IACpCU,OAAO,EAAE,IAAAF,aAAO,EAACR,eAAe,CAAC;IACjCW,gBAAgB,EAAE,IAAAH,aAAO,EAACb,WAAW,CAACgB,gBAAgB,EAAEX,eAAe,CAAC;IACxEY,eAAe,EAAE,IAAAJ,aAAO,EAACR,eAAe,CAAC;IACzCa,SAAS,EAAE,IAAArB,qBAAW,EAACG,WAAW,CAACkB,SAAS,CAAC;IAC7CC,UAAU,EAAE,IAAAtB,qBAAW,EAACW,eAAe,CAAC;IACxCY,OAAO,EAAE,IAAAvB,qBAAW,EAACW,eAAe,CAAC;IACrCa,gBAAgB,EAAE,IAAAxB,qBAAW,EAACG,WAAW,CAACqB,gBAAgB,EAAEb,eAAe,CAAC;IAC5Ec,eAAe,EAAE,IAAAzB,qBAAW,EAACW,eAAe,CAAC;IAE7C;AACR;AACA;IACQe,iBAAiB,EAAE,IAAAV,aAAO,EAACd,aAAa,CAACwB,iBAAiB,CAAC;IAC3DC,eAAe,EAAE,IAAAX,aAAO,EAACR,eAAe,CAAC;IACzCoB,kBAAkB,EAAE,IAAAZ,aAAO,EAACR,eAAe,CAAC;IAC5CqB,wBAAwB,EAAE,IAAAb,aAAO,EAACd,aAAa,CAAC2B,wBAAwB,EAAErB,eAAe,CAAC;IAC1FsB,uBAAuB,EAAE,IAAAd,aAAO,EAACR,eAAe,CAAC;IACjDuB,iBAAiB,EAAE,IAAA/B,qBAAW,EAACE,aAAa,CAAC6B,iBAAiB,CAAC;IAC/DC,eAAe,EAAE,IAAAhC,qBAAW,EAACW,eAAe,CAAC;IAC7CsB,kBAAkB,EAAE,IAAAjC,qBAAW,EAACW,eAAe,CAAC;IAChDuB,wBAAwB,EAAE,IAAAlC,qBAAW,EACjCE,aAAa,CAACgC,wBAAwB,EACtCvB,eACJ,CAAC;IACDwB,uBAAuB,EAAE,IAAAnC,qBAAW,EAACW,eAAe;EACxD,CAAgB;EAEhB,OAAO;IAAEJ;EAAM,CAAC;AACpB,CAAC;AAAC6B,OAAA,CAAAvC,sBAAA,GAAAA,sBAAA","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import type { CmsContext, CmsEntry, CmsModel } from "../../../types";
1
+ import type { CmsContext, CmsEntry, CmsEntryValues, CmsModel } from "../../../types";
2
2
  import type { SecurityIdentity } from "@webiny/api-security/types";
3
3
  type CreateRepublishEntryDataParams = {
4
4
  model: CmsModel;
@@ -6,7 +6,7 @@ type CreateRepublishEntryDataParams = {
6
6
  getIdentity: () => SecurityIdentity;
7
7
  originalEntry: CmsEntry;
8
8
  };
9
- export declare const createUnpublishEntryData: ({ getIdentity: getSecurityIdentity, originalEntry }: CreateRepublishEntryDataParams) => Promise<{
10
- entry: CmsEntry;
9
+ export declare const createUnpublishEntryData: <T extends CmsEntryValues = CmsEntryValues>({ getIdentity: getSecurityIdentity, originalEntry }: CreateRepublishEntryDataParams) => Promise<{
10
+ entry: CmsEntry<T>;
11
11
  }>;
12
12
  export {};
@@ -1 +1 @@
1
- {"version":3,"names":["_statuses","require","_identity","_date","createUnpublishEntryData","getIdentity","getSecurityIdentity","originalEntry","currentDateTime","Date","toISOString","currentIdentity","entry","status","STATUS_UNPUBLISHED","savedOn","getDate","modifiedOn","savedBy","modifiedBy","revisionSavedOn","revisionModifiedOn","revisionSavedBy","revisionModifiedBy","exports"],"sources":["createUnpublishEntryData.ts"],"sourcesContent":["import type { CmsContext, CmsEntry, CmsModel } from \"~/types\";\nimport { STATUS_UNPUBLISHED } from \"./statuses\";\nimport type { SecurityIdentity } from \"@webiny/api-security/types\";\nimport { getIdentity } from \"~/utils/identity\";\nimport { getDate } from \"~/utils/date\";\n\ntype CreateRepublishEntryDataParams = {\n model: CmsModel;\n context: CmsContext;\n getIdentity: () => SecurityIdentity;\n originalEntry: CmsEntry;\n};\n\nexport const createUnpublishEntryData = async ({\n getIdentity: getSecurityIdentity,\n originalEntry\n}: CreateRepublishEntryDataParams): Promise<{\n entry: CmsEntry;\n}> => {\n const currentDateTime = new Date().toISOString();\n const currentIdentity = getSecurityIdentity();\n\n const entry: CmsEntry = {\n ...originalEntry,\n status: STATUS_UNPUBLISHED,\n\n /**\n * Entry-level meta fields. 👇\n */\n savedOn: getDate(currentDateTime),\n modifiedOn: getDate(currentDateTime),\n savedBy: getIdentity(currentIdentity),\n modifiedBy: getIdentity(currentIdentity),\n\n /**\n * Revision-level meta fields. 👇\n */\n revisionSavedOn: getDate(currentDateTime),\n revisionModifiedOn: getDate(currentDateTime),\n revisionSavedBy: getIdentity(currentIdentity),\n revisionModifiedBy: getIdentity(currentIdentity)\n };\n\n return { entry };\n};\n"],"mappings":";;;;;;AACA,IAAAA,SAAA,GAAAC,OAAA;AAEA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AASO,MAAMG,wBAAwB,GAAG,MAAAA,CAAO;EAC3CC,WAAW,EAAEC,mBAAmB;EAChCC;AAC4B,CAAC,KAE3B;EACF,MAAMC,eAAe,GAAG,IAAIC,IAAI,CAAC,CAAC,CAACC,WAAW,CAAC,CAAC;EAChD,MAAMC,eAAe,GAAGL,mBAAmB,CAAC,CAAC;EAE7C,MAAMM,KAAe,GAAG;IACpB,GAAGL,aAAa;IAChBM,MAAM,EAAEC,4BAAkB;IAE1B;AACR;AACA;IACQC,OAAO,EAAE,IAAAC,aAAO,EAACR,eAAe,CAAC;IACjCS,UAAU,EAAE,IAAAD,aAAO,EAACR,eAAe,CAAC;IACpCU,OAAO,EAAE,IAAAb,qBAAW,EAACM,eAAe,CAAC;IACrCQ,UAAU,EAAE,IAAAd,qBAAW,EAACM,eAAe,CAAC;IAExC;AACR;AACA;IACQS,eAAe,EAAE,IAAAJ,aAAO,EAACR,eAAe,CAAC;IACzCa,kBAAkB,EAAE,IAAAL,aAAO,EAACR,eAAe,CAAC;IAC5Cc,eAAe,EAAE,IAAAjB,qBAAW,EAACM,eAAe,CAAC;IAC7CY,kBAAkB,EAAE,IAAAlB,qBAAW,EAACM,eAAe;EACnD,CAAC;EAED,OAAO;IAAEC;EAAM,CAAC;AACpB,CAAC;AAACY,OAAA,CAAApB,wBAAA,GAAAA,wBAAA","ignoreList":[]}
1
+ {"version":3,"names":["_statuses","require","_identity","_date","createUnpublishEntryData","getIdentity","getSecurityIdentity","originalEntry","currentDateTime","Date","toISOString","currentIdentity","entry","status","STATUS_UNPUBLISHED","savedOn","getDate","modifiedOn","savedBy","modifiedBy","revisionSavedOn","revisionModifiedOn","revisionSavedBy","revisionModifiedBy","exports"],"sources":["createUnpublishEntryData.ts"],"sourcesContent":["import type { CmsContext, CmsEntry, CmsEntryValues, CmsModel } from \"~/types\";\nimport { STATUS_UNPUBLISHED } from \"./statuses\";\nimport type { SecurityIdentity } from \"@webiny/api-security/types\";\nimport { getIdentity } from \"~/utils/identity\";\nimport { getDate } from \"~/utils/date\";\n\ntype CreateRepublishEntryDataParams = {\n model: CmsModel;\n context: CmsContext;\n getIdentity: () => SecurityIdentity;\n originalEntry: CmsEntry;\n};\n\nexport const createUnpublishEntryData = async <T extends CmsEntryValues = CmsEntryValues>({\n getIdentity: getSecurityIdentity,\n originalEntry\n}: CreateRepublishEntryDataParams): Promise<{\n entry: CmsEntry<T>;\n}> => {\n const currentDateTime = new Date().toISOString();\n const currentIdentity = getSecurityIdentity();\n\n const entry: CmsEntry<T> = {\n ...originalEntry,\n status: STATUS_UNPUBLISHED,\n\n /**\n * Entry-level meta fields. 👇\n */\n savedOn: getDate(currentDateTime),\n modifiedOn: getDate(currentDateTime),\n savedBy: getIdentity(currentIdentity),\n modifiedBy: getIdentity(currentIdentity),\n\n /**\n * Revision-level meta fields. 👇\n */\n revisionSavedOn: getDate(currentDateTime),\n revisionModifiedOn: getDate(currentDateTime),\n revisionSavedBy: getIdentity(currentIdentity),\n revisionModifiedBy: getIdentity(currentIdentity)\n } as CmsEntry<T>;\n\n return { entry };\n};\n"],"mappings":";;;;;;AACA,IAAAA,SAAA,GAAAC,OAAA;AAEA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AASO,MAAMG,wBAAwB,GAAG,MAAAA,CAAkD;EACtFC,WAAW,EAAEC,mBAAmB;EAChCC;AAC4B,CAAC,KAE3B;EACF,MAAMC,eAAe,GAAG,IAAIC,IAAI,CAAC,CAAC,CAACC,WAAW,CAAC,CAAC;EAChD,MAAMC,eAAe,GAAGL,mBAAmB,CAAC,CAAC;EAE7C,MAAMM,KAAkB,GAAG;IACvB,GAAGL,aAAa;IAChBM,MAAM,EAAEC,4BAAkB;IAE1B;AACR;AACA;IACQC,OAAO,EAAE,IAAAC,aAAO,EAACR,eAAe,CAAC;IACjCS,UAAU,EAAE,IAAAD,aAAO,EAACR,eAAe,CAAC;IACpCU,OAAO,EAAE,IAAAb,qBAAW,EAACM,eAAe,CAAC;IACrCQ,UAAU,EAAE,IAAAd,qBAAW,EAACM,eAAe,CAAC;IAExC;AACR;AACA;IACQS,eAAe,EAAE,IAAAJ,aAAO,EAACR,eAAe,CAAC;IACzCa,kBAAkB,EAAE,IAAAL,aAAO,EAACR,eAAe,CAAC;IAC5Cc,eAAe,EAAE,IAAAjB,qBAAW,EAACM,eAAe,CAAC;IAC7CY,kBAAkB,EAAE,IAAAlB,qBAAW,EAACM,eAAe;EACnD,CAAgB;EAEhB,OAAO;IAAEC;EAAM,CAAC;AACpB,CAAC;AAACY,OAAA,CAAApB,wBAAA,GAAAA,wBAAA","ignoreList":[]}
@@ -1,7 +1,9 @@
1
1
  import type { IGetEntriesByIds } from "../../abstractions";
2
2
  import type { CmsEntryStorageOperations, CmsEntryStorageOperationsGetByIdsParams, CmsModel } from "../../../../types";
3
+ import type { ITransformEntryCallable } from "../../../../utils/entryStorage.js";
3
4
  export declare class GetEntriesByIds implements IGetEntriesByIds {
4
- private operation;
5
- constructor(operation: CmsEntryStorageOperations["getByIds"]);
6
- execute(model: CmsModel, params: CmsEntryStorageOperationsGetByIdsParams): Promise<import("../../../../types").CmsStorageEntry[]>;
5
+ private readonly operation;
6
+ private readonly transform;
7
+ constructor(operation: CmsEntryStorageOperations["getByIds"], transform: ITransformEntryCallable);
8
+ execute(model: CmsModel, params: CmsEntryStorageOperationsGetByIdsParams): Promise<import("../../../../types").CmsEntry<import("../../../../types").CmsEntryValues>[]>;
7
9
  }
@@ -5,11 +5,15 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.GetEntriesByIds = void 0;
7
7
  class GetEntriesByIds {
8
- constructor(operation) {
8
+ constructor(operation, transform) {
9
9
  this.operation = operation;
10
+ this.transform = transform;
10
11
  }
11
12
  async execute(model, params) {
12
- return await this.operation(model, params);
13
+ const result = await this.operation(model, params);
14
+ return await Promise.all(result.map(entry => {
15
+ return this.transform(model, entry);
16
+ }));
13
17
  }
14
18
  }
15
19
  exports.GetEntriesByIds = GetEntriesByIds;
@@ -1 +1 @@
1
- {"version":3,"names":["GetEntriesByIds","constructor","operation","execute","model","params","exports"],"sources":["GetEntriesByIds.ts"],"sourcesContent":["import type { IGetEntriesByIds } from \"../../abstractions\";\nimport type {\n CmsEntryStorageOperations,\n CmsEntryStorageOperationsGetByIdsParams,\n CmsModel\n} from \"~/types\";\n\nexport class GetEntriesByIds implements IGetEntriesByIds {\n private operation: CmsEntryStorageOperations[\"getByIds\"];\n\n constructor(operation: CmsEntryStorageOperations[\"getByIds\"]) {\n this.operation = operation;\n }\n\n async execute(model: CmsModel, params: CmsEntryStorageOperationsGetByIdsParams) {\n return await this.operation(model, params);\n }\n}\n"],"mappings":";;;;;;AAOO,MAAMA,eAAe,CAA6B;EAGrDC,WAAWA,CAACC,SAAgD,EAAE;IAC1D,IAAI,CAACA,SAAS,GAAGA,SAAS;EAC9B;EAEA,MAAMC,OAAOA,CAACC,KAAe,EAAEC,MAA+C,EAAE;IAC5E,OAAO,MAAM,IAAI,CAACH,SAAS,CAACE,KAAK,EAAEC,MAAM,CAAC;EAC9C;AACJ;AAACC,OAAA,CAAAN,eAAA,GAAAA,eAAA","ignoreList":[]}
1
+ {"version":3,"names":["GetEntriesByIds","constructor","operation","transform","execute","model","params","result","Promise","all","map","entry","exports"],"sources":["GetEntriesByIds.ts"],"sourcesContent":["import type { IGetEntriesByIds } from \"../../abstractions\";\nimport type {\n CmsEntryStorageOperations,\n CmsEntryStorageOperationsGetByIdsParams,\n CmsModel\n} from \"~/types\";\nimport type { ITransformEntryCallable } from \"~/utils/entryStorage.js\";\n\nexport class GetEntriesByIds implements IGetEntriesByIds {\n private readonly operation: CmsEntryStorageOperations[\"getByIds\"];\n private readonly transform: ITransformEntryCallable;\n\n public constructor(\n operation: CmsEntryStorageOperations[\"getByIds\"],\n transform: ITransformEntryCallable\n ) {\n this.operation = operation;\n this.transform = transform;\n }\n\n public async execute(model: CmsModel, params: CmsEntryStorageOperationsGetByIdsParams) {\n const result = await this.operation(model, params);\n\n return await Promise.all(\n result.map(entry => {\n return this.transform(model, entry);\n })\n );\n }\n}\n"],"mappings":";;;;;;AAQO,MAAMA,eAAe,CAA6B;EAI9CC,WAAWA,CACdC,SAAgD,EAChDC,SAAkC,EACpC;IACE,IAAI,CAACD,SAAS,GAAGA,SAAS;IAC1B,IAAI,CAACC,SAAS,GAAGA,SAAS;EAC9B;EAEA,MAAaC,OAAOA,CAACC,KAAe,EAAEC,MAA+C,EAAE;IACnF,MAAMC,MAAM,GAAG,MAAM,IAAI,CAACL,SAAS,CAACG,KAAK,EAAEC,MAAM,CAAC;IAElD,OAAO,MAAME,OAAO,CAACC,GAAG,CACpBF,MAAM,CAACG,GAAG,CAACC,KAAK,IAAI;MAChB,OAAO,IAAI,CAACR,SAAS,CAACE,KAAK,EAAEM,KAAK,CAAC;IACvC,CAAC,CACL,CAAC;EACL;AACJ;AAACC,OAAA,CAAAZ,eAAA,GAAAA,eAAA","ignoreList":[]}
@@ -1,9 +1,11 @@
1
1
  import { GetEntriesByIdsNotDeleted } from "./GetEntriesByIdsNotDeleted";
2
2
  import type { AccessControl } from "../../../AccessControl/AccessControl";
3
3
  import type { CmsEntryStorageOperations } from "../../../../types";
4
+ import type { ITransformEntryCallable } from "../../../../utils/entryStorage.js";
4
5
  interface GetEntriesByIdsUseCasesParams {
5
6
  operation: CmsEntryStorageOperations["getByIds"];
6
7
  accessControl: AccessControl;
8
+ transform: ITransformEntryCallable;
7
9
  }
8
10
  export declare const getEntriesByIdsUseCases: (params: GetEntriesByIdsUseCasesParams) => {
9
11
  getEntriesByIdsUseCase: GetEntriesByIdsNotDeleted;
@@ -8,7 +8,7 @@ var _GetEntriesByIds = require("./GetEntriesByIds");
8
8
  var _GetEntriesByIdsSecure = require("./GetEntriesByIdsSecure");
9
9
  var _GetEntriesByIdsNotDeleted = require("./GetEntriesByIdsNotDeleted");
10
10
  const getEntriesByIdsUseCases = params => {
11
- const getEntriesByIds = new _GetEntriesByIds.GetEntriesByIds(params.operation);
11
+ const getEntriesByIds = new _GetEntriesByIds.GetEntriesByIds(params.operation, params.transform);
12
12
  const getEntriesByIdsSecure = new _GetEntriesByIdsSecure.GetEntriesByIdsSecure(params.accessControl, getEntriesByIds);
13
13
  const getEntriesByIdsNotDeleted = new _GetEntriesByIdsNotDeleted.GetEntriesByIdsNotDeleted(getEntriesByIdsSecure);
14
14
  return {
@@ -1 +1 @@
1
- {"version":3,"names":["_GetEntriesByIds","require","_GetEntriesByIdsSecure","_GetEntriesByIdsNotDeleted","getEntriesByIdsUseCases","params","getEntriesByIds","GetEntriesByIds","operation","getEntriesByIdsSecure","GetEntriesByIdsSecure","accessControl","getEntriesByIdsNotDeleted","GetEntriesByIdsNotDeleted","getEntriesByIdsUseCase","exports"],"sources":["index.ts"],"sourcesContent":["import { GetEntriesByIds } from \"./GetEntriesByIds\";\nimport { GetEntriesByIdsSecure } from \"./GetEntriesByIdsSecure\";\nimport { GetEntriesByIdsNotDeleted } from \"./GetEntriesByIdsNotDeleted\";\nimport type { AccessControl } from \"~/crud/AccessControl/AccessControl\";\nimport type { CmsEntryStorageOperations } from \"~/types\";\n\ninterface GetEntriesByIdsUseCasesParams {\n operation: CmsEntryStorageOperations[\"getByIds\"];\n accessControl: AccessControl;\n}\n\nexport const getEntriesByIdsUseCases = (params: GetEntriesByIdsUseCasesParams) => {\n const getEntriesByIds = new GetEntriesByIds(params.operation);\n const getEntriesByIdsSecure = new GetEntriesByIdsSecure(params.accessControl, getEntriesByIds);\n const getEntriesByIdsNotDeleted = new GetEntriesByIdsNotDeleted(getEntriesByIdsSecure);\n\n return {\n getEntriesByIdsUseCase: getEntriesByIdsNotDeleted\n };\n};\n"],"mappings":";;;;;;AAAA,IAAAA,gBAAA,GAAAC,OAAA;AACA,IAAAC,sBAAA,GAAAD,OAAA;AACA,IAAAE,0BAAA,GAAAF,OAAA;AASO,MAAMG,uBAAuB,GAAIC,MAAqC,IAAK;EAC9E,MAAMC,eAAe,GAAG,IAAIC,gCAAe,CAACF,MAAM,CAACG,SAAS,CAAC;EAC7D,MAAMC,qBAAqB,GAAG,IAAIC,4CAAqB,CAACL,MAAM,CAACM,aAAa,EAAEL,eAAe,CAAC;EAC9F,MAAMM,yBAAyB,GAAG,IAAIC,oDAAyB,CAACJ,qBAAqB,CAAC;EAEtF,OAAO;IACHK,sBAAsB,EAAEF;EAC5B,CAAC;AACL,CAAC;AAACG,OAAA,CAAAX,uBAAA,GAAAA,uBAAA","ignoreList":[]}
1
+ {"version":3,"names":["_GetEntriesByIds","require","_GetEntriesByIdsSecure","_GetEntriesByIdsNotDeleted","getEntriesByIdsUseCases","params","getEntriesByIds","GetEntriesByIds","operation","transform","getEntriesByIdsSecure","GetEntriesByIdsSecure","accessControl","getEntriesByIdsNotDeleted","GetEntriesByIdsNotDeleted","getEntriesByIdsUseCase","exports"],"sources":["index.ts"],"sourcesContent":["import { GetEntriesByIds } from \"./GetEntriesByIds\";\nimport { GetEntriesByIdsSecure } from \"./GetEntriesByIdsSecure\";\nimport { GetEntriesByIdsNotDeleted } from \"./GetEntriesByIdsNotDeleted\";\nimport type { AccessControl } from \"~/crud/AccessControl/AccessControl\";\nimport type { CmsEntryStorageOperations } from \"~/types\";\nimport type { ITransformEntryCallable } from \"~/utils/entryStorage.js\";\n\ninterface GetEntriesByIdsUseCasesParams {\n operation: CmsEntryStorageOperations[\"getByIds\"];\n accessControl: AccessControl;\n transform: ITransformEntryCallable;\n}\n\nexport const getEntriesByIdsUseCases = (params: GetEntriesByIdsUseCasesParams) => {\n const getEntriesByIds = new GetEntriesByIds(params.operation, params.transform);\n const getEntriesByIdsSecure = new GetEntriesByIdsSecure(params.accessControl, getEntriesByIds);\n const getEntriesByIdsNotDeleted = new GetEntriesByIdsNotDeleted(getEntriesByIdsSecure);\n\n return {\n getEntriesByIdsUseCase: getEntriesByIdsNotDeleted\n };\n};\n"],"mappings":";;;;;;AAAA,IAAAA,gBAAA,GAAAC,OAAA;AACA,IAAAC,sBAAA,GAAAD,OAAA;AACA,IAAAE,0BAAA,GAAAF,OAAA;AAWO,MAAMG,uBAAuB,GAAIC,MAAqC,IAAK;EAC9E,MAAMC,eAAe,GAAG,IAAIC,gCAAe,CAACF,MAAM,CAACG,SAAS,EAAEH,MAAM,CAACI,SAAS,CAAC;EAC/E,MAAMC,qBAAqB,GAAG,IAAIC,4CAAqB,CAACN,MAAM,CAACO,aAAa,EAAEN,eAAe,CAAC;EAC9F,MAAMO,yBAAyB,GAAG,IAAIC,oDAAyB,CAACJ,qBAAqB,CAAC;EAEtF,OAAO;IACHK,sBAAsB,EAAEF;EAC5B,CAAC;AACL,CAAC;AAACG,OAAA,CAAAZ,uBAAA,GAAAA,uBAAA","ignoreList":[]}
@@ -1,7 +1,9 @@
1
1
  import type { IGetLatestEntriesByIds } from "../../abstractions";
2
2
  import type { CmsEntryStorageOperations, CmsEntryStorageOperationsGetLatestByIdsParams, CmsModel } from "../../../../types";
3
+ import type { ITransformEntryCallable } from "../../../../utils/entryStorage.js";
3
4
  export declare class GetLatestEntriesByIds implements IGetLatestEntriesByIds {
4
- private operation;
5
- constructor(operation: CmsEntryStorageOperations["getLatestByIds"]);
6
- execute(model: CmsModel, params: CmsEntryStorageOperationsGetLatestByIdsParams): Promise<import("../../../../types").CmsStorageEntry[]>;
5
+ private readonly operation;
6
+ private readonly transform;
7
+ constructor(operation: CmsEntryStorageOperations["getLatestByIds"], transform: ITransformEntryCallable);
8
+ execute(model: CmsModel, params: CmsEntryStorageOperationsGetLatestByIdsParams): Promise<import("../../../../types").CmsEntry<import("../../../../types").CmsEntryValues>[]>;
7
9
  }
@@ -5,11 +5,15 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.GetLatestEntriesByIds = void 0;
7
7
  class GetLatestEntriesByIds {
8
- constructor(operation) {
8
+ constructor(operation, transform) {
9
9
  this.operation = operation;
10
+ this.transform = transform;
10
11
  }
11
12
  async execute(model, params) {
12
- return await this.operation(model, params);
13
+ const result = await this.operation(model, params);
14
+ return await Promise.all(result.map(async entry => {
15
+ return this.transform(model, entry);
16
+ }));
13
17
  }
14
18
  }
15
19
  exports.GetLatestEntriesByIds = GetLatestEntriesByIds;
@@ -1 +1 @@
1
- {"version":3,"names":["GetLatestEntriesByIds","constructor","operation","execute","model","params","exports"],"sources":["GetLatestEntriesByIds.ts"],"sourcesContent":["import type { IGetLatestEntriesByIds } from \"../../abstractions\";\nimport type {\n CmsEntryStorageOperations,\n CmsEntryStorageOperationsGetLatestByIdsParams,\n CmsModel\n} from \"~/types\";\n\nexport class GetLatestEntriesByIds implements IGetLatestEntriesByIds {\n private operation: CmsEntryStorageOperations[\"getLatestByIds\"];\n\n constructor(operation: CmsEntryStorageOperations[\"getLatestByIds\"]) {\n this.operation = operation;\n }\n\n async execute(model: CmsModel, params: CmsEntryStorageOperationsGetLatestByIdsParams) {\n return await this.operation(model, params);\n }\n}\n"],"mappings":";;;;;;AAOO,MAAMA,qBAAqB,CAAmC;EAGjEC,WAAWA,CAACC,SAAsD,EAAE;IAChE,IAAI,CAACA,SAAS,GAAGA,SAAS;EAC9B;EAEA,MAAMC,OAAOA,CAACC,KAAe,EAAEC,MAAqD,EAAE;IAClF,OAAO,MAAM,IAAI,CAACH,SAAS,CAACE,KAAK,EAAEC,MAAM,CAAC;EAC9C;AACJ;AAACC,OAAA,CAAAN,qBAAA,GAAAA,qBAAA","ignoreList":[]}
1
+ {"version":3,"names":["GetLatestEntriesByIds","constructor","operation","transform","execute","model","params","result","Promise","all","map","entry","exports"],"sources":["GetLatestEntriesByIds.ts"],"sourcesContent":["import type { IGetLatestEntriesByIds } from \"../../abstractions\";\nimport type {\n CmsEntryStorageOperations,\n CmsEntryStorageOperationsGetLatestByIdsParams,\n CmsModel\n} from \"~/types\";\nimport type { ITransformEntryCallable } from \"~/utils/entryStorage.js\";\n\nexport class GetLatestEntriesByIds implements IGetLatestEntriesByIds {\n private readonly operation: CmsEntryStorageOperations[\"getLatestByIds\"];\n private readonly transform: ITransformEntryCallable;\n\n public constructor(\n operation: CmsEntryStorageOperations[\"getLatestByIds\"],\n transform: ITransformEntryCallable\n ) {\n this.operation = operation;\n this.transform = transform;\n }\n\n public async execute(model: CmsModel, params: CmsEntryStorageOperationsGetLatestByIdsParams) {\n const result = await this.operation(model, params);\n\n return await Promise.all(\n result.map(async entry => {\n return this.transform(model, entry);\n })\n );\n }\n}\n"],"mappings":";;;;;;AAQO,MAAMA,qBAAqB,CAAmC;EAI1DC,WAAWA,CACdC,SAAsD,EACtDC,SAAkC,EACpC;IACE,IAAI,CAACD,SAAS,GAAGA,SAAS;IAC1B,IAAI,CAACC,SAAS,GAAGA,SAAS;EAC9B;EAEA,MAAaC,OAAOA,CAACC,KAAe,EAAEC,MAAqD,EAAE;IACzF,MAAMC,MAAM,GAAG,MAAM,IAAI,CAACL,SAAS,CAACG,KAAK,EAAEC,MAAM,CAAC;IAElD,OAAO,MAAME,OAAO,CAACC,GAAG,CACpBF,MAAM,CAACG,GAAG,CAAC,MAAMC,KAAK,IAAI;MACtB,OAAO,IAAI,CAACR,SAAS,CAACE,KAAK,EAAEM,KAAK,CAAC;IACvC,CAAC,CACL,CAAC;EACL;AACJ;AAACC,OAAA,CAAAZ,qBAAA,GAAAA,qBAAA","ignoreList":[]}
@@ -1,9 +1,11 @@
1
1
  import { GetLatestEntriesByIdsNotDeleted } from "./GetLatestEntriesByIdsNotDeleted";
2
2
  import type { CmsEntryStorageOperations } from "../../../../types";
3
3
  import type { AccessControl } from "../../../AccessControl/AccessControl";
4
+ import type { ITransformEntryCallable } from "../../../../utils/entryStorage.js";
4
5
  interface GetLatestEntriesByIdsUseCasesParams {
5
6
  operation: CmsEntryStorageOperations["getLatestByIds"];
6
7
  accessControl: AccessControl;
8
+ transform: ITransformEntryCallable;
7
9
  }
8
10
  export declare const getLatestEntriesByIdsUseCases: (params: GetLatestEntriesByIdsUseCasesParams) => {
9
11
  getLatestEntriesByIdsUseCase: GetLatestEntriesByIdsNotDeleted;
@@ -8,7 +8,7 @@ var _GetLatestEntriesByIds = require("./GetLatestEntriesByIds");
8
8
  var _GetLatestEntriesByIdsNotDeleted = require("./GetLatestEntriesByIdsNotDeleted");
9
9
  var _GetLatestEntriesByIdsSecure = require("./GetLatestEntriesByIdsSecure");
10
10
  const getLatestEntriesByIdsUseCases = params => {
11
- const getLatestEntriesByIds = new _GetLatestEntriesByIds.GetLatestEntriesByIds(params.operation);
11
+ const getLatestEntriesByIds = new _GetLatestEntriesByIds.GetLatestEntriesByIds(params.operation, params.transform);
12
12
  const getLatestEntriesByIdsSecure = new _GetLatestEntriesByIdsSecure.GetLatestEntriesByIdsSecure(params.accessControl, getLatestEntriesByIds);
13
13
  const getLatestEntriesByIdsNotDeleted = new _GetLatestEntriesByIdsNotDeleted.GetLatestEntriesByIdsNotDeleted(getLatestEntriesByIdsSecure);
14
14
  return {
@@ -1 +1 @@
1
- {"version":3,"names":["_GetLatestEntriesByIds","require","_GetLatestEntriesByIdsNotDeleted","_GetLatestEntriesByIdsSecure","getLatestEntriesByIdsUseCases","params","getLatestEntriesByIds","GetLatestEntriesByIds","operation","getLatestEntriesByIdsSecure","GetLatestEntriesByIdsSecure","accessControl","getLatestEntriesByIdsNotDeleted","GetLatestEntriesByIdsNotDeleted","getLatestEntriesByIdsUseCase","exports"],"sources":["index.ts"],"sourcesContent":["import { GetLatestEntriesByIds } from \"./GetLatestEntriesByIds\";\nimport { GetLatestEntriesByIdsNotDeleted } from \"./GetLatestEntriesByIdsNotDeleted\";\nimport { GetLatestEntriesByIdsSecure } from \"./GetLatestEntriesByIdsSecure\";\nimport type { CmsEntryStorageOperations } from \"~/types\";\nimport type { AccessControl } from \"~/crud/AccessControl/AccessControl\";\n\ninterface GetLatestEntriesByIdsUseCasesParams {\n operation: CmsEntryStorageOperations[\"getLatestByIds\"];\n accessControl: AccessControl;\n}\n\nexport const getLatestEntriesByIdsUseCases = (params: GetLatestEntriesByIdsUseCasesParams) => {\n const getLatestEntriesByIds = new GetLatestEntriesByIds(params.operation);\n const getLatestEntriesByIdsSecure = new GetLatestEntriesByIdsSecure(\n params.accessControl,\n getLatestEntriesByIds\n );\n const getLatestEntriesByIdsNotDeleted = new GetLatestEntriesByIdsNotDeleted(\n getLatestEntriesByIdsSecure\n );\n\n return {\n getLatestEntriesByIdsUseCase: getLatestEntriesByIdsNotDeleted\n };\n};\n"],"mappings":";;;;;;AAAA,IAAAA,sBAAA,GAAAC,OAAA;AACA,IAAAC,gCAAA,GAAAD,OAAA;AACA,IAAAE,4BAAA,GAAAF,OAAA;AASO,MAAMG,6BAA6B,GAAIC,MAA2C,IAAK;EAC1F,MAAMC,qBAAqB,GAAG,IAAIC,4CAAqB,CAACF,MAAM,CAACG,SAAS,CAAC;EACzE,MAAMC,2BAA2B,GAAG,IAAIC,wDAA2B,CAC/DL,MAAM,CAACM,aAAa,EACpBL,qBACJ,CAAC;EACD,MAAMM,+BAA+B,GAAG,IAAIC,gEAA+B,CACvEJ,2BACJ,CAAC;EAED,OAAO;IACHK,4BAA4B,EAAEF;EAClC,CAAC;AACL,CAAC;AAACG,OAAA,CAAAX,6BAAA,GAAAA,6BAAA","ignoreList":[]}
1
+ {"version":3,"names":["_GetLatestEntriesByIds","require","_GetLatestEntriesByIdsNotDeleted","_GetLatestEntriesByIdsSecure","getLatestEntriesByIdsUseCases","params","getLatestEntriesByIds","GetLatestEntriesByIds","operation","transform","getLatestEntriesByIdsSecure","GetLatestEntriesByIdsSecure","accessControl","getLatestEntriesByIdsNotDeleted","GetLatestEntriesByIdsNotDeleted","getLatestEntriesByIdsUseCase","exports"],"sources":["index.ts"],"sourcesContent":["import { GetLatestEntriesByIds } from \"./GetLatestEntriesByIds\";\nimport { GetLatestEntriesByIdsNotDeleted } from \"./GetLatestEntriesByIdsNotDeleted\";\nimport { GetLatestEntriesByIdsSecure } from \"./GetLatestEntriesByIdsSecure\";\nimport type { CmsEntryStorageOperations } from \"~/types\";\nimport type { AccessControl } from \"~/crud/AccessControl/AccessControl\";\nimport type { ITransformEntryCallable } from \"~/utils/entryStorage.js\";\n\ninterface GetLatestEntriesByIdsUseCasesParams {\n operation: CmsEntryStorageOperations[\"getLatestByIds\"];\n accessControl: AccessControl;\n transform: ITransformEntryCallable;\n}\n\nexport const getLatestEntriesByIdsUseCases = (params: GetLatestEntriesByIdsUseCasesParams) => {\n const getLatestEntriesByIds = new GetLatestEntriesByIds(params.operation, params.transform);\n const getLatestEntriesByIdsSecure = new GetLatestEntriesByIdsSecure(\n params.accessControl,\n getLatestEntriesByIds\n );\n const getLatestEntriesByIdsNotDeleted = new GetLatestEntriesByIdsNotDeleted(\n getLatestEntriesByIdsSecure\n );\n\n return {\n getLatestEntriesByIdsUseCase: getLatestEntriesByIdsNotDeleted\n };\n};\n"],"mappings":";;;;;;AAAA,IAAAA,sBAAA,GAAAC,OAAA;AACA,IAAAC,gCAAA,GAAAD,OAAA;AACA,IAAAE,4BAAA,GAAAF,OAAA;AAWO,MAAMG,6BAA6B,GAAIC,MAA2C,IAAK;EAC1F,MAAMC,qBAAqB,GAAG,IAAIC,4CAAqB,CAACF,MAAM,CAACG,SAAS,EAAEH,MAAM,CAACI,SAAS,CAAC;EAC3F,MAAMC,2BAA2B,GAAG,IAAIC,wDAA2B,CAC/DN,MAAM,CAACO,aAAa,EACpBN,qBACJ,CAAC;EACD,MAAMO,+BAA+B,GAAG,IAAIC,gEAA+B,CACvEJ,2BACJ,CAAC;EAED,OAAO;IACHK,4BAA4B,EAAEF;EAClC,CAAC;AACL,CAAC;AAACG,OAAA,CAAAZ,6BAAA,GAAAA,6BAAA","ignoreList":[]}
@@ -1,7 +1,9 @@
1
1
  import type { IGetLatestRevisionByEntryId } from "../../abstractions";
2
2
  import type { CmsEntryStorageOperations, CmsEntryStorageOperationsGetLatestRevisionParams, CmsModel } from "../../../../types";
3
+ import type { ITransformEntryCallable } from "../../../../utils/entryStorage.js";
3
4
  export declare class GetLatestRevisionByEntryId implements IGetLatestRevisionByEntryId {
4
- private operation;
5
- constructor(operation: CmsEntryStorageOperations["getLatestRevisionByEntryId"]);
6
- execute(model: CmsModel, params: CmsEntryStorageOperationsGetLatestRevisionParams): Promise<import("../../../../types").CmsStorageEntry | null>;
5
+ private readonly operation;
6
+ private readonly transform;
7
+ constructor(operation: CmsEntryStorageOperations["getLatestRevisionByEntryId"], transform: ITransformEntryCallable);
8
+ execute(model: CmsModel, params: CmsEntryStorageOperationsGetLatestRevisionParams): Promise<import("../../../../types").CmsEntry<import("../../../../types").CmsEntryValues> | null>;
7
9
  }
@@ -5,11 +5,16 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.GetLatestRevisionByEntryId = void 0;
7
7
  class GetLatestRevisionByEntryId {
8
- constructor(operation) {
8
+ constructor(operation, transform) {
9
9
  this.operation = operation;
10
+ this.transform = transform;
10
11
  }
11
12
  async execute(model, params) {
12
- return await this.operation(model, params);
13
+ const entry = await this.operation(model, params);
14
+ if (!entry) {
15
+ return null;
16
+ }
17
+ return this.transform(model, entry);
13
18
  }
14
19
  }
15
20
  exports.GetLatestRevisionByEntryId = GetLatestRevisionByEntryId;
@@ -1 +1 @@
1
- {"version":3,"names":["GetLatestRevisionByEntryId","constructor","operation","execute","model","params","exports"],"sources":["GetLatestRevisionByEntryId.ts"],"sourcesContent":["import type { IGetLatestRevisionByEntryId } from \"../../abstractions\";\nimport type {\n CmsEntryStorageOperations,\n CmsEntryStorageOperationsGetLatestRevisionParams,\n CmsModel\n} from \"~/types\";\n\nexport class GetLatestRevisionByEntryId implements IGetLatestRevisionByEntryId {\n private operation: CmsEntryStorageOperations[\"getLatestRevisionByEntryId\"];\n\n constructor(operation: CmsEntryStorageOperations[\"getLatestRevisionByEntryId\"]) {\n this.operation = operation;\n }\n\n async execute(model: CmsModel, params: CmsEntryStorageOperationsGetLatestRevisionParams) {\n return await this.operation(model, params);\n }\n}\n"],"mappings":";;;;;;AAOO,MAAMA,0BAA0B,CAAwC;EAG3EC,WAAWA,CAACC,SAAkE,EAAE;IAC5E,IAAI,CAACA,SAAS,GAAGA,SAAS;EAC9B;EAEA,MAAMC,OAAOA,CAACC,KAAe,EAAEC,MAAwD,EAAE;IACrF,OAAO,MAAM,IAAI,CAACH,SAAS,CAACE,KAAK,EAAEC,MAAM,CAAC;EAC9C;AACJ;AAACC,OAAA,CAAAN,0BAAA,GAAAA,0BAAA","ignoreList":[]}
1
+ {"version":3,"names":["GetLatestRevisionByEntryId","constructor","operation","transform","execute","model","params","entry","exports"],"sources":["GetLatestRevisionByEntryId.ts"],"sourcesContent":["import type { IGetLatestRevisionByEntryId } from \"../../abstractions\";\nimport type {\n CmsEntryStorageOperations,\n CmsEntryStorageOperationsGetLatestRevisionParams,\n CmsModel\n} from \"~/types\";\nimport type { ITransformEntryCallable } from \"~/utils/entryStorage.js\";\n\nexport class GetLatestRevisionByEntryId implements IGetLatestRevisionByEntryId {\n private readonly operation: CmsEntryStorageOperations[\"getLatestRevisionByEntryId\"];\n private readonly transform: ITransformEntryCallable;\n\n public constructor(\n operation: CmsEntryStorageOperations[\"getLatestRevisionByEntryId\"],\n transform: ITransformEntryCallable\n ) {\n this.operation = operation;\n this.transform = transform;\n }\n\n public async execute(\n model: CmsModel,\n params: CmsEntryStorageOperationsGetLatestRevisionParams\n ) {\n const entry = await this.operation(model, params);\n\n if (!entry) {\n return null;\n }\n return this.transform(model, entry);\n }\n}\n"],"mappings":";;;;;;AAQO,MAAMA,0BAA0B,CAAwC;EAIpEC,WAAWA,CACdC,SAAkE,EAClEC,SAAkC,EACpC;IACE,IAAI,CAACD,SAAS,GAAGA,SAAS;IAC1B,IAAI,CAACC,SAAS,GAAGA,SAAS;EAC9B;EAEA,MAAaC,OAAOA,CAChBC,KAAe,EACfC,MAAwD,EAC1D;IACE,MAAMC,KAAK,GAAG,MAAM,IAAI,CAACL,SAAS,CAACG,KAAK,EAAEC,MAAM,CAAC;IAEjD,IAAI,CAACC,KAAK,EAAE;MACR,OAAO,IAAI;IACf;IACA,OAAO,IAAI,CAACJ,SAAS,CAACE,KAAK,EAAEE,KAAK,CAAC;EACvC;AACJ;AAACC,OAAA,CAAAR,0BAAA,GAAAA,0BAAA","ignoreList":[]}
@@ -2,8 +2,10 @@ import { GetLatestRevisionByEntryId } from "./GetLatestRevisionByEntryId";
2
2
  import { GetLatestRevisionByEntryIdDeleted } from "./GetLatestRevisionByEntryIdDeleted";
3
3
  import { GetLatestRevisionByEntryIdNotDeleted } from "./GetLatestRevisionByEntryIdNotDeleted";
4
4
  import type { CmsEntryStorageOperations } from "../../../../types";
5
+ import type { ITransformEntryCallable } from "../../../../utils/entryStorage.js";
5
6
  interface GetLatestRevisionByEntryIdUseCasesParams {
6
7
  operation: CmsEntryStorageOperations["getLatestRevisionByEntryId"];
8
+ transform: ITransformEntryCallable;
7
9
  }
8
10
  export declare const getLatestRevisionByEntryIdUseCases: (params: GetLatestRevisionByEntryIdUseCasesParams) => {
9
11
  getLatestRevisionByEntryIdUseCase: GetLatestRevisionByEntryIdNotDeleted;
@@ -8,7 +8,7 @@ var _GetLatestRevisionByEntryId = require("./GetLatestRevisionByEntryId");
8
8
  var _GetLatestRevisionByEntryIdDeleted = require("./GetLatestRevisionByEntryIdDeleted");
9
9
  var _GetLatestRevisionByEntryIdNotDeleted = require("./GetLatestRevisionByEntryIdNotDeleted");
10
10
  const getLatestRevisionByEntryIdUseCases = params => {
11
- const getLatestRevisionByEntryId = new _GetLatestRevisionByEntryId.GetLatestRevisionByEntryId(params.operation);
11
+ const getLatestRevisionByEntryId = new _GetLatestRevisionByEntryId.GetLatestRevisionByEntryId(params.operation, params.transform);
12
12
  const getLatestRevisionByEntryIdNotDeleted = new _GetLatestRevisionByEntryIdNotDeleted.GetLatestRevisionByEntryIdNotDeleted(getLatestRevisionByEntryId);
13
13
  const getLatestRevisionByEntryIdDeleted = new _GetLatestRevisionByEntryIdDeleted.GetLatestRevisionByEntryIdDeleted(getLatestRevisionByEntryId);
14
14
  return {
@@ -1 +1 @@
1
- {"version":3,"names":["_GetLatestRevisionByEntryId","require","_GetLatestRevisionByEntryIdDeleted","_GetLatestRevisionByEntryIdNotDeleted","getLatestRevisionByEntryIdUseCases","params","getLatestRevisionByEntryId","GetLatestRevisionByEntryId","operation","getLatestRevisionByEntryIdNotDeleted","GetLatestRevisionByEntryIdNotDeleted","getLatestRevisionByEntryIdDeleted","GetLatestRevisionByEntryIdDeleted","getLatestRevisionByEntryIdUseCase","getLatestRevisionByEntryIdWithDeletedUseCase","getLatestRevisionByEntryIdDeletedUseCase","exports"],"sources":["index.ts"],"sourcesContent":["import { GetLatestRevisionByEntryId } from \"./GetLatestRevisionByEntryId\";\nimport { GetLatestRevisionByEntryIdDeleted } from \"./GetLatestRevisionByEntryIdDeleted\";\nimport { GetLatestRevisionByEntryIdNotDeleted } from \"./GetLatestRevisionByEntryIdNotDeleted\";\nimport type { CmsEntryStorageOperations } from \"~/types\";\n\ninterface GetLatestRevisionByEntryIdUseCasesParams {\n operation: CmsEntryStorageOperations[\"getLatestRevisionByEntryId\"];\n}\n\nexport const getLatestRevisionByEntryIdUseCases = (\n params: GetLatestRevisionByEntryIdUseCasesParams\n) => {\n const getLatestRevisionByEntryId = new GetLatestRevisionByEntryId(params.operation);\n const getLatestRevisionByEntryIdNotDeleted = new GetLatestRevisionByEntryIdNotDeleted(\n getLatestRevisionByEntryId\n );\n const getLatestRevisionByEntryIdDeleted = new GetLatestRevisionByEntryIdDeleted(\n getLatestRevisionByEntryId\n );\n\n return {\n getLatestRevisionByEntryIdUseCase: getLatestRevisionByEntryIdNotDeleted,\n getLatestRevisionByEntryIdWithDeletedUseCase: getLatestRevisionByEntryId,\n getLatestRevisionByEntryIdDeletedUseCase: getLatestRevisionByEntryIdDeleted\n };\n};\n"],"mappings":";;;;;;AAAA,IAAAA,2BAAA,GAAAC,OAAA;AACA,IAAAC,kCAAA,GAAAD,OAAA;AACA,IAAAE,qCAAA,GAAAF,OAAA;AAOO,MAAMG,kCAAkC,GAC3CC,MAAgD,IAC/C;EACD,MAAMC,0BAA0B,GAAG,IAAIC,sDAA0B,CAACF,MAAM,CAACG,SAAS,CAAC;EACnF,MAAMC,oCAAoC,GAAG,IAAIC,0EAAoC,CACjFJ,0BACJ,CAAC;EACD,MAAMK,iCAAiC,GAAG,IAAIC,oEAAiC,CAC3EN,0BACJ,CAAC;EAED,OAAO;IACHO,iCAAiC,EAAEJ,oCAAoC;IACvEK,4CAA4C,EAAER,0BAA0B;IACxES,wCAAwC,EAAEJ;EAC9C,CAAC;AACL,CAAC;AAACK,OAAA,CAAAZ,kCAAA,GAAAA,kCAAA","ignoreList":[]}
1
+ {"version":3,"names":["_GetLatestRevisionByEntryId","require","_GetLatestRevisionByEntryIdDeleted","_GetLatestRevisionByEntryIdNotDeleted","getLatestRevisionByEntryIdUseCases","params","getLatestRevisionByEntryId","GetLatestRevisionByEntryId","operation","transform","getLatestRevisionByEntryIdNotDeleted","GetLatestRevisionByEntryIdNotDeleted","getLatestRevisionByEntryIdDeleted","GetLatestRevisionByEntryIdDeleted","getLatestRevisionByEntryIdUseCase","getLatestRevisionByEntryIdWithDeletedUseCase","getLatestRevisionByEntryIdDeletedUseCase","exports"],"sources":["index.ts"],"sourcesContent":["import { GetLatestRevisionByEntryId } from \"./GetLatestRevisionByEntryId\";\nimport { GetLatestRevisionByEntryIdDeleted } from \"./GetLatestRevisionByEntryIdDeleted\";\nimport { GetLatestRevisionByEntryIdNotDeleted } from \"./GetLatestRevisionByEntryIdNotDeleted\";\nimport type { CmsEntryStorageOperations } from \"~/types\";\nimport type { ITransformEntryCallable } from \"~/utils/entryStorage.js\";\n\ninterface GetLatestRevisionByEntryIdUseCasesParams {\n operation: CmsEntryStorageOperations[\"getLatestRevisionByEntryId\"];\n transform: ITransformEntryCallable;\n}\n\nexport const getLatestRevisionByEntryIdUseCases = (\n params: GetLatestRevisionByEntryIdUseCasesParams\n) => {\n const getLatestRevisionByEntryId = new GetLatestRevisionByEntryId(\n params.operation,\n params.transform\n );\n const getLatestRevisionByEntryIdNotDeleted = new GetLatestRevisionByEntryIdNotDeleted(\n getLatestRevisionByEntryId\n );\n const getLatestRevisionByEntryIdDeleted = new GetLatestRevisionByEntryIdDeleted(\n getLatestRevisionByEntryId\n );\n\n return {\n getLatestRevisionByEntryIdUseCase: getLatestRevisionByEntryIdNotDeleted,\n getLatestRevisionByEntryIdWithDeletedUseCase: getLatestRevisionByEntryId,\n getLatestRevisionByEntryIdDeletedUseCase: getLatestRevisionByEntryIdDeleted\n };\n};\n"],"mappings":";;;;;;AAAA,IAAAA,2BAAA,GAAAC,OAAA;AACA,IAAAC,kCAAA,GAAAD,OAAA;AACA,IAAAE,qCAAA,GAAAF,OAAA;AASO,MAAMG,kCAAkC,GAC3CC,MAAgD,IAC/C;EACD,MAAMC,0BAA0B,GAAG,IAAIC,sDAA0B,CAC7DF,MAAM,CAACG,SAAS,EAChBH,MAAM,CAACI,SACX,CAAC;EACD,MAAMC,oCAAoC,GAAG,IAAIC,0EAAoC,CACjFL,0BACJ,CAAC;EACD,MAAMM,iCAAiC,GAAG,IAAIC,oEAAiC,CAC3EP,0BACJ,CAAC;EAED,OAAO;IACHQ,iCAAiC,EAAEJ,oCAAoC;IACvEK,4CAA4C,EAAET,0BAA0B;IACxEU,wCAAwC,EAAEJ;EAC9C,CAAC;AACL,CAAC;AAACK,OAAA,CAAAb,kCAAA,GAAAA,kCAAA","ignoreList":[]}
@@ -1,7 +1,9 @@
1
1
  import type { IGetPreviousRevisionByEntryId } from "../../abstractions";
2
2
  import type { CmsEntryStorageOperations, CmsEntryStorageOperationsGetPreviousRevisionParams, CmsModel } from "../../../../types";
3
+ import type { ITransformEntryCallable } from "../../../../utils/entryStorage.js";
3
4
  export declare class GetPreviousRevisionByEntryId implements IGetPreviousRevisionByEntryId {
4
- private operation;
5
- constructor(operation: CmsEntryStorageOperations["getPreviousRevision"]);
6
- execute(model: CmsModel, params: CmsEntryStorageOperationsGetPreviousRevisionParams): Promise<import("../../../../types").CmsStorageEntry | null>;
5
+ private readonly operation;
6
+ private readonly transform;
7
+ constructor(operation: CmsEntryStorageOperations["getPreviousRevision"], transform: ITransformEntryCallable);
8
+ execute(model: CmsModel, params: CmsEntryStorageOperationsGetPreviousRevisionParams): Promise<import("../../../../types").CmsEntry<import("../../../../types").CmsEntryValues> | null>;
7
9
  }
@@ -5,11 +5,16 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.GetPreviousRevisionByEntryId = void 0;
7
7
  class GetPreviousRevisionByEntryId {
8
- constructor(operation) {
8
+ constructor(operation, transform) {
9
9
  this.operation = operation;
10
+ this.transform = transform;
10
11
  }
11
12
  async execute(model, params) {
12
- return await this.operation(model, params);
13
+ const entry = await this.operation(model, params);
14
+ if (!entry) {
15
+ return null;
16
+ }
17
+ return await this.transform(model, entry);
13
18
  }
14
19
  }
15
20
  exports.GetPreviousRevisionByEntryId = GetPreviousRevisionByEntryId;
@@ -1 +1 @@
1
- {"version":3,"names":["GetPreviousRevisionByEntryId","constructor","operation","execute","model","params","exports"],"sources":["GetPreviousRevisionByEntryId.ts"],"sourcesContent":["import type { IGetPreviousRevisionByEntryId } from \"../../abstractions\";\nimport type {\n CmsEntryStorageOperations,\n CmsEntryStorageOperationsGetPreviousRevisionParams,\n CmsModel\n} from \"~/types\";\n\nexport class GetPreviousRevisionByEntryId implements IGetPreviousRevisionByEntryId {\n private operation: CmsEntryStorageOperations[\"getPreviousRevision\"];\n\n constructor(operation: CmsEntryStorageOperations[\"getPreviousRevision\"]) {\n this.operation = operation;\n }\n\n async execute(model: CmsModel, params: CmsEntryStorageOperationsGetPreviousRevisionParams) {\n return await this.operation(model, params);\n }\n}\n"],"mappings":";;;;;;AAOO,MAAMA,4BAA4B,CAA0C;EAG/EC,WAAWA,CAACC,SAA2D,EAAE;IACrE,IAAI,CAACA,SAAS,GAAGA,SAAS;EAC9B;EAEA,MAAMC,OAAOA,CAACC,KAAe,EAAEC,MAA0D,EAAE;IACvF,OAAO,MAAM,IAAI,CAACH,SAAS,CAACE,KAAK,EAAEC,MAAM,CAAC;EAC9C;AACJ;AAACC,OAAA,CAAAN,4BAAA,GAAAA,4BAAA","ignoreList":[]}
1
+ {"version":3,"names":["GetPreviousRevisionByEntryId","constructor","operation","transform","execute","model","params","entry","exports"],"sources":["GetPreviousRevisionByEntryId.ts"],"sourcesContent":["import type { IGetPreviousRevisionByEntryId } from \"../../abstractions\";\nimport type {\n CmsEntryStorageOperations,\n CmsEntryStorageOperationsGetPreviousRevisionParams,\n CmsModel\n} from \"~/types\";\nimport type { ITransformEntryCallable } from \"~/utils/entryStorage.js\";\n\nexport class GetPreviousRevisionByEntryId implements IGetPreviousRevisionByEntryId {\n private readonly operation: CmsEntryStorageOperations[\"getPreviousRevision\"];\n private readonly transform: ITransformEntryCallable;\n\n public constructor(\n operation: CmsEntryStorageOperations[\"getPreviousRevision\"],\n transform: ITransformEntryCallable\n ) {\n this.operation = operation;\n this.transform = transform;\n }\n\n public async execute(\n model: CmsModel,\n params: CmsEntryStorageOperationsGetPreviousRevisionParams\n ) {\n const entry = await this.operation(model, params);\n\n if (!entry) {\n return null;\n }\n return await this.transform(model, entry);\n }\n}\n"],"mappings":";;;;;;AAQO,MAAMA,4BAA4B,CAA0C;EAIxEC,WAAWA,CACdC,SAA2D,EAC3DC,SAAkC,EACpC;IACE,IAAI,CAACD,SAAS,GAAGA,SAAS;IAC1B,IAAI,CAACC,SAAS,GAAGA,SAAS;EAC9B;EAEA,MAAaC,OAAOA,CAChBC,KAAe,EACfC,MAA0D,EAC5D;IACE,MAAMC,KAAK,GAAG,MAAM,IAAI,CAACL,SAAS,CAACG,KAAK,EAAEC,MAAM,CAAC;IAEjD,IAAI,CAACC,KAAK,EAAE;MACR,OAAO,IAAI;IACf;IACA,OAAO,MAAM,IAAI,CAACJ,SAAS,CAACE,KAAK,EAAEE,KAAK,CAAC;EAC7C;AACJ;AAACC,OAAA,CAAAR,4BAAA,GAAAA,4BAAA","ignoreList":[]}
@@ -1,7 +1,9 @@
1
1
  import { GetPreviousRevisionByEntryIdNotDeleted } from "./GetPreviousRevisionByEntryIdNotDeleted";
2
2
  import type { CmsEntryStorageOperations } from "../../../../types";
3
+ import type { ITransformEntryCallable } from "../../../../utils/entryStorage.js";
3
4
  interface GetPreviousRevisionByEntryIdUseCasesParams {
4
5
  operation: CmsEntryStorageOperations["getPreviousRevision"];
6
+ transform: ITransformEntryCallable;
5
7
  }
6
8
  export declare const getPreviousRevisionByEntryIdUseCases: (params: GetPreviousRevisionByEntryIdUseCasesParams) => {
7
9
  getPreviousRevisionByEntryIdUseCase: GetPreviousRevisionByEntryIdNotDeleted;
@@ -7,7 +7,7 @@ exports.getPreviousRevisionByEntryIdUseCases = void 0;
7
7
  var _GetPreviousRevisionByEntryId = require("./GetPreviousRevisionByEntryId");
8
8
  var _GetPreviousRevisionByEntryIdNotDeleted = require("./GetPreviousRevisionByEntryIdNotDeleted");
9
9
  const getPreviousRevisionByEntryIdUseCases = params => {
10
- const getPreviousRevisionByEntryId = new _GetPreviousRevisionByEntryId.GetPreviousRevisionByEntryId(params.operation);
10
+ const getPreviousRevisionByEntryId = new _GetPreviousRevisionByEntryId.GetPreviousRevisionByEntryId(params.operation, params.transform);
11
11
  const getPreviousRevisionByEntryIdNotDeleted = new _GetPreviousRevisionByEntryIdNotDeleted.GetPreviousRevisionByEntryIdNotDeleted(getPreviousRevisionByEntryId);
12
12
  return {
13
13
  getPreviousRevisionByEntryIdUseCase: getPreviousRevisionByEntryIdNotDeleted
@@ -1 +1 @@
1
- {"version":3,"names":["_GetPreviousRevisionByEntryId","require","_GetPreviousRevisionByEntryIdNotDeleted","getPreviousRevisionByEntryIdUseCases","params","getPreviousRevisionByEntryId","GetPreviousRevisionByEntryId","operation","getPreviousRevisionByEntryIdNotDeleted","GetPreviousRevisionByEntryIdNotDeleted","getPreviousRevisionByEntryIdUseCase","exports"],"sources":["index.ts"],"sourcesContent":["import { GetPreviousRevisionByEntryId } from \"./GetPreviousRevisionByEntryId\";\nimport { GetPreviousRevisionByEntryIdNotDeleted } from \"./GetPreviousRevisionByEntryIdNotDeleted\";\nimport type { CmsEntryStorageOperations } from \"~/types\";\n\ninterface GetPreviousRevisionByEntryIdUseCasesParams {\n operation: CmsEntryStorageOperations[\"getPreviousRevision\"];\n}\n\nexport const getPreviousRevisionByEntryIdUseCases = (\n params: GetPreviousRevisionByEntryIdUseCasesParams\n) => {\n const getPreviousRevisionByEntryId = new GetPreviousRevisionByEntryId(params.operation);\n const getPreviousRevisionByEntryIdNotDeleted = new GetPreviousRevisionByEntryIdNotDeleted(\n getPreviousRevisionByEntryId\n );\n\n return {\n getPreviousRevisionByEntryIdUseCase: getPreviousRevisionByEntryIdNotDeleted\n };\n};\n"],"mappings":";;;;;;AAAA,IAAAA,6BAAA,GAAAC,OAAA;AACA,IAAAC,uCAAA,GAAAD,OAAA;AAOO,MAAME,oCAAoC,GAC7CC,MAAkD,IACjD;EACD,MAAMC,4BAA4B,GAAG,IAAIC,0DAA4B,CAACF,MAAM,CAACG,SAAS,CAAC;EACvF,MAAMC,sCAAsC,GAAG,IAAIC,8EAAsC,CACrFJ,4BACJ,CAAC;EAED,OAAO;IACHK,mCAAmC,EAAEF;EACzC,CAAC;AACL,CAAC;AAACG,OAAA,CAAAR,oCAAA,GAAAA,oCAAA","ignoreList":[]}
1
+ {"version":3,"names":["_GetPreviousRevisionByEntryId","require","_GetPreviousRevisionByEntryIdNotDeleted","getPreviousRevisionByEntryIdUseCases","params","getPreviousRevisionByEntryId","GetPreviousRevisionByEntryId","operation","transform","getPreviousRevisionByEntryIdNotDeleted","GetPreviousRevisionByEntryIdNotDeleted","getPreviousRevisionByEntryIdUseCase","exports"],"sources":["index.ts"],"sourcesContent":["import { GetPreviousRevisionByEntryId } from \"./GetPreviousRevisionByEntryId\";\nimport { GetPreviousRevisionByEntryIdNotDeleted } from \"./GetPreviousRevisionByEntryIdNotDeleted\";\nimport type { CmsEntryStorageOperations } from \"~/types\";\nimport type { ITransformEntryCallable } from \"~/utils/entryStorage.js\";\n\ninterface GetPreviousRevisionByEntryIdUseCasesParams {\n operation: CmsEntryStorageOperations[\"getPreviousRevision\"];\n transform: ITransformEntryCallable;\n}\n\nexport const getPreviousRevisionByEntryIdUseCases = (\n params: GetPreviousRevisionByEntryIdUseCasesParams\n) => {\n const getPreviousRevisionByEntryId = new GetPreviousRevisionByEntryId(\n params.operation,\n params.transform\n );\n const getPreviousRevisionByEntryIdNotDeleted = new GetPreviousRevisionByEntryIdNotDeleted(\n getPreviousRevisionByEntryId\n );\n\n return {\n getPreviousRevisionByEntryIdUseCase: getPreviousRevisionByEntryIdNotDeleted\n };\n};\n"],"mappings":";;;;;;AAAA,IAAAA,6BAAA,GAAAC,OAAA;AACA,IAAAC,uCAAA,GAAAD,OAAA;AASO,MAAME,oCAAoC,GAC7CC,MAAkD,IACjD;EACD,MAAMC,4BAA4B,GAAG,IAAIC,0DAA4B,CACjEF,MAAM,CAACG,SAAS,EAChBH,MAAM,CAACI,SACX,CAAC;EACD,MAAMC,sCAAsC,GAAG,IAAIC,8EAAsC,CACrFL,4BACJ,CAAC;EAED,OAAO;IACHM,mCAAmC,EAAEF;EACzC,CAAC;AACL,CAAC;AAACG,OAAA,CAAAT,oCAAA,GAAAA,oCAAA","ignoreList":[]}
@@ -1,7 +1,9 @@
1
1
  import type { IGetPublishedEntriesByIds } from "../../abstractions";
2
2
  import type { CmsEntryStorageOperations, CmsEntryStorageOperationsGetPublishedByIdsParams, CmsModel } from "../../../../types";
3
+ import type { ITransformEntryCallable } from "../../../../utils/entryStorage.js";
3
4
  export declare class GetPublishedEntriesByIds implements IGetPublishedEntriesByIds {
4
- private operation;
5
- constructor(operation: CmsEntryStorageOperations["getPublishedByIds"]);
6
- execute(model: CmsModel, params: CmsEntryStorageOperationsGetPublishedByIdsParams): Promise<import("../../../../types").CmsStorageEntry[]>;
5
+ private readonly operation;
6
+ private readonly transform;
7
+ constructor(operation: CmsEntryStorageOperations["getPublishedByIds"], transform: ITransformEntryCallable);
8
+ execute(model: CmsModel, params: CmsEntryStorageOperationsGetPublishedByIdsParams): Promise<import("../../../../types").CmsEntry<import("../../../../types").CmsEntryValues>[]>;
7
9
  }
@@ -5,11 +5,15 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.GetPublishedEntriesByIds = void 0;
7
7
  class GetPublishedEntriesByIds {
8
- constructor(operation) {
8
+ constructor(operation, transform) {
9
9
  this.operation = operation;
10
+ this.transform = transform;
10
11
  }
11
12
  async execute(model, params) {
12
- return await this.operation(model, params);
13
+ const result = await this.operation(model, params);
14
+ return await Promise.all(result.map(async entry => {
15
+ return await this.transform(model, entry);
16
+ }));
13
17
  }
14
18
  }
15
19
  exports.GetPublishedEntriesByIds = GetPublishedEntriesByIds;
@@ -1 +1 @@
1
- {"version":3,"names":["GetPublishedEntriesByIds","constructor","operation","execute","model","params","exports"],"sources":["GetPublishedEntriesByIds.ts"],"sourcesContent":["import type { IGetPublishedEntriesByIds } from \"../../abstractions\";\nimport type {\n CmsEntryStorageOperations,\n CmsEntryStorageOperationsGetPublishedByIdsParams,\n CmsModel\n} from \"~/types\";\n\nexport class GetPublishedEntriesByIds implements IGetPublishedEntriesByIds {\n private operation: CmsEntryStorageOperations[\"getPublishedByIds\"];\n\n constructor(operation: CmsEntryStorageOperations[\"getPublishedByIds\"]) {\n this.operation = operation;\n }\n\n async execute(model: CmsModel, params: CmsEntryStorageOperationsGetPublishedByIdsParams) {\n return await this.operation(model, params);\n }\n}\n"],"mappings":";;;;;;AAOO,MAAMA,wBAAwB,CAAsC;EAGvEC,WAAWA,CAACC,SAAyD,EAAE;IACnE,IAAI,CAACA,SAAS,GAAGA,SAAS;EAC9B;EAEA,MAAMC,OAAOA,CAACC,KAAe,EAAEC,MAAwD,EAAE;IACrF,OAAO,MAAM,IAAI,CAACH,SAAS,CAACE,KAAK,EAAEC,MAAM,CAAC;EAC9C;AACJ;AAACC,OAAA,CAAAN,wBAAA,GAAAA,wBAAA","ignoreList":[]}
1
+ {"version":3,"names":["GetPublishedEntriesByIds","constructor","operation","transform","execute","model","params","result","Promise","all","map","entry","exports"],"sources":["GetPublishedEntriesByIds.ts"],"sourcesContent":["import type { IGetPublishedEntriesByIds } from \"../../abstractions\";\nimport type {\n CmsEntryStorageOperations,\n CmsEntryStorageOperationsGetPublishedByIdsParams,\n CmsModel\n} from \"~/types\";\nimport type { ITransformEntryCallable } from \"~/utils/entryStorage.js\";\n\nexport class GetPublishedEntriesByIds implements IGetPublishedEntriesByIds {\n private readonly operation: CmsEntryStorageOperations[\"getPublishedByIds\"];\n private readonly transform: ITransformEntryCallable;\n\n public constructor(\n operation: CmsEntryStorageOperations[\"getPublishedByIds\"],\n transform: ITransformEntryCallable\n ) {\n this.operation = operation;\n this.transform = transform;\n }\n\n public async execute(\n model: CmsModel,\n params: CmsEntryStorageOperationsGetPublishedByIdsParams\n ) {\n const result = await this.operation(model, params);\n\n return await Promise.all(\n result.map(async entry => {\n return await this.transform(model, entry);\n })\n );\n }\n}\n"],"mappings":";;;;;;AAQO,MAAMA,wBAAwB,CAAsC;EAIhEC,WAAWA,CACdC,SAAyD,EACzDC,SAAkC,EACpC;IACE,IAAI,CAACD,SAAS,GAAGA,SAAS;IAC1B,IAAI,CAACC,SAAS,GAAGA,SAAS;EAC9B;EAEA,MAAaC,OAAOA,CAChBC,KAAe,EACfC,MAAwD,EAC1D;IACE,MAAMC,MAAM,GAAG,MAAM,IAAI,CAACL,SAAS,CAACG,KAAK,EAAEC,MAAM,CAAC;IAElD,OAAO,MAAME,OAAO,CAACC,GAAG,CACpBF,MAAM,CAACG,GAAG,CAAC,MAAMC,KAAK,IAAI;MACtB,OAAO,MAAM,IAAI,CAACR,SAAS,CAACE,KAAK,EAAEM,KAAK,CAAC;IAC7C,CAAC,CACL,CAAC;EACL;AACJ;AAACC,OAAA,CAAAZ,wBAAA,GAAAA,wBAAA","ignoreList":[]}
@@ -1,9 +1,11 @@
1
1
  import { GetPublishedEntriesByIdsNotDeleted } from "./GetPublishedEntriesByIdsNotDeleted";
2
2
  import type { CmsEntryStorageOperations } from "../../../../types";
3
3
  import type { AccessControl } from "../../../AccessControl/AccessControl";
4
+ import type { ITransformEntryCallable } from "../../../../utils/entryStorage.js";
4
5
  interface GetPublishedEntriesByIdsUseCasesParams {
5
6
  operation: CmsEntryStorageOperations["getPublishedByIds"];
6
7
  accessControl: AccessControl;
8
+ transform: ITransformEntryCallable;
7
9
  }
8
10
  export declare const getPublishedEntriesByIdsUseCases: (params: GetPublishedEntriesByIdsUseCasesParams) => {
9
11
  getPublishedEntriesByIdsUseCase: GetPublishedEntriesByIdsNotDeleted;
@@ -8,7 +8,7 @@ var _GetPublishedEntriesByIds = require("./GetPublishedEntriesByIds");
8
8
  var _GetPublishedEntriesByIdsNotDeleted = require("./GetPublishedEntriesByIdsNotDeleted");
9
9
  var _GetPublishedEntriesByIdsSecure = require("./GetPublishedEntriesByIdsSecure");
10
10
  const getPublishedEntriesByIdsUseCases = params => {
11
- const getPublishedEntriesByIds = new _GetPublishedEntriesByIds.GetPublishedEntriesByIds(params.operation);
11
+ const getPublishedEntriesByIds = new _GetPublishedEntriesByIds.GetPublishedEntriesByIds(params.operation, params.transform);
12
12
  const getPublishedEntriesByIdsSecure = new _GetPublishedEntriesByIdsSecure.GetPublishedEntriesByIdsSecure(params.accessControl, getPublishedEntriesByIds);
13
13
  const getPublishedEntriesByIdsNotDeleted = new _GetPublishedEntriesByIdsNotDeleted.GetPublishedEntriesByIdsNotDeleted(getPublishedEntriesByIdsSecure);
14
14
  return {
@@ -1 +1 @@
1
- {"version":3,"names":["_GetPublishedEntriesByIds","require","_GetPublishedEntriesByIdsNotDeleted","_GetPublishedEntriesByIdsSecure","getPublishedEntriesByIdsUseCases","params","getPublishedEntriesByIds","GetPublishedEntriesByIds","operation","getPublishedEntriesByIdsSecure","GetPublishedEntriesByIdsSecure","accessControl","getPublishedEntriesByIdsNotDeleted","GetPublishedEntriesByIdsNotDeleted","getPublishedEntriesByIdsUseCase","exports"],"sources":["index.ts"],"sourcesContent":["import { GetPublishedEntriesByIds } from \"./GetPublishedEntriesByIds\";\nimport { GetPublishedEntriesByIdsNotDeleted } from \"./GetPublishedEntriesByIdsNotDeleted\";\nimport { GetPublishedEntriesByIdsSecure } from \"./GetPublishedEntriesByIdsSecure\";\nimport type { CmsEntryStorageOperations } from \"~/types\";\nimport type { AccessControl } from \"~/crud/AccessControl/AccessControl\";\n\ninterface GetPublishedEntriesByIdsUseCasesParams {\n operation: CmsEntryStorageOperations[\"getPublishedByIds\"];\n accessControl: AccessControl;\n}\n\nexport const getPublishedEntriesByIdsUseCases = (\n params: GetPublishedEntriesByIdsUseCasesParams\n) => {\n const getPublishedEntriesByIds = new GetPublishedEntriesByIds(params.operation);\n const getPublishedEntriesByIdsSecure = new GetPublishedEntriesByIdsSecure(\n params.accessControl,\n getPublishedEntriesByIds\n );\n const getPublishedEntriesByIdsNotDeleted = new GetPublishedEntriesByIdsNotDeleted(\n getPublishedEntriesByIdsSecure\n );\n\n return {\n getPublishedEntriesByIdsUseCase: getPublishedEntriesByIdsNotDeleted\n };\n};\n"],"mappings":";;;;;;AAAA,IAAAA,yBAAA,GAAAC,OAAA;AACA,IAAAC,mCAAA,GAAAD,OAAA;AACA,IAAAE,+BAAA,GAAAF,OAAA;AASO,MAAMG,gCAAgC,GACzCC,MAA8C,IAC7C;EACD,MAAMC,wBAAwB,GAAG,IAAIC,kDAAwB,CAACF,MAAM,CAACG,SAAS,CAAC;EAC/E,MAAMC,8BAA8B,GAAG,IAAIC,8DAA8B,CACrEL,MAAM,CAACM,aAAa,EACpBL,wBACJ,CAAC;EACD,MAAMM,kCAAkC,GAAG,IAAIC,sEAAkC,CAC7EJ,8BACJ,CAAC;EAED,OAAO;IACHK,+BAA+B,EAAEF;EACrC,CAAC;AACL,CAAC;AAACG,OAAA,CAAAX,gCAAA,GAAAA,gCAAA","ignoreList":[]}
1
+ {"version":3,"names":["_GetPublishedEntriesByIds","require","_GetPublishedEntriesByIdsNotDeleted","_GetPublishedEntriesByIdsSecure","getPublishedEntriesByIdsUseCases","params","getPublishedEntriesByIds","GetPublishedEntriesByIds","operation","transform","getPublishedEntriesByIdsSecure","GetPublishedEntriesByIdsSecure","accessControl","getPublishedEntriesByIdsNotDeleted","GetPublishedEntriesByIdsNotDeleted","getPublishedEntriesByIdsUseCase","exports"],"sources":["index.ts"],"sourcesContent":["import { GetPublishedEntriesByIds } from \"./GetPublishedEntriesByIds\";\nimport { GetPublishedEntriesByIdsNotDeleted } from \"./GetPublishedEntriesByIdsNotDeleted\";\nimport { GetPublishedEntriesByIdsSecure } from \"./GetPublishedEntriesByIdsSecure\";\nimport type { CmsEntryStorageOperations } from \"~/types\";\nimport type { AccessControl } from \"~/crud/AccessControl/AccessControl\";\nimport type { ITransformEntryCallable } from \"~/utils/entryStorage.js\";\n\ninterface GetPublishedEntriesByIdsUseCasesParams {\n operation: CmsEntryStorageOperations[\"getPublishedByIds\"];\n accessControl: AccessControl;\n transform: ITransformEntryCallable;\n}\n\nexport const getPublishedEntriesByIdsUseCases = (\n params: GetPublishedEntriesByIdsUseCasesParams\n) => {\n const getPublishedEntriesByIds = new GetPublishedEntriesByIds(\n params.operation,\n params.transform\n );\n const getPublishedEntriesByIdsSecure = new GetPublishedEntriesByIdsSecure(\n params.accessControl,\n getPublishedEntriesByIds\n );\n const getPublishedEntriesByIdsNotDeleted = new GetPublishedEntriesByIdsNotDeleted(\n getPublishedEntriesByIdsSecure\n );\n\n return {\n getPublishedEntriesByIdsUseCase: getPublishedEntriesByIdsNotDeleted\n };\n};\n"],"mappings":";;;;;;AAAA,IAAAA,yBAAA,GAAAC,OAAA;AACA,IAAAC,mCAAA,GAAAD,OAAA;AACA,IAAAE,+BAAA,GAAAF,OAAA;AAWO,MAAMG,gCAAgC,GACzCC,MAA8C,IAC7C;EACD,MAAMC,wBAAwB,GAAG,IAAIC,kDAAwB,CACzDF,MAAM,CAACG,SAAS,EAChBH,MAAM,CAACI,SACX,CAAC;EACD,MAAMC,8BAA8B,GAAG,IAAIC,8DAA8B,CACrEN,MAAM,CAACO,aAAa,EACpBN,wBACJ,CAAC;EACD,MAAMO,kCAAkC,GAAG,IAAIC,sEAAkC,CAC7EJ,8BACJ,CAAC;EAED,OAAO;IACHK,+BAA+B,EAAEF;EACrC,CAAC;AACL,CAAC;AAACG,OAAA,CAAAZ,gCAAA,GAAAA,gCAAA","ignoreList":[]}
@@ -1,7 +1,9 @@
1
1
  import type { IGetPublishedRevisionByEntryId } from "../../abstractions";
2
2
  import type { CmsEntryStorageOperations, CmsEntryStorageOperationsGetPublishedRevisionParams, CmsModel } from "../../../../types";
3
+ import type { ITransformEntryCallable } from "../../../../utils/entryStorage.js";
3
4
  export declare class GetPublishedRevisionByEntryId implements IGetPublishedRevisionByEntryId {
4
- private operation;
5
- constructor(operation: CmsEntryStorageOperations["getPublishedRevisionByEntryId"]);
6
- execute(model: CmsModel, params: CmsEntryStorageOperationsGetPublishedRevisionParams): Promise<import("../../../../types").CmsStorageEntry | null>;
5
+ private readonly operation;
6
+ private readonly transform;
7
+ constructor(operation: CmsEntryStorageOperations["getPublishedRevisionByEntryId"], transform: ITransformEntryCallable);
8
+ execute(model: CmsModel, params: CmsEntryStorageOperationsGetPublishedRevisionParams): Promise<import("../../../../types").CmsEntry<import("../../../../types").CmsEntryValues> | null>;
7
9
  }
@@ -5,11 +5,16 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.GetPublishedRevisionByEntryId = void 0;
7
7
  class GetPublishedRevisionByEntryId {
8
- constructor(operation) {
8
+ constructor(operation, transform) {
9
9
  this.operation = operation;
10
+ this.transform = transform;
10
11
  }
11
12
  async execute(model, params) {
12
- return await this.operation(model, params);
13
+ const entry = await this.operation(model, params);
14
+ if (!entry) {
15
+ return null;
16
+ }
17
+ return await this.transform(model, entry);
13
18
  }
14
19
  }
15
20
  exports.GetPublishedRevisionByEntryId = GetPublishedRevisionByEntryId;
@@ -1 +1 @@
1
- {"version":3,"names":["GetPublishedRevisionByEntryId","constructor","operation","execute","model","params","exports"],"sources":["GetPublishedRevisionByEntryId.ts"],"sourcesContent":["import type { IGetPublishedRevisionByEntryId } from \"../../abstractions\";\nimport type {\n CmsEntryStorageOperations,\n CmsEntryStorageOperationsGetPublishedRevisionParams,\n CmsModel\n} from \"~/types\";\n\nexport class GetPublishedRevisionByEntryId implements IGetPublishedRevisionByEntryId {\n private operation: CmsEntryStorageOperations[\"getPublishedRevisionByEntryId\"];\n\n constructor(operation: CmsEntryStorageOperations[\"getPublishedRevisionByEntryId\"]) {\n this.operation = operation;\n }\n\n async execute(model: CmsModel, params: CmsEntryStorageOperationsGetPublishedRevisionParams) {\n return await this.operation(model, params);\n }\n}\n"],"mappings":";;;;;;AAOO,MAAMA,6BAA6B,CAA2C;EAGjFC,WAAWA,CAACC,SAAqE,EAAE;IAC/E,IAAI,CAACA,SAAS,GAAGA,SAAS;EAC9B;EAEA,MAAMC,OAAOA,CAACC,KAAe,EAAEC,MAA2D,EAAE;IACxF,OAAO,MAAM,IAAI,CAACH,SAAS,CAACE,KAAK,EAAEC,MAAM,CAAC;EAC9C;AACJ;AAACC,OAAA,CAAAN,6BAAA,GAAAA,6BAAA","ignoreList":[]}
1
+ {"version":3,"names":["GetPublishedRevisionByEntryId","constructor","operation","transform","execute","model","params","entry","exports"],"sources":["GetPublishedRevisionByEntryId.ts"],"sourcesContent":["import type { IGetPublishedRevisionByEntryId } from \"../../abstractions\";\nimport type {\n CmsEntryStorageOperations,\n CmsEntryStorageOperationsGetPublishedRevisionParams,\n CmsModel\n} from \"~/types\";\nimport type { ITransformEntryCallable } from \"~/utils/entryStorage.js\";\n\nexport class GetPublishedRevisionByEntryId implements IGetPublishedRevisionByEntryId {\n private readonly operation: CmsEntryStorageOperations[\"getPublishedRevisionByEntryId\"];\n private readonly transform: ITransformEntryCallable;\n\n constructor(\n operation: CmsEntryStorageOperations[\"getPublishedRevisionByEntryId\"],\n transform: ITransformEntryCallable\n ) {\n this.operation = operation;\n this.transform = transform;\n }\n\n async execute(model: CmsModel, params: CmsEntryStorageOperationsGetPublishedRevisionParams) {\n const entry = await this.operation(model, params);\n\n if (!entry) {\n return null;\n }\n return await this.transform(model, entry);\n }\n}\n"],"mappings":";;;;;;AAQO,MAAMA,6BAA6B,CAA2C;EAIjFC,WAAWA,CACPC,SAAqE,EACrEC,SAAkC,EACpC;IACE,IAAI,CAACD,SAAS,GAAGA,SAAS;IAC1B,IAAI,CAACC,SAAS,GAAGA,SAAS;EAC9B;EAEA,MAAMC,OAAOA,CAACC,KAAe,EAAEC,MAA2D,EAAE;IACxF,MAAMC,KAAK,GAAG,MAAM,IAAI,CAACL,SAAS,CAACG,KAAK,EAAEC,MAAM,CAAC;IAEjD,IAAI,CAACC,KAAK,EAAE;MACR,OAAO,IAAI;IACf;IACA,OAAO,MAAM,IAAI,CAACJ,SAAS,CAACE,KAAK,EAAEE,KAAK,CAAC;EAC7C;AACJ;AAACC,OAAA,CAAAR,6BAAA,GAAAA,6BAAA","ignoreList":[]}
@@ -1,7 +1,9 @@
1
1
  import { GetPublishedRevisionByEntryIdNotDeleted } from "./GetPublishedRevisionByEntryIdNotDeleted";
2
2
  import type { CmsEntryStorageOperations } from "../../../../types";
3
+ import type { ITransformEntryCallable } from "../../../../utils/entryStorage.js";
3
4
  interface GetPublishedRevisionByEntryIdUseCasesParams {
4
5
  operation: CmsEntryStorageOperations["getPublishedRevisionByEntryId"];
6
+ transform: ITransformEntryCallable;
5
7
  }
6
8
  export declare const getPublishedRevisionByEntryIdUseCases: (params: GetPublishedRevisionByEntryIdUseCasesParams) => {
7
9
  getPublishedRevisionByEntryIdUseCase: GetPublishedRevisionByEntryIdNotDeleted;
@@ -7,7 +7,7 @@ exports.getPublishedRevisionByEntryIdUseCases = void 0;
7
7
  var _GetPublishedRevisionByEntryId = require("./GetPublishedRevisionByEntryId");
8
8
  var _GetPublishedRevisionByEntryIdNotDeleted = require("./GetPublishedRevisionByEntryIdNotDeleted");
9
9
  const getPublishedRevisionByEntryIdUseCases = params => {
10
- const getPublishedRevisionByEntryId = new _GetPublishedRevisionByEntryId.GetPublishedRevisionByEntryId(params.operation);
10
+ const getPublishedRevisionByEntryId = new _GetPublishedRevisionByEntryId.GetPublishedRevisionByEntryId(params.operation, params.transform);
11
11
  const getPublishedRevisionByEntryIdNotDeleted = new _GetPublishedRevisionByEntryIdNotDeleted.GetPublishedRevisionByEntryIdNotDeleted(getPublishedRevisionByEntryId);
12
12
  return {
13
13
  getPublishedRevisionByEntryIdUseCase: getPublishedRevisionByEntryIdNotDeleted
@@ -1 +1 @@
1
- {"version":3,"names":["_GetPublishedRevisionByEntryId","require","_GetPublishedRevisionByEntryIdNotDeleted","getPublishedRevisionByEntryIdUseCases","params","getPublishedRevisionByEntryId","GetPublishedRevisionByEntryId","operation","getPublishedRevisionByEntryIdNotDeleted","GetPublishedRevisionByEntryIdNotDeleted","getPublishedRevisionByEntryIdUseCase","exports"],"sources":["index.ts"],"sourcesContent":["import { GetPublishedRevisionByEntryId } from \"./GetPublishedRevisionByEntryId\";\nimport { GetPublishedRevisionByEntryIdNotDeleted } from \"./GetPublishedRevisionByEntryIdNotDeleted\";\nimport type { CmsEntryStorageOperations } from \"~/types\";\n\ninterface GetPublishedRevisionByEntryIdUseCasesParams {\n operation: CmsEntryStorageOperations[\"getPublishedRevisionByEntryId\"];\n}\n\nexport const getPublishedRevisionByEntryIdUseCases = (\n params: GetPublishedRevisionByEntryIdUseCasesParams\n) => {\n const getPublishedRevisionByEntryId = new GetPublishedRevisionByEntryId(params.operation);\n const getPublishedRevisionByEntryIdNotDeleted = new GetPublishedRevisionByEntryIdNotDeleted(\n getPublishedRevisionByEntryId\n );\n\n return {\n getPublishedRevisionByEntryIdUseCase: getPublishedRevisionByEntryIdNotDeleted\n };\n};\n"],"mappings":";;;;;;AAAA,IAAAA,8BAAA,GAAAC,OAAA;AACA,IAAAC,wCAAA,GAAAD,OAAA;AAOO,MAAME,qCAAqC,GAC9CC,MAAmD,IAClD;EACD,MAAMC,6BAA6B,GAAG,IAAIC,4DAA6B,CAACF,MAAM,CAACG,SAAS,CAAC;EACzF,MAAMC,uCAAuC,GAAG,IAAIC,gFAAuC,CACvFJ,6BACJ,CAAC;EAED,OAAO;IACHK,oCAAoC,EAAEF;EAC1C,CAAC;AACL,CAAC;AAACG,OAAA,CAAAR,qCAAA,GAAAA,qCAAA","ignoreList":[]}
1
+ {"version":3,"names":["_GetPublishedRevisionByEntryId","require","_GetPublishedRevisionByEntryIdNotDeleted","getPublishedRevisionByEntryIdUseCases","params","getPublishedRevisionByEntryId","GetPublishedRevisionByEntryId","operation","transform","getPublishedRevisionByEntryIdNotDeleted","GetPublishedRevisionByEntryIdNotDeleted","getPublishedRevisionByEntryIdUseCase","exports"],"sources":["index.ts"],"sourcesContent":["import { GetPublishedRevisionByEntryId } from \"./GetPublishedRevisionByEntryId\";\nimport { GetPublishedRevisionByEntryIdNotDeleted } from \"./GetPublishedRevisionByEntryIdNotDeleted\";\nimport type { CmsEntryStorageOperations } from \"~/types\";\nimport type { ITransformEntryCallable } from \"~/utils/entryStorage.js\";\n\ninterface GetPublishedRevisionByEntryIdUseCasesParams {\n operation: CmsEntryStorageOperations[\"getPublishedRevisionByEntryId\"];\n transform: ITransformEntryCallable;\n}\n\nexport const getPublishedRevisionByEntryIdUseCases = (\n params: GetPublishedRevisionByEntryIdUseCasesParams\n) => {\n const getPublishedRevisionByEntryId = new GetPublishedRevisionByEntryId(\n params.operation,\n params.transform\n );\n const getPublishedRevisionByEntryIdNotDeleted = new GetPublishedRevisionByEntryIdNotDeleted(\n getPublishedRevisionByEntryId\n );\n\n return {\n getPublishedRevisionByEntryIdUseCase: getPublishedRevisionByEntryIdNotDeleted\n };\n};\n"],"mappings":";;;;;;AAAA,IAAAA,8BAAA,GAAAC,OAAA;AACA,IAAAC,wCAAA,GAAAD,OAAA;AASO,MAAME,qCAAqC,GAC9CC,MAAmD,IAClD;EACD,MAAMC,6BAA6B,GAAG,IAAIC,4DAA6B,CACnEF,MAAM,CAACG,SAAS,EAChBH,MAAM,CAACI,SACX,CAAC;EACD,MAAMC,uCAAuC,GAAG,IAAIC,gFAAuC,CACvFL,6BACJ,CAAC;EAED,OAAO;IACHM,oCAAoC,EAAEF;EAC1C,CAAC;AACL,CAAC;AAACG,OAAA,CAAAT,qCAAA,GAAAA,qCAAA","ignoreList":[]}