@payloadcms/db-postgres 0.1.10 → 0.1.11

Sign up to get free protection for your applications and to get access to all the features.
@@ -42,9 +42,10 @@ async function updateGlobalVersion({ id, global, locale, req = {}, versionData,
42
42
  fields,
43
43
  operation: 'update',
44
44
  tableName,
45
- where
45
+ where,
46
+ req
46
47
  });
47
48
  return result;
48
49
  }
49
50
 
50
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy91cGRhdGVHbG9iYWxWZXJzaW9uLnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB0eXBlIHsgVHlwZVdpdGhWZXJzaW9uIH0gZnJvbSAncGF5bG9hZC9kYXRhYmFzZSdcbmltcG9ydCB0eXBlIHsgVXBkYXRlR2xvYmFsVmVyc2lvbkFyZ3MgfSBmcm9tICdwYXlsb2FkL2RhdGFiYXNlJ1xuaW1wb3J0IHR5cGUgeyBQYXlsb2FkUmVxdWVzdCwgU2FuaXRpemVkR2xvYmFsQ29uZmlnLCBUeXBlV2l0aElEIH0gZnJvbSAncGF5bG9hZC90eXBlcydcblxuaW1wb3J0IHsgYnVpbGRWZXJzaW9uR2xvYmFsRmllbGRzIH0gZnJvbSAncGF5bG9hZC92ZXJzaW9ucydcbmltcG9ydCB0b1NuYWtlQ2FzZSBmcm9tICd0by1zbmFrZS1jYXNlJ1xuXG5pbXBvcnQgdHlwZSB7IFBvc3RncmVzQWRhcHRlciB9IGZyb20gJy4vdHlwZXMnXG5cbmltcG9ydCBidWlsZFF1ZXJ5IGZyb20gJy4vcXVlcmllcy9idWlsZFF1ZXJ5J1xuaW1wb3J0IHsgdXBzZXJ0Um93IH0gZnJvbSAnLi91cHNlcnRSb3cnXG5cbmV4cG9ydCBhc3luYyBmdW5jdGlvbiB1cGRhdGVHbG9iYWxWZXJzaW9uPFQgZXh0ZW5kcyBUeXBlV2l0aElEPihcbiAgdGhpczogUG9zdGdyZXNBZGFwdGVyLFxuICB7XG4gICAgaWQsXG4gIC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C,CAAC,SAAS,UAAU,EACtD,IAAI,EAAE,eAAe,EACrB,EACE,EAAE,EACF,UAAU,EACV,MAAM,EACN,GAA0B,EAC1B,WAAW,EACX,KAAK,EAAE,QAAQ,GAChB,EAAE,iBAAiB,CAAC,CAAC,CAAC,+BA4BxB"}
1
+ {"version":3,"file":"updateVersion.d.ts","sourceRoot":"","sources":["../src/updateVersion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AAC1E,OAAO,KAAK,EAA6C,UAAU,EAAE,MAAM,eAAe,CAAA;AAK1F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAK9C,wBAAsB,aAAa,CAAC,CAAC,SAAS,UAAU,EACtD,IAAI,EAAE,eAAe,EACrB,EACE,EAAE,EACF,UAAU,EACV,MAAM,EACN,GAA0B,EAC1B,WAAW,EACX,KAAK,EAAE,QAAQ,GAChB,EAAE,iBAAiB,CAAC,CAAC,CAAC,+BA6BxB"}
@@ -42,9 +42,10 @@ async function updateVersion({ id, collection, locale, req = {}, versionData, wh
42
42
  fields,
43
43
  operation: 'update',
44
44
  tableName,
45
- where
45
+ where,
46
+ req
46
47
  });
47
48
  return result;
48
49
  }
49
50
 
50
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy91cGRhdGVWZXJzaW9uLnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB0eXBlIHsgVHlwZVdpdGhWZXJzaW9uLCBVcGRhdGVWZXJzaW9uQXJncyB9IGZyb20gJ3BheWxvYWQvZGF0YWJhc2UnXG5pbXBvcnQgdHlwZSB7IFBheWxvYWRSZXF1ZXN0LCBTYW5pdGl6ZWRDb2xsZWN0aW9uQ29uZmlnLCBUeXBlV2l0aElEIH0gZnJvbSAncGF5bG9hZC90eXBlcydcblxuaW1wb3J0IHsgYnVpbGRWZXJzaW9uQ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BQU9vQjtBQUNUIn0=
@@ -1,4 +1,4 @@
1
1
  import type { TypeWithID } from 'payload/types';
