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

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. package/dist/connect.js +17 -32
  2. package/dist/create.js +6 -21
  3. package/dist/createGlobal.js +6 -21
  4. package/dist/createGlobalVersion.js +10 -25
  5. package/dist/createMigration.js +11 -26
  6. package/dist/createVersion.js +10 -25
  7. package/dist/deleteMany.js +8 -23
  8. package/dist/deleteOne.js +10 -25
  9. package/dist/deleteVersions.js +10 -25
  10. package/dist/destroy.js +2 -12
  11. package/dist/find/buildFindManyArgs.js +6 -14
  12. package/dist/find/chainMethods.js +2 -11
  13. package/dist/find/findMany.js +14 -29
  14. package/dist/find/traverseFields.js +8 -23
  15. package/dist/find.js +6 -21
  16. package/dist/findGlobal.js +6 -21
  17. package/dist/findGlobalVersions.js +8 -23
  18. package/dist/findOne.js +6 -21
  19. package/dist/findVersions.js +8 -23
  20. package/dist/index.js +72 -87
  21. package/dist/init.js +17 -32
  22. package/dist/migrate.js +15 -30
  23. package/dist/migrateDown.js +12 -22
  24. package/dist/migrateFresh.js +15 -28
  25. package/dist/migrateRefresh.js +18 -26
  26. package/dist/migrateReset.js +13 -21
  27. package/dist/migrateStatus.js +9 -19
  28. package/dist/queries/buildAndOrConditions.js +4 -14
  29. package/dist/queries/buildQuery.js +10 -20
  30. package/dist/queries/createJSONQuery/convertPathToJSONTraversal.js +4 -14
  31. package/dist/queries/createJSONQuery/formatJSONPathSegment.js +2 -12
  32. package/dist/queries/createJSONQuery/index.js +6 -16
  33. package/dist/queries/getTableColumnFromPath.js +38 -49
  34. package/dist/queries/operatorMap.js +17 -27
  35. package/dist/queries/parseParams.js +32 -42
  36. package/dist/queries/sanitizeQueryValue.js +8 -18
  37. package/dist/queryDrafts.js +10 -25
  38. package/dist/schema/build.js +49 -64
  39. package/dist/schema/createIndex.js +5 -15
  40. package/dist/schema/idToUUID.js +2 -12
  41. package/dist/schema/parentIDColumnMap.js +7 -17
  42. package/dist/schema/setColumnID.js +10 -20
  43. package/dist/schema/traverseFields.js +62 -77
  44. package/dist/schema/validateExistingBlockIsIdentical.js +9 -19
  45. package/dist/transactions/beginTransaction.js +4 -14
  46. package/dist/transactions/commitTransaction.js +2 -12
  47. package/dist/transactions/rollbackTransaction.js +2 -12
  48. package/dist/transform/read/hasManyNumber.js +2 -12
  49. package/dist/transform/read/hasManyText.js +2 -12
  50. package/dist/transform/read/index.js +12 -20
  51. package/dist/transform/read/relationship.js +2 -12
  52. package/dist/transform/read/traverseFields.js +15 -23
  53. package/dist/transform/write/array.js +6 -16
  54. package/dist/transform/write/blocks.js +6 -21
  55. package/dist/transform/write/index.js +4 -14
  56. package/dist/transform/write/numbers.js +2 -12
  57. package/dist/transform/write/relationships.js +4 -14
  58. package/dist/transform/write/selects.js +4 -14
  59. package/dist/transform/write/texts.js +2 -12
  60. package/dist/transform/write/traverseFields.js +30 -45
  61. package/dist/transform/write/types.js +2 -5
  62. package/dist/types.js +2 -5
  63. package/dist/update.js +11 -26
  64. package/dist/updateGlobal.js +6 -21
  65. package/dist/updateGlobalVersion.js +10 -25
  66. package/dist/updateVersion.js +10 -25
  67. package/dist/upsertRow/deleteExistingArrayRows.js +5 -15
  68. package/dist/upsertRow/deleteExistingRowsByPath.js +9 -19
  69. package/dist/upsertRow/index.js +24 -34
  70. package/dist/upsertRow/insertArrays.js +2 -12
  71. package/dist/upsertRow/types.js +2 -5
  72. package/dist/utilities/appendPrefixToKeys.js +2 -12
  73. package/dist/utilities/createBlocksMap.js +2 -12
  74. package/dist/utilities/createMigrationTable.js +4 -14
  75. package/dist/utilities/createRelationshipMap.js +2 -12
  76. package/dist/utilities/hasLocalesTable.js +5 -15
  77. package/dist/utilities/isArrayOfRows.js +2 -12
  78. package/dist/utilities/migrationTableExists.js +4 -14
  79. package/dist/utilities/parseError.js +6 -14
  80. package/package.json +4 -4
