@webiny/migrations 5.41.0-dbt.0 → 5.41.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/ddb-es.d.ts +2 -19
  2. package/ddb-es.js +5 -58
  3. package/ddb-es.js.map +1 -1
  4. package/ddb.d.ts +2 -19
  5. package/ddb.js +5 -42
  6. package/ddb.js.map +1 -1
  7. package/migrations/5.39.0/001/utils/getFallbackIdentity.d.ts +3 -1
  8. package/migrations/5.39.0/001/utils/getFallbackIdentity.js +13 -8
  9. package/migrations/5.39.0/001/utils/getFallbackIdentity.js.map +1 -1
  10. package/migrations/5.39.0/001/utils/getFirstLastPublishedOn.d.ts +2 -0
  11. package/migrations/5.39.0/001/utils/getFirstLastPublishedOn.js +9 -5
  12. package/migrations/5.39.0/001/utils/getFirstLastPublishedOn.js.map +1 -1
  13. package/migrations/5.39.0/001/utils/getOldestRevisionCreatedOn.d.ts +2 -0
  14. package/migrations/5.39.0/001/utils/getOldestRevisionCreatedOn.js +9 -5
  15. package/migrations/5.39.0/001/utils/getOldestRevisionCreatedOn.js.map +1 -1
  16. package/migrations/5.39.6/001/ddb-es/worker.js +301 -188
  17. package/migrations/5.39.6/001/ddb-es/worker.js.map +1 -1
  18. package/migrations/5.41.0/001/createTenantEntity.d.ts +42 -0
  19. package/migrations/5.41.0/001/createTenantEntity.js +46 -0
  20. package/migrations/5.41.0/001/createTenantEntity.js.map +1 -0
  21. package/migrations/5.41.0/001/createUserEntity.d.ts +48 -0
  22. package/migrations/5.41.0/001/createUserEntity.js +54 -0
  23. package/migrations/5.41.0/001/createUserEntity.js.map +1 -0
  24. package/migrations/5.41.0/001/index.d.ts +11 -0
  25. package/migrations/5.41.0/001/index.js +89 -0
  26. package/migrations/5.41.0/001/index.js.map +1 -0
  27. package/package.json +17 -17
  28. package/utils/elasticsearch/esGetIndexName.js +3 -2
  29. package/utils/elasticsearch/esGetIndexName.js.map +1 -1
package/ddb-es.d.ts CHANGED
@@ -1,19 +1,2 @@
1
- import { FileManager_5_35_0_001 } from "./migrations/5.35.0/001/ddb-es";
2
- import { PageBuilder_5_35_0_002 } from "./migrations/5.35.0/002";
3
- import { AdminUsers_5_35_0_003 } from "./migrations/5.35.0/003";
4
- import { Tenancy_5_35_0_004 } from "./migrations/5.35.0/004";
5
- import { CmsModels_5_35_0_005 } from "./migrations/5.35.0/005";
6
- import { AcoRecords_5_35_0_006 } from "./migrations/5.35.0/006/ddb-es";
7
- import { AcoRecords_5_36_0_001 } from "./migrations/5.36.0/001/ddb-es";
8
- import { TenantLinkRecords_5_37_0_001 } from "./migrations/5.37.0/001";
9
- import { CmsEntriesRootFolder_5_37_0_002 } from "./migrations/5.37.0/002/ddb-es";
10
- import { AcoFolders_5_37_0_003 } from "./migrations/5.37.0/003/ddb-es";
11
- import { AcoRecords_5_37_0_004 } from "./migrations/5.37.0/004/ddb-es";
12
- import { FileManager_5_37_0_005 } from "./migrations/5.37.0/005/ddb-es";
13
- import { MultiStepForms_5_38_0_001 } from "./migrations/5.38.0/001/ddb-es";
14
- import { MultiStepForms_5_38_0_002 } from "./migrations/5.38.0/002/ddb-es";
15
- import { PageBlocks_5_38_0_003 } from "./migrations/5.38.0/003/ddb";
16
- import { FileManager_5_39_0_002 } from "./migrations/5.39.0/002/ddb-es";
17
- import { CmsEntriesInitNewMetaFields_5_39_6_001 } from "./migrations/5.39.6/001/ddb-es";
18
- import { PbUniqueBlockElementIds_5_40_0_001 } from "./migrations/5.40.0/001/ddb";
19
- export declare const migrations: () => (typeof FileManager_5_35_0_001 | typeof PageBuilder_5_35_0_002 | typeof AdminUsers_5_35_0_003 | typeof Tenancy_5_35_0_004 | typeof CmsModels_5_35_0_005 | typeof AcoRecords_5_35_0_006 | typeof AcoRecords_5_36_0_001 | typeof TenantLinkRecords_5_37_0_001 | typeof CmsEntriesRootFolder_5_37_0_002 | typeof AcoFolders_5_37_0_003 | typeof AcoRecords_5_37_0_004 | typeof FileManager_5_37_0_005 | typeof MultiStepForms_5_38_0_001 | typeof MultiStepForms_5_38_0_002 | typeof PageBlocks_5_38_0_003 | typeof FileManager_5_39_0_002 | typeof CmsEntriesInitNewMetaFields_5_39_6_001 | typeof PbUniqueBlockElementIds_5_40_0_001)[];
1
+ import { AdminUsers_5_41_0_001 } from "./migrations/5.41.0/001";
2
+ export declare const migrations: () => (typeof AdminUsers_5_41_0_001)[];
package/ddb-es.js CHANGED
@@ -4,66 +4,13 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.migrations = void 0;
7
- var _ddbEs = require("./migrations/5.35.0/001/ddb-es");
8
- var _ = require("./migrations/5.35.0/002");
9
- var _2 = require("./migrations/5.35.0/003");
10
- var _3 = require("./migrations/5.35.0/004");
11
- var _4 = require("./migrations/5.35.0/005");
12
- var _ddbEs2 = require("./migrations/5.35.0/006/ddb-es");
13
- var _ddbEs3 = require("./migrations/5.36.0/001/ddb-es");
14
- var _5 = require("./migrations/5.37.0/001");
15
- var _ddbEs4 = require("./migrations/5.37.0/002/ddb-es");
16
- var _ddbEs5 = require("./migrations/5.37.0/003/ddb-es");
17
- var _ddbEs6 = require("./migrations/5.37.0/004/ddb-es");
18
- var _ddbEs7 = require("./migrations/5.37.0/005/ddb-es");
19
- var _ddbEs8 = require("./migrations/5.38.0/001/ddb-es");
20
- var _ddbEs9 = require("./migrations/5.38.0/002/ddb-es");
21
- var _ddb = require("./migrations/5.38.0/003/ddb");
22
- var _ddbEs10 = require("./migrations/5.39.0/002/ddb-es");
23
- var _ddbEs11 = require("./migrations/5.39.6/001/ddb-es");
24
- var _ddb2 = require("./migrations/5.40.0/001/ddb");
25
- // 5.35.0
26
-
27
- // 5.36.0
28
-
29
- // 5.37.0
30
-
31
- // 5.38.0
32
-
33
- // Page Blocks storage is the same for both DDB abd DDB-ES projects.
34
-
35
- // 5.39.0
36
- // Because of the 5.39.6-001 migration, this one is no longer needed.
37
- // import { CmsEntriesInitNewMetaFields_5_39_0_001 } from "~/migrations/5.39.0/001/ddb-es";
38
-
39
- // 5.39.2
40
- // Because of the 5.39.6-001 migration, this one is no longer needed.
41
- // import { CmsEntriesInitNewMetaFields_5_39_2_001 } from "~/migrations/5.39.2/001/ddb-es";
42
-
43
- // 5.39.6
7
+ var _ = require("./migrations/5.41.0/001");
8
+ // We only list current version migrations here. No need to have them all
9
+ // listed, as we only need the latest version migrations to be executed.
10
+ // This also helps with keeping the bundle size down / faster boot times.
44
11
 
