@payloadcms/db-postgres 0.1.9 → 0.1.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. package/dist/create.d.ts.map +1 -1
  2. package/dist/create.js +3 -2
  3. package/dist/createGlobal.d.ts.map +1 -1
  4. package/dist/createGlobal.js +3 -2
  5. package/dist/createGlobalVersion.d.ts +1 -1
  6. package/dist/createGlobalVersion.d.ts.map +1 -1
  7. package/dist/createGlobalVersion.js +3 -2
  8. package/dist/createVersion.d.ts.map +1 -1
  9. package/dist/createVersion.js +4 -3
  10. package/dist/find/traverseFields.js +2 -2
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +2 -1
  13. package/dist/schema/idToUUID.d.ts +3 -0
  14. package/dist/schema/idToUUID.d.ts.map +1 -0
  15. package/dist/schema/idToUUID.js +21 -0
  16. package/dist/schema/traverseFields.d.ts.map +1 -1
  17. package/dist/schema/traverseFields.js +16 -7
  18. package/dist/schema/validateExistingBlockIsIdentical.js +3 -2
  19. package/dist/transform/read/index.d.ts.map +1 -1
  20. package/dist/transform/read/index.js +4 -1
  21. package/dist/transform/read/traverseFields.d.ts +5 -1
  22. package/dist/transform/read/traverseFields.d.ts.map +1 -1
  23. package/dist/transform/read/traverseFields.js +29 -2
  24. package/dist/transform/write/array.d.ts +3 -1
  25. package/dist/transform/write/array.d.ts.map +1 -1
  26. package/dist/transform/write/array.js +13 -2
  27. package/dist/transform/write/blocks.d.ts +3 -1
  28. package/dist/transform/write/blocks.d.ts.map +1 -1
  29. package/dist/transform/write/blocks.js +13 -2
  30. package/dist/transform/write/index.d.ts +3 -1
  31. package/dist/transform/write/index.d.ts.map +1 -1
  32. package/dist/transform/write/index.js +3 -2
  33. package/dist/transform/write/traverseFields.d.ts +3 -1
  34. package/dist/transform/write/traverseFields.d.ts.map +1 -1
  35. package/dist/transform/write/traverseFields.js +12 -2
  36. package/dist/types.d.ts +6 -0
  37. package/dist/types.d.ts.map +1 -1
  38. package/dist/update.d.ts.map +1 -1
  39. package/dist/update.js +3 -2
  40. package/dist/updateGlobal.d.ts.map +1 -1
  41. package/dist/updateGlobal.js +3 -2
  42. package/dist/updateGlobalVersion.d.ts +1 -2
  43. package/dist/updateGlobalVersion.d.ts.map +1 -1
  44. package/dist/updateGlobalVersion.js +3 -2
  45. package/dist/updateVersion.d.ts.map +1 -1
  46. package/dist/updateVersion.js +3 -2
  47. package/dist/upsertRow/index.d.ts +1 -1
  48. package/dist/upsertRow/index.d.ts.map +1 -1
  49. package/dist/upsertRow/index.js +188 -170
  50. package/dist/upsertRow/types.d.ts +2 -1
  51. package/dist/upsertRow/types.d.ts.map +1 -1
  52. package/package.json +6 -3
@@ -15,10 +15,13 @@ const _write = require("../transform/write");
15
15
  const _deleteExistingArrayRows = require("./deleteExistingArrayRows");
16
16
  const _deleteExistingRowsByPath = require("./deleteExistingRowsByPath");
17
17
  const _insertArrays = require("./insertArrays");