@@ -1,26 +1,11 @@
1
- /* eslint-disable no-param-reassign */ "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "buildTable", {
6
- enumerable: true,
7
- get: function() {
8
- return buildTable;
9
- }
10
- });
11
- const _drizzleorm = require("drizzle-orm");
12
- const _pgcore = require("drizzle-orm/pg-core");
13
- const _types = require("payload/types");
14
- const _tosnakecase = /*#__PURE__*/ _interop_require_default(require("to-snake-case"));
15
- const _parentIDColumnMap = require("./parentIDColumnMap");
16
- const _setColumnID = require("./setColumnID");
17
- const _traverseFields = require("./traverseFields");
18
- function _interop_require_default(obj) {
19
- return obj && obj.__esModule ? obj : {
20
- default: obj
21
- };
22
- }
23
- const buildTable = ({ adapter, baseColumns = {}, baseExtraConfig = {}, buildNumbers, buildRelationships, buildTexts, disableNotNull, disableUnique = false, fields, rootRelationsToBuild, rootRelationships, rootTableIDColType, rootTableName: incomingRootTableName, tableName, timestamps })=>{
1
+ /* eslint-disable no-param-reassign */ import { relations } from 'drizzle-orm';
2
+ import { index, integer, numeric, serial, timestamp, unique, varchar } from 'drizzle-orm/pg-core';
3
+ import { fieldAffectsData } from 'payload/types';
4
+ import toSnakeCase from 'to-snake-case';
5
+ import { parentIDColumnMap } from './parentIDColumnMap';
6
+ import { setColumnID } from './setColumnID';
7
+ import { traverseFields } from './traverseFields';
8
+ export const buildTable = ({ adapter, baseColumns = {}, baseExtraConfig = {}, buildNumbers, buildRelationships, buildTexts, disableNotNull, disableUnique = false, fields, rootRelationsToBuild, rootRelationships, rootTableIDColType, rootTableName: incomingRootTableName, tableName, timestamps })=>{
24
9
  const rootTableName = incomingRootTableName || tableName;
25
10
  const columns = baseColumns;
26
11
  const indexes = {};
@@ -40,12 +25,12 @@ const buildTable = ({ adapter, baseColumns = {}, baseExtraConfig = {}, buildNumb
40
25
  let relationshipsTable;
41
26
  // Drizzle relations
42
27
  const relationsToBuild = new Map();
43
- const idColType = (0, _setColumnID.setColumnID)({
28
+ const idColType = setColumnID({
44
29
  adapter,
45
30
  columns,
46
31
  fields
47
32
  });
48
- ({ hasLocalizedField, hasLocalizedManyNumberField, hasLocalizedManyTextField, hasLocalizedRelationshipField, hasManyNumberField, hasManyTextField } = (0, _traverseFields.traverseFields)({
33
+ ({ hasLocalizedField, hasLocalizedManyNumberField, hasLocalizedManyTextField, hasLocalizedRelationshipField, hasManyNumberField, hasManyTextField } = traverseFields({
49
34
  adapter,
50
35
  buildNumbers,
51
36
  buildRelationships,
@@ -66,12 +51,12 @@ const buildTable = ({ adapter, baseColumns = {}, baseExtraConfig = {}, buildNumb
66
51
  rootTableName
67
52
  }));
68
53
  if (timestamps) {
69
- columns.createdAt = (0, _pgcore.timestamp)('created_at', {
54
+ columns.createdAt = timestamp('created_at', {
70
55
  mode: 'string',
71
56
  precision: 3,
72
57
  withTimezone: true
73
58
  }).defaultNow().notNull();
74
- columns.updatedAt = (0, _pgcore.timestamp)('updated_at', {
59
+ columns.updatedAt = timestamp('updated_at', {
75
60
  mode: 'string',
76
61
  precision: 3,
77
62
  withTimezone: true
@@ -90,9 +75,9 @@ const buildTable = ({ adapter, baseColumns = {}, baseExtraConfig = {}, buildNumb
90
75
  adapter.tables[tableName] = table;
91
76
  if (hasLocalizedField) {
92
77
  const localeTableName = `${tableName}_locales`;
93
- localesColumns.id = (0, _pgcore.serial)('id').primaryKey();
78
+ localesColumns.id = serial('id').primaryKey();
94
79
  localesColumns._locale = adapter.enums.enum__locales('_locale').notNull();
95
- localesColumns._parentID = _parentIDColumnMap.parentIDColumnMap[idColType]('_parent_id').references(()=>table.id, {
80
+ localesColumns._parentID = parentIDColumnMap[idColType]('_parent_id').references(()=>table.id, {
96
81
  onDelete: 'cascade'
97
82
  }).notNull();
98
83
  localesTable = adapter.pgSchema.table(localeTableName, localesColumns, (cols)=>{
@@ -100,11 +85,11 @@ const buildTable = ({ adapter, baseColumns = {}, baseExtraConfig = {}, buildNumb
100
85
  acc[colName] = func(cols);
101
86
  return acc;
102
87
  }, {
103
- _localeParent: (0, _pgcore.unique)(`${localeTableName}_locale_parent_id_unique`).on(cols._locale, cols._parentID)
88
+ _localeParent: unique(`${localeTableName}_locale_parent_id_unique`).on(cols._locale, cols._parentID)
104
89
  });
105
90
  });
106
91
  adapter.tables[localeTableName] = localesTable;
107
- const localesTableRelations = (0, _drizzleorm.relations)(localesTable, ({ one })=>({
92
+ const localesTableRelations = relations(localesTable, ({ one })=>({
108
93
  _parentID: one(table, {
109
94
  fields: [
110
95
  localesTable._parentID
@@ -119,31 +104,31 @@ const buildTable = ({ adapter, baseColumns = {}, baseExtraConfig = {}, buildNumb
119
104
  if (hasManyTextField && buildTexts) {
120
105
  const textsTableName = `${rootTableName}_texts`;
121
106
  const columns = {
122
- id: (0, _pgcore.serial)('id').primaryKey(),
123
- order: (0, _pgcore.integer)('order').notNull(),
124
- parent: _parentIDColumnMap.parentIDColumnMap[idColType]('parent_id').references(()=>table.id, {
107
+ id: serial('id').primaryKey(),
108
+ order: integer('order').notNull(),
109
+ parent: parentIDColumnMap[idColType]('parent_id').references(()=>table.id, {
125
110
  onDelete: 'cascade'
126
111
  }).notNull(),
127
- path: (0, _pgcore.varchar)('path').notNull(),
128
- text: (0, _pgcore.varchar)('text')
112
+ path: varchar('path').notNull(),
113
+ text: varchar('text')
129
114
  };
130
115
  if (hasLocalizedManyTextField) {
131
116
  columns.locale = adapter.enums.enum__locales('locale');
132
117
  }
133
118
  textsTable = adapter.pgSchema.table(textsTableName, columns, (cols)=>{
134
119
  const indexes = {
135
- orderParentIdx: (0, _pgcore.index)(`${textsTableName}_order_parent_idx`).on(cols.order, cols.parent)
120
+ orderParentIdx: index(`${textsTableName}_order_parent_idx`).on(cols.order, cols.parent)
136
121
  };
137
122
  if (hasManyTextField === 'index') {
138
- indexes.text_idx = (0, _pgcore.index)(`${textsTableName}_text_idx`).on(cols.text);
123
+ indexes.text_idx = index(`${textsTableName}_text_idx`).on(cols.text);
139
124
  }
140
125
  if (hasLocalizedManyTextField) {
141
- indexes.localeParent = (0, _pgcore.index)(`${textsTableName}_locale_parent`).on(cols.locale, cols.parent);
126
+ indexes.localeParent = index(`${textsTableName}_locale_parent`).on(cols.locale, cols.parent);
142
127
  }
143
128
  return indexes;
144
129
  });
145
130
  adapter.tables[textsTableName] = textsTable;
146
- const textsTableRelations = (0, _drizzleorm.relations)(textsTable, ({ one })=>({
131
+ const textsTableRelations = relations(textsTable, ({ one })=>({
147
132
  parent: one(table, {
148
133
  fields: [
149
134
  textsTable.parent
@@ -158,31 +143,31 @@ const buildTable = ({ adapter, baseColumns = {}, baseExtraConfig = {}, buildNumb
158
143
  if (hasManyNumberField && buildNumbers) {
159
144
  const numbersTableName = `${rootTableName}_numbers`;
160
145
  const columns = {
161
- id: (0, _pgcore.serial)('id').primaryKey(),
162
- number: (0, _pgcore.numeric)('number'),
163
- order: (0, _pgcore.integer)('order').notNull(),
164
- parent: _parentIDColumnMap.parentIDColumnMap[idColType]('parent_id').references(()=>table.id, {
146
+ id: serial('id').primaryKey(),
147
+ number: numeric('number'),
148
+ order: integer('order').notNull(),
149
+ parent: parentIDColumnMap[idColType]('parent_id').references(()=>table.id, {
165
150
  onDelete: 'cascade'
166
151
  }).notNull(),
167
- path: (0, _pgcore.varchar)('path').notNull()
152
+ path: varchar('path').notNull()
168
153
  };
169
154
  if (hasLocalizedManyNumberField) {
170
155
  columns.locale = adapter.enums.enum__locales('locale');
171
156
  }
172
157
  numbersTable = adapter.pgSchema.table(numbersTableName, columns, (cols)=>{
173
158
  const indexes = {
174
- orderParentIdx: (0, _pgcore.index)(`${numbersTableName}_order_parent_idx`).on(cols.order, cols.parent)
159
+ orderParentIdx: index(`${numbersTableName}_order_parent_idx`).on(cols.order, cols.parent)
175
160
  };
176
161
  if (hasManyNumberField === 'index') {
177
- indexes.numberIdx = (0, _pgcore.index)(`${numbersTableName}_number_idx`).on(cols.number);
162
+ indexes.numberIdx = index(`${numbersTableName}_number_idx`).on(cols.number);
178
163
  }
179
164
  if (hasLocalizedManyNumberField) {
180
- indexes.localeParent = (0, _pgcore.index)(`${numbersTableName}_locale_parent`).on(cols.locale, cols.parent);
165
+ indexes.localeParent = index(`${numbersTableName}_locale_parent`).on(cols.locale, cols.parent);
181
166
  }
182
167
  return indexes;
183
168
  });
184
169
  adapter.tables[numbersTableName] = numbersTable;
185
- const numbersTableRelations = (0, _drizzleorm.relations)(numbersTable, ({ one })=>({
170
+ const numbersTableRelations = relations(numbersTable, ({ one })=>({
186
171
  parent: one(table, {
187
172
  fields: [
188
173
  numbersTable.parent
@@ -197,40 +182,40 @@ const buildTable = ({ adapter, baseColumns = {}, baseExtraConfig = {}, buildNumb
197
182
  if (buildRelationships) {
198
183
  if (relationships.size) {
199
184
  const relationshipColumns = {
200
- id: (0, _pgcore.serial)('id').primaryKey(),
201
- order: (0, _pgcore.integer)('order'),
202
- parent: _parentIDColumnMap.parentIDColumnMap[idColType]('parent_id').references(()=>table.id, {
185
+ id: serial('id').primaryKey(),
186
+ order: integer('order'),
187
+ parent: parentIDColumnMap[idColType]('parent_id').references(()=>table.id, {
203
188
  onDelete: 'cascade'
204
189
  }).notNull(),
205
- path: (0, _pgcore.varchar)('path').notNull()
190
+ path: varchar('path').notNull()
206
191
  };
207
192
  if (hasLocalizedRelationshipField) {
208
193
  relationshipColumns.locale = adapter.enums.enum__locales('locale');
209
194
  }
210
195
  relationships.forEach((relationTo)=>{
211
- const formattedRelationTo = (0, _tosnakecase.default)(relationTo);
196
+ const formattedRelationTo = toSnakeCase(relationTo);
212
197
  let colType = adapter.idType === 'uuid' ? 'uuid' : 'integer';
213
- const relatedCollectionCustomID = adapter.payload.collections[relationTo].config.fields.find((field)=>(0, _types.fieldAffectsData)(field) && field.name === 'id');
198
+ const relatedCollectionCustomID = adapter.payload.collections[relationTo].config.fields.find((field)=>fieldAffectsData(field) && field.name === 'id');
214
199
  if (relatedCollectionCustomID?.type === 'number') colType = 'numeric';
215
200
  if (relatedCollectionCustomID?.type === 'text') colType = 'varchar';
216
- relationshipColumns[`${relationTo}ID`] = _parentIDColumnMap.parentIDColumnMap[colType](`${formattedRelationTo}_id`).references(()=>adapter.tables[formattedRelationTo].id, {
201
+ relationshipColumns[`${relationTo}ID`] = parentIDColumnMap[colType](`${formattedRelationTo}_id`).references(()=>adapter.tables[formattedRelationTo].id, {
217
202
  onDelete: 'cascade'
218
203
  });
219
204
  });
220
205
  const relationshipsTableName = `${tableName}_rels`;
221
206
  relationshipsTable = adapter.pgSchema.table(relationshipsTableName, relationshipColumns, (cols)=>{
222
207
  const result = {
223
- order: (0, _pgcore.index)(`${relationshipsTableName}_order_idx`).on(cols.order),
224
- parentIdx: (0, _pgcore.index)(`${relationshipsTableName}_parent_idx`).on(cols.parent),
225
- pathIdx: (0, _pgcore.index)(`${relationshipsTableName}_path_idx`).on(cols.path)
208
+ order: index(`${relationshipsTableName}_order_idx`).on(cols.order),
209
+ parentIdx: index(`${relationshipsTableName}_parent_idx`).on(cols.parent),
210
+ pathIdx: index(`${relationshipsTableName}_path_idx`).on(cols.path)
226
211
  };
227
212
  if (hasLocalizedRelationshipField) {
228
- result.localeIdx = (0, _pgcore.index)(`${relationshipsTableName}_locale_idx`).on(cols.locale);
213
+ result.localeIdx = index(`${relationshipsTableName}_locale_idx`).on(cols.locale);
229
214
  }
230
215
  return result;
231
216
  });
232
217
  adapter.tables[relationshipsTableName] = relationshipsTable;
233
- const relationshipsTableRelations = (0, _drizzleorm.relations)(relationshipsTable, ({ one })=>{
218
+ const relationshipsTableRelations = relations(relationshipsTable, ({ one })=>{
234
219
  const result = {
235
220
  parent: one(table, {
236
221
  fields: [
@@ -243,7 +228,7 @@ const buildTable = ({ adapter, baseColumns = {}, baseExtraConfig = {}, buildNumb
243
228
  })
244
229
  };
245
230
  relationships.forEach((relationTo)=>{
246
- const relatedTableName = (0, _tosnakecase.default)(relationTo);
231
+ const relatedTableName = toSnakeCase(relationTo);
247
232
  const idColumnName = `${relationTo}ID`;
248
233
  result[idColumnName] = one(adapter.tables[relatedTableName], {
249
234
  fields: [
@@ -259,7 +244,7 @@ const buildTable = ({ adapter, baseColumns = {}, baseExtraConfig = {}, buildNumb
259
244
  adapter.relations[`relations_${relationshipsTableName}`] = relationshipsTableRelations;
260
245
  }
261
246
  }
262
- const tableRelations = (0, _drizzleorm.relations)(table, ({ many })=>{
247
+ const tableRelations = relations(table, ({ many })=>{
263
248
  const result = {};
264
249
  relationsToBuild.forEach((val, key)=>{
265
250
  result[key] = many(adapter.tables[val]);
@@ -288,4 +273,4 @@ const buildTable = ({ adapter, baseColumns = {}, baseExtraConfig = {}, buildNumb
288
273
  };
289
274
  };
290
275
 
291
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9zY2hlbWEvYnVpbGQudHMiXSwic291cmNlc0NvbnRlbnQiOlsiLyogZXNsaW50LWRpc2FibGUgbm8tcGFyYW0tcmVhc3NpZ24gKi9cbmltcG9ydCB0eXBlIHsgUmVsYXRpb24gfSBmcm9tICdkcml6emxlLW9ybSdcbmltcG9ydCB0eXBlIHtcbiAgSW5kZXhCdWlsZGVyLFxuICBQZ0NvbHVtbkJ1aWxkZXIsXG4gIFBnVGFibGVXaXRoQ29sdW1ucyxcbiAgVW5pcXVlQ29uc3RyYWludEJ1aWxkZXIsXG59IGZyb20gJ2RyaXp6bGUtb3JtL3BnLWNvcmUnXG5pbXBvcnQgdHlwZSB7IEZpZWxkIH0gZnJvbSAncGF5bG9hZC90eXBlcydcblxuaW1wb3J0IHsgcmVsYXRpb25zIH0gZnJvbSAnZHJpenpsZS1vcm0nXG5pbXBvcnQgeyBpbmRleCwgaW50ZWdlciwgbnVtZXJpYywgc2VyaWFsLCB0aW1lc3RhbXAsIHVuaXF1ZSwgdmFyY2hhciB9IGZyb20gJ2RyaXp6bGUtb3JtL3BnLWNvcmUnXG5pbXBvcnQgeyBmaWVsZEFmZmVjdHNEYXRhIH0gZnJvbSAncGF5bG9hZC90eXBlcydcbmltcG9ydCB0b1NuYWtlQ2FzZSBmcm9tICd0by1zbmFrZS1jYXNlJ1xuXG5pbXBvcnQgdHl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JZHggPSBpbmRleChgJHtyZWxhdGlvbnNoaXBzVGFibGVOYW1lfV9sb2NhbGVfaWR4YCkub24oY29scy5sb2NhbGUpXG4gICAgICAgICAgfVxuXG4gICAgICAgICAgcmV0dXJuIHJlc3VsdFxuICAgICAgICB9LFxuICAgICAgKVxuXG4gICAgICBhZGFwdGVyLnRhYmxlc1tyZWxhdGlvbnNoaXBzVGFibGVOYW1lXSA9IHJlbGF0aW9uc2hpcHNUYWJsZVxuXG4gICAgICBjb25zdCByZWxhdGlvbnNoaXBzVGFibGVSZWxhdGlvbnMgPSByZWxhdGlvbnMocmVsYXRpb25zaGlwc1RhYmxlLCAoeyBvbmUgfSkgPT4ge1xuICAgICAgICBjb25zdCByZXN1bHQ6IFJlY29yZDxzdHJpbmcsIFJlbGF0aW9uPHN0cmluZz4+ID0ge1xuICAgICAgICAgIHBhcmVudDogb25lKHRhYmxlLCB7XG4gICAgICAgICAgICBmaWVsZHM6IFtyZWxhdGlvbnNoaXBzVGFibGUucGFyZW50XSxcbiAgICAgICAgICAgIHJlZmVyZW5jZXM6IFt0YWJsZS5pZF0sXG4gICAgICAgICAgICByZWxhdGlvbk5hbWU6ICdfcmVscycsXG4gICAgICAgICAgfSksXG4gICAgICAgIH1cblxuICAgICAgICByZWxhdGlvbnNoaXBzLmZvckVhY2goKHJlbGF0aW9uVG8pID0+IHtcbiAgICAgICAgICBjb25zdCByZWxhdGVkVGFibGVOYW1lID0gdG9TbmFrZUNhc2UocmVsYXRpb25UbylcbiAgICAgICAgICBjb25zdCBpZENvbHVtbk5hbWUgPSBgJHtyZWxhdGlvblRvfUlEYFxuICAgICAgICAgIHJlc3VsdFtpZENvbHVtbk5hbWVdID0gb25lKGFkYXB0ZXIudGFibGVzW3JlbGF0ZWRUYWJsZU5hbWVdLCB7XG4gICAgICAgICAgICBmaWVsZHM6IFtyZWxhdGlvbnNoaXBzVGFibGVbaWRDb2x1bW5OYW1lXV0sXG4gICAgICAgICAgICByZWZlcmVuY2VzOiBb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ICAgICAgIHBhdGhJZHg6IGluZGV4KGAke3JlbGF0aW9uc2hpcHNUYWJsZU5hbWV9X3BhdGhfaWR4YCkub24oY29scy5wYXRoKSxcbiAgICAgICAgICB9XG5cbiAgICAgICAgICBpZiAoaGFzTG9jYWxpemVkUmVsYXRpb25zaGlwRmllbGQpIHtcbiAgICAgICAgICAgIHJlc3VsdC5sb2NhbGVJZHggPSBpbmRleChgJHtyZWxhdGlvbnNoaXBzVGFibGVOYW1lfV9sb2NhbGVfaWR4YCkub24oY29scy5sb2NhbGUpXG4gICAgICAgICAgfVxuXG4gICAgICAgICAgcmV0dXJuIHJlc3VsdFxuICAgICAgICB9LFxuICAgICAgKVxuXG4gICAgICBhZGFwdGVyLnRhYmxlc1tyZWxhdGlvbnNoaXBzVGFibGVOYW1lXSA9IHJlbGF0aW9uc2hpcHNUYWJsZVxuXG4gICAgICBjb25zdCByZWxhdGlvbnNoaXBzVGFibGVSZWxhdGlvbnMgPSByZWxhdGlvbnMocmVsYXRpb25zaGlwc1RhYmxlLCAoeyBvbmUgfSkgPT4ge1xuICAgICAgICBjb25zdCByZXN1bHQ6IFJlY29yZDxzdHJpbmcsIFJlbGF0aW9uPHN0cmluZz4+ID0ge1xuICAgICAgICAgIHBhcmVudDogb25lKHRhYmxlLCB7XG4gICAgICAgICAgICBmaWVsZHM6IFtyZWxhdGlvbnNoaXBzVGFibGUucGFyZW50XSxcbiAgICAgICAgICAgIHJlZmVyZW5jZXM6IFt0YWJsZS5pZF0sXG4gICAgICAgICAgICByZWxhdGlvbk5hbWU6ICdfcmVscycsXG4gICAgICAgICAgfSksXG4gICAgICAgIH1cblxuICAgICAgICByZWxhdGlvbnNoaXBzLmZvckVhY2goKHJlbGF0aW9uVG8pID0+IHtcbiAgICAgICAgICBjb25zdCByZWxhdGVkVGFibGVOYW1lID0gdG9TbmFrZUNhc2UocmVsYXRpb25UbylcbiAgICAgICAgICBjb25zdCBpZENvbHVtbk5hbWUgPSBgJHtyZWxhdGlvblRvf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UUFFQSxJQUFJTixrQkFBa0I7WUFDcEIrRSxPQUFPWSxNQUFNLEdBQUdILEtBQUtqRjtRQUN2QjtRQUNBLElBQUlOLG9CQUFvQjtZQUN0QjhFLE9BQU9hLFFBQVEsR0FBR0osS0FBS2hGO1FBQ3pCO1FBRUEsSUFBSUMsY0FBY3VELElBQUksSUFBSXJELG9CQUFvQjtZQUM1Q29FLE9BQU9jLEtBQUssR0FBR0wsS0FBSzdFLG9CQUFvQjtnQkFDdEN5RSxjQUFjO1lBQ2hCO1FBQ0Y7UUFFQSxPQUFPTDtJQUNUO0lBRUFuRyxRQUFRZCxTQUFTLENBQUMsQ0FBQyxVQUFVLEVBQUU0QixVQUFVLENBQUMsQ0FBQyxHQUFHNkY7SUFFOUMsT0FBTztRQUFFdEY7UUFBb0JEO1FBQWtCWTtJQUFpQjtBQUNsRSxFQUFDIn0=
@@ -1,15 +1,5 @@
1
- /* eslint-disable no-param-reassign */ "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "createIndex", {
6
- enumerable: true,
7
- get: function() {
8
- return createIndex;
9
- }
10
- });
11
- const _pgcore = require("drizzle-orm/pg-core");
12
- const createIndex = ({ name, columnName, tableName, unique })=>{
1
+ /* eslint-disable no-param-reassign */ import { index, uniqueIndex } from 'drizzle-orm/pg-core';
2
+ export const createIndex = ({ name, columnName, tableName, unique })=>{
13
3
  return (table)=>{
14
4
  let columns;
15
5
  if (Array.isArray(name)) {
@@ -20,9 +10,9 @@ const createIndex = ({ name, columnName, tableName, unique })=>{
20
10
  table[name]
21
11
  ];
22
12
  }
23
- if (unique) return (0, _pgcore.uniqueIndex)(`${tableName}_${columnName}_idx`).on(columns[0], ...columns.slice(1));
24
- return (0, _pgcore.index)(`${tableName}_${columnName}_idx`).on(columns[0], ...columns.slice(1));
13
+ if (unique) return uniqueIndex(`${tableName}_${columnName}_idx`).on(columns[0], ...columns.slice(1));
14
+ return index(`${tableName}_${columnName}_idx`).on(columns[0], ...columns.slice(1));
25
15
  };
26
16
  };
27
17
 
28
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9zY2hlbWEvY3JlYXRlSW5kZXgudHMiXSwic291cmNlc0NvbnRlbnQiOlsiLyogZXNsaW50LWRpc2FibGUgbm8tcGFyYW0tcmVhc3NpZ24gKi9cbmltcG9ydCB7IGluZGV4LCB1bmlxdWVJbmRleCB9IGZyb20gJ2RyaXp6bGUtb3JtL3BnLWNvcmUnXG5cbmltcG9ydCB0eXBlIHsgR2VuZXJpY0NvbHVtbiB9IGZyb20gJy4uL3R5cGVzJ1xuXG50eXBlIENyZWF0ZUluZGV4QXJncyA9IHtcbiAgY29sdW1uTmFtZTogc3RyaW5nXG4gIG5hbWU6IHN0cmluZyB8IHN0cmluZ1tdXG4gIHRhYmxlTmFtZTogc3RyaW5nXG4gIHVuaXF1ZT86IGJvb2xlYW5cbn1cblxuZXhwb3J0IGNvbnN0IGNyZWF0ZUluZGV4ID0gKHsgbmFtZSwgY29sdW1uTmFtZSwgdGFibGVOYW1lLCB1bmlxdWUgfTogQ3JlYXRlSW5kZXhBcmdzKSA9PiB7XG4gIHJldHVybiAodGFibGU6IHsgW3g6IHN0cmluZ106IEdlbmVyaWNDb2x1bW4gfSkgPT4ge1xuICAgIGxldCBjb2x1bW5zXG4gICAgaWYgKEFycmF5LmlzQXJyYXkobmFtZSkpIHtcbiAgICAgIGNvbHVtbnMgPSBuYW1lXG4gICAgICAgIC5tYXAoKGNvbHVtbk5hbWUpID0+IHRhYmxlW2NvbHVtbk5hbWVdKVxuICAgICAgICAvLyBleGNsdWRlIGZpZWxkcyB3ZXJlIGluY2x1ZGVkIGluIGNvbXBvdW5kIGluZGV4ZXMgYnV0IGRvIG5vdCBleGlzdCBvbiB0aGUgdGFibGVcbiAgICAgICAgLmZpbHRlcigoY29sKSA9PiB0eXBlb2YgY29sICE9PSAndW5kZWZpbmVkJyl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UFPLENBQUNDO1FBQ04sSUFBSUM7UUFDSixJQUFJQyxNQUFNQyxPQUFPLENBQUNQLE9BQU87WUFDdkJLLFVBQVVMLEtBQ1BRLEdBQUcsQ0FBQyxDQUFDUCxhQUFlRyxLQUFLLENBQUNILFdBQVcsQ0FDdEMsaUZBQWlGO2FBQ2hGUSxNQUFNLENBQUMsQ0FBQ0MsTUFBUSxPQUFPQSxRQUFRO1FBQ3BDLE9BQU87WUFDTEwsVUFBVTtnQkFBQ0QsS0FBSyxDQUFDSixLQUFLO2FBQUM7UUFDekI7UUFDQSxJQUFJRyxRQUNGLE9BQU9MLFlBQVksQ0FBQyxFQUFFSSxVQUFVLENBQUMsRUFBRUQsV0FBVyxJQUFJLENBQUMsRUFBRVUsRUFBRSxDQUFDTixPQUFPLENBQUMsRUFBRSxLQUFLQSxRQUFRTyxLQUFLLENBQUM7UUFDdkYsT0FBT2YsTUFBTSxDQUFDLEVBQUVLLFVBQVUsQ0FBQyxFQUFFRCxXQUFXLElBQUksQ0FBQyxFQUFFVSxFQUFFLENBQUNOLE9BQU8sQ0FBQyxFQUFFLEtBQUtBLFFBQVFPLEtBQUssQ0FBQztJQUNqRjtBQUNGLEVBQUMifQ==
@@ -1,14 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "idToUUID", {
6
- enumerable: true,
7
- get: function() {
8
- return idToUUID;
9
- }
10
- });
11
- const idToUUID = (fields)=>fields.map((field)=>{
1
+ export const idToUUID = (fields)=>fields.map((field)=>{
12
2
  if ('name' in field && field.name === 'id') {
13
3
  return {
14
4
  ...field,
@@ -18,4 +8,4 @@ const idToUUID = (fields)=>fields.map((field)=>{
18
8
  return field;
19
9
  });
20
10
 
21
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9zY2hlbWEvaWRUb1VVSUQudHMiXSwic291cmNlc0NvbnRlbnQiO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nKSB7XG4gICAgICByZXR1cm4ge1xuICAgICAgICAuLi5maWVsZCxcbiAgICAgICAgbmFtZTogJ191dWlkJyxcbiAgICAgIH1cbiAgICB9XG5cbiAgICByZXR1cm4gZmllbGRcbiAgfSlcbiJdLCJuYW1lcyI6WyJpZFRvVVVJRCIsImZpZWxkcyIsIm1hcCIsImZpZWxkIiwibmFtZSJdLCJtYXBwaW5ncyI6IkFBRUEsT0FBTyxNQUFNQSxXQUFXLENBQUNDLFNBQ3ZCQSxPQUFPQyxHQUFHLENBQUMsQ0FBQ0M7UUFDVixJQUFJLFVBQVVBLFNBQVNBLE1BQU1DLElBQUksS0FBSyxNQUFNO1lBQzFDLE9BQU87Z0JBQ0wsR0FBR0QsS0FBSztnQkFDUkMsTUFBTTtZQUNSO1FBQ0Y7UUFFQSxPQUFPRDtJQUNULEdBQUUifQ==
@@ -1,19 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "parentIDColumnMap", {
6
- enumerable: true,
7
- get: function() {
8
- return parentIDColumnMap;
9
- }
10
- });
11
- const _pgcore = require("drizzle-orm/pg-core");
12
- const parentIDColumnMap = {
13
- integer: _pgcore.integer,
14
- numeric: _pgcore.numeric,
15
- uuid: _pgcore.uuid,
16
- varchar: _pgcore.varchar
1
+ import { integer, numeric, uuid, varchar } from 'drizzle-orm/pg-core';
2
+ export const parentIDColumnMap = {
3
+ integer,
4
+ numeric,
5
+ uuid,
6
+ varchar
17
7
  };
18
8
 
19
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9zY2hlbWEvcGFyZW50SURDb2x1bW5NYXAudHMiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgaW50ZWdlciwgbnVtZXJpYywgdXVpZCwgdmFyY2hhciB9IGZyb20gJ2RyaXp6bGUtb3JtL3BnLWNvcmUnXG5cbmltcG9ydCB0e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yXG4+ID0ge1xuICBpbnRlZ2VyLFxuICBudW1lcmljLFxuICB1dWlkLFxuICB2YXJjaGFyLFxufVxuIl0sIm5hbWVzIjpbImludGVnZXIiLCJudW1lcmljIiwidXVpZCIsInZhcmNoYXIiLCJwYXJlbnRJRENvbHVtbk1hcCJdLCJtYXBwaW5ncyI6IkFBQUEsU0FBU0EsT0FBTyxFQUFFQyxPQUFPLEVBQUVDLElBQUksRUFBRUMsT0FBTyxRQUFRLHNCQUFxQjtBQUlyRSxPQUFPLE1BQU1DLG9CQUdUO0lBQ0ZKO0lBQ0FDO0lBQ0FDO0lBQ0FDO0FBQ0YsRUFBQyJ9
@@ -1,34 +1,24 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "setColumnID", {
6
- enumerable: true,
7
- get: function() {
8
- return setColumnID;
9
- }
10
- });
11
- const _pgcore = require("drizzle-orm/pg-core");
12
- const _types = require("payload/types");
13
- const _utilities = require("payload/utilities");
14
- const setColumnID = ({ adapter, columns, fields })=>{
15
- const idField = (0, _utilities.flattenTopLevelFields)(fields).find((field)=>(0, _types.fieldAffectsData)(field) && field.name === 'id');
1
+ import { numeric, serial, uuid, varchar } from 'drizzle-orm/pg-core';
2
+ import { fieldAffectsData } from 'payload/types';
3
+ import { flattenTopLevelFields } from 'payload/utilities';
4
+ export const setColumnID = ({ adapter, columns, fields })=>{
5
+ const idField = flattenTopLevelFields(fields).find((field)=>fieldAffectsData(field) && field.name === 'id');
16
6
  if (idField) {
17
7
  if (idField.type === 'number') {
18
- columns.id = (0, _pgcore.numeric)('id').primaryKey();
8
+ columns.id = numeric('id').primaryKey();
19
9
  return 'numeric';
20
10
  }
21
11
  if (idField.type === 'text') {
22
- columns.id = (0, _pgcore.varchar)('id').primaryKey();
12
+ columns.id = varchar('id').primaryKey();
23
13
  return 'varchar';
24
14
  }
25
15
  }
26
16
  if (adapter.idType === 'uuid') {
27
- columns.id = (0, _pgcore.uuid)('id').defaultRandom().primaryKey();
17
+ columns.id = uuid('id').defaultRandom().primaryKey();
28
18
  return 'uuid';
29
19
  }
30
- columns.id = (0, _pgcore.serial)('id').primaryKey();
20
+ columns.id = serial('id').primaryKey();
31
21
  return 'integer';
32
22
  };
33
23
 
34
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9zY2hlbWEvc2V0Q29sdW1uSUQudHMiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHR5cGUgeyBQZ0NvbHVtbkJ1aWxkZXIgfSBmcm9tICdkcml6emxlLW9ybS9wZy1jb3JlJ1xuXG5pbXBvcnQgeyBudW1lcmljLCBzZXJpYWwsIHV1aWQsIHZhcmNoYXIgfSBmcm9tICdkcml6emxlLW9ybS9wZy1jb3JlJ1xuaW1wb3J0IHsgdHlwZSBGaWVsZCwgZmllbGRBZmZlY3RzRGF0YSB9IGZyb20gJ3BheWxvYWQvdHlwZXMnXG5pbXBvcnQgeyBmbGF0dGVuVG9wTGV2ZWxGaWVsZHMgfSBmcm9tICdwYXlsb2FkL3V0aWxpdGllcydcblxuaW1wb3J0IHR5cGUgeyBJRFR5cGUsIFBvc3RncmVzQWRhcHRlciB9IGZyb20gJy4uL3R5cGVzJ1xuXG50eXBlIEFyZ3MgPSB7IGFkYXB0ZXI6IFBvc3RncmVzQWRhcHRlcjsgY29sdW1uczogUmVjb3JkPHN0cmluZywgUGdDb2x1bW5CdWlsZGVyPjsgZmllbGRzOiBGaWVsZFtdIH1cbmV4cG9ydCBjb25zdCBzZXRDb2x1bW5JRCA9ICh7IGFkYXB0ZXIsIGNvbHVtbnMsIGZpZWxkcyB9OiBBcmdzKTogSURUeXBlID0+IHtcbiAgY29uc3QgaWRGaWVsZCA9IGZsYXR0ZW5Ub3BMZXZlbEZpZWxkcyhmaWVsZHMpLmZpbmQoXG4gICAgKGZpZWxkKSA9PiBmaWVsZEFmZmVjdHNEYXRhKGZpZ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