@payloadcms/db-postgres 0.5.2 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/connect.d.ts.map +1 -1
- package/dist/connect.js +48 -8
- package/dist/find/traverseFields.js +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -2
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +12 -7
- package/dist/migrate.js +2 -2
- package/dist/migrateFresh.d.ts.map +1 -1
- package/dist/migrateFresh.js +3 -3
- package/dist/queries/buildQuery.d.ts +2 -1
- package/dist/queries/buildQuery.d.ts.map +1 -1
- package/dist/queries/buildQuery.js +3 -2
- package/dist/queries/getTableColumnFromPath.d.ts +9 -4
- package/dist/queries/getTableColumnFromPath.d.ts.map +1 -1
- package/dist/queries/getTableColumnFromPath.js +40 -13
- package/dist/queries/parseParams.d.ts.map +1 -1
- package/dist/queries/parseParams.js +6 -8
- package/dist/queries/sanitizeQueryValue.d.ts +3 -1
- package/dist/queries/sanitizeQueryValue.d.ts.map +1 -1
- package/dist/queries/sanitizeQueryValue.js +5 -3
- package/dist/schema/build.d.ts.map +1 -1
- package/dist/schema/build.js +13 -15
- package/dist/schema/parentIDColumnMap.d.ts +3 -6
- package/dist/schema/parentIDColumnMap.d.ts.map +1 -1
- package/dist/schema/parentIDColumnMap.js +2 -1
- package/dist/schema/setColumnID.d.ts +11 -0
- package/dist/schema/setColumnID.d.ts.map +1 -0
- package/dist/schema/setColumnID.js +34 -0
- package/dist/schema/traverseFields.d.ts.map +1 -1
- package/dist/schema/traverseFields.js +2 -1
- package/dist/types.d.ts +11 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/upsertRow/insertArrays.d.ts.map +1 -1
- package/dist/upsertRow/insertArrays.js +19 -5
- package/dist/utilities/createMigrationTable.d.ts +2 -2
- package/dist/utilities/createMigrationTable.d.ts.map +1 -1
- package/dist/utilities/createMigrationTable.js +5 -4
- package/package.json +3 -3
- package/dist/schema/getConfigIDType.d.ts +0 -3
- package/dist/schema/getConfigIDType.d.ts.map +0 -1
- package/dist/schema/getConfigIDType.js +0 -25
package/dist/connect.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"connect.d.ts","sourceRoot":"","sources":["../src/connect.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"connect.d.ts","sourceRoot":"","sources":["../src/connect.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AA+C/C,eAAO,MAAM,OAAO,EAAE,OAuGrB,CAAA"}
|
package/dist/connect.js
CHANGED
@@ -18,6 +18,41 @@ function _interop_require_default(obj) {
|
|
18
18
|
default: obj
|
19
19
|
};
|
20
20
|
}
|
21
|
+
const connectWithReconnect = async function({ adapter, payload, reconnect = false }) {
|
22
|
+
let result;
|
23
|
+
if (!reconnect) {
|
24
|
+
result = await adapter.pool.connect();
|
25
|
+
} else {
|
26
|
+
try {
|
27
|
+
result = await adapter.pool.connect();
|
28
|
+
} catch (err) {
|
29
|
+
setTimeout(()=>{
|
30
|
+
payload.logger.info('Reconnecting to postgres');
|
31
|
+
void connectWithReconnect({
|
32
|
+
adapter,
|
33
|
+
payload,
|
34
|
+
reconnect: true
|
35
|
+
});
|
36
|
+
}, 1000);
|
37
|
+
}
|
38
|
+
}
|
39
|
+
if (!result) {
|
40
|
+
return;
|
41
|
+
}
|
42
|
+
result.prependListener('error', (err)=>{
|
43
|
+
try {
|
44
|
+
if (err.code === 'ECONNRESET') {
|
45
|
+
void connectWithReconnect({
|
46
|
+
adapter,
|
47
|
+
payload,
|
48
|
+
reconnect: true
|
49
|
+
});
|
50
|
+
}
|
51
|
+
} catch (err) {
|
52
|
+
// swallow error
|
53
|
+
}
|
54
|
+
});
|
55
|
+
};
|
21
56
|
const connect = async function connect(payload) {
|
22
57
|
this.schema = {
|
23
58
|
...this.tables,
|
@@ -26,16 +61,21 @@ const connect = async function connect(payload) {
|
|
26
61
|
};
|
27
62
|
try {
|
28
63
|
this.pool = new _pg.Pool(this.poolOptions);
|
29
|
-
await
|
64
|
+
await connectWithReconnect({
|
65
|
+
adapter: this,
|
66
|
+
payload
|
67
|
+
});
|
30
68
|
const logger = this.logger || false;
|
31
69
|
this.drizzle = (0, _nodepostgres.drizzle)(this.pool, {
|
32
|
-
|
33
|
-
|
70
|
+
logger,
|
71
|
+
schema: this.schema
|
34
72
|
});
|
35
73
|
if (process.env.PAYLOAD_DROP_DATABASE === 'true') {
|
36
|
-
this.payload.logger.info(
|
37
|
-
await this.drizzle.execute(
|
38
|
-
|
74
|
+
this.payload.logger.info(`---- DROPPING TABLES SCHEMA(${this.schemaName || 'public'}) ----`);
|
75
|
+
await this.drizzle.execute(_drizzleorm.sql.raw(`
|
76
|
+
drop schema if exists ${this.schemaName || 'public'} cascade;
|
77
|
+
create schema ${this.schemaName || 'public'};
|
78
|
+
`));
|
39
79
|
this.payload.logger.info('---- DROPPED TABLES ----');
|
40
80
|
}
|
41
81
|
} catch (err) {
|
@@ -71,7 +111,7 @@ const connect = async function connect(payload) {
|
|
71
111
|
}
|
72
112
|
await apply();
|
73
113
|
// Migration table def in order to use query using drizzle
|
74
|
-
const migrationsSchema =
|
114
|
+
const migrationsSchema = this.pgSchema.table('payload_migrations', {
|
75
115
|
name: (0, _pgcore.varchar)('name'),
|
76
116
|
batch: (0, _pgcore.numeric)('batch'),
|
77
117
|
created_at: (0, _pgcore.timestamp)('created_at'),
|
@@ -90,4 +130,4 @@ const connect = async function connect(payload) {
|
|
90
130
|
}
|
91
131
|
};
|
92
132
|
|
93
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9jb25uZWN0LnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB0eXBlIHsgQ29ubmVjdCB9IGZyb20gJ3BheWxvYWQvZGF0YWJhc2UnXG5cbmltcG9ydCB7IGVxLCBzcWwgfSBmcm9tICdkcml6emxlLW9ybSdcbmltcG9ydCB7IGRyaX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UUFBUVMsSUFBSSxDQUFDO1FBQ2Y7SUFDRjtJQUVBLE1BQU1NO0lBRU4sMERBQTBEO0lBQzFELE1BQU1hLG1CQUFtQixJQUFJLENBQUNDLFFBQVEsQ0FBQ0MsS0FBSyxDQUFDLHNCQUFzQjtRQUNqRU4sTUFBTU8sSUFBQUEsZUFBTyxFQUFDO1FBQ2RDLE9BQU9DLElBQUFBLGVBQU8sRUFBQztRQUNmQyxZQUFZQyxJQUFBQSxpQkFBUyxFQUFDO1FBQ3RCQyxZQUFZRCxJQUFBQSxpQkFBUyxFQUFDO0lBQ3hCO0lBRUEsTUFBTUUsVUFBVSxNQUFNLElBQUksQ0FBQ3RDLE9BQU8sQ0FDL0J1QyxNQUFNLEdBQ05DLElBQUksQ0FBQ1gsa0JBQ0xZLEtBQUssQ0FBQ0MsSUFBQUEsY0FBRSxFQUFDYixpQkFBaUJJLEtBQUssRUFBRTtJQUVwQyxJQUFJLENBQUNLLFFBQVFsQixNQUFNLEVBQUU7UUFDbkIsTUFBTSxJQUFJLENBQUNwQixPQUFPLENBQUMyQyxNQUFNLENBQUNkLGtCQUFrQmUsTUFBTSxDQUFDO1lBQ2pEbkIsTUFBTTtZQUNOUSxPQUFPO1FBQ1Q7SUFDRixPQUFPO1FBQ0wsTUFBTSxJQUFJLENBQUNqQyxPQUFPLENBQ2Y2QyxNQUFNLENBQUNoQixrQkFDUGlCLEdBQUcsQ0FBQztZQUNIVCxZQUFZLElBQUlVO1FBQ2xCLEdBQ0NOLEtBQUssQ0FBQ0MsSUFBQUEsY0FBRSxFQUFDYixpQkFBaUJJLEtBQUssRUFBRTtJQUN0QztBQUNGIn0=
|
@@ -61,7 +61,7 @@ const traverseFields = ({ _locales, adapter, currentArgs, currentTableName, dept
|
|
61
61
|
],
|
62
62
|
with: {}
|
63
63
|
};
|
64
|
-
const arrayTableName = `${currentTableName}_${(0, _tosnakecase.default)(field.name)}`;
|
64
|
+
const arrayTableName = `${currentTableName}_${path}${(0, _tosnakecase.default)(field.name)}`;
|
65
65
|
if (adapter.tables[`${arrayTableName}_locales`]) withArray.with._locales = _locales;
|
66
66
|
currentArgs.with[`${path}${field.name}`] = withArray;
|
67
67
|
traverseFields({
|
@@ -147,4 +147,4 @@ const traverseFields = ({ _locales, adapter, currentArgs, currentTableName, dept
|
|
147
147
|
return topLevelArgs;
|
148
148
|
};
|
149
149
|
|
150
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9maW5kL3RyYXZlcnNlRmllbGRzLnRzIl0sInNvdXJjZXNDb250ZW50IjpbIi8qIGVzbGludC1kaXNhYmxlIG5vLXBhcmFtLXJlYXNzaWduICovXG5pbXBvcnQgdHlwZSB7IEZpZWxkIH0gZnJvbSAncGF5bG9hZC90eXBlcydcblxuaW1wb3J0IHsgZmllbGRBZmZlY3RzRGF0YSwgdGFiSGFzTmFtZSB9IGZyb20gJ3BheWxvYWQvdHlwZXMnXG5pbXBvcnQgdG9TbmFrZUNhc2UgZnJvbSAndG8tc25ha2UtY2FzZSdcblxuaW1wb3J0IHR5cGUgeyBQb3N0Z3Jlc0FkYXB0ZXIgfSBmcm9tICcuLi90eXBlcydcbmltcG9ydCB0eXBlIHsgUmVzdWx0IH0gZnJvbSAnLi9idWlsZEZpbmRNYW55QXJncydcblxudHlwZSBUcmF2ZXJzZUZpZWxkQXJncyA9IHtcbiAgX2xvY2FsZXM6IFJlY29yZDxzdHJpbmcsIHVua25vd24+XG4gIGFkYXB0ZXI6IFBvc3RncmVzQWRhcHRlclxuICBjdXJyZW50QXJnczogUmVjb3JkPHN0cmluZywgdW5rbm93bj5cbiAgY3VycmVudFRhYmxlTmFtZTogc3RyaW5nXG4gIGRlcHRoPzogbnVtYmVyXG4gIGZpZWxkczogRmllbGRbXVxuICBwYXRoOiBzdHJpbmdcbiAgdG9wTGV2ZWxBcmdzOiBSZWNvcmQ8c3RyaW5nLCB1bmtub3duPlxuICB0b3BMZXZlbFRhYmxlTmFtZTogc3RyaW5nXG59XG5cbmV4cG9ydCBjb25zdCB0cmF2ZXJzZUZpZWxkcyA9ICh7XG4gIF9sb2NhbGVzLFxuICBhZGFwdGVyLFxuICBjdXJyZW50QXJncyxcbiAgY3VycmVudFRhYmxlTmFtZSxcbiAgZGVwdGgsXG4gIGZpZWxkcyxcbiAgcGF0aCxcbiAgdG9wTGV2ZWxBcmdzLFxuICB0b3BMZXZlbFRhYmxlTmFtZSxcbn06IFRyYXZlcnNlRmllbGRBcmdzKSA9PiB7XG4gIGZpZWxkcy5mb3JFYWNoKChmaWVsZCkgPT4ge1xuICAgIGlmIChmaWVsZC50eXBlID09PSAnY29sbGFwc2libGUnIHx8IGZpZWxkLnR5cGUgPT09ICdyb3cnKSB7XG4gICAgICB0cmF2ZXJzZUZpZWxkcyh7XG4gICAgICAgIF9sb2NhbGVzLFxuICAgICAgICBhZGFwdGVyLFxuICAgICAgICBjdXJyZW50QXJncyxcbiAgICAgICAgY3VycmVudFRhYmxlTmFtZSxcbiAgICAgICAgZGVwdGgsXG4gICAgICAgIGZpZWxkczogZmllbGQuZmllbGRzLFxuICAgICAgICBwYXRoLFxuICAgICAgICB0b3BMZXZlbEFyZ3MsXG4gICAgICAgIHRvcExldmVsVGFibGVOYW1lLFxuICAgICAgfSlcblxuICAgICAgcmV0dXJuXG4gICAgfVxuXG4gICAgaWYgKGZpZWxkLnR5cGUgPT09ICd0YWJzJykge1xuICAgICAgZmllbGQudGFicy5mb3JFYWNoKCh0YWIpID0+IHtcbiAgICAgICAgY29uc3QgdGFiUGF0aCA9IHRhYkhhc05hbWUodGFiKSA/
|
150
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9maW5kL3RyYXZlcnNlRmllbGRzLnRzIl0sInNvdXJjZXNDb250ZW50IjpbIi8qIGVzbGludC1kaXNhYmxlIG5vLXBhcmFtLXJlYXNzaWduICovXG5pbXBvcnQ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gPT09ICdyb3cnKSB7XG4gICAgICB0cmF2ZXJzZUZpZWxkcyh7XG4gICAgICAgIF9sb2NhbGVzLFxuICAgICAgICBhZGFwdGVyLFxuICAgICAgICBjdXJyZW50QXJncyxcbiAgICAgICAgY3VycmVudFRhYmxlTmFtZSxcbiAgICAgICAgZGVwdGgsXG4gICAgICAgIGZpZWxkczogZmllbGQuZmllbGRzLFxuICAgICAgICBwYXRoLFxuICAgICAgICB0b3BMZXZlbEFyZ3MsXG4gICAgICAgIHRvcExldmVsVGFibGVOYW1lLFxuICAgICAgfSlcblxuICAgICAgcmV0dXJuXG4gICAgfVxuXG4gICAgaWYgKGZpZWxkLnR5cGUgPT09ICd0YWJzJykge1xuICAgICAgZmllbGQudGFicy5mb3JFYWNoKCh0YWIpID0+IHtcbiAgICAgICAgY29uc3QgdGFiUGF0aCA9IHRhYkhhc05hbWUodGFiKSA/IGAke3BhdGh9JHt0YWIubmFtZX1fYCA6IHBhdGhcblxuICAgICAgICB0cmF2ZXJzZUZpZWxkcyh7XG4gICAgICAgICAgX2xvY2FsZXMsXG4gICAgICAgICAgYWRhcHRlcixcbiAgICAgICAgICBjdXJyZW50QXJncyxcbiAgICAgICAgICBjdXJyZW50VGFibGVOYW1lLFxuICAgICAgICAgIGRlcHRoLFxuICAgICAgICAgIGZpZWxkczogdGFiLmZpZWxkcyxcbiAgICAgICAgICBwYXRoOiB0YWJQYXRoLFxuICAgICAgICAgIHRvcExldmVsQXJncyxcbiAgICAgICAgICB0b3BMZXZlbFRhYmxlTmFtZSxcbiAgICAgICAgfSlcbiAgICAgIH0pXG5cbiAgICAgIHJldHVyblxuICAgIH1cblxuICAgIGlmIChmaWVsZEFmZmVjdHNEYXRhKGZpZWxkKSkge1xuICAgICAgc3dpdGNoIChmaWVsZC50eXBlKSB7XG4gICAgICAgIGNhc2UgJ2FycmF5Jzoge1xuICAgICAgICAgIGNvbnN0IHdpdGhBcnJheTogUmVzdWx0ID0ge1xuICAgICAgICAgICAgY29sdW1uczoge1xuICAgICAgICAgICAgICBfcGFyZW50SUQ6IGZhbHNlLFxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIG9yZGVyQnk6ICh7IF9vcmRlciB9LCB7IGFzYyB9KSA9PiBbYXNjKF9vcmRlcildLFxuICAgICAgICAgICAgd2l0aDoge30sXG4gICAgICAgICAgfVxuXG4gICAgICAgICAgY29uc3QgYXJyYXlUYWJsZU5hbWUgPSBgJHtjdXJyZW50VGFibGVOYW1lfV8ke3BhdGh9JHt0b1NuYWtlQ2FzZShmaWVsZC5uYW1lKX1gXG5cbiAgICAgICAgICBpZiAoYWRhcHRlci50YWJsZXNbYCR7YXJyYXlUYWJsZU5hbWV9X2xvY2FsZXNgXSkgd2l0aEFycmF5LndpdGguX2xvY2FsZXMgPSBfbG9jYWxlc1xuICAgICAgICAgIGN1cnJlbnRBcmdzLndpdGhbYCR7cGF0aH0ke2ZpZWxkLm5hbWV9YF0gPSB3aXRoQXJyYXlcblxuICAgICAgICAgIHRyYXZlcnNlRmllbGRzKHtcbiAgICAgICAgICAgIF9sb2NhbGVzLFxuICAgICAgICAgICAgYWRhcHRlcixcbiAgICAgICAgICAgIGN1cnJlbnRBcmdzOiB3aXRoQXJyYXksXG4gICAgICAgICAgICBjdXJyZW50VGFibGVOYW1lOiBhcnJheVRhYmxlTmFtZSxcbiAgICAgICAgICAgIGRlcHRoLFxuICAgICAgICAgICAgZmllbGRzOiBmaWVsZC5maWVsZHMsXG4gICAgICAgICAgICBwYXRoOiAnJyxcbiAgICAgICAgICAgIHRvcExldmVsQXJncyxcbiAgICAgICAgICAgIHRvcExldmVsVGFibGVOYW1lLFxuICAgICAgICAgIH0pXG5cbiAgICAgICAgICBicmVha1xuICAgICAgICB9XG5cbiAgICAgICAgY2FzZSAnc2VsZWN0Jzoge1xuICAgICAgICAgIGlmIChmaWVsZC5oYXNNYW55KSB7XG4gICAgICAgICAgICBjb25zdCB3aXRoU2VsZWN0OiBSZXN1bHQgPSB7XG4gICAgICAgICAgICAgIGNvbHVtbnM6IHtcbiAgICAgICAgICAgICAgICBpZDogZmFsc2UsXG4gICAgICAgICAgICAgICAgb3JkZXI6IGZhbHNlLFxuICAgICAgICAgICAgICAgIHBhcmVudDogZmFsc2UsXG4gICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgIG9yZGVyQnk6ICh7IG9yZGVyIH0sIHsgYXNjIH0pID0+IFthc2Mob3JkZXIpXSxcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgY3VycmVudEFyZ3Mud2l0aFtgJHtwYXRofSR7ZmllbGQubmFtZX1gXSA9IHdpdGhTZWxlY3RcbiAgICAgICAgICB9XG5cbiAgICAgICAgICBicmVha1xuICAgICAgICB9XG5cbiAgICAgICAgY2FzZSAnYmxvY2tzJzpcbiAgICAgICAgICBmaWVsZC5ibG9ja3MuZm9yRWFjaCgoYmxvY2spID0+IHtcbiAgICAgICAgICAgIGNvbnN0IGJsb2NrS2V5ID0gYF9ibG9ja3NfJHtibG9jay5zbHVnfWBcblxuICAgICAgICAgICAgaWYgKCF0b3BMZXZlbEFyZ3NbYmxvY2tLZXldKSB7XG4gICAgICAgICAgICAgIGNvbnN0IHdpdGhCbG9jazogUmVzdWx0ID0ge1xuICAgICAgICAgICAgICAgIGNvbHVtbnM6IHtcbiAgICAgICAgICAgICAgICAgIF9wYXJlbnRJRDogZmFsc2UsXG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBvcmRlckJ5OiAoeyBfb3JkZXIgfSwgeyBhc2MgfSkgPT4gW2FzYyhfb3JkZXIpXSxcbiAgICAgICAgICAgICAgICB3aXRoOiB7fSxcbiAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgIGNvbnN0IHRhYmxlTmFtZSA9IGAke3RvcExldmVsVGFibGVOYW1lfV9ibG9ja3NfJHt0b1NuYWtlQ2FzZShibG9jay5zbHVnKX1gXG5cbiAgICAgICAgICAgICAgaWYgKGFkYXB0ZXIudGFibGVzW2Ake3RhYmxlTmFtZX1fbG9jYWxlc2BdKSB3aXRoQmxvY2sud2l0aC5fbG9jYWxlcyA9IF9sb2NhbGVzXG4gICAgICAgICAgICAgIHRvcExldmVsQXJncy53aXRoW2Jsb2NrS2V5XSA9IHdpdGhCbG9ja1xuXG4gICAgICAgICAgICAgIHRyYXZlcnNlRmllbGRzKHtcbiAgICAgICAgICAgICAgICBfbG9jYWxlcyxcbiAgICAgICAgICAgICAgICBhZGFwdGVyLFxuICAgICAgICAgICAgICAgIGN1cnJlbnRBcmdzOiB3aXRoQmxvY2ssXG4gICAgICAgICAgICAgICAgY3VycmVudFRhYmxlTmFtZTogdGFibGVOYW1lLFxuICAgICAgICAgICAgICAgIGRlcHRoLFxuICAgICAgICAgICAgICAgIGZpZWxkczogYmxvY2suZmllbGRzLFxuICAgICAgICAgICAgICAgIHBhdGg6ICcnLFxuICAgICAgICAgICAgICAgIHRvcExldmVsQXJncyxcbiAgICAgICAgICAgICAgICB0b3BMZXZlbFRhYmxlTmFtZSxcbiAgICAgICAgICAgICAgfSlcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9KVxuXG4gICAgICAgICAgYnJlYWtcblxuICAgICAgICBjYXNlICdncm91cCc6XG4gICAgICAgICAgdHJhdmVyc2VGaWVsZHMoe1xuICAgICAgICAgICAgX2xvY2FsZXMsXG4gICAgICAgICAgICBhZGFwdGVyLFxuICAgICAgICAgICAgY3VycmVudEFyZ3MsXG4gICAgICAgICAgICBjdXJyZW50VGFibGVOYW1lLFxuICAgICAgICAgICAgZGVwdGgsXG4gICAgICAgICAgICBmaWVsZHM6IGZpZWxkLmZpZWxkcyxcbiAgICAgICAgICAgIHBhdGg6IGAke3BhdGh9JHtmaWVsZC5uYW1lfV9gLFxuICAgICAgICAgICAgdG9wTGV2ZWxBcmdzLFxuICAgICAgICAgICAgdG9wTGV2ZWxUYWJsZU5hbWUsXG4gICAgICAgICAgfSlcblxuICAgICAgICAgIGJyZWFrXG5cbiAgICAgICAgZGVmYXVsdD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],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,IAAI,EAAmB,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAiC3E,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAE7D,wBAAgB,eAAe,CAAC,IAAI,EAAE,IAAI,GAAG,qBAAqB,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,IAAI,EAAmB,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAiC3E,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAE7D,wBAAgB,eAAe,CAAC,IAAI,EAAE,IAAI,GAAG,qBAAqB,CAgEjE"}
|
package/dist/index.js
CHANGED
@@ -49,18 +49,22 @@ function _interop_require_default(obj) {
|
|
49
49
|
function postgresAdapter(args) {
|
50
50
|
function adapter({ payload }) {
|
51
51
|
const migrationDir = findMigrationDir(args.migrationDir);
|
52
|
+
const idType = args.idType || 'serial';
|
52
53
|
return (0, _database.createDatabaseAdapter)({
|
53
54
|
name: 'postgres',
|
54
55
|
// Postgres-specific
|
55
56
|
drizzle: undefined,
|
56
57
|
enums: {},
|
57
58
|
fieldConstraints: {},
|
59
|
+
idType,
|
58
60
|
logger: args.logger,
|
61
|
+
pgSchema: undefined,
|
59
62
|
pool: undefined,
|
60
63
|
poolOptions: args.pool,
|
61
64
|
push: args.push,
|
62
65
|
relations: {},
|
63
66
|
schema: {},
|
67
|
+
schemaName: args.schemaName,
|
64
68
|
sessions: {},
|
65
69
|
tables: {},
|
66
70
|
// DatabaseAdapter
|
@@ -72,7 +76,9 @@ function postgresAdapter(args) {
|
|
72
76
|
createGlobalVersion: _createGlobalVersion.createGlobalVersion,
|
73
77
|
createMigration: _createMigration.createMigration,
|
74
78
|
createVersion: _createVersion.createVersion,
|
75
|
-
|
79
|
+
/**
|
80
|
+
* This represents how a default ID is treated in Payload as were a field type
|
81
|
+
*/ defaultIDType: idType === 'serial' ? 'number' : 'text',
|
76
82
|
deleteMany: _deleteMany.deleteMany,
|
77
83
|
deleteOne: _deleteOne.deleteOne,
|
78
84
|
deleteVersions: _deleteVersions.deleteVersions,
|
@@ -134,4 +140,4 @@ function postgresAdapter(args) {
|
|
134
140
|
return srcDir;
|
135
141
|
}
|
136
142
|
|
137
|
-
//# sourceMappingURL=data:application/json;base64,
|
143
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9pbmRleC50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgdHlwZSB7IFBheWxvYWQgfSBmcm9tICdwYXlsb2FkJ1xuXG5pbXBvcnQgZnMgZnJvbSAnZnMnXG5pbXBvcnQgcGF0aCBmcm9tICdwYXRoJ1xuaW1wb3J0IHsgY3JlYXRlRGF0YWJhc2VBZGFwdGVyIH0gZnJvbSAncGF5bG9hZC9kYXRhYmFzZSdcblxuaW1wb3J0IHR5cGUgeyBBcmdzLCBQb3N0Z3Jlc0FkYXB0ZXIsIFBvc3RncmVzQWRhcHRlclJlc3VsdCB9IGZyb20gJy4vdHlwZXMnXG5cbmltcG9ydCB7IGNvbm5lY3QgfSBmcm9tICcuL2Nvbm5lY3QnXG5pbXBvcnQgeyBjcmVhdGUgfSBmcm9tICcuL2NyZWF0ZSdcbmltcG9ydCB7IGNyZWF0ZUdsb2JhbCB9IGZyb20gJy4vY3JlYXRlR2xvYmFsJ1xuaW1wb3J0IHsgY3JlYXRlR2xvYmFsVmVyc2lvbiB9IGZyb20gJy4vY3JlYXRlR2xvYmFsVmVyc2lvbidcbmltcG9ydCB7IGNyZWF0ZU1pZ3JhdGlvbiB9IGZyb20gJy4vY3JlYXRlTWlncmF0aW9uJ1xuaW1wb3J0IHsgY3JlYXRlVmVyc2lvbiB9IGZyb20gJy4vY3JlYXRlVmVyc2lvbidcbmltcG9ydCB7IGRlbGV0ZU1hbnkg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"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAW5C,eAAO,MAAM,IAAI,EAAE,IA+ElB,CAAA"}
|
package/dist/init.js
CHANGED
@@ -12,13 +12,19 @@ const _pgcore = require("drizzle-orm/pg-core");
|
|
12
12
|
const _versions = require("payload/versions");
|
13
13
|
const _tosnakecase = /*#__PURE__*/ _interop_require_default(require("to-snake-case"));
|
14
14
|
const _build = require("./schema/build");
|
15
|
-
const _getConfigIDType = require("./schema/getConfigIDType");
|
16
15
|
function _interop_require_default(obj) {
|
17
16
|
return obj && obj.__esModule ? obj : {
|
18
17
|
default: obj
|
19
18
|
};
|
20
19
|
}
|
21
20
|
const init = async function init() {
|
21
|
+
if (this.schemaName) {
|
22
|
+
this.pgSchema = (0, _pgcore.pgSchema)(this.schemaName);
|
23
|
+
} else {
|
24
|
+
this.pgSchema = {
|
25
|
+
table: _pgcore.pgTable
|
26
|
+
};
|
27
|
+
}
|
22
28
|
if (this.payload.config.localization) {
|
23
29
|
this.enums.enum__locales = (0, _pgcore.pgEnum)('_locales', this.payload.config.localization.locales.map(({ code })=>code));
|
24
30
|
}
|
@@ -26,9 +32,9 @@ const init = async function init() {
|
|
26
32
|
const tableName = (0, _tosnakecase.default)(collection.slug);
|
27
33
|
(0, _build.buildTable)({
|
28
34
|
adapter: this,
|
29
|
-
buildTexts: true,
|
30
35
|
buildNumbers: true,
|
31
36
|
buildRelationships: true,
|
37
|
+
buildTexts: true,
|
32
38
|
disableNotNull: !!collection?.versions?.drafts,
|
33
39
|
disableUnique: false,
|
34
40
|
fields: collection.fields,
|
@@ -38,12 +44,11 @@ const init = async function init() {
|
|
38
44
|
if (collection.versions) {
|
39
45
|
const versionsTableName = `_${tableName}_v`;
|
40
46
|
const versionFields = (0, _versions.buildVersionCollectionFields)(collection);
|
41
|
-
const versionsParentIDColType = (0, _getConfigIDType.getConfigIDType)(collection.fields);
|
42
47
|
(0, _build.buildTable)({
|
43
48
|
adapter: this,
|
44
|
-
buildTexts: true,
|
45
49
|
buildNumbers: true,
|
46
50
|
buildRelationships: true,
|
51
|
+
buildTexts: true,
|
47
52
|
disableNotNull: !!collection.versions?.drafts,
|
48
53
|
disableUnique: true,
|
49
54
|
fields: versionFields,
|
@@ -56,9 +61,9 @@ const init = async function init() {
|
|
56
61
|
const tableName = (0, _tosnakecase.default)(global.slug);
|
57
62
|
(0, _build.buildTable)({
|
58
63
|
adapter: this,
|
59
|
-
buildTexts: true,
|
60
64
|
buildNumbers: true,
|
61
65
|
buildRelationships: true,
|
66
|
+
buildTexts: true,
|
62
67
|
disableNotNull: !!global?.versions?.drafts,
|
63
68
|
disableUnique: false,
|
64
69
|
fields: global.fields,
|
@@ -70,9 +75,9 @@ const init = async function init() {
|
|
70
75
|
const versionFields = (0, _versions.buildVersionGlobalFields)(global);
|
71
76
|
(0, _build.buildTable)({
|
72
77
|
adapter: this,
|
73
|
-
buildTexts: true,
|
74
78
|
buildNumbers: true,
|
75
79
|
buildRelationships: true,
|
80
|
+
buildTexts: true,
|
76
81
|
disableNotNull: !!global.versions?.drafts,
|
77
82
|
disableUnique: true,
|
78
83
|
fields: versionFields,
|
@@ -83,4 +88,4 @@ const init = async function init() {
|
|
83
88
|
});
|
84
89
|
};
|
85
90
|
|
86
|
-
//# sourceMappingURL=data:application/json;base64,
|
91
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9pbml0LnRzIl0sInNvdXJjZXNDb250ZW50IjpbIi8qIGVzbGludC1kaXNhYmxlIG5vLXBhcmFtLXJlYXNzaWduICovXG5pbXBvcnQgdHlwZSB7IEluaXQgfSBmcm9tICdwYXlsb2FkL2RhdGFiYXNlJ1xuaW1wb3J0IHR5cGUgeyBTYW5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(migrationsInDB[0]?.batch);
|
46
46
|
}
|
47
47
|
} else {
|
48
|
-
await (0, _createMigrationTable.createMigrationTable)(this
|
48
|
+
await (0, _createMigrationTable.createMigrationTable)(this);
|
49
49
|
}
|
50
50
|
if (migrationsInDB.find((m)=>m.batch === -1)) {
|
51
51
|
const { confirm: runMigrations } = await (0, _prompts.default)({
|
@@ -112,4 +112,4 @@ async function runMigrationFile(payload, migration, batch) {
|
|
112
112
|
}
|
113
113
|
}
|
114
114
|
|
115
|
-
//# sourceMappingURL=data:application/json;base64,
|
115
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9taWdyYXRlLnRzIl0sInNvdXJjZXNDb250ZW50IjpbIi8qIGVzbGludC1kaXNhYmxlIG5vLXJlc3RyaWN0ZWQtc3ludGF4LCBuby1hd2FpdC1pbi1sb29wICovXG5pbXBvcnQgdHlwZSB7IFBheWxvYWQgfSBmcm9tICdwYXlsb2FkJ1xuaW1wb3J0IHR5cGUgeyBNaWdyYXRpb24gfSBmcm9tICdwYXlsb2FkL2RhdGFiYXNlJ1xuaW1wb3J0IHR5cGUgeyBQYXlsb2FkUmVxdWVzdCB9IGZyb20gJ3BheWxvYWQvZGlzdC9leHByZXNzL3R5cGVzJ1xuXG5pbXBvcnQgeyByZWFkTWlncmF0aW9uRmlsZXMgfSBmcm9tICdwYXlsb2FkL2RhdGFiYXNlJ1xuaW1wb3J0IHsgY29tbWl0VHJhbnNhY3Rpb24gfSBmcm9tICdwYXlsb2FkL2Rpc3QvdXRpbGl0aWVzL2NvbW1pdFRyYW5zYWN0aW9uJ1xuaW1wb3J0IHsgaW5pdFRyYW5zYWN0aW9uIH0gZnJvbSAncGF5bG9hZC9kaXN0L3V0aWxpdGllcy9pbml0VHJhbnNhY3Rpb24nXG5pbXBvcnQgeyBraWxsVHJhbnNhY3Rpb24gfSBmcm9tICdwYXlsb2FkL2Rpc3QvdXRpbGl0aWVzL2tpbG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sQ0FBQ2lELEtBQUssQ0FBQztZQUNuQkY7WUFDQTdDLEtBQUtnRCxJQUFBQSxzQkFBVSxFQUFDSCxLQUFLLENBQUMsd0JBQXdCLEVBQUVuQixVQUFVUixJQUFJLENBQUMsQ0FBQztRQUNsRTtJQUNGO0FBQ0YifQ==
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"migrateFresh.d.ts","sourceRoot":"","sources":["../src/migrateFresh.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAI9C;;GAEG;AACH,wBAAsB,YAAY,CAChC,IAAI,EAAE,eAAe,EACrB,EAAE,kBAA0B,EAAE;;CAAA,GAC7B,OAAO,CAAC,IAAI,CAAC,
|
1
|
+
{"version":3,"file":"migrateFresh.d.ts","sourceRoot":"","sources":["../src/migrateFresh.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAI9C;;GAEG;AACH,wBAAsB,YAAY,CAChC,IAAI,EAAE,eAAe,EACrB,EAAE,kBAA0B,EAAE;;CAAA,GAC7B,OAAO,CAAC,IAAI,CAAC,CAgEf"}
|
package/dist/migrateFresh.js
CHANGED
@@ -40,8 +40,8 @@ async function migrateFresh({ forceAcceptWarning = false }) {
|
|
40
40
|
payload.logger.info({
|
41
41
|
msg: `Dropping database.`
|
42
42
|
});
|
43
|
-
await this.drizzle.execute(
|
44
|
-
create schema public;`);
|
43
|
+
await this.drizzle.execute(_drizzleorm.sql.raw(`drop schema ${this.schemaName || 'public'} cascade;
|
44
|
+
create schema ${this.schemaName || 'public'};`));
|
45
45
|
const migrationFiles = await (0, _database.readMigrationFiles)({
|
46
46
|
payload
|
47
47
|
});
|
@@ -85,4 +85,4 @@ async function migrateFresh({ forceAcceptWarning = false }) {
|
|
85
85
|
}
|
86
86
|
}
|
87
87
|
|
88
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3V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gTableWithColumns } from 'drizzle-orm/pg-core';
|
2
3
|
import type { Field, Where } from 'payload/types';
|
3
4
|
import { asc, desc } from 'drizzle-orm';
|
4
5
|
import type { GenericColumn, GenericTable, PostgresAdapter } from '../types';
|
5
6
|
export type BuildQueryJoins = Record<string, SQL>;
|
6
7
|
export type BuildQueryJoinAliases = {
|
7
8
|
condition: SQL;
|
8
|
-
table: GenericTable
|
9
|
+
table: GenericTable | PgTableWithColumns<any>;
|
9
10
|
}[];
|
10
11
|
type BuildQueryArgs = {
|
11
12
|
adapter: PostgresAdapter;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"buildQuery.d.ts","sourceRoot":"","sources":["../../src/queries/buildQuery.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAEjD,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAEvC,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAK5E,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;AAEjD,MAAM,MAAM,qBAAqB,GAAG;IAClC,SAAS,EAAE,GAAG,CAAA;IACd,KAAK,EAAE,YAAY,CAAA;
|
1
|
+
{"version":3,"file":"buildQuery.d.ts","sourceRoot":"","sources":["../../src/queries/buildQuery.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAC7D,OAAO,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAEjD,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAEvC,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAK5E,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;AAEjD,MAAM,MAAM,qBAAqB,GAAG;IAClC,SAAS,EAAE,GAAG,CAAA;IACd,KAAK,EAAE,YAAY,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAAA;CAC9C,EAAE,CAAA;AAEH,KAAK,cAAc,GAAG;IACpB,OAAO,EAAE,eAAe,CAAA;IACxB,MAAM,EAAE,KAAK,EAAE,CAAA;IACf,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE,KAAK,CAAA;CACb,CAAA;AAED,KAAK,MAAM,GAAG;IACZ,WAAW,EAAE,qBAAqB,CAAA;IAClC,KAAK,EAAE,eAAe,CAAA;IACtB,OAAO,EAAE;QACP,MAAM,EAAE,aAAa,CAAA;QACrB,KAAK,EAAE,OAAO,GAAG,GAAG,OAAO,IAAI,CAAA;KAChC,CAAA;IACD,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAA;IAC3C,KAAK,EAAE,GAAG,CAAA;CACX,CAAA;AACD,QAAA,MAAM,UAAU,wEAOb,cAAc,KAAG,QAAQ,MAAM,CA+EjC,CAAA;AAED,eAAe,UAAU,CAAA"}
|
@@ -40,7 +40,8 @@ const buildQuery = async function buildQuery({ adapter, fields, locale, sort, ta
|
|
40
40
|
locale,
|
41
41
|
pathSegments: sortPath.replace(/__/g, '.').split('.'),
|
42
42
|
selectFields,
|
43
|
-
tableName
|
43
|
+
tableName,
|
44
|
+
value: sortPath
|
44
45
|
});
|
45
46
|
orderBy.column = sortTable?.[sortTableColumnName];
|
46
47
|
} catch (err) {
|
@@ -82,4 +83,4 @@ const buildQuery = async function buildQuery({ adapter, fields, locale, sort, ta
|
|
82
83
|
};
|
83
84
|
const _default = buildQuery;
|
84
85
|
|
85
|
-
//# sourceMappingURL=data:application/json;base64,
|
86
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9xdWVyaWVzL2J1aWxkUXVlcnkudHMiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHR5cGUgeyBTUUwgfSBmcm9tICdkcml6emxlLW9ybSdcbmltcG9ydCB0eXBlIHsgUGdUYWJsZVdpdGhDb2x1bW5zIH0gZnJvbSAnZHJpenpsZS1vcm0vcGctY29yZSdcbmltcG9ydCB0eXBlIHsgRmllbGQsIFdoZXJlIH0gZnJvbSAncGF5bG9hZC90eXBlcydcblxuaW1wb3J0IHsgYXNjLCBkZXNjIH0gZnJvbSAnZHJpenpsZS1vcm0nXG5cbmltcG9ydCB0eXBlIHsgR2VuZXJpY0NvbHVtbiwgR2VuZXJpY1RhYmxlLCBQb3N0Z3Jlc0FkYXB0ZXIgfSBmcm9tICcuLi90eXBlcydcblxuaW1wb3J0IHsgZ2V0VGFibGVDb2x1bW5Gcm9tUGF0aCB9IGZyb20gJy4vZ2V0VGFibGVDb2x1bW5Gcm9tUGF0aCdcbmltcG9ydCB7IHBhcnNlUGFyYW1zIH0gZnJvbSAnLi9wYXJzZVBhcmFtcydcblxuZXhwb3J0IHR5cGUgQnVpbGRRdWVyeUpvaW5zID0gUmVjb3JkPHN0cmluZywgU1FMPlxuXG5leHBvcnQgdHlwZSBCdWlsZFF1ZXJ5Sm9pbkFsaWFzZXMgPSB7XG4gIGNvbmRpdGlvbjogU1FMXG4gIHRhYmxlOiBHZW5lcmljVGFibGUgfCBQZ1RhYmxlV2l0aENvbHVtbnM8YW55PlxufVtdXG5cbnR5cGUgQnVpbGRRdWVyeUFyZ3MgPSB7XG4gIGFkYXB0ZXI6IFBvc3RncmVzQWRhcHRlclxuICBmaWVsZHM6IEZpZWxkW11cbiAgbG9jYWxlPzogc3RyaW5nXG4gI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S0FBS0MsS0FBSyxDQUFDO2dCQUNqRHBCO2dCQUNBSDtnQkFDQXdCLE9BQU9iO1lBQ1Q7WUFDQUgsUUFBUUMsTUFBTSxHQUFHUyxXQUFXLENBQUNGLG9CQUFvQjtRQUNuRCxFQUFFLE9BQU9TLEtBQUs7UUFDWixXQUFXO1FBQ2I7SUFDRjtJQUVBLElBQUksQ0FBQ2pCLFNBQVNDLFFBQVE7UUFDcEJELFFBQVFFLEtBQUssR0FBR0csZ0JBQUk7UUFDcEIsTUFBTWEsWUFBWTlCLFFBQVFTLE1BQU0sQ0FBQ0wsVUFBVSxFQUFFMEI7UUFFN0MsSUFBSUEsV0FBVztZQUNibEIsUUFBUUMsTUFBTSxHQUFHaUI7UUFDbkIsT0FBTztZQUNMbEIsUUFBUUMsTUFBTSxHQUFHYixRQUFRUyxNQUFNLENBQUNMLFVBQVUsQ0FBQ0ksRUFBRTtRQUMvQztJQUNGO0lBRUEsSUFBSUksUUFBUUMsTUFBTSxFQUFFO1FBQ2xCTixhQUFhSixJQUFJLEdBQUdTLFFBQVFDLE1BQU07SUFDcEM7SUFFQSxJQUFJUjtJQUVKLElBQUlDLGlCQUFpQnlCLE9BQU9DLElBQUksQ0FBQzFCLGVBQWUyQixNQUFNLEdBQUcsR0FBRztRQUMxRDVCLFFBQVEsTUFBTTZCLElBQUFBLHdCQUFXLEVBQUM7WUFDeEJsQztZQUNBQztZQUNBVTtZQUNBRDtZQUNBUjtZQUNBSztZQUNBSDtZQUNBQyxPQUFPQztRQUNUO0lBQ0Y7SUFFQSxPQUFPO1FBQ0xLO1FBQ0FEO1FBQ0FFO1FBQ0FMO1FBQ0FGO0lBQ0Y7QUFDRjtNQUVBLFdBQWVOIn0=
|
@@ -1,10 +1,11 @@
|
|
1
1
|
import type { SQL } from 'drizzle-orm';
|
2
|
+
import type { PgTableWithColumns } from 'drizzle-orm/pg-core';
|
2
3
|
import type { Field, FieldAffectingData, TabAsField } from 'payload/types';
|
3
4
|
import type { GenericColumn, GenericTable, PostgresAdapter } from '../types';
|
4
5
|
import type { BuildQueryJoinAliases, BuildQueryJoins } from './buildQuery';
|
5
6
|
type Constraint = {
|
6
7
|
columnName: string;
|
7
|
-
table: GenericTable
|
8
|
+
table: GenericTable | PgTableWithColumns<any>;
|
8
9
|
value: unknown;
|
9
10
|
};
|
10
11
|
type TableColumn = {
|
@@ -14,11 +15,11 @@ type TableColumn = {
|
|
14
15
|
getNotNullColumnByValue?: (val: unknown) => string;
|
15
16
|
pathSegments?: string[];
|
16
17
|
rawColumn?: SQL;
|
17
|
-
table: GenericTable
|
18
|
+
table: GenericTable | PgTableWithColumns<any>;
|
18
19
|
};
|
19
20
|
type Args = {
|
20
21
|
adapter: PostgresAdapter;
|
21
|
-
aliasTable?: GenericTable
|
22
|
+
aliasTable?: GenericTable | PgTableWithColumns<any>;
|
22
23
|
collectionPath: string;
|
23
24
|
columnPrefix?: string;
|
24
25
|
constraintPath?: string;
|
@@ -35,12 +36,16 @@ type Args = {
|
|
35
36
|
* If creating a new table name for arrays and blocks, this suffix should be appended to the table name
|
36
37
|
*/
|
37
38
|
tableNameSuffix?: string;
|
39
|
+
/**
|
40
|
+
* The raw value of the query before sanitization
|
41
|
+
*/
|
42
|
+
value: unknown;
|
38
43
|
};
|
39
44
|
/**
|
40
45
|
* Transforms path to table and column name
|
41
46
|
* Adds tables to `join`
|
42
47
|
* @returns TableColumn
|
43
48
|
*/
|
44
|
-
export declare const getTableColumnFromPath: ({ adapter, aliasTable, collectionPath, columnPrefix, constraintPath: incomingConstraintPath, constraints, fields, joinAliases, joins, locale: incomingLocale, pathSegments: incomingSegments, rootTableName: incomingRootTableName, selectFields, tableName, tableNameSuffix, }: Args) => TableColumn;
|
49
|
+
export declare const getTableColumnFromPath: ({ adapter, aliasTable, collectionPath, columnPrefix, constraintPath: incomingConstraintPath, constraints, fields, joinAliases, joins, locale: incomingLocale, pathSegments: incomingSegments, rootTableName: incomingRootTableName, selectFields, tableName, tableNameSuffix, value, }: Args) => TableColumn;
|
45
50
|
export {};
|
46
51
|
//# sourceMappingURL=getTableColumnFromPath.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"getTableColumnFromPath.d.ts","sourceRoot":"","sources":["../../src/queries/getTableColumnFromPath.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,KAAK,EAAE,KAAK,EAAE,
|
1
|
+
{"version":3,"file":"getTableColumnFromPath.d.ts","sourceRoot":"","sources":["../../src/queries/getTableColumnFromPath.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAC7D,OAAO,KAAK,EAAE,KAAK,EAAE,kBAAkB,EAAe,UAAU,EAAa,MAAM,eAAe,CAAA;AAUlG,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAC5E,OAAO,KAAK,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAE1E,KAAK,UAAU,GAAG;IAChB,UAAU,EAAE,MAAM,CAAA;IAClB,KAAK,EAAE,YAAY,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAAA;IAC7C,KAAK,EAAE,OAAO,CAAA;CACf,CAAA;AAED,KAAK,WAAW,GAAG;IACjB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,WAAW,EAAE,UAAU,EAAE,CAAA;IACzB,KAAK,EAAE,kBAAkB,CAAA;IACzB,uBAAuB,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,MAAM,CAAA;IAClD,YAAY,CAAC,EAAE,MAAM,EAAE,CAAA;IACvB,SAAS,CAAC,EAAE,GAAG,CAAA;IACf,KAAK,EAAE,YAAY,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAAA;CAC9C,CAAA;AAED,KAAK,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