18
- const upsertRow = async ({ id, adapter, data, db, fields, operation, path = '', tableName, upsertTarget, where })=>{
18
+ const _errors = require("payload/errors");
19
+ const _utilities = require("payload/utilities");
20
+ const upsertRow = async ({ id, adapter, data, db, fields, operation, path = '', req, tableName, upsertTarget, where })=>{
19
21
  // Split out the incoming data into the corresponding:
20
22
  // base row, locales, relationships, blocks, and arrays
21
23
  const rowToInsert = (0, _write.transformForWrite)({
24
+ adapter,
22
25
  data,
23
26
  fields,
24
27
  path,
@@ -26,197 +29,212 @@ const upsertRow = async ({ id, adapter, data, db, fields, operation, path = '',
26
29
  });
27
30
  // First, we insert the main row
28
31
  let insertedRow;
29
- if (operation === 'update') {
30
- const target = upsertTarget || adapter.tables[tableName].id;
31
- if (id) {
32
- rowToInsert.row.id = id;
33
- [insertedRow] = await db.insert(adapter.tables[tableName]).values(rowToInsert.row).onConflictDoUpdate({
34
- set: rowToInsert.row,
35
- target
36
- }).returning();
32
+ try {
33
+ if (operation === 'update') {
34
+ const target = upsertTarget || adapter.tables[tableName].id;
35
+ if (id) {
36
+ rowToInsert.row.id = id;
37
+ [insertedRow] = await db.insert(adapter.tables[tableName]).values(rowToInsert.row).onConflictDoUpdate({
38
+ set: rowToInsert.row,
39
+ target
40
+ }).returning();
41
+ } else {
42
+ [insertedRow] = await db.insert(adapter.tables[tableName]).values(rowToInsert.row).onConflictDoUpdate({
43
+ set: rowToInsert.row,
44
+ target,
45
+ where
46
+ }).returning();
47
+ }
37
48
  } else {
38
- [insertedRow] = await db.insert(adapter.tables[tableName]).values(rowToInsert.row).onConflictDoUpdate({
39
- set: rowToInsert.row,
40
- target,
41
- where
42
- }).returning();
49
+ [insertedRow] = await db.insert(adapter.tables[tableName]).values(rowToInsert.row).returning();
43
50
  }
44
- } else {
45
- [insertedRow] = await db.insert(adapter.tables[tableName]).values(rowToInsert.row).returning();
46
- }
47
- const localesToInsert = [];
48
- const relationsToInsert = [];
49
- const numbersToInsert = [];
50
- const blocksToInsert = {};
51
- const selectsToInsert = {};
52
- // If there are locale rows with data, add the parent and locale to each
53
- if (Object.keys(rowToInsert.locales).length > 0) {
54
- Object.entries(rowToInsert.locales).forEach(([locale, localeRow])=>{
55
- localeRow._parentID = insertedRow.id;
56
- localeRow._locale = locale;
57
- localesToInsert.push(localeRow);
58
- });
59
- }
60
- // If there are relationships, add parent to each
61
- if (rowToInsert.relationships.length > 0) {
62
- rowToInsert.relationships.forEach((relation)=>{
63
- relation.parent = insertedRow.id;
64
- relationsToInsert.push(relation);
65
- });
66
- }
67
- // If there are numbers, add parent to each
68
- if (rowToInsert.numbers.length > 0) {
69
- rowToInsert.numbers.forEach((numberRow)=>{
70
- numberRow.parent = insertedRow.id;
71
- numbersToInsert.push(numberRow);
72
- });
73
- }
74
- // If there are selects, add parent to each, and then
75
- // store by table name and rows
76
- if (Object.keys(rowToInsert.selects).length > 0) {
77
- Object.entries(rowToInsert.selects).forEach(([selectTableName, selectRows])=>{
78
- selectRows.forEach((row)=>{
79
- row.parent = insertedRow.id;
80
- if (!selectsToInsert[selectTableName]) selectsToInsert[selectTableName] = [];
81
- selectsToInsert[selectTableName].push(row);
51
+ const localesToInsert = [];
52
+ const relationsToInsert = [];
53
+ const numbersToInsert = [];
54
+ const blocksToInsert = {};
55
+ const selectsToInsert = {};
56
+ // If there are locale rows with data, add the parent and locale to each
57
+ if (Object.keys(rowToInsert.locales).length > 0) {
58
+ Object.entries(rowToInsert.locales).forEach(([locale, localeRow])=>{
59
+ localeRow._parentID = insertedRow.id;
60
+ localeRow._locale = locale;
61
+ localesToInsert.push(localeRow);
62
+ });
63
+ }
64
+ // If there are relationships, add parent to each
65
+ if (rowToInsert.relationships.length > 0) {
66
+ rowToInsert.relationships.forEach((relation)=>{
67
+ relation.parent = insertedRow.id;
68
+ relationsToInsert.push(relation);
69
+ });
70
+ }
71
+ // If there are numbers, add parent to each
72
+ if (rowToInsert.numbers.length > 0) {
73
+ rowToInsert.numbers.forEach((numberRow)=>{
74
+ numberRow.parent = insertedRow.id;
75
+ numbersToInsert.push(numberRow);
76
+ });
77
+ }
78
+ // If there are selects, add parent to each, and then
79
+ // store by table name and rows
80
+ if (Object.keys(rowToInsert.selects).length > 0) {
81
+ Object.entries(rowToInsert.selects).forEach(([selectTableName, selectRows])=>{
82
+ selectRows.forEach((row)=>{
83
+ row.parent = insertedRow.id;
84
+ if (!selectsToInsert[selectTableName]) selectsToInsert[selectTableName] = [];
85
+ selectsToInsert[selectTableName].push(row);
86
+ });
87
+ });
88
+ }
89
+ // If there are blocks, add parent to each, and then
90
+ // store by table name and rows
91
+ Object.keys(rowToInsert.blocks).forEach((blockName)=>{
92
+ rowToInsert.blocks[blockName].forEach((blockRow)=>{
93
+ blockRow.row._parentID = insertedRow.id;
94
+ if (!blocksToInsert[blockName]) blocksToInsert[blockName] = [];
95
+ if (blockRow.row.uuid) {
96
+ delete blockRow.row.uuid;
97
+ }
98
+ blocksToInsert[blockName].push(blockRow);
82
99
  });
83
100
  });
84
- }
85
- // If there are blocks, add parent to each, and then
86
- // store by table name and rows
87
- Object.keys(rowToInsert.blocks).forEach((blockName)=>{
88
- rowToInsert.blocks[blockName].forEach((blockRow)=>{
89
- blockRow.row._parentID = insertedRow.id;
90
- if (!blocksToInsert[blockName]) blocksToInsert[blockName] = [];
91
- blocksToInsert[blockName].push(blockRow);
92
- });
93
- });
94
- // //////////////////////////////////
95
- // INSERT LOCALES
96
- // //////////////////////////////////
97
- if (localesToInsert.length > 0) {
98
- const localeTable = adapter.tables[`${tableName}_locales`];
101
+ // //////////////////////////////////
102
+ // INSERT LOCALES
103
+ // //////////////////////////////////
104
+ if (localesToInsert.length > 0) {
105
+ const localeTable = adapter.tables[`${tableName}_locales`];
106
+ if (operation === 'update') {
107
+ await db.delete(localeTable).where((0, _drizzleorm.eq)(localeTable._parentID, insertedRow.id));
108
+ }
109
+ await db.insert(localeTable).values(localesToInsert);
110
+ }
111
+ // //////////////////////////////////
112
+ // INSERT RELATIONSHIPS
113
+ // //////////////////////////////////
114
+ const relationshipsTableName = `${tableName}_rels`;
99
115
  if (operation === 'update') {
100
- await db.delete(localeTable).where((0, _drizzleorm.eq)(localeTable._parentID, insertedRow.id));
116
+ await (0, _deleteExistingRowsByPath.deleteExistingRowsByPath)({
117
+ adapter,
118
+ db,
119
+ localeColumnName: 'locale',
120
+ parentColumnName: 'parent',
121
+ parentID: insertedRow.id,
122
+ pathColumnName: 'path',
123
+ rows: [
124
+ ...relationsToInsert,
125
+ ...rowToInsert.relationshipsToDelete
126
+ ],
127
+ tableName: relationshipsTableName
128
+ });
101
129
  }
102
- await db.insert(localeTable).values(localesToInsert);
103
- }
104
- // //////////////////////////////////
105
- // INSERT RELATIONSHIPS
106
- // //////////////////////////////////
107
- const relationshipsTableName = `${tableName}_rels`;
108
- if (operation === 'update') {
109
- await (0, _deleteExistingRowsByPath.deleteExistingRowsByPath)({
110
- adapter,
111
- db,
112
- localeColumnName: 'locale',
113
- parentColumnName: 'parent',
114
- parentID: insertedRow.id,
115
- pathColumnName: 'path',
116
- rows: [
117
- ...relationsToInsert,
118
- ...rowToInsert.relationshipsToDelete
119
- ],
120
- tableName: relationshipsTableName
121
- });
122
- }
123
- if (relationsToInsert.length > 0) {
124
- await db.insert(adapter.tables[relationshipsTableName]).values(relationsToInsert);
125
- }
126
- // //////////////////////////////////
127
- // INSERT hasMany NUMBERS
128
- // //////////////////////////////////
129
- const numbersTableName = `${tableName}_numbers`;
130
- if (operation === 'update') {
131
- await (0, _deleteExistingRowsByPath.deleteExistingRowsByPath)({
132
- adapter,
133
- db,
134
- localeColumnName: 'locale',
135
- parentColumnName: 'parent',
136
- parentID: insertedRow.id,
137
- pathColumnName: 'path',
138
- rows: numbersToInsert,
139
- tableName: numbersTableName
140
- });
141
- }
142
- if (numbersToInsert.length > 0) {
143
- await db.insert(adapter.tables[numbersTableName]).values(numbersToInsert).returning();
144
- }
145
- // //////////////////////////////////
146
- // INSERT BLOCKS
147
- // //////////////////////////////////
148
- const insertedBlockRows = {};
149
- for (const [blockName, blockRows] of Object.entries(blocksToInsert)){
130
+ if (relationsToInsert.length > 0) {
131
+ await db.insert(adapter.tables[relationshipsTableName]).values(relationsToInsert);
132
+ }
133
+ // //////////////////////////////////
134
+ // INSERT hasMany NUMBERS
135
+ // //////////////////////////////////
136
+ const numbersTableName = `${tableName}_numbers`;
150
137
  if (operation === 'update') {
151
138
  await (0, _deleteExistingRowsByPath.deleteExistingRowsByPath)({
152
139
  adapter,
153
140
  db,
141
+ localeColumnName: 'locale',
142
+ parentColumnName: 'parent',
154
143
  parentID: insertedRow.id,
155
- pathColumnName: '_path',
156
- rows: blockRows.map(({ row })=>row),
157
- tableName: `${tableName}_blocks_${blockName}`
144
+ pathColumnName: 'path',
145
+ rows: numbersToInsert,
146
+ tableName: numbersTableName
158
147
  });
159
148
  }
160
- insertedBlockRows[blockName] = await db.insert(adapter.tables[`${tableName}_blocks_${blockName}`]).values(blockRows.map(({ row })=>row)).returning();
161
- insertedBlockRows[blockName].forEach((row, i)=>{
162
- blockRows[i].row = row;
163
- });
164
- const blockLocaleIndexMap = [];
165
- const blockLocaleRowsToInsert = blockRows.reduce((acc, blockRow, i)=>{
166
- if (Object.entries(blockRow.locales).length > 0) {
167
- Object.entries(blockRow.locales).forEach(([blockLocale, blockLocaleData])=>{
168
- if (Object.keys(blockLocaleData).length > 0) {
169
- blockLocaleData._parentID = blockRow.row.id;
170
- blockLocaleData._locale = blockLocale;
171
- acc.push(blockLocaleData);
172
- blockLocaleIndexMap.push(i);
173
- }
149
+ if (numbersToInsert.length > 0) {
150
+ await db.insert(adapter.tables[numbersTableName]).values(numbersToInsert).returning();
151
+ }
152
+ // //////////////////////////////////
153
+ // INSERT BLOCKS
154
+ // //////////////////////////////////
155
+ const insertedBlockRows = {};
156
+ for (const [blockName, blockRows] of Object.entries(blocksToInsert)){
157
+ if (operation === 'update') {
158
+ await (0, _deleteExistingRowsByPath.deleteExistingRowsByPath)({
159
+ adapter,
160
+ db,
161
+ parentID: insertedRow.id,
162
+ pathColumnName: '_path',
163
+ rows: blockRows.map(({ row })=>row),
164
+ tableName: `${tableName}_blocks_${blockName}`
165
+ });
166
+ }
167
+ insertedBlockRows[blockName] = await db.insert(adapter.tables[`${tableName}_blocks_${blockName}`]).values(blockRows.map(({ row })=>row)).returning();
168
+ insertedBlockRows[blockName].forEach((row, i)=>{
169
+ blockRows[i].row = row;
170
+ });
171
+ const blockLocaleIndexMap = [];
172
+ const blockLocaleRowsToInsert = blockRows.reduce((acc, blockRow, i)=>{
173
+ if (Object.entries(blockRow.locales).length > 0) {
174
+ Object.entries(blockRow.locales).forEach(([blockLocale, blockLocaleData])=>{
175
+ if (Object.keys(blockLocaleData).length > 0) {
176
+ blockLocaleData._parentID = blockRow.row.id;
177
+ blockLocaleData._locale = blockLocale;
178
+ acc.push(blockLocaleData);
179
+ blockLocaleIndexMap.push(i);
180
+ }
181
+ });
182
+ }
183
+ return acc;
184
+ }, []);
185
+ if (blockLocaleRowsToInsert.length > 0) {
186
+ await db.insert(adapter.tables[`${tableName}_blocks_${blockName}_locales`]).values(blockLocaleRowsToInsert).returning();
187
+ }
188
+ await (0, _insertArrays.insertArrays)({
189
+ adapter,
190
+ arrays: blockRows.map(({ arrays })=>arrays),
191
+ db,
192
+ parentRows: insertedBlockRows[blockName]
193
+ });
194
+ }
195
+ // //////////////////////////////////
196
+ // INSERT ARRAYS RECURSIVELY
197
+ // //////////////////////////////////
198
+ if (operation === 'update') {
199
+ for (const arrayTableName of Object.keys(rowToInsert.arrays)){
200
+ await (0, _deleteExistingArrayRows.deleteExistingArrayRows)({
201
+ adapter,
202
+ db,
203
+ parentID: insertedRow.id,
204
+ tableName: arrayTableName
174
205
  });
175
206
  }
176
- return acc;
177
- }, []);
178
- if (blockLocaleRowsToInsert.length > 0) {
179
- await db.insert(adapter.tables[`${tableName}_blocks_${blockName}_locales`]).values(blockLocaleRowsToInsert).returning();
180
207
  }
181
208
  await (0, _insertArrays.insertArrays)({
182
209
  adapter,
183
- arrays: blockRows.map(({ arrays })=>arrays),
210
+ arrays: [
211
+ rowToInsert.arrays
212
+ ],
184
213
  db,
185
- parentRows: insertedBlockRows[blockName]
214
+ parentRows: [
215
+ insertedRow
216
+ ]
186
217
  });
187
- }
188
- // //////////////////////////////////
189
- // INSERT ARRAYS RECURSIVELY
190
- // //////////////////////////////////
191
- if (operation === 'update') {
192
- for (const arrayTableName of Object.keys(rowToInsert.arrays)){
193
- await (0, _deleteExistingArrayRows.deleteExistingArrayRows)({
194
- adapter,
195
- db,
196
- parentID: insertedRow.id,
197
- tableName: arrayTableName
198
- });
218
+ // //////////////////////////////////
219
+ // INSERT hasMany SELECTS
220
+ // //////////////////////////////////
221
+ for (const [selectTableName, tableRows] of Object.entries(selectsToInsert)){
222
+ const selectTable = adapter.tables[selectTableName];
223
+ if (operation === 'update') {
224
+ await db.delete(selectTable).where((0, _drizzleorm.eq)(selectTable.parent, insertedRow.id));
225
+ }
226
+ await db.insert(selectTable).values(tableRows).returning();
199
227
  }
200
- }
201
- await (0, _insertArrays.insertArrays)({
202
- adapter,
203
- arrays: [
204
- rowToInsert.arrays
205
- ],
206
- db,
207
- parentRows: [
208
- insertedRow
209
- ]
210
- });
211
228
  // //////////////////////////////////
212
- // INSERT hasMany SELECTS
229
+ // Error Handling
213
230
  // //////////////////////////////////
214
- for (const [selectTableName, tableRows] of Object.entries(selectsToInsert)){
215
- const selectTable = adapter.tables[selectTableName];
216
- if (operation === 'update') {
217
- await db.delete(selectTable).where((0, _drizzleorm.eq)(selectTable.parent, insertedRow.id));
218
- }
219
- await db.insert(selectTable).values(tableRows).returning();
231
+ } catch (error) {
232
+ throw error.code === '23505' ? new _errors.ValidationError([
233
+ {
234
+ field: adapter.fieldConstraints[tableName][error.constraint],
235
+ message: req.t('error:valueMustBeUnique')
236
+ }
237
+ ], req?.t ?? (0, _utilities.i18nInit)(req.payload.config.i18n).t) : error;
220
238
  }
221
239
  // //////////////////////////////////
222
240
  // RETRIEVE NEWLY UPDATED ROW
@@ -240,4 +258,4 @@ const upsertRow = async ({ id, adapter, data, db, fields, operation, path = '',
240
258
  return result;
241
259
  };
242
260
 
243
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91cHNlcnRSb3cvaW5kZXgudHMiXSwic291cmNlc0NvbnRlbnQiOlsiLyogZXNsaW50LWRpc2FibGUgbm8tcGFyYW0tcmVhc3NpZ24gKi9cbmltcG9ydCB0eXBlIHsgVHlwZVdpdGhJRCB9IGZyb20gJ3BheWxvYWQvdHlwZXMnXG5cbmltcG9ydCB7IGVxIH0gZnJvbSAnZHJpenpsZS1vcm0nXG5cbmltcG9ydCB0eXBlIHsgQmxvY2tSb3dUb0luc2VydCB9IGZyb20gJy4uL3RyYW5zZm9ybS93cml0ZS90eXBlcydcbmltcG9ydCB0eXBlIHsgQXJncyB9IGZyb20gJy4vdHlwZXMnXG5cbmltcG9ydCB7IGJ1aWxkRmluZE1hbnlBcmdzIH0gZnJvbSAnLi4vZmluZC9idWlsZEZpbmRNYW55QXJncydcbmltcG9ydCB7IHRyYW5zZm9ybS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SytFLEtBQUtDLElBQUFBLG1CQUFRLEVBQUNoRixJQUFJaUYsT0FBTyxDQUFDQyxNQUFNLENBQUNDLElBQUksRUFBRUosQ0FBQyxJQUUvQ1A7SUFDTjtJQUVBLHFDQUFxQztJQUNyQyw2QkFBNkI7SUFDN0IscUNBQXFDO0lBRXJDLE1BQU1ZLGVBQWVDLElBQUFBLG9DQUFpQixFQUFDO1FBQ3JDM0Y7UUFDQTRGLE9BQU87UUFDUHpGO1FBQ0FJO0lBQ0Y7SUFFQW1GLGFBQWFqRixLQUFLLEdBQUcwQyxJQUFBQSxjQUFFLEVBQUNuRCxRQUFRYyxNQUFNLENBQUNQLFVBQVUsQ0FBQ1IsRUFBRSxFQUFFYSxZQUFZYixFQUFFO0lBRXBFLE1BQU04RixNQUFNLE1BQU0zRixHQUFHNEYsS0FBSyxDQUFDdkYsVUFBVSxDQUFDd0YsU0FBUyxDQUFDTDtJQUVoRCxxQ0FBcUM7SUFDckMsaUJBQWlCO0lBQ2pCLHFDQUFxQztJQUVyQyxNQUFNTSxTQUFTQyxJQUFBQSxlQUFTLEVBQUk7UUFDMUJULFFBQVF4RixRQUFRdUYsT0FBTyxDQUFDQyxNQUFNO1FBQzlCdkYsTUFBTTRGO1FBQ04xRjtJQUNGO0lBRUEsT0FBTzZGO0FBQ1QifQ==
@@ -1,5 +1,5 @@
1
1
  import type { SQL } from 'drizzle-orm';
2
- import type { Field } from 'payload/types';
2
+ import type { Field, PayloadRequest } from 'payload/types';
3
3
  import type { DrizzleDB, GenericColumn, PostgresAdapter } from '../types';
4
4
  type BaseArgs = {
5
5
  adapter: PostgresAdapter;
@@ -8,6 +8,7 @@ type BaseArgs = {
8
8
  fields: Field[];
9
9
  path?: string;
10
10
  tableName: string;
11
+ req: PayloadRequest;
11
12
  };
12
13
  type CreateArgs = BaseArgs & {
13
14
  id?: never;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/upsertRow/types.ts"],"names":[],"mappings":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AAA;IACxB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC7B,EAAE,EAAE,SAAS,CAAA;IACb,MAAM,EAAE,KAAK,EAAE,CAAA;IACf,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,SAAS,EAAE,MAAM,CAAA;IACjB,GAAG,EAAE,cAAc,CAAA;CACpB,CAAA;AAED,KAAK,UAAU,GAAG,QAAQ,GAAG;IAC3B,EAAE,CAAC,EAAE,KAAK,CAAA;IACV,SAAS,EAAE,QAAQ,CAAA;IACnB,YAAY,CAAC,EAAE,KAAK,CAAA;IACpB,KAAK,CAAC,EAAE,KAAK,CAAA;CACd,CAAA;AAED,KAAK,UAAU,GAAG,QAAQ,GAAG;IAC3B,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACpB,SAAS,EAAE,QAAQ,CAAA;IACnB,YAAY,CAAC,EAAE,aAAa,CAAA;IAC5B,KAAK,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;CACrB,CAAA;AAED,MAAM,MAAM,IAAI,GAAG,UAAU,GAAG,UAAU,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payloadcms/db-postgres",
3
- "version": "0.1.9",
3
+ "version": "0.1.11",
4
4
  "description": "The officially supported Postgres database adapter for Payload",
5
5
  "repository": "https://github.com/payloadcms/payload",
6
6
  "license": "MIT",
@@ -24,8 +24,11 @@
24
24
  "devDependencies": {
25
25
  "@types/pg": "8.10.2",
26
26
  "@types/to-snake-case": "1.0.0",
27
- "@payloadcms/eslint-config": "0.0.1",
28
- "payload": "2.0.7"
27
+ "@payloadcms/eslint-config": "1.0.0",
28
+ "payload": "2.0.14"
29
+ },
30
+ "peerDependencies": {
31
+ "payload": "^2.0.0"
29
32
  },
30
33
  "publishConfig": {
31
34
  "registry": "https://registry.npmjs.org/"