@payloadcms/db-postgres 0.7.0 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (130) hide show
  1. package/dist/connect.js +1 -1
  2. package/dist/create.d.ts.map +1 -1
  3. package/dist/create.js +7 -9
  4. package/dist/createGlobal.d.ts +1 -1
  5. package/dist/createGlobal.d.ts.map +1 -1
  6. package/dist/createGlobal.js +8 -10
  7. package/dist/createGlobalVersion.d.ts +1 -1
  8. package/dist/createGlobalVersion.d.ts.map +1 -1
  9. package/dist/createGlobalVersion.js +12 -14
  10. package/dist/createMigration.js +1 -1
  11. package/dist/createVersion.d.ts.map +1 -1
  12. package/dist/createVersion.js +22 -19
  13. package/dist/deleteMany.js +6 -8
  14. package/dist/deleteOne.d.ts.map +1 -1
  15. package/dist/deleteOne.js +46 -16
  16. package/dist/deleteVersions.d.ts.map +1 -1
  17. package/dist/deleteVersions.js +7 -8
  18. package/dist/destroy.js +1 -1
  19. package/dist/find/buildFindManyArgs.js +3 -3
  20. package/dist/find/chainMethods.d.ts +3 -2
  21. package/dist/find/chainMethods.d.ts.map +1 -1
  22. package/dist/find/chainMethods.js +1 -1
  23. package/dist/find/findMany.d.ts.map +1 -1
  24. package/dist/find/findMany.js +33 -55
  25. package/dist/find/traverseFields.d.ts.map +1 -1
  26. package/dist/find/traverseFields.js +23 -11
  27. package/dist/find.d.ts.map +1 -1
  28. package/dist/find.js +10 -11
  29. package/dist/findGlobal.d.ts.map +1 -1
  30. package/dist/findGlobal.js +7 -9
  31. package/dist/findGlobalVersions.d.ts.map +1 -1
  32. package/dist/findGlobalVersions.js +7 -8
  33. package/dist/findOne.d.ts +1 -1
  34. package/dist/findOne.d.ts.map +1 -1
  35. package/dist/findOne.js +9 -10
  36. package/dist/findVersions.d.ts.map +1 -1
  37. package/dist/findVersions.js +7 -8
  38. package/dist/index.d.ts.map +1 -1
  39. package/dist/index.js +5 -1
  40. package/dist/init.d.ts.map +1 -1
  41. package/dist/init.js +28 -15
  42. package/dist/migrate.js +1 -1
  43. package/dist/migrateDown.js +1 -1
  44. package/dist/migrateFresh.js +1 -1
  45. package/dist/migrateRefresh.js +1 -1
  46. package/dist/migrateReset.js +1 -1
  47. package/dist/migrateStatus.js +1 -1
  48. package/dist/queries/buildAndOrConditions.js +1 -1
  49. package/dist/queries/buildQuery.js +1 -1
  50. package/dist/queries/createJSONQuery/convertPathToJSONTraversal.js +1 -1
  51. package/dist/queries/createJSONQuery/formatJSONPathSegment.js +1 -1
  52. package/dist/queries/createJSONQuery/index.js +1 -1
  53. package/dist/queries/getTableColumnFromPath.d.ts.map +1 -1
  54. package/dist/queries/getTableColumnFromPath.js +148 -42
  55. package/dist/queries/operatorMap.js +1 -1
  56. package/dist/queries/parseParams.js +1 -1
  57. package/dist/queries/sanitizeQueryValue.d.ts.map +1 -1
  58. package/dist/queries/sanitizeQueryValue.js +5 -2
  59. package/dist/queries/selectDistinct.d.ts +23 -0
  60. package/dist/queries/selectDistinct.d.ts.map +1 -0
  61. package/dist/queries/selectDistinct.js +49 -0
  62. package/dist/queryDrafts.d.ts.map +1 -1
  63. package/dist/queryDrafts.js +7 -8
  64. package/dist/schema/build.d.ts +2 -1
  65. package/dist/schema/build.d.ts.map +1 -1
  66. package/dist/schema/build.js +19 -14
  67. package/dist/schema/createIndex.js +1 -1
  68. package/dist/schema/getTableName.d.ts +32 -0
  69. package/dist/schema/getTableName.d.ts.map +1 -0
  70. package/dist/schema/getTableName.js +43 -0
  71. package/dist/schema/idToUUID.js +1 -1
  72. package/dist/schema/parentIDColumnMap.js +1 -1
  73. package/dist/schema/setColumnID.js +1 -1
  74. package/dist/schema/traverseFields.d.ts +2 -1
  75. package/dist/schema/traverseFields.d.ts.map +1 -1
  76. package/dist/schema/traverseFields.js +55 -17
  77. package/dist/schema/validateExistingBlockIsIdentical.d.ts +2 -1
  78. package/dist/schema/validateExistingBlockIsIdentical.d.ts.map +1 -1
  79. package/dist/schema/validateExistingBlockIsIdentical.js +12 -6
  80. package/dist/transactions/beginTransaction.js +1 -1
  81. package/dist/transactions/commitTransaction.js +1 -1
  82. package/dist/transactions/rollbackTransaction.js +1 -1
  83. package/dist/transform/read/hasManyNumber.js +1 -1
  84. package/dist/transform/read/hasManyText.js +1 -1
  85. package/dist/transform/read/index.js +1 -1
  86. package/dist/transform/read/relationship.js +1 -1
  87. package/dist/transform/read/traverseFields.js +1 -1
  88. package/dist/transform/write/array.js +1 -1
  89. package/dist/transform/write/blocks.d.ts +2 -2
  90. package/dist/transform/write/blocks.d.ts.map +1 -1
  91. package/dist/transform/write/blocks.js +4 -4
  92. package/dist/transform/write/index.js +1 -1
  93. package/dist/transform/write/numbers.js +1 -1
  94. package/dist/transform/write/relationships.js +1 -1
  95. package/dist/transform/write/selects.js +1 -1
  96. package/dist/transform/write/texts.js +1 -1
  97. package/dist/transform/write/traverseFields.d.ts +2 -2
  98. package/dist/transform/write/traverseFields.d.ts.map +1 -1
  99. package/dist/transform/write/traverseFields.js +34 -25
  100. package/dist/transform/write/types.js +1 -1
  101. package/dist/types.d.ts +13 -0
  102. package/dist/types.d.ts.map +1 -1
  103. package/dist/types.js +1 -1
  104. package/dist/update.d.ts.map +1 -1
  105. package/dist/update.js +26 -48
  106. package/dist/updateGlobal.d.ts +1 -1
  107. package/dist/updateGlobal.d.ts.map +1 -1
  108. package/dist/updateGlobal.js +9 -11
  109. package/dist/updateGlobalVersion.d.ts.map +1 -1
  110. package/dist/updateGlobalVersion.js +9 -5
  111. package/dist/updateVersion.d.ts.map +1 -1
  112. package/dist/updateVersion.js +9 -5
  113. package/dist/upsertRow/deleteExistingArrayRows.js +1 -1
  114. package/dist/upsertRow/deleteExistingRowsByPath.js +1 -1
  115. package/dist/upsertRow/index.d.ts.map +1 -1
  116. package/dist/upsertRow/index.js +7 -6
  117. package/dist/upsertRow/insertArrays.d.ts.map +1 -1
  118. package/dist/upsertRow/insertArrays.js +3 -3
  119. package/dist/upsertRow/types.d.ts +1 -1
  120. package/dist/upsertRow/types.d.ts.map +1 -1
  121. package/dist/upsertRow/types.js +1 -1
  122. package/dist/utilities/appendPrefixToKeys.js +1 -1
  123. package/dist/utilities/createBlocksMap.js +1 -1
  124. package/dist/utilities/createMigrationTable.js +1 -1
  125. package/dist/utilities/createRelationshipMap.js +1 -1
  126. package/dist/utilities/hasLocalesTable.js +1 -1
  127. package/dist/utilities/isArrayOfRows.js +1 -1
  128. package/dist/utilities/migrationTableExists.js +1 -1
  129. package/dist/utilities/parseError.js +1 -1
  130. package/package.json +8 -4
@@ -10,6 +10,7 @@ Object.defineProperty(exports, "traverseFields", {
10
10
  });
11
11
  const _types = require("payload/types");
12
12
  const _tosnakecase = /*#__PURE__*/ _interop_require_default(require("to-snake-case"));
13
+ const _getTableName = require("../../schema/getTableName");
13
14
  const _isArrayOfRows = require("../../utilities/isArrayOfRows");
14
15
  const _array = require("./array");
15
16
  const _blocks = require("./blocks");
@@ -22,13 +23,18 @@ function _interop_require_default(obj) {
22
23
  default: obj
23
24
  };
24
25
  }