2
2
  import type { Args } from './types';
3
- export declare const upsertRow: <T extends TypeWithID>({ id, adapter, data, db, fields, operation, path, tableName, upsertTarget, where, }: Args) => Promise<T>;
3
+ export declare const upsertRow: <T extends TypeWithID>({ id, adapter, data, db, fields, operation, path, req, tableName, upsertTarget, where, }: Args) => Promise<T>;
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/upsertRow/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAK/C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AASnC,eAAO,MAAM,SAAS,8GAWnB,IAAI,eA8QN,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/upsertRow/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAK/C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAWnC,eAAO,MAAM,SAAS,mHAYnB,IAAI,eAmSN,CAAA"}
@@ -15,7 +15,9 @@ 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)({
@@ -27,200 +29,212 @@ const upsertRow = async ({ id, adapter, data, db, fields, operation, path = '',
27
29
  });
28
30
  // First, we insert the main row
29
31
  let insertedRow;
30
- if (operation === 'update') {
31
- const target = upsertTarget || adapter.tables[tableName].id;
32
- if (id) {
33
- rowToInsert.row.id = id;
34
- [insertedRow] = await db.insert(adapter.tables[tableName]).values(rowToInsert.row).onConflictDoUpdate({
35
- set: rowToInsert.row,
36
- target
37
- }).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
+ }
38
48
  } else {
39
- [insertedRow] = await db.insert(adapter.tables[tableName]).values(rowToInsert.row).onConflictDoUpdate({
40
- set: rowToInsert.row,
41
- target,
42
- where
43
- }).returning();
49
+ [insertedRow] = await db.insert(adapter.tables[tableName]).values(rowToInsert.row).returning();
44
50
  }
45
- } else {
46
- [insertedRow] = await db.insert(adapter.tables[tableName]).values(rowToInsert.row).returning();
47
- }
48
- const localesToInsert = [];
49
- const relationsToInsert = [];
50
- const numbersToInsert = [];
51
- const blocksToInsert = {};
52
- const selectsToInsert = {};
53
- // If there are locale rows with data, add the parent and locale to each
54
- if (Object.keys(rowToInsert.locales).length > 0) {
55
- Object.entries(rowToInsert.locales).forEach(([locale, localeRow])=>{
56
- localeRow._parentID = insertedRow.id;
57
- localeRow._locale = locale;
58
- localesToInsert.push(localeRow);
59
- });
60
- }
61
- // If there are relationships, add parent to each
62
- if (rowToInsert.relationships.length > 0) {
63
- rowToInsert.relationships.forEach((relation)=>{
64
- relation.parent = insertedRow.id;
65
- relationsToInsert.push(relation);
66
- });
67
- }
68
- // If there are numbers, add parent to each
69
- if (rowToInsert.numbers.length > 0) {
70
- rowToInsert.numbers.forEach((numberRow)=>{
71
- numberRow.parent = insertedRow.id;
72
- numbersToInsert.push(numberRow);
73
- });
74
- }
75
- // If there are selects, add parent to each, and then
76
- // store by table name and rows
77
- if (Object.keys(rowToInsert.selects).length > 0) {
78
- Object.entries(rowToInsert.selects).forEach(([selectTableName, selectRows])=>{
79
- selectRows.forEach((row)=>{
80
- row.parent = insertedRow.id;
81
- if (!selectsToInsert[selectTableName]) selectsToInsert[selectTableName] = [];
82
- 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);
83
99
  });
84
100
  });
85
- }
86
- // If there are blocks, add parent to each, and then
87
- // store by table name and rows
88
- Object.keys(rowToInsert.blocks).forEach((blockName)=>{
89
- rowToInsert.blocks[blockName].forEach((blockRow)=>{
90
- blockRow.row._parentID = insertedRow.id;
91
- if (!blocksToInsert[blockName]) blocksToInsert[blockName] = [];
92
- if (blockRow.row.uuid) {
93
- delete blockRow.row.uuid;
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));
94
108
  }
95
- blocksToInsert[blockName].push(blockRow);
96
- });
97
- });
98
- // //////////////////////////////////
99
- // INSERT LOCALES
100
- // //////////////////////////////////
101
- if (localesToInsert.length > 0) {
102
- const localeTable = adapter.tables[`${tableName}_locales`];
109
+ await db.insert(localeTable).values(localesToInsert);
110
+ }
111
+ // //////////////////////////////////
112
+ // INSERT RELATIONSHIPS
113
+ // //////////////////////////////////
114
+ const relationshipsTableName = `${tableName}_rels`;
103
115
  if (operation === 'update') {
104
- 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
+ });
105
129
  }