45
12
  const migrations = () => {
46
- return [
47
- // 5.35.0
48
- _ddbEs.FileManager_5_35_0_001, _.PageBuilder_5_35_0_002, _2.AdminUsers_5_35_0_003, _3.Tenancy_5_35_0_004, _4.CmsModels_5_35_0_005, _ddbEs2.AcoRecords_5_35_0_006,
49
- // 5.36.0
50
- _ddbEs3.AcoRecords_5_36_0_001,
51
- // 5.37.0
52
- _5.TenantLinkRecords_5_37_0_001, _ddbEs4.CmsEntriesRootFolder_5_37_0_002, _ddbEs5.AcoFolders_5_37_0_003, _ddbEs6.AcoRecords_5_37_0_004, _ddbEs7.FileManager_5_37_0_005,
53
- // 5.38.0
54
- _ddbEs8.MultiStepForms_5_38_0_001, _ddbEs9.MultiStepForms_5_38_0_002, _ddb.PageBlocks_5_38_0_003,
55
- // 5.39.0
56
- // Because of the 5.39.6-001 migration, this one is no longer needed.
57
- // CmsEntriesInitNewMetaFields_5_39_0_001,
58
- _ddbEs10.FileManager_5_39_0_002,
59
- // 5.39.2
60
- // Because of the 5.39.6-001 migration, this one is no longer needed.
61
- // CmsEntriesInitNewMetaFields_5_39_2_001
62
-
63
- // 5.39.6
64
- _ddbEs11.CmsEntriesInitNewMetaFields_5_39_6_001,
65
- // 5.40.0
66
- _ddb2.PbUniqueBlockElementIds_5_40_0_001];
13
+ return [_.AdminUsers_5_41_0_001];
67
14
  };
68
15
  exports.migrations = migrations;
69
16
 
