@payloadcms/db-postgres 0.7.1 → 0.8.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. package/dist/count.d.ts +3 -0
  2. package/dist/count.d.ts.map +1 -0
  3. package/dist/count.js +68 -0
  4. package/dist/create.d.ts.map +1 -1
  5. package/dist/create.js +7 -9
  6. package/dist/createGlobal.d.ts +1 -1
  7. package/dist/createGlobal.d.ts.map +1 -1
  8. package/dist/createGlobal.js +8 -10
  9. package/dist/createGlobalVersion.d.ts +1 -1
  10. package/dist/createGlobalVersion.d.ts.map +1 -1
  11. package/dist/createGlobalVersion.js +12 -14
  12. package/dist/createVersion.d.ts.map +1 -1
  13. package/dist/createVersion.js +22 -19
  14. package/dist/deleteMany.js +6 -8
  15. package/dist/deleteOne.d.ts.map +1 -1
  16. package/dist/deleteOne.js +6 -3
  17. package/dist/deleteVersions.d.ts.map +1 -1
  18. package/dist/deleteVersions.js +7 -8
  19. package/dist/find/buildFindManyArgs.js +3 -3
  20. package/dist/find/findMany.js +2 -2
  21. package/dist/find/traverseFields.d.ts.map +1 -1
  22. package/dist/find/traverseFields.js +23 -11
  23. package/dist/find.d.ts.map +1 -1
  24. package/dist/find.js +10 -11
  25. package/dist/findGlobal.d.ts.map +1 -1
  26. package/dist/findGlobal.js +7 -9
  27. package/dist/findGlobalVersions.d.ts.map +1 -1
  28. package/dist/findGlobalVersions.js +7 -8
  29. package/dist/findOne.d.ts +1 -1
  30. package/dist/findOne.d.ts.map +1 -1
  31. package/dist/findOne.js +9 -10
  32. package/dist/findVersions.d.ts.map +1 -1
  33. package/dist/findVersions.js +7 -8
  34. package/dist/index.d.ts.map +1 -1
  35. package/dist/index.js +7 -1
  36. package/dist/init.d.ts.map +1 -1
  37. package/dist/init.js +28 -15
  38. package/dist/queries/getTableColumnFromPath.d.ts.map +1 -1
  39. package/dist/queries/getTableColumnFromPath.js +148 -42
  40. package/dist/queries/sanitizeQueryValue.d.ts.map +1 -1
  41. package/dist/queries/sanitizeQueryValue.js +5 -2
  42. package/dist/queryDrafts.d.ts.map +1 -1
  43. package/dist/queryDrafts.js +7 -8
  44. package/dist/schema/build.d.ts +2 -1
  45. package/dist/schema/build.d.ts.map +1 -1
  46. package/dist/schema/build.js +19 -14
  47. package/dist/schema/getTableName.d.ts +32 -0
  48. package/dist/schema/getTableName.d.ts.map +1 -0
  49. package/dist/schema/getTableName.js +43 -0
  50. package/dist/schema/traverseFields.d.ts +2 -1
  51. package/dist/schema/traverseFields.d.ts.map +1 -1
  52. package/dist/schema/traverseFields.js +54 -18
  53. package/dist/schema/validateExistingBlockIsIdentical.d.ts +2 -1
  54. package/dist/schema/validateExistingBlockIsIdentical.d.ts.map +1 -1
  55. package/dist/schema/validateExistingBlockIsIdentical.js +14 -8
  56. package/dist/transform/write/blocks.d.ts +2 -2
  57. package/dist/transform/write/blocks.d.ts.map +1 -1
  58. package/dist/transform/write/blocks.js +4 -4
  59. package/dist/transform/write/traverseFields.d.ts +2 -2
  60. package/dist/transform/write/traverseFields.d.ts.map +1 -1
  61. package/dist/transform/write/traverseFields.js +34 -25
  62. package/dist/types.d.ts +13 -0
  63. package/dist/types.d.ts.map +1 -1
  64. package/dist/update.d.ts.map +1 -1
  65. package/dist/update.js +7 -4
  66. package/dist/updateGlobal.d.ts +1 -1
  67. package/dist/updateGlobal.d.ts.map +1 -1
  68. package/dist/updateGlobal.js +9 -11
  69. package/dist/updateGlobalVersion.d.ts.map +1 -1
  70. package/dist/updateGlobalVersion.js +9 -5
  71. package/dist/updateVersion.d.ts.map +1 -1
  72. package/dist/updateVersion.js +9 -5
  73. package/dist/upsertRow/index.d.ts.map +1 -1
  74. package/dist/upsertRow/index.js +7 -6
  75. package/dist/upsertRow/insertArrays.d.ts.map +1 -1
  76. package/dist/upsertRow/insertArrays.js +3 -3
  77. package/dist/upsertRow/types.d.ts +1 -1
  78. package/dist/upsertRow/types.d.ts.map +1 -1
  79. package/package.json +3 -3
