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

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 +5 -4
package/dist/connect.js CHANGED
@@ -1,23 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "connect", {
6
- enumerable: true,
7
- get: function() {
8
- return connect;
9
- }
10
- });
11
- const _drizzleorm = require("drizzle-orm");
12
- const _nodepostgres = require("drizzle-orm/node-postgres");
13
- const _pgcore = require("drizzle-orm/pg-core");
14
- const _pg = require("pg");
15
- const _prompts = /*#__PURE__*/ _interop_require_default(require("prompts"));
16
- function _interop_require_default(obj) {
17
- return obj && obj.__esModule ? obj : {
18
- default: obj
19
- };
20
- }
1
+ import { eq, sql } from 'drizzle-orm';
2
+ import { drizzle } from 'drizzle-orm/node-postgres';
3
+ import { numeric, timestamp, varchar } from 'drizzle-orm/pg-core';
4
+ import { Pool } from 'pg';
5
+ import prompts from 'prompts';
21
6
  const connectWithReconnect = async function({ adapter, payload, reconnect = false }) {
22
7
  let result;
23
8
  if (!reconnect) {
@@ -53,7 +38,7 @@ const connectWithReconnect = async function({ adapter, payload, reconnect = fals
53
38
  }
54
39
  });
55
40
  };
56
- const connect = async function connect(options = {
41
+ export const connect = async function connect(options = {
57
42
  hotReload: false
58
43
  }) {
59
44
  const { hotReload } = options;
@@ -63,20 +48,20 @@ const connect = async function connect(options = {
63
48
  ...this.enums
64
49
  };
65
50
  try {
66
- this.pool = new _pg.Pool(this.poolOptions);
51
+ this.pool = new Pool(this.poolOptions);
67
52
  await connectWithReconnect({
68
53
  adapter: this,
69
54
  payload: this.payload
70
55
  });
71
56
  const logger = this.logger || false;
72
- this.drizzle = (0, _nodepostgres.drizzle)(this.pool, {
57
+ this.drizzle = drizzle(this.pool, {
73
58
  logger,
74
59
  schema: this.schema
75
60
  });
76
61
  if (!hotReload) {
77
62
  if (process.env.PAYLOAD_DROP_DATABASE === 'true') {
78
63
  this.payload.logger.info(`---- DROPPING TABLES SCHEMA(${this.schemaName || 'public'}) ----`);
79
- await this.drizzle.execute(_drizzleorm.sql.raw(`
64
+ await this.drizzle.execute(sql.raw(`
80
65
  drop schema if exists ${this.schemaName || 'public'} cascade;
81
66
  create schema ${this.schemaName || 'public'};
82
67
  `));
@@ -98,7 +83,7 @@ const connect = async function connect(options = {
98
83
  message += `DATA LOSS WARNING: Possible data loss detected if schema is pushed.\n\n`;
99
84
  }
100
85
  message += `Accept warnings and push schema to database?`;
101
- const { confirm: acceptWarnings } = await (0, _prompts.default)({
86
+ const { confirm: acceptWarnings } = await prompts({
102
87
  name: 'confirm',
103
88
  type: 'confirm',
104
89
  initial: false,
@@ -117,12 +102,12 @@ const connect = async function connect(options = {
117
102
  await apply();
118
103
  // Migration table def in order to use query using drizzle
119
104
  const migrationsSchema = this.pgSchema.table('payload_migrations', {
120
- name: (0, _pgcore.varchar)('name'),
121
- batch: (0, _pgcore.numeric)('batch'),
122
- created_at: (0, _pgcore.timestamp)('created_at'),
123
- updated_at: (0, _pgcore.timestamp)('updated_at')
105
+ name: varchar('name'),
106
+ batch: numeric('batch'),
107
+ created_at: timestamp('created_at'),
108
+ updated_at: timestamp('updated_at')
124
109
  });
125
- const devPush = await this.drizzle.select().from(migrationsSchema).where((0, _drizzleorm.eq)(migrationsSchema.batch, '-1'));
110
+ const devPush = await this.drizzle.select().from(migrationsSchema).where(eq(migrationsSchema.batch, '-1'));
126
111
  if (!devPush.length) {
127
112
  await this.drizzle.insert(migrationsSchema).values({
128
113
  name: 'dev',
@@ -131,8 +116,8 @@ const connect = async function connect(options = {
131
116
  } else {
132
117
  await this.drizzle.update(migrationsSchema).set({
133
118
  updated_at: new Date()
134
- }).where((0, _drizzleorm.eq)(migrationsSchema.batch, '-1'));
119
+ }).where(eq(migrationsSchema.batch, '-1'));
135
120
  }
136
121
  };
137
122
 
138
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9jb25uZWN0LnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB0eXBlIHsgUGF5bG9hZCB9IGZyb20gJ3BheWxvYWQnXG5pbXBvcnQgdHlwZSB7IENvbm5lY3QgfSBmcm9tICdwYX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
5
- Object.defineProperty(exports, "create", {
6
- enumerable: true,
7
- get: function() {
8
- return create;
9
- }
10
- });
11
- const _tosnakecase = /*#__PURE__*/ _interop_require_default(require("to-snake-case"));
12
- const _upsertRow = require("./upsertRow");
13
- function _interop_require_default(obj) {
14
- return obj && obj.__esModule ? obj : {
15
- default: obj
16
- };
17
- }
18
- const create = async function create({ collection: collectionSlug, data, req }) {
1
+ import toSnakeCase from 'to-snake-case';
2
+ import { upsertRow } from './upsertRow';
3
+ export const create = async function create({ collection: collectionSlug, data, req }) {
19
4
  const db = this.sessions[req.transactionID]?.db || this.drizzle;
20
5
  const collection = this.payload.collections[collectionSlug].config;
21
- const result = await (0, _upsertRow.upsertRow)({
6
+ const result = await upsertRow({
22
7
  adapter: this,
23
8
  data,
24
9
  db,
25
10
  fields: collection.fields,
26
11
  operation: 'create',
27
- tableName: (0, _tosnakecase.default)(collectionSlug),
12
+ tableName: toSnakeCase(collectionSlug),
28
13
  req
29
14
  });
30
15
  return result;
31
16
  };
32
17
 
33
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9jcmVhdGUudHMiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHR5cGUgeyBDcmVhdGUgfSBmcm9tICdwYXlsb2FkL2RhdGFiYXNlJ1xuXG5pbXBvcnQgdG9TbmFrZUNhc2UgZnJvbSAndG8tc25ha2UtY2FzZSdcblxuaW1wb3J0IHR5cGUgeyBQb3N0Z3Jlc0FkYXB0ZXIgfSBmcm9tICcuL3R5cGVzJ1xuXG5pbXBvcnQgeyB1cHNlcnRSb3cgfSBmcm9tICcuL3Vwc2VydFJvdydcblxuZXhwb3J0IGNvbnN0IGNyZWF0ZTogQ3JlYXRlID0gYXN5bmMgZnVuY3Rpb24gY3JlYXRlKFxuICB0aGlzOiBQb3N0Z3Jlc0FkYXB0ZXIsXG4gIHsgY29sbGVjdGlvbjogY29sbGVjdGlvblNsdWcsIGRhd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1FBQ1hDLFdBQVdsQixZQUFZSTtRQUN2QkU7SUFDRjtJQUVBLE9BQU9RO0FBQ1QsRUFBQyJ9
@@ -1,33 +1,18 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "createGlobal", {
6
- enumerable: true,
7
- get: function() {
8
- return createGlobal;
9
- }
10
- });
11
- const _tosnakecase = /*#__PURE__*/ _interop_require_default(require("to-snake-case"));
12
- const _upsertRow = require("./upsertRow");
13
- function _interop_require_default(obj) {
14
- return obj && obj.__esModule ? obj : {
15
- default: obj
16
- };
17
- }
18
- async function createGlobal({ data, req = {}, slug }) {
1
+ import toSnakeCase from 'to-snake-case';
2
+ import { upsertRow } from './upsertRow';
3
+ export async function createGlobal({ data, req = {}, slug }) {
19
4
  const db = this.sessions[req.transactionID]?.db || this.drizzle;
20
5
  const globalConfig = this.payload.globals.config.find((config)=>config.slug === slug);
21
- const result = await (0, _upsertRow.upsertRow)({
6
+ const result = await upsertRow({
22
7
  adapter: this,
23
8
  data,
24
9
  db,
25
10
  fields: globalConfig.fields,
26
11
  operation: 'create',
27
- tableName: (0, _tosnakecase.default)(slug),
12
+ tableName: toSnakeCase(slug),
28
13
  req
29
14
  });
30
15
  return result;
31
16
  }
32
17
 
33
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9jcmVhdGVHbG9iYWwudHMiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHR5cGUgeyBDcmVhdGVHbG9iYWxBcmdzIH0gZnJvbSAncGF5bG9hZC9kYXRhYmFzZSdcbmltcG9ydCB0eXBlIHsgUGF5bG9hZFJlcXVlc3QsIFR5cGVXaXRoSUQgfSBmcm9tICdwYXlsb2FkL3R5cGVzJ1xuXG5pbXBvcnQgdG9TbmFrZUNhc2UgZnJvbSAndG8tc25ha2UtY2FzZSdcblxuaW1wb3J0IHR5cGUgeyBQb3N0Z3J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CJ0YWJsZU5hbWUiXSwibWFwcGluZ3MiOiJBQUdBLE9BQU9BLGlCQUFpQixnQkFBZTtBQUl2QyxTQUFTQyxTQUFTLFFBQVEsY0FBYTtBQUV2QyxPQUFPLGVBQWVDLGFBRXBCLEVBQUVDLElBQUksRUFBRUMsTUFBTSxDQUFDLENBQW1CLEVBQUVDLElBQUksRUFBb0I7SUFFNUQsTUFBTUMsS0FBSyxJQUFJLENBQUNDLFFBQVEsQ0FBQ0gsSUFBSUksYUFBYSxDQUFDLEVBQUVGLE1BQU0sSUFBSSxDQUFDRyxPQUFPO0lBQy9ELE1BQU1DLGVBQWUsSUFBSSxDQUFDQyxPQUFPLENBQUNDLE9BQU8sQ0FBQ0MsTUFBTSxDQUFDQyxJQUFJLENBQUMsQ0FBQ0QsU0FBV0EsT0FBT1IsSUFBSSxLQUFLQTtJQUVsRixNQUFNVSxTQUFTLE1BQU1kLFVBQWE7UUFDaENlLFNBQVMsSUFBSTtRQUNiYjtRQUNBRztRQUNBVyxRQUFRUCxhQUFhTyxNQUFNO1FBQzNCQyxXQUFXO1FBQ1hDLFdBQVduQixZQUFZSztRQUN2QkQ7SUFDRjtJQUVBLE9BQU9XO0FBQ1QifQ==
@@ -1,28 +1,13 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "createGlobalVersion", {
6
- enumerable: true,
7
- get: function() {
8
- return createGlobalVersion;
9
- }
10
- });
11
- const _drizzleorm = require("drizzle-orm");
12
- const _versions = require("payload/versions");
13
- const _tosnakecase = /*#__PURE__*/ _interop_require_default(require("to-snake-case"));
14
- const _upsertRow = require("./upsertRow");
15
- function _interop_require_default(obj) {
16
- return obj && obj.__esModule ? obj : {
17
- default: obj
18
- };
19
- }
20
- async function createGlobalVersion({ autosave, globalSlug, req = {}, versionData }) {
1
+ import { sql } from 'drizzle-orm';
2
+ import { buildVersionGlobalFields } from 'payload/versions';
3
+ import toSnakeCase from 'to-snake-case';
4
+ import { upsertRow } from './upsertRow';
5
+ export async function createGlobalVersion({ autosave, globalSlug, req = {}, versionData }) {
21
6
  const db = this.sessions[req.transactionID]?.db || this.drizzle;
22
7
  const global = this.payload.globals.config.find(({ slug })=>slug === globalSlug);
23
- const globalTableName = (0, _tosnakecase.default)(globalSlug);
8
+ const globalTableName = toSnakeCase(globalSlug);
24
9
  const tableName = `_${globalTableName}_v`;
25
- const result = await (0, _upsertRow.upsertRow)({
10
+ const result = await upsertRow({
26
11
  adapter: this,
27
12
  data: {
28
13
  autosave,
@@ -30,14 +15,14 @@ async function createGlobalVersion({ autosave, globalSlug, req = {}, versionData
30
15
  version: versionData
31
16
  },
32
17
  db,
33
- fields: (0, _versions.buildVersionGlobalFields)(global),
18
+ fields: buildVersionGlobalFields(global),
34
19
  operation: 'create',
35
20
  tableName,
36
21
  req
37
22
  });
38
23
  const table = this.tables[tableName];
39
24
  if (global.versions.drafts) {
40
- await db.execute((0, _drizzleorm.sql)`
25
+ await db.execute(sql`
41
26
  UPDATE ${table}
42
27
  SET latest = false
43
28
  WHERE ${table.id} != ${result.id};
@@ -46,4 +31,4 @@ async function createGlobalVersion({ autosave, globalSlug, req = {}, versionData
46
31
  return result;
47
32
  }
48
33
 
49
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9jcmVhdGVHbG9iYWxWZXJzaW9uLnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB0eXBlIHsgVHlwZVdpdGhWZXJzaW9uIH0gZnJvbSAncGF5bG9hZC9kYXRhYmFzZSdcbmltcG9ydCB7IHR5cGUgQ3JlYXRlR2xvYmFsVmVyc2lvbkFyZ3MgfSBmcm9tICdwYXlsb2FkL2RhdGFiYXNlJ1xuaW1wb3J0IHR5cGUgeyBQYXlsb2FkUmVxdWVzdCwgVHlwZVdpdGhJRCB9IGZyb20gJ3BheWxvYWQvdHlwZXMnXG5cbmltcG9ydCB7IHNxbCB9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UFBSTtRQUNiQyxNQUFNO1lBQ0psQjtZQUNBbUIsUUFBUTtZQUNSQyxTQUFTakI7UUFDWDtRQUNBQztRQUNBaUIsUUFBUXpCLHlCQUF5Qlk7UUFDakNjLFdBQVc7UUFDWFA7UUFDQWI7SUFDRjtJQUVBLE1BQU1xQixRQUFRLElBQUksQ0FBQ0MsTUFBTSxDQUFDVCxVQUFVO0lBRXBDLElBQUlQLE9BQU9pQixRQUFRLENBQUNDLE1BQU0sRUFBRTtRQUMxQixNQUFNdEIsR0FBR3VCLE9BQU8sQ0FBQ2hDLEdBQUcsQ0FBQzthQUNaLEVBQUU0QixNQUFNOztZQUVULEVBQUVBLE1BQU1LLEVBQUUsQ0FBQyxJQUFJLEVBQUVaLE9BQU9ZLEVBQUUsQ0FBQztJQUNuQyxDQUFDO0lBQ0g7SUFFQSxPQUFPWjtBQUNUIn0=
@@ -1,20 +1,5 @@
1
- /* eslint-disable no-restricted-syntax, no-await-in-loop */ "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "createMigration", {
6
- enumerable: true,
7
- get: function() {
8
- return createMigration;
9
- }
10
- });
11
- const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
12
- const _prompts = /*#__PURE__*/ _interop_require_default(require("prompts"));
13
- function _interop_require_default(obj) {
14
- return obj && obj.__esModule ? obj : {
15
- default: obj
16
- };
17
- }
1
+ /* eslint-disable no-restricted-syntax, no-await-in-loop */ import fs from 'fs';
2
+ import prompts from 'prompts';
18
3
  const migrationTemplate = (upSQL, downSQL)=>`import { MigrateUpArgs, MigrateDownArgs } from '@payloadcms/db-postgres'
19
4
  import { sql } from 'drizzle-orm'
20
5
 
@@ -46,10 +31,10 @@ const getDefaultDrizzleSnapshot = ()=>({
46
31
  tables: {},
47
32
  version: '5'
48
33
  });
49
- const createMigration = async function createMigration({ forceAcceptWarning, migrationName, payload }) {
34
+ export const createMigration = async function createMigration({ forceAcceptWarning, migrationName, payload }) {
50
35
  const dir = payload.db.migrationDir;
51
- if (!_fs.default.existsSync(dir)) {
52
- _fs.default.mkdirSync(dir);
36
+ if (!fs.existsSync(dir)) {
37
+ fs.mkdirSync(dir);
53
38
  }
54
39
  const { generateDrizzleJson, generateMigration } = require('drizzle-kit/payload');
55
40
  const [yyymmdd, hhmmss] = new Date().toISOString().split('T');
@@ -60,16 +45,16 @@ const createMigration = async function createMigration({ forceAcceptWarning, mig
60
45
  const filePath = `${dir}/${fileName}`;
61
46
  let drizzleJsonBefore = getDefaultDrizzleSnapshot();
62
47
  // Get latest migration snapshot
63
- const latestSnapshot = _fs.default.readdirSync(dir).filter((file)=>file.endsWith('.json')).sort().reverse()?.[0];
48
+ const latestSnapshot = fs.readdirSync(dir).filter((file)=>file.endsWith('.json')).sort().reverse()?.[0];
64
49
  if (latestSnapshot) {
65
- const latestSnapshotJSON = JSON.parse(_fs.default.readFileSync(`${dir}/${latestSnapshot}`, 'utf8'));
50
+ const latestSnapshotJSON = JSON.parse(fs.readFileSync(`${dir}/${latestSnapshot}`, 'utf8'));
66
51
  drizzleJsonBefore = latestSnapshotJSON;
67
52
  }
68
53
  const drizzleJsonAfter = generateDrizzleJson(this.schema);
69
54
  const sqlStatementsUp = await generateMigration(drizzleJsonBefore, drizzleJsonAfter);
70
55
  const sqlStatementsDown = await generateMigration(drizzleJsonAfter, drizzleJsonBefore);
71
56
  if (!sqlStatementsUp.length && !sqlStatementsDown.length && !forceAcceptWarning) {
72
- const { confirm: shouldCreateBlankMigration } = await (0, _prompts.default)({
57
+ const { confirm: shouldCreateBlankMigration } = await prompts({
73
58
  name: 'confirm',
74
59
  type: 'confirm',
75
60
  initial: false,
@@ -84,12 +69,12 @@ const createMigration = async function createMigration({ forceAcceptWarning, mig
84
69
  }
85
70
  }
86
71
  // write schema
87
- _fs.default.writeFileSync(`${filePath}.json`, JSON.stringify(drizzleJsonAfter, null, 2));
72
+ fs.writeFileSync(`${filePath}.json`, JSON.stringify(drizzleJsonAfter, null, 2));
88
73
  // write migration
89
- _fs.default.writeFileSync(`${filePath}.ts`, migrationTemplate(sqlStatementsUp.length ? sqlStatementsUp?.join('\n') : undefined, sqlStatementsDown.length ? sqlStatementsDown?.join('\n') : undefined));
74
+ fs.writeFileSync(`${filePath}.ts`, migrationTemplate(sqlStatementsUp.length ? sqlStatementsUp?.join('\n') : undefined, sqlStatementsDown.length ? sqlStatementsDown?.join('\n') : undefined));
90
75
  payload.logger.info({
91
76
  msg: `Migration created at ${filePath}.ts`
92
77
  });
93
78
  };
94
79
 
95
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9jcmVhdGVNaWdyYXRpb24udHMiXSwic291cmNlc0NvbnRlbnQiOlsiLyogZXNsaW50LWRpc2FibGUgbm8tcmVzdHJpY3RlZC1zeW50YXgsIG5vLWF3YWl0LWluLWxvb3AgKi9cbmltcG9ydCB0eXBlIHsgRHJpenpsZVNuYXBzaG90SlNPTiB9IGZyb20gJ2RyaXp6bGUta2l0L3BheWxvYWQnXG5pbXBvcnQgdHlwZSB7IENyZWF0ZU1pZ3JhdGlvbiB9IGZyb20gJ3BheWxvYWQvZGF0YWJhc2UnXG5cbmltcG9ydCBmcyBmcm9tICdmcydcbmltcG9ydCBwcm9tcHRzIGZyb20gJ3Byb21wdHMnXG5cbmltcG9ydCB0eXBlIHsgUG9zdGdyZXNBZGFwdGVyIH0gZnJvbSAnLi90eXBlcydcblxuY29uc3QgbWlncmF0aW9uVGVtcGxhdGUgPSAoXG4gIHVwU1FMPzogc3RyaW5nLFxuICBkb3duU1FMPzogc3RyaW5nLFxuKSA9PiBgaW1wb3J0IHsgTWlncmF0ZVVwQXJncywgTWlncmF0ZURvd25BcmdzIH0gZnJvbSAnQHBheWxvYWRjbXMvZGItcG9zdGdyZXMnXG5pbXBvcnQgeyBzcWwgfSBmcm9tICdkcml6emxlLW9ybSdcblxuZXhwb3J0IGFzeW5jIGZ1bmN0aW9uIHVw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__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "createVersion", {
6
- enumerable: true,
7
- get: function() {
8
- return createVersion;
9
- }
10
- });
11
- const _drizzleorm = require("drizzle-orm");
12
- const _versions = require("payload/versions");
13
- const _tosnakecase = /*#__PURE__*/ _interop_require_default(require("to-snake-case"));
14
- const _upsertRow = require("./upsertRow");
15
- function _interop_require_default(obj) {
16
- return obj && obj.__esModule ? obj : {
17
- default: obj
18
- };
19
- }
20
- async function createVersion({ autosave, collectionSlug, parent, req = {}, versionData }) {
1
+ import { sql } from 'drizzle-orm';
2
+ import { buildVersionCollectionFields } from 'payload/versions';
3
+ import toSnakeCase from 'to-snake-case';
4
+ import { upsertRow } from './upsertRow';
5
+ export async function createVersion({ autosave, collectionSlug, parent, req = {}, versionData }) {
21
6
  const db = this.sessions[req.transactionID]?.db || this.drizzle;
22
7
  const collection = this.payload.collections[collectionSlug].config;
23
- const collectionTableName = (0, _tosnakecase.default)(collectionSlug);
8
+ const collectionTableName = toSnakeCase(collectionSlug);
24
9
  const tableName = `_${collectionTableName}_v`;
25
- const result = await (0, _upsertRow.upsertRow)({
10
+ const result = await upsertRow({
26
11
  adapter: this,
27
12
  data: {
28
13
  autosave,
@@ -31,7 +16,7 @@ async function createVersion({ autosave, collectionSlug, parent, req = {}, versi
31
16
  version: versionData
32
17
  },
33
18
  db,
34
- fields: (0, _versions.buildVersionCollectionFields)(collection),
19
+ fields: buildVersionCollectionFields(collection),
35
20
  operation: 'create',
36
21
  tableName,
37
22
  req
@@ -39,7 +24,7 @@ async function createVersion({ autosave, collectionSlug, parent, req = {}, versi
39
24
  const table = this.tables[tableName];
40
25
  const relationshipsTable = this.tables[`${tableName}_rels`];
41
26
  if (collection.versions.drafts) {
42
- await db.execute((0, _drizzleorm.sql)`
27
+ await db.execute(sql`
43
28
  UPDATE ${table}
44
29
  SET latest = false
45
30
  FROM ${relationshipsTable}
@@ -52,4 +37,4 @@ async function createVersion({ autosave, collectionSlug, parent, req = {}, vers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BQUUsU0FBUztZQUN4QyxFQUFFTCxrQkFBa0IsQ0FBQyxDQUFDLEVBQUV2QixlQUFlLEVBQUUsQ0FBQyxDQUFDLENBQUMsR0FBRyxFQUFFQyxPQUFPO1lBQ3hELEVBQUVvQixNQUFNTSxFQUFFLENBQUMsSUFBSSxFQUFFYixPQUFPYSxFQUFFLENBQUM7SUFDbkMsQ0FBQztJQUNIO0lBRUEsT0FBT2I7QUFDVCJ9
@@ -1,26 +1,11 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "deleteMany", {
6
- enumerable: true,
7
- get: function() {
8
- return deleteMany;
9
- }
10
- });
11
- const _drizzleorm = require("drizzle-orm");
12
- const _tosnakecase = /*#__PURE__*/ _interop_require_default(require("to-snake-case"));
13
- const _findMany = require("./find/findMany");
14
- function _interop_require_default(obj) {
15
- return obj && obj.__esModule ? obj : {
16
- default: obj
17
- };
18
- }
19
- const deleteMany = async function deleteMany({ collection, req = {}, where }) {
1
+ import { inArray } from 'drizzle-orm';
2
+ import toSnakeCase from 'to-snake-case';
3
+ import { findMany } from './find/findMany';
4
+ export const deleteMany = async function deleteMany({ collection, req = {}, where }) {
20
5
  const db = this.sessions[req.transactionID]?.db || this.drizzle;
21
6
  const collectionConfig = this.payload.collections[collection].config;
22
- const tableName = (0, _tosnakecase.default)(collection);
23
- const result = await (0, _findMany.findMany)({
7
+ const tableName = toSnakeCase(collection);
8
+ const result = await findMany({
24
9
  adapter: this,
25
10
  fields: collectionConfig.fields,
26
11
  limit: 0,
@@ -36,8 +21,8 @@ const deleteMany = async function deleteMany({ collection, req = {}, where }) {
36
21
  ids.push(data.id);
37
22
  });
38
23
  if (ids.length > 0) {
39
- await db.delete(this.tables[tableName]).where((0, _drizzleorm.inArray)(this.tables[tableName].id, ids));
24
+ await db.delete(this.tables[tableName]).where(inArray(this.tables[tableName].id, ids));
40
25
  }
41
26
  };
42
27
 
43
- //# sourceMappingURL=data:application/json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VyxDQUFDVSxNQUFNO0lBQ3BFLE1BQU1DLFlBQVlkLFlBQVlHO0lBRTlCLE1BQU1ZLFNBQVMsTUFBTWQsU0FBUztRQUM1QmUsU0FBUyxJQUFJO1FBQ2JDLFFBQVFQLGlCQUFpQk8sTUFBTTtRQUMvQkMsT0FBTztRQUNQQyxRQUFRZixJQUFJZSxNQUFNO1FBQ2xCQyxNQUFNO1FBQ05DLFlBQVk7UUFDWmpCO1FBQ0FVO1FBQ0FUO0lBQ0Y7SUFFQSxNQUFNaUIsTUFBTSxFQUFFO0lBRWRQLE9BQU9RLElBQUksQ0FBQ0MsT0FBTyxDQUFDLENBQUNDO1FBQ25CSCxJQUFJSSxJQUFJLENBQUNELEtBQUtFLEVBQUU7SUFDbEI7SUFFQSxJQUFJTCxJQUFJTSxNQUFNLEdBQUcsR0FBRztRQUNsQixNQUFNdEIsR0FBR3VCLE1BQU0sQ0FBQyxJQUFJLENBQUNDLE1BQU0sQ0FBQ2hCLFVBQVUsRUFBRVQsS0FBSyxDQUFDTixRQUFRLElBQUksQ0FBQytCLE1BQU0sQ0FBQ2hCLFVBQVUsQ0FBQ2EsRUFBRSxFQUFFTDtJQUNuRjtBQUNGLEVBQUMifQ==
package/dist/deleteOne.js CHANGED
@@ -1,33 +1,18 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "deleteOne", {
6
- enumerable: true,
7
- get: function() {
8
- return deleteOne;
9
- }
10
- });
11
- const _tosnakecase = /*#__PURE__*/ _interop_require_default(require("to-snake-case"));
12
- const _buildFindManyArgs = require("./find/buildFindManyArgs");
13
- const _buildQuery = /*#__PURE__*/ _interop_require_default(require("./queries/buildQuery"));
14
- const _read = require("./transform/read");
15
- function _interop_require_default(obj) {
16
- return obj && obj.__esModule ? obj : {
17
- default: obj
18
- };
19
- }
20
- const deleteOne = async function deleteOne({ collection, req = {}, where: incomingWhere }) {
1
+ import toSnakeCase from 'to-snake-case';
2
+ import { buildFindManyArgs } from './find/buildFindManyArgs';
3
+ import buildQuery from './queries/buildQuery';
4
+ import { transform } from './transform/read';
5
+ export const deleteOne = async function deleteOne({ collection, req = {}, where: incomingWhere }) {
21
6
  const db = this.sessions[req.transactionID]?.db || this.drizzle;
22
7
  const collectionConfig = this.payload.collections[collection].config;
23
- const tableName = (0, _tosnakecase.default)(collection);
24
- const { where } = await (0, _buildQuery.default)({
8
+ const tableName = toSnakeCase(collection);
9
+ const { where } = await buildQuery({
25
10
  adapter: this,
26
11
  fields: collectionConfig.fields,
27
12
  tableName,
28
13
  where: incomingWhere
29
14
  });
30
- const findManyArgs = (0, _buildFindManyArgs.buildFindManyArgs)({
15
+ const findManyArgs = buildFindManyArgs({
31
16
  adapter: this,
32
17
  depth: 0,
33
18
  fields: collectionConfig.fields,
@@ -35,7 +20,7 @@ const deleteOne = async function deleteOne({ collection, req = {}, where: incomi
35
20
  });
36
21
  findManyArgs.where = where;
37
22
  const docToDelete = await db.query[tableName].findFirst(findManyArgs);
38
- const result = (0, _read.transform)({
23
+ const result = transform({
39
24
  config: this.payload.config,
40
25
  data: docToDelete,
41
26
  fields: collectionConfig.fields
@@ -44,4 +29,4 @@ const deleteOne = async function deleteOne({ collection, req = {}, where: incomi
44
29
  return result;
45
30
  };
46
31
 
47
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9kZWxldGVPbmUudHMiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHR5cGUgeyBEZWxldGVPbmUgfSBmcm9tICdwYXlsb2FkL2RhdGFiYXNlJ1xuaW1wb3J0IHR5cGUgeyBQYXlsb2FkUmVxdWVzdCB9IGZyb20gJ3BheWxvYWQvdHlwZXMnXG5cbmltcG9ydCB0b1NuYWtlQ2FzZSBmcm9tICd0by1zbmFrZS1jYXNlJ1xuXG5pbXBvcnQgdHlwZSB7IFBvc3RncmVzQWRhcHRlciB9IGZyb20gJy4vdHlw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