@payloadcms/db-postgres 0.7.0 → 3.0.0-alpha.19

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. package/dist/connect.d.ts.map +1 -1
  2. package/dist/connect.js +30 -40
  3. package/dist/create.js +6 -21
  4. package/dist/createGlobal.js +6 -21
  5. package/dist/createGlobalVersion.js +10 -25
  6. package/dist/createMigration.js +11 -26
  7. package/dist/createVersion.js +10 -25
  8. package/dist/deleteMany.js +8 -23
  9. package/dist/deleteOne.js +10 -25
  10. package/dist/deleteVersions.js +10 -25
  11. package/dist/destroy.js +2 -12
  12. package/dist/find/buildFindManyArgs.js +6 -14
  13. package/dist/find/chainMethods.js +2 -11
  14. package/dist/find/findMany.js +14 -29
  15. package/dist/find/traverseFields.js +8 -23
  16. package/dist/find.js +6 -21
  17. package/dist/findGlobal.js +6 -21
  18. package/dist/findGlobalVersions.js +8 -23
  19. package/dist/findOne.js +6 -21
  20. package/dist/findVersions.js +8 -23
  21. package/dist/index.d.ts +3 -2
  22. package/dist/index.d.ts.map +1 -1
  23. package/dist/index.js +76 -88
  24. package/dist/init.js +17 -32
  25. package/dist/migrate.d.ts.map +1 -1
  26. package/dist/migrate.js +15 -33
  27. package/dist/migrateDown.d.ts.map +1 -1
  28. package/dist/migrateDown.js +12 -25
  29. package/dist/migrateFresh.d.ts.map +1 -1
  30. package/dist/migrateFresh.js +15 -31
  31. package/dist/migrateRefresh.d.ts.map +1 -1
  32. package/dist/migrateRefresh.js +18 -29
  33. package/dist/migrateReset.d.ts.map +1 -1
  34. package/dist/migrateReset.js +13 -24
  35. package/dist/migrateStatus.js +9 -19
  36. package/dist/queries/buildAndOrConditions.js +4 -14
  37. package/dist/queries/buildQuery.js +10 -20
  38. package/dist/queries/createJSONQuery/convertPathToJSONTraversal.js +4 -14
  39. package/dist/queries/createJSONQuery/formatJSONPathSegment.js +2 -12
  40. package/dist/queries/createJSONQuery/index.js +6 -16
  41. package/dist/queries/getTableColumnFromPath.js +38 -49
  42. package/dist/queries/operatorMap.js +17 -27
  43. package/dist/queries/parseParams.js +32 -42
  44. package/dist/queries/sanitizeQueryValue.js +8 -18
  45. package/dist/queryDrafts.js +10 -25
  46. package/dist/schema/build.js +49 -64
  47. package/dist/schema/createIndex.js +5 -15
  48. package/dist/schema/idToUUID.js +2 -12
  49. package/dist/schema/parentIDColumnMap.js +7 -17
  50. package/dist/schema/setColumnID.js +10 -20
  51. package/dist/schema/traverseFields.js +62 -77
  52. package/dist/schema/validateExistingBlockIsIdentical.js +9 -19
  53. package/dist/transactions/beginTransaction.js +4 -14
  54. package/dist/transactions/commitTransaction.js +2 -12
  55. package/dist/transactions/rollbackTransaction.js +2 -12
  56. package/dist/transform/read/hasManyNumber.js +2 -12
  57. package/dist/transform/read/hasManyText.js +2 -12
  58. package/dist/transform/read/index.js +12 -20
  59. package/dist/transform/read/relationship.js +2 -12
  60. package/dist/transform/read/traverseFields.js +15 -23
  61. package/dist/transform/write/array.js +6 -16
  62. package/dist/transform/write/blocks.js +6 -21
  63. package/dist/transform/write/index.js +4 -14
  64. package/dist/transform/write/numbers.js +2 -12
  65. package/dist/transform/write/relationships.js +4 -14
  66. package/dist/transform/write/selects.js +4 -14
  67. package/dist/transform/write/texts.js +2 -12
  68. package/dist/transform/write/traverseFields.js +30 -45
  69. package/dist/transform/write/types.js +2 -5
  70. package/dist/types.js +2 -5
  71. package/dist/update.js +11 -26
  72. package/dist/updateGlobal.js +6 -21
  73. package/dist/updateGlobalVersion.js +10 -25
  74. package/dist/updateVersion.js +10 -25
  75. package/dist/upsertRow/deleteExistingArrayRows.js +5 -15
  76. package/dist/upsertRow/deleteExistingRowsByPath.js +9 -19
  77. package/dist/upsertRow/index.d.ts.map +1 -1
  78. package/dist/upsertRow/index.js +25 -36
  79. package/dist/upsertRow/insertArrays.js +2 -12
  80. package/dist/upsertRow/types.js +2 -5
  81. package/dist/utilities/appendPrefixToKeys.js +2 -12
  82. package/dist/utilities/createBlocksMap.js +2 -12
  83. package/dist/utilities/createMigrationTable.js +4 -14
  84. package/dist/utilities/createRelationshipMap.js +2 -12
  85. package/dist/utilities/hasLocalesTable.js +5 -15
  86. package/dist/utilities/isArrayOfRows.js +2 -12
  87. package/dist/utilities/migrationTableExists.js +4 -14
  88. package/dist/utilities/parseError.js +6 -14
  89. package/package.json +6 -6