25
- const traverseFields = ({ adapter, arrays, baseTableName, blocks, blocksToDelete, columnPrefix, data, existingLocales, fieldPrefix, fields, forcedLocale, locales, texts, numbers, parentTableName, path, relationships, relationshipsToDelete, row, selects })=>{
26
+ const traverseFields = ({ adapter, arrays, baseTableName, blocks, blocksToDelete, columnPrefix, data, existingLocales, fieldPrefix, fields, forcedLocale, locales, numbers, parentTableName, path, relationships, relationshipsToDelete, row, selects, texts })=>{
26
27
  fields.forEach((field)=>{
27
28
  let columnName = '';
28
29
  let fieldName = '';
29
30
  let fieldData;
30
31
  if ((0, _types.fieldAffectsData)(field)) {
31
- columnName = `${columnPrefix || ''}${(0, _tosnakecase.default)(field.name)}`;
32
+ columnName = `${columnPrefix || ''}${(0, _getTableName.getTableName)({
33
+ adapter,
34
+ config: field,
35
+ // do not pass columnPrefix here because it is required and custom dbNames also need it
36
+ prefix: ''
37
+ })}`;
32
38
  fieldName = `${fieldPrefix || ''}${field.name}`;
33
39
  fieldData = data[field.name];
34
40
  }
@@ -48,12 +54,12 @@ const traverseFields = ({ adapter, arrays, baseTableName, blocks, blocksToDelete
48
54
  data: localeData,
49
55
  field,
50
56
  locale: localeKey,
51
- texts,
52
57
  numbers,
53
58
  path,
54
59
  relationships,
55
60
  relationshipsToDelete,
56
- selects
61
+ selects,
62
+ texts
57
63
  });
58
64
  arrays[arrayTableName] = arrays[arrayTableName].concat(newRows);
59
65
  }
@@ -68,20 +74,23 @@ const traverseFields = ({ adapter, arrays, baseTableName, blocks, blocksToDelete
68
74
  blocksToDelete,
69
75
  data: data[field.name],
70
76
  field,
71
- texts,
72
77
  numbers,
73
78
  path,
74
79
  relationships,
75
80
  relationshipsToDelete,
76
- selects
81
+ selects,
82
+ texts
77
83
  });
78
84
  arrays[arrayTableName] = arrays[arrayTableName].concat(newRows);
79
85
  }
80
86
  return;
81
87
  }
82
88
  if (field.type === 'blocks') {
83
- field.blocks.forEach(({ slug })=>{
84
- blocksToDelete.add((0, _tosnakecase.default)(slug));
89
+ field.blocks.forEach((block)=>{
90
+ blocksToDelete.add((0, _getTableName.getTableName)({
91
+ adapter,
92
+ config: block
93
+ }));
85
94
  });
86
95
  if (field.localized) {
87
96
  if (typeof data[field.name] === 'object' && data[field.name] !== null) {
@@ -95,12 +104,12 @@ const traverseFields = ({ adapter, arrays, baseTableName, blocks, blocksToDelete
95
104
  data: localeData,
96
105
  field,
97
106
  locale: localeKey,
98
- texts,
99
107
  numbers,
100
108
  path,
101
109
  relationships,
102
110
  relationshipsToDelete,
103
- selects
111
+ selects,
112
+ texts
104
113
  });
105
114
  }
106
115
  });
@@ -113,12 +122,12 @@ const traverseFields = ({ adapter, arrays, baseTableName, blocks, blocksToDelete
113
122
  blocksToDelete,
114
123
  data: fieldData,
115
124
  field,
116
- texts,
117
125
  numbers,
118
126
  path,
119
127
  relationships,
120
128
  relationshipsToDelete,
121
- selects
129
+ selects,
130
+ texts
122
131
  });
123
132
  }
124
133
  return;
@@ -140,14 +149,14 @@ const traverseFields = ({ adapter, arrays, baseTableName, blocks, blocksToDelete
140
149
  fields: field.fields,
141
150
  forcedLocale: localeKey,
142
151
  locales,
143
- texts,
144
152
  numbers,
145
153
  parentTableName,
146
154
  path: `${path || ''}${field.name}.`,
147
155
  relationships,
148
156
  relationshipsToDelete,
149
157
  row,
150
- selects
158
+ selects,
159
+ texts
151
160
  });
152
161
  });
153
162
  } else {
@@ -163,14 +172,14 @@ const traverseFields = ({ adapter, arrays, baseTableName, blocks, blocksToDelete
163
172
  fieldPrefix: `${fieldName}_`,
164
173
  fields: field.fields,
165
174
  locales,
166
- texts,
167
175
  numbers,
168
176
  parentTableName,
169
177
  path: `${path || ''}${field.name}.`,
170
178
  relationships,
171
179
  relationshipsToDelete,
172
180
  row,
173
- selects
181
+ selects,
182
+ texts
174
183
  });
175
184
  }
176
185
  }
@@ -195,14 +204,14 @@ const traverseFields = ({ adapter, arrays, baseTableName, blocks, blocksToDelete
195
204
  fields: tab.fields,
196
205
  forcedLocale: localeKey,
197
206
  locales,
198
- texts,
199
207
  numbers,
200
208
  parentTableName,
201
209
  path: `${path || ''}${tab.name}.`,
202
210
  relationships,
203
211
  relationshipsToDelete,
204
212
  row,
205
- selects
213
+ selects,
214
+ texts
206
215
  });
207
216
  });
208
217
  } else {
@@ -218,14 +227,14 @@ const traverseFields = ({ adapter, arrays, baseTableName, blocks, blocksToDelete
218
227
  fieldPrefix: `${fieldPrefix || ''}${tab.name}_`,
219
228
  fields: tab.fields,
220
229
  locales,
221
- texts,
222
230
  numbers,
223
231
  parentTableName,
224
232
  path: `${path || ''}${tab.name}.`,
225
233
  relationships,
226
234
  relationshipsToDelete,
227
235
  row,
228
- selects
236
+ selects,
237
+ texts
229
238
  });
230
239
  }
231
240
  }
@@ -242,14 +251,14 @@ const traverseFields = ({ adapter, arrays, baseTableName, blocks, blocksToDelete
242
251
  fieldPrefix,
243
252
  fields: tab.fields,
244
253
  locales,
245
- texts,
246
254
  numbers,
247
255
  parentTableName,
248
256
  path,
249
257
  relationships,
250
258
  relationshipsToDelete,
251
259
  row,
252
- selects
260
+ selects,
261
+ texts
253
262
  });
254
263
  }
255
264
  });
@@ -267,14 +276,14 @@ const traverseFields = ({ adapter, arrays, baseTableName, blocks, blocksToDelete
267
276
  fieldPrefix,
268
277
  fields: field.fields,
269
278
  locales,
270
- texts,
271
279
  numbers,
272
280
  parentTableName,
273
281
  path,
274
282
  relationships,
275
283
  relationshipsToDelete,
276
284
  row,
277
- selects
285
+ selects,
286
+ texts
278
287
  });
279
288
  }
280
289
  if (field.type === 'relationship' || field.type === 'upload') {
@@ -440,4 +449,4 @@ const traverseFields = ({ adapter, arrays, baseTableName, blocks, blocksToDelete
440
449
  });
441
450
  };
442
451
 