package/ddb-es.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["_ddbEs","require","_","_2","_3","_4","_ddbEs2","_ddbEs3","_5","_ddbEs4","_ddbEs5","_ddbEs6","_ddbEs7","_ddbEs8","_ddbEs9","_ddb","_ddbEs10","_ddbEs11","_ddb2","migrations","FileManager_5_35_0_001","PageBuilder_5_35_0_002","AdminUsers_5_35_0_003","Tenancy_5_35_0_004","CmsModels_5_35_0_005","AcoRecords_5_35_0_006","AcoRecords_5_36_0_001","TenantLinkRecords_5_37_0_001","CmsEntriesRootFolder_5_37_0_002","AcoFolders_5_37_0_003","AcoRecords_5_37_0_004","FileManager_5_37_0_005","MultiStepForms_5_38_0_001","MultiStepForms_5_38_0_002","PageBlocks_5_38_0_003","FileManager_5_39_0_002","CmsEntriesInitNewMetaFields_5_39_6_001","PbUniqueBlockElementIds_5_40_0_001","exports"],"sources":["ddb-es.ts"],"sourcesContent":["// 5.35.0\nimport { FileManager_5_35_0_001 } from \"./migrations/5.35.0/001/ddb-es\";\nimport { PageBuilder_5_35_0_002 } from \"~/migrations/5.35.0/002\";\nimport { AdminUsers_5_35_0_003 } from \"~/migrations/5.35.0/003\";\nimport { Tenancy_5_35_0_004 } from \"~/migrations/5.35.0/004\";\nimport { CmsModels_5_35_0_005 } from \"~/migrations/5.35.0/005\";\nimport { AcoRecords_5_35_0_006 } from \"~/migrations/5.35.0/006/ddb-es\";\n\n// 5.36.0\nimport { AcoRecords_5_36_0_001 } from \"~/migrations/5.36.0/001/ddb-es\";\n\n// 5.37.0\nimport { TenantLinkRecords_5_37_0_001 } from \"~/migrations/5.37.0/001\";\nimport { CmsEntriesRootFolder_5_37_0_002 } from \"~/migrations/5.37.0/002/ddb-es\";\nimport { AcoFolders_5_37_0_003 } from \"~/migrations/5.37.0/003/ddb-es\";\nimport { AcoRecords_5_37_0_004 } from \"~/migrations/5.37.0/004/ddb-es\";\nimport { FileManager_5_37_0_005 } from \"~/migrations/5.37.0/005/ddb-es\";\n\n// 5.38.0\nimport { MultiStepForms_5_38_0_001 } from \"~/migrations/5.38.0/001/ddb-es\";\nimport { MultiStepForms_5_38_0_002 } from \"~/migrations/5.38.0/002/ddb-es\";\n// Page Blocks storage is the same for both DDB abd DDB-ES projects.\nimport { PageBlocks_5_38_0_003 } from \"~/migrations/5.38.0/003/ddb\";\n\n// 5.39.0\n// Because of the 5.39.6-001 migration, this one is no longer needed.\n// import { CmsEntriesInitNewMetaFields_5_39_0_001 } from \"~/migrations/5.39.0/001/ddb-es\";\nimport { FileManager_5_39_0_002 } from \"~/migrations/5.39.0/002/ddb-es\";\n\n// 5.39.2\n// Because of the 5.39.6-001 migration, this one is no longer needed.\n// import { CmsEntriesInitNewMetaFields_5_39_2_001 } from \"~/migrations/5.39.2/001/ddb-es\";\n\n// 5.39.6\nimport { CmsEntriesInitNewMetaFields_5_39_6_001 } from \"~/migrations/5.39.6/001/ddb-es\";\n\nimport { PbUniqueBlockElementIds_5_40_0_001 } from \"~/migrations/5.40.0/001/ddb\";\n\nexport const migrations = () => {\n return [\n // 5.35.0\n FileManager_5_35_0_001,\n PageBuilder_5_35_0_002,\n AdminUsers_5_35_0_003,\n Tenancy_5_35_0_004,\n CmsModels_5_35_0_005,\n AcoRecords_5_35_0_006,\n\n // 5.36.0\n AcoRecords_5_36_0_001,\n\n // 5.37.0\n TenantLinkRecords_5_37_0_001,\n CmsEntriesRootFolder_5_37_0_002,\n AcoFolders_5_37_0_003,\n AcoRecords_5_37_0_004,\n FileManager_5_37_0_005,\n\n // 5.38.0\n MultiStepForms_5_38_0_001,\n MultiStepForms_5_38_0_002,\n PageBlocks_5_38_0_003,\n\n // 5.39.0\n // Because of the 5.39.6-001 migration, this one is no longer needed.\n // CmsEntriesInitNewMetaFields_5_39_0_001,\n FileManager_5_39_0_002,\n\n // 5.39.2\n // Because of the 5.39.6-001 migration, this one is no longer needed.\n // CmsEntriesInitNewMetaFields_5_39_2_001\n\n // 5.39.6\n CmsEntriesInitNewMetaFields_5_39_6_001,\n\n // 5.40.0\n PbUniqueBlockElementIds_5_40_0_001\n ];\n};\n"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,CAAA,GAAAD,OAAA;AACA,IAAAE,EAAA,GAAAF,OAAA;AACA,IAAAG,EAAA,GAAAH,OAAA;AACA,IAAAI,EAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AAGA,IAAAM,OAAA,GAAAN,OAAA;AAGA,IAAAO,EAAA,GAAAP,OAAA;AACA,IAAAQ,OAAA,GAAAR,OAAA;AACA,IAAAS,OAAA,GAAAT,OAAA;AACA,IAAAU,OAAA,GAAAV,OAAA;AACA,IAAAW,OAAA,GAAAX,OAAA;AAGA,IAAAY,OAAA,GAAAZ,OAAA;AACA,IAAAa,OAAA,GAAAb,OAAA;AAEA,IAAAc,IAAA,GAAAd,OAAA;AAKA,IAAAe,QAAA,GAAAf,OAAA;AAOA,IAAAgB,QAAA,GAAAhB,OAAA;AAEA,IAAAiB,KAAA,GAAAjB,OAAA;AApCA;;AAQA;;AAGA;;AAOA;;AAGA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;;AAEA;;AAKO,MAAMkB,UAAU,GAAGA,CAAA,KAAM;EAC5B,OAAO;EACH;EACAC,6BAAsB,EACtBC,wBAAsB,EACtBC,wBAAqB,EACrBC,qBAAkB,EAClBC,uBAAoB,EACpBC,6BAAqB;EAErB;EACAC,6BAAqB;EAErB;EACAC,+BAA4B,EAC5BC,uCAA+B,EAC/BC,6BAAqB,EACrBC,6BAAqB,EACrBC,8BAAsB;EAEtB;EACAC,iCAAyB,EACzBC,iCAAyB,EACzBC,0BAAqB;EAErB;EACA;EACA;EACAC,+BAAsB;EAEtB;EACA;EACA;;EAEA;EACAC,+CAAsC;EAEtC;EACAC,wCAAkC,CACrC;AACL,CAAC;AAACC,OAAA,CAAAnB,UAAA,GAAAA,UAAA","ignoreList":[]}
1
+ {"version":3,"names":["_","require","migrations","AdminUsers_5_41_0_001","exports"],"sources":["ddb-es.ts"],"sourcesContent":["// We only list current version migrations here. No need to have them all\n// listed, as we only need the latest version migrations to be executed.\n// This also helps with keeping the bundle size down / faster boot times.\nimport { AdminUsers_5_41_0_001 } from \"~/migrations/5.41.0/001\";\n\nexport const migrations = () => {\n return [AdminUsers_5_41_0_001];\n};\n"],"mappings":";;;;;;AAGA,IAAAA,CAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGO,MAAMC,UAAU,GAAGA,CAAA,KAAM;EAC5B,OAAO,CAACC,uBAAqB,CAAC;AAClC,CAAC;AAACC,OAAA,CAAAF,UAAA,GAAAA,UAAA","ignoreList":[]}
package/ddb.d.ts CHANGED
@@ -1,19 +1,2 @@
1
- import { FileManager_5_35_0_001 } from "./migrations/5.35.0/001/ddb";
2
- import { PageBuilder_5_35_0_002 } from "./migrations/5.35.0/002";
3
- import { AdminUsers_5_35_0_003 } from "./migrations/5.35.0/003";
4
- import { Tenancy_5_35_0_004 } from "./migrations/5.35.0/004";
5
- import { CmsModels_5_35_0_005 } from "./migrations/5.35.0/005";
6
- import { AcoRecords_5_35_0_006 } from "./migrations/5.35.0/006/ddb";
7
- import { AcoRecords_5_36_0_001 } from "./migrations/5.36.0/001/ddb";
8
- import { TenantLinkRecords_5_37_0_001 } from "./migrations/5.37.0/001";
9
- import { CmsEntriesRootFolder_5_37_0_002 } from "./migrations/5.37.0/002/ddb";
10
- import { AcoFolders_5_37_0_003 } from "./migrations/5.37.0/003/ddb";
11
- import { AcoRecords_5_37_0_004 } from "./migrations/5.37.0/004/ddb";
12
- import { FileManager_5_37_0_005 } from "./migrations/5.37.0/005/ddb";
13
- import { MultiStepForms_5_38_0_001 } from "./migrations/5.38.0/001/ddb";
14
- import { MultiStepForms_5_38_0_002 } from "./migrations/5.38.0/002/ddb";
15
- import { PageBlocks_5_38_0_003 } from "./migrations/5.38.0/003/ddb";
16
- import { CmsEntriesInitNewMetaFields_5_39_0_001 } from "./migrations/5.39.0/001/ddb";
17
- import { FileManager_5_39_0_002 } from "./migrations/5.39.0/002/ddb";
18
- import { PbUniqueBlockElementIds_5_40_0_001 } from "./migrations/5.40.0/001/ddb";
19
- export declare const migrations: () => (typeof PageBuilder_5_35_0_002 | typeof AdminUsers_5_35_0_003 | typeof Tenancy_5_35_0_004 | typeof CmsModels_5_35_0_005 | typeof TenantLinkRecords_5_37_0_001 | typeof PageBlocks_5_38_0_003 | typeof PbUniqueBlockElementIds_5_40_0_001 | typeof FileManager_5_35_0_001 | typeof AcoRecords_5_35_0_006 | typeof AcoRecords_5_36_0_001 | typeof CmsEntriesRootFolder_5_37_0_002 | typeof AcoFolders_5_37_0_003 | typeof AcoRecords_5_37_0_004 | typeof FileManager_5_37_0_005 | typeof MultiStepForms_5_38_0_001 | typeof MultiStepForms_5_38_0_002 | typeof CmsEntriesInitNewMetaFields_5_39_0_001 | typeof FileManager_5_39_0_002)[];
1
+ import { AdminUsers_5_41_0_001 } from "./migrations/5.41.0/001";
2
+ export declare const migrations: () => (typeof AdminUsers_5_41_0_001)[];
package/ddb.js CHANGED
@@ -4,50 +4,13 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.migrations = void 0;
7
- var _ddb = require("./migrations/5.35.0/001/ddb");
8
- var _ = require("./migrations/5.35.0/002");
9
- var _2 = require("./migrations/5.35.0/003");
10
- var _3 = require("./migrations/5.35.0/004");
11
- var _4 = require("./migrations/5.35.0/005");
12
- var _ddb2 = require("./migrations/5.35.0/006/ddb");
13
- var _ddb3 = require("./migrations/5.36.0/001/ddb");
14
- var _5 = require("./migrations/5.37.0/001");
15
- var _ddb4 = require("./migrations/5.37.0/002/ddb");
16
- var _ddb5 = require("./migrations/5.37.0/003/ddb");
17
- var _ddb6 = require("./migrations/5.37.0/004/ddb");
18
- var _ddb7 = require("./migrations/5.37.0/005/ddb");
19
- var _ddb8 = require("./migrations/5.38.0/001/ddb");
20
- var _ddb9 = require("./migrations/5.38.0/002/ddb");
21
- var _ddb10 = require("./migrations/5.38.0/003/ddb");
22
- var _ddb11 = require("./migrations/5.39.0/001/ddb");
23
- var _ddb12 = require("./migrations/5.39.0/002/ddb");
24
- var _ddb13 = require("./migrations/5.40.0/001/ddb");
25
- // 5.35.0
26
-
27
- // 5.36.0
28
-
29
- // 5.37.0
30
-
31
- // 5.38.0
32
-
33
- // 5.39.0
34
-
35
- // Page Blocks storage is the same for both DDB abd DDB-ES projects.
7
+ var _ = require("./migrations/5.41.0/001");
8
+ // We only list current version migrations here. No need to have them all
9
+ // listed, as we only need the latest version migrations to be executed.
10
+ // This also helps with keeping the bundle size down / faster boot times.
36
11
 
37
12
  const migrations = () => {
38
- return [
39
- // 5.35.0
40
- _ddb.FileManager_5_35_0_001, _.PageBuilder_5_35_0_002, _2.AdminUsers_5_35_0_003, _3.Tenancy_5_35_0_004, _4.CmsModels_5_35_0_005, _ddb2.AcoRecords_5_35_0_006,
41
- // 5.36.0
42
- _ddb3.AcoRecords_5_36_0_001,
43
- // 5.37.0
44
- _5.TenantLinkRecords_5_37_0_001, _ddb4.CmsEntriesRootFolder_5_37_0_002, _ddb5.AcoFolders_5_37_0_003, _ddb6.AcoRecords_5_37_0_004, _ddb7.FileManager_5_37_0_005,
45
- // 5.38.0
46
- _ddb8.MultiStepForms_5_38_0_001, _ddb9.MultiStepForms_5_38_0_002, _ddb10.PageBlocks_5_38_0_003,
47
- // 5.39.0
48
- _ddb11.CmsEntriesInitNewMetaFields_5_39_0_001, _ddb12.FileManager_5_39_0_002,
49
- // 5.40.0
50
- _ddb13.PbUniqueBlockElementIds_5_40_0_001];
13
+ return [_.AdminUsers_5_41_0_001];
51
14
  };
52
15
  exports.migrations = migrations;
53
16
 
package/ddb.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["_ddb","require","_","_2","_3","_4","_ddb2","_ddb3","_5","_ddb4","_ddb5","_ddb6","_ddb7","_ddb8","_ddb9","_ddb10","_ddb11","_ddb12","_ddb13","migrations","FileManager_5_35_0_001","PageBuilder_5_35_0_002","AdminUsers_5_35_0_003","Tenancy_5_35_0_004","CmsModels_5_35_0_005","AcoRecords_5_35_0_006","AcoRecords_5_36_0_001","TenantLinkRecords_5_37_0_001","CmsEntriesRootFolder_5_37_0_002","AcoFolders_5_37_0_003","AcoRecords_5_37_0_004","FileManager_5_37_0_005","MultiStepForms_5_38_0_001","MultiStepForms_5_38_0_002","PageBlocks_5_38_0_003","CmsEntriesInitNewMetaFields_5_39_0_001","FileManager_5_39_0_002","PbUniqueBlockElementIds_5_40_0_001","exports"],"sources":["ddb.ts"],"sourcesContent":["// 5.35.0\nimport { FileManager_5_35_0_001 } from \"./migrations/5.35.0/001/ddb\";\nimport { PageBuilder_5_35_0_002 } from \"~/migrations/5.35.0/002\";\nimport { AdminUsers_5_35_0_003 } from \"~/migrations/5.35.0/003\";\nimport { Tenancy_5_35_0_004 } from \"~/migrations/5.35.0/004\";\nimport { CmsModels_5_35_0_005 } from \"~/migrations/5.35.0/005\";\nimport { AcoRecords_5_35_0_006 } from \"~/migrations/5.35.0/006/ddb\";\n// 5.36.0\nimport { AcoRecords_5_36_0_001 } from \"~/migrations/5.36.0/001/ddb\";\n// 5.37.0\nimport { TenantLinkRecords_5_37_0_001 } from \"~/migrations/5.37.0/001\";\nimport { CmsEntriesRootFolder_5_37_0_002 } from \"~/migrations/5.37.0/002/ddb\";\nimport { AcoFolders_5_37_0_003 } from \"~/migrations/5.37.0/003/ddb\";\nimport { AcoRecords_5_37_0_004 } from \"~/migrations/5.37.0/004/ddb\";\nimport { FileManager_5_37_0_005 } from \"~/migrations/5.37.0/005/ddb\";\n// 5.38.0\nimport { MultiStepForms_5_38_0_001 } from \"~/migrations/5.38.0/001/ddb\";\nimport { MultiStepForms_5_38_0_002 } from \"~/migrations/5.38.0/002/ddb\";\nimport { PageBlocks_5_38_0_003 } from \"~/migrations/5.38.0/003/ddb\";\n// 5.39.0\nimport { CmsEntriesInitNewMetaFields_5_39_0_001 } from \"~/migrations/5.39.0/001/ddb\";\nimport { FileManager_5_39_0_002 } from \"~/migrations/5.39.0/002/ddb\";\n// Page Blocks storage is the same for both DDB abd DDB-ES projects.\nimport { PbUniqueBlockElementIds_5_40_0_001 } from \"~/migrations/5.40.0/001/ddb\";\n\nexport const migrations = () => {\n return [\n // 5.35.0\n FileManager_5_35_0_001,\n PageBuilder_5_35_0_002,\n AdminUsers_5_35_0_003,\n Tenancy_5_35_0_004,\n CmsModels_5_35_0_005,\n AcoRecords_5_35_0_006,\n // 5.36.0\n AcoRecords_5_36_0_001,\n // 5.37.0\n TenantLinkRecords_5_37_0_001,\n CmsEntriesRootFolder_5_37_0_002,\n AcoFolders_5_37_0_003,\n AcoRecords_5_37_0_004,\n FileManager_5_37_0_005,\n // 5.38.0\n MultiStepForms_5_38_0_001,\n MultiStepForms_5_38_0_002,\n PageBlocks_5_38_0_003,\n // 5.39.0\n CmsEntriesInitNewMetaFields_5_39_0_001,\n FileManager_5_39_0_002,\n // 5.40.0\n PbUniqueBlockElementIds_5_40_0_001\n ];\n};\n"],"mappings":";;;;;;AACA,IAAAA,IAAA,GAAAC,OAAA;AACA,IAAAC,CAAA,GAAAD,OAAA;AACA,IAAAE,EAAA,GAAAF,OAAA;AACA,IAAAG,EAAA,GAAAH,OAAA;AACA,IAAAI,EAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AAEA,IAAAM,KAAA,GAAAN,OAAA;AAEA,IAAAO,EAAA,GAAAP,OAAA;AACA,IAAAQ,KAAA,GAAAR,OAAA;AACA,IAAAS,KAAA,GAAAT,OAAA;AACA,IAAAU,KAAA,GAAAV,OAAA;AACA,IAAAW,KAAA,GAAAX,OAAA;AAEA,IAAAY,KAAA,GAAAZ,OAAA;AACA,IAAAa,KAAA,GAAAb,OAAA;AACA,IAAAc,MAAA,GAAAd,OAAA;AAEA,IAAAe,MAAA,GAAAf,OAAA;AACA,IAAAgB,MAAA,GAAAhB,OAAA;AAEA,IAAAiB,MAAA,GAAAjB,OAAA;AAvBA;;AAOA;;AAEA;;AAMA;;AAIA;;AAGA;;AAGO,MAAMkB,UAAU,GAAGA,CAAA,KAAM;EAC5B,OAAO;EACH;EACAC,2BAAsB,EACtBC,wBAAsB,EACtBC,wBAAqB,EACrBC,qBAAkB,EAClBC,uBAAoB,EACpBC,2BAAqB;EACrB;EACAC,2BAAqB;EACrB;EACAC,+BAA4B,EAC5BC,qCAA+B,EAC/BC,2BAAqB,EACrBC,2BAAqB,EACrBC,4BAAsB;EACtB;EACAC,+BAAyB,EACzBC,+BAAyB,EACzBC,4BAAqB;EACrB;EACAC,6CAAsC,EACtCC,6BAAsB;EACtB;EACAC,yCAAkC,CACrC;AACL,CAAC;AAACC,OAAA,CAAAnB,UAAA,GAAAA,UAAA","ignoreList":[]}
1
+ {"version":3,"names":["_","require","migrations","AdminUsers_5_41_0_001","exports"],"sources":["ddb.ts"],"sourcesContent":["// We only list current version migrations here. No need to have them all\n// listed, as we only need the latest version migrations to be executed.\n// This also helps with keeping the bundle size down / faster boot times.\nimport { AdminUsers_5_41_0_001 } from \"~/migrations/5.41.0/001\";\n\nexport const migrations = () => {\n return [AdminUsers_5_41_0_001];\n};\n"],"mappings":";;;;;;AAGA,IAAAA,CAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGO,MAAMC,UAAU,GAAGA,CAAA,KAAM;EAC5B,OAAO,CAACC,uBAAqB,CAAC;AAClC,CAAC;AAACC,OAAA,CAAAF,UAAA,GAAAA,UAAA","ignoreList":[]}
@@ -1,8 +1,10 @@
1
1
  import { CmsIdentity } from "@webiny/api-headless-cms/types";
