@payloadcms/db-postgres 3.0.0-beta.13 → 3.0.0-beta.131
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +1 -1
- package/dist/connect.d.ts +1 -1
- package/dist/connect.d.ts.map +1 -1
- package/dist/connect.js +45 -17
- package/dist/connect.js.map +1 -1
- package/dist/exports/migration-utils.d.ts +2 -0
- package/dist/exports/migration-utils.d.ts.map +1 -0
- package/dist/exports/migration-utils.js +3 -0
- package/dist/exports/migration-utils.js.map +1 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +68 -72
- package/dist/index.js.map +1 -1
- package/dist/predefinedMigrations/relationships-v2-v3.d.ts +4 -0
- package/dist/predefinedMigrations/relationships-v2-v3.d.ts.map +1 -0
- package/dist/predefinedMigrations/relationships-v2-v3.js.map +1 -0
- package/dist/predefinedMigrations/relationships-v2-v3.mjs +11 -0
- package/dist/predefinedMigrations/v2-v3/fetchAndResave/index.d.ts +20 -0
- package/dist/predefinedMigrations/v2-v3/fetchAndResave/index.d.ts.map +1 -0
- package/dist/predefinedMigrations/v2-v3/fetchAndResave/index.js +169 -0
- package/dist/predefinedMigrations/v2-v3/fetchAndResave/index.js.map +1 -0
- package/dist/predefinedMigrations/v2-v3/fetchAndResave/traverseFields.d.ts +11 -0
- package/dist/predefinedMigrations/v2-v3/fetchAndResave/traverseFields.d.ts.map +1 -0
- package/dist/predefinedMigrations/v2-v3/fetchAndResave/traverseFields.js +196 -0
- package/dist/predefinedMigrations/v2-v3/fetchAndResave/traverseFields.js.map +1 -0
- package/dist/predefinedMigrations/v2-v3/groupUpSQLStatements.d.ts +3 -0
- package/dist/predefinedMigrations/v2-v3/groupUpSQLStatements.d.ts.map +1 -0
- package/dist/predefinedMigrations/v2-v3/groupUpSQLStatements.js +56 -0
- package/dist/predefinedMigrations/v2-v3/groupUpSQLStatements.js.map +1 -0
- package/dist/predefinedMigrations/v2-v3/index.d.ts +23 -0
- package/dist/predefinedMigrations/v2-v3/index.d.ts.map +1 -0
- package/dist/predefinedMigrations/v2-v3/index.js +211 -0
- package/dist/predefinedMigrations/v2-v3/index.js.map +1 -0
- package/dist/predefinedMigrations/v2-v3/migrateRelationships.d.ts +20 -0
- package/dist/predefinedMigrations/v2-v3/migrateRelationships.d.ts.map +1 -0
- package/dist/predefinedMigrations/v2-v3/migrateRelationships.js +63 -0
- package/dist/predefinedMigrations/v2-v3/migrateRelationships.js.map +1 -0
- package/dist/predefinedMigrations/v2-v3/traverseFields.d.ts +23 -0
- package/dist/predefinedMigrations/v2-v3/traverseFields.d.ts.map +1 -0
- package/dist/predefinedMigrations/v2-v3/traverseFields.js +85 -0
- package/dist/predefinedMigrations/v2-v3/traverseFields.js.map +1 -0
- package/dist/predefinedMigrations/v2-v3/types.d.ts +9 -0
- package/dist/predefinedMigrations/v2-v3/types.d.ts.map +1 -0
- package/dist/predefinedMigrations/v2-v3/types.js +6 -0
- package/dist/predefinedMigrations/v2-v3/types.js.map +1 -0
- package/dist/types.d.ts +65 -80
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/license.md +22 -0
- package/package.json +48 -34
- package/dist/count.d.ts +0 -3
- package/dist/count.d.ts.map +0 -1
- package/dist/count.js +0 -53
- package/dist/count.js.map +0 -1
- package/dist/create.d.ts +0 -3
- package/dist/create.d.ts.map +0 -1
- package/dist/create.js +0 -21
- package/dist/create.js.map +0 -1
- package/dist/createGlobal.d.ts +0 -5
- package/dist/createGlobal.d.ts.map +0 -1
- package/dist/createGlobal.js +0 -21
- package/dist/createGlobal.js.map +0 -1
- package/dist/createGlobalVersion.d.ts +0 -6
- package/dist/createGlobalVersion.d.ts.map +0 -1
- package/dist/createGlobalVersion.js +0 -37
- package/dist/createGlobalVersion.js.map +0 -1
- package/dist/createMigration.d.ts +0 -3
- package/dist/createMigration.d.ts.map +0 -1
- package/dist/createMigration.js +0 -81
- package/dist/createMigration.js.map +0 -1
- package/dist/createVersion.d.ts +0 -5
- package/dist/createVersion.d.ts.map +0 -1
- package/dist/createVersion.js +0 -48
- package/dist/createVersion.js.map +0 -1
- package/dist/deleteMany.d.ts +0 -3
- package/dist/deleteMany.d.ts.map +0 -1
- package/dist/deleteMany.js +0 -31
- package/dist/deleteMany.js.map +0 -1
- package/dist/deleteOne.d.ts +0 -3
- package/dist/deleteOne.d.ts.map +0 -1
- package/dist/deleteOne.js +0 -62
- package/dist/deleteOne.js.map +0 -1
- package/dist/deleteVersions.d.ts +0 -3
- package/dist/deleteVersions.d.ts.map +0 -1
- package/dist/deleteVersions.js +0 -35
- package/dist/deleteVersions.js.map +0 -1
- package/dist/destroy.d.ts +0 -3
- package/dist/destroy.d.ts.map +0 -1
- package/dist/destroy.js +0 -12
- package/dist/destroy.js.map +0 -1
- package/dist/find/buildFindManyArgs.d.ts +0 -13
- package/dist/find/buildFindManyArgs.d.ts.map +0 -1
- package/dist/find/buildFindManyArgs.js +0 -64
- package/dist/find/buildFindManyArgs.js.map +0 -1
- package/dist/find/chainMethods.d.ts +0 -16
- package/dist/find/chainMethods.d.ts.map +0 -1
- package/dist/find/chainMethods.js +0 -12
- package/dist/find/chainMethods.js.map +0 -1
- package/dist/find/findMany.d.ts +0 -22
- package/dist/find/findMany.d.ts.map +0 -1
- package/dist/find/findMany.js +0 -163
- package/dist/find/findMany.js.map +0 -1
- package/dist/find/traverseFields.d.ts +0 -16
- package/dist/find/traverseFields.d.ts.map +0 -1
- package/dist/find/traverseFields.js +0 -154
- package/dist/find/traverseFields.js.map +0 -1
- package/dist/find.d.ts +0 -3
- package/dist/find.d.ts.map +0 -1
- package/dist/find.js +0 -24
- package/dist/find.js.map +0 -1
- package/dist/findGlobal.d.ts +0 -3
- package/dist/findGlobal.d.ts.map +0 -1
- package/dist/findGlobal.js +0 -26
- package/dist/findGlobal.js.map +0 -1
- package/dist/findGlobalVersions.d.ts +0 -3
- package/dist/findGlobalVersions.d.ts.map +0 -1
- package/dist/findGlobalVersions.js +0 -28
- package/dist/findGlobalVersions.js.map +0 -1
- package/dist/findOne.d.ts +0 -5
- package/dist/findOne.d.ts.map +0 -1
- package/dist/findOne.js +0 -24
- package/dist/findOne.js.map +0 -1
- package/dist/findVersions.d.ts +0 -3
- package/dist/findVersions.d.ts.map +0 -1
- package/dist/findVersions.js +0 -28
- package/dist/findVersions.js.map +0 -1
- package/dist/init.d.ts +0 -3
- package/dist/init.d.ts.map +0 -1
- package/dist/init.js +0 -94
- package/dist/init.js.map +0 -1
- package/dist/migrate.d.ts +0 -3
- package/dist/migrate.d.ts.map +0 -1
- package/dist/migrate.js +0 -99
- package/dist/migrate.js.map +0 -1
- package/dist/migrateDown.d.ts +0 -3
- package/dist/migrateDown.d.ts.map +0 -1
- package/dist/migrateDown.js +0 -63
- package/dist/migrateDown.js.map +0 -1
- package/dist/migrateFresh.d.ts +0 -8
- package/dist/migrateFresh.d.ts.map +0 -1
- package/dist/migrateFresh.js +0 -72
- package/dist/migrateFresh.js.map +0 -1
- package/dist/migrateRefresh.d.ts +0 -6
- package/dist/migrateRefresh.d.ts.map +0 -1
- package/dist/migrateRefresh.js +0 -102
- package/dist/migrateRefresh.js.map +0 -1
- package/dist/migrateReset.d.ts +0 -6
- package/dist/migrateReset.d.ts.map +0 -1
- package/dist/migrateReset.js +0 -82
- package/dist/migrateReset.js.map +0 -1
- package/dist/migrateStatus.d.ts +0 -3
- package/dist/migrateStatus.d.ts.map +0 -1
- package/dist/migrateStatus.js +0 -44
- package/dist/migrateStatus.js.map +0 -1
- package/dist/queries/buildAndOrConditions.d.ts +0 -17
- package/dist/queries/buildAndOrConditions.d.ts.map +0 -1
- package/dist/queries/buildAndOrConditions.js +0 -29
- package/dist/queries/buildAndOrConditions.js.map +0 -1
- package/dist/queries/buildQuery.d.ts +0 -31
- package/dist/queries/buildQuery.d.ts.map +0 -1
- package/dist/queries/buildQuery.js +0 -76
- package/dist/queries/buildQuery.js.map +0 -1
- package/dist/queries/createJSONQuery/convertPathToJSONTraversal.d.ts +0 -2
- package/dist/queries/createJSONQuery/convertPathToJSONTraversal.d.ts.map +0 -1
- package/dist/queries/createJSONQuery/convertPathToJSONTraversal.js +0 -14
- package/dist/queries/createJSONQuery/convertPathToJSONTraversal.js.map +0 -1
- package/dist/queries/createJSONQuery/formatJSONPathSegment.d.ts +0 -2
- package/dist/queries/createJSONQuery/formatJSONPathSegment.d.ts.map +0 -1
- package/dist/queries/createJSONQuery/formatJSONPathSegment.js +0 -5
- package/dist/queries/createJSONQuery/formatJSONPathSegment.js.map +0 -1
- package/dist/queries/createJSONQuery/index.d.ts +0 -10
- package/dist/queries/createJSONQuery/index.d.ts.map +0 -1
- package/dist/queries/createJSONQuery/index.js +0 -54
- package/dist/queries/createJSONQuery/index.js.map +0 -1
- package/dist/queries/getTableColumnFromPath.d.ts +0 -51
- package/dist/queries/getTableColumnFromPath.d.ts.map +0 -1
- package/dist/queries/getTableColumnFromPath.js +0 -475
- package/dist/queries/getTableColumnFromPath.js.map +0 -1
- package/dist/queries/operatorMap.d.ts +0 -18
- package/dist/queries/operatorMap.d.ts.map +0 -1
- package/dist/queries/operatorMap.js +0 -24
- package/dist/queries/operatorMap.js.map +0 -1
- package/dist/queries/parseParams.d.ts +0 -17
- package/dist/queries/parseParams.d.ts.map +0 -1
- package/dist/queries/parseParams.js +0 -182
- package/dist/queries/parseParams.js.map +0 -1
- package/dist/queries/sanitizeQueryValue.d.ts +0 -15
- package/dist/queries/sanitizeQueryValue.d.ts.map +0 -1
- package/dist/queries/sanitizeQueryValue.js +0 -90
- package/dist/queries/sanitizeQueryValue.js.map +0 -1
- package/dist/queries/selectDistinct.d.ts +0 -23
- package/dist/queries/selectDistinct.d.ts.map +0 -1
- package/dist/queries/selectDistinct.js +0 -41
- package/dist/queries/selectDistinct.js.map +0 -1
- package/dist/queryDrafts.d.ts +0 -3
- package/dist/queryDrafts.d.ts.map +0 -1
- package/dist/queryDrafts.js +0 -45
- package/dist/queryDrafts.js.map +0 -1
- package/dist/schema/build.d.ts +0 -30
- package/dist/schema/build.d.ts.map +0 -1
- package/dist/schema/build.js +0 -320
- package/dist/schema/build.js.map +0 -1
- package/dist/schema/createIndex.d.ts +0 -12
- package/dist/schema/createIndex.d.ts.map +0 -1
- package/dist/schema/createIndex.js +0 -18
- package/dist/schema/createIndex.js.map +0 -1
- package/dist/schema/getTableName.d.ts +0 -32
- package/dist/schema/getTableName.d.ts.map +0 -1
- package/dist/schema/getTableName.js +0 -31
- package/dist/schema/getTableName.js.map +0 -1
- package/dist/schema/idToUUID.d.ts +0 -3
- package/dist/schema/idToUUID.d.ts.map +0 -1
- package/dist/schema/idToUUID.js +0 -11
- package/dist/schema/idToUUID.js.map +0 -1
- package/dist/schema/parentIDColumnMap.d.ts +0 -4
- package/dist/schema/parentIDColumnMap.d.ts.map +0 -1
- package/dist/schema/parentIDColumnMap.js +0 -9
- package/dist/schema/parentIDColumnMap.js.map +0 -1
- package/dist/schema/setColumnID.d.ts +0 -11
- package/dist/schema/setColumnID.d.ts.map +0 -1
- package/dist/schema/setColumnID.js +0 -24
- package/dist/schema/setColumnID.js.map +0 -1
- package/dist/schema/traverseFields.d.ts +0 -38
- package/dist/schema/traverseFields.d.ts.map +0 -1
- package/dist/schema/traverseFields.js +0 -550
- package/dist/schema/traverseFields.js.map +0 -1
- package/dist/schema/validateExistingBlockIsIdentical.d.ts +0 -12
- package/dist/schema/validateExistingBlockIsIdentical.d.ts.map +0 -1
- package/dist/schema/validateExistingBlockIsIdentical.js +0 -76
- package/dist/schema/validateExistingBlockIsIdentical.js.map +0 -1
- package/dist/transactions/beginTransaction.d.ts +0 -3
- package/dist/transactions/beginTransaction.d.ts.map +0 -1
- package/dist/transactions/beginTransaction.js +0 -47
- package/dist/transactions/beginTransaction.js.map +0 -1
- package/dist/transactions/commitTransaction.d.ts +0 -3
- package/dist/transactions/commitTransaction.d.ts.map +0 -1
- package/dist/transactions/commitTransaction.js +0 -14
- package/dist/transactions/commitTransaction.js.map +0 -1
- package/dist/transactions/rollbackTransaction.d.ts +0 -3
- package/dist/transactions/rollbackTransaction.d.ts.map +0 -1
- package/dist/transactions/rollbackTransaction.js +0 -13
- package/dist/transactions/rollbackTransaction.js.map +0 -1
- package/dist/transform/read/hasManyNumber.d.ts +0 -10
- package/dist/transform/read/hasManyNumber.d.ts.map +0 -1
- package/dist/transform/read/hasManyNumber.js +0 -10
- package/dist/transform/read/hasManyNumber.js.map +0 -1
- package/dist/transform/read/hasManyText.d.ts +0 -10
- package/dist/transform/read/hasManyText.d.ts.map +0 -1
- package/dist/transform/read/hasManyText.js +0 -10
- package/dist/transform/read/hasManyText.js.map +0 -1
- package/dist/transform/read/index.d.ts +0 -12
- package/dist/transform/read/index.d.ts.map +0 -1
- package/dist/transform/read/index.js +0 -43
- package/dist/transform/read/index.js.map +0 -1
- package/dist/transform/read/relationship.d.ts +0 -10
- package/dist/transform/read/relationship.d.ts.map +0 -1
- package/dist/transform/read/relationship.js +0 -64
- package/dist/transform/read/relationship.js.map +0 -1
- package/dist/transform/read/traverseFields.d.ts +0 -52
- package/dist/transform/read/traverseFields.d.ts.map +0 -1
- package/dist/transform/read/traverseFields.js +0 -421
- package/dist/transform/read/traverseFields.js.map +0 -1
- package/dist/transform/write/array.d.ts +0 -26
- package/dist/transform/write/array.d.ts.map +0 -1
- package/dist/transform/write/array.js +0 -58
- package/dist/transform/write/array.js.map +0 -1
- package/dist/transform/write/blocks.d.ts +0 -25
- package/dist/transform/write/blocks.d.ts.map +0 -1
- package/dist/transform/write/blocks.js +0 -54
- package/dist/transform/write/blocks.js.map +0 -1
- package/dist/transform/write/index.d.ts +0 -13
- package/dist/transform/write/index.d.ts.map +0 -1
- package/dist/transform/write/index.js +0 -41
- package/dist/transform/write/index.js.map +0 -1
- package/dist/transform/write/numbers.d.ts +0 -8
- package/dist/transform/write/numbers.d.ts.map +0 -1
- package/dist/transform/write/numbers.js +0 -11
- package/dist/transform/write/numbers.js.map +0 -1
- package/dist/transform/write/relationships.d.ts +0 -10
- package/dist/transform/write/relationships.d.ts.map +0 -1
- package/dist/transform/write/relationships.js +0 -23
- package/dist/transform/write/relationships.js.map +0 -1
- package/dist/transform/write/selects.d.ts +0 -8
- package/dist/transform/write/selects.d.ts.map +0 -1
- package/dist/transform/write/selects.js +0 -20
- package/dist/transform/write/selects.js.map +0 -1
- package/dist/transform/write/texts.d.ts +0 -8
- package/dist/transform/write/texts.d.ts.map +0 -1
- package/dist/transform/write/texts.js +0 -11
- package/dist/transform/write/texts.js.map +0 -1
- package/dist/transform/write/traverseFields.d.ts +0 -50
- package/dist/transform/write/traverseFields.d.ts.map +0 -1
- package/dist/transform/write/traverseFields.js +0 -428
- package/dist/transform/write/traverseFields.js.map +0 -1
- package/dist/transform/write/types.d.ts +0 -43
- package/dist/transform/write/types.d.ts.map +0 -1
- package/dist/transform/write/types.js +0 -3
- package/dist/transform/write/types.js.map +0 -1
- package/dist/update.d.ts +0 -3
- package/dist/update.d.ts.map +0 -1
- package/dist/update.js +0 -58
- package/dist/update.js.map +0 -1
- package/dist/updateGlobal.d.ts +0 -5
- package/dist/updateGlobal.d.ts.map +0 -1
- package/dist/updateGlobal.js +0 -28
- package/dist/updateGlobal.js.map +0 -1
- package/dist/updateGlobalVersion.d.ts +0 -5
- package/dist/updateGlobalVersion.d.ts.map +0 -1
- package/dist/updateGlobalVersion.js +0 -40
- package/dist/updateGlobalVersion.js.map +0 -1
- package/dist/updateVersion.d.ts +0 -5
- package/dist/updateVersion.d.ts.map +0 -1
- package/dist/updateVersion.js +0 -40
- package/dist/updateVersion.js.map +0 -1
- package/dist/upsertRow/deleteExistingArrayRows.d.ts +0 -10
- package/dist/upsertRow/deleteExistingArrayRows.d.ts.map +0 -1
- package/dist/upsertRow/deleteExistingArrayRows.js +0 -10
- package/dist/upsertRow/deleteExistingArrayRows.js.map +0 -1
- package/dist/upsertRow/deleteExistingRowsByPath.d.ts +0 -14
- package/dist/upsertRow/deleteExistingRowsByPath.d.ts.map +0 -1
- package/dist/upsertRow/deleteExistingRowsByPath.js +0 -33
- package/dist/upsertRow/deleteExistingRowsByPath.js.map +0 -1
- package/dist/upsertRow/index.d.ts +0 -4
- package/dist/upsertRow/index.d.ts.map +0 -1
- package/dist/upsertRow/index.js +0 -276
- package/dist/upsertRow/index.js.map +0 -1
- package/dist/upsertRow/insertArrays.d.ts +0 -13
- package/dist/upsertRow/insertArrays.d.ts.map +0 -1
- package/dist/upsertRow/insertArrays.js +0 -68
- package/dist/upsertRow/insertArrays.js.map +0 -1
- package/dist/upsertRow/types.d.ts +0 -27
- package/dist/upsertRow/types.d.ts.map +0 -1
- package/dist/upsertRow/types.js +0 -3
- package/dist/upsertRow/types.js.map +0 -1
- package/dist/utilities/appendPrefixToKeys.d.ts +0 -2
- package/dist/utilities/appendPrefixToKeys.d.ts.map +0 -1
- package/dist/utilities/appendPrefixToKeys.js +0 -6
- package/dist/utilities/appendPrefixToKeys.js.map +0 -1
- package/dist/utilities/createBlocksMap.d.ts +0 -5
- package/dist/utilities/createBlocksMap.d.ts.map +0 -1
- package/dist/utilities/createBlocksMap.js +0 -29
- package/dist/utilities/createBlocksMap.js.map +0 -1
- package/dist/utilities/createMigrationTable.d.ts +0 -3
- package/dist/utilities/createMigrationTable.d.ts.map +0 -1
- package/dist/utilities/createMigrationTable.js +0 -13
- package/dist/utilities/createMigrationTable.js.map +0 -1
- package/dist/utilities/createRelationshipMap.d.ts +0 -2
- package/dist/utilities/createRelationshipMap.d.ts.map +0 -1
- package/dist/utilities/createRelationshipMap.js +0 -19
- package/dist/utilities/createRelationshipMap.js.map +0 -1
- package/dist/utilities/hasLocalesTable.d.ts +0 -3
- package/dist/utilities/hasLocalesTable.d.ts.map +0 -1
- package/dist/utilities/hasLocalesTable.js +0 -11
- package/dist/utilities/hasLocalesTable.js.map +0 -1
- package/dist/utilities/isArrayOfRows.d.ts +0 -2
- package/dist/utilities/isArrayOfRows.d.ts.map +0 -1
- package/dist/utilities/isArrayOfRows.js +0 -5
- package/dist/utilities/isArrayOfRows.js.map +0 -1
- package/dist/utilities/migrationTableExists.d.ts +0 -3
- package/dist/utilities/migrationTableExists.d.ts.map +0 -1
- package/dist/utilities/migrationTableExists.js +0 -9
- package/dist/utilities/migrationTableExists.js.map +0 -1
- package/dist/utilities/parseError.d.ts +0 -5
- package/dist/utilities/parseError.d.ts.map +0 -1
- package/dist/utilities/parseError.js +0 -17
- package/dist/utilities/parseError.js.map +0 -1
- package/dist/utilities/pushDevSchema.d.ts +0 -9
- package/dist/utilities/pushDevSchema.d.ts.map +0 -1
- package/dist/utilities/pushDevSchema.js +0 -58
- package/dist/utilities/pushDevSchema.js.map +0 -1
package/dist/types.d.ts
CHANGED
@@ -1,102 +1,87 @@
|
|
1
|
-
import type {
|
2
|
-
import type {
|
3
|
-
import type {
|
4
|
-
import type { PgTableFn } from 'drizzle-orm/pg-core
|
5
|
-
import type { Payload } from 'payload';
|
6
|
-
import type { BaseDatabaseAdapter } from 'payload/database';
|
7
|
-
import type { PayloadRequest } from 'payload/types';
|
1
|
+
import type { BasePostgresAdapter, GenericEnum, MigrateDownArgs, MigrateUpArgs, PostgresDB, PostgresSchemaHook } from '@payloadcms/drizzle/postgres';
|
2
|
+
import type { DrizzleAdapter } from '@payloadcms/drizzle/types';
|
3
|
+
import type { DrizzleConfig } from 'drizzle-orm';
|
4
|
+
import type { PgSchema, PgTableFn, PgTransactionConfig } from 'drizzle-orm/pg-core';
|
8
5
|
import type { Pool, PoolConfig } from 'pg';
|
9
|
-
export type DrizzleDB = NodePgDatabase<Record<string, unknown>>;
|
10
6
|
export type Args = {
|
7
|
+
/**
|
8
|
+
* Transform the schema after it's built.
|
9
|
+
* You can use it to customize the schema with features that aren't supported by Payload.
|
10
|
+
* Examples may include: composite indices, generated columns, vectors
|
11
|
+
*/
|
12
|
+
afterSchemaInit?: PostgresSchemaHook[];
|
13
|
+
/**
|
14
|
+
* Transform the schema before it's built.
|
15
|
+
* You can use it to preserve an existing database schema and if there are any collissions Payload will override them.
|
16
|
+
* To generate Drizzle schema from the database, see [Drizzle Kit introspection](https://orm.drizzle.team/kit-docs/commands#introspect--pull)
|
17
|
+
*/
|
18
|
+
beforeSchemaInit?: PostgresSchemaHook[];
|
19
|
+
/**
|
20
|
+
* Pass `true` to disale auto database creation if it doesn't exist.
|
21
|
+
* @default false
|
22
|
+
*/
|
23
|
+
disableCreateDatabase?: boolean;
|
24
|
+
extensions?: string[];
|
11
25
|
idType?: 'serial' | 'uuid';
|
12
26
|
localesSuffix?: string;
|
13
27
|
logger?: DrizzleConfig['logger'];
|
14
28
|
migrationDir?: string;
|
15
29
|
pool: PoolConfig;
|
30
|
+
prodMigrations?: {
|
31
|
+
down: (args: MigrateDownArgs) => Promise<void>;
|
32
|
+
name: string;
|
33
|
+
up: (args: MigrateUpArgs) => Promise<void>;
|
34
|
+
}[];
|
16
35
|
push?: boolean;
|
17
36
|
relationshipsSuffix?: string;
|
18
|
-
schemaName?: string;
|
19
|
-
versionsSuffix?: string;
|
20
|
-
};
|
21
|
-
export type GenericColumn = PgColumn<ColumnBaseConfig<ColumnDataType, string>, Record<string, unknown>>;
|
22
|
-
export type GenericColumns = {
|
23
|
-
[x: string]: GenericColumn;
|
24
|
-
};
|
25
|
-
export type GenericTable = PgTableWithColumns<{
|
26
|
-
columns: GenericColumns;
|
27
|
-
dialect: string;
|
28
|
-
name: string;
|
29
|
-
schema: undefined;
|
30
|
-
}>;
|
31
|
-
export type GenericEnum = PgEnum<[string, ...string[]]>;
|
32
|
-
export type GenericRelation = Relations<string, Record<string, Relation<string>>>;
|
33
|
-
export type DrizzleTransaction = PgTransaction<NodePgQueryResultHKT, Record<string, unknown>, ExtractTablesWithRelations<Record<string, unknown>>>;
|
34
|
-
export type PostgresAdapter = BaseDatabaseAdapter & {
|
35
37
|
/**
|
36
|
-
*
|
38
|
+
* The schema name to use for the database
|
39
|
+
* @experimental This only works when there are not other tables or enums of the same name in the database under a different schema. Awaiting fix from Drizzle.
|
37
40
|
*/
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
/**
|
42
|
-
* An object keyed on each table, with a key value pair where the constraint name is the key, followed by the dot-notation field name
|
43
|
-
* Used for returning properly formed errors from unique fields
|
44
|
-
*/
|
45
|
-
fieldConstraints: Record<string, Record<string, string>>;
|
46
|
-
idType: Args['idType'];
|
47
|
-
localesSuffix?: string;
|
48
|
-
logger: DrizzleConfig['logger'];
|
49
|
-
pgSchema?: {
|
50
|
-
table: PgTableFn;
|
51
|
-
} | PgSchema;
|
52
|
-
pool: Pool;
|
53
|
-
poolOptions: Args['pool'];
|
54
|
-
push: boolean;
|
55
|
-
relations: Record<string, GenericRelation>;
|
56
|
-
relationshipsSuffix?: string;
|
57
|
-
schema: Record<string, GenericEnum | GenericRelation | GenericTable>;
|
58
|
-
schemaName?: Args['schemaName'];
|
59
|
-
sessions: {
|
60
|
-
[id: string]: {
|
61
|
-
db: DrizzleTransaction;
|
62
|
-
reject: () => Promise<void>;
|
63
|
-
resolve: () => Promise<void>;
|
64
|
-
};
|
65
|
-
};
|
66
|
-
tables: Record<string, GenericTable | PgTableWithColumns<any>>;
|
41
|
+
schemaName?: string;
|
42
|
+
tablesFilter?: string[];
|
43
|
+
transactionOptions?: false | PgTransactionConfig;
|
67
44
|
versionsSuffix?: string;
|
68
45
|
};
|
69
|
-
export type
|
70
|
-
|
71
|
-
|
72
|
-
}
|
73
|
-
export type MigrateUpArgs = {
|
74
|
-
payload: Payload;
|
75
|
-
req?: Partial<PayloadRequest>;
|
76
|
-
};
|
77
|
-
export type MigrateDownArgs = {
|
78
|
-
payload: Payload;
|
79
|
-
req?: Partial<PayloadRequest>;
|
80
|
-
};
|
46
|
+
export type PostgresAdapter = {
|
47
|
+
pool: Pool;
|
48
|
+
poolOptions: PoolConfig;
|
49
|
+
} & BasePostgresAdapter;
|
81
50
|
declare module 'payload' {
|
82
|
-
interface DatabaseAdapter extends Omit<Args, 'migrationDir' | 'pool'>,
|
83
|
-
|
51
|
+
interface DatabaseAdapter extends Omit<Args, 'idType' | 'logger' | 'migrationDir' | 'pool'>, DrizzleAdapter {
|
52
|
+
afterSchemaInit: PostgresSchemaHook[];
|
53
|
+
beforeSchemaInit: PostgresSchemaHook[];
|
54
|
+
beginTransaction: (options?: PgTransactionConfig) => Promise<null | number | string>;
|
55
|
+
drizzle: PostgresDB;
|
84
56
|
enums: Record<string, GenericEnum>;
|
57
|
+
extensions: Record<string, boolean>;
|
58
|
+
/**
|
59
|
+
* An object keyed on each table, with a key value pair where the constraint name is the key, followed by the dot-notation field name
|
60
|
+
* Used for returning properly formed errors from unique fields
|
61
|
+
*/
|
85
62
|
fieldConstraints: Record<string, Record<string, string>>;
|
86
|
-
|
63
|
+
idType: Args['idType'];
|
64
|
+
initializing: Promise<void>;
|
65
|
+
localesSuffix?: string;
|
66
|
+
logger: DrizzleConfig['logger'];
|
67
|
+
pgSchema?: {
|
68
|
+
table: PgTableFn;
|
69
|
+
} | PgSchema;
|
87
70
|
pool: Pool;
|
71
|
+
poolOptions: Args['pool'];
|
72
|
+
prodMigrations?: {
|
73
|
+
down: (args: MigrateDownArgs) => Promise<void>;
|
74
|
+
name: string;
|
75
|
+
up: (args: MigrateUpArgs) => Promise<void>;
|
76
|
+
}[];
|
88
77
|
push: boolean;
|
89
|
-
|
78
|
+
rejectInitializing: () => void;
|
90
79
|
relationshipsSuffix?: string;
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
resolve: () => Promise<void>;
|
97
|
-
};
|
98
|
-
};
|
99
|
-
tables: Record<string, GenericTable>;
|
80
|
+
resolveInitializing: () => void;
|
81
|
+
schema: Record<string, unknown>;
|
82
|
+
schemaName?: Args['schemaName'];
|
83
|
+
tableNameMap: Map<string, string>;
|
84
|
+
tablesFilter?: string[];
|
100
85
|
versionsSuffix?: string;
|
101
86
|
}
|
102
87
|
}
|
package/dist/types.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,
|
1
|
+
{"version":3,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IAAI,EAAE,CAAC,IAAI,EAAE,eAAe,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;YAC9C,IAAI,EAAE,MAAM,CAAA;YACZ,EAAE,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;SAC3C,EAAE,CAAA;QACH,IAAI,EAAE,OAAO,CAAA;QACb,kBAAkB,EAAE,MAAM,IAAI,CAAA;QAC9B,mBAAmB,CAAC,EAAE,MAAM,CAAA;QAC5B,mBAAmB,EAAE,MAAM,IAAI,CAAA;QAC/B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;QAC/B,UAAU,CAAC,EAAE,IAAI,CAAC,YAAY,CAAC,CAAA;QAC/B,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;QACjC,YAAY,CAAC,EAAE,MAAM,EAAE,CAAA;QACvB,cAAc,CAAC,EAAE,MAAM,CAAA;KACxB;CACF"}
|
package/dist/types.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/types.ts"],"sourcesContent":["import type {\n
|
1
|
+
{"version":3,"sources":["../src/types.ts"],"sourcesContent":["import type {\n BasePostgresAdapter,\n GenericEnum,\n MigrateDownArgs,\n MigrateUpArgs,\n PostgresDB,\n PostgresSchemaHook,\n} from '@payloadcms/drizzle/postgres'\nimport type { DrizzleAdapter } from '@payloadcms/drizzle/types'\nimport type { DrizzleConfig } from 'drizzle-orm'\nimport type { PgSchema, PgTableFn, PgTransactionConfig } from 'drizzle-orm/pg-core'\nimport type { Pool, PoolConfig } from 'pg'\n\nexport type Args = {\n /**\n * Transform the schema after it's built.\n * You can use it to customize the schema with features that aren't supported by Payload.\n * Examples may include: composite indices, generated columns, vectors\n */\n afterSchemaInit?: PostgresSchemaHook[]\n /**\n * Transform the schema before it's built.\n * You can use it to preserve an existing database schema and if there are any collissions Payload will override them.\n * To generate Drizzle schema from the database, see [Drizzle Kit introspection](https://orm.drizzle.team/kit-docs/commands#introspect--pull)\n */\n beforeSchemaInit?: PostgresSchemaHook[]\n /**\n * Pass `true` to disale auto database creation if it doesn't exist.\n * @default false\n */\n disableCreateDatabase?: boolean\n extensions?: string[]\n idType?: 'serial' | 'uuid'\n localesSuffix?: string\n logger?: DrizzleConfig['logger']\n migrationDir?: string\n pool: PoolConfig\n prodMigrations?: {\n down: (args: MigrateDownArgs) => Promise<void>\n name: string\n up: (args: MigrateUpArgs) => Promise<void>\n }[]\n push?: boolean\n relationshipsSuffix?: string\n /**\n * The schema name to use for the database\n * @experimental This only works when there are not other tables or enums of the same name in the database under a different schema. Awaiting fix from Drizzle.\n */\n schemaName?: string\n tablesFilter?: string[]\n transactionOptions?: false | PgTransactionConfig\n versionsSuffix?: string\n}\n\nexport type PostgresAdapter = {\n pool: Pool\n poolOptions: PoolConfig\n} & BasePostgresAdapter\n\ndeclare module 'payload' {\n export interface DatabaseAdapter\n extends Omit<Args, 'idType' | 'logger' | 'migrationDir' | 'pool'>,\n DrizzleAdapter {\n afterSchemaInit: PostgresSchemaHook[]\n\n beforeSchemaInit: PostgresSchemaHook[]\n beginTransaction: (options?: PgTransactionConfig) => Promise<null | number | string>\n drizzle: PostgresDB\n enums: Record<string, GenericEnum>\n extensions: Record<string, boolean>\n /**\n * An object keyed on each table, with a key value pair where the constraint name is the key, followed by the dot-notation field name\n * Used for returning properly formed errors from unique fields\n */\n fieldConstraints: Record<string, Record<string, string>>\n idType: Args['idType']\n initializing: Promise<void>\n localesSuffix?: string\n logger: DrizzleConfig['logger']\n pgSchema?: { table: PgTableFn } | PgSchema\n pool: Pool\n poolOptions: Args['pool']\n prodMigrations?: {\n down: (args: MigrateDownArgs) => Promise<void>\n name: string\n up: (args: MigrateUpArgs) => Promise<void>\n }[]\n push: boolean\n rejectInitializing: () => void\n relationshipsSuffix?: string\n resolveInitializing: () => void\n schema: Record<string, unknown>\n schemaName?: Args['schemaName']\n tableNameMap: Map<string, string>\n tablesFilter?: string[]\n versionsSuffix?: string\n }\n}\n"],"names":[],"mappings":"AAsDA,WAGuB"}
|
package/license.md
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2018-2024 Payload CMS, Inc. <info@payloadcms.com>
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
'Software'), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
19
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
20
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
21
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
22
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/package.json
CHANGED
@@ -1,61 +1,75 @@
|
|
1
1
|
{
|
2
2
|
"name": "@payloadcms/db-postgres",
|
3
|
-
"version": "3.0.0-beta.
|
3
|
+
"version": "3.0.0-beta.131",
|
4
4
|
"description": "The officially supported Postgres database adapter for Payload",
|
5
|
+
"homepage": "https://payloadcms.com",
|
5
6
|
"repository": {
|
6
7
|
"type": "git",
|
7
8
|
"url": "https://github.com/payloadcms/payload.git",
|
8
9
|
"directory": "packages/db-postgres"
|
9
10
|
},
|
10
11
|
"license": "MIT",
|
11
|
-
"
|
12
|
+
"author": "Payload <dev@payloadcms.com> (https://payloadcms.com)",
|
13
|
+
"maintainers": [
|
14
|
+
{
|
15
|
+
"name": "Payload",
|
16
|
+
"email": "info@payloadcms.com",
|
17
|
+
"url": "https://payloadcms.com"
|
18
|
+
}
|
19
|
+
],
|
12
20
|
"type": "module",
|
13
|
-
"
|
14
|
-
"
|
15
|
-
|
16
|
-
|
21
|
+
"exports": {
|
22
|
+
".": {
|
23
|
+
"import": "./dist/index.js",
|
24
|
+
"types": "./dist/index.d.ts",
|
25
|
+
"default": "./dist/index.js"
|
26
|
+
},
|
27
|
+
"./types": {
|
28
|
+
"import": "./dist/types.js",
|
29
|
+
"types": "./dist/types.d.ts",
|
30
|
+
"default": "./dist/types.js"
|
31
|
+
},
|
32
|
+
"./migration-utils": {
|
33
|
+
"import": "./dist/exports/migration-utils.js",
|
34
|
+
"types": "./dist/exports/migration-utils.d.ts",
|
35
|
+
"default": "./dist/exports/migration-utils.js"
|
36
|
+
}
|
17
37
|
},
|
18
38
|
"main": "./dist/index.js",
|
19
39
|
"types": "./dist/index.d.ts",
|
40
|
+
"files": [
|
41
|
+
"dist",
|
42
|
+
"mock.js"
|
43
|
+
],
|
20
44
|
"dependencies": {
|
21
|
-
"@
|
22
|
-
"console-table-printer": "2.
|
23
|
-
"drizzle-kit": "0.
|
24
|
-
"drizzle-orm": "0.
|
45
|
+
"@types/pg": "8.10.2",
|
46
|
+
"console-table-printer": "2.12.1",
|
47
|
+
"drizzle-kit": "0.28.0",
|
48
|
+
"drizzle-orm": "0.36.1",
|
25
49
|
"pg": "8.11.3",
|
26
50
|
"prompts": "2.4.2",
|
27
51
|
"to-snake-case": "1.0.0",
|
28
|
-
"uuid": "
|
52
|
+
"uuid": "10.0.0",
|
53
|
+
"@payloadcms/drizzle": "3.0.0-beta.131"
|
29
54
|
},
|
30
55
|
"devDependencies": {
|
31
|
-
"@
|
56
|
+
"@hyrious/esbuild-plugin-commonjs": "^0.2.4",
|
32
57
|
"@types/to-snake-case": "1.0.0",
|
33
|
-
"
|
34
|
-
"
|
58
|
+
"esbuild": "0.23.1",
|
59
|
+
"@payloadcms/eslint-config": "3.0.0-beta.112",
|
60
|
+
"payload": "3.0.0-beta.131"
|
35
61
|
},
|
36
62
|
"peerDependencies": {
|
37
|
-
"payload": "3.0.0-beta.
|
63
|
+
"payload": "3.0.0-beta.131"
|
38
64
|
},
|
39
|
-
"exports": {
|
40
|
-
".": {
|
41
|
-
"import": "./dist/index.js",
|
42
|
-
"require": "./dist/index.js",
|
43
|
-
"types": "./dist/index.d.ts"
|
44
|
-
},
|
45
|
-
"./types": {
|
46
|
-
"import": "./dist/types.js",
|
47
|
-
"require": "./dist/types.js",
|
48
|
-
"types": "./dist/types.d.ts"
|
49
|
-
}
|
50
|
-
},
|
51
|
-
"files": [
|
52
|
-
"dist",
|
53
|
-
"mock.js"
|
54
|
-
],
|
55
65
|
"scripts": {
|
56
|
-
"build": "pnpm build:swc && pnpm build:
|
57
|
-
"build:
|
66
|
+
"build": "rimraf .dist && rimraf tsconfig.tsbuildinfo && pnpm build:types && pnpm build:swc && pnpm build:esbuild && pnpm renamePredefinedMigrations",
|
67
|
+
"build:esbuild": "echo skipping esbuild",
|
68
|
+
"build:swc": "swc ./src -d ./dist --config-file .swcrc --strip-leading-paths",
|
58
69
|
"build:types": "tsc --emitDeclarationOnly --outDir dist",
|
59
|
-
"clean": "rimraf {dist,*.tsbuildinfo}"
|
70
|
+
"clean": "rimraf {dist,*.tsbuildinfo}",
|
71
|
+
"lint": "eslint .",
|
72
|
+
"lint:fix": "eslint . --fix",
|
73
|
+
"renamePredefinedMigrations": "node --no-deprecation --import @swc-node/register/esm-register ./scripts/renamePredefinedMigrations.ts"
|
60
74
|
}
|
61
75
|
}
|
package/dist/count.d.ts
DELETED
package/dist/count.d.ts.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"count.d.ts","sourceRoot":"","sources":["../src/count.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AAY7C,eAAO,MAAM,KAAK,EAAE,KAoDnB,CAAA"}
|
package/dist/count.js
DELETED
@@ -1,53 +0,0 @@
|
|
1
|
-
import { sql } from 'drizzle-orm';
|
2
|
-
import { chainMethods } from './find/chainMethods.js';
|
3
|
-
import buildQuery from './queries/buildQuery.js';
|
4
|
-
import { getTableName } from './schema/getTableName.js';
|
5
|
-
export const count = async function count({ collection, locale, req, where: whereArg }) {
|
6
|
-
const collectionConfig = this.payload.collections[collection].config;
|
7
|
-
const tableName = getTableName({
|
8
|
-
adapter: this,
|
9
|
-
config: collectionConfig
|
10
|
-
});
|
11
|
-
const db = this.sessions[req.transactionID]?.db || this.drizzle;
|
12
|
-
const table = this.tables[tableName];
|
13
|
-
const { joinAliases, joins, where } = await buildQuery({
|
14
|
-
adapter: this,
|
15
|
-
fields: collectionConfig.fields,
|
16
|
-
locale,
|
17
|
-
tableName,
|
18
|
-
where: whereArg
|
19
|
-
});
|
20
|
-
const selectCountMethods = [];
|
21
|
-
joinAliases.forEach(({ condition, table })=>{
|
22
|
-
selectCountMethods.push({
|
23
|
-
args: [
|
24
|
-
table,
|
25
|
-
condition
|
26
|
-
],
|
27
|
-
method: 'leftJoin'
|
28
|
-
});
|
29
|
-
});
|
30
|
-
Object.entries(joins).forEach(([joinTable, condition])=>{
|
31
|
-
if (joinTable) {
|
32
|
-
selectCountMethods.push({
|
33
|
-
args: [
|
34
|
-
this.tables[joinTable],
|
35
|
-
condition
|
36
|
-
],
|
37
|
-
method: 'leftJoin'
|
38
|
-
});
|
39
|
-
}
|
40
|
-
});
|
41
|
-
const countResult = await chainMethods({
|
42
|
-
methods: selectCountMethods,
|
43
|
-
query: db.select({
|
44
|
-
count: sql`count
|
45
|
-
(DISTINCT ${this.tables[tableName].id})`
|
46
|
-
}).from(table).where(where)
|
47
|
-
});
|
48
|
-
return {
|
49
|
-
totalDocs: Number(countResult[0].count)
|
50
|
-
};
|
51
|
-
};
|
52
|
-
|
53
|
-
//# sourceMappingURL=count.js.map
|
package/dist/count.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../src/count.ts"],"sourcesContent":["import type { Count } from 'payload/database'\nimport type { SanitizedCollectionConfig } from 'payload/types'\n\nimport { sql } from 'drizzle-orm'\n\nimport type { ChainedMethods } from './find/chainMethods.js'\nimport type { PostgresAdapter } from './types.js'\n\nimport { chainMethods } from './find/chainMethods.js'\nimport buildQuery from './queries/buildQuery.js'\nimport { getTableName } from './schema/getTableName.js'\n\nexport const count: Count = async function count(\n this: PostgresAdapter,\n { collection, locale, req, where: whereArg },\n) {\n const collectionConfig: SanitizedCollectionConfig = this.payload.collections[collection].config\n\n const tableName = getTableName({\n adapter: this,\n config: collectionConfig,\n })\n\n const db = this.sessions[req.transactionID]?.db || this.drizzle\n const table = this.tables[tableName]\n\n const { joinAliases, joins, where } = await buildQuery({\n adapter: this,\n fields: collectionConfig.fields,\n locale,\n tableName,\n where: whereArg,\n })\n\n const selectCountMethods: ChainedMethods = []\n\n joinAliases.forEach(({ condition, table }) => {\n selectCountMethods.push({\n args: [table, condition],\n method: 'leftJoin',\n })\n })\n\n Object.entries(joins).forEach(([joinTable, condition]) => {\n if (joinTable) {\n selectCountMethods.push({\n args: [this.tables[joinTable], condition],\n method: 'leftJoin',\n })\n }\n })\n\n const countResult = await chainMethods({\n methods: selectCountMethods,\n query: db\n .select({\n count: sql<number>`count\n (DISTINCT ${this.tables[tableName].id})`,\n })\n .from(table)\n .where(where),\n })\n\n return { totalDocs: Number(countResult[0].count) }\n}\n"],"names":["sql","chainMethods","buildQuery","getTableName","count","collection","locale","req","where","whereArg","collectionConfig","payload","collections","config","tableName","adapter","db","sessions","transactionID","drizzle","table","tables","joinAliases","joins","fields","selectCountMethods","forEach","condition","push","args","method","Object","entries","joinTable","countResult","methods","query","select","id","from","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,OAAOpB,GACJqB,MAAM,CAAC;YACNjC,OAAOJ,GAAW,CAAC;sBACL,EAAE,IAAI,CAACqB,MAAM,CAACP,UAAU,CAACwB,EAAE,CAAC,CAAC,CAAC;QAC9C,GACCC,IAAI,CAACnB,OACLZ,KAAK,CAACA;IACX;IAEA,OAAO;QAAEgC,WAAWC,OAAOP,WAAW,CAAC,EAAE,CAAC9B,KAAK;IAAE;AACnD,EAAC"}
|
package/dist/create.d.ts
DELETED
package/dist/create.d.ts.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../src/create.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAO9C,eAAO,MAAM,MAAM,EAAE,MAqBpB,CAAA"}
|
package/dist/create.js
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
import { getTableName } from './schema/getTableName.js';
|
2
|
-
import { upsertRow } from './upsertRow/index.js';
|
3
|
-
export const create = async function create({ collection: collectionSlug, data, req }) {
|
4
|
-
const db = this.sessions[req.transactionID]?.db || this.drizzle;
|
5
|
-
const collection = this.payload.collections[collectionSlug].config;
|
6
|
-
const result = await upsertRow({
|
7
|
-
adapter: this,
|
8
|
-
data,
|
9
|
-
db,
|
10
|
-
fields: collection.fields,
|
11
|
-
operation: 'create',
|
12
|
-
req,
|
13
|
-
tableName: getTableName({
|
14
|
-
adapter: this,
|
15
|
-
config: collection
|
16
|
-
})
|
17
|
-
});
|
18
|
-
return result;
|
19
|
-
};
|
20
|
-
|
21
|
-
//# sourceMappingURL=create.js.map
|
package/dist/create.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../src/create.ts"],"sourcesContent":["import type { Create } from 'payload/database'\n\nimport type { PostgresAdapter } from './types.js'\n\nimport { getTableName } from './schema/getTableName.js'\nimport { upsertRow } from './upsertRow/index.js'\n\nexport const create: Create = async function create(\n this: PostgresAdapter,\n { collection: collectionSlug, data, req },\n) {\n const db = this.sessions[req.transactionID]?.db || this.drizzle\n const collection = this.payload.collections[collectionSlug].config\n\n const result = await upsertRow({\n adapter: this,\n data,\n db,\n fields: collection.fields,\n operation: 'create',\n req,\n tableName: getTableName({\n adapter: this,\n config: collection,\n }),\n })\n\n return result\n}\n"],"names":["getTableName","upsertRow","create","collection","collectionSlug","data","req","db","sessions","transactionID","drizzle","payload","collections","config","result","adapter","fields","operation","tableName"],"rangeMappings":";;;;;;;;;;;;;;;;;;","mappings":"AAIA,SAASA,YAAY,QAAQ,2BAA0B;AACvD,SAASC,SAAS,QAAQ,uBAAsB;AAEhD,OAAO,MAAMC,SAAiB,eAAeA,OAE3C,EAAEC,YAAYC,cAAc,EAAEC,IAAI,EAAEC,GAAG,EAAE;IAEzC,MAAMC,KAAK,IAAI,CAACC,QAAQ,CAACF,IAAIG,aAAa,CAAC,EAAEF,MAAM,IAAI,CAACG,OAAO;IAC/D,MAAMP,aAAa,IAAI,CAACQ,OAAO,CAACC,WAAW,CAACR,eAAe,CAACS,MAAM;IAElE,MAAMC,SAAS,MAAMb,UAAU;QAC7Bc,SAAS,IAAI;QACbV;QACAE;QACAS,QAAQb,WAAWa,MAAM;QACzBC,WAAW;QACXX;QACAY,WAAWlB,aAAa;YACtBe,SAAS,IAAI;YACbF,QAAQV;QACV;IACF;IAEA,OAAOW;AACT,EAAC"}
|
package/dist/createGlobal.d.ts
DELETED
@@ -1,5 +0,0 @@
|
|
1
|
-
import type { CreateGlobalArgs } from 'payload/database';
|
2
|
-
import type { TypeWithID } from 'payload/types';
|
3
|
-
import type { PostgresAdapter } from './types.js';
|
4
|
-
export declare function createGlobal<T extends TypeWithID>(this: PostgresAdapter, { slug, data, req }: CreateGlobalArgs): Promise<T>;
|
5
|
-
//# sourceMappingURL=createGlobal.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"createGlobal.d.ts","sourceRoot":"","sources":["../src/createGlobal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AACxD,OAAO,KAAK,EAAkB,UAAU,EAAE,MAAM,eAAe,CAAA;AAE/D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAKjD,wBAAsB,YAAY,CAAC,CAAC,SAAS,UAAU,EACrD,IAAI,EAAE,eAAe,EACrB,EAAE,IAAI,EAAE,IAAI,EAAE,GAA0B,EAAE,EAAE,gBAAgB,GAC3D,OAAO,CAAC,CAAC,CAAC,CAkBZ"}
|
package/dist/createGlobal.js
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
import { getTableName } from './schema/getTableName.js';
|
2
|
-
import { upsertRow } from './upsertRow/index.js';
|
3
|
-
export async function createGlobal({ slug, data, req = {} }) {
|
4
|
-
const db = this.sessions[req.transactionID]?.db || this.drizzle;
|
5
|
-
const globalConfig = this.payload.globals.config.find((config)=>config.slug === slug);
|
6
|
-
const result = await upsertRow({
|
7
|
-
adapter: this,
|
8
|
-
data,
|
9
|
-
db,
|
10
|
-
fields: globalConfig.fields,
|
11
|
-
operation: 'create',
|
12
|
-
req,
|
13
|
-
tableName: getTableName({
|
14
|
-
adapter: this,
|
15
|
-
config: globalConfig
|
16
|
-
})
|
17
|
-
});
|
18
|
-
return result;
|
19
|
-
}
|
20
|
-
|
21
|
-
//# sourceMappingURL=createGlobal.js.map
|
package/dist/createGlobal.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../src/createGlobal.ts"],"sourcesContent":["import type { CreateGlobalArgs } from 'payload/database'\nimport type { PayloadRequest, TypeWithID } from 'payload/types'\n\nimport type { PostgresAdapter } from './types.js'\n\nimport { getTableName } from './schema/getTableName.js'\nimport { upsertRow } from './upsertRow/index.js'\n\nexport async function createGlobal<T extends TypeWithID>(\n this: PostgresAdapter,\n { slug, data, req = {} as PayloadRequest }: CreateGlobalArgs,\n): Promise<T> {\n const db = this.sessions[req.transactionID]?.db || this.drizzle\n const globalConfig = this.payload.globals.config.find((config) => config.slug === slug)\n\n const result = await upsertRow<T>({\n adapter: this,\n data,\n db,\n fields: globalConfig.fields,\n operation: 'create',\n req,\n tableName: getTableName({\n adapter: this,\n config: globalConfig,\n }),\n })\n\n return result\n}\n"],"names":["getTableName","upsertRow","createGlobal","slug","data","req","db","sessions","transactionID","drizzle","globalConfig","payload","globals","config","find","result","adapter","fields","operation","tableName"],"rangeMappings":";;;;;;;;;;;;;;;;;;","mappings":"AAKA,SAASA,YAAY,QAAQ,2BAA0B;AACvD,SAASC,SAAS,QAAQ,uBAAsB;AAEhD,OAAO,eAAeC,aAEpB,EAAEC,IAAI,EAAEC,IAAI,EAAEC,MAAM,CAAC,CAAmB,EAAoB;IAE5D,MAAMC,KAAK,IAAI,CAACC,QAAQ,CAACF,IAAIG,aAAa,CAAC,EAAEF,MAAM,IAAI,CAACG,OAAO;IAC/D,MAAMC,eAAe,IAAI,CAACC,OAAO,CAACC,OAAO,CAACC,MAAM,CAACC,IAAI,CAAC,CAACD,SAAWA,OAAOV,IAAI,KAAKA;IAElF,MAAMY,SAAS,MAAMd,UAAa;QAChCe,SAAS,IAAI;QACbZ;QACAE;QACAW,QAAQP,aAAaO,MAAM;QAC3BC,WAAW;QACXb;QACAc,WAAWnB,aAAa;YACtBgB,SAAS,IAAI;YACbH,QAAQH;QACV;IACF;IAEA,OAAOK;AACT"}
|
@@ -1,6 +0,0 @@
|
|
1
|
-
import type { TypeWithVersion } from 'payload/database';
|
2
|
-
import type { TypeWithID } from 'payload/types';
|
3
|
-
import { type CreateGlobalVersionArgs } from 'payload/database';
|
4
|
-
import type { PostgresAdapter } from './types.js';
|
5
|
-
export declare function createGlobalVersion<T extends TypeWithID>(this: PostgresAdapter, { autosave, globalSlug, req, versionData }: CreateGlobalVersionArgs): Promise<TypeWithVersion<T>>;
|
6
|
-
//# sourceMappingURL=createGlobalVersion.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"createGlobalVersion.d.ts","sourceRoot":"","sources":["../src/createGlobalVersion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AACvD,OAAO,KAAK,EAAkB,UAAU,EAAE,MAAM,eAAe,CAAA;AAG/D,OAAO,EAAE,KAAK,uBAAuB,EAAE,MAAM,kBAAkB,CAAA;AAG/D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAKjD,wBAAsB,mBAAmB,CAAC,CAAC,SAAS,UAAU,EAC5D,IAAI,EAAE,eAAe,EACrB,EAAE,QAAQ,EAAE,UAAU,EAAE,GAA0B,EAAE,WAAW,EAAE,EAAE,uBAAuB,+BAmC3F"}
|
@@ -1,37 +0,0 @@
|
|
1
|
-
import { sql } from 'drizzle-orm';
|
2
|
-
import { buildVersionGlobalFields } from 'payload/versions';
|
3
|
-
import { getTableName } from './schema/getTableName.js';
|
4
|
-
import { upsertRow } from './upsertRow/index.js';
|
5
|
-
export async function createGlobalVersion({ autosave, globalSlug, req = {}, versionData }) {
|
6
|
-
const db = this.sessions[req.transactionID]?.db || this.drizzle;
|
7
|
-
const global = this.payload.globals.config.find(({ slug })=>slug === globalSlug);
|
8
|
-
const tableName = getTableName({
|
9
|
-
adapter: this,
|
10
|
-
config: global,
|
11
|
-
versions: true
|
12
|
-
});
|
13
|
-
const result = await upsertRow({
|
14
|
-
adapter: this,
|
15
|
-
data: {
|
16
|
-
autosave,
|
17
|
-
latest: true,
|
18
|
-
version: versionData
|
19
|
-
},
|
20
|
-
db,
|
21
|
-
fields: buildVersionGlobalFields(global),
|
22
|
-
operation: 'create',
|
23
|
-
req,
|
24
|
-
tableName
|
25
|
-
});
|
26
|
-
const table = this.tables[tableName];
|
27
|
-
if (global.versions.drafts) {
|
28
|
-
await db.execute(sql`
|
29
|
-
UPDATE ${table}
|
30
|
-
SET latest = false
|
31
|
-
WHERE ${table.id} != ${result.id};
|
32
|
-
`);
|
33
|
-
}
|
34
|
-
return result;
|
35
|
-
}
|
36
|
-
|
37
|
-
//# sourceMappingURL=createGlobalVersion.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../src/createGlobalVersion.ts"],"sourcesContent":["import type { TypeWithVersion } from 'payload/database'\nimport type { PayloadRequest, TypeWithID } from 'payload/types'\n\nimport { sql } from 'drizzle-orm'\nimport { type CreateGlobalVersionArgs } from 'payload/database'\nimport { buildVersionGlobalFields } from 'payload/versions'\n\nimport type { PostgresAdapter } from './types.js'\n\nimport { getTableName } from './schema/getTableName.js'\nimport { upsertRow } from './upsertRow/index.js'\n\nexport async function createGlobalVersion<T extends TypeWithID>(\n this: PostgresAdapter,\n { autosave, globalSlug, req = {} as PayloadRequest, versionData }: CreateGlobalVersionArgs,\n) {\n const db = this.sessions[req.transactionID]?.db || this.drizzle\n const global = this.payload.globals.config.find(({ slug }) => slug === globalSlug)\n const tableName = getTableName({\n adapter: this,\n config: global,\n versions: true,\n })\n\n const result = await upsertRow<TypeWithVersion<T>>({\n adapter: this,\n data: {\n autosave,\n latest: true,\n version: versionData,\n },\n db,\n fields: buildVersionGlobalFields(global),\n operation: 'create',\n req,\n tableName,\n })\n\n const table = this.tables[tableName]\n\n if (global.versions.drafts) {\n await db.execute(sql`\n UPDATE ${table}\n SET latest = false\n WHERE ${table.id} != ${result.id};\n `)\n }\n\n return result\n}\n"],"names":["sql","buildVersionGlobalFields","getTableName","upsertRow","createGlobalVersion","autosave","globalSlug","req","versionData","db","sessions","transactionID","drizzle","global","payload","globals","config","find","slug","tableName","adapter","versions","result","data","latest","version","fields","operation","table","tables","drafts","execute","id"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAGA,SAASA,GAAG,QAAQ,cAAa;AAEjC,SAASC,wBAAwB,QAAQ,mBAAkB;AAI3D,SAASC,YAAY,QAAQ,2BAA0B;AACvD,SAASC,SAAS,QAAQ,uBAAsB;AAEhD,OAAO,eAAeC,o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