@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
@@ -1,21 +1,11 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
value: true
|
4
|
-
});
|
5
|
-
Object.defineProperty(exports, "hasLocalesTable", {
|
6
|
-
enumerable: true,
|
7
|
-
get: function() {
|
8
|
-
return hasLocalesTable;
|
9
|
-
}
|
10
|
-
});
|
11
|
-
const _types = require("payload/types");
|
12
|
-
const hasLocalesTable = (fields)=>{
|
1
|
+
import { fieldAffectsData, fieldHasSubFields } from 'payload/types';
|
2
|
+
export const hasLocalesTable = (fields)=>{
|
13
3
|
return fields.some((field)=>{
|
14
|
-
if (
|
15
|
-
if (
|
4
|
+
if (fieldAffectsData(field) && field.localized) return true;
|
5
|
+
if (fieldHasSubFields(field) && field.type !== 'array') return hasLocalesTable(field.fields);
|
16
6
|
if (field.type === 'tabs') return field.tabs.some((tab)=>hasLocalesTable(tab.fields));
|
17
7
|
return false;
|
18
8
|
});
|
19
9
|
};
|
20
10
|
|
21
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlsaXRpZXMvaGFzTG9jYWxlc1RhYmxlLnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB0eXBlIHsgRmllbGQgfSBmcm9tICdwYXlsb2FkL3R5cGVzJ1xuXG5pbXBvcnQgeyBmaWVsZEFmZmVjdHNEYXRhLCBmaWVsZEhhc1N1YkZpZWxkcyB9IGZyb20gJ3BheWxvYWQvdHlwZXMnXG5cbmV4cG9ydCBjb25zdCBoYXNMb2NhbGVzVGFibGUgPSAoZmllbGRzOiBGaWVsZFtdKTogYm9vbGVhbiA9PiB7XG4gIHJldHVybiBmaWVsZHMuc29tZSgoZmllbGQpID0+
|
11
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlsaXRpZXMvaGFzTG9jYWxlc1RhYmxlLnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB0eXBlIHsgRmllbGQgfSBmcm9tICdwYXlsb2FkL3R5cGVzJ1xuXG5pbXBvcnQgeyBmaWVsZEFmZmVjdHNEYXRhLCBmaWVsZEhhc1N1YkZpZWxkcyB9IGZyb20gJ3BheWxvYWQvdHlwZXMnXG5cbmV4cG9ydCBjb25zdCBoYXNMb2NhbGVzVGFibGUgPSAoZmllbGRzOiBGaWVsZFtdKTogYm9vbGVhbiA9PiB7XG4g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@@ -1,15 +1,5 @@
|
|
1
|
-
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
3
|
-
value: true
|
4
|
-
});
|
5
|
-
Object.defineProperty(exports, "isArrayOfRows", {
|
6
|
-
enumerable: true,
|
7
|
-
get: function() {
|
8
|
-
return isArrayOfRows;
|
9
|
-
}
|
10
|
-
});
|
11
|
-
function isArrayOfRows(data) {
|
1
|
+
export function isArrayOfRows(data) {
|
12
2
|
return Array.isArray(data);
|
13
3
|
}
|
14
4
|
|
15
|
-
//# sourceMappingURL=data:application/json;base64,
|
5
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlsaXRpZXMvaXNBcnJheU9mUm93cy50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgZnVuY3Rpb24gaXNBcnJheU9mUm93cyhkYXRhOiB1bmtub3duKTogZGF0YSBpcyBSZWNvcmQ8c3RyaW5nLCB1bmtub3duPltdIHtcbiAgcmV0dXJuIEFycmF5LmlzQXJyYXkoZGF0YSlcbn1cbiJdLCJuYW1lcyI6WyJpc0FycmF5T2ZSb3dzIiwiZGF0YSIsIkFycmF5IiwiaXNBcnJheSJdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxTQUFTQSxjQUFjQyxJQUFhO0lBQ3pDLE9BQU9DLE1BQU1DLE9BQU8sQ0FBQ0Y7QUFDdkIifQ==
|
@@ -1,19 +1,9 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
});
|
5
|
-
Object.defineProperty(exports, "migrationTableExists", {
|
6
|
-
enumerable: true,
|
7
|
-
get: function() {
|
8
|
-
return migrationTableExists;
|
9
|
-
}
|
10
|
-
});
|
11
|
-
const _drizzleorm = require("drizzle-orm");
|
12
|
-
const migrationTableExists = async (db)=>{
|
13
|
-
const queryRes = await db.execute((0, _drizzleorm.sql)`SELECT to_regclass('public.payload_migrations');`);
|
1
|
+
import { sql } from 'drizzle-orm';
|
2
|
+
export const migrationTableExists = async (db)=>{
|
3
|
+
const queryRes = await db.execute(sql`SELECT to_regclass('public.payload_migrations');`);
|
14
4
|
// Returns table name 'payload_migrations' or null
|
15
5
|
const exists = queryRes.rows?.[0]?.to_regclass === 'payload_migrations';
|
16
6
|
return exists;
|
17
7
|
};
|
18
8
|
|
19
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlsaXRpZXMvbWlncmF0aW9uVGFibGVFeGlzdHMudHMiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgc3FsIH0gZnJvbSAnZHJpenpsZS1vcm0nXG5cbmltcG9ydCB0eXBlIHsgRHJpenpsZURCIH0gZnJvbSAnLi4vdHlwZXMnXG5cbmV4cG9ydCBjb25zdCBtaWdyYXRpb25UYWJsZUV4aXN0cyA9IGFzeW5jIChkYjogRHJpenpsZURCKTogUHJvbWlzZTxib29sZWFuPiA9PiB7XG4gIGNvbnN0IHF1ZXJ5UmVzID0gYXdhaXQgZGIuZXhlY3V0ZShzcWxgU0VMRUNUIHRvX3JlZ2NsYXNzKCdwdWJsaWMucGF5bG9hZF9taWdyYXRpb25zJyk7YClcblxuICAvLyBSZXR1cm5zIHRhYmxlIG5hbWUgJ3BheWxvYWRfbWlncmF0aW9ucycgb3IgbnVsbFxuICBjb25zdCBleGlzdHMgPSBxdWVyeVJlcy5yb3dzPy5bMF0/
|
9
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlsaXRpZXMvbWlncmF0aW9uVGFibGVFeGlzdHMudHMiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgc3FsIH0gZnJvbSAnZHJpenpsZS1vcm0nXG5cbmltcG9ydCB0eXBlIHsgRHJpenpsZURCIH0gZnJvbSAnLi4vdHlwZXMnXG5cbmV4cG9ydCBjb25zdCBtaWdyYXRpb25UYWJsZUV4aXN0cyA9IGFzeW5jIChkYjogRHJpenpsZURCKTogUHJvbWlzZTxib29sZWFuPiA9PiB7XG4gIGNvbnN0IHF1ZXJ5UmVzID0gYXdhaXQgZGIuZXhlY3V0ZShzcWxgU0VMRUNUIHRvX3JlZ2NsYXNzKCdwdWJsaWMucGF5bG9hZF9taWdyYXRpb25zJyk7YClcblxuICAvLyBSZXR1cm5zIHRhYmxlIG5hbWUgJ3BheWxvYWRfbWlncmF0aW9ucycgb3IgbnVsbFxuICBjb25zdCBleGlzdHMgPSBxdWVyeVJlcy5yb3dzPy5bMF0/LnRvX3JlZ2NsYXNzID09PSAncGF5bG9hZF9taWdyYXRpb25zJ1xuICByZXR1cm4gZXhpc3RzXG59XG4iXSwibmFtZXMiOlsic3FsIiwibWlncmF0aW9uVGFibGVFeGlzdHMiLCJkYiIsInF1ZXJ5UmVzIiwiZXhlY3V0ZSIsImV4aXN0cyIsInJvd3MiLCJ0b19yZWdjbGFzcyJdLCJtYXBwaW5ncyI6IkFBQUEsU0FBU0EsR0FBRyxRQUFRLGNBQWE7QUFJakMsT0FBTyxNQUFNQyx1QkFBdUIsT0FBT0M7SUFDekMsTUFBTUMsV0FBVyxNQUFNRCxHQUFHRSxPQUFPLENBQUNKLEdBQUcsQ0FBQyxnREFBZ0QsQ0FBQztJQUV2RixrREFBa0Q7SUFDbEQsTUFBTUssU0FBU0YsU0FBU0csSUFBSSxFQUFFLENBQUMsRUFBRSxFQUFFQyxnQkFBZ0I7SUFDbkQsT0FBT0Y7QUFDVCxFQUFDIn0=
|
@@ -1,19 +1,11 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
Object.defineProperty(exports, "parseError", {
|
6
|
-
enumerable: true,
|
7
|
-
get: function() {
|
8
|
-
return parseError;
|
9
|
-
}
|
10
|
-
});
|
11
|
-
const _pg = require("pg");
|
12
|
-
const parseError = (err, msg)=>{
|
1
|
+
import { DatabaseError } from 'pg';
|
2
|
+
/**
|
3
|
+
* Format error message with hint if available
|
4
|
+
*/ export const parseError = (err, msg)=>{
|
13
5
|
let formattedMsg = `${msg}`;
|
14
6
|
if (err instanceof Error) {
|
15
7
|
formattedMsg += ` ${err.message}.`;
|
16
|
-
if (err instanceof
|
8
|
+
if (err instanceof DatabaseError) {
|
17
9
|
msg += `: ${err.message}`;
|
18
10
|
if (err.hint) msg += ` ${err.hint}.`;
|
19
11
|
}
|
@@ -21,4 +13,4 @@ const parseError = (err, msg)=>{
|
|
21
13
|
return formattedMsg;
|
22
14
|
};
|
23
15
|
|
24
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlsaXRpZXMvcGFyc2VFcnJvci50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBEYXRhYmFzZUVycm9yIH0gZnJvbSAncGcnXG5cbi8qKlxuICogRm9ybWF0IGVycm9yIG1lc3NhZ2Ugd2l0aCBoaW50IGlmIGF2YWlsYWJsZVxuICovXG5leHBvcnQgY29uc3QgcGFyc2VFcnJvciA9IChlcnI6IHVua25vd24sIG1zZzogc3RyaW5nKTogc3RyaW5nID0+
|
16
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlsaXRpZXMvcGFyc2VFcnJvci50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBEYXRhYmFzZUVycm9yIH0gZnJvbSAncGcnXG5cbi8qKlxuICogRm9ybWF0IGVycm9yIG1lc3NhZ2Ugd2l0aCBoaW50IGlmIGF2YWlsYWJsZVxuICovXG5leHBvcnQgY29uc3QgcGFyc2VFcnJvciA9IChlcnI6IHVua25vd24sIG1zZzogc3RyaW5nKTogc3RyaW5nID0+IHtcbiAgbGV0IGZvcm1hdHRlZE1zZyA9IGAke21zZ31gXG4gIGlmIChlcnIgaW5zdGFuY2VvZiBFcnJvcikge1xuICAgIGZvcm1hdHRlZE1zZyArPSBgICR7ZXJyLm1lc3NhZ2V9LmBcbiAgICBpZiAoZXJyIGluc3RhbmNlb2YgRGF0YWJhc2VFcnJvcikge1xuICAgICAgbXNnICs9IGA6ICR7ZXJyLm1lc3NhZ2V9YFxuICAgICAgaWYgKGVyci5oaW50KSBtc2cgKz0gYCAke2Vyci5oaW50fS5gXG4gICAgfVxuICB9XG4gIHJldHVybiBmb3JtYXR0ZWRNc2dcbn1cbiJdLCJuYW1lcyI6WyJEYXRhYmFzZUVycm9yIiwicGFyc2VFcnJvciIsImVyciIsIm1zZyIsImZvcm1hdHRlZE1zZyIsIkVycm9yIiwibWVzc2FnZSIsImhpbnQiXSwibWFwcGluZ3MiOiJBQUFBLFNBQVNBLGFBQWEsUUFBUSxLQUFJO0FBRWxDOztDQUVDLEdBQ0QsT0FBTyxNQUFNQyxhQUFhLENBQUNDLEtBQWNDO0lBQ3ZDLElBQUlDLGVBQWUsQ0FBQyxFQUFFRCxJQUFJLENBQUM7SUFDM0IsSUFBSUQsZUFBZUcsT0FBTztRQUN4QkQsZ0JBQWdCLENBQUMsQ0FBQyxFQUFFRixJQUFJSSxPQUFPLENBQUMsQ0FBQyxDQUFDO1FBQ2xDLElBQUlKLGVBQWVGLGVBQWU7WUFDaENHLE9BQU8sQ0FBQyxFQUFFLEVBQUVELElBQUlJLE9BQU8sQ0FBQyxDQUFDO1lBQ3pCLElBQUlKLElBQUlLLElBQUksRUFBRUosT0FBTyxDQUFDLENBQUMsRUFBRUQsSUFBSUssSUFBSSxDQUFDLENBQUMsQ0FBQztRQUN0QztJQUNGO0lBQ0EsT0FBT0g7QUFDVCxFQUFDIn0=
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@payloadcms/db-postgres",
|
3
|
-
"version": "3.0.0-alpha.
|
3
|
+
"version": "3.0.0-alpha.19",
|
4
4
|
"description": "The officially supported Postgres database adapter for Payload",
|
5
5
|
"repository": "https://github.com/payloadcms/payload",
|
6
6
|
"license": "MIT",
|
@@ -25,11 +25,11 @@
|
|
25
25
|
"devDependencies": {
|
26
26
|
"@types/pg": "8.10.2",
|
27
27
|
"@types/to-snake-case": "1.0.0",
|
28
|
-
"
|
29
|
-
"
|
28
|
+
"@payloadcms/eslint-config": "1.1.1",
|
29
|
+
"payload": "3.0.0-alpha.19"
|
30
30
|
},
|
31
31
|
"peerDependencies": {
|
32
|
-
"payload": "3.0.0-alpha.
|
32
|
+
"payload": "3.0.0-alpha.19"
|
33
33
|
},
|
34
34
|
"publishConfig": {
|
35
35
|
"registry": "https://registry.npmjs.org/"
|