@payloadcms/db-postgres 0.5.1 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. package/dist/connect.d.ts.map +1 -1
  2. package/dist/connect.js +42 -4
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +6 -2
  5. package/dist/init.d.ts.map +1 -1
  6. package/dist/init.js +5 -7
  7. package/dist/queries/buildQuery.d.ts.map +1 -1
  8. package/dist/queries/buildQuery.js +3 -2
  9. package/dist/queries/getTableColumnFromPath.d.ts +9 -1
  10. package/dist/queries/getTableColumnFromPath.d.ts.map +1 -1
  11. package/dist/queries/getTableColumnFromPath.js +46 -15
  12. package/dist/queries/parseParams.d.ts.map +1 -1
  13. package/dist/queries/parseParams.js +6 -8
  14. package/dist/queries/sanitizeQueryValue.d.ts +3 -1
  15. package/dist/queries/sanitizeQueryValue.d.ts.map +1 -1
  16. package/dist/queries/sanitizeQueryValue.js +5 -3
  17. package/dist/schema/build.d.ts.map +1 -1
  18. package/dist/schema/build.js +8 -10
  19. package/dist/schema/parentIDColumnMap.d.ts +3 -6
  20. package/dist/schema/parentIDColumnMap.d.ts.map +1 -1
  21. package/dist/schema/parentIDColumnMap.js +2 -1
  22. package/dist/schema/setColumnID.d.ts +11 -0
  23. package/dist/schema/setColumnID.d.ts.map +1 -0
  24. package/dist/schema/setColumnID.js +34 -0
  25. package/dist/schema/traverseFields.d.ts.map +1 -1
  26. package/dist/schema/traverseFields.js +2 -1
  27. package/dist/types.d.ts +3 -0
  28. package/dist/types.d.ts.map +1 -1
  29. package/dist/upsertRow/insertArrays.d.ts.map +1 -1
  30. package/dist/upsertRow/insertArrays.js +6 -4
  31. package/package.json +3 -3
  32. package/dist/schema/getConfigIDType.d.ts +0 -3
  33. package/dist/schema/getConfigIDType.d.ts.map +0 -1
  34. package/dist/schema/getConfigIDType.js +0 -25
@@ -21,7 +21,7 @@ const insertArrays = async ({ adapter, arrays, db, parentRows })=>{
21
21
  rows: []
22
22
  };
23
23
  }
24
- const parentID = parentRows[parentRowIndex].id || parentRows[parentRowIndex]._parentID;
24
+ const parentID = parentRows[parentRowIndex].id;
25
25
  // Add any sub arrays that need to be created
26
26
  // We will call this recursively below