443
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy90cmFuc2Zvcm0vd3JpdGUvdHJhdmVyc2VGaWVsZHMudHMiXSwic291cmNlc0NvbnRlbnQiOlsiLyogZXNsaW50LWRpc2FibGUgbm8tcGFyYW0tcmVhc3NpZ24gKi9cbmltcG9ydCB0eXBlIHsgRmllbGQgfSBmcm9tICdwYXlsb2FkL3R5cGVzJ1xuXG5pbXBvcnQgeyBmaWVsZEFmZmVjdHNEYXRhIH0gZnJvbSAncGF5bG9hZC90eXBlcydcbmltcG9ydCB0b1NuYWtlQ2FzZSBmcm9tICd0by1zbmFrZS1jYXNlJ1xuXG5pbXBvcnQgdHlwZSB7IFBvc3RncmVzQWRhcHRlciB9IGZyb20gJy4uLy4uL3R5cGVzJ1xuaW1wb3J0IHR5cGUgeyBBcnJheVJvd1RvSW5zZXJ0LCBCbG9ja1Jvd1RvSW5zZXJ0LCBSZWxhdGlvbnNoaXBUb0RlbGV0ZSB9IGZyb20gJy4vdHlwZXMnXG5cbmltcG9ydCB7IGlzQXJyYXlPZlJvd3MgfSBmcm9tICcuLi8uLi91dGlsaXRpZXMvaXNBcnJheU9mUm93cydcbmltcG9ydCB7IHRyYW5zZm9ybUFycmF5IH0gZnJvbSAnL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nN0IG5ld1Jvd3MgPSB0cmFuc2Zvcm1BcnJheSh7XG4gICAgICAgICAgICAgICAgYWRhcHRlcixcbiAgICAgICAgICAgICAgICBhcnJheVRhYmxlTmFtZSxcbiAgICAgICAgICAgICAgICBiYXNlVGFibGVOYW1lLFxuICAgICAgICAgICAgICAgIGJsb2NrcyxcbiAgICAgICAgICAgICAgICBibG9ja3NUb0RlbGV0ZSxcbiAgICAgICAgICAgICAgICBkYXRhOiBsb2NhbGVEYXRhLFxuICAgICAgICAgICAgICAgIGZpZWxkLFxuICAgICAgICAgICAgICAgIGxvY2FsZTogbG9jYWxlS2V5LFxuICAgICAgICAgICAgICAgIHRleHRzLFxuICAgICAgICAgICAgICAgIG51bWJlcnMsXG4gICAgICAgICAgICAgICAgcGF0aCxcbiAgICAgICAgICAgICAgICByZWxhdGlvbnNoaXBzLFxuICAgICAgICAgICAgICAgIHJlbGF0aW9uc2hpcHNUb0RlbGV0ZSxcbiAgICAgICAgICAgICAgICBzZWxlY3RzLFxuICAgICAgICAgICAgICB9KVxuXG4gICAgICAgICAgICAgIGFycmF5c1thcnJheVRhYmxlTmFtZV0gPSBhcnJheXNbYXJyYXlUYWJsZU5hbWVdLmNvbmNhdChuZXdSb3dzKVxuICAgICAgICAgICAgfVxuICAgICAgICAgIH0pXG4gICAgICAgIH1cbiAgICAgIH0gZWxzZSB7XG4gICAgICAgIGNvbnN0IG5ld1Jvd3MgPSB0cmFuc2Zvcm1BcnJheSh7XG4gICAgICAgICAgYWRhcHRlcixcbiAgICAgICAgICBhcnJheVRhYmxlTmFtZSxcbiAgICAgICAgICBiYXNlVGFibGVOYW1lLFxuICAgICAgICAgIGJsb2NrcyxcbiAgICAgICAgICBibG9ja3NUb0RlbGV0ZSxcbiAgICAgICAgICBkYXRhOiBkYXRhW2ZpZWxkLm5hbWVdLFxuICAgICAgICAgIGZpZWxkLFxuICAgICAgICAgIHRleHRzLFxuICAgICAgICAgIG51bWJlcnMsXG4gICAgICAgICAgcGF0aCxcbiAgICAgICAgICByZWxhdGlvbnNoaXBzLFxuICAgICAgICAgIHJlbGF0aW9uc2hpcHNUb0RlbGV0ZSxcbiAgICAgICAgICBzZWxlY3RzLFxuICAgICAgICB9KVxuXG4gICAgICAgIGFycmF5c1thcnJheVRhYmxlTmFtZV0gPSBhcnJheXNbYXJyYXlUYWJsZU5hbWVdLmNvbmNhdChuZXdSb3dzKVxuICAgICAgfVxuXG4gICAgICByZXR1cm5cbiAgICB9XG5cbiAgICBpZiAoZmllbGQudHlwZSA9PT0gJ2Jsb2NrcycpIHtcbiAgICAgIGZpZWxkLmJsb2Nrcy5mb3JFYWNoKCh7IHNsdWcgfSkgPT4ge1xuICAgICAgICBibG9ja3NUb0RlbGV0ZS5hZGQodG9TbmFrZUNhc2Uoc2x1ZykpXG4gICAgICB9KVxuXG4gICAgICBpZiAoZmllbGQubG9jYWxpemVkKSB7XG4gICAgICAgIGlmICh0eXBlb2YgZGF0YVtmaWVsZC5uYW1lXSA9PT0gJ29iamVjdCcgJiYgZGF0YVtmaWVsZC5uYW1lXSAhPT0gbnVsbCkge1xuICAgICAgICAgIE9iamVjdC5lbnRyaWVzKGRhdGFbZmllbGQubmFtZV0pLmZvckVhY2goKFtsb2NhbGVLZXksIGxvY2FsZURhdGFdKSA9PiB7XG4gICAgICAgICAgICBpZiAoQXJyYXkuaXNBcnJheShsb2NhbGVEYXRhKSkge1xuICAgICAgICAgICAgICB0cmFuc2Zvcm1CbG9ja3Moe1xuICAgICAgICAgICAgICAgIGFkYXB0ZXIsXG4gICAgICAgICAgICAgICAgYmFzZVRhYmxlTmFtZSxcbiAgICAgICAgICAgICAgICBibG9ja3MsXG4gICAgICAgICAgICAgICAgYmxvY2tzVG9EZWxldGUsXG4gICAgICAgICAgICAgICAgZGF0YTogbG9jYWxlRGF0YSxcbiAgICAgICAgICAgICAgICBmaWVsZCxcbiAgICAgICAgICAgICAgICBsb2NhbGU6IGxvY2FsZUtleSxcbiAgICAgICAgICAgICAgICB0ZXh0cyxcbiAgICAgICAgICAgICAgICBudW1iZXJzLFxuICAgICAgICAgICAgICAgIHBhdGgsXG4gICAgICAgICAgICAgICAgcmVsYXRpb25zaGlwcyxcbiAgICAgICAgICAgICAgICByZWxhdGlvbnNoaXBzVG9EZWxldGUsXG4gICAgICAgICAgICAgICAgc2VsZWN0cyxcbiAgICAgICAgICAgICAgfSlcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9KVxuICAgICAgICB9XG4gICAgICB9IGVsc2UgaWYgKGlzQXJyYXlPZlJvd3MoZmllbGREYXRhKSkge1xuICAgICAgICB0cmFuc2Zvcm1CbG9ja3Moe1xuICAgICAgICAgIGFkYXB0ZXIsXG4gICAgICAgICAgYmFzZVRhYmxlTmFtZSxcbiAgICAgICAgICBibG9ja3MsXG4gICAgICAgICAgYmxvY2tzVG9EZWxldGUsXG4gICAgICAgICAgZGF0YTogZmllbGREYXRhLFxuICAgICAgICAgIGZpZWxkLFxuICAgICAgICAgIHRleHRzLFxuICAgICAgICAgIG51bWJlcnMsXG4gICAgICAgICAgcGF0aCxcbiAgICAgICAgICByZWxhdGlvbnNoaXBzLFxuICAgICAgICAgIHJlbGF0aW9uc2hpcHNUb0RlbGV0ZSxcbiAgICAgICAgICBzZWxlY3RzLFxuICAgICAgICB9KVxuICAgICAgfVxuXG4gICAgICByZXR1cm5cbiAgICB9XG5cbiAgICBpZiAoZmllbGQudHlwZSA9PT0gJ2dyb3VwJykge1xuICAgICAgaWYgKHR5cGVvZiBkYXRhW2ZpZWxkLm5hbWVdID09PSAnb2JqZWN0JyAmJiBkYXRhW2ZpZWxkLm5hbWVdICE9PSBudWxsKSB7XG4gICAgICAgIGlmIChmaWVsZC5sb2NhbGl6ZWQpIHtcbiAgICAgICAgICBPYmplY3QuZW50cmllcyhkYXRhW2ZpZWxkLm5hbWVdKS5mb3JFYWNoKChbbG9jYWxlS2V5LCBsb2NhbGVEYXRhXSkgPT4ge1xuICAgICAgICAgICAgdHJhdmVyc2VGaWVsZHMoe1xuICAgICAgICAgICAgICBhZGFwdGVyLFxuICAgICAgICAgICAgICBhcnJheXMsXG4gICAgICAgICAgICAgIGJhc2VUYWJsZU5hbWUsXG4gICAgICAgICAgICAgIGJsb2NrcyxcbiAgICAgICAgICAgICAgYmxvY2tzVG9EZWxldGUsXG4gICAgICAgICAgICAgIGNvbHVtblByZWZpeDogYCR7Y29sdW1uTmFtZX1fYCxcbiAgICAgICAgICAgICAgZGF0YTogbG9jYWxlRGF0YSBhcyBSZWNvcmQ8c3RyaW5nLCB1bmtub3duPixcbiAgICAgICAgICAgICAgZXhpc3RpbmdMb2NhbGVzLFxuICAgICAgICAgICAgICBmaWVsZFByZWZpeDogYCR7ZmllbGROYW1lfV9gLFxuICAgICAgICAgICAgICBmaWVsZHM6IGZpZWxkLmZpZWxkcyxcbiAgICAgICAgICAgICAgZm9yY2VkTG9jYWxlOiBsb2NhbGVLZXksXG4gICAgICAgICAgICAgIGxvY2FsZXMsXG4gICAgICAgICAgICAgIHRleHRzLFxuICAgICAgICAgICAgICBudW1iZXJzLFxuICAgICAgICAgICAgICBwYXJlbnRUYWJsZU5hbWUsXG4gICAgICAgICAgICAgIHBhdGg6IGAke3BhdGggfHwgJyd9JHtmaWVsZC5uYW1lfS5gLFxuICAgICAgICAgICAgICByZWxhdGlvbnNoaXBzLFxuICAgICAgICAgICAgICByZWxhdGlvbnNoaXBzVG9EZWxldGUsXG4gICAgICAgICAgICAgIHJvdyxcbiAgICAgICAgICAgICAgc2VsZWN0cyxcbiAgICAgICAgICAgIH0pXG4gICAgICAgICAgfSlcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICB0cmF2ZXJzZUZpZWxkcyh7XG4gICAgICAgICAgICBhZGFwdGVyLFxuICAgICAgICAgICAgYXJyYXlzLFxuICAgICAgICAgICAgYmFzZVRhYmxlTmFtZSxcbiAgICAgICAgICAgIGJsb2NrcyxcbiAgICAgICAgICAgIGJsb2Nrc1RvRGVsZXRlLFxuICAgICAgICAgICAgY29sdW1uUHJlZml4OiBgJHtjb2x1bW5OYW1lfV9gLFxuICAgICAgICAgICAgZGF0YTogZGF0YVtmaWVsZC5uYW1lXSBhcyBSZWNvcmQ8c3RyaW5nLCB1bmtub3duPixcbiAgICAgICAgICAgIGV4aXN0aW5nTG9jYWxlcyxcbiAgICAgICAgICAgIGZpZWxkUHJlZml4OiBgJHtmaWVsZE5hbWV9X2AsXG4gICAgICAgICAgICBmaWVsZHM6IGZpZWxkLmZpZWxkcyxcbiAgICAgICAgICAgIGxvY2FsZXMsXG4gICAgICAgICAgICB0ZXh0cyxcbiAgICAgICAgICAgIG51bWJlcnMsXG4gICAgICAgICAgICBwYXJlbnRUYWJsZU5hbWUsXG4gICAgICAgICAgICBwYXRoOiBgJHtwYXRoIHx8ICcnfSR7ZmllbGQubmFtZX0uYCxcbiAgICAgICAgICAgIHJlbGF0aW9uc2hpcHMsXG4gICAgICAgICAgICByZWxhdGlvbnNoaXBzVG9EZWxldGUsXG4gICAgICAgICAgICByb3csXG4gICAgICAgICAgICBzZWxlY3RzLFxuICAgICAgICAgIH0pXG4gICAgICAgIH1cbiAgICAgIH1cblxuICAgICAgcmV0dXJuXG4gICAgfVxuXG4gICAgaWYgKGZpZWxkLnR5cGUgPT09ICd0YWJzJykge1xuICAgICAgZmllbGQudGFicy5mb3JFYWNoKCh0YWIpID0+IHtcbiAgICAgICAgaWYgKCduYW1lJyBpbiB0YWIpIHtcbiAgICAgICAgICBpZiAodHlwZW9mIGRhdGFbdGFiLm5hbWVdID09PSAnb2JqZWN0JyAmJiBkYXRhW3RhYi5uYW1lXSAhPT0gbnVsbCkge1xuICAgICAgICAgICAgaWYgKHRhYi5sb2NhbGl6ZWQpIHtcbiAgICAgICAgICAgICAgT2JqZWN0LmVudHJpZXMoZGF0YVt0YWIubmFtZV0pLmZvckVhY2goKFtsb2NhbGVLZXksIGxvY2FsZURhdGFdKSA9PiB7XG4gICAgICAgICAgICAgICAgdHJhdmVyc2VGaWVsZHMoe1xuICAgICAgICAgICAgICAgICAgYWRhcHRlcixcbiAgICAgICAgICAgICAgICAgIGFycmF5cyxcbiAgICAgICAgICAgICAgICAgIGJhc2VUYWJsZU5hbWUsXG4gICAgICAgICAgICAgICAgICBibG9ja3MsXG4gICAgICAgICAgICAgICAgICBibG9ja3NUb0RlbGV0ZSxcbiAgICAgICAgICAgICAgICAgIGNvbHVtblByZWZpeDogYCR7Y29sdW1uUHJlZml4IHx8ICcnfSR7dG9TbmFrZUNhc2UodGFiLm5hbWUpfV9gLFxuICAgICAgICAgICAgICAgICAgZGF0YTogbG9jYWxlRGF0YSBhcyBSZWNvcmQ8c3RyaW5nLCB1bmtub3duPixcbiAgICAgICAgICAgICAgICAgIGV4aXN0aW5nTG9jYWxlcyxcbiAgICAgICAgICAgICAgICAgIGZpZWxkUHJlZml4OiBgJHtmaWVsZFByZWZpeCB8fCAnJ30ke3RhYi5uYW1lfV9gLFxuICAgICAgICAgICAgICAgICAgZmllbGRzOiB0YWIuZmllbGRzLFxuICAgICAgICAgICAgICAgICAgZm9yY2VkTG9jYWxlOiBsb2NhbGVLZXksXG4gICAgICAgICAgICAgICAgICBsb2NhbGVzLFxuICAgICAgICAgICAgICAgICAgdGV4dHMsXG4gICAgICAgICAgICAgICAgICBudW1iZXJzLFxuICAgICAgICAgICAgICAgICAgcGFyZW50VGFibGVOYW1lLFxuICAgICAgICAgICAgICAgICAgcGF0aDogYCR7cGF0aCB8fCAnJ30ke3RhYi5uYW1lfS5gLFxuICAgICAgICAgICAgICAgICAgcmVsYXRpb25zaGlwcyxcbiAgICAgICAgICAgICAgICAgIHJlbGF0aW9uc2hpcHNUb0RlbGV0ZSxcbiAgICAgICAgICAgICAgICAgIHJvdyxcbiAgICAgICAgICAgICAgICAgIHNlbGVjdHMsXG4gICAgICAgICAgICAgICAgfSlcbiAgICAgICAgICAgICAgfSlcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgIHRyYXZlcnNlRmllbGRzKHtcbiAgICAgICAgICAgICAgICBhZGFwdGVyLFxuICAgICAgICAgICAgICAgIGFycmF5cyxcbiAgICAgICAgICAgICAgICBiYXNlVGFibGVOYW1lLFxuICAgICAgICAgICAgICAgIGJsb2NrcyxcbiAgICAgICAgICAgICAgICBibG9ja3NUb0RlbGV0ZSxcbiAgICAgICAgICAgICAgICBjb2x1bW5QcmVmaXg6IGAke2NvbHVtblByZWZpeCB8fCAnJ30ke3RvU25ha2VDYXNlKHRhYi5uYW1lKX1fYCxcbiAgICAgICAgICAgICAgICBkYXRhOiBkYXRhW3RhYi5uYW1lXSBhcyBSZWNvcmQ8c3RyaW5nLCB1bmtub3duPixcbiAgICAgICAgICAgICAgICBleGlzdGluZ0xvY2FsZXMsXG4gICAgICAgICAgICAgICAgZmllbGRQcmVmaXg6IGAke2ZpZWxkUHJlZml4IHx8ICcnfSR7dGFiLm5hbWV9X2AsXG4gICAgICAgICAgICAgICAgZmllbGRzOiB0YWIuZmllbGRzLFxuICAgICAgICAgICAgICAgIGxvY2FsZXMsXG4gICAgICAgICAgICAgICAgdGV4dHMsXG4gICAgICAgICAgICAgICAgbnVtYmVycyxcbiAgICAgICAgICAgICAgICBwYXJlbnRUYWJsZU5hbWUsXG4gICAgICAgICAgICAgICAgcGF0aDogYCR7cGF0aCB8fCAnJ30ke3RhYi5uYW1lfS5gLFxuICAgICAgICAgICAgICAgIHJlbGF0aW9uc2hpcHMsXG4gICAgICAgICAgICAgICAgcmVsYXRpb25zaGlwc1RvRGVsZXRlLFxuICAgICAgICAgICAgICAgIHJvdyxcbiAgICAgICAgICAgICAgICBzZWxlY3RzLFxuICAgICAgICAgICAgICB9KVxuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICB0cmF2ZXJzZUZpZWxkcyh7XG4gICAgICAgICAgICBhZGFwdGVyLFxuICAgICAgICAgICAgYXJyYXlzLFxuICAgICAgICAgICAgYmFzZVRhYmxlTmFtZSxcbiAgICAgICAgICAgIGJsb2NrcyxcbiAgICAgICAgICAgIGJsb2Nrc1RvRGVsZXRlLFxuICAgICAgICAgICAgY29sdW1uUHJlZml4LFxuICAgICAgICAgICAgZGF0YSxcbiAgICAgICAgICAgIGV4aXN0aW5nTG9jYWxlcyxcbiAgICAgICAgICAgIGZpZWxkUHJlZml4LFxuICAgICAgICAgICAgZmllbGRzOiB0YWIuZmllbGRzLFxuICAgICAgICAgICAgbG9jYWxlcyxcbiAgICAgICAgICAgIHRleHRzLFxuICAgICAgICAgICAgbnVtYmVycyxcbiAgICAgICAgICAgIHBhcmVudFRhYmxlTmFtZSxcbiAgICAgICAgICAgIHBhdGgsXG4gICAgICAgICAgICByZWxhdGlvbnNoaXBzLFxuICAgICAgICAgICAgcmVsYXRpb25zaGlwc1RvRGVsZXRlLFxuICAgICAgICAgICAgcm93LFxuICAgICAgICAgICAgc2VsZWN0cyxcbiAgICAgICAgICB9KVxuICAgICAgICB9XG4gICAgICB9KVxuICAgIH1cblxuICAgIGlmIChmaWVsZC50eXBlID09PSAncm93JyB8fCBmaWVsZC50eXBlID09PSAnY29sbGFwc2libGUnKSB7XG4gICAgICB0cmF2ZXJzZUZpZWxkcyh7XG4gICAgICAgIGFkYXB0ZXIsXG4gICAgICAgIGFycmF5cyxcbiAgICAgICAgYmFzZVRhYmxlTmFtZSxcbiAgICAgICAgYmxvY2tzLFxuICAgICAgICBibG9ja3NUb0RlbGV0ZSxcbiAgICAgICAgY29sdW1uUHJlZml4LFxuICAgICAgICBkYXRhLFxuICAgICAgICBleGlzdGluZ0xvY2FsZXMsXG4gICAgICAgIGZpZWxkUHJlZml4LFxuICAgICAgICBmaWVsZHM6IGZpZWxkLmZpZWxkcyxcbiAgICAgICAgbG9jYWxlcyxcbiAgICAgICAgdGV4dHMsXG4gICAgICAgIG51bWJlcnMsXG4gICAgICAgIHBhcmVudFRhYmxlTmFtZSxcbiAgICAgICAgcGF0aCxcbiAgICAgICAgcmVsYXRpb25zaGlwcyxcbiAgICAgICAgcmVsYXRpb25zaGlwc1RvRGVsZXRlLFxuICAgICAgICByb3csXG4gICAgICAgIHNlbGVjdHMsXG4gICAgICB9KVxuICAgIH1cblxuICAgIGlmIChmaWVsZC50eXBlID09PSAncmVsYXRpb25zaGlwJyB8fCBmaWVsZC50eXBlID09PSAndXBsb2FkJykge1xuICAgICAgY29uc3QgcmVsYXRpb25zaGlwUGF0aCA9IGAke3BhdGggfHwgJyd9JHtmaWVsZC5uYW1lfWBcblxuICAgICAgaWYgKGZpZWxkLmxvY2FsaXplZCkge1xuICAgICAgICBpZiAodHlwZW9mIGZpZWxkRGF0YSA9PT0gJ29iamVjdCcpIHtcbiAgICAgICAgICBPYmplY3QuZW50cmllcyhmaWVsZERhdGEpLmZvckVhY2goKFtsb2NhbGVLZXksIGxvY2FsZURhdGFdKSA9PiB7XG4gICAgICAgICAgICBpZiAobG9jYWxlRGF0YSA9PT0gbnVsbCkge1xuICAgICAgICAgICAgICByZWxhdGlvbnNoaXBzVG9EZWxldGUucHVzaCh7XG4gICAgICAgICAgICAgICAgbG9jYWxlOiBsb2NhbGVLZXksXG4gICAgICAgICAgICAgICAgcGF0aDogcmVsYXRpb25zaGlwUGF0aCxcbiAgICAgICAgICAgICAgfSlcbiAgICAgICAgICAgICAgcmV0dXJuXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHRyYW5zZm9ybVJlbGF0aW9uc2hpcCh7XG4gICAgICAgICAgICAgIGJhc2VSb3c6IHtcbiAgICAgICAgICAgICAgICBsb2NhbGU6IGxvY2FsZUtleSxcbiAgICAgICAgICAgICAgICBwYXRoOiByZWxhdGlvbnNoaXBQYXRoLFxuICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICBkYXRhOiBsb2NhbGVEYXRhLFxuICAgICAgICAgICAgICBmaWVsZCxcbiAgICAgICAgICAgICAgcmVsYXRpb25zaGlwcyxcbiAgICAgICAgICAgIH0pXG4gICAgICAgICAgfSlcbiAgICAgICAgfVxuICAgICAgfSBlbHNlIHtcbiAgICAgICAgaWYgKGZpZWxkRGF0YSA9PT0gbnVsbCB8fCAoQXJyYXkuaXNBcnJheShmaWVsZERhdGEpICYmIGZpZWxkRGF0YS5sZW5ndGggPT09IDApKSB7XG4gICAgICAgICAgcmVsYXRpb25zaGlwc1RvRGVsZXRlLnB1c2goeyBwYXRoOiByZWxhdGlvbnNoaXBQYXRoIH0pXG4gICAgICAgICAgcmV0dXJuXG4gICAgICAgIH1cblxuICAgICAgICB0cmFuc2Zvcm1SZWxhdGlvbnNoaXAoe1xuICAgICAgICAgIGJhc2VSb3c6IHtcbiAgICAgICAgICAgIHBhdGg6IHJlbGF0aW9uc2hpcFBhdGgsXG4gICAgICAgICAgfSxcbiAgICAgICAgICBkYXRhOiBmaWVsZERhdGEsXG4gICAgICAgICAgZmllbGQsXG4gICAgICAgICAgcmVsYXRpb25zaGlwcyxcbiAgICAgICAgfSlcbiAgICAgIH1cblxuICAgICAgcmV0dXJuXG4gICAgfVxuXG4gICAgaWYgKGZpZWxkLnR5cGUgPT09ICd0ZXh0JyAmJiBmaWVsZC5oYXNNYW55KSB7XG4gICAgICBjb25zdCB0ZXh0UGF0aCA9IGAke3BhdGggfHwgJyd9JHtmaWVsZC5uYW1lfWBcblxuICAgICAgaWYgKGZpZWxkLmxvY2FsaXplZCkge1xuICAgICAgICBpZiAodHlwZW9mIGZpZWxkRGF0YSA9PT0gJ29iamVjdCcpIHtcbiAgICAgICAgICBPYmplY3QuZW50cmllcyhmaWVsZERhdGEpLmZvckVhY2goKFtsb2NhbGVLZXksIGxvY2FsZURhdGFdKSA9PiB7XG4gICAgICAgICAgICBpZiAoQXJyYXkuaXNBcnJheShsb2NhbGVEYXRhKSkge1xuICAgICAgICAgICAgICB0cmFuc2Zvcm1UZXh0cyh7XG4gICAgICAgICAgICAgICAgYmFzZVJvdzoge1xuICAgICAgICAgICAgICAgICAgbG9jYWxlOiBsb2NhbGVLZXksXG4gICAgICAgICAgICAgICAgICBwYXRoOiB0ZXh0UGF0aCxcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIGRhdGE6IGxvY2FsZURhdGEsXG4gICAgICAgICAgICAgICAgdGV4dHMsXG4gICAgICAgICAgICAgIH0pXG4gICAgICAgICAgICB9XG4gICAgICAgICAgfSlcbiAgICAgICAgfVxuICAgICAgfSBlbHNlIGlmIChBcnJheS5pc0FycmF5KGZpZWxkRGF0YSkpIHtcbiAgICAgICAgdHJhbnNmb3JtVGV4dHMoe1xuICAgICAgICAgIGJhc2VSb3c6IHtcbiAgICAgICAgICAgIHBhdGg6IHRleHRQYXRoLFxuICAgICAgICAgIH0sXG4gICAgICAgICAgZGF0YTogZmllbGREYXRhLFxuICAgICAgICAgIHRleHRzLFxuICAgICAgICB9KVxuICAgICAgfVxuXG4gICAgICByZXR1cm5cbiAgICB9XG5cbiAgICBpZiAoZmllbGQudHlwZSA9PT0gJ251bWJlcicgJiYgZmllbGQuaGFzTWFueSkge1xuICAgICAgY29uc3QgbnVtYmVyUGF0aCA9IGAke3BhdGggfHwgJyd9JHtmaWVsZC5uYW1lfWBcblxuICAgICAgaWYgKGZpZWxkLmxvY2FsaXplZCkge1xuICAgICAgICBpZiAodHlwZW9mIGZpZWxkRGF0YSA9PT0gJ29iamVjdCcpIHtcbiAgICAgICAgICBPYmplY3QuZW50cmllcyhmaWVsZERhdGEpLmZvckVhY2goKFtsb2NhbGVLZXksIGxvY2FsZURhdGFdKSA9PiB7XG4gICAgICAgICAgICBpZiAoQXJyYXkuaXNBcnJheShsb2NhbGVEYXRhKSkge1xuICAgICAgICAgICAgICB0cmFuc2Zvcm1OdW1iZXJzKHtcbiAgICAgICAgICAgICAgICBiYXNlUm93OiB7XG4gICAgICAgICAgICAgICAgICBsb2NhbGU6IGxvY2FsZUtleSxcbiAgICAgICAgICAgICAgICAgIHBhdGg6IG51bWJlclBhdGgsXG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBkYXRhOiBsb2NhbGVEYXRhLFxuICAg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gICAgIGNvbnN0IG5ld1Jvd3MgPSB0cmFuc2Zvcm1BcnJheSh7XG4gICAgICAgICAgICAgICAgYWRhcHRlcixcbiAgICAgICAgICAgICAgICBhcnJheVRhYmxlTmFtZSxcbiAgICAgICAgICAgICAgICBiYXNlVGFibGVOYW1lLFxuICAgICAgICAgICAgICAgIGJsb2NrcyxcbiAgICAgICAgICAgICAgICBibG9ja3NUb0RlbGV0ZSxcbiAgICAgICAgICAgICAgICBkYXRhOiBsb2NhbGVEYXRhLFxuICAgICAgICAgICAgICAgIGZpZWxkLFxuICAgICAgICAgICAgICAgIGxvY2FsZTogbG9jYWxlS2V5LFxuICAgICAgICAgICAgICAgIG51bWJlcnMsXG4gICAgICAgICAgICAgICAgcGF0aCxcbiAgICAgICAgICAgICAgICByZWxhdGlvbnNoaXBzLFxuICAgICAgICAgICAgICAgIHJlbGF0aW9uc2hpcHNUb0RlbGV0ZSxcbiAgICAgICAgICAgICAgICBzZWxlY3RzLFxuICAgICAgICAgICAgICAgIHRleHRzLFxuICAgICAgICAgICAgICB9KVxuXG4gICAgICAgICAgICAgIGFycmF5c1thcnJheVRhYmxlTmFtZV0gPSBhcnJheXNbYXJyYXlUYWJsZU5hbWVdLmNvbmNhdChuZXdSb3dzKVxuICAgICAgICAgICAgfVxuICAgICAgICAgIH0pXG4gICAgICAgIH1cbiAgICAgIH0gZWxzZSB7XG4gICAgICAgIGNvbnN0IG5ld1Jvd3MgPSB0cmFuc2Zvcm1BcnJheSh7XG4gICAgICAgICAgYWRhcHRlcixcbiAgICAgICAgICBhcnJheVRhYmxlTmFtZSxcbiAgICAgICAgICBiYXNlVGFibGVOYW1lLFxuICAgICAgICAgIGJsb2NrcyxcbiAgICAgICAgICBibG9ja3NUb0RlbGV0ZSxcbiAgICAgICAgICBkYXRhOiBkYXRhW2ZpZWxkLm5hbWVdLFxuICAgICAgICAgIGZpZWxkLFxuICAgICAgICAgIG51bWJlcnMsXG4gICAgICAgICAgcGF0aCxcbiAgICAgICAg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ogbG9jYWxlS2V5LFxuICAgICAgICAgICAgICAgIG51bWJlcnMsXG4gICAgICAgICAgICAgICAgcGF0aCxcbiAgICAgICAgICAgICAgICByZWxhdGlvbnNoaXBzLFxuICAgICAgICAgICAgICAgIHJlbGF0aW9uc2hpcHNUb0RlbGV0ZSxcbiAgICAgICAgICAgICAgICBzZWxlY3RzLFxuICAgICAgICAgICAgICAgIHRleHRzLFxuICAgICAgICAgICAgICB9KVxuICAgICAgICAgICAgfVxuICAgICAgICAgIH0pXG4gICAgICAgIH1cbiAgICAgIH0gZWxzZSBpZiAoaXNBcnJheU9mUm93cyhmaWVsZERhdGEpKSB7XG4gICAgICAgIHRyYW5zZm9ybUJsb2Nrcyh7XG4gICAgICAgICAgYWRhcHRlcixcbiAgICAgICAgICBiYXNlVGFibGVOYW1lLFxuICAgICAgICAgIGJsb2NrcyxcbiAgICAgICAgICBibG9ja3NUb0RlbGV0ZSxcbiAgICAgICAgICBkYXRhOiBmaWVsZERhdGEsXG4gICAgICAgICAgZmllbGQsXG4gICAgICAgICAgbnVtYmVycyxcbiAgICAgICAgICBwYXRoLFxuICAgICAgICAgIHJlbGF0aW9uc2hpcHMsXG4gICAgICAgICAgcmVsYXRpb25zaGlwc1RvRGVsZXRlLFxuICAgICAgICAgIHNlbGVjdHMsXG4gICAgICAgICAgdGV4dHMsXG4gICAgICAgIH0pXG4gICAgICB9XG5cbiAgICAgIHJldHVyblxuICAgIH1cblxuICAgIGlmIChmaWVsZC50eXBlID09PSAnZ3JvdXAnKSB7XG4gICAgICBpZiAodHlwZW9mIGRhdGFbZmllbGQubmFtZV0gPT09ICdvYmplY3QnICYmIGRhdGFbZmllbGQubmFtZV0gIT09IG51bGwpIHtcbiAgICAgICAgaWYgKGZpZWxkLmxvY2FsaXplZCkge1xuICAgICAgICAgIE9iamVjdC5lbnRyaWVzKGRhdGFbZmllbGQubmFtZV0pLmZvckVhY2goKFtsb2NhbGVLZXksIGxvY2FsZURhdGFdKSA9PiB7XG4gICAgICAgICAgICB0cmF2ZXJzZUZpZWxkcyh7XG4gICAgICAgICAgICAgIGFkYXB0ZXIsXG4gICAgICAgICAgICAgIGFycmF5cyxcbiAgICAgICAgICAgICAgYmFzZVRhYmxlTmFtZSxcbiAgICAgICAgICAgICAgYmxvY2tzLFxuICAgICAgICAgICAgICBibG9ja3NUb0RlbGV0ZSxcbiAgICAgICAgICAgICAgY29sdW1uUHJlZml4OiBgJHtjb2x1bW5OYW1lfV9gLFxuICAgICAgICAgICAgICBkYXRhOiBsb2NhbGVEYXRhIGFzIFJlY29yZDxzdHJpbmcsIHVua25vd24+LFxuICAgICAgICAgICAgICBleGlzdGluZ0xvY2FsZXMsXG4gICAgICAgICAgICAgIGZpZWxkUHJlZml4OiBgJHtmaWVsZE5hbWV9X2AsXG4gICAgICAgICAgICAgIGZpZWxkczogZmllbGQuZmllbGRzLFxuICAgICAgICAgICAgICBmb3JjZWRMb2NhbGU6IGxvY2FsZUtleSxcbiAgICAgICAgICAgICAgbG9jYWxlcyxcbiAgICAgICAgICAgICAgbnVtYmVycyxcbiAgICAgICAgICAgICAgcGFyZW50VGFibGVOYW1lLFxuICAgICAgICAgICAgICBwYXRoOiBgJHtwYXRoIHx8ICcnfSR7ZmllbGQubmFtZX0uYCxcbiAgICAgICAgICAgICAgcmVsYXRpb25zaGlwcyxcbiAgICAgICAgICAgICAgcmVsYXRpb25zaGlwc1RvRGVsZXRlLFxuICAgICAgICAgICAgICByb3csXG4gICAgICAgICAgICAgIHNlbGVjdHMsXG4gICAgICAgICAgICAgIHRleHRzLFxuICAgICAgICAgICAgfSlcbiAgICAgICAgICB9KVxuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgIHRyYXZlcnNlRmllbGRzKHtcbiAgICAgICAgICAgIGFkYXB0ZXIsXG4gICAgICAgICAgICBhcnJheXMsXG4gICAgICAgICAgICBiYXNlVGFibGVOYW1lLFxuICAgICAgICAgICAgYmxvY2tzLFxuICAgICAgICAgICAgYmxvY2tzVG9EZWxldGUsXG4gICAgICAgICAgICBjb2x1bW5QcmVmaXg6IGAke2NvbHVtbk5hbWV9X2AsXG4gICAgICAgICAgICBkYXRhOiBkYXRhW2ZpZWxkLm5hbWVdIGFzIFJlY29yZDxzdHJpbmcsIHVua25vd24+LFxuICAgICAgICAgICAgZXhpc3RpbmdMb2NhbGVzLFxuICAgICAgICAgICAgZmllbGRQcmVmaXg6IGAke2ZpZWxkTmFtZX1fYCxcbiAgICAgICAgICAgIGZpZWxkczogZmllbGQuZmllbGRzLFxuICAgICAgICAgICAgbG9jYWxlcyxcbiAgICAgICAgICAgIG51bWJlcnMsXG4gICAgICAgICAgICBwYXJlbnRUYWJsZU5hbWUsXG4gICAgICAgICAgICBwYXRoOiBgJHtwYXRoIHx8ICcnfSR7ZmllbGQubmFtZX0uYCxcbiAgICAgICAgICAgIHJlbGF0aW9uc2hpcHMsXG4gICAgICAgICAgICByZWxhdGlvbnNoaXBzVG9EZWxldGUsXG4gICAgICAgICAgICByb3csXG4gICAgICAgICAgICBzZWxlY3RzLFxuICAgICAgICAgICAgdGV4dHMsXG4gICAgICAgICAgfSlcbiAgICAgICAgfVxuICAgICAgfVxuXG4gICAgICByZXR1cm5cbiAgICB9XG5cbiAgICBpZiAoZmllbGQudHlwZSA9PT0gJ3RhYnMnKSB7XG4gICAgICBmaWVsZC50YWJzLmZvckVhY2goKHRhYikgPT4ge1xuICAgICAgICBpZiAoJ25hbWUnIGluIHRhYikge1xuICAgICAgICAgIGlmICh0eXBlb2YgZGF0YVt0YWIubmFtZV0gPT09ICdvYmplY3QnICYmIGRhdGFbdGFiLm5hbWVdICE9PSBudWxsKSB7XG4gICAgICAgICAgICBpZiAodGFiLmxvY2FsaXplZCkge1xuICAgICAgICAgICAgICBPYmplY3QuZW50cmllcyhkYXRhW3RhYi5uYW1lXSkuZm9yRWFjaCgoW2xvY2FsZUtleSwgbG9jYWxlRGF0YV0pID0+IHtcbiAgICAgICAgICAgICAgICB0cmF2ZXJzZUZpZWxkcyh7XG4gICAgICAgICAgICAgICAgICBhZGFwdGVyLFxuICAgICAgICAgICAgICAgICAgYXJyYXlzLFxuICAgICAgICAgICAgICAgICAgYmFzZVRhYmxlTmFtZSxcbiAgICAgICAgICAgICAgICAgIGJsb2NrcyxcbiAgICAgICAgICAgICAgICAgIGJsb2Nrc1RvRGVsZXRlLFxuICAgICAgICAgICAgICAgICAgY29sdW1uUHJlZml4OiBgJHtjb2x1bW5QcmVmaXggfHwgJyd9JHt0b1NuYWtlQ2FzZSh0YWIubmFtZSl9X2AsXG4gICAgICAgICAgICAgICAgICBkYXRhOiBsb2NhbGVEYXRhIGFzIFJlY29yZDxzdHJpbmcsIHVua25vd24+LFxuICAgICAgICAgICAgICAgICAgZXhpc3RpbmdMb2NhbGVzLFxuICAgICAgICAgICAgICAgICAgZmllbGRQcmVmaXg6IGAke2ZpZWxkUHJlZml4IHx8ICcnfSR7dGFiLm5hbWV9X2AsXG4gICAgICAgICAgICAgICAgICBmaWVsZHM6IHRhYi5maWVsZHMsXG4gICAgICAgICAgICAgICAgICBmb3JjZWRMb2NhbGU6IGxvY2FsZUtleSxcbiAgICAgICAgICAgICAgICAgIGxvY2FsZXMsXG4gICAgICAgICAgICAgICAgICBudW1iZXJzLFxuICAgICAgICAgICAgICAgICAgcGFyZW50VGFibGVOYW1lLFxuICAgICAgICAgICAgICAgICAgcGF0aDogYCR7cGF0aCB8fCAnJ30ke3RhYi5uYW1lfS5gLFxuICAgICAgICAgICAgICAgICAgcmVsYXRpb25zaGlwcyxcbiAgICAgICAgICAgICAgICAgIHJlbGF0aW9uc2hpcHNUb0RlbGV0ZSxcbiAgICAgICAgICAgICAgICAgIHJvdyxcbiAgICAgICAgICAgICAgICAgIHNlbGVjdHMsXG4gICAgICAgICAgICAgICAgICB0ZXh0cyxcbiAgICAgICAgICAgICAgICB9KVxuICAgICAgICAgICAgICB9KVxuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgdHJhdmVyc2VGaWVsZHMoe1xuICAgICAgICAgICAgICAgIGFkYXB0ZXIsXG4gICAgICAgICAgICAgICAgYXJyYXlzLFxuICAgICAgICAgICAgICAgIGJhc2VUYWJsZU5hbWUsXG4gICAgICAgICAgICAgICAgYmxvY2tzLFxuICAgICAgICAgICAgICAgIGJsb2Nrc1RvRGVsZXRlLFxuICAgICAgICAgICAgICAgIGNvbHVtblByZWZpeDogYCR7Y29sdW1uUHJlZml4IHx8ICcnfSR7dG9TbmFrZUNhc2UodGFiLm5hbWUpfV9gLFxuICAgICAgICAgICAgICAgIGRhdGE6IGRhdGFbdGFiLm5hbWVdIGFzIFJlY29yZDxzdHJpbmcsIHVua25vd24+LFxuICAgICAgICAgICAgICAgIGV4aXN0aW5nTG9jYWxlcyxcbiAgICAgICAgICAgICAgICBmaWVsZFByZWZpeDogYCR7ZmllbGRQcmVmaXggfHwgJyd9JHt0YWIubmFtZX1fYCxcbiAgICAgICAgICAgICAgICBmaWVsZHM6IHRhYi5maWVsZHMsXG4gICAgICAgICAgICAgICAgbG9jYWxlcyxcbiAgICAgICAgICAgICAgICBudW1iZXJzLFxuICAgICAgICAgICAgICAgIHBhcmVudFRhYmxlTmFtZSxcbiAgICAgICAgICAgICAgICBwYXRoOiBgJHtwYXRoIHx8ICcnfSR7dGFiLm5hbWV9LmAsXG4gICAgICAgICAgICAgICAgcmVsYXRpb25zaGlwcyxcbiAgICAgICAgICAgICAgICByZWxhdGlvbnNoaXBzVG9EZWxldGUsXG4gICAgICAgICAgICAgICAgcm93LFxuICAgICAgICAgICAgICAgIHNlbGVjdHMsXG4gICAgICAgICAgICAgICAgdGV4dHMsXG4gICAgICAgICAgICAgIH0pXG4gICAgICAgICAgICB9XG4gICAgICAgICAgfVxuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgIHRyYXZlcnNlRmllbGRzKHtcbiAgICAgICAgICAgIGFkYXB0ZXIsXG4gICAgICAgICAgICBhcnJheXMsXG4gICAgICAgICAgICBiYXNlVGFibGVOYW1lLFxuICAgICAgICAgICAgYmxvY2tzLFxuICAgICAgICAgICAgYmxvY2tzVG9EZWxldGUsXG4gICAgICAgICAgICBjb2x1bW5QcmVmaXgsXG4gICAgICAgICAgICBkYXRhLFxuICAgICAgICAgICAgZXhpc3RpbmdMb2NhbGVzLFxuICAgICAgICAgICAgZmllbGRQcmVmaXgsXG4gICAgICAgICAgICBmaWVsZHM6IHRhYi5maWVsZHMsXG4gICAgICAgICAgICBsb2NhbGVzLFxuICAgICAgICAgICAgbnVtYmVycyxcbiAgICAgICAgICAgIHBhcmVudFRhYmxlTmFtZSxcbiAgICAgICAgICAgIHBhdGgsXG4gICAgICAgICAgICByZWxhdGlvbnNoaXBzLFxuICAgICAgICAgICAgcmVsYXRpb25zaGlwc1RvRGVsZXRlLFxuICAgICAgICAgICAgcm93LFxuICAgICAgICAgICAgc2VsZWN0cyxcbiAgICAgICAgICAgIHRleHRzLFxuICAgICAgICAgIH0pXG4gICAgICAgIH1cbiAgICAgIH0pXG4gICAgfVxuXG4gICAgaWYgKGZpZWxkLnR5cGUgPT09ICdyb3cnIHx8IGZpZWxkLnR5cGUgPT09ICdjb2xsYXBzaWJsZScpIHtcbiAgICAgIHRyYXZlcnNlRmllbGRzKHtcbiAgICAgICAgYWRhcHRlcixcbiAgICAgICAgYXJyYXlzLFxuICAgICAgICBiYXNlVGFibGVOYW1lLFxuICAgICAgICBibG9ja3MsXG4gICAgICAgIGJsb2Nrc1RvRGVsZXRlLFxuICAgICAgICBjb2x1bW5QcmVmaXgsXG4gICAgICAgIGRhdGEsXG4gICAgICAgIGV4aXN0aW5nTG9jYWxlcyxcbiAgICAgICAgZmllbGRQcmVmaXgsXG4gICAgICAgIGZpZWxkczogZmllbGQuZmllbGRzLFxuICAgICAgICBsb2NhbGVzLFxuICAgICAgICBudW1iZXJzLFxuICAgICAgICBwYXJlbnRUYWJsZU5hbWUsXG4gICAgICAgIHBhdGgsXG4gICAgICAgIHJlbGF0aW9uc2hpcHMsXG4gICAgICAgIHJlbGF0aW9uc2hpcHNUb0RlbGV0ZSxcbiAgICAgICAgcm93LFxuICAgICAgICBzZWxlY3RzLFxuICAgICAgICB0ZXh0cyxcbiAgICAgIH0pXG4gICAgfVxuXG4gICAgaWYgKGZpZWxkLnR5cGUgPT09ICdyZWxhdGlvbnNoaXAnIHx8IGZpZWxkLnR5cGUgPT09ICd1cGxvYWQnKSB7XG4gICAgICBjb25zdCByZWxhdGlvbnNoaXBQYXRoID0gYCR7cGF0aCB8fCAnJ30ke2ZpZWxkLm5hbWV9YFxuXG4gICAgICBpZiAoZmllbGQubG9jYWxpemVkKSB7XG4gICAgICAgIGlmICh0eXBlb2YgZmllbGREYXRhID09PSAnb2JqZWN0Jykge1xuICAgICAgICAgIE9iamVjdC5lbnRyaWVzKGZpZWxkRGF0YSkuZm9yRWFjaCgoW2xvY2FsZUtleSwgbG9jYWxlRGF0YV0pID0+IHtcbiAgICAgICAgICAgIGlmIChsb2NhbGVEYXRhID09PSBudWxsKSB7XG4gICAgICAgICAgICAgIHJlbGF0aW9uc2hpcHNUb0RlbGV0ZS5wdXNoKHtcbiAgICAgICAgICAgICAgICBsb2NhbGU6IGxvY2FsZUtleSxcbiAgICAgICAgICAgICAgICBwYXRoOiByZWxhdGlvbnNoaXBQYXRoLFxuICAgICAgICAgICAgICB9KVxuICAgICAgICAgICAgICByZXR1cm5cbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdHJhbnNmb3JtUmVsYXRpb25zaGlwKHtcbiAgICAgICAgICAgICAgYmFzZVJvdzoge1xuICAgICAgICAgICAgICAgIGxvY2FsZTogbG9jYWxlS2V5LFxuICAgICAgICAgICAgICAgIHBhdGg6IHJlbGF0aW9uc2hpcFBhdGgsXG4gICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgIGRhdGE6IGxvY2FsZURhdGEsXG4gICAgICAgICAgICAgIGZpZWxkLFxuICAgICAgICAgICAgICByZWxhdGlvbnNoaXBzLFxuICAgICAgICAgICAgfSlcbiAgICAgICAgICB9KVxuICAgICAgICB9XG4gICAgICB9IGVsc2Uge1xuICAgICAgICBpZiAoZmllbGREYXRhID09PSBudWxsIHx8IChBcnJheS5pc0FycmF5KGZpZWxkRGF0YSkgJiYgZmllbGREYXRhLmxlbmd0aCA9PT0gMCkpIHtcbiAgICAgICAgICByZWxhdGlvbnNoaXBzVG9EZWxldGUucHVzaCh7IHBhdGg6IHJlbGF0aW9uc2hpcFBhdGggfSlcbiAgICAgICAgICByZXR1cm5cbiAgICAgICAgfVxuXG4gICAgICAgIHRyYW5zZm9ybVJlbGF0aW9uc2hpcCh7XG4gICAgICAgICAgYmFzZVJvdzoge1xuICAgICAgICAgICAgcGF0aDogcmVsYXRpb25zaGlwUGF0aCxcbiAgICAgICAgICB9LFxuICAgICAgICAgIGRhdGE6IGZpZWxkRGF0YSxcbiAgICAgICAgICBmaWVsZCxcbiAgICAgICAgICByZWxhdGlvbnNoaXBzLFxuICAgICAgICB9KVxuICAgICAgfVxuXG4gICAgICByZXR1cm5cbiAgICB9XG5cbiAgICBpZiAoZmllbGQudHlwZSA9PT0gJ3RleHQnICYmIGZpZWxkLmhhc01hbnkpIHtcbiAgICAgIGNvbnN0IHRleHRQYXRoID0gYCR7cGF0aCB8fCAnJ30ke2ZpZWxkLm5hbWV9YFxuXG4gICAgICBpZiAoZmllbGQubG9jYWxpemVkKSB7XG4gICAgICAgIGlmICh0eXBlb2YgZmllbGREYXRhID09PSAnb2JqZWN0Jykge1xuICAgICAgICAgIE9iamVjdC5lbnRyaWVzKGZpZWxkRGF0YSkuZm9yRWFjaCgoW2xvY2FsZUtleSwgbG9jYWxlRGF0YV0pID0+IHtcbiAgICAgICAgICAgIGlmIChBcnJheS5pc0FycmF5KGxvY2FsZURhdGEpKSB7XG4gICAgICAgICAgICAgIHRyYW5zZm9ybVRleHRzKHtcbiAgICAgICAgICAgICAgICBiYXNlUm93OiB7XG4gICAgICAgICAgICAgICAgICBsb2NhbGU6IGxvY2FsZUtleSxcbiAgICAgICAgICAgICAgICAgIHBhdGg6IHRleHRQYXRoLFxuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgZGF0YTogbG9jYWxlRGF0YSxcbiAgICAgICAgICAgICAgICB0ZXh0cyxcbiAgICAgICAgICAgICAgfSlcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9KVxuICAgICAgICB9XG4gICAgICB9IGVsc2UgaWYgKEFycmF5LmlzQXJyYXkoZmllbGREYXRhKSkge1xuICAgICAgICB0cmFuc2Zvcm1UZXh0cyh7XG4gICAgICAgICAgYmFzZVJvdzoge1xuICAgICAgICAgICAgcGF0aDogdGV4dFBhdGgsXG4gICAgICAgICAgfSxcbiAgICAgICAgICBkYXRhOiBmaWVsZERhdGEsXG4gICAgICAgICAgdGV4dHMsXG4gICAgICAgIH0pXG4gICAgICB9XG5cbiAgICAgIHJldHVyblxuICAgIH1cblxuICAgIGlmIChmaWVsZC50eXBlID09PSAnbnVtYmVyJyAmJiBmaWVsZC5oYXNNYW55KSB7XG4gICAgICBjb25zdCBudW1iZXJQYXRoID0gYCR7cGF0aCB8fCAnJ30ke2ZpZWxkLm5hbWV9YFxuXG4gICAgICBpZiAoZmllbGQubG9jYWxpemVkKSB7XG4gICAgICAgIGlmICh0eXBlb2YgZmllbGREYXRhID09PSAnb2JqZWN0Jykge1xuICAgICAgICAgIE9iamVjdC5lbnRyaWVzKGZpZWxkRGF0YSkuZm9yRWFjaCgoW2xvY2FsZUtleSwgbG9jYWxlRGF0YV0pID0+IHtcbiAgICAgICAgICAgIGlmIChBcnJheS5pc0FycmF5KGxvY2FsZURhdGEpKSB7XG4gICAgICAgICAgICAgIHRyYW5zZm9ybU51bWJlcnMoe1xuICAgICAgICAgICAgICAgIGJhc2VSb3c6IHtcbiAgICAgICAgICAgICAgICAgIGxvY2FsZTogbG9jYWxlS2V5LFxuICAgICAgICAgICAgICAgICAgcGF0aDogbnVtYmVyUGF0aCxcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIGRhdGE6IGxvY2FsZURhdGEsXG4gICAgICAgICAgICAgICAgbnVtYmVycyxcbiAgICAgICAgICAgICAgfSlcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9KVxuICAgICAgICB9XG4gICAgICB9IGVsc2UgaWYgKEFycmF5LmlzQXJyYXkoZmllbGREYXRhKSkge1xuICAgICAgICB0cmFuc2Zvcm1OdW1iZXJzKHtcbiAgICAgICAgICBiYXNlUm93OiB7XG4gICAgICAgICAgICBwYXRoOiBudW1iZXJQYXRoLFxuICAgICAgICAgIH0sXG4gICAgICAgICAgZGF0YTogZmllbGREYXRhLFxuICAgICAgICAgIG51bWJlcnMsXG4gICAgICAgIH0pXG4gICAgICB9XG5cbiAgICAgIHJldHVyblxuICAgIH1cblxuICAgIGlmIChmaWVsZC50eXBlID09PSAnc2VsZWN0JyAmJiBmaWVsZC5oYXNNYW55KSB7XG4gICAgICBjb25zdCBzZWxlY3RUYWJsZU5hbWUgPSBgJHtwYXJlbnRUYWJsZU5hbWV9XyR7Y29sdW1uTmFtZX1gXG4gICAgICBpZiAoIXNlbGVjdHNbc2VsZWN0VGFibGVOYW1lXSkgc2VsZWN0c1tzZWxlY3RUYWJsZU5hbWVdID0gW11cblxuICAgICAgaWYgKGZpZWxkLmxvY2FsaXplZCkge1xuICAgICAgICBpZiAodHlwZW9mIGRhdGFbZmllbGQubmFtZV0gPT09ICdvYmplY3QnICYmIGRhdGFbZmllbGQubmFtZV0gIT09IG51bGwpIHtcbiAgICAgICAgICBPYmplY3QuZW50cmllcyhkYXRhW2ZpZWxkLm5hbWVdKS5mb3JFYWNoKChbbG9jYWxlS2V5LCBsb2NhbGVEYXRhXSkgPT4ge1xuICAgICAgICAgICAgaWYgKEFycmF5LmlzQXJyYXkobG9jYWxlRGF0YSkpIHtcbiAgICAgICAgICAgICAgY29uc3QgbmV3Um93cyA9IHRyYW5zZm9ybVNlbGVjdHMoe1xuICAgICAgICAgICAgICAgIGlkOiBkYXRhLl91dWlkIHx8IGRhdGE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FDRiJ9
@@ -3,4 +3,4 @@ Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
5
 
