@payloadcms/db-postgres 0.1.0-beta.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/connect.js +82 -0
- package/dist/create.js +32 -0
- package/dist/createGlobal.js +32 -0
- package/dist/createGlobalVersion.js +48 -0
- package/dist/createMigration.js +85 -0
- package/dist/createVersion.js +54 -0
- package/dist/deleteMany.js +44 -0
- package/dist/deleteOne.js +47 -0
- package/dist/deleteVersions.js +46 -0
- package/dist/destroy.js +16 -0
- package/dist/find/buildFindManyArgs.js +61 -0
- package/dist/find/chainMethods.js +21 -0
- package/dist/find/findMany.js +197 -0
- package/dist/find/traverseFields.js +118 -0
- package/dist/find.js +35 -0
- package/dist/findGlobal.js +38 -0
- package/dist/findGlobalVersions.js +39 -0
- package/dist/findOne.js +49 -0
- package/dist/findVersions.js +39 -0
- package/dist/index.js +95 -0
- package/dist/init.js +74 -0
- package/dist/migrate.js +81 -0
- package/dist/migrateStatus.js +54 -0
- package/dist/mock.js +13 -0
- package/dist/queries/buildAndOrConditions.js +39 -0
- package/dist/queries/buildQuery.js +80 -0
- package/dist/queries/createJSONQuery/convertPathToJSONTraversal.js +24 -0
- package/dist/queries/createJSONQuery/formatJSONPathSegment.js +15 -0
- package/dist/queries/createJSONQuery/index.js +64 -0
- package/dist/queries/getTableColumnFromPath.js +333 -0
- package/dist/queries/operatorMap.js +34 -0
- package/dist/queries/parseParams.js +146 -0
- package/dist/queries/sanitizeQueryValue.js +79 -0
- package/dist/queryDrafts.js +56 -0
- package/dist/reference.js +76 -0
- package/dist/schema/build.js +245 -0
- package/dist/schema/createIndex.js +19 -0
- package/dist/schema/parentIDColumnMap.js +18 -0
- package/dist/schema/traverseFields.js +430 -0
- package/dist/schema/validateExistingBlockIsIdentical.js +34 -0
- package/dist/transactions/beginTransaction.js +51 -0
- package/dist/transactions/commitTransaction.js +24 -0
- package/dist/transactions/rollbackTransaction.js +20 -0
- package/dist/transform/read/hasManyNumber.js +20 -0
- package/dist/transform/read/index.js +42 -0
- package/dist/transform/read/relationship.js +74 -0
- package/dist/transform/read/traverseFields.js +325 -0
- package/dist/transform/write/array.js +55 -0
- package/dist/transform/write/blocks.js +56 -0
- package/dist/transform/write/index.js +46 -0
- package/dist/transform/write/numbers.js +21 -0
- package/dist/transform/write/relationships.js +33 -0
- package/dist/transform/write/selects.js +29 -0
- package/dist/transform/write/traverseFields.js +379 -0
- package/dist/transform/write/types.js +6 -0
- package/dist/types.js +6 -0
- package/dist/update.js +48 -0
- package/dist/updateGlobal.js +39 -0
- package/dist/updateGlobalVersion.js +50 -0
- package/dist/updateVersion.js +50 -0
- package/dist/upsertRow/deleteExistingArrayRows.js +20 -0
- package/dist/upsertRow/deleteExistingRowsByPath.js +43 -0
- package/dist/upsertRow/index.js +243 -0
- package/dist/upsertRow/insertArrays.js +64 -0
- package/dist/upsertRow/types.js +6 -0
- package/dist/utilities/appendPrefixToKeys.js +16 -0
- package/dist/utilities/createBlocksMap.js +39 -0
- package/dist/utilities/createMigrationTable.js +23 -0
- package/dist/utilities/createRelationshipMap.js +29 -0
- package/dist/utilities/hasLocalesTable.js +21 -0
- package/dist/utilities/isArrayOfRows.js +15 -0
- package/dist/utilities/migrationTableExists.js +19 -0
- package/dist/webpack.js +30 -0
- package/package.json +47 -0
@@ -0,0 +1,16 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
Object.defineProperty(exports, "appendPrefixToObjectKeys", {
|
6
|
+
enumerable: true,
|
7
|
+
get: function() {
|
8
|
+
return appendPrefixToObjectKeys;
|
9
|
+
}
|
10
|
+
});
|
11
|
+
const appendPrefixToObjectKeys = (obj, prefix)=>Object.entries(obj).reduce((res, [key, val])=>{
|
12
|
+
res[`${prefix}_${key}`] = val;
|
13
|
+
return res;
|
14
|
+
}, {});
|
15
|
+
|
16
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlsaXRpZXMvYXBwZW5kUHJlZml4VG9LZXlzLnRzIl0sInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBjb25zdCBhcHBlbmRQcmVmaXhUb09iamVjdEtleXMgPSA8VD4ob2JqOiBSZWNvcmQ8c3RyaW5nLCB1bmtub3duPiwgcHJlZml4OiBzdHJpbmcpOiBUID0+XG4gIE9iamVjdC5lbnRyaWVzKG9iaikucmVkdWNlKChyZXMsIFtrZXksIHZhbF0pID0+IHtcbiAgICByZXNbYCR7cHJlZml4fV8ke2tleX1gXSA9IHZhbFxuICAgIHJldHVybiByZXNcbiAgfSwge30gYXMgVClcbiJdLCJuYW1lcyI6WyJhcHBlbmRQcmVmaXhUb09iamVjdEtleXMiLCJvYmoiLCJwcmVmaXgiLCJPYmplY3QiLCJlbnRyaWVzIiwicmVkdWNlIiwicmVzIiwia2V5IiwidmFsIl0sIm1hcHBpbmdzIjoiOzs7OytCQUFhQTs7O2VBQUFBOzs7QUFBTixNQUFNQSwyQkFBMkIsQ0FBSUMsS0FBOEJDLFNBQ3hFQyxPQUFPQyxPQUFPLENBQUNILEtBQUtJLE1BQU0sQ0FBQyxDQUFDQyxLQUFLLENBQUNDLEtBQUtDLElBQUk7UUFDekNGLEdBQUcsQ0FBQyxDQUFDLEVBQUVKLE9BQU8sQ0FBQyxFQUFFSyxJQUFJLENBQUMsQ0FBQyxHQUFHQztRQUMxQixPQUFPRjtJQUNULEdBQUcsQ0FBQyJ9
|
@@ -0,0 +1,39 @@
|
|
1
|
+
/* eslint-disable no-param-reassign */ "use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
Object.defineProperty(exports, "createBlocksMap", {
|
6
|
+
enumerable: true,
|
7
|
+
get: function() {
|
8
|
+
return createBlocksMap;
|
9
|
+
}
|
10
|
+
});
|
11
|
+
const createBlocksMap = (data)=>{
|
12
|
+
const blocksMap = {};
|
13
|
+
Object.entries(data).forEach(([key, rows])=>{
|
14
|
+
if (key.startsWith('_blocks_') && Array.isArray(rows)) {
|
15
|
+
const blockType = key.replace('_blocks_', '');
|
16
|
+
rows.forEach((row)=>{
|
17
|
+
if ('_path' in row) {
|
18
|
+
if (!(row._path in blocksMap)) blocksMap[row._path] = [];
|
19
|
+
row.blockType = blockType;
|
20
|
+
blocksMap[row._path].push(row);
|
21
|
+
delete row._path;
|
22
|
+
}
|
23
|
+
});
|
24
|
+
delete data[key];
|
25
|
+
}
|
26
|
+
});
|
27
|
+
Object.entries(blocksMap).reduce((sortedBlocksMap, [path, blocks])=>{
|
28
|
+
sortedBlocksMap[path] = blocks.sort((a, b)=>{
|
29
|
+
if (typeof a._order === 'number' && typeof b._order === 'number') {
|
30
|
+
return a._order - b._order;
|
31
|
+
}
|
32
|
+
return 0;
|
33
|
+
});
|
34
|
+
return sortedBlocksMap;
|
35
|
+
}, {});
|
36
|
+
return blocksMap;
|
37
|
+
};
|
38
|
+
|
39
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlsaXRpZXMvY3JlYXRlQmxvY2tzTWFwLnRzIl0sInNvdXJjZXNDb250ZW50IjpbIi8qIGVzbGludC1kaXNhYmxlIG5vLXBhcmFtLXJlYXNzaWduICovXG5leHBvcnQgdHlwZSBCbG9ja3NNYXAgPSB7XG4gIFtwYXRoOiBzdHJpbmddOiBSZWNvcmQ8c3RyaW5nLCB1bmtub3duPltdXG59XG5cbmV4cG9ydCBjb25zdCBjcmVhdGVCbG9ja3NNYXAgPSAoZGF0YTogUmVjb3JkPHN0cmluZywgdW5rbm93bj4pOiBCbG9ja3NNYXAgPT4ge1xuICBjb25zdCBibG9ja3NNYXA6IEJsb2Nrc01hcCA9IHt9XG5cbiAgT2JqZWN0LmVudHJpZXMoZGF0YSkuZm9yRWFjaCgoW2tleSwgcm93c10pID0+IHtcbiAgICBpZiAoa2V5LnN0YXJ0c1dpdGgoJ19ibG9ja3NfJykgJi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BQUMsQ0FBQ0MsR0FBR0M7WUFDdEMsSUFBSSxPQUFPRCxFQUFFRSxNQUFNLEtBQUssWUFBWSxPQUFPRCxFQUFFQyxNQUFNLEtBQUssVUFBVTtnQkFDaEUsT0FBT0YsRUFBRUUsTUFBTSxHQUFHRCxFQUFFQyxNQUFNO1lBQzVCO1lBRUEsT0FBTztRQUNUO1FBRUEsT0FBT047SUFDVCxHQUFHLENBQUM7SUFFSixPQUFPZjtBQUNUIn0=
|
@@ -0,0 +1,23 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
Object.defineProperty(exports, "createMigrationTable", {
|
6
|
+
enumerable: true,
|
7
|
+
get: function() {
|
8
|
+
return createMigrationTable;
|
9
|
+
}
|
10
|
+
});
|
11
|
+
const _drizzleorm = require("drizzle-orm");
|
12
|
+
const createMigrationTable = async (db)=>{
|
13
|
+
await db.execute((0, _drizzleorm.sql)`CREATE TABLE IF NOT EXISTS "payload_migrations" (
|
14
|
+
"id" serial PRIMARY KEY NOT NULL,
|
15
|
+
"name" varchar,
|
16
|
+
"batch" numeric,
|
17
|
+
"schema" jsonb,
|
18
|
+
"updated_at" timestamp(3) with time zone DEFAULT now() NOT NULL,
|
19
|
+
"created_at" timestamp(3) with time zone DEFAULT now() NOT NULL
|
20
|
+
);`);
|
21
|
+
};
|
22
|
+
|
23
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlsaXRpZXMvY3JlYXRlTWlncmF0aW9uVGFibGUudHMiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgc3FsIH0gZnJvbSAnZHJpenpsZS1vcm0nXG5cbmltcG9ydCB0eXBlIHsgRHJpenpsZURCIH0gZnJvbSAnLi4vdHlwZXMnXG5cbmV4cG9ydCBjb25zdCBjcmVhdGVNaWdyYXRpb25UYWJsZSA9IGFzeW5jIChkYjogRHJpenpsZURCKTogUHJvbWlzZTx2b2lkPiA9PiB7XG4gIGF3YWl0IGRiLmV4ZWN1dGUoc3FsYENSRUFURSBUQUJMRSBJRiBOT1QgRVhJU1RTIFwicGF5bG9hZF9taWdyYXRpb25zXCIgKFxuICBcImlkXCIgc2VyaWFsIFBSSU1BUlkgS0VZIE5PVCBOVUxMLFxuICBcIm5hbWVcIiB2YXJjaGFyLFxuICBcImJhdGNoXCIgbnVtZXJpYyxcbiAgXCJzY2hlbWFcIiBqc29uYixcbiAgXCJ1cGRhdGVkX2F0XCIgdGltZXN0YW1wKDMpIHdpdGggdGltZSB6b25lIERFRkFVTFQgbm93KCkgTk9UIE5VTEwsXG4gIFwiY3JlYXRlZF9hdFwiIHRpbWVzdGFtcCgzKSB3aXRoIHRpbWUgem9uZSBERUZBVUxUIG5vdygpIE5PVCBOVUxMXG4pO2ApXG59XG4iXSwibmFtZXMiOlsiY3JlYXRlTWlncmF0aW9uVGFibGUiLCJkYiIsImV4ZWN1dGUiLCJzcWwiXSwibWFwcGluZ3MiOiI7Ozs7K0JBSWFBOzs7ZUFBQUE7Ozs0QkFKTztBQUliLE1BQU1BLHVCQUF1QixPQUFPQztJQUN6QyxNQUFNQSxHQUFHQyxPQUFPLENBQUNDLElBQUFBLGVBQUcsQ0FBQSxDQUFDOzs7Ozs7O0VBT3JCLENBQUM7QUFDSCJ9
|
@@ -0,0 +1,29 @@
|
|
1
|
+
// Flatten rows to object with path keys
|
2
|
+
// for easier retrieval
|
3
|
+
"use strict";
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
5
|
+
value: true
|
6
|
+
});
|
7
|
+
Object.defineProperty(exports, "createPathMap", {
|
8
|
+
enumerable: true,
|
9
|
+
get: function() {
|
10
|
+
return createPathMap;
|
11
|
+
}
|
12
|
+
});
|
13
|
+
const createPathMap = (rows)=>{
|
14
|
+
let rowsByPath = {};
|
15
|
+
if (Array.isArray(rows)) {
|
16
|
+
rowsByPath = rows.reduce((res, row)=>{
|
17
|
+
const formattedRow = {
|
18
|
+
...row
|
19
|
+
};
|
20
|
+
delete formattedRow.path;
|
21
|
+
if (!res[row.path]) res[row.path] = [];
|
22
|
+
res[row.path].push(row);
|
23
|
+
return res;
|
24
|
+
}, {});
|
25
|
+
}
|
26
|
+
return rowsByPath;
|
27
|
+
};
|
28
|
+
|
29
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlsaXRpZXMvY3JlYXRlUmVsYXRpb25zaGlwTWFwLnRzIl0sInNvdXJjZXNDb250ZW50IjpbIi8vIEZsYXR0ZW4gcm93cyB0byBvYmplY3Qgd2l0aCBwYXRoIGtleXNcbi8vIGZvciBlYXNpZXIgcmV0cmlldmFsXG5leHBvcnQgY29uc3QgY3JlYXRlUGF0aE1hcCA9IChyb3dzOiB1bmtub3duKTogUmVjb3JkPHN0cmluZywgUmVjb3JkPHN0cmluZywgdW5rbm93bj5bXT4gPT4ge1xuICBsZXQgcm93c0J5UGF0aCA9IHt9XG5cbiAgaWYgKEFycmF5LmlzQXJyYXkocm93cykpIHtcbiAgICByb3dzQnlQYXRoID0gcm93cy5yZWR1Y2UoKHJlcywgcm93KSA9PiB7XG4gICAgICBjb25zdCBmb3JtYXR0ZWRSb3cgPSB7XG4gICAgICAgIC4uLnJvdyxcbiAgICAgIH1cblxuICAgICAgZGVsZXRlIGZvcm1hdHRlZFJvdy5wYXRoXG5cbiAgICAgIGlmICghcmVzW3Jvdy5wYXRoXSkgcmVzW3Jvdy5wYXRoXSA9IFtdXG4gICAgICByZXNbcm93LnBhdGhdLnB1c2gocm93KVxuXG4gICAgICByZXR1cm4gcmVzXG4gICAgfSwge30pXG4gIH1cblxuICByZXR1cm4gcm93c0J5UGF0aFxufVxuIl0sIm5hbWVzIjpbImNyZWF0ZVBhdGhNYXAiLCJyb3dzIiwicm93c0J5UGF0aCIsIkFycmF5IiwiaXNBcnJheSIsInJlZHVjZSIsInJlcyIsInJvdyIsImZvcm1hdHRlZFJvdyIsInBhdGgiLCJwdXNoIl0sIm1hcHBpbmdzIjoiQUFBQSx3Q0FBd0M7QUFDeEMsdUJBQXVCOzs7OzsrQkFDVkE7OztlQUFBQTs7O0FBQU4sTUFBTUEsZ0JBQWdCLENBQUNDO0lBQzVCLElBQUlDLGFBQWEsQ0FBQztJQUVsQixJQUFJQyxNQUFNQyxPQUFPLENBQUNILE9BQU87UUFDdkJDLGFBQWFELEtBQUtJLE1BQU0sQ0FBQyxDQUFDQyxLQUFLQztZQUM3QixNQUFNQyxlQUFlO2dCQUNuQixHQUFHRCxHQUFHO1lBQ1I7WUFFQSxPQUFPQyxhQUFhQyxJQUFJO1lBRXhCLElBQUksQ0FBQ0gsR0FBRyxDQUFDQyxJQUFJRSxJQUFJLENBQUMsRUFBRUgsR0FBRyxDQUFDQyxJQUFJRSxJQUFJLENBQUMsR0FBRyxFQUFFO1lBQ3RDSCxHQUFHLENBQUNDLElBQUlFLElBQUksQ0FBQyxDQUFDQyxJQUFJLENBQUNIO1lBRW5CLE9BQU9EO1FBQ1QsR0FBRyxDQUFDO0lBQ047SUFFQSxPQUFPSjtBQUNUIn0=
|
@@ -0,0 +1,21 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
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)=>{
|
13
|
+
return fields.some((field)=>{
|
14
|
+
if ((0, _types.fieldAffectsData)(field) && field.localized) return true;
|
15
|
+
if ((0, _types.fieldHasSubFields)(field) && field.type !== 'array') return hasLocalesTable(field.fields);
|
16
|
+
if (field.type === 'tabs') return field.tabs.some((tab)=>hasLocalesTable(tab.fields));
|
17
|
+
return false;
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sa0JBQWtCLENBQUNDO0lBQzlCLE9BQU9BLE9BQU9DLElBQUksQ0FBQyxDQUFDQztRQUNsQixJQUFJQyxJQUFBQSx1QkFBZ0IsRUFBQ0QsVUFBVUEsTUFBTUUsU0FBUyxFQUFFLE9BQU87UUFDdkQsSUFBSUMsSUFBQUEsd0JBQWlCLEVBQUNILFVBQVVBLE1BQU1JLElBQUksS0FBSyxTQUFTLE9BQU9QLGdCQUFnQkcsTUFBTUYsTUFBTTtRQUMzRixJQUFJRSxNQUFNSSxJQUFJLEtBQUssUUFBUSxPQUFPSixNQUFNSyxJQUFJLENBQUNOLElBQUksQ0FBQyxDQUFDTyxNQUFRVCxnQkFBZ0JTLElBQUlSLE1BQU07UUFDckYsT0FBTztJQUNUO0FBQ0YifQ==
|
@@ -0,0 +1,15 @@
|
|
1
|
+
"use strict";
|
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) {
|
12
|
+
return Array.isArray(data);
|
13
|
+
}
|
14
|
+
|
15
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlsaXRpZXMvaXNBcnJheU9mUm93cy50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgZnVuY3Rpb24gaXNBcnJheU9mUm93cyhkYXRhOiB1bmtub3duKTogZGF0YSBpcyBSZWNvcmQ8c3RyaW5nLCB1bmtub3duPltdIHtcbiAgcmV0dXJuIEFycmF5LmlzQXJyYXkoZGF0YSlcbn1cbiJdLCJuYW1lcyI6WyJpc0FycmF5T2ZSb3dzIiwiZGF0YSIsIkFycmF5IiwiaXNBcnJheSJdLCJtYXBwaW5ncyI6Ijs7OzsrQkFBZ0JBOzs7ZUFBQUE7OztBQUFULFNBQVNBLGNBQWNDLElBQWE7SUFDekMsT0FBT0MsTUFBTUMsT0FBTyxDQUFDRjtBQUN2QiJ9
|
@@ -0,0 +1,19 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
3
|
+
value: true
|
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');`);
|
14
|
+
// Returns table name 'payload_migrations' or null
|
15
|
+
const exists = queryRes.rows?.[0]?.to_regclass === 'payload_migrations';
|
16
|
+
return exists;
|
17
|
+
};
|
18
|
+
|
19
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlsaXRpZXMvbWlncmF0aW9uVGFibGVFeGlzdHMudHMiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgc3FsIH0gZnJvbSAnZHJpenpsZS1vcm0nXG5cbmltcG9ydCB0eXBlIHsgRHJpenpsZURCIH0gZnJvbSAnLi4vdHlwZXMnXG5cbmV4cG9ydCBjb25zdCBtaWdyYXRpb25UYWJsZUV4aXN0cyA9IGFzeW5jIChkYjogRHJpenpsZURCKTogUHJvbWlzZTxib29sZWFuPiA9PiB7XG4gIGNvbnN0IHF1ZXJ5UmVzID0gYXdhaXQgZGIuZXhlY3V0ZShzcWxgU0VMRUNUIHRvX3JlZ2NsYXNzKCdwdWJsaWMucGF5bG9hZF9taWdyYXRpb25zJyk7YClcblxuICAvLyBSZXR1cm5zIHRhYmxlIG5hbWUgJ3BheWxvYWRfbWlncmF0aW9ucycgb3IgbnVsbFxuICBjb25zdCBleGlzdHMgPSBxdWVyeVJlcy5yb3dzPy5bMF0/LnRvX3JlZ2NsYXNzID09PSAncGF5bG9hZF9taWdyYXRpb25zJ1xuICByZXR1cm4gZXhpc3RzXG59XG4iXSwibmFtZXMiOlsibWlncmF0aW9uVGFibGVFeGlzdHMiLCJkYiIsInF1ZXJ5UmVzIiwiZXhlY3V0ZSIsInNxbCIsImV4aXN0cyIsInJvd3MiLCJ0b19yZWdjbGFzcyJdLCJtYXBwaW5ncyI6Ijs7OzsrQkFJYUE7OztlQUFBQTs7OzRCQUpPO0FBSWIsTUFBTUEsdUJBQXVCLE9BQU9DO0lBQ3pDLE1BQU1DLFdBQVcsTUFBTUQsR0FBR0UsT0FBTyxDQUFDQyxJQUFBQSxlQUFHLENBQUEsQ0FBQyxnREFBZ0QsQ0FBQztJQUV2RixrREFBa0Q7SUFDbEQsTUFBTUMsU0FBU0gsU0FBU0ksSUFBSSxFQUFFLENBQUMsRUFBRSxFQUFFQyxnQkFBZ0I7SUFDbkQsT0FBT0Y7QUFDVCJ9
|
package/dist/webpack.js
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
Object.defineProperty(exports, "webpack", {
|
6
|
+
enumerable: true,
|
7
|
+
get: function() {
|
8
|
+
return webpack;
|
9
|
+
}
|
10
|
+
});
|
11
|
+
const _path = /*#__PURE__*/ _interop_require_default(require("path"));
|
12
|
+
function _interop_require_default(obj) {
|
13
|
+
return obj && obj.__esModule ? obj : {
|
14
|
+
default: obj
|
15
|
+
};
|
16
|
+
}
|
17
|
+
const webpack = (config)=>{
|
18
|
+
return {
|
19
|
+
...config,
|
20
|
+
resolve: {
|
21
|
+
...config.resolve || {},
|
22
|
+
alias: {
|
23
|
+
...config.resolve?.alias || {},
|
24
|
+
[_path.default.resolve(__dirname, './index')]: _path.default.resolve(__dirname, 'mock.js')
|
25
|
+
}
|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UFBSSxDQUFDRixPQUFPLENBQUNHLFdBQVc7WUFDaEU7UUFDRjtJQUNGO0FBQ0YifQ==
|
package/package.json
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
{
|
2
|
+
"name": "@payloadcms/db-postgres",
|
3
|
+
"version": "0.1.0-beta.0",
|
4
|
+
"description": "The officially supported Postgres database adapter for Payload",
|
5
|
+
"repository": "https://github.com/payloadcms/payload",
|
6
|
+
"license": "MIT",
|
7
|
+
"homepage": "https://payloadcms.com",
|
8
|
+
"author": {
|
9
|
+
"email": "info@payloadcms.com",
|
10
|
+
"name": "Payload",
|
11
|
+
"url": "https://payloadcms.com"
|
12
|
+
},
|
13
|
+
"main": "./src/index.ts",
|
14
|
+
"types": "./src/index.ts",
|
15
|
+
"scripts": {
|
16
|
+
"build": "pnpm build:swc && pnpm build:types",
|
17
|
+
"build:swc": "swc ./src -d ./dist --config-file .swcrc",
|
18
|
+
"build:types": "tsc --emitDeclarationOnly --outDir dist"
|
19
|
+
},
|
20
|
+
"dependencies": {
|
21
|
+
"@libsql/client": "^0.3.1",
|
22
|
+
"console-table-printer": "2.11.2",
|
23
|
+
"drizzle-kit": "0.19.13-e99bac1",
|
24
|
+
"drizzle-orm": "0.28.5",
|
25
|
+
"pg": "8.11.3",
|
26
|
+
"prompts": "2.4.2",
|
27
|
+
"to-snake-case": "1.0.0"
|
28
|
+
},
|
29
|
+
"devDependencies": {
|
30
|
+
"@payloadcms/eslint-config": "workspace:*",
|
31
|
+
"@types/pg": "8.10.2",
|
32
|
+
"@types/to-snake-case": "1.0.0",
|
33
|
+
"better-sqlite3": "^8.5.0",
|
34
|
+
"payload": "workspace:*"
|
35
|
+
},
|
36
|
+
"peerDependencies": {
|
37
|
+
"better-sqlite3": "^8.5.0"
|
38
|
+
},
|
39
|
+
"publishConfig": {
|
40
|
+
"main": "./dist/index.js",
|
41
|
+
"registry": "https://registry.npmjs.org/",
|
42
|
+
"types": "./dist/index.d.ts"
|
43
|
+
},
|
44
|
+
"files": [
|
45
|
+
"dist"
|
46
|
+
]
|
47
|
+
}
|