@@ -0,0 +1,3 @@
1
+ import type { Count } from 'payload/database';
2
+ export declare const count: Count;
3
+ //# sourceMappingURL=count.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"count.d.ts","sourceRoot":"","sources":["../src/count.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AAY7C,eAAO,MAAM,KAAK,EAAE,KAoDnB,CAAA"}
package/dist/count.js ADDED
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "count", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return count;
9
+ }
10
+ });
11
+ const _drizzleorm = require("drizzle-orm");
12
+ const _chainMethods = require("./find/chainMethods");
13
+ const _buildQuery = /*#__PURE__*/ _interop_require_default(require("./queries/buildQuery"));
14
+ const _getTableName = require("./schema/getTableName");
15
+ function _interop_require_default(obj) {
16
+ return obj && obj.__esModule ? obj : {
17
+ default: obj
18
+ };
19
+ }
20
+ const count = async function count({ collection, locale, req, where: whereArg }) {
21
+ const collectionConfig = this.payload.collections[collection].config;
22
+ const tableName = (0, _getTableName.getTableName)({
23
+ adapter: this,
24
+ config: collectionConfig
25
+ });
26
+ const db = this.sessions[req.transactionID]?.db || this.drizzle;
27
+ const table = this.tables[tableName];
28
+ const { joinAliases, joins, where } = await (0, _buildQuery.default)({
29
+ adapter: this,
30
+ fields: collectionConfig.fields,
31
+ locale,
32
+ tableName,
33
+ where: whereArg
34
+ });
35
+ const selectCountMethods = [];
36
+ joinAliases.forEach(({ condition, table })=>{
37
+ selectCountMethods.push({
38
+ args: [
39
+ table,
40
+ condition
41
+ ],
42
+ method: 'leftJoin'
43
+ });
44
+ });
45
+ Object.entries(joins).forEach(([joinTable, condition])=>{
46
+ if (joinTable) {
47
+ selectCountMethods.push({
48
+ args: [
49
+ this.tables[joinTable],
50
+ condition
51
+ ],
52
+ method: 'leftJoin'
53
+ });
54
+ }
55
+ });
56
+ const countResult = await (0, _chainMethods.chainMethods)({
57
+ methods: selectCountMethods,
58
+ query: db.select({
59
+ count: (0, _drizzleorm.sql)`count
60
+ (DISTINCT ${this.tables[tableName].id})`
61
+ }).from(table).where(where)
62
+ });
63
+ return {
64
+ totalDocs: Number(countResult[0].count)
65
+ };
66
+ };
67
+
68
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9jb3VudC50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgdHlwZSB7IENvdW50IH0gZnJvbSAncGF5bG9hZC9kYXRhYmFzZSdcbmltcG9ydCB0eXBlIHsgU2FuaXRpemVkQ29sbGVjdGlvbkNvbmZpZyB9IGZyb20gJ3BheWxvYWQvdHlwZXMnXG5cbmltcG9ydCB7IHNxbCB9IGZyb20gJ2RyaXp6bGUtb3JtJ1xuXG5pbXBvcnQgdHlwZSB7IENoYWluZWRNZXRob2RzIH0gZnJvbSAnLi9maW5kL2NoYWluTWV0aG9kcydcbmltcG9ydCB0eXBlIHsgUG9zdGdyZXNBZGFwdGVyIH0gZnJvbSAnLi90eXBlcydcblxuaW1wb3J0IHsgY2hhaW5NZXRob2RzIH0gZnJvbSAnLi9maW5kL2NoYWluTWV0aG9kcydcbmltcG9ydCBidWlsZFF1ZXJ5IGZyb20gJy4vcXVlcmllcy9idWlsZFF1ZXJ5J1xuaW1wb3J0IHsgZ2V0VGFibGVOYW1lIH0gZnJvbSAnLi9zY2hlbWEvZ2V0VGFibGVOYW1lJ1xuXG5leHBvcnQgY29uc3QgY291bnQ6IENvdW50ID0gYXN5bmMgZnVuY3Rpb24gY291bnQoXG4gIHRoaXM6IFBvc3RncmVzQWRhcHRlcixcbiAgeyBjb2xsZWN0aW9uLCBsb2NhbGUsIHJlcSwgd2hlcmU6IHdoZXJlQXJnIH0sXG4pIHtcbiAgY29uc3QgY29sbGVjdGlvbkNvbmZpZzogU2FuaXRpemVkQ29sbGVjdGlvbkNvbmZpZyA9IHRoaXMucGF5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JQUFJLENBQUM7Z0JBQ3RCQyxNQUFNO29CQUFDLElBQUksQ0FBQ1QsTUFBTSxDQUFDYSxVQUFVO29CQUFFTjtpQkFBVTtnQkFDekNHLFFBQVE7WUFDVjtRQUNGO0lBQ0Y7SUFFQSxNQUFNSSxjQUFjLE1BQU1DLElBQUFBLDBCQUFZLEVBQUM7UUFDckNDLFNBQVNYO1FBQ1RZLE9BQU90QixHQUNKdUIsTUFBTSxDQUFDO1lBQ05wQyxPQUFPcUMsSUFBQUEsZUFBRyxDQUFRLENBQUM7c0JBQ0wsRUFBRSxJQUFJLENBQUNuQixNQUFNLENBQUNSLFVBQVUsQ0FBQzRCLEVBQUUsQ0FBQyxDQUFDLENBQUM7UUFDOUMsR0FDQ0MsSUFBSSxDQUFDdEIsT0FDTGIsS0FBSyxDQUFDQTtJQUNYO0lBRUEsT0FBTztRQUFFb0MsV0FBV0MsT0FBT1QsV0FBVyxDQUFDLEVBQUUsQ0FBQ2hDLEtBQUs7SUFBRTtBQUNuRCJ9
@@ -1 +1 @@
1
- {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../src/create.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAQ9C,eAAO,MAAM,MAAM,EAAE,MAkBpB,CAAA"}
1
+ {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../src/create.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAO9C,eAAO,MAAM,MAAM,EAAE,MAqBpB,CAAA"}
package/dist/create.js CHANGED
@@ -8,13 +8,8 @@ Object.defineProperty(exports, "create", {
8
8
  return create;
9
9
  }
10
10
  });
11
- const _tosnakecase = /*#__PURE__*/ _interop_require_default(require("to-snake-case"));
11
+ const _getTableName = require("./schema/getTableName");
12
12
  const _upsertRow = require("./upsertRow");
13
- function _interop_require_default(obj) {
14
- return obj && obj.__esModule ? obj : {
15
- default: obj
16
- };
17
- }
18
13
  const create = async function create({ collection: collectionSlug, data, req }) {
19
14
  const db = this.sessions[req.transactionID]?.db || this.drizzle;
20
15
  const collection = this.payload.collections[collectionSlug].config;
@@ -24,10 +19,13 @@ const create = async function create({ collection: collectionSlug, data, req })
24
19
  db,
25
20
  fields: collection.fields,
26
21
  operation: 'create',
27
- tableName: (0, _tosnakecase.default)(collectionSlug),
28
- req
22
+ req,
23
+ tableName: (0, _getTableName.getTableName)({
24
+ adapter: this,
25
+ config: collection
26
+ })
29
27
  });