27
27
  arrayRows.forEach((arrayRow)=>{
@@ -42,8 +42,10 @@ const insertArrays = async ({ adapter, arrays, db, parentRows })=>{
42
42
  // Insert all corresponding arrays
43
43
  // (one insert per array table)
44
44
  for (const [tableName, row] of Object.entries(rowsByTable)){
45
+ // the nested arrays need the ID for the parentID foreign key
46
+ let insertedRows;
45
47
  if (row.rows.length > 0) {
46
- await db.insert(adapter.tables[tableName]).values(row.rows).returning();
48
+ insertedRows = await db.insert(adapter.tables[tableName]).values(row.rows).returning();
47
49
  }
48
50
  // Insert locale rows
49
51
  if (adapter.tables[`${tableName}_locales`] && row.locales.length > 0) {
@@ -55,10 +57,10 @@ const insertArrays = async ({ adapter, arrays, db, parentRows })=>{
55
57
  adapter,
56
58
  arrays: row.arrays,
57
59
  db,
58
- parentRows: row.rows
60
+ parentRows: insertedRows
59
61
  });
60
62
  }
61
63
  }
62
64
  };
63
65
 
64
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91cHNlcnRSb3cvaW5zZXJ0QXJyYXlzLnRzIl0sInNvdXJjZXNDb250ZW50IjpbIi8qIGVzbGludC1kaXNhYmxlIG5vLXBhcmFtLXJlYXNzaWduICovXG5pbXBvcnQgdHlwZSB7IEFycmF5Um93VG9JbnNlcnQgfSBmcm9tICcuLi90cmFuc2Zvcm0vd3JpdGUvdHlwZXMnXG5pbXBvcnQgdHlwZSB7IERyaXp6bGVEQiwgUG9zdGdyZXNBZGFwdGVyIH0gZnJvbSAnLi4vdHlwZXMnXG5cbnR5cGUgQXJncyA9IHtcbiAgYWRhcHRlcjogUG9zdGdyZXNBZGFwdGVyXG4gIGFycmF5czoge1xuICAgIFt0YWJsZU5hbWU6IHN0cmluZ106IEFycmF5Um93VG9JbnNlcnRbXV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QUMsQ0FBQyxFQUFFakIsVUFBVSxRQUFRLENBQUMsQ0FBQyxFQUFFa0IsTUFBTSxDQUFDUixJQUFJUixPQUFPLEVBQUVpQixTQUFTO1FBQ3ZGO1FBRUEsMERBQTBEO1FBQzFELElBQUlULElBQUluQixNQUFNLENBQUNpQixNQUFNLEdBQUcsR0FBRztZQUN6QixNQUFNbkIsYUFBYTtnQkFDakJDO2dCQUNBQyxRQUFRbUIsSUFBSW5CLE1BQU07Z0JBQ2xCQztnQkFDQUMsWUFBWXNCO1lBQ2Q7UUFDRjtJQUNGO0FBQ0YifQ==
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payloadcms/db-postgres",
3
- "version": "0.5.1",
3
+ "version": "0.6.0",
4
4
  "description": "The officially supported Postgres database adapter for Payload",
5
5
  "repository": "https://github.com/payloadcms/payload",
6
6
  "license": "MIT",
@@ -25,8 +25,8 @@
25
25
  "devDependencies": {
26
26
  "@types/pg": "8.10.2",
27
27
  "@types/to-snake-case": "1.0.0",
28
- "@payloadcms/eslint-config": "1.1.1",
29
- "payload": "2.10.0"
28
+ "payload": "2.11.1",
29
+ "@payloadcms/eslint-config": "1.1.1"
30
30
  },
31
31
  "peerDependencies": {
32
32
  "payload": "^2.0.0"
@@ -1,3 +0,0 @@
1
- import { type Field } from 'payload/types';
2
- export declare const getConfigIDType: (fields: Field[]) => string;
3
- //# sourceMappingURL=getConfigIDType.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getConfigIDType.d.ts","sourceRoot":"","sources":["../../src/schema/getConfigIDType.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,KAAK,EAAoB,MAAM,eAAe,CAAA;AAE5D,eAAO,MAAM,eAAe,WAAY,KAAK,EAAE,KAAG,MAcjD,CAAA"}
@@ -1,25 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "getConfigIDType", {
6
- enumerable: true,
7
- get: function() {
8
- return getConfigIDType;
9
- }
10
- });
11
- const _types = require("payload/types");
12
- const getConfigIDType = (fields)=>{
13
- const idField = fields.find((field)=>(0, _types.fieldAffectsData)(field) && field.name === 'id');
14
- if (idField) {
15
- if (idField.type === 'number') {
16
- return 'numeric';
17
- }
18
- if (idField.type === 'text') {
19
- return 'varchar';
20
- }
21
- }
22
- return 'integer';
23
- };
24
-
25
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9zY2hlbWEvZ2V0Q29uZmlnSURUeXBlLnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IHR5cGUgRmllbGQsIGZpZWxkQWZmZWN0c0RhdGEgfSBmcm9tICdwYXlsb2FkL3R5cGVzJ1xuXG5leHBvcnQgY29uc3QgZ2V0Q29uZmlnSURUeXBlID0gKGZpZWxkczogRmllbGRbXSk6IHN0cmluZyA9PiB7XG4gIGNvbnN0IGlkRmllbGQgPSBmaWVsZHMuZmluZCgoZmllbGQpID0+IGZpZWxkQWZmZWN0c0RhdGEoZmllbGQpICYmIGZpZWxkLm5hbWUgPT09ICdpZCcpXG5cbiAgaWYgKGlkRmllbGQpIHtcbiAgICBpZiAoaWRGaWVsZC50eXBlID09PSAnbnVtYmVyJykge1xuICAgICAgcmV0dXJuICdudW1lcmljJ1xuICAgIH1cblxuICAgIGlmIChpZEZpZWxkLnR5cGUgPT09ICd0ZXh0Jykge1xuICAgICAgcmV0dXJuICd2YXJjaGFyJ1xuICAgIH1cbiAgfVxuXG4gIHJldHVybiAnaW50ZWdlcidcbn1cbiJdLCJuYW1lcyI6WyJnZXRDb25maWdJRFR5cGUiLCJmaWVsZHMiLCJpZEZpZWxkIiwiZmluZCIsImZpZWxkIiwiZmllbGRBZmZlY3RzRGF0YSIsIm5hbWUiLCJ0eXBlIl0sIm1hcHBpbmdzIjoiOzs7OytCQUVhQTs7O2VBQUFBOzs7dUJBRmdDO0F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