106
- await db.insert(localeTable).values(localesToInsert);
107
- }
108
- // //////////////////////////////////
109
- // INSERT RELATIONSHIPS
110
- // //////////////////////////////////
111
- const relationshipsTableName = `${tableName}_rels`;
112
- if (operation === 'update') {
113
- await (0, _deleteExistingRowsByPath.deleteExistingRowsByPath)({
114
- adapter,
115
- db,
116
- localeColumnName: 'locale',
117
- parentColumnName: 'parent',
118
- parentID: insertedRow.id,
119
- pathColumnName: 'path',
120
- rows: [
121
- ...relationsToInsert,
122
- ...rowToInsert.relationshipsToDelete
123
- ],
124
- tableName: relationshipsTableName
125
- });
126
- }
127
- if (relationsToInsert.length > 0) {
128
- await db.insert(adapter.tables[relationshipsTableName]).values(relationsToInsert);
129
- }
130
- // //////////////////////////////////
131
- // INSERT hasMany NUMBERS
132
- // //////////////////////////////////
133
- const numbersTableName = `${tableName}_numbers`;
134
- if (operation === 'update') {
135
- await (0, _deleteExistingRowsByPath.deleteExistingRowsByPath)({
136
- adapter,
137
- db,
138
- localeColumnName: 'locale',
139
- parentColumnName: 'parent',
140
- parentID: insertedRow.id,
141
- pathColumnName: 'path',
142
- rows: numbersToInsert,
143
- tableName: numbersTableName
144
- });
145
- }
146
- if (numbersToInsert.length > 0) {
147
- await db.insert(adapter.tables[numbersTableName]).values(numbersToInsert).returning();
148
- }
149
- // //////////////////////////////////
150
- // INSERT BLOCKS
151
- // //////////////////////////////////
152
- const insertedBlockRows = {};
153
- 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`;
154
137
  if (operation === 'update') {
155
138
  await (0, _deleteExistingRowsByPath.deleteExistingRowsByPath)({
156
139
  adapter,
157
140
  db,
141
+ localeColumnName: 'locale',
142
+ parentColumnName: 'parent',
158
143
  parentID: insertedRow.id,
159
- pathColumnName: '_path',
160
- rows: blockRows.map(({ row })=>row),
161
- tableName: `${tableName}_blocks_${blockName}`
144
+ pathColumnName: 'path',
145
+ rows: numbersToInsert,
146
+ tableName: numbersTableName
162
147
  });
163
148
  }
164
- insertedBlockRows[blockName] = await db.insert(adapter.tables[`${tableName}_blocks_${blockName}`]).values(blockRows.map(({ row })=>row)).returning();
165
- insertedBlockRows[blockName].forEach((row, i)=>{
166
- blockRows[i].row = row;
167
- });
168
- const blockLocaleIndexMap = [];
169
- const blockLocaleRowsToInsert = blockRows.reduce((acc, blockRow, i)=>{
170
- if (Object.entries(blockRow.locales).length > 0) {
171
- Object.entries(blockRow.locales).forEach(([blockLocale, blockLocaleData])=>{
172
- if (Object.keys(blockLocaleData).length > 0) {
173
- blockLocaleData._parentID = blockRow.row.id;
174
- blockLocaleData._locale = blockLocale;
175
- acc.push(blockLocaleData);
176
- blockLocaleIndexMap.push(i);
177
- }
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
178
205
  });
179
206
  }
180
- return acc;
181
- }, []);
182
- if (blockLocaleRowsToInsert.length > 0) {
183
- await db.insert(adapter.tables[`${tableName}_blocks_${blockName}_locales`]).values(blockLocaleRowsToInsert).returning();
184
207
  }
185
208
  await (0, _insertArrays.insertArrays)({
186
209
  adapter,
187
- arrays: blockRows.map(({ arrays })=>arrays),
210
+ arrays: [
211
+ rowToInsert.arrays
212
+ ],
188
213
  db,
189
- parentRows: insertedBlockRows[blockName]
214
+ parentRows: [
215
+ insertedRow
216
+ ]
190
217
  });
191
- }
192
- // //////////////////////////////////
193
- // INSERT ARRAYS RECURSIVELY
194
- // //////////////////////////////////
195
- if (operation === 'update') {
196
- for (const arrayTableName of Object.keys(rowToInsert.arrays)){
197
- await (0, _deleteExistingArrayRows.deleteExistingArrayRows)({
198
- adapter,
199
- db,
200
- parentID: insertedRow.id,
201
- tableName: arrayTableName
202
- });
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();
203
227
  }
204
- }
205
- await (0, _insertArrays.insertArrays)({
206
- adapter,
207
- arrays: [
208
- rowToInsert.arrays
209
- ],
210
- db,
211
- parentRows: [
212
- insertedRow
213
- ]
214
- });
215
228
  // //////////////////////////////////
216
- // INSERT hasMany SELECTS
229
+ // Error Handling
217
230
  // //////////////////////////////////
218
- for (const [selectTableName, tableRows] of Object.entries(selectsToInsert)){
219
- const selectTable = adapter.tables[selectTableName];
220
- if (operation === 'update') {
221
- await db.delete(selectTable).where((0, _drizzleorm.eq)(selectTable.parent, insertedRow.id));
222
- }
223
- 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;
224
238
  }
225
239
  // //////////////////////////////////
226
240
  // RETRIEVE NEWLY UPDATED ROW
@@ -244,4 +258,4 @@ const upsertRow = async ({ id, adapter, data, db, fields, operation, path = '',
244
258
  return result;
245
259
  };
246
260
 
247
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91cHNlcnRSb3cvaW5kZXgudHMiXSwic291cmNlc0NvbnRlbnQiOlsiLyogZXNsaW50LWRpc2FibGUgbm8tcGFyYW0tcmVhc3NpZ24gKi9cbmltcG9ydCB0eXBlIHsgVHlwZV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DQUFDdkYsVUFBVSxDQUFDd0YsU0FBUyxDQUFDTDtJQUVoRCxxQ0FBcUM7SUFDckMsaUJBQWlCO0lBQ2pCLHFDQUFxQztJQUVyQyxNQUFNTSxTQUFTQyxJQUFBQSxlQUFTLEVBQUk7UUFDMUJULFFBQVF4RixRQUFRdUYsT0FBTyxDQUFDQyxNQUFNO1FBQzlCdkYsTUFBTTRGO1FBQ04xRjtJQUNGO0lBRUEsT0FBTzZGO0FBQ1QifQ==
@@ -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":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAE1C,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAEzE,KAAK,QAAQ,GAAG;IACd,OAAO,EAAE,eAAe,CAAA;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;CAClB,CAAA;AAED,KAAK,UAAU,GAAG,QAAQ,GAAG;IAC3B,EAAE,CAAC,EAAE,KAAK,CAAA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S,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.10",
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,8 @@
24
24
  "devDependencies": {
25
25
  "@types/pg": "8.10.2",
26
26
  "@types/to-snake-case": "1.0.0",
27
- "payload": "2.0.11",
28
- "@payloadcms/eslint-config": "1.0.0"
27
+ "@payloadcms/eslint-config": "1.0.0",
28
+ "payload": "2.0.14"
29
29
  },
30
30
  "peerDependencies": {
31
31
  "payload": "^2.0.0"