30
28
  return result;
31
29
  };
32
30
 
33
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9jcmVhdGUudHMiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHR5cGUgeyBDcmVhdGUgfSBmcm9tICdwYXlsb2FkL2RhdGFiYXNlJ1xuXG5pbXBvcnQgdG9TbmFrZUNhc2UgZnJvbSAndG8tc25ha2UtY2FzZSdcblxuaW1wb3J0IHR5cGUgeyBQb3N0Z3Jlc0FkYXB0ZXIgfSBmcm9tICcuL3R5cGVzJ1xuXG5pbXBvcnQgeyB1cHNlcnRSb3cgfSBmcm9tICcuL3Vwc2VydFJvdydcblxuZXhwb3J0IGNvbnN0IGNyZWF0ZTogQ3JlYXRlID0gYXN5bmMgZnVuY3Rpb24gY3JlYXRlKFxuICB0aGlzOiBQb3N0Z3Jlc0FkYXB0ZXIsXG4gIHsgY29sbGVjdGlvbjogY29sbGVjdGlvblNsdWcsIGRhdGEsIHJlcSB9LFxuKSB7XG4gIGNvbnN0IGRiID0gdGhpcy5zZXNzaW9uc1tyZXEudHJhbnNhY3Rpb25JRF0/LmRiIHx8IHRoaXMuZHJpenpsZVxuICBjb25zdCBjb2xsZWN0aW9uID0gdGhpcy5wYXlsb2FkLmNvbGxlY3Rpb25zW2NvbGxlY3Rpb25TbHVnXS5jb25maWdcblxuICBjb25zdCByZXN1bHQgPSBhd2FpdCB1cHNl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types';
3
3
  import type { PostgresAdapter } from './types';
4
- export declare function createGlobal<T extends TypeWithID>(this: PostgresAdapter, { data, req, slug }: CreateGlobalArgs): Promise<T>;
4
+ export declare function createGlobal<T extends TypeWithID>(this: PostgresAdapter, { slug, data, req }: CreateGlobalArgs): Promise<T>;
5
5
  //# sourceMappingURL=createGlobal.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"createGlobal.d.ts","sourceRoot":"","sources":["../src/createGlobal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AACxD,OAAO,KAAK,EAAkB,UAAU,EAAE,MAAM,eAAe,CAAA;AAI/D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAI9C,wBAAsB,YAAY,CAAC,CAAC,SAAS,UAAU,EACrD,IAAI,EAAE,eAAe,EACrB,EAAE,IAAI,EAAE,GAA0B,EAAE,IAAI,EAAE,EAAE,gBAAgB,GAC3D,OAAO,CAAC,CAAC,CAAC,CAeZ"}
1
+ {"version":3,"file":"createGlobal.d.ts","sourceRoot":"","sources":["../src/createGlobal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AACxD,OAAO,KAAK,EAAkB,UAAU,EAAE,MAAM,eAAe,CAAA;AAE/D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAK9C,wBAAsB,YAAY,CAAC,CAAC,SAAS,UAAU,EACrD,IAAI,EAAE,eAAe,EACrB,EAAE,IAAI,EAAE,IAAI,EAAE,GAA0B,EAAE,EAAE,gBAAgB,GAC3D,OAAO,CAAC,CAAC,CAAC,CAkBZ"}
@@ -8,14 +8,9 @@ Object.defineProperty(exports, "createGlobal", {
8
8
  return createGlobal;
9
9
  }
10
10
  });
11
- const _tosnakecase = /*#__PURE__*/ _interop_require_default(require("to-snake-case"));
11
+ const _getTableName = require("./schema/getTableName");
12
12
  const _upsertRow = require("./upsertRow");