2
2
  import { Entity } from "@webiny/db-dynamodb/toolbox";
3
+ import { ExecuteWithRetryOptions } from "@webiny/utils";
3
4
  interface GetFallbackIdentityParams {
4
5
  entity: Entity;
5
6
  tenant: string;
7
+ retryOptions?: ExecuteWithRetryOptions;
6
8
  }
7
- export declare const getFallbackIdentity: ({ entity, tenant }: GetFallbackIdentityParams) => Promise<CmsIdentity>;
9
+ export declare const getFallbackIdentity: ({ entity, tenant, retryOptions }: GetFallbackIdentityParams) => Promise<CmsIdentity>;
8
10
  export {};
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.getFallbackIdentity = void 0;
7
7
  var _dbDynamodb = require("@webiny/db-dynamodb");
8
+ var _utils = require("@webiny/utils");
8
9
  const NON_EXISTING_DATA_MIGRATION_IDENTITY = {
9
10
  id: "data-migration",
10
11
  type: "data-migration",
@@ -13,18 +14,22 @@ const NON_EXISTING_DATA_MIGRATION_IDENTITY = {
13
14
  const identitiesPerTenantCache = {};
14
15
  const getFallbackIdentity = async ({
15
16
  entity,
16
- tenant
17
+ tenant,
18
+ retryOptions
17
19
  }) => {
18
20
  if (identitiesPerTenantCache[tenant]) {
19
21
  return identitiesPerTenantCache[tenant];
20
22
  }
21
- const allAdminUsersRecords = await (0, _dbDynamodb.queryAll)({
22
- entity,
23
- partitionKey: `T#${tenant}#ADMIN_USERS`,
24
- options: {
25
- index: "GSI1"
26
- }
27
- });
23
+ const executeQueryAll = () => {
24
+ return (0, _dbDynamodb.queryAll)({
25
+ entity,
26
+ partitionKey: `T#${tenant}#ADMIN_USERS`,
27
+ options: {
28
+ index: "GSI1"
29
+ }
30
+ });
31
+ };
32
+ const allAdminUsersRecords = await (0, _utils.executeWithRetry)(executeQueryAll, retryOptions);
28
33
  if (allAdminUsersRecords.length === 0) {
29
34
  // Hopefully it doesn't come to this, but we still need to consider it.
30
35
  return NON_EXISTING_DATA_MIGRATION_IDENTITY;
@@ -1 +1 @@
1
- {"version":3,"names":["_dbDynamodb","require","NON_EXISTING_DATA_MIGRATION_IDENTITY","id","type","displayName","identitiesPerTenantCache","getFallbackIdentity","entity","tenant","allAdminUsersRecords","queryAll","partitionKey","options","index","length","oldestAdminUser","sort","prev","next","data","createdOn","exports"],"sources":["getFallbackIdentity.ts"],"sourcesContent":["import { CmsIdentity } from \"@webiny/api-headless-cms/types\";\nimport { queryAll } from \"@webiny/db-dynamodb\";\nimport { Entity } from \"@webiny/db-dynamodb/toolbox\";\n\nconst NON_EXISTING_DATA_MIGRATION_IDENTITY: CmsIdentity = {\n id: \"data-migration\",\n type: \"data-migration\",\n displayName: \"Data Migration\"\n};\n\ninterface GetFallbackIdentityParams {\n entity: Entity;\n tenant: string;\n}\n\ninterface AdminUserRecord {\n data: {\n createdOn: string;\n id: string;\n displayName: string;\n };\n}\n\nconst identitiesPerTenantCache: Record<string, CmsIdentity> = {};\n\nexport const getFallbackIdentity = async ({\n entity,\n tenant\n}: GetFallbackIdentityParams): Promise<CmsIdentity> => {\n if (identitiesPerTenantCache[tenant]) {\n return identitiesPerTenantCache[tenant];\n }\n\n const allAdminUsersRecords = await queryAll<AdminUserRecord>({\n entity,\n partitionKey: `T#${tenant}#ADMIN_USERS`,\n options: {\n index: \"GSI1\"\n }\n });\n\n if (allAdminUsersRecords.length === 0) {\n // Hopefully it doesn't come to this, but we still need to consider it.\n return NON_EXISTING_DATA_MIGRATION_IDENTITY;\n }\n\n const [oldestAdminUser] = allAdminUsersRecords.sort((prev, next) => {\n return prev.data.createdOn < next.data.createdOn ? -1 : 1;\n });\n\n identitiesPerTenantCache[tenant] = {\n id: oldestAdminUser.data.id,\n type: \"admin\",\n displayName: oldestAdminUser.data.displayName\n };\n\n return identitiesPerTenantCache[tenant];\n};\n"],"mappings":";;;;;;AACA,IAAAA,WAAA,GAAAC,OAAA;AAGA,MAAMC,oCAAiD,GAAG;EACtDC,EAAE,EAAE,gBAAgB;EACpBC,IAAI,EAAE,gBAAgB;EACtBC,WAAW,EAAE;AACjB,CAAC;AAeD,MAAMC,wBAAqD,GAAG,CAAC,CAAC;AAEzD,MAAMC,mBAAmB,GAAG,MAAAA,CAAO;EACtCC,MAAM;EACNC;AACuB,CAAC,KAA2B;EACnD,IAAIH,wBAAwB,CAACG,MAAM,CAAC,EAAE;IAClC,OAAOH,wBAAwB,CAACG,MAAM,CAAC;EAC3C;EAEA,MAAMC,oBAAoB,GAAG,MAAM,IAAAC,oBAAQ,EAAkB;IACzDH,MAAM;IACNI,YAAY,EAAG,KAAIH,MAAO,cAAa;IACvCI,OAAO,EAAE;MACLC,KAAK,EAAE;IACX;EACJ,CAAC,CAAC;EAEF,IAAIJ,oBAAoB,CAACK,MAAM,KAAK,CAAC,EAAE;IACnC;IACA,OAAOb,oCAAoC;EAC/C;EAEA,MAAM,CAACc,eAAe,CAAC,GAAGN,oBAAoB,CAACO,IAAI,CAAC,CAACC,IAAI,EAAEC,IAAI,KAAK;IAChE,OAAOD,IAAI,CAACE,IAAI,CAACC,SAAS,GAAGF,IAAI,CAACC,IAAI,CAACC,SAAS,GAAG,CAAC,CAAC,GAAG,CAAC;EAC7D,CAAC,CAAC;EAEFf,wBAAwB,CAACG,MAAM,CAAC,GAAG;IAC/BN,EAAE,EAAEa,eAAe,CAACI,IAAI,CAACjB,EAAE;IAC3BC,IAAI,EAAE,OAAO;IACbC,WAAW,EAAEW,eAAe,CAACI,IAAI,CAACf;EACtC,CAAC;EAED,OAAOC,wBAAwB,CAACG,MAAM,CAAC;AAC3C,CAAC;AAACa,OAAA,CAAAf,mBAAA,GAAAA,mBAAA","ignoreList":[]}
1
+ {"version":3,"names":["_dbDynamodb","require","_utils","NON_EXISTING_DATA_MIGRATION_IDENTITY","id","type","displayName","identitiesPerTenantCache","getFallbackIdentity","entity","tenant","retryOptions","executeQueryAll","queryAll","partitionKey","options","index","allAdminUsersRecords","executeWithRetry","length","oldestAdminUser","sort","prev","next","data","createdOn","exports"],"sources":["getFallbackIdentity.ts"],"sourcesContent":["import { CmsIdentity } from \"@webiny/api-headless-cms/types\";\nimport { queryAll } from \"@webiny/db-dynamodb\";\nimport { Entity } from \"@webiny/db-dynamodb/toolbox\";\nimport { executeWithRetry, ExecuteWithRetryOptions } from \"@webiny/utils\";\n\nconst NON_EXISTING_DATA_MIGRATION_IDENTITY: CmsIdentity = {\n id: \"data-migration\",\n type: \"data-migration\",\n displayName: \"Data Migration\"\n};\n\ninterface GetFallbackIdentityParams {\n entity: Entity;\n tenant: string;\n retryOptions?: ExecuteWithRetryOptions;\n}\n\ninterface AdminUserRecord {\n data: {\n createdOn: string;\n id: string;\n displayName: string;\n };\n}\n\nconst identitiesPerTenantCache: Record<string, CmsIdentity> = {};\n\nexport const getFallbackIdentity = async ({\n entity,\n tenant,\n retryOptions\n}: GetFallbackIdentityParams): Promise<CmsIdentity> => {\n if (identitiesPerTenantCache[tenant]) {\n return identitiesPerTenantCache[tenant];\n }\n\n const executeQueryAll = () => {\n return queryAll<AdminUserRecord>({\n entity,\n partitionKey: `T#${tenant}#ADMIN_USERS`,\n options: {\n index: \"GSI1\"\n }\n });\n };\n\n const allAdminUsersRecords = await executeWithRetry(executeQueryAll, retryOptions);\n\n if (allAdminUsersRecords.length === 0) {\n // Hopefully it doesn't come to this, but we still need to consider it.\n return NON_EXISTING_DATA_MIGRATION_IDENTITY;\n }\n\n const [oldestAdminUser] = allAdminUsersRecords.sort((prev, next) => {\n return prev.data.createdOn < next.data.createdOn ? -1 : 1;\n });\n\n identitiesPerTenantCache[tenant] = {\n id: oldestAdminUser.data.id,\n type: \"admin\",\n displayName: oldestAdminUser.data.displayName\n };\n\n return identitiesPerTenantCache[tenant];\n};\n"],"mappings":";;;;;;AACA,IAAAA,WAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AAEA,MAAME,oCAAiD,GAAG;EACtDC,EAAE,EAAE,gBAAgB;EACpBC,IAAI,EAAE,gBAAgB;EACtBC,WAAW,EAAE;AACjB,CAAC;AAgBD,MAAMC,wBAAqD,GAAG,CAAC,CAAC;AAEzD,MAAMC,mBAAmB,GAAG,MAAAA,CAAO;EACtCC,MAAM;EACNC,MAAM;EACNC;AACuB,CAAC,KAA2B;EACnD,IAAIJ,wBAAwB,CAACG,MAAM,CAAC,EAAE;IAClC,OAAOH,wBAAwB,CAACG,MAAM,CAAC;EAC3C;EAEA,MAAME,eAAe,GAAGA,CAAA,KAAM;IAC1B,OAAO,IAAAC,oBAAQ,EAAkB;MAC7BJ,MAAM;MACNK,YAAY,EAAG,KAAIJ,MAAO,cAAa;MACvCK,OAAO,EAAE;QACLC,KAAK,EAAE;MACX;IACJ,CAAC,CAAC;EACN,CAAC;EAED,MAAMC,oBAAoB,GAAG,MAAM,IAAAC,uBAAgB,EAACN,eAAe,EAAED,YAAY,CAAC;EAElF,IAAIM,oBAAoB,CAACE,MAAM,KAAK,CAAC,EAAE;IACnC;IACA,OAAOhB,oCAAoC;EAC/C;EAEA,MAAM,CAACiB,eAAe,CAAC,GAAGH,oBAAoB,CAACI,IAAI,CAAC,CAACC,IAAI,EAAEC,IAAI,KAAK;IAChE,OAAOD,IAAI,CAACE,IAAI,CAACC,SAAS,GAAGF,IAAI,CAACC,IAAI,CAACC,SAAS,GAAG,CAAC,CAAC,GAAG,CAAC;EAC7D,CAAC,CAAC;EAEFlB,wBAAwB,CAACG,MAAM,CAAC,GAAG;IAC/BN,EAAE,EAAEgB,eAAe,CAACI,IAAI,CAACpB,EAAE;IAC3BC,IAAI,EAAE,OAAO;IACbC,WAAW,EAAEc,eAAe,CAACI,IAAI,CAAClB;EACtC,CAAC;EAED,OAAOC,wBAAwB,CAACG,MAAM,CAAC;AAC3C,CAAC;AAACgB,OAAA,CAAAlB,mBAAA,GAAAA,mBAAA","ignoreList":[]}
@@ -1,11 +1,13 @@
1
1
  import { createDdbEntryEntity } from "./../entities/createEntryEntity";
2
2
  import { CmsEntry } from "../types";
3
+ import { ExecuteWithRetryOptions } from "@webiny/utils";
3
4
  interface CmsEntryWithPK extends CmsEntry {
4
5
  PK: string;
5
6
  }
6
7
  export interface getFirstLastPublishedOnParams {
7
8
  entry: CmsEntryWithPK;
8
9
  entryEntity: ReturnType<typeof createDdbEntryEntity>;
10
+ retryOptions?: ExecuteWithRetryOptions;
9
11
  }
10
12
  export declare const getFirstLastPublishedOnBy: (params: getFirstLastPublishedOnParams) => Promise<Pick<CmsEntry<import("../types").CmsEntryValues>, "firstPublishedOn" | "lastPublishedOn" | "firstPublishedBy" | "lastPublishedBy">>;
11
13
  export {};
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.getFirstLastPublishedOnBy = void 0;
7
+ var _utils = require("@webiny/utils");
7
8
  const cachedEntryFirstLastPublishedOnBy = {};
8
9
  const getFirstLastPublishedOnBy = async params => {
9
10
  const {
@@ -19,11 +20,14 @@ const getFirstLastPublishedOnBy = async params => {
19
20
  firstPublishedBy: null,
20
21
  lastPublishedBy: null
21
22
  };
22
- const result = await entryEntity.query(entry.PK, {
23
- limit: 1,
24
- eq: "P",
25
- attributes: ["modifiedBy", "createdBy", "publishedOn"]
26
- });
23
+ const executeQuery = () => {
24
+ return entryEntity.query(entry.PK, {
25
+ limit: 1,
26
+ eq: "P",
27
+ attributes: ["modifiedBy", "createdBy", "publishedOn"]
28
+ });
29
+ };
30
+ const result = await (0, _utils.executeWithRetry)(executeQuery, params.retryOptions);
27
31
  const publishedRecord = result.Items?.[0];
28
32
  if (publishedRecord) {
29
33
  cachedEntryFirstLastPublishedOnBy[entry.PK] = {
@@ -1 +1 @@
1
- {"version":3,"names":["cachedEntryFirstLastPublishedOnBy","getFirstLastPublishedOnBy","params","entry","entryEntity","PK","firstPublishedOn","lastPublishedOn","firstPublishedBy","lastPublishedBy","result","query","limit","eq","attributes","publishedRecord","Items","publishedOn","modifiedBy","createdBy","exports"],"sources":["getFirstLastPublishedOn.ts"],"sourcesContent":["import { createDdbEntryEntity } from \"./../entities/createEntryEntity\";\nimport { CmsEntry } from \"../types\";\n\nconst cachedEntryFirstLastPublishedOnBy: Record<\n string,\n Pick<CmsEntry, \"firstPublishedOn\" | \"lastPublishedOn\" | \"firstPublishedBy\" | \"lastPublishedBy\">\n> = {};\n\ninterface CmsEntryWithPK extends CmsEntry {\n PK: string;\n}\n\nexport interface getFirstLastPublishedOnParams {\n entry: CmsEntryWithPK;\n entryEntity: ReturnType<typeof createDdbEntryEntity>;\n}\n\nexport const getFirstLastPublishedOnBy = async (params: getFirstLastPublishedOnParams) => {\n const { entry, entryEntity } = params;\n\n if (cachedEntryFirstLastPublishedOnBy[entry.PK]) {\n return cachedEntryFirstLastPublishedOnBy[entry.PK];\n }\n\n cachedEntryFirstLastPublishedOnBy[entry.PK] = {\n firstPublishedOn: null,\n lastPublishedOn: null,\n firstPublishedBy: null,\n lastPublishedBy: null\n };\n\n const result = await entryEntity.query(entry.PK, {\n limit: 1,\n eq: \"P\",\n attributes: [\"modifiedBy\", \"createdBy\", \"publishedOn\"]\n });\n\n const publishedRecord = result.Items?.[0];\n if (publishedRecord) {\n cachedEntryFirstLastPublishedOnBy[entry.PK] = {\n firstPublishedOn: publishedRecord.publishedOn || null,\n lastPublishedOn: publishedRecord.publishedOn || null,\n firstPublishedBy: entry.modifiedBy || entry.createdBy || null,\n lastPublishedBy: entry.modifiedBy || entry.createdBy || null\n };\n }\n\n return cachedEntryFirstLastPublishedOnBy[entry.PK];\n};\n"],"mappings":";;;;;;AAGA,MAAMA,iCAGL,GAAG,CAAC,CAAC;AAWC,MAAMC,yBAAyB,GAAG,MAAOC,MAAqC,IAAK;EACtF,MAAM;IAAEC,KAAK;IAAEC;EAAY,CAAC,GAAGF,MAAM;EAErC,IAAIF,iCAAiC,CAACG,KAAK,CAACE,EAAE,CAAC,EAAE;IAC7C,OAAOL,iCAAiC,CAACG,KAAK,CAACE,EAAE,CAAC;EACtD;EAEAL,iCAAiC,CAACG,KAAK,CAACE,EAAE,CAAC,GAAG;IAC1CC,gBAAgB,EAAE,IAAI;IACtBC,eAAe,EAAE,IAAI;IACrBC,gBAAgB,EAAE,IAAI;IACtBC,eAAe,EAAE;EACrB,CAAC;EAED,MAAMC,MAAM,GAAG,MAAMN,WAAW,CAACO,KAAK,CAACR,KAAK,CAACE,EAAE,EAAE;IAC7CO,KAAK,EAAE,CAAC;IACRC,EAAE,EAAE,GAAG;IACPC,UAAU,EAAE,CAAC,YAAY,EAAE,WAAW,EAAE,aAAa;EACzD,CAAC,CAAC;EAEF,MAAMC,eAAe,GAAGL,MAAM,CAACM,KAAK,GAAG,CAAC,CAAC;EACzC,IAAID,eAAe,EAAE;IACjBf,iCAAiC,CAACG,KAAK,CAACE,EAAE,CAAC,GAAG;MAC1CC,gBAAgB,EAAES,eAAe,CAACE,WAAW,IAAI,IAAI;MACrDV,eAAe,EAAEQ,eAAe,CAACE,WAAW,IAAI,IAAI;MACpDT,gBAAgB,EAAEL,KAAK,CAACe,UAAU,IAAIf,KAAK,CAACgB,SAAS,IAAI,IAAI;MAC7DV,eAAe,EAAEN,KAAK,CAACe,UAAU,IAAIf,KAAK,CAACgB,SAAS,IAAI;IAC5D,CAAC;EACL;EAEA,OAAOnB,iCAAiC,CAACG,KAAK,CAACE,EAAE,CAAC;AACtD,CAAC;AAACe,OAAA,CAAAnB,yBAAA,GAAAA,yBAAA","ignoreList":[]}
1
+ {"version":3,"names":["_utils","require","cachedEntryFirstLastPublishedOnBy","getFirstLastPublishedOnBy","params","entry","entryEntity","PK","firstPublishedOn","lastPublishedOn","firstPublishedBy","lastPublishedBy","executeQuery","query","limit","eq","attributes","result","executeWithRetry","retryOptions","publishedRecord","Items","publishedOn","modifiedBy","createdBy","exports"],"sources":["getFirstLastPublishedOn.ts"],"sourcesContent":["import { createDdbEntryEntity } from \"./../entities/createEntryEntity\";\nimport { CmsEntry } from \"../types\";\nimport { executeWithRetry, ExecuteWithRetryOptions } from \"@webiny/utils\";\n\nconst cachedEntryFirstLastPublishedOnBy: Record<\n string,\n Pick<CmsEntry, \"firstPublishedOn\" | \"lastPublishedOn\" | \"firstPublishedBy\" | \"lastPublishedBy\">\n> = {};\n\ninterface CmsEntryWithPK extends CmsEntry {\n PK: string;\n}\n\nexport interface getFirstLastPublishedOnParams {\n entry: CmsEntryWithPK;\n entryEntity: ReturnType<typeof createDdbEntryEntity>;\n retryOptions?: ExecuteWithRetryOptions;\n}\n\nexport const getFirstLastPublishedOnBy = async (params: getFirstLastPublishedOnParams) => {\n const { entry, entryEntity } = params;\n\n if (cachedEntryFirstLastPublishedOnBy[entry.PK]) {\n return cachedEntryFirstLastPublishedOnBy[entry.PK];\n }\n\n cachedEntryFirstLastPublishedOnBy[entry.PK] = {\n firstPublishedOn: null,\n lastPublishedOn: null,\n firstPublishedBy: null,\n lastPublishedBy: null\n };\n\n const executeQuery = () => {\n return entryEntity.query(entry.PK, {\n limit: 1,\n eq: \"P\",\n attributes: [\"modifiedBy\", \"createdBy\", \"publishedOn\"]\n });\n };\n\n const result = await executeWithRetry(executeQuery, params.retryOptions);\n\n const publishedRecord = result.Items?.[0];\n if (publishedRecord) {\n cachedEntryFirstLastPublishedOnBy[entry.PK] = {\n firstPublishedOn: publishedRecord.publishedOn || null,\n lastPublishedOn: publishedRecord.publishedOn || null,\n firstPublishedBy: entry.modifiedBy || entry.createdBy || null,\n lastPublishedBy: entry.modifiedBy || entry.createdBy || null\n };\n }\n\n return cachedEntryFirstLastPublishedOnBy[entry.PK];\n};\n"],"mappings":";;;;;;AAEA,IAAAA,MAAA,GAAAC,OAAA;AAEA,MAAMC,iCAGL,GAAG,CAAC,CAAC;AAYC,MAAMC,yBAAyB,GAAG,MAAOC,MAAqC,IAAK;EACtF,MAAM;IAAEC,KAAK;IAAEC;EAAY,CAAC,GAAGF,MAAM;EAErC,IAAIF,iCAAiC,CAACG,KAAK,CAACE,EAAE,CAAC,EAAE;IAC7C,OAAOL,iCAAiC,CAACG,KAAK,CAACE,EAAE,CAAC;EACtD;EAEAL,iCAAiC,CAACG,KAAK,CAACE,EAAE,CAAC,GAAG;IAC1CC,gBAAgB,EAAE,IAAI;IACtBC,eAAe,EAAE,IAAI;IACrBC,gBAAgB,EAAE,IAAI;IACtBC,eAAe,EAAE;EACrB,CAAC;EAED,MAAMC,YAAY,GAAGA,CAAA,KAAM;IACvB,OAAON,WAAW,CAACO,KAAK,CAACR,KAAK,CAACE,EAAE,EAAE;MAC/BO,KAAK,EAAE,CAAC;MACRC,EAAE,EAAE,GAAG;MACPC,UAAU,EAAE,CAAC,YAAY,EAAE,WAAW,EAAE,aAAa;IACzD,CAAC,CAAC;EACN,CAAC;EAED,MAAMC,MAAM,GAAG,MAAM,IAAAC,uBAAgB,EAACN,YAAY,EAAER,MAAM,CAACe,YAAY,CAAC;EAExE,MAAMC,eAAe,GAAGH,MAAM,CAACI,KAAK,GAAG,CAAC,CAAC;EACzC,IAAID,eAAe,EAAE;IACjBlB,iCAAiC,CAACG,KAAK,CAACE,EAAE,CAAC,GAAG;MAC1CC,gBAAgB,EAAEY,eAAe,CAACE,WAAW,IAAI,IAAI;MACrDb,eAAe,EAAEW,eAAe,CAACE,WAAW,IAAI,IAAI;MACpDZ,gBAAgB,EAAEL,KAAK,CAACkB,UAAU,IAAIlB,KAAK,CAACmB,SAAS,IAAI,IAAI;MAC7Db,eAAe,EAAEN,KAAK,CAACkB,UAAU,IAAIlB,KAAK,CAACmB,SAAS,IAAI;IAC5D,CAAC;EACL;EAEA,OAAOtB,iCAAiC,CAACG,KAAK,CAACE,EAAE,CAAC;AACtD,CAAC;AAACkB,OAAA,CAAAtB,yBAAA,GAAAA,yBAAA","ignoreList":[]}
@@ -1,11 +1,13 @@
1
1
  import { createDdbEntryEntity } from "./../entities/createEntryEntity";
2
2
  import { CmsEntry } from "../types";
3
+ import { ExecuteWithRetryOptions } from "@webiny/utils";
3
4
  interface CmsEntryWithPK extends CmsEntry {
4
5
  PK: string;
5
6
  }
6
7
  export interface GetOldestRevisionCreatedOnParams {
7
8
  entry: CmsEntryWithPK;
8
9
  entryEntity: ReturnType<typeof createDdbEntryEntity>;
10
+ retryOptions?: ExecuteWithRetryOptions;
9
11
  }
10
12
  export declare const getOldestRevisionCreatedOn: (params: GetOldestRevisionCreatedOnParams) => Promise<string>;
11
13
  export {};
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.getOldestRevisionCreatedOn = void 0;
7
+ var _utils = require("@webiny/utils");
7
8
  const cachedEntryCreatedOn = {};
8
9
  const getOldestRevisionCreatedOn = async params => {
9
10
  const {
@@ -16,11 +17,14 @@ const getOldestRevisionCreatedOn = async params => {
16
17
  if (entry.version === 1) {
17
18
  cachedEntryCreatedOn[entry.PK] = entry.createdOn;
18
19
  } else {
19
- const result = await entryEntity.query(entry.PK, {
20
- limit: 1,
21
- beginsWith: "REV#",
22
- attributes: ["createdOn"]
23
- });
20
+ const executeQuery = () => {
21
+ return entryEntity.query(entry.PK, {
22
+ limit: 1,
23
+ beginsWith: "REV#",
24
+ attributes: ["createdOn"]
25
+ });
26
+ };
27
+ const result = await (0, _utils.executeWithRetry)(executeQuery, params.retryOptions);
24
28
  const oldestRevision = result.Items?.[0];
25
29
  if (oldestRevision) {
26
30
  cachedEntryCreatedOn[entry.PK] = oldestRevision.createdOn;
@@ -1 +1 @@
1
- {"version":3,"names":["cachedEntryCreatedOn","getOldestRevisionCreatedOn","params","entry","entryEntity","PK","version","createdOn","result","query","limit","beginsWith","attributes","oldestRevision","Items","exports"],"sources":["getOldestRevisionCreatedOn.ts"],"sourcesContent":["import { createDdbEntryEntity } from \"./../entities/createEntryEntity\";\nimport { CmsEntry } from \"../types\";\n\nconst cachedEntryCreatedOn: Record<string, string> = {};\n\ninterface CmsEntryWithPK extends CmsEntry {\n PK: string;\n}\n\nexport interface GetOldestRevisionCreatedOnParams {\n entry: CmsEntryWithPK;\n entryEntity: ReturnType<typeof createDdbEntryEntity>;\n}\n\nexport const getOldestRevisionCreatedOn = async (params: GetOldestRevisionCreatedOnParams) => {\n const { entry, entryEntity } = params;\n\n if (cachedEntryCreatedOn[entry.PK]) {\n return cachedEntryCreatedOn[entry.PK];\n }\n\n if (entry.version === 1) {\n cachedEntryCreatedOn[entry.PK] = entry.createdOn;\n } else {\n const result = await entryEntity.query(entry.PK, {\n limit: 1,\n beginsWith: \"REV#\",\n attributes: [\"createdOn\"]\n });\n\n const oldestRevision = result.Items?.[0];\n if (oldestRevision) {\n cachedEntryCreatedOn[entry.PK] = oldestRevision.createdOn;\n }\n }\n\n return cachedEntryCreatedOn[entry.PK];\n};\n"],"mappings":";;;;;;AAGA,MAAMA,oBAA4C,GAAG,CAAC,CAAC;AAWhD,MAAMC,0BAA0B,GAAG,MAAOC,MAAwC,IAAK;EAC1F,MAAM;IAAEC,KAAK;IAAEC;EAAY,CAAC,GAAGF,MAAM;EAErC,IAAIF,oBAAoB,CAACG,KAAK,CAACE,EAAE,CAAC,EAAE;IAChC,OAAOL,oBAAoB,CAACG,KAAK,CAACE,EAAE,CAAC;EACzC;EAEA,IAAIF,KAAK,CAACG,OAAO,KAAK,CAAC,EAAE;IACrBN,oBAAoB,CAACG,KAAK,CAACE,EAAE,CAAC,GAAGF,KAAK,CAACI,SAAS;EACpD,CAAC,MAAM;IACH,MAAMC,MAAM,GAAG,MAAMJ,WAAW,CAACK,KAAK,CAACN,KAAK,CAACE,EAAE,EAAE;MAC7CK,KAAK,EAAE,CAAC;MACRC,UAAU,EAAE,MAAM;MAClBC,UAAU,EAAE,CAAC,WAAW;IAC5B,CAAC,CAAC;IAEF,MAAMC,cAAc,GAAGL,MAAM,CAACM,KAAK,GAAG,CAAC,CAAC;IACxC,IAAID,cAAc,EAAE;MAChBb,oBAAoB,CAACG,KAAK,CAACE,EAAE,CAAC,GAAGQ,cAAc,CAACN,SAAS;IAC7D;EACJ;EAEA,OAAOP,oBAAoB,CAACG,KAAK,CAACE,EAAE,CAAC;AACzC,CAAC;AAACU,OAAA,CAAAd,0BAAA,GAAAA,0BAAA","ignoreList":[]}
1
+ {"version":3,"names":["_utils","require","cachedEntryCreatedOn","getOldestRevisionCreatedOn","params","entry","entryEntity","PK","version","createdOn","executeQuery","query","limit","beginsWith","attributes","result","executeWithRetry","retryOptions","oldestRevision","Items","exports"],"sources":["getOldestRevisionCreatedOn.ts"],"sourcesContent":["import { createDdbEntryEntity } from \"./../entities/createEntryEntity\";\nimport { CmsEntry } from \"../types\";\nimport { executeWithRetry, ExecuteWithRetryOptions } from \"@webiny/utils\";\n\nconst cachedEntryCreatedOn: Record<string, string> = {};\n\ninterface CmsEntryWithPK extends CmsEntry {\n PK: string;\n}\n\nexport interface GetOldestRevisionCreatedOnParams {\n entry: CmsEntryWithPK;\n entryEntity: ReturnType<typeof createDdbEntryEntity>;\n retryOptions?: ExecuteWithRetryOptions;\n}\n\nexport const getOldestRevisionCreatedOn = async (params: GetOldestRevisionCreatedOnParams) => {\n const { entry, entryEntity } = params;\n\n if (cachedEntryCreatedOn[entry.PK]) {\n return cachedEntryCreatedOn[entry.PK];\n }\n\n if (entry.version === 1) {\n cachedEntryCreatedOn[entry.PK] = entry.createdOn;\n } else {\n const executeQuery = () => {\n return entryEntity.query(entry.PK, {\n limit: 1,\n beginsWith: \"REV#\",\n attributes: [\"createdOn\"]\n });\n };\n\n const result = await executeWithRetry(executeQuery, params.retryOptions);\n\n const oldestRevision = result.Items?.[0];\n if (oldestRevision) {\n cachedEntryCreatedOn[entry.PK] = oldestRevision.createdOn;\n }\n }\n\n return cachedEntryCreatedOn[entry.PK];\n};\n"],"mappings":";;;;;;AAEA,IAAAA,MAAA,GAAAC,OAAA;AAEA,MAAMC,oBAA4C,GAAG,CAAC,CAAC;AAYhD,MAAMC,0BAA0B,GAAG,MAAOC,MAAwC,IAAK;EAC1F,MAAM;IAAEC,KAAK;IAAEC;EAAY,CAAC,GAAGF,MAAM;EAErC,IAAIF,oBAAoB,CAACG,KAAK,CAACE,EAAE,CAAC,EAAE;IAChC,OAAOL,oBAAoB,CAACG,KAAK,CAACE,EAAE,CAAC;EACzC;EAEA,IAAIF,KAAK,CAACG,OAAO,KAAK,CAAC,EAAE;IACrBN,oBAAoB,CAACG,KAAK,CAACE,EAAE,CAAC,GAAGF,KAAK,CAACI,SAAS;EACpD,CAAC,MAAM;IACH,MAAMC,YAAY,GAAGA,CAAA,KAAM;MACvB,OAAOJ,WAAW,CAACK,KAAK,CAACN,KAAK,CAACE,EAAE,EAAE;QAC/BK,KAAK,EAAE,CAAC;QACRC,UAAU,EAAE,MAAM;QAClBC,UAAU,EAAE,CAAC,WAAW;MAC5B,CAAC,CAAC;IACN,CAAC;IAED,MAAMC,MAAM,GAAG,MAAM,IAAAC,uBAAgB,EAACN,YAAY,EAAEN,MAAM,CAACa,YAAY,CAAC;IAExE,MAAMC,cAAc,GAAGH,MAAM,CAACI,KAAK,GAAG,CAAC,CAAC;IACxC,IAAID,cAAc,EAAE;MAChBhB,oBAAoB,CAACG,KAAK,CAACE,EAAE,CAAC,GAAGW,cAAc,CAACT,SAAS;IAC7D;EACJ;EAEA,OAAOP,oBAAoB,CAACG,KAAK,CAACE,EAAE,CAAC;AACzC,CAAC;AAACa,OAAA,CAAAjB,0BAAA,GAAAA,0BAAA","ignoreList":[]}