@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.
- package/dist/connect.js +17 -32
- package/dist/create.js +6 -21
- package/dist/createGlobal.js +6 -21
- package/dist/createGlobalVersion.js +10 -25
- package/dist/createMigration.js +11 -26
- package/dist/createVersion.js +10 -25
- package/dist/deleteMany.js +8 -23
- package/dist/deleteOne.js +10 -25
- package/dist/deleteVersions.js +10 -25
- package/dist/destroy.js +2 -12
- package/dist/find/buildFindManyArgs.js +6 -14
- package/dist/find/chainMethods.js +2 -11
- package/dist/find/findMany.js +14 -29
- package/dist/find/traverseFields.js +8 -23
- package/dist/find.js +6 -21
- package/dist/findGlobal.js +6 -21
- package/dist/findGlobalVersions.js +8 -23
- package/dist/findOne.js +6 -21
- package/dist/findVersions.js +8 -23
- package/dist/index.js +72 -87
- package/dist/init.js +17 -32
- package/dist/migrate.js +15 -30
- package/dist/migrateDown.js +12 -22
- package/dist/migrateFresh.js +15 -28
- package/dist/migrateRefresh.js +18 -26
- package/dist/migrateReset.js +13 -21
- package/dist/migrateStatus.js +9 -19
- package/dist/queries/buildAndOrConditions.js +4 -14
- package/dist/queries/buildQuery.js +10 -20
- package/dist/queries/createJSONQuery/convertPathToJSONTraversal.js +4 -14
- package/dist/queries/createJSONQuery/formatJSONPathSegment.js +2 -12
- package/dist/queries/createJSONQuery/index.js +6 -16
- package/dist/queries/getTableColumnFromPath.js +38 -49
- package/dist/queries/operatorMap.js +17 -27
- package/dist/queries/parseParams.js +32 -42
- package/dist/queries/sanitizeQueryValue.js +8 -18
- package/dist/queryDrafts.js +10 -25
- package/dist/schema/build.js +49 -64
- package/dist/schema/createIndex.js +5 -15
- package/dist/schema/idToUUID.js +2 -12
- package/dist/schema/parentIDColumnMap.js +7 -17
- package/dist/schema/setColumnID.js +10 -20
- package/dist/schema/traverseFields.js +62 -77
- package/dist/schema/validateExistingBlockIsIdentical.js +9 -19
- package/dist/transactions/beginTransaction.js +4 -14
- package/dist/transactions/commitTransaction.js +2 -12
- package/dist/transactions/rollbackTransaction.js +2 -12
- package/dist/transform/read/hasManyNumber.js +2 -12
- package/dist/transform/read/hasManyText.js +2 -12
- package/dist/transform/read/index.js +12 -20
- package/dist/transform/read/relationship.js +2 -12
- package/dist/transform/read/traverseFields.js +15 -23
- package/dist/transform/write/array.js +6 -16
- package/dist/transform/write/blocks.js +6 -21
- package/dist/transform/write/index.js +4 -14
- package/dist/transform/write/numbers.js +2 -12
- package/dist/transform/write/relationships.js +4 -14
- package/dist/transform/write/selects.js +4 -14
- package/dist/transform/write/texts.js +2 -12
- package/dist/transform/write/traverseFields.js +30 -45
- package/dist/transform/write/types.js +2 -5
- package/dist/types.js +2 -5
- package/dist/update.js +11 -26
- package/dist/updateGlobal.js +6 -21
- package/dist/updateGlobalVersion.js +10 -25
- package/dist/updateVersion.js +10 -25
- package/dist/upsertRow/deleteExistingArrayRows.js +5 -15
- package/dist/upsertRow/deleteExistingRowsByPath.js +9 -19
- package/dist/upsertRow/index.js +24 -34
- package/dist/upsertRow/insertArrays.js +2 -12
- package/dist/upsertRow/types.js +2 -5
- package/dist/utilities/appendPrefixToKeys.js +2 -12
- package/dist/utilities/createBlocksMap.js +2 -12
- package/dist/utilities/createMigrationTable.js +4 -14
- package/dist/utilities/createRelationshipMap.js +2 -12
- package/dist/utilities/hasLocalesTable.js +5 -15
- package/dist/utilities/isArrayOfRows.js +2 -12
- package/dist/utilities/migrationTableExists.js +4 -14
- package/dist/utilities/parseError.js +6 -14
- package/package.json +4 -4
package/dist/migrateFresh.js
CHANGED
@@ -1,26 +1,13 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
}
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
return migrateFresh;
|
9
|
-
}
|
10
|
-
});
|
11
|
-
const _drizzleorm = require("drizzle-orm");
|
12
|
-
const _database = require("payload/database");
|
13
|
-
const _prompts = /*#__PURE__*/ _interop_require_default(require("prompts"));
|
14
|
-
const _parseError = require("./utilities/parseError");
|
15
|
-
function _interop_require_default(obj) {
|
16
|
-
return obj && obj.__esModule ? obj : {
|
17
|
-
default: obj
|
18
|
-
};
|
19
|
-
}
|
20
|
-
async function migrateFresh({ forceAcceptWarning = false }) {
|
1
|
+
import { sql } from 'drizzle-orm';
|
2
|
+
import { commitTransaction, initTransaction, killTransaction, readMigrationFiles } from 'payload/database';
|
3
|
+
import prompts from 'prompts';
|
4
|
+
import { parseError } from './utilities/parseError';
|
5
|
+
/**
|
6
|
+
* Drop the current database and run all migrate up functions
|
7
|
+
*/ export async function migrateFresh({ forceAcceptWarning = false }) {
|
21
8
|
const { payload } = this;
|
22
9
|
if (forceAcceptWarning === false) {
|
23
|
-
const { confirm: acceptWarning } = await (
|
10
|
+
const { confirm: acceptWarning } = await prompts({
|
24
11
|
name: 'confirm',
|
25
12
|
type: 'confirm',
|
26
13
|
initial: false,
|
@@ -37,9 +24,9 @@ async function migrateFresh({ forceAcceptWarning = false }) {
|
|
37
24
|
payload.logger.info({
|
38
25
|
msg: `Dropping database.`
|
39
26
|
});
|
40
|
-
await this.drizzle.execute(
|
27
|
+
await this.drizzle.execute(sql.raw(`drop schema ${this.schemaName || 'public'} cascade;
|
41
28
|
create schema ${this.schemaName || 'public'};`));
|
42
|
-
const migrationFiles = await
|
29
|
+
const migrationFiles = await readMigrationFiles({
|
43
30
|
payload
|
44
31
|
});
|
45
32
|
payload.logger.debug({
|
@@ -55,7 +42,7 @@ async function migrateFresh({ forceAcceptWarning = false }) {
|
|
55
42
|
});
|
56
43
|
try {
|
57
44
|
const start = Date.now();
|
58
|
-
await
|
45
|
+
await initTransaction(req);
|
59
46
|
await migration.up({
|
60
47
|
payload,
|
61
48
|
req
|
@@ -68,18 +55,18 @@ async function migrateFresh({ forceAcceptWarning = false }) {
|
|
68
55
|
},
|
69
56
|
req
|
70
57
|
});
|
71
|
-
await
|
58
|
+
await commitTransaction(req);
|
72
59
|
payload.logger.info({
|
73
60
|
msg: `Migrated: ${migration.name} (${Date.now() - start}ms)`
|
74
61
|
});
|
75
62
|
} catch (err) {
|
76
|
-
await
|
63
|
+
await killTransaction(req);
|
77
64
|
payload.logger.error({
|
78
65
|
err,
|
79
|
-
msg:
|
66
|
+
msg: parseError(err, `Error running migration ${migration.name}. Rolling back`)
|
80
67
|
});
|
81
68
|
}
|
82
69
|
}
|
83
70
|
}
|
84
71
|
|
85
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9taWdyYXRlRnJlc2gudHMiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHR5cGUgeyBQYXlsb2FkUmVxdWVzdCB9IGZyb20gJ3BheWxvYWQvdHlwZXMnXG5cbmltcG9ydCB7IHNxbCB9IGZyb20gJ2RyaXp6bGUtb3JtJ1xuaW1wb3J0IHtcbiAgY29tbWl0VHJhbnNhY3Rpb24sXG4gIGluaXRUcmFuc2FjdGlvbixcbiAga2lsbFRyYW5zYWN0aW9uLFxuICByZWFkTWlncmF0aW9uRmlsZXMsXG59IGZyb20gJ3BheWxvYWQvZGF0YWJhc2UnXG5pbXBvcnQgcHJvbXB0cyBmcm9tICdwcm9tcHRzJ1xuXG5pbXBvcnQgdHlwZSB7IFBvc3RncmVzQWRhcHRlciB9IGZyb20gJy4vdHlwZXMnXG5cbmltcG9ydCB7IHBhcnNlRXJyb3IgfSBmcm9tICcuL3V0aWxpdGllcy9wYXJzZUVycm9yJ1xuXG4vKipcbiAqIERyb3AgdGhlIGN1cnJlbnQgZGF0YWJhc2UgYW5kIHJ1biBhbGwgbWlncmF0ZSB1cCBmdW5jdGlvbnNcbiAqL1xuZXhwb3J0IGFzeW5jIGZ1bmN0aW9uIG1pZ3JhdGVGcmVzaChcbiAgdGhpczogUG9zdGdyZXNBZGFwdGVyLFxuICB7IGZvcmNlQWNjZXB0V2FybmluZyA9IGZhbHNlIH0sXG4pOiBQcm9taXNlPHZvaWQ+IHtcbiAgY29uc3QgeyBw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VFVLE1BQU0sQ0FBQ0MsSUFBSSxDQUFDO1lBQUVDLEtBQUssQ0FBQyxXQUFXLEVBQUVTLFVBQVVsQixJQUFJLENBQUMsQ0FBQztRQUFDO1FBQzFELElBQUk7WUFDRixNQUFNbUIsUUFBUUMsS0FBS0MsR0FBRztZQUN0QixNQUFNL0IsZ0JBQWdCMkI7WUFDdEIsTUFBTUMsVUFBVUksRUFBRSxDQUFDO2dCQUFFekI7Z0JBQVNvQjtZQUFJO1lBQ2xDLE1BQU1wQixRQUFRMEIsTUFBTSxDQUFDO2dCQUNuQkMsWUFBWTtnQkFDWkMsTUFBTTtvQkFDSnpCLE1BQU1rQixVQUFVbEIsSUFBSTtvQkFDcEIwQixPQUFPO2dCQUNUO2dCQUNBVDtZQUNGO1lBQ0EsTUFBTTVCLGtCQUFrQjRCO1lBRXhCcEIsUUFBUVUsTUFBTSxDQUFDQyxJQUFJLENBQUM7Z0JBQUVDLEtBQUssQ0FBQyxXQUFXLEVBQUVTLFVBQVVsQixJQUFJLENBQUMsRUFBRSxFQUFFb0IsS0FBS0MsR0FBRyxLQUFLRixNQUFNLEdBQUcsQ0FBQztZQUFDO1FBQ3RGLEVBQUUsT0FBT1EsS0FBYztZQUNyQixNQUFNcEMsZ0JBQWdCMEI7WUFDdEJwQixRQUFRVSxNQUFNLENBQUNxQixLQUFLLENBQUM7Z0JBQ25CRDtnQkFDQWxCLEtBQUtmLFdBQVdpQyxLQUFLLENBQUMsd0JBQXdCLEVBQUVULFVBQVVsQixJQUFJLENBQUMsY0FBYyxDQUFDO1lBQ2hGO1FBQ0Y7SUFDRjtBQUNGIn0=
|
package/dist/migrateRefresh.js
CHANGED
@@ -1,22 +1,14 @@
|
|
1
|
-
/* eslint-disable no-restricted-syntax, no-await-in-loop */
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
get: function() {
|
8
|
-
return migrateRefresh;
|
9
|
-
}
|
10
|
-
});
|
11
|
-
const _database = require("payload/database");
|
12
|
-
const _migrationTableExists = require("./utilities/migrationTableExists");
|
13
|
-
const _parseError = require("./utilities/parseError");
|
14
|
-
async function migrateRefresh() {
|
1
|
+
/* eslint-disable no-restricted-syntax, no-await-in-loop */ import { commitTransaction, getMigrations, initTransaction, killTransaction, readMigrationFiles } from 'payload/database';
|
2
|
+
import { migrationTableExists } from './utilities/migrationTableExists';
|
3
|
+
import { parseError } from './utilities/parseError';
|
4
|
+
/**
|
5
|
+
* Run all migration down functions before running up
|
6
|
+
*/ export async function migrateRefresh() {
|
15
7
|
const { payload } = this;
|
16
|
-
const migrationFiles = await
|
8
|
+
const migrationFiles = await readMigrationFiles({
|
17
9
|
payload
|
18
10
|
});
|
19
|
-
const { existingMigrations, latestBatch } = await
|
11
|
+
const { existingMigrations, latestBatch } = await getMigrations({
|
20
12
|
payload
|
21
13
|
});
|
22
14
|
if (!existingMigrations?.length) {
|
@@ -43,7 +35,7 @@ async function migrateRefresh() {
|
|
43
35
|
msg: `Migrating down: ${migration.name}`
|
44
36
|
});
|
45
37
|
const start = Date.now();
|
46
|
-
await
|
38
|
+
await initTransaction(req);
|
47
39
|
await migrationFile.down({
|
48
40
|
payload,
|
49
41
|
req
|
@@ -51,7 +43,7 @@ async function migrateRefresh() {
|
|
51
43
|
payload.logger.info({
|
52
44
|
msg: `Migrated down: ${migration.name} (${Date.now() - start}ms)`
|
53
45
|
});
|
54
|
-
const tableExists = await
|
46
|
+
const tableExists = await migrationTableExists(this.drizzle);
|
55
47
|
if (tableExists) {
|
56
48
|
await payload.delete({
|
57
49
|
collection: 'payload-migrations',
|
@@ -63,12 +55,12 @@ async function migrateRefresh() {
|
|
63
55
|
}
|
64
56
|
});
|
65
57
|
}
|
66
|
-
await
|
58
|
+
await commitTransaction(req);
|
67
59
|
} catch (err) {
|
68
|
-
await
|
60
|
+
await killTransaction(req);
|
69
61
|
payload.logger.error({
|
70
62
|
err,
|
71
|
-
msg:
|
63
|
+
msg: parseError(err, `Error running migration ${migration.name}. Rolling back.`)
|
72
64
|
});
|
73
65
|
process.exit(1);
|
74
66
|
}
|
@@ -80,7 +72,7 @@ async function migrateRefresh() {
|
|
80
72
|
});
|
81
73
|
try {
|
82
74
|
const start = Date.now();
|
83
|
-
await
|
75
|
+
await initTransaction(req);
|
84
76
|
await migration.up({
|
85
77
|
payload,
|
86
78
|
req
|
@@ -93,18 +85,18 @@ async function migrateRefresh() {
|
|
93
85
|
},
|
94
86
|
req
|
95
87
|
});
|
96
|
-
await
|
88
|
+
await commitTransaction(req);
|
97
89
|
payload.logger.info({
|
98
90
|
msg: `Migrated: ${migration.name} (${Date.now() - start}ms)`
|
99
91
|
});
|
100
92
|
} catch (err) {
|
101
|
-
await
|
93
|
+
await killTransaction(req);
|
102
94
|
payload.logger.error({
|
103
95
|
err,
|
104
|
-
msg:
|
96
|
+
msg: parseError(err, `Error running migration ${migration.name}. Rolling back.`)
|
105
97
|
});
|
106
98
|
}
|
107
99
|
}
|
108
100
|
}
|
109
101
|
|
110
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9taWdyYXRlUmVmcmVzaC50cyJdLCJzb3VyY2VzQ29udGVudCI6WyIvKiBlc2xpbnQtZGlzYWJsZSBuby1yZXN0cmljdGVkLXN5bnRheCwgbm8tYXdhaXQtaW4tbG9vcCAqL1xuaW1wb3J0IHR5cGUgeyBQYXlsb2FkUmVxdWVzdCB9IGZyb20gJ3BheWxvYWQvdHlwZXMnXG5cbmltcG9ydCB7XG4gIGNvbW1pdFRyYW5zYWN0aW9uLFxuICBnZXRNaWdyYXRpb25zLFxuICBpbml0VHJhbnNhY3Rpb24sXG4gIGtpbGxUcmFuc2FjdGlvbixcbiAgcmVhZE1pZ3JhdGlvbkZpbGVzLFxufSBmcm9tICdwYXlsb2FkL2RhdGFiYXNlJ1xuXG5pbXBvcnQgdHlwZSB7IFBvc3RncmVzQWRhcHRlciB9IGZyb20gJy4vdHlwZXMnXG5cbmlt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-
|
6
|
-
enumerable: true,
|
7
|
-
get: function() {
|
8
|
-
return migrateReset;
|
9
|
-
}
|
10
|
-
});
|
11
|
-
const _database = require("payload/database");
|
12
|
-
const _migrationTableExists = require("./utilities/migrationTableExists");
|
13
|
-
async function migrateReset() {
|
1
|
+
/* eslint-disable no-restricted-syntax, no-await-in-loop */ import { commitTransaction, getMigrations, initTransaction, killTransaction, readMigrationFiles } from 'payload/database';
|
2
|
+
import { migrationTableExists } from './utilities/migrationTableExists';
|
3
|
+
/**
|
4
|
+
* Run all migrate down functions
|
5
|
+
*/ export async function migrateReset() {
|
14
6
|
const { payload } = this;
|
15
|
-
const migrationFiles = await
|
7
|
+
const migrationFiles = await readMigrationFiles({
|
16
8
|
payload
|
17
9
|
});
|
18
|
-
const { existingMigrations } = await
|
10
|
+
const { existingMigrations } = await getMigrations({
|
19
11
|
payload
|
20
12
|
});
|
21
13
|
if (!existingMigrations?.length) {
|
@@ -38,7 +30,7 @@ async function migrateReset() {
|
|
38
30
|
payload.logger.info({
|
39
31
|
msg: `Migrating down: ${migrationFile.name}`
|
40
32
|
});
|
41
|
-
await
|
33
|
+
await initTransaction(req);
|
42
34
|
await migrationFile.down({
|
43
35
|
payload,
|
44
36
|
req
|
@@ -46,7 +38,7 @@ async function migrateReset() {
|
|
46
38
|
payload.logger.info({
|
47
39
|
msg: `Migrated down: ${migrationFile.name} (${Date.now() - start}ms)`
|
48
40
|
});
|
49
|
-
const tableExists = await
|
41
|
+
const tableExists = await migrationTableExists(this.drizzle);
|
50
42
|
if (tableExists) {
|
51
43
|
await payload.delete({
|
52
44
|
id: migration.id,
|
@@ -54,11 +46,11 @@ async function migrateReset() {
|
|
54
46
|
req
|
55
47
|
});
|
56
48
|
}
|
57
|
-
await
|
49
|
+
await commitTransaction(req);
|
58
50
|
} catch (err) {
|
59
51
|
let msg = `Error running migration ${migrationFile.name}.`;
|
60
52
|
if (err instanceof Error) msg += ` ${err.message}`;
|
61
|
-
await
|
53
|
+
await killTransaction(req);
|
62
54
|
payload.logger.error({
|
63
55
|
err,
|
64
56
|
msg
|
@@ -67,7 +59,7 @@ async function migrateReset() {
|
|
67
59
|
}
|
68
60
|
}
|
69
61
|
// Delete dev migration
|
70
|
-
const tableExists = await
|
62
|
+
const tableExists = await migrationTableExists(this.drizzle);
|
71
63
|
if (tableExists) {
|
72
64
|
try {
|
73
65
|
await payload.delete({
|
@@ -87,4 +79,4 @@ async function migrateReset() {
|
|
87
79
|
}
|
88
80
|
}
|
89
81
|
|
90
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9taWdyYXRlUmVzZXQudHMiXSwic291cmNlc0NvbnRlbnQiOlsiLyogZXNsaW50LWRpc2FibGUgbm8tcmVzdHJpY3RlZC1zeW50YXgsIG5vLWF3YWl0LWluLWxvb3AgKi9cbmltcG9ydCB0eXBlIHsgUGF5bG9hZFJlcXVlc3QgfSBmcm9tICdwYXlsb2FkL3R5cGVzJ1xuXG5pbXBvcnQge1xuICBjb21taXRUcmFuc2FjdGlvbixcbiAgZ2V0TWlncmF0aW9ucyxcbiAgaW5pdFRyYW5zYWN0aW9uLFxuICBraWxsVHJhbnNhY3Rpb24sXG4gIHJlYWRNaWdyYXRpb25GaWxlcyxcbn0gZnJvbSAncGF5bG9hZC9kYXRhYmFzZSdcblxuaW1wb3J0IHR5cGUgeyBQb3N0Z3Jlc0FkYXB0ZXIgfSBmcm9tICcuL3R5cGVzJ1xuXG5pbXBvcnQgeyBtaWdyYXRpb25UYWJsZUV4aXN0cyB9IGZyb20gJy4vdXRpbGl0aWVzL21pZ3JhdGlvblRhYmxlRXhpc3RzJ1xuXG4vKipcbiAqIFJ1biBhbGwgbWlncmF0ZSBkb3duIGZ1bmN0aW9uc1xuICovXG5leHBvcnQgYXN5bmMgZnVuY3Rpb24gbWlncmF0ZVJlc2V0KHRoaXM6IFBvc3RncmVzQWRhcHRlcik6IFByb21pc2U8dm9pZD4ge1xuIC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XZCLE1BQU1ULGNBQWMsTUFBTXBCLHFCQUFxQixJQUFJLENBQUNxQixPQUFPO0lBQzNELElBQUlELGFBQWE7UUFDZixJQUFJO1lBQ0YsTUFBTWxCLFFBQVFvQixNQUFNLENBQUM7Z0JBQ25CRSxZQUFZO2dCQUNaTSxPQUFPO29CQUNMQyxPQUFPO3dCQUNMQyxRQUFRLENBQUM7b0JBQ1g7Z0JBQ0Y7WUFDRjtRQUNGLEVBQUUsT0FBT1AsS0FBYztZQUNyQnZCLFFBQVFJLE1BQU0sQ0FBQ3FCLEtBQUssQ0FBQztnQkFBRUEsT0FBT0Y7Z0JBQUtqQixLQUFLO1lBQStCO1FBQ3pFO0lBQ0Y7QUFDRiJ9
|
package/dist/migrateStatus.js
CHANGED
@@ -1,28 +1,18 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
Object.defineProperty(exports, "migrateStatus", {
|
6
|
-
enumerable: true,
|
7
|
-
get: function() {
|
8
|
-
return migrateStatus;
|
9
|
-
}
|
10
|
-
});
|
11
|
-
const _consoletableprinter = require("console-table-printer");
|
12
|
-
const _database = require("payload/database");
|
13
|
-
const _migrationTableExists = require("./utilities/migrationTableExists");
|
14
|
-
async function migrateStatus() {
|
1
|
+
import { Table } from 'console-table-printer';
|
2
|
+
import { getMigrations, readMigrationFiles } from 'payload/database';
|
3
|
+
import { migrationTableExists } from './utilities/migrationTableExists';
|
4
|
+
export async function migrateStatus() {
|
15
5
|
const { payload } = this;
|
16
|
-
const migrationFiles = await
|
6
|
+
const migrationFiles = await readMigrationFiles({
|
17
7
|
payload
|
18
8
|
});
|
19
9
|
payload.logger.debug({
|
20
10
|
msg: `Found ${migrationFiles.length} migration files.`
|
21
11
|
});
|
22
12
|
let existingMigrations = [];
|
23
|
-
const hasMigrationTable = await
|
13
|
+
const hasMigrationTable = await migrationTableExists(this.drizzle);
|
24
14
|
if (hasMigrationTable) {
|
25
|
-
({ existingMigrations } = await
|
15
|
+
({ existingMigrations } = await getMigrations({
|
26
16
|
payload
|
27
17
|
}));
|
28
18
|
}
|
@@ -42,7 +32,7 @@ async function migrateStatus() {
|
|
42
32
|
Ran: existingMigration ? 'Yes' : 'No'
|
43
33
|
};
|
44
34
|
});
|
45
|
-
const p = new
|
35
|
+
const p = new Table();
|
46
36
|
statuses.forEach((s)=>{
|
47
37
|
p.addRow(s, {
|
48
38
|
color: s.Ran === 'Yes' ? 'green' : 'red'
|
@@ -51,4 +41,4 @@ async function migrateStatus() {
|
|
51
41
|
p.printTable();
|
52
42
|
}
|
53
43
|
|
54
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9taWdyYXRlU3RhdHVzLnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IFRhYmxlIH0gZnJvbSAnY29uc29sZS10YWJsZS1wcmludGVyJ1xuaW1wb3J0IHsgZ2V0TWlncmF0aW9ucywgcmVhZE1pZ3JhdGlvbkZpbGVzIH0gZnJvbSAncGF5bG9hZC9kYXRhYmFzZSdcblxuaW1wb3J0IHR5cGUgeyBQb3N0Z3Jlc0FkYXB0ZXIgfSBmcm9tICcuL3R5cGVzJ1xuXG5pbXBvcnQgeyBtaWdyYXRpb25UYWJsZUV4aXN0cyB9IGZyb20gJy4vdXRpbGl0aWVzL21pZ3JhdGlvblRhYmxlRXhpc3RzJ1xuXG5leHBvcnQgYXN5bmMgZnVuY3Rpb24gbWlncmF0ZVN0YXR1cyh0aGlzOiBQb3N0Z3Jlc0FkYXB0ZXIpOiBQcm9taXNlPHZvaWQ+IHtcbiAgY29uc3QgeyBwYXlsb2FkIH0gPSB0aGlzXG4gIGNvbnN0IG1pZ3JhdGlvbkZpbGVzID0gYXdhaXQgcmVhZE1pZ3JhdGlvbkZpbGVzKHsgcGF5bG9hZCB9KVxuXG4gIHBheWxvYWQubG9nZ2VyLmRlYnVnKHtcbiAgICBtc2c6IGBGb3VuZCAke21pZ3JhdGl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7SUFDRjtJQUVBLGlEQUFpRDtJQUNqRCxNQUFNTSxXQUFXVCxlQUFlVSxHQUFHLENBQUMsQ0FBQ0M7UUFDbkMsTUFBTUMsb0JBQW9CUCxtQkFBbUJRLElBQUksQ0FBQyxDQUFDQyxJQUFNQSxFQUFFQyxJQUFJLEtBQUtKLFVBQVVJLElBQUk7UUFDbEYsT0FBTztZQUNMQyxNQUFNTCxVQUFVSSxJQUFJO1lBQ3BCLHNEQUFzRDtZQUN0REUsT0FBT0wsbUJBQW1CTTtZQUMxQkMsS0FBS1Asb0JBQW9CLFFBQVE7UUFDbkM7SUFDRjtJQUVBLE1BQU1RLElBQUksSUFBSTFCO0lBRWRlLFNBQVNZLE9BQU8sQ0FBQyxDQUFDQztRQUNoQkYsRUFBRUcsTUFBTSxDQUFDRCxHQUFHO1lBQ1ZFLE9BQU9GLEVBQUVILEdBQUcsS0FBSyxRQUFRLFVBQVU7UUFDckM7SUFDRjtJQUNBQyxFQUFFSyxVQUFVO0FBQ2QifQ==
|
@@ -1,15 +1,5 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
value: true
|
4
|
-
});
|
5
|
-
Object.defineProperty(exports, "buildAndOrConditions", {
|
6
|
-
enumerable: true,
|
7
|
-
get: function() {
|
8
|
-
return buildAndOrConditions;
|
9
|
-
}
|
10
|
-
});
|
11
|
-
const _parseParams = require("./parseParams");
|
12
|
-
async function buildAndOrConditions({ adapter, fields, joinAliases, joins, locale, selectFields, tableName, where }) {
|
1
|
+
import { parseParams } from './parseParams';
|
2
|
+
export async function buildAndOrConditions({ adapter, fields, joinAliases, joins, locale, selectFields, tableName, where }) {
|
13
3
|
const completedConditions = [];
|
14
4
|
// Loop over all AND / OR operations and add them to the AND / OR query param
|
15
5
|
// Operations should come through as an array
|
@@ -18,7 +8,7 @@ async function buildAndOrConditions({ adapter, fields, joinAliases, joins, local
|
|
18
8
|
// If the operation is properly formatted as an object
|
19
9
|
if (typeof condition === 'object') {
|
20
10
|
// eslint-disable-next-line no-await-in-loop
|
21
|
-
const result = await
|
11
|
+
const result = await parseParams({
|
22
12
|
adapter,
|
23
13
|
fields,
|
24
14
|
joinAliases,
|
@@ -36,4 +26,4 @@ async function buildAndOrConditions({ adapter, fields, joinAliases, joins, local
|
|
36
26
|
return completedConditions;
|
37
27
|
}
|
38
28
|
|
39
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9xdWVyaWVzL2J1aWxkQW5kT3JDb25kaXRpb25zLnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB0eXBlIHsgU1FMIH0gZnJvbSAnZHJpenpsZS1vcm0nXG5pbXBvcnQgdHlwZSB7IEZpZWxkLCBXaGVyZSB9IGZyb20gJ3BheWxvYWQvdHlwZXMnXG5cbmltcG9ydCB0eXBlIHsgR2VuZXJpY0NvbHVtbiwgUG9zdGdyZXNBZGFwdGVyIH0gZnJvbSAnLi4vdHlwZXMnXG5pbXBvcnQgdHlwZSB7IEJ1aWxkUXVlcnlKb2luQWxpYXNlcywgQnVpbGRRdWVyeUpvaW5zIH0gZnJvbSAnLi9idWlsZFF1ZXJ5J1xuXG5pbXBvcnQgeyBwYXJzZVBhcmFtcyB9IGZyb20gJy4vcGFyc2VQYXJhbXMnXG5cbmV4cG9ydCBhc3luYyBmdW5jdGlvbiBidWlsZEFuZE9yQ29uZGl0aW9ucyh7XG4gIGFkYXB0ZXIsXG4gIGZpZWxkcyxcbiAgam9pbkFsaWFzZXMsXG4gIGpvaW5zLFxuICBsb2NhbGUsXG4gIHNlbGVjdEZpZWxkcyxcbiAgdGFibGVOYW1lLFxuICB3aGVyZSxcbn06IHtcbiAgYWRhcHRlcjogUG9zdGdyZXNBZGFwdGVyXG4gIGNvbGxlY3Rpb25TbHVnPzogc3RyaW5nXG4gIGZpZWxkczogRmllbGRbXVxuICBnbG9iYWxTbHVnPzogc3RyaW5nXG4gIGpvaW5BbGlhc2VzOiBCdWls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ElBQUksQ0FBQ0YsUUFBUUcsTUFBTSxHQUFHLEdBQUc7Z0JBQzVDTCxvQkFBb0JNLElBQUksQ0FBQ0o7WUFDM0I7UUFDRjtJQUNGO0lBQ0EsT0FBT0Y7QUFDVCJ9
|
@@ -1,16 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
});
|
5
|
-
Object.defineProperty(exports, "default", {
|
6
|
-
enumerable: true,
|
7
|
-
get: function() {
|
8
|
-
return _default;
|
9
|
-
}
|
10
|
-
});
|
11
|
-
const _drizzleorm = require("drizzle-orm");
|
12
|
-
const _getTableColumnFromPath = require("./getTableColumnFromPath");
|
13
|
-
const _parseParams = require("./parseParams");
|
1
|
+
import { asc, desc } from 'drizzle-orm';
|
2
|
+
import { getTableColumnFromPath } from './getTableColumnFromPath';
|
3
|
+
import { parseParams } from './parseParams';
|
14
4
|
const buildQuery = async function buildQuery({ adapter, fields, locale, sort, tableName, where: incomingWhere }) {
|
15
5
|
const selectFields = {
|
16
6
|
id: adapter.tables[tableName].id
|
@@ -25,13 +15,13 @@ const buildQuery = async function buildQuery({ adapter, fields, locale, sort, ta
|
|
25
15
|
let sortPath;
|
26
16
|
if (sort[0] === '-') {
|
27
17
|
sortPath = sort.substring(1);
|
28
|
-
orderBy.order =
|
18
|
+
orderBy.order = desc;
|
29
19
|
} else {
|
30
20
|
sortPath = sort;
|
31
|
-
orderBy.order =
|
21
|
+
orderBy.order = asc;
|
32
22
|
}
|
33
23
|
try {
|
34
|
-
const { columnName: sortTableColumnName, table: sortTable } =
|
24
|
+
const { columnName: sortTableColumnName, table: sortTable } = getTableColumnFromPath({
|
35
25
|
adapter,
|
36
26
|
collectionPath: sortPath,
|
37
27
|
fields,
|
@@ -49,7 +39,7 @@ const buildQuery = async function buildQuery({ adapter, fields, locale, sort, ta
|
|
49
39
|
}
|
50
40
|
}
|
51
41
|
if (!orderBy?.column) {
|
52
|
-
orderBy.order =
|
42
|
+
orderBy.order = desc;
|
53
43
|
const createdAt = adapter.tables[tableName]?.createdAt;
|
54
44
|
if (createdAt) {
|
55
45
|
orderBy.column = createdAt;
|
@@ -62,7 +52,7 @@ const buildQuery = async function buildQuery({ adapter, fields, locale, sort, ta
|
|
62
52
|
}
|
63
53
|
let where;
|
64
54
|
if (incomingWhere && Object.keys(incomingWhere).length > 0) {
|
65
|
-
where = await
|
55
|
+
where = await parseParams({
|
66
56
|
adapter,
|
67
57
|
fields,
|
68
58
|
joinAliases,
|
@@ -81,6 +71,6 @@ const buildQuery = async function buildQuery({ adapter, fields, locale, sort, ta
|
|
81
71
|
where
|
82
72
|
};
|
83
73
|
};
|
84
|
-
|
74
|
+
export default buildQuery;
|
85
75
|
|
86
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9xdWVyaWVzL2J1aWxkUXVlcnkudHMiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHR5cGUgeyBTUUwgfSBmcm9tICdkcml6emxlLW9ybSdcbmltcG9ydCB0eXBlIHsgUGdUYWJsZVdpdGhDb2x1bW5zIH0gZnJvbSAnZHJpenpsZS1vcm0vcGctY29yZSdcbmltcG9ydCB0eXBlIHsgRmllbGQsIFdoZXJlIH0gZnJvbSAncGF5bG9hZC90eXBlcydcblxuaW1wb3J0IHsgYXNjLCBkZXNjIH0gZnJvbSAnZHJpenpsZS1vcm0nXG5cbmltcG9ydCB0eXBlIHsgR2VuZXJpY0NvbHVtbiwgR2VuZXJpY1RhYmxlLCBQb3N0Z3Jlc0FkYXB0ZXIgfSBmcm9tICcuLi90eXBlcydcblxuaW1wb3J0IHsgZ2V0VGFibGVDb2x1bW5Gcm9tUGF0aCB9IGZyb20gJy4vZ2V0VGFibGVDb2x1bW5Gcm9tUGF0aCdcbmltcG9ydCB7IHBhcnNlUGFyYW1zIH0gZnJvbSAnLi9wYXJzZVBhcmFtcydcblxuZXhwb3J0IHR5cGUgQnVpbGRRdWVyeUpva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dBQUdjO1FBQ25CLE9BQU87WUFDTGYsUUFBUUMsTUFBTSxHQUFHYixRQUFRUyxNQUFNLENBQUNMLFVBQVUsQ0FBQ0ksRUFBRTtRQUMvQztJQUNGO0lBRUEsSUFBSUksUUFBUUMsTUFBTSxFQUFFO1FBQ2xCTixhQUFhSixJQUFJLEdBQUdTLFFBQVFDLE1BQU07SUFDcEM7SUFFQSxJQUFJUjtJQUVKLElBQUlDLGlCQUFpQnNCLE9BQU9DLElBQUksQ0FBQ3ZCLGVBQWV3QixNQUFNLEdBQUcsR0FBRztRQUMxRHpCLFFBQVEsTUFBTVAsWUFBWTtZQUN4QkU7WUFDQUM7WUFDQVU7WUFDQUQ7WUFDQVI7WUFDQUs7WUFDQUg7WUFDQUMsT0FBT0M7UUFDVDtJQUNGO0lBRUEsT0FBTztRQUNMSztRQUNBRDtRQUNBRTtRQUNBTDtRQUNBRjtJQUNGO0FBQ0Y7QUFFQSxlQUFlTixXQUFVIn0=
|
@@ -1,24 +1,14 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
value: true
|
4
|
-
});
|
5
|
-
Object.defineProperty(exports, "convertPathToJSONTraversal", {
|
6
|
-
enumerable: true,
|
7
|
-
get: function() {
|
8
|
-
return convertPathToJSONTraversal;
|
9
|
-
}
|
10
|
-
});
|
11
|
-
const _formatJSONPathSegment = require("./formatJSONPathSegment");
|
12
|
-
const convertPathToJSONTraversal = (incomingSegments)=>{
|
1
|
+
import { formatJSONPathSegment } from './formatJSONPathSegment';
|
2
|
+
export const convertPathToJSONTraversal = (incomingSegments)=>{
|
13
3
|
const segments = [
|
14
4
|
...incomingSegments
|
15
5
|
];
|
16
6
|
segments.shift();
|
17
7
|
return segments.reduce((res, segment, i)=>{
|
18
|
-
const formattedSegment =
|
8
|
+
const formattedSegment = formatJSONPathSegment(segment);
|
19
9
|
if (i + 1 === segments.length) return `${res}->>${formattedSegment}`;
|
20
10
|
return `${res}->${formattedSegment}`;
|
21
11
|
}, '');
|
22
12
|
};
|
23
13
|
|
24
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9xdWVyaWVzL2NyZWF0ZUpTT05RdWVyeS9jb252ZXJ0UGF0aFRvSlNPTlRyYXZlcnNhbC50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBmb3JtYXRKU09OUGF0aFNlZ21lbnQgfSBmcm9tICcuL2Zvcm1hdEpTT05QYXRoU2VnbWVudCdcblxuZXhwb3J0IGNvbnN0IGNvbnZlcnRQYXRoVG9KU09OVHJhdmVyc2FsID0gKGluY29taW5nU2VnbWVudHM6IHN0cmluZ1tdKSA9PiB7XG4gIGNvbnN0IHNlZ21lbnRzID0gWy4uLmluY29taW5nU2VnbWVudHNdXG4gIHNlZ21lbnRzLnNoaWZ0KClcblxuICByZXR1cm4gc2VnbWVudHMucmVkdWNlKChyZXMsIHNlZ21lbnQsIGkpID0+
|
14
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9xdWVyaWVzL2NyZWF0ZUpTT05RdWVyeS9jb252ZXJ0UGF0aFRvSlNPTlRyYXZlcnNhbC50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBmb3JtYXRKU09OUGF0aFNlZ21lbnQgfSBmcm9tICcuL2Zvcm1hdEpTT05QYXRoU2VnbWVudCdcblxuZXhwb3J0IGNvbnN0IGNvbnZlcnRQYXRoVG9KU09OVHJhdmVyc2FsID0gKGluY29taW5nU2VnbWVudHM6IHN0cmluZ1tdKSA9PiB7XG4gIGNvbnN0IHNlZ21lbnRzID0gWy4uLmluY29taW5nU2VnbWVudHNdXG4gIHNlZ21lbnRzLnNoaWZ0KClcblxuICByZXR1cm4gc2VnbWVudHMucmVkdWNlKChyZXMsIHNlZ21lbnQsIGkpID0+IHtcbiAgICBjb25zdCBmb3JtYXR0ZWRTZWdtZW50ID0gZm9ybWF0SlNPTlBhdGhTZWdtZW50KHNlZ21lbnQpXG5cbiAgICBpZiAoaSArIDEgPT09IHNlZ21lbnRzLmxlbmd0aCkgcmV0dXJuIGAke3Jlc30tPj4ke2Zvcm1hdHRlZFNlZ21lbnR9YFxuICAgIHJldHVybiBgJHtyZXN9LT4ke2Zvcm1hdHRlZFNlZ21lbnR9YFxuICB9LCAnJylcbn1cbiJdLCJuYW1lcyI6WyJmb3JtYXRKU09OUGF0aFNlZ21lbnQiLCJjb252ZXJ0UGF0aFRvSlNPTlRyYXZlcnNhbCIsImluY29taW5nU2VnbWVudHMiLCJzZWdtZW50cyIsInNoaWZ0IiwicmVkdWNlIiwicmVzIiwic2VnbWVudCIsImkiLCJmb3JtYXR0ZWRTZWdtZW50IiwibGVuZ3RoIl0sIm1hcHBpbmdzIjoiQUFBQSxTQUFTQSxxQkFBcUIsUUFBUSwwQkFBeUI7QUFFL0QsT0FBTyxNQUFNQyw2QkFBNkIsQ0FBQ0M7SUFDekMsTUFBTUMsV0FBVztXQUFJRDtLQUFpQjtJQUN0Q0MsU0FBU0MsS0FBSztJQUVkLE9BQU9ELFNBQVNFLE1BQU0sQ0FBQyxDQUFDQyxLQUFLQyxTQUFTQztRQUNwQyxNQUFNQyxtQkFBbUJULHNCQUFzQk87UUFFL0MsSUFBSUMsSUFBSSxNQUFNTCxTQUFTTyxNQUFNLEVBQUUsT0FBTyxDQUFDLEVBQUVKLElBQUksR0FBRyxFQUFFRyxpQkFBaUIsQ0FBQztRQUNwRSxPQUFPLENBQUMsRUFBRUgsSUFBSSxFQUFFLEVBQUVHLGlCQUFpQixDQUFDO0lBQ3RDLEdBQUc7QUFDTCxFQUFDIn0=
|
@@ -1,15 +1,5 @@
|
|
1
|
-
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
3
|
-
value: true
|
4
|
-
});
|
5
|
-
Object.defineProperty(exports, "formatJSONPathSegment", {
|
6
|
-
enumerable: true,
|
7
|
-
get: function() {
|
8
|
-
return formatJSONPathSegment;
|
9
|
-
}
|
10
|
-
});
|
11
|
-
const formatJSONPathSegment = (segment)=>{
|
1
|
+
export const formatJSONPathSegment = (segment)=>{
|
12
2
|
return Number.isNaN(parseInt(segment)) ? `'${segment}'` : segment;
|
13
3
|
};
|
14
4
|
|
15
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9xdWVyaWVzL2NyZWF0ZUpTT05RdWVyeS9mb3JtYXRKU09OUGF0aFNlZ21lbnQudHMiXSwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IGNvbnN0IGZvcm1hdEpTT05QYXRoU2VnbWVudCA9IChzZWdtZW50OiBzdHJpbmcpID0+
|
5
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9xdWVyaWVzL2NyZWF0ZUpTT05RdWVyeS9mb3JtYXRKU09OUGF0aFNlZ21lbnQudHMiXSwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IGNvbnN0IGZvcm1hdEpTT05QYXRoU2VnbWVudCA9IChzZWdtZW50OiBzdHJpbmcpID0+IHtcbiAgcmV0dXJuIE51bWJlci5pc05hTihwYXJzZUludChzZWdtZW50KSkgPyBgJyR7c2VnbWVudH0nYCA6IHNlZ21lbnRcbn1cbiJdLCJuYW1lcyI6WyJmb3JtYXRKU09OUGF0aFNlZ21lbnQiLCJzZWdtZW50IiwiTnVtYmVyIiwiaXNOYU4iLCJwYXJzZUludCJdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxNQUFNQSx3QkFBd0IsQ0FBQ0M7SUFDcEMsT0FBT0MsT0FBT0MsS0FBSyxDQUFDQyxTQUFTSCxZQUFZLENBQUMsQ0FBQyxFQUFFQSxRQUFRLENBQUMsQ0FBQyxHQUFHQTtBQUM1RCxFQUFDIn0=
|