13
- function _interop_require_default(obj) {
14
- return obj && obj.__esModule ? obj : {
15
- default: obj
16
- };
17
- }
18
- async function createGlobal({ data, req = {}, slug }) {
13
+ async function createGlobal({ slug, data, req = {} }) {
19
14
  const db = this.sessions[req.transactionID]?.db || this.drizzle;
20
15
  const globalConfig = this.payload.globals.config.find((config)=>config.slug === slug);
21
16
  const result = await (0, _upsertRow.upsertRow)({
@@ -24,10 +19,13 @@ async function createGlobal({ data, req = {}, slug }) {
24
19
  db,
25
20
  fields: globalConfig.fields,
26
21
  operation: 'create',
27
- tableName: (0, _tosnakecase.default)(slug),
28
- req
22
+ req,
23
+ tableName: (0, _getTableName.getTableName)({
24
+ adapter: this,
25
+ config: globalConfig
26
+ })
29
27
  });
30
28
  return result;
31
29
  }
32
30
 
33
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9jcmVhdGVHbG9iYWwudHMiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHR5cGUgeyBDcmVhdGVHbG9iYWxBcmdzIH0gZnJvbSAncGF5bG9hZC9kYXRhYmFzZSdcbmltcG9ydCB0eXBlIHsgUGF5bG9hZFJlcXVlc3QsIFR5cGVXaXRoSUQgfSBmcm9tICdwYXlsb2FkL3R5cGVzJ1xuXG5pbXBvcnQgdG9TbmFrZUNhc2UgZnJvbSAndG8tc25ha2UtY2FzZSdcblxuaW1wb3J0IHR5cGUgeyBQb3N0Z3Jlc0FkYXB0ZXIgfSBmcm9tICcuL3R5cGVzJ1xuXG5pbXBvcnQgeyB1cHNlcnRSb3cgfSBmcm9tICcuL3Vwc2VydFJvdydcblxuZXhwb3J0IGFzeW5jIGZ1bmN0aW9uIGNyZWF0ZUdsb2JhbDxUIGV4dGVuZHMgVHlwZVdpdGhJRD4oXG4gIHRoaXM6IFBvc3RncmVzQWRhcHRlcixcbiAgeyBkYXRhLCByZXEgPSB7fSBhcyBQYXlsb2FkU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LEtBQUssSUFBSSxDQUFDQyxRQUFRLENBQUNGLElBQUlHLGFBQWEsQ0FBQyxFQUFFRixNQUFNLElBQUksQ0FBQ0csT0FBTztJQUMvRCxNQUFNQyxlQUFlLElBQUksQ0FBQ0MsT0FBTyxDQUFDQyxPQUFPLENBQUNDLE1BQU0sQ0FBQ0MsSUFBSSxDQUFDLENBQUNELFNBQVdBLE9BQU9WLElBQUksS0FBS0E7SUFFbEYsTUFBTVksU0FBUyxNQUFNQyxJQUFBQSxvQkFBUyxFQUFJO1FBQ2hDQyxTQUFTLElBQUk7UUFDYmI7UUFDQUU7UUFDQVksUUFBUVIsYUFBYVEsTUFBTTtRQUMzQkMsV0FBVztRQUNYZDtRQUNBZSxXQUFXQyxJQUFBQSwwQkFBWSxFQUFDO1lBQ3RCSixTQUFTLElBQUk7WUFDYkosUUFBUUg7UUFDVjtJQUNGO0lBRUEsT0FBT0s7QUFDVCJ9
@@ -1,6 +1,6 @@
1
1
  import type { TypeWithVersion } from 'payload/database';
2
- import { type CreateGlobalVersionArgs } from 'payload/database';
3
2
  import type { TypeWithID } from 'payload/types';
3
+ import { type CreateGlobalVersionArgs } from 'payload/database';
4
4
  import type { PostgresAdapter } from './types';
5
5
  export declare function createGlobalVersion<T extends TypeWithID>(this: PostgresAdapter, { autosave, globalSlug, req, versionData }: CreateGlobalVersionArgs): Promise<TypeWithVersion<T>>;
6
6
  //# sourceMappingURL=createGlobalVersion.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"createGlobalVersion.d.ts","sourceRoot":"","sources":["../src/createGlobalVersion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AACvD,OAAO,EAAE,KAAK,uBAAuB,EAAE,MAAM,kBAAkB,CAAA;AAC/D,OAAO,KAAK,EAAkB,UAAU,EAAE,MAAM,eAAe,CAAA;AAM/D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAI9C,wBAAsB,mBAAmB,CAAC,CAAC,SAAS,UAAU,EAC5D,IAAI,EAAE,eAAe,EACrB,EAAE,QAAQ,EAAE,UAAU,EAAE,GAA0B,EAAE,WAAW,EAAE,EAAE,uBAAuB,+BAgC3F"}
1
+ {"version":3,"file":"createGlobalVersion.d.ts","sourceRoot":"","sources":["../src/createGlobalVersion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AACvD,OAAO,KAAK,EAAkB,UAAU,EAAE,MAAM,eAAe,CAAA;AAG/D,OAAO,EAAE,KAAK,uBAAuB,EAAE,MAAM,kBAAkB,CAAA;AAG/D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAK9C,wBAAsB,mBAAmB,CAAC,CAAC,SAAS,UAAU,EAC5D,IAAI,EAAE,eAAe,EACrB,EAAE,QAAQ,EAAE,UAAU,EAAE,GAA0B,EAAE,WAAW,EAAE,EAAE,uBAAuB,+BAmC3F"}
@@ -10,18 +10,16 @@ Object.defineProperty(exports, "createGlobalVersion", {
10
10
  });
11
11
  const _drizzleorm = require("drizzle-orm");
12
12
  const _versions = require("payload/versions");
13
- const _tosnakecase = /*#__PURE__*/ _interop_require_default(require("to-snake-case"));
13
+ const _getTableName = require("./schema/getTableName");
14
14
  const _upsertRow = require("./upsertRow");
15
- function _interop_require_default(obj) {
16
- return obj && obj.__esModule ? obj : {
17
- default: obj
18
- };
19
- }
20
15
  async function createGlobalVersion({ autosave, globalSlug, req = {}, versionData }) {
21
16
  const db = this.sessions[req.transactionID]?.db || this.drizzle;
22
17
  const global = this.payload.globals.config.find(({ slug })=>slug === globalSlug);
23
- const globalTableName = (0, _tosnakecase.default)(globalSlug);
24
- const tableName = `_${globalTableName}_v`;
18
+ const tableName = (0, _getTableName.getTableName)({
19
+ adapter: this,
20
+ config: global,
21
+ versions: true
22
+ });
25
23
  const result = await (0, _upsertRow.upsertRow)({
26
24
  adapter: this,
27
25
  data: {
@@ -32,18 +30,18 @@ async function createGlobalVersion({ autosave, globalSlug, req = {}, versionData
32
30
  db,
33
31
  fields: (0, _versions.buildVersionGlobalFields)(global),
34
32
  operation: 'create',
35
- tableName,
36
- req
33
+ req,
34
+ tableName
37
35
  });
38
36
  const table = this.tables[tableName];
39
37
  if (global.versions.drafts) {
40
38
  await db.execute((0, _drizzleorm.sql)`
41
- UPDATE ${table}
42
- SET latest = false
43
- WHERE ${table.id} != ${result.id};
39
+ UPDATE ${table}
40
+ SET latest = false
41
+ WHERE ${table.id} != ${result.id};
44
42
  `);
45
43
  }
46
44
  return result;
47
45
  }
48
46
 
49
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9jcmVhdGVHbG9iYWxWZXJzaW9uLnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB0eXBlIHsgVHlwZVdpdGhWZXJzaW9uIH0gZnJvbSAncGF5bG9hZC9kYXRhYmFzZSdcbmltcG9ydCB7IHR5cGUgQ3JlYXRlR2xvYmFsVmVyc2lvbkFyZ3MgfSBmcm9tICdwYXlsb2FkL2RhdGFiYXNlJ1xuaW1wb3J0IHR5cGUgeyBQYXlsb2FkUmVxdWVzdCwgVHlwZVdpdGhJRCB9IGZyb20gJ3BheWxvYWQvdHlwZXMnXG5cbmltcG9ydCB7IHNxbCB9IGZyb20gJ2RyaXp6bGUtb3JtJ1xuaW1wb3J0IHsgYnVpbGRWZXJzaW9uR2xvYmFsRmllbGRzIH0gZnJvbSAncGF5bG9hZC92ZXJzaW9ucydcbmltcG9ydCB0b1NuYWtlQ2FzZSBmcm9tICd0by1zbmFrZS1jYXNlJ1xuXG5pbXBvcnQgdHlwZSB7IFBvc3RncmVzQWRhcHRlciB9IGZyb20gJy4vdHlwZXMnXG5cbmltcG9ydCB7IHVwc2VydFJvdyB9IGZyb20gJy4vdXBzZXJ0Um93J1xuXG5leHBvcnQgYXN5bmMgZnVuY3Rpb24gY3J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UFBRUEsTUFBTUssRUFBRSxDQUFDLElBQUksRUFBRWIsT0FBT2EsRUFBRSxDQUFDO0lBQ3JDLENBQUM7SUFDSDtJQUVBLE9BQU9iO0FBQ1QifQ==
@@ -1 +1 @@
1
- {"version":3,"file":"createVersion.d.ts","sourceRoot":"","sources":["../src/createVersion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAC1E,OAAO,KAAK,EAAkB,UAAU,EAAE,MAAM,eAAe,CAAA;AAM/D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAI9C,wBAAsB,aAAa,CAAC,CAAC,SAAS,UAAU,EACtD,IAAI,EAAE,eAAe,EACrB,EACE,QAAQ,EACR,cAAc,EACd,MAAM,EACN,GAA0B,EAC1B,WAAW,GACZ,EAAE,iBAAiB,CAAC,CAAC,CAAC,+BAsCxB"}
1
+ {"version":3,"file":"createVersion.d.ts","sourceRoot":"","sources":["../src/createVersion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAC1E,OAAO,KAAK,EAAkB,UAAU,EAAE,MAAM,eAAe,CAAA;AAK/D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAK9C,wBAAsB,aAAa,CAAC,CAAC,SAAS,UAAU,EACtD,IAAI,EAAE,eAAe,EACrB,EACE,QAAQ,EACR,cAAc,EACd,MAAM,EACN,GAA0B,EAC1B,WAAW,GACZ,EAAE,iBAAiB,CAAC,CAAC,CAAC,+BAiDxB"}
@@ -10,18 +10,16 @@ Object.defineProperty(exports, "createVersion", {
10
10
  });
11
11
  const _drizzleorm = require("drizzle-orm");
12
12
  const _versions = require("payload/versions");
13
- const _tosnakecase = /*#__PURE__*/ _interop_require_default(require("to-snake-case"));
13
+ const _getTableName = require("./schema/getTableName");
14
14
  const _upsertRow = require("./upsertRow");
15
- function _interop_require_default(obj) {
16
- return obj && obj.__esModule ? obj : {
17
- default: obj
18
- };
19
- }
20
15
  async function createVersion({ autosave, collectionSlug, parent, req = {}, versionData }) {
21
16
  const db = this.sessions[req.transactionID]?.db || this.drizzle;
22
17
  const collection = this.payload.collections[collectionSlug].config;
23
- const collectionTableName = (0, _tosnakecase.default)(collectionSlug);
24
- const tableName = `_${collectionTableName}_v`;
18
+ const tableName = (0, _getTableName.getTableName)({
19
+ adapter: this,
20
+ config: collection,
21
+ versions: true
22
+ });
25
23
  const result = await (0, _upsertRow.upsertRow)({
26
24
  adapter: this,
27
25
  data: {
@@ -33,23 +31,28 @@ async function createVersion({ autosave, collectionSlug, parent, req = {}, versi
33
31
  db,
34
32
  fields: (0, _versions.buildVersionCollectionFields)(collection),
35
33
  operation: 'create',
36
- tableName,
37
- req
34
+ req,
35
+ tableName
38
36
  });
39
37
  const table = this.tables[tableName];
40
- const relationshipsTable = this.tables[`${tableName}_rels`];
38
+ const relationshipsTable = this.tables[(0, _getTableName.getTableName)({
39
+ adapter: this,
40
+ config: collection,
41
+ relationships: true,
42
+ versions: true
43
+ })];
41
44
  if (collection.versions.drafts) {
42
45
  await db.execute((0, _drizzleorm.sql)`
43
- UPDATE ${table}
44
- SET latest = false
45
- FROM ${relationshipsTable}
46
- WHERE ${table.id} = ${relationshipsTable.parent}
47
- AND ${relationshipsTable.path} = ${'parent'}
48
- AND ${relationshipsTable[`${collectionSlug}ID`]} = ${parent}
49
- AND ${table.id} != ${result.id};
46
+ UPDATE ${table}
47
+ SET latest = false
48
+ FROM ${relationshipsTable}
49
+ WHERE ${table.id} = ${relationshipsTable.parent}
50
+ AND ${relationshipsTable.path} = ${'parent'}
51
+ AND ${relationshipsTable[`${collectionSlug}ID`]} = ${parent}
52
+ AND ${table.id} != ${result.id};
50
53
  `);
51
54
  }
52
55
  return result;
53
56
  }
54
57
 
55
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2V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FBRUUsbUJBQW1CO2NBQ3BCLEVBQUVGLE1BQU1PLEVBQUUsQ0FBQyxHQUFHLEVBQUVMLG1CQUFtQnpCLE1BQU0sQ0FBQztjQUMxQyxFQUFFeUIsbUJBQW1CTSxJQUFJLENBQUMsR0FBRyxFQUFFLFNBQVM7Y0FDeEMsRUFBRU4sa0JBQWtCLENBQUMsQ0FBQyxFQUFFMUIsZUFBZSxFQUFFLENBQUMsQ0FBQyxDQUFDLEdBQUcsRUFBRUMsT0FBTztjQUN4RCxFQUFFdUIsTUFBTU8sRUFBRSxDQUFDLElBQUksRUFBRWYsT0FBT2UsRUFBRSxDQUFDO0lBQ3JDLENBQUM7SUFDSDtJQUVBLE9BQU9mO0FBQ1QifQ==
@@ -9,17 +9,15 @@ Object.defineProperty(exports, "deleteMany", {
9
9
  }
10
10
  });
11
11
  const _drizzleorm = require("drizzle-orm");
12
- const _tosnakecase = /*#__PURE__*/ _interop_require_default(require("to-snake-case"));
13
12
  const _findMany = require("./find/findMany");
14
- function _interop_require_default(obj) {
15
- return obj && obj.__esModule ? obj : {
16
- default: obj
17
- };
18
- }
13
+ const _getTableName = require("./schema/getTableName");
19
14
  const deleteMany = async function deleteMany({ collection, req = {}, where }) {
20
15
  const db = this.sessions[req.transactionID]?.db || this.drizzle;
21
16
  const collectionConfig = this.payload.collections[collection].config;
22
- const tableName = (0, _tosnakecase.default)(collection);
17
+ const tableName = (0, _getTableName.getTableName)({
18
+ adapter: this,
19
+ config: collectionConfig
20
+ });
23
21
  const result = await (0, _findMany.findMany)({
24
22
  adapter: this,
25
23
  fields: collectionConfig.fields,
@@ -40,4 +38,4 @@ const deleteMany = async function deleteMany({ collection, req = {}, where }) {
40
38
  }
41
39
  };
42
40
 
43
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9kZWxldGVNYW55LnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB0eXBlIHsgRGVsZXRlT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SUFFekUsTUFBTU8sU0FBUyxNQUFNQyxJQUFBQSxrQkFBUSxFQUFDO1FBQzVCRixTQUFTLElBQUk7UUFDYkcsUUFBUVQsaUJBQWlCUyxNQUFNO1FBQy9CQyxPQUFPO1FBQ1BDLFFBQVFqQixJQUFJaUIsTUFBTTtRQUNsQkMsTUFBTTtRQUNOQyxZQUFZO1FBQ1puQjtRQUNBVTtRQUNBVDtJQUNGO0lBRUEsTUFBTW1CLE1BQU0sRUFBRTtJQUVkUCxPQUFPUSxJQUFJLENBQUNDLE9BQU8sQ0FBQyxDQUFDQztRQUNuQkgsSUFBSUksSUFBSSxDQUFDRCxLQUFLRSxFQUFFO0lBQ2xCO0lBRUEsSUFBSUwsSUFBSU0sTUFBTSxHQUFHLEdBQUc7UUFDbEIsTUFBTXhCLEdBQUd5QixNQUFNLENBQUMsSUFBSSxDQUFDQyxNQUFNLENBQUNsQixVQUFVLEVBQUVULEtBQUssQ0FBQzRCLElBQUFBLG1CQUFPLEVBQUMsSUFBSSxDQUFDRCxNQUFNLENBQUNsQixVQUFVLENBQUNlLEVBQUUsRUFBRUw7SUFDbkY7QUFDRiJ9
@@ -1 +1 @@
1
- {"version":3,"file":"deleteOne.d.ts","sourceRoot":"","sources":["../src/deleteOne.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAajD,eAAO,MAAM,SAAS,EAAE,SAsDvB,CAAA"}
1
+ {"version":3,"file":"deleteOne.d.ts","sourceRoot":"","sources":["../src/deleteOne.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAajD,eAAO,MAAM,SAAS,EAAE,SAyDvB,CAAA"}
package/dist/deleteOne.js CHANGED
@@ -9,10 +9,10 @@ Object.defineProperty(exports, "deleteOne", {
9
9
  }
10
10
  });
11
11
  const _drizzleorm = require("drizzle-orm");
12
- const _tosnakecase = /*#__PURE__*/ _interop_require_default(require("to-snake-case"));
13
12
  const _buildFindManyArgs = require("./find/buildFindManyArgs");
14
13
  const _buildQuery = /*#__PURE__*/ _interop_require_default(require("./queries/buildQuery"));
15
14
  const _selectDistinct = require("./queries/selectDistinct");
15
+ const _getTableName = require("./schema/getTableName");
16
16
  const _read = require("./transform/read");
17
17
  function _interop_require_default(obj) {
18
18
  return obj && obj.__esModule ? obj : {
@@ -22,7 +22,10 @@ function _interop_require_default(obj) {
22
22
  const deleteOne = async function deleteOne({ collection: collectionSlug, req = {}, where: whereArg }) {
23
23
  const db = this.sessions[req.transactionID]?.db || this.drizzle;
24
24
  const collection = this.payload.collections[collectionSlug].config;
25
- const tableName = (0, _tosnakecase.default)(collectionSlug);
25
+ const tableName = (0, _getTableName.getTableName)({
26
+ adapter: this,
27
+ config: collection
28
+ });
26
29
  let docToDelete;
27
30
  const { joinAliases, joins, selectFields, where } = await (0, _buildQuery.default)({
28
31
  adapter: this,
@@ -71,4 +74,4 @@ const deleteOne = async function deleteOne({ collection: collectionSlug, req = {
71
74
  return result;
72
75
  };
73
76
 
74
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9kZWxldGVPbmUudHMiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHR5cGUgeyBEZWxldGVPbmUgfSBmcm9tICdwYXlsb2FkL2RhdGFiYXNlJ1xuaW1wb3J0IHR5cGUgeyBQYXlsb2FkUmVxdWVzdCB9IGZyb20gJ3BheWxvYWQvdHlwZXMnXG5cbmltcG9ydCB7IGVxIH0gZnJvbSAnZHJpenpsZS1vcm0nXG5pbXBvcnQgdG9TbmFrZUNhc2UgZnJvbSAndG8tc25ha2UtY2FzZSdcblxuaW1wb3J0IHR5cGUgeyBQb3N0Z3Jlc0FkYXB0ZXIgfSBmcm9tICcuL3R5cGVzJ1xuXG5pbXBvcnQgeyBidWlsZEZpbmRNYW55QXJncyB9IGZyb20gJy4vZmluZC9idWlsZEZpbmRN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BQ0Y7UUFFQW9CLGFBQWE3QixLQUFLLEdBQUdBO1FBRXJCWSxjQUFjLE1BQU1WLEdBQUd1QixLQUFLLENBQUNoQixVQUFVLENBQUNpQixTQUFTLENBQUNHO0lBQ3BEO0lBRUEsTUFBTUcsU0FBU0MsSUFBQUEsZUFBUyxFQUFDO1FBQ3ZCekIsUUFBUSxJQUFJLENBQUNGLE9BQU8sQ0FBQ0UsTUFBTTtRQUMzQjBCLE1BQU10QjtRQUNOSyxRQUFRcEIsV0FBV29CLE1BQU07SUFDM0I7SUFFQSxNQUFNZixHQUFHaUMsTUFBTSxDQUFDLElBQUksQ0FBQ1AsTUFBTSxDQUFDbkIsVUFBVSxFQUFFVCxLQUFLLENBQUMyQixJQUFBQSxjQUFFLEVBQUMsSUFBSSxDQUFDQyxNQUFNLENBQUNuQixVQUFVLENBQUNlLEVBQUUsRUFBRVosWUFBWVksRUFBRTtJQUUxRixPQUFPUTtBQUNUIn0=
@@ -1 +1 @@
1
- {"version":3,"file":"deleteVersions.d.ts","sourceRoot":"","sources":["../src/deleteVersions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAWtD,eAAO,MAAM,cAAc,EAAE,cAiC5B,CAAA"}
1
+ {"version":3,"file":"deleteVersions.d.ts","sourceRoot":"","sources":["../src/deleteVersions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAWtD,eAAO,MAAM,cAAc,EAAE,cAqC5B,CAAA"}
@@ -10,17 +10,16 @@ Object.defineProperty(exports, "deleteVersions", {
10
10
  });
11
11
  const _drizzleorm = require("drizzle-orm");
12
12
  const _versions = require("payload/versions");
13
- const _tosnakecase = /*#__PURE__*/ _interop_require_default(require("to-snake-case"));
14
13
  const _findMany = require("./find/findMany");
15
- function _interop_require_default(obj) {
16
- return obj && obj.__esModule ? obj : {
17
- default: obj
18
- };
19
- }
14
+ const _getTableName = require("./schema/getTableName");
20
15
  const deleteVersions = async function deleteVersion({ collection, locale, req = {}, where: where }) {
21
16
  const db = this.sessions[req.transactionID]?.db || this.drizzle;
22
17
  const collectionConfig = this.payload.collections[collection].config;
23
- const tableName = `_${(0, _tosnakecase.default)(collection)}_v`;
18
+ const tableName = (0, _getTableName.getTableName)({
19
+ adapter: this,
20
+ config: collectionConfig,
21
+ versions: true
22
+ });
24
23
  const fields = (0, _versions.buildVersionCollectionFields)(collectionConfig);
25
24
  const { docs } = await (0, _findMany.findMany)({
26
25
  adapter: this,
@@ -43,4 +42,4 @@ const deleteVersions = async function deleteVersion({ collection, locale, req =
43
42
  return docs;
44
43
  };
45
44
 
46
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9kZWxldGVWZXJzaW9ucy50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgdHlwZSB7IERlbGV0ZVZlcnNpb25zIH0gZnJvbSAncGF5bG9hZC9kYXRhYmFzZSdcbmltcG9ydCB0eXBlIHsgUGF5bG9hZFJlcXVlc3QsIFNhbml0aXplZENvbGxlY3Rpb25Db25maWcgfSBmcm9tICdwYXlsb2FkL3R5cGVzJ1xuXG5pbXBvcnQgeyBpbkFycmF5IH0gZnJvbSAnZHJpenpsZS1vcm0nXG5pbXBvcnQgeyBidWlsZFZlcnNpb25Db2xsZWN0aW9uRmllbGRzIH0gZnJvbSAncGF5bG9hZC92ZXJzaW9ucydcbmltcG9ydCB0b1NuYWtlQ2FzZSBmcm9tICd0by1zbmFrZS1jYXNlJ1xuXG5pbXBvcnQgdHlwZSB7IFBvc3RncmVzQWRhcHRlciB9IGZyb20gJy4vdHlwZXMnXG5cbmltcG9ydCB7IGZpbmRNYW55IH0gZnJvbSAnLi9maW5kL2ZpbmRNYW55J1xuXG5leHBvcnQgY29uc3QgZGVsZXRlVmVyc2lvbnM6IERlbGV0ZVZlcnNpb25zID0gYXN5bmMgZnVuY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yxJQUFJLENBQUNDLFFBQVEsQ0FBQ0gsSUFBSUksYUFBYSxDQUFDLEVBQUVGLE1BQU0sSUFBSSxDQUFDRyxPQUFPO0lBQy9ELE1BQU1DLG1CQUE4QyxJQUFJLENBQUNDLE9BQU8sQ0FBQ0MsV0FBVyxDQUFDVixXQUFXLENBQUNXLE1BQU07SUFFL0YsTUFBTUMsWUFBWUMsSUFBQUEsMEJBQVksRUFBQztRQUM3QkMsU0FBUyxJQUFJO1FBQ2JILFFBQVFIO1FBQ1JPLFVBQVU7SUFDWjtJQUNBLE1BQU1DLFNBQVNDLElBQUFBLHNDQUE0QixFQUFDVDtJQUU1QyxNQUFNLEVBQUVVLElBQUksRUFBRSxHQUFHLE1BQU1DLElBQUFBLGtCQUFRLEVBQUM7UUFDOUJMLFNBQVMsSUFBSTtRQUNiRTtRQUNBSSxPQUFPO1FBQ1BuQjtRQUNBb0IsTUFBTTtRQUNOQyxZQUFZO1FBQ1pwQjtRQUNBVTtRQUNBVDtJQUNGO0lBRUEsTUFBTW9CLE1BQU0sRUFBRTtJQUVkTCxLQUFLTSxPQUFPLENBQUMsQ0FBQ0M7UUFDWkYsSUFBSUcsSUFBSSxDQUFDRCxJQUFJRSxFQUFFO0lBQ2pCO0lBRUEsSUFBSUosSUFBSUssTUFBTSxHQUFHLEdBQUc7UUFDbEIsTUFBTXhCLEdBQUd5QixNQUFNLENBQUMsSUFBSSxDQUFDQyxNQUFNLENBQUNsQixVQUFVLEVBQUVULEtBQUssQ0FBQzRCLElBQUFBLG1CQUFPLEVBQUMsSUFBSSxDQUFDRCxNQUFNLENBQUNsQixVQUFVLENBQUNlLEVBQUUsRUFBRUo7SUFDbkY7SUFFQSxPQUFPTDtBQUNUIn0=
@@ -41,7 +41,7 @@ const buildFindManyArgs = ({ adapter, depth, fields, tableName })=>{
41
41
  ]
42
42
  };
43
43
  }
44
- if (adapter.tables[`${tableName}_rels`]) {
44
+ if (adapter.tables[`${tableName}${adapter.relationshipsSuffix}`]) {
45
45
  result.with._rels = {
46
46
  columns: {
47
47
  id: false,
@@ -52,7 +52,7 @@ const buildFindManyArgs = ({ adapter, depth, fields, tableName })=>{
52
52
  ]
53
53
  };
54
54
  }
55
- if (adapter.tables[`${tableName}_locales`]) {
55
+ if (adapter.tables[`${tableName}${adapter.localesSuffix}`]) {
56
56
  result.with._locales = _locales;
57
57
  }
58
58
  (0, _traverseFields.traverseFields)({
@@ -69,4 +69,4 @@ const buildFindManyArgs = ({ adapter, depth, fields, tableName })=>{
69
69
  return result;
70
70
  };
71
71
 
72
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9maW5kL2J1aWxkRmluZE1hbnlBcmdzLnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB0eXBlIHsgREJRdWVyeUNvbmZpZyB9IGZyb20gJ2RyaXp6bGUtb3JtJ1xuaW1wb3J0IHR5cGUgeyBGaWVsZCB9IGZyb20gJ3BheWxvYWQvdHlwZXMnXG5cbmltcG9ydCB0eXBlIHsgUG9zdGdyZXNBZGFwdGVyIH0gZnJvbSAnLi4vdHlwZXMnXG5cbmltcG9ydCB7IHRyYXZlcnNlRmllbGRzIH0gZnJvbSAnLi90cmF2ZXJzZUZpZWxkcydcblxudHlwZSBCdWlsZEZpbmRRdWVyeUFyZ3MgPSB7XG4gIGFkYXB0ZXI6IFBvc3RncmVzQWRhcHRlclxuICBkZXB0aDogbnVtYmVyXG4gIGZpZWxkczogRmllbGRbXVxuICB0YWJsZU5hbWU6IHN0cmluZ1xufVxuXG5leHBvcnQgdHlwZSBSZXN1bHQgPSBEQlF1ZXJ5Q29uZmlnPCdtYW55JywgdHJ1ZSwgYW55LCBhbnk+XG5cbi8vIEdlbmVyYXRlIHRoZSBEcml6emxlIHF1ZXJ5IGZvciBmaW5kTWFueSBiYXNlZCBvblxuLy8gYSBjb2xsZWN0aW9uIGZpZWxkIHN0cnVjdHVyZVxuZXhwb3J0I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