6
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiJ9
6
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbXSwibmFtZXMiOltdLCJyYW5nZU1hcHBpbmdzIjoiIiwibWFwcGluZ3MiOiIifQ==
package/dist/types.d.ts CHANGED
@@ -8,12 +8,15 @@ import type { PayloadRequest } from 'payload/types';
8
8
  import type { Pool, PoolConfig } from 'pg';
9
9
  export type DrizzleDB = NodePgDatabase<Record<string, unknown>>;
10
10
  export type Args = {
11
+ localesSuffix?: string;
11
12
  idType?: 'serial' | 'uuid';
12
13
  logger?: DrizzleConfig['logger'];
13
14
  migrationDir?: string;
14
15
  pool: PoolConfig;
15
16
  push?: boolean;
16
17
  schemaName?: string;
18
+ relationshipsSuffix?: string;
19
+ versionsSuffix?: string;
17
20
  };
18
21
  export type GenericColumn = PgColumn<ColumnBaseConfig<ColumnDataType, string>, Record<string, unknown>>;
19
22
  export type GenericColumns = {
@@ -29,6 +32,10 @@ export type GenericEnum = PgEnum<[string, ...string[]]>;
29
32
  export type GenericRelation = Relations<string, Record<string, Relation<string>>>;
30
33
  export type DrizzleTransaction = PgTransaction<NodePgQueryResultHKT, Record<string, unknown>, ExtractTablesWithRelations<Record<string, unknown>>>;
31
34
  export type PostgresAdapter = BaseDatabaseAdapter & {
35
+ /**
36
+ * Used internally to map the block name to the table name
37
+ */
38
+ blockTableNames: Record<string, string>;
32
39
  drizzle: DrizzleDB;
33
40
  enums: Record<string, GenericEnum>;
34
41
  /**
@@ -37,6 +44,7 @@ export type PostgresAdapter = BaseDatabaseAdapter & {
37
44
  */
38
45
  fieldConstraints: Record<string, Record<string, string>>;
39
46
  idType: Args['idType'];
47
+ localesSuffix?: string;
40
48
  logger: DrizzleConfig['logger'];
41
49
  pgSchema?: {
42
50
  table: PgTableFn;
@@ -45,6 +53,7 @@ export type PostgresAdapter = BaseDatabaseAdapter & {
45
53
  poolOptions: Args['pool'];
46
54
  push: boolean;
47
55
  relations: Record<string, GenericRelation>;
56
+ relationshipsSuffix?: string;
48
57
  schema: Record<string, GenericEnum | GenericRelation | GenericTable>;
49
58
  schemaName?: Args['schemaName'];
50
59
  sessions: {
@@ -55,6 +64,7 @@ export type PostgresAdapter = BaseDatabaseAdapter & {
55
64
  };
56
65
  };
57
66
  tables: Record<string, GenericTable | PgTableWithColumns<any>>;
67
+ versionsSuffix?: string;
58
68
  };
59
69
  export type IDType = 'integer' | 'numeric' | 'uuid' | 'varchar';
60
70
  export type PostgresAdapterResult = (args: {
@@ -73,9 +83,11 @@ declare module 'payload' {
73
83
  drizzle: DrizzleDB;
74
84
  enums: Record<string, GenericEnum>;
75
85
  fieldConstraints: Record<string, Record<string, string>>;
86
+ localeSuffix?: string;
76
87
  pool: Pool;
77
88
  push: boolean;
78
89
  relations: Record<string, GenericRelation>;
90
+ relationshipsSuffix?: string;
79
91
  schema: Record<string, GenericEnum | GenericRelation | GenericTable>;
80
92
  sessions: {
81
93
  [id: string]: {
@@ -85,6 +97,7 @@ declare module 'payload' {
85
97
  };
86
98
  };
87
99
  tables: Record<string, GenericTable>;
100
+ versionsSuffix?: string;
88
101
  }
89
102
  }
90
103
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,cAAc,EACd,aAAa,EACb,0BAA0B,EAC1B,QAAQ,EACR,SAAS,EACV,MAAM,aAAa,CAAA;AACpB,OAAO,KAAK,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AACrF,OAAO,KAAK,EACV,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,kB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Ac,CAAC,CAAA;CAC9B,CAAA;AAED,OAAO,QAAQ,SAAS,CAAC;IACvB,UAAiB,eACf,SAAQ,IAAI,CAAC,IAAI,EAAE,cAAc,GAAG,MAAM,CAAC,EACzC,mBAAmB;QACrB,OAAO,EAAE,SAAS,CAAA;QAClB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAA;QAClC,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;QACxD,YAAY,CAAC,EAAE,MAAM,CAAA;QACrB,IAAI,EAAE,IAAI,CAAA;QACV,IAAI,EAAE,OAAO,CAAA;QACb,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAA;QAC1C,mBAAmB,CAAC,EAAE,MAAM,CAAA;QAC5B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,GAAG,eAAe,GAAG,YAAY,CAAC,CAAA;QACpE,QAAQ,EAAE;YACR,CAAC,EAAE,EAAE,MAAM,GAAG;gBACZ,EAAE,EAAE,kBAAkB,CAAA;gBACtB,MAAM,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;gBAC3B,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;aAC7B,CAAA;SACF,CAAA;QACD,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAA;QACpC,cAAc,CAAC,EAAE,MAAM,CAAA;KACxB;CACF"}
package/dist/types.js CHANGED
@@ -3,4 +3,4 @@ Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
5
 
6
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiJ9
6
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbXSwibmFtZXMiOltdLCJyYW5nZU1hcHBpbmdzIjoiIiwibWFwcGluZ3MiOiIifQ==
@@ -1 +1 @@
1
- {"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../src/update.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAUjD,eAAO,MAAM,SAAS,EAAE,SAmEvB,CAAA"}
1
+ {"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../src/update.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAYjD,eAAO,MAAM,SAAS,EAAE,SAgDvB,CAAA"}
package/dist/update.js CHANGED
@@ -8,9 +8,9 @@ Object.defineProperty(exports, "updateOne", {
8
8
  return updateOne;
9
9
  }
10
10
  });
11
- const _tosnakecase = /*#__PURE__*/ _interop_require_default(require("to-snake-case"));
12
- const _chainMethods = require("./find/chainMethods");
13
11
  const _buildQuery = /*#__PURE__*/ _interop_require_default(require("./queries/buildQuery"));
12
+ const _selectDistinct = require("./queries/selectDistinct");
13
+ const _getTableName = require("./schema/getTableName");
14
14
  const _upsertRow = require("./upsertRow");
15
15
  function _interop_require_default(obj) {
16
16
  return obj && obj.__esModule ? obj : {
@@ -20,12 +20,16 @@ function _interop_require_default(obj) {
20
20
  const updateOne = async function updateOne({ id, collection: collectionSlug, data, draft, locale, req, where: whereArg }) {
21
21
  const db = this.sessions[req.transactionID]?.db || this.drizzle;
22
22
  const collection = this.payload.collections[collectionSlug].config;
23
- const tableName = (0, _tosnakecase.default)(collectionSlug);
23
+ const tableName = (0, _getTableName.getTableName)({
24
+ adapter: this,
25
+ config: collection
26
+ });
24
27
  const whereToUse = whereArg || {
25
28
  id: {
26
29
  equals: id
27
30
  }
28
31
  };
32
+ let idToUpdate = id;
29
33
  const { joinAliases, joins, selectFields, where } = await (0, _buildQuery.default)({
30
34
  adapter: this,
31
35
  fields: collection.fields,
@@ -33,51 +37,25 @@ const updateOne = async function updateOne({ id, collection: collectionSlug, dat
33
37
  tableName,
34
38
  where: whereToUse
35
39
  });
36
- let idToUpdate = id;
37
- // only fetch IDs when a sort or where query is used that needs to be done on join tables, otherwise these can be done directly on the table in findMany
38
- if (Object.keys(joins).length > 0 || joinAliases.length > 0) {
39
- const selectDistinctMethods = [];
40
- if (where) {
41
- selectDistinctMethods.push({
42
- args: [
43
- where
44
- ],
45
- method: 'where'
46
- });
47
- }
48
- joinAliases.forEach(({ condition, table })=>{
49
- selectDistinctMethods.push({
40
+ const selectDistinctResult = await (0, _selectDistinct.selectDistinct)({
41
+ adapter: this,
42
+ chainedMethods: [
43
+ {
50
44
  args: [
51
- table,
52
- condition
45
+ 1
53
46
  ],
54
- method: 'leftJoin'
55
- });
56
- });
57
- Object.entries(joins).forEach(([joinTable, condition])=>{
58
- if (joinTable) {
59
- selectDistinctMethods.push({
60
- args: [
61
- this.tables[joinTable],
62
- condition
63
- ],
64
- method: 'leftJoin'
65
- });
47
+ method: 'limit'
66
48
  }
67
- });
68
- selectDistinctMethods.push({
69
- args: [
70
- 1
71
- ],
72
- method: 'limit'
73
- });
74
- const selectDistinctResult = await (0, _chainMethods.chainMethods)({
75
- methods: selectDistinctMethods,
76
- query: db.selectDistinct(selectFields).from(this.tables[tableName])
77
- });
78
- if (selectDistinctResult?.[0]?.id) {
79
- idToUpdate = selectDistinctResult?.[0]?.id;
80
- }
49
+ ],
50
+ db,
51
+ joinAliases,
52
+ joins,
53
+ selectFields,
54
+ tableName,
55
+ where
56
+ });
57
+ if (selectDistinctResult?.[0]?.id) {
58
+ idToUpdate = selectDistinctResult?.[0]?.id;
81
59
  }
82
60
  const result = await (0, _upsertRow.upsertRow)({
83
61
  id: idToUpdate,
@@ -86,10 +64,10 @@ const updateOne = async function updateOne({ id, collection: collectionSlug, dat
86
64
  db,
87
65
  fields: collection.fields,
88
66
  operation: 'update',
89
- tableName: (0, _tosnakecase.default)(collectionSlug),
90
- req
67
+ req,
68
+ tableName
91
69
  });
92
70
  return result;
93
71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 'payload/database';
2
2
  import type { TypeWithID } from 'payload/types';
3
3
  import type { PostgresAdapter } from './types';
4
- export declare function updateGlobal<T extends TypeWithID>(this: PostgresAdapter, { data, req, slug }: UpdateGlobalArgs): Promise<T>;
4
+ export declare function updateGlobal<T extends TypeWithID>(this: PostgresAdapter, { slug, data, req }: UpdateGlobalArgs): Promise<T>;
5
5
  //# sourceMappingURL=updateGlobal.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"updateGlobal.d.ts","sourceRoot":"","sources":["../src/updateGlobal.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,CAkBZ"}
1
+ {"version":3,"file":"updateGlobal.d.ts","sourceRoot":"","sources":["../src/updateGlobal.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,CAqBZ"}