@@ -1,28 +1,18 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "migrateStatus", {
6
- enumerable: true,
7
- get: function() {
8
- return migrateStatus;
9
- }
10
- });
11
- const _consoletableprinter = require("console-table-printer");
12
- const _database = require("payload/database");
13
- const _migrationTableExists = require("./utilities/migrationTableExists");
14
- async function migrateStatus() {
1
+ import { Table } from 'console-table-printer';
2
+ import { getMigrations, readMigrationFiles } from 'payload/database';
3
+ import { migrationTableExists } from './utilities/migrationTableExists';
4
+ export async function migrateStatus() {
15
5
  const { payload } = this;
16
- const migrationFiles = await (0, _database.readMigrationFiles)({
6
+ const migrationFiles = await readMigrationFiles({
17
7
  payload
18
8
  });
19
9
  payload.logger.debug({
20
10
  msg: `Found ${migrationFiles.length} migration files.`
21
11
  });
22
12
  let existingMigrations = [];
23
- const hasMigrationTable = await (0, _migrationTableExists.migrationTableExists)(this.drizzle);
13
+ const hasMigrationTable = await migrationTableExists(this.drizzle);
24
14
  if (hasMigrationTable) {
25
- ({ existingMigrations } = await (0, _database.getMigrations)({
15
+ ({ existingMigrations } = await getMigrations({
26
16
  payload
27
17
  }));
28
18
  }
@@ -42,7 +32,7 @@ async function migrateStatus() {
42
32
  Ran: existingMigration ? 'Yes' : 'No'
43
33
  };
44
34
  });
45
- const p = new _consoletableprinter.Table();
35
+ const p = new Table();
46
36
  statuses.forEach((s)=>{
47
37
  p.addRow(s, {
48
38
  color: s.Ran === 'Yes' ? 'green' : 'red'
@@ -51,4 +41,4 @@ async function migrateStatus() {
51
41
  p.printTable();
52
42
  }
53
43
 
54
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9u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- enumerable: true,
7
- get: function() {
8
- return buildAndOrConditions;
9
- }
10
- });
11
- const _parseParams = require("./parseParams");
12
- async function buildAndOrConditions({ adapter, fields, joinAliases, joins, locale, selectFields, tableName, where }) {
1
+ import { parseParams } from './parseParams';
2
+ export async function buildAndOrConditions({ adapter, fields, joinAliases, joins, locale, selectFields, tableName, where }) {
13
3
  const completedConditions = [];
14
4
  // Loop over all AND / OR operations and add them to the AND / OR query param
15
5
  // Operations should come through as an array
@@ -18,7 +8,7 @@ async function buildAndOrConditions({ adapter, fields, joinAliases, joins, local
18
8
  // If the operation is properly formatted as an object
19
9
  if (typeof condition === 'object') {
20
10
  // eslint-disable-next-line no-await-in-loop
21
- const result = await (0, _parseParams.parseParams)({
11
+ const result = await parseParams({
22
12
  adapter,
23
13
  fields,
24
14
  joinAliases,
@@ -36,4 +26,4 @@ async function buildAndOrConditions({ adapter, fields, joinAliases, joins, local
36
26
  return completedConditions;
37
27
  }
38
28
 
39
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9xdWVyaWVzL2J1aWxkQW5kT3JDb25kaXRpb25zLnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB0eXBlIHsgU1FMIH0gZnJvbSAnZHJpenpsZS1vcm0nXG5pbXBvcnQgdHlwZSB7IEZpZWxkLCBXaGVyZSB9IGZyb20gJ3BheWxvYWQvdHlwZXMnXG5cbmltcG9ydCB0eXBlIHsgR2VuZXJpY0NvbHVtbiwgUG9zdGdyZXNBZGFwdGVyIH0gZnJvbSAnLi4vdHlwZXMnXG5pbXBvcnQgdHlwZSB7IEJ1aWxkUXVlcnlKb2luQWxpYXNlcywgQnVpbGRRdWVyeUpvaW5zIH0gZnJvbSAnLi9idWlsZFF1ZXJ5J1xuXG5pbXBvcnQgeyBwYXJzZVBhcmFtcyB9IGZyb20gJy4vcGFyc2VQYXJhbXMnXG5cbmV4cG9ydCBhc3luYyBmdW5jd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FBYyxVQUFVO1lBQ2pDLDRDQUE0QztZQUM1QyxNQUFNQyxTQUFTLE1BQU1aLFlBQVk7Z0JBQy9CRTtnQkFDQUM7Z0JBQ0FDO2dCQUNBQztnQkFDQUM7Z0JBQ0FDO2dCQUNBQztnQkFDQUMsT0FBT0U7WUFDVDtZQUNBLElBQUlDLFVBQVVDLE9BQU9DLElBQUksQ0FBQ0YsUUFBUUcsTUFBTSxHQUFHLEdBQUc7Z0JBQzVDTCxvQkFBb0JNLElBQUksQ0FBQ0o7WUFDM0I7UUFDRjtJQUNGO0lBQ0EsT0FBT0Y7QUFDVCJ9
@@ -1,16 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "default", {
6
- enumerable: true,
7
- get: function() {
8
- return _default;
9
- }
10
- });
11
- const _drizzleorm = require("drizzle-orm");
12
- const _getTableColumnFromPath = require("./getTableColumnFromPath");
13
- const _parseParams = require("./parseParams");
1
+ import { asc, desc } from 'drizzle-orm';
2
+ import { getTableColumnFromPath } from './getTableColumnFromPath';
3
+ import { parseParams } from './parseParams';
14
4
  const buildQuery = async function buildQuery({ adapter, fields, locale, sort, tableName, where: incomingWhere }) {
15
5
  const selectFields = {
16
6
  id: adapter.tables[tableName].id
@@ -25,13 +15,13 @@ const buildQuery = async function buildQuery({ adapter, fields, locale, sort, ta
25
15
  let sortPath;
26
16
  if (sort[0] === '-') {
27
17
  sortPath = sort.substring(1);
28
- orderBy.order = _drizzleorm.desc;
18
+ orderBy.order = desc;
29
19
  } else {
30
20
  sortPath = sort;
31
- orderBy.order = _drizzleorm.asc;
21
+ orderBy.order = asc;
32
22
  }
33
23
  try {
34
- const { columnName: sortTableColumnName, table: sortTable } = (0, _getTableColumnFromPath.getTableColumnFromPath)({
24
+ const { columnName: sortTableColumnName, table: sortTable } = getTableColumnFromPath({
35
25
  adapter,
36
26
  collectionPath: sortPath,
37
27
  fields,
@@ -49,7 +39,7 @@ const buildQuery = async function buildQuery({ adapter, fields, locale, sort, ta
49
39
  }
50
40
  }
51
41
  if (!orderBy?.column) {
52
- orderBy.order = _drizzleorm.desc;
42
+ orderBy.order = desc;
53
43
  const createdAt = adapter.tables[tableName]?.createdAt;
54
44
  if (createdAt) {
55
45
  orderBy.column = createdAt;
@@ -62,7 +52,7 @@ const buildQuery = async function buildQuery({ adapter, fields, locale, sort, ta
62
52
  }
63
53
  let where;
64
54
  if (incomingWhere && Object.keys(incomingWhere).length > 0) {
65
- where = await (0, _parseParams.parseParams)({
55
+ where = await parseParams({
66
56
  adapter,
67
57
  fields,
68
58
  joinAliases,
@@ -81,6 +71,6 @@ const buildQuery = async function buildQuery({ adapter, fields, locale, sort, ta
81
71
  where
82
72
  };
83
73
  };
84
- const _default = buildQuery;
74
+ export default buildQuery;
85
75
 
86
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9xdWVyaWVzL2J1aWxkUXVlcnkudHMiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHR5cGUgeyBTUUwgfSBmcm9tICdkcml6emxlLW9ybSdcbmltcG9ydCB0eXBlIHsgUGdUYWJsZVdpdGhDb2x1bW5zIH0gZnJvbSAnZHJpenpsZS1vcm0vcGctY29yZSdcbmltcG9ydCB0eXBlIHsgRmllbGQsIFdoZXJlIH0gZnJvbSAncGF5bG9hZC90eXBlcydcblxuaW1wb3J0IHsgYXNjLCBkZXNjIH0gZnJvbSAnZHJpenpsZS1vcm0nXG5cbmltcG9ydCB0eXBlIHsgR2VuZXJpY0NvbHVtbiwgR2VuZXJpY1RhYmxlLCBQb3N0Z3Jlc0FkYXB0ZXIgfSBmcm9tICcuLi90eXBlcydcblxuaW1wb3J0IHsgZ2V0VGFibGVDb2x1bW5Gcm9tUGF0aCB9IGZyb20gJy4vZ2V0VGFibGVDb2x1bW5Gcm9tUGF0aCdcbmltcG9ydCB7IHBhcnNlUGFyYW1zIH0g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ztRQUNBRDtRQUNBRTtRQUNBTDtRQUNBRjtJQUNGO0FBQ0Y7QUFFQSxlQUFlTixXQUFVIn0=
@@ -1,24 +1,14 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "convertPathToJSONTraversal", {
6
- enumerable: true,
7
- get: function() {
8
- return convertPathToJSONTraversal;
9
- }
10
- });
11
- const _formatJSONPathSegment = require("./formatJSONPathSegment");
12
- const convertPathToJSONTraversal = (incomingSegments)=>{
1
+ import { formatJSONPathSegment } from './formatJSONPathSegment';
2
+ export const convertPathToJSONTraversal = (incomingSegments)=>{
13
3
  const segments = [
14
4
  ...incomingSegments
15
5
  ];
16
6
  segments.shift();
17
7
  return segments.reduce((res, segment, i)=>{
18
- const formattedSegment = (0, _formatJSONPathSegment.formatJSONPathSegment)(segment);
8
+ const formattedSegment = formatJSONPathSegment(segment);
19
9
  if (i + 1 === segments.length) return `${res}->>${formattedSegment}`;
20
10
  return `${res}->${formattedSegment}`;
21
11
  }, '');
22
12
  };
23
13
 
24
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9xdWVyaWVzL2NyZWF0ZUpTT05RdWVyeS9jb252ZXJ0UGF0aFRvSlNPTlRyYXZlcnNhbC50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBmb3JtYXRKU09OUGF0aFNlZ21lbnQgfSBmcm9tICcuL2Zvcm1hdEpTT05QYXRoU2VnbWVudCdcblxuZXhwb3J0IGNvbnN0IGNvbnZlcnRQYXRoVG9KU09OVHJhdmVyc2FsID0gKGluY29taW5nU2VnbWVudHM6IHN0cmluZ1tdKSA9PiB7XG4gIGNvbnN0IHNlZ21lbnRzID0gWy4uLmluY29taW5nU2VnbWVudHNdXG4gIHNlZ21lbnRzLnNoaWZ0KClcblxuICByZXR1cm4gc2VnbWVudHMucmVkdWNlKChyZXMsIHNl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E1BQU0sQ0FBQyxDQUFDQyxLQUFLQyxTQUFTQztRQUNwQyxNQUFNQyxtQkFBbUJULHNCQUFzQk87UUFFL0MsSUFBSUMsSUFBSSxNQUFNTCxTQUFTTyxNQUFNLEVBQUUsT0FBTyxDQUFDLEVBQUVKLElBQUksR0FBRyxFQUFFRyxpQkFBaUIsQ0FBQztRQUNwRSxPQUFPLENBQUMsRUFBRUgsSUFBSSxFQUFFLEVBQUVHLGlCQUFpQixDQUFDO0lBQ3RDLEdBQUc7QUFDTCxFQUFDIn0=
@@ -1,15 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "formatJSONPathSegment", {
6
- enumerable: true,
7
- get: function() {
8
- return formatJSONPathSegment;
9
- }
10
- });
11
- const formatJSONPathSegment = (segment)=>{
1
+ export const formatJSONPathSegment = (segment)=>{
12
2
  return Number.isNaN(parseInt(segment)) ? `'${segment}'` : segment;
13
3
  };
14
4
 
15
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9xdWVyaWVzL2NyZWF0ZUpTT05RdWVyeS9mb3JtYXRKU09OUGF0aFNlZ21lbnQudHMiXSwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IGNvbnN0IGZvcm1hdEpTT05QYXRoU2VnbWVudCA9IChzZWdtZW50OiBzdHJpbmcpID0+IHtcbiAgcmV0dXJuIE51bWJlci5pc05hTihwYXJzZUludChzZWdtZW50KSkgPyBgJyR7c2VnbWVudH0nYCA6IHNlZ21lbnRcbn1cbiJdLCJuYW1lcyI6WyJmb3JtYXRKU09OUGF0aFNlZ21lbnQiLCJzZWdtZW50IiwiTnVtYmVyIiwiaXNOYU4iLCJwYXJzZUludCJdLCJtYXBwaW5ncyI6Ijs7OzsrQkFBYUE7OztlQUFBQTs7O0FBQU4sTUFBTUEsd0JBQXdCLENBQUNDO0lBQ3BDLE9BQU9DLE9BQU9DLEtBQUssQ0FBQ0MsU0FBU0gsWUFBWSxDQUFDLENBQUMsRUFBRUEsUUFBUSxDQUFDLENBQUMsR0FBR0E7QUFDNUQifQ==
5
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9xdWVyaWVzL2NyZWF0ZUpTT05RdWVyeS9mb3JtYXRKU09OUGF0aFNlZ21lbnQudHMiXSwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IGNvbnN0IGZvcm1hdEpTT05QYXRoU2VnbWVudCA9IChzZWdtZW50OiBzdHJpbmcpID0+IHtcbiAgcmV0dXJuIE51bWJlci5pc05hTihwYXJzZUludChzZWdtZW50KSkgPyBgJyR7c2VnbWVudH0nYCA6IHNlZ21lbnRcbn1cbiJdLCJuYW1lcyI6WyJmb3JtYXRKU09OUGF0aFNlZ21lbnQiLCJzZWdtZW50IiwiTnVtYmVyIiwiaXNOYU4iLCJwYXJzZUludCJdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxNQUFNQSx3QkFBd0IsQ0FBQ0M7SUFDcEMsT0FBT0MsT0FBT0MsS0FBSyxDQUFDQyxTQUFTSCxZQUFZLENBQUMsQ0FBQyxFQUFFQSxRQUFRLENBQUMsQ0FBQyxHQUFHQTtBQUM1RCxFQUFDIn0=
@@ -1,15 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "createJSONQuery", {
6
- enumerable: true,
7
- get: function() {
8
- return createJSONQuery;
9
- }
10
- });
11
- const _convertPathToJSONTraversal = require("./convertPathToJSONTraversal");
12
- const _formatJSONPathSegment = require("./formatJSONPathSegment");
1
+ import { convertPathToJSONTraversal } from './convertPathToJSONTraversal';
2
+ import { formatJSONPathSegment } from './formatJSONPathSegment';
13
3
  const operatorMap = {
14
4
  contains: '~*',
15
5
  equals: '=',
@@ -19,7 +9,7 @@ const fromArray = ({ isRoot, operator, pathSegments, treatAsArray, value })=>{
19
9
  const newPathSegments = pathSegments.slice(isRoot ? 1 : 2);
20
10
  const alias = `${pathSegments[isRoot ? 0 : 1]}_alias_${newPathSegments.length}`;
21
11
  newPathSegments.unshift(alias);
22
- const arrayElements = isRoot ? pathSegments[0] : `${pathSegments[0]} -> ${(0, _formatJSONPathSegment.formatJSONPathSegment)(pathSegments[1])}`;
12
+ const arrayElements = isRoot ? pathSegments[0] : `${pathSegments[0]} -> ${formatJSONPathSegment(pathSegments[1])}`;
23
13
  return `EXISTS (
24
14
  SELECT 1
25
15
  FROM jsonb_array_elements(${arrayElements}) AS ${alias}
@@ -32,10 +22,10 @@ const fromArray = ({ isRoot, operator, pathSegments, treatAsArray, value })=>{
32
22
  )`;
33
23
  };
34
24
  const createConstraint = ({ operator, pathSegments, value })=>{
35
- const jsonQuery = (0, _convertPathToJSONTraversal.convertPathToJSONTraversal)(pathSegments);
25
+ const jsonQuery = convertPathToJSONTraversal(pathSegments);
36
26
  return `${pathSegments[0]}${jsonQuery} ${operatorMap[operator]} '${value}'`;
37
27
  };
38
- const createJSONQuery = ({ operator, pathSegments, treatAsArray, treatRootAsArray, value })=>{
28
+ export const createJSONQuery = ({ operator, pathSegments, treatAsArray, treatRootAsArray, value })=>{
39
29
  if (treatRootAsArray) {
40
30
  return fromArray({
41
31
  isRoot: true,
@@ -61,4 +51,4 @@ const createJSONQuery = ({ operator, pathSegments, treatAsArray, treatRootAsArra
61
51
  });
62
52
  };
63
53
 
64
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9xdWVyaWVzL2NyZWF0ZUpTT05RdWVyeS9pbmRleC50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBjb252ZXJ0UGF0aFRvSlNPTlRyYXZlcnNhbCB9IGZyb20gJy4vY29udmVydFBhdGhUb0pTT05UcmF2ZXJzYWwnXG5pbXBvcn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