@payloadcms/db-postgres 3.0.0-canary.f6e77b8 → 3.0.0-canary.fb81f02
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 +17 -51
- package/dist/connect.js.map +1 -1
- package/dist/connectionHelpers/nodePostgres.d.ts +11 -0
- package/dist/connectionHelpers/nodePostgres.d.ts.map +1 -0
- package/dist/connectionHelpers/nodePostgres.js +6 -0
- package/dist/connectionHelpers/nodePostgres.js.map +1 -0
- package/dist/countDistinct.d.ts +3 -0
- package/dist/countDistinct.d.ts.map +1 -0
- package/dist/countDistinct.js +24 -0
- package/dist/countDistinct.js.map +1 -0
- package/dist/createJSONQuery/convertPathToJSONTraversal.d.ts.map +1 -0
- package/dist/createJSONQuery/convertPathToJSONTraversal.js.map +1 -0
- package/dist/createJSONQuery/formatJSONPathSegment.d.ts.map +1 -0
- package/dist/createJSONQuery/formatJSONPathSegment.js.map +1 -0
- package/dist/createJSONQuery/index.d.ts.map +1 -0
- package/dist/createJSONQuery/index.js.map +1 -0
- package/dist/createMigration.d.ts +1 -1
- package/dist/createMigration.d.ts.map +1 -1
- package/dist/createMigration.js +67 -57
- package/dist/createMigration.js.map +1 -1
- package/dist/defaultSnapshot.d.ts +3 -0
- package/dist/defaultSnapshot.d.ts.map +1 -0
- package/dist/defaultSnapshot.js +17 -0
- package/dist/defaultSnapshot.js.map +1 -0
- package/dist/deleteWhere.d.ts +3 -0
- package/dist/deleteWhere.d.ts.map +1 -0
- package/dist/deleteWhere.js +6 -0
- package/dist/deleteWhere.js.map +1 -0
- package/dist/dropDatabase.d.ts +3 -0
- package/dist/dropDatabase.d.ts.map +1 -0
- package/dist/dropDatabase.js +9 -0
- package/dist/dropDatabase.js.map +1 -0
- package/dist/execute.d.ts +3 -0
- package/dist/execute.d.ts.map +1 -0
- package/dist/execute.js +11 -0
- package/dist/execute.js.map +1 -0
- 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/getMigrationTemplate.d.ts +4 -0
- package/dist/getMigrationTemplate.d.ts.map +1 -0
- package/dist/getMigrationTemplate.js +13 -0
- package/dist/getMigrationTemplate.js.map +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +51 -66
- package/dist/index.js.map +1 -1
- package/dist/init.d.ts +1 -1
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +17 -30
- package/dist/init.js.map +1 -1
- package/dist/insert.d.ts +3 -0
- package/dist/insert.d.ts.map +1 -0
- package/dist/insert.js +12 -0
- package/dist/insert.js.map +1 -0
- 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 +191 -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 +57 -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/requireDrizzleKit.d.ts +3 -0
- package/dist/requireDrizzleKit.d.ts.map +1 -0
- package/dist/requireDrizzleKit.js +5 -0
- package/dist/requireDrizzleKit.js.map +1 -0
- package/dist/schema/build.d.ts +9 -5
- package/dist/schema/build.d.ts.map +1 -1
- package/dist/schema/build.js +163 -114
- package/dist/schema/build.js.map +1 -1
- package/dist/schema/createIndex.d.ts.map +1 -1
- package/dist/schema/createIndex.js +1 -1
- package/dist/schema/createIndex.js.map +1 -1
- package/dist/schema/idToUUID.d.ts +1 -1
- package/dist/schema/idToUUID.d.ts.map +1 -1
- package/dist/schema/idToUUID.js.map +1 -1
- package/dist/schema/parentIDColumnMap.js.map +1 -1
- package/dist/schema/setColumnID.d.ts +1 -1
- package/dist/schema/setColumnID.d.ts.map +1 -1
- package/dist/schema/setColumnID.js +2 -2
- package/dist/schema/setColumnID.js.map +1 -1
- package/dist/schema/traverseFields.d.ts +5 -7
- package/dist/schema/traverseFields.d.ts.map +1 -1
- package/dist/schema/traverseFields.js +118 -56
- package/dist/schema/traverseFields.js.map +1 -1
- package/dist/schema/withDefault.d.ts +4 -0
- package/dist/schema/withDefault.d.ts.map +1 -0
- package/dist/schema/withDefault.js +10 -0
- package/dist/schema/withDefault.js.map +1 -0
- package/dist/types.d.ts +111 -39
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +25 -15
- package/dist/count.d.ts +0 -3
- package/dist/count.d.ts.map +0 -1
- package/dist/count.js +0 -50
- 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 -19
- 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 -19
- 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 -33
- package/dist/createGlobalVersion.js.map +0 -1
- package/dist/createVersion.d.ts +0 -5
- package/dist/createVersion.d.ts.map +0 -1
- package/dist/createVersion.js +0 -44
- 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 -28
- 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 -59
- 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 -31
- 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 -11
- 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 -138
- 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 -21
- 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 -23
- 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 -24
- 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 -21
- 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 -24
- package/dist/findVersions.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.map +0 -1
- package/dist/queries/createJSONQuery/convertPathToJSONTraversal.js.map +0 -1
- package/dist/queries/createJSONQuery/formatJSONPathSegment.d.ts.map +0 -1
- package/dist/queries/createJSONQuery/formatJSONPathSegment.js.map +0 -1
- package/dist/queries/createJSONQuery/index.d.ts.map +0 -1
- 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 -445
- 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 -41
- package/dist/queryDrafts.js.map +0 -1
- package/dist/schema/createTableName.d.ts +0 -30
- package/dist/schema/createTableName.d.ts.map +0 -1
- package/dist/schema/createTableName.js +0 -31
- package/dist/schema/createTableName.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 -55
- 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 -25
- 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 -36
- 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 -36
- 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 -277
- 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/{queries/createJSONQuery → createJSONQuery}/convertPathToJSONTraversal.d.ts +0 -0
- /package/dist/{queries/createJSONQuery → createJSONQuery}/convertPathToJSONTraversal.js +0 -0
- /package/dist/{queries/createJSONQuery → createJSONQuery}/formatJSONPathSegment.d.ts +0 -0
- /package/dist/{queries/createJSONQuery → createJSONQuery}/formatJSONPathSegment.js +0 -0
- /package/dist/{queries/createJSONQuery → createJSONQuery}/index.d.ts +0 -0
- /package/dist/{queries/createJSONQuery → createJSONQuery}/index.js +0 -0
package/dist/types.d.ts
CHANGED
@@ -1,21 +1,34 @@
|
|
1
|
-
import type {
|
2
|
-
import type {
|
3
|
-
import type {
|
1
|
+
import type { Operators } from '@payloadcms/drizzle';
|
2
|
+
import type { BuildQueryJoinAliases, DrizzleAdapter, TransactionPg } from '@payloadcms/drizzle/types';
|
3
|
+
import type { DrizzleSnapshotJSON } from 'drizzle-kit/api';
|
4
|
+
import type { ColumnBaseConfig, ColumnDataType, DrizzleConfig, Relation, Relations, SQL } from 'drizzle-orm';
|
5
|
+
import type { NodePgDatabase } from 'drizzle-orm/node-postgres';
|
6
|
+
import type { PgColumn, PgEnum, PgInsertOnConflictDoUpdateConfig, PgSchema, PgTableWithColumns, PgTransactionConfig, pgEnum } from 'drizzle-orm/pg-core';
|
4
7
|
import type { PgTableFn } from 'drizzle-orm/pg-core/table';
|
5
|
-
import type { Payload } from 'payload';
|
6
|
-
import type {
|
7
|
-
import type { PayloadRequestWithData } from 'payload/types';
|
8
|
-
import type { Pool, PoolConfig } from 'pg';
|
9
|
-
export type DrizzleDB = NodePgDatabase<Record<string, unknown>>;
|
8
|
+
import type { Payload, PayloadRequest } from 'payload';
|
9
|
+
import type { Pool, QueryResult } from 'pg';
|
10
10
|
export type Args = {
|
11
|
+
/**
|
12
|
+
* A function that connects to the database and returns the drizzle instance
|
13
|
+
*/
|
14
|
+
getDrizzle: PostgresAdapter['getDrizzle'];
|
11
15
|
idType?: 'serial' | 'uuid';
|
12
16
|
localesSuffix?: string;
|
13
17
|
logger?: DrizzleConfig['logger'];
|
14
18
|
migrationDir?: string;
|
15
|
-
|
19
|
+
prodMigrations?: {
|
20
|
+
down: (args: MigrateDownArgs) => Promise<void>;
|
21
|
+
name: string;
|
22
|
+
up: (args: MigrateUpArgs) => Promise<void>;
|
23
|
+
}[];
|
16
24
|
push?: boolean;
|
17
25
|
relationshipsSuffix?: string;
|
26
|
+
/**
|
27
|
+
* The schema name to use for the database
|
28
|
+
* @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.
|
29
|
+
*/
|
18
30
|
schemaName?: string;
|
31
|
+
transactionOptions?: PgTransactionConfig | false;
|
19
32
|
versionsSuffix?: string;
|
20
33
|
};
|
21
34
|
export type GenericColumn = PgColumn<ColumnBaseConfig<ColumnDataType, string>, Record<string, unknown>>;
|
@@ -26,75 +39,134 @@ export type GenericTable = PgTableWithColumns<{
|
|
26
39
|
columns: GenericColumns;
|
27
40
|
dialect: string;
|
28
41
|
name: string;
|
29
|
-
schema:
|
42
|
+
schema: string;
|
30
43
|
}>;
|
31
44
|
export type GenericEnum = PgEnum<[string, ...string[]]>;
|
32
45
|
export type GenericRelation = Relations<string, Record<string, Relation<string>>>;
|
33
|
-
export type
|
34
|
-
export type
|
35
|
-
|
46
|
+
export type PostgresDB = NodePgDatabase<Record<string, unknown>>;
|
47
|
+
export type CountDistinct = (args: {
|
48
|
+
db: PostgresDB | TransactionPg;
|
49
|
+
joins: BuildQueryJoinAliases;
|
50
|
+
tableName: string;
|
51
|
+
where: SQL;
|
52
|
+
}) => Promise<number>;
|
53
|
+
export type DeleteWhere = (args: {
|
54
|
+
db: PostgresDB | TransactionPg;
|
55
|
+
tableName: string;
|
56
|
+
where: SQL;
|
57
|
+
}) => Promise<void>;
|
58
|
+
export type DropDatabase = (args: {
|
59
|
+
adapter: PostgresAdapter;
|
60
|
+
}) => Promise<void>;
|
61
|
+
export type Execute<T> = (args: {
|
62
|
+
db?: PostgresDB | TransactionPg;
|
63
|
+
drizzle?: PostgresDB;
|
64
|
+
raw?: string;
|
65
|
+
sql?: SQL<unknown>;
|
66
|
+
}) => Promise<QueryResult<Record<string, T>>>;
|
67
|
+
export type Insert = (args: {
|
68
|
+
db: PostgresDB | TransactionPg;
|
69
|
+
onConflictDoUpdate?: PgInsertOnConflictDoUpdateConfig<any>;
|
70
|
+
tableName: string;
|
71
|
+
values: Record<string, unknown> | Record<string, unknown>[];
|
72
|
+
}) => Promise<Record<string, unknown>[]>;
|
73
|
+
type PostgresDrizzleAdapter = Omit<DrizzleAdapter, 'countDistinct' | 'deleteWhere' | 'drizzle' | 'dropDatabase' | 'execute' | 'insert' | 'operators' | 'relations'>;
|
74
|
+
type Schema = {
|
75
|
+
enum: typeof pgEnum;
|
76
|
+
table: PgTableFn;
|
77
|
+
} | PgSchema;
|
78
|
+
export type PostgresAdapter = {
|
79
|
+
countDistinct: CountDistinct;
|
80
|
+
defaultDrizzleSnapshot: DrizzleSnapshotJSON;
|
81
|
+
deleteWhere: DeleteWhere;
|
82
|
+
drizzle: PostgresDB;
|
83
|
+
dropDatabase: DropDatabase;
|
36
84
|
enums: Record<string, GenericEnum>;
|
85
|
+
execute: Execute<unknown>;
|
37
86
|
/**
|
38
87
|
* 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
|
39
88
|
* Used for returning properly formed errors from unique fields
|
40
89
|
*/
|
41
90
|
fieldConstraints: Record<string, Record<string, string>>;
|
91
|
+
/**
|
92
|
+
* A function that connects to the database and returns the drizzle instance
|
93
|
+
*/
|
94
|
+
getDrizzle: (args: Pick<DrizzleConfig<Record<string, unknown>>, 'logger' | 'schema'>) => {
|
95
|
+
drizzle: PostgresDB | TransactionPg;
|
96
|
+
} | Promise<{
|
97
|
+
drizzle: PostgresDB | TransactionPg;
|
98
|
+
}>;
|
42
99
|
idType: Args['idType'];
|
100
|
+
initializing: Promise<void>;
|
101
|
+
insert: Insert;
|
43
102
|
localesSuffix?: string;
|
44
103
|
logger: DrizzleConfig['logger'];
|
45
|
-
|
46
|
-
|
47
|
-
} | PgSchema;
|
104
|
+
operators: Operators;
|
105
|
+
pgSchema?: Schema;
|
48
106
|
pool: Pool;
|
49
|
-
|
107
|
+
prodMigrations?: {
|
108
|
+
down: (args: MigrateDownArgs) => Promise<void>;
|
109
|
+
name: string;
|
110
|
+
up: (args: MigrateUpArgs) => Promise<void>;
|
111
|
+
}[];
|
50
112
|
push: boolean;
|
113
|
+
rejectInitializing: () => void;
|
51
114
|
relations: Record<string, GenericRelation>;
|
52
115
|
relationshipsSuffix?: string;
|
53
|
-
|
116
|
+
resolveInitializing: () => void;
|
54
117
|
schemaName?: Args['schemaName'];
|
55
118
|
sessions: {
|
56
119
|
[id: string]: {
|
57
|
-
db:
|
120
|
+
db: PostgresDB | TransactionPg;
|
58
121
|
reject: () => Promise<void>;
|
59
122
|
resolve: () => Promise<void>;
|
60
123
|
};
|
61
124
|
};
|
62
125
|
tableNameMap: Map<string, string>;
|
63
|
-
tables: Record<string, GenericTable
|
126
|
+
tables: Record<string, GenericTable>;
|
64
127
|
versionsSuffix?: string;
|
65
|
-
};
|
128
|
+
} & PostgresDrizzleAdapter;
|
66
129
|
export type IDType = 'integer' | 'numeric' | 'uuid' | 'varchar';
|
67
|
-
export type PostgresAdapterResult = (args: {
|
68
|
-
payload: Payload;
|
69
|
-
}) => PostgresAdapter;
|
70
130
|
export type MigrateUpArgs = {
|
71
131
|
payload: Payload;
|
72
|
-
req?: Partial<
|
132
|
+
req?: Partial<PayloadRequest>;
|
73
133
|
};
|
74
134
|
export type MigrateDownArgs = {
|
75
135
|
payload: Payload;
|
76
|
-
req?: Partial<
|
136
|
+
req?: Partial<PayloadRequest>;
|
77
137
|
};
|
78
138
|
declare module 'payload' {
|
79
|
-
interface DatabaseAdapter extends Omit<Args, 'migrationDir' | 'pool'>,
|
80
|
-
|
139
|
+
interface DatabaseAdapter extends Omit<Args, 'idType' | 'logger' | 'migrationDir' | 'pool'>, DrizzleAdapter {
|
140
|
+
beginTransaction: (options?: PgTransactionConfig) => Promise<null | number | string>;
|
141
|
+
drizzle: PostgresDB;
|
81
142
|
enums: Record<string, GenericEnum>;
|
143
|
+
/**
|
144
|
+
* 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
|
145
|
+
* Used for returning properly formed errors from unique fields
|
146
|
+
*/
|
82
147
|
fieldConstraints: Record<string, Record<string, string>>;
|
83
|
-
|
148
|
+
idType: Args['idType'];
|
149
|
+
initializing: Promise<void>;
|
150
|
+
localesSuffix?: string;
|
151
|
+
logger: DrizzleConfig['logger'];
|
152
|
+
pgSchema?: {
|
153
|
+
table: PgTableFn;
|
154
|
+
} | PgSchema;
|
84
155
|
pool: Pool;
|
156
|
+
prodMigrations?: {
|
157
|
+
down: (args: MigrateDownArgs) => Promise<void>;
|
158
|
+
name: string;
|
159
|
+
up: (args: MigrateUpArgs) => Promise<void>;
|
160
|
+
}[];
|
85
161
|
push: boolean;
|
86
|
-
|
162
|
+
rejectInitializing: () => void;
|
87
163
|
relationshipsSuffix?: string;
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
reject: () => Promise<void>;
|
93
|
-
resolve: () => Promise<void>;
|
94
|
-
};
|
95
|
-
};
|
96
|
-
tables: Record<string, GenericTable>;
|
164
|
+
resolveInitializing: () => void;
|
165
|
+
schema: Record<string, unknown>;
|
166
|
+
schemaName?: Args['schemaName'];
|
167
|
+
tableNameMap: Map<string, string>;
|
97
168
|
versionsSuffix?: string;
|
98
169
|
}
|
99
170
|
}
|
171
|
+
export {};
|
100
172
|
//# sourceMappingURL=types.d.ts.map
|
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,
|
1
|
+
{"version":3,"file":"types.d.ts","s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|
+
{"version":3,"sources":["../src/types.ts"],"sourcesContent":["import type { Operators } from '@payloadcms/drizzle'\nimport type {\n BuildQueryJoinAliases,\n DrizzleAdapter,\n TransactionPg,\n} from '@payloadcms/drizzle/types'\nimport type { DrizzleSnapshotJSON } from 'drizzle-kit/api'\nimport type {\n ColumnBaseConfig,\n ColumnDataType,\n DrizzleConfig,\n Relation,\n Relations,\n SQL,\n} from 'drizzle-orm'\nimport type { NodePgDatabase } from 'drizzle-orm/node-postgres'\nimport type {\n PgColumn,\n PgEnum,\n PgInsertOnConflictDoUpdateConfig,\n PgSchema,\n PgTableWithColumns,\n PgTransactionConfig,\n pgEnum,\n} from 'drizzle-orm/pg-core'\nimport type { PgTableFn } from 'drizzle-orm/pg-core/table'\nimport type { Payload, PayloadRequest } from 'payload'\nimport type { Pool, QueryResult } from 'pg'\n\nexport type Args = {\n /**\n * A function that connects to the database and returns the drizzle instance\n */\n getDrizzle: PostgresAdapter['getDrizzle']\n idType?: 'serial' | 'uuid'\n localesSuffix?: string\n logger?: DrizzleConfig['logger']\n migrationDir?: string\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 transactionOptions?: PgTransactionConfig | false\n versionsSuffix?: string\n}\n\nexport type GenericColumn = PgColumn<\n ColumnBaseConfig<ColumnDataType, string>,\n Record<string, unknown>\n>\n\nexport type GenericColumns = {\n [x: string]: GenericColumn\n}\n\nexport type GenericTable = PgTableWithColumns<{\n columns: GenericColumns\n dialect: string\n name: string\n schema: string\n}>\n\nexport type GenericEnum = PgEnum<[string, ...string[]]>\n\nexport type GenericRelation = Relations<string, Record<string, Relation<string>>>\n\nexport type PostgresDB = NodePgDatabase<Record<string, unknown>>\n\nexport type CountDistinct = (args: {\n db: PostgresDB | TransactionPg\n joins: BuildQueryJoinAliases\n tableName: string\n where: SQL\n}) => Promise<number>\n\nexport type DeleteWhere = (args: {\n db: PostgresDB | TransactionPg\n tableName: string\n where: SQL\n}) => Promise<void>\n\nexport type DropDatabase = (args: { adapter: PostgresAdapter }) => Promise<void>\n\nexport type Execute<T> = (args: {\n db?: PostgresDB | TransactionPg\n drizzle?: PostgresDB\n raw?: string\n sql?: SQL<unknown>\n}) => Promise<QueryResult<Record<string, T>>>\n\nexport type Insert = (args: {\n db: PostgresDB | TransactionPg\n onConflictDoUpdate?: PgInsertOnConflictDoUpdateConfig<any>\n tableName: string\n values: Record<string, unknown> | Record<string, unknown>[]\n}) => Promise<Record<string, unknown>[]>\n\ntype PostgresDrizzleAdapter = Omit<\n DrizzleAdapter,\n | 'countDistinct'\n | 'deleteWhere'\n | 'drizzle'\n | 'dropDatabase'\n | 'execute'\n | 'insert'\n | 'operators'\n | 'relations'\n>\n\ntype Schema =\n | {\n enum: typeof pgEnum\n table: PgTableFn\n }\n | PgSchema\n\nexport type PostgresAdapter = {\n countDistinct: CountDistinct\n defaultDrizzleSnapshot: DrizzleSnapshotJSON\n deleteWhere: DeleteWhere\n drizzle: PostgresDB\n dropDatabase: DropDatabase\n enums: Record<string, GenericEnum>\n execute: Execute<unknown>\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 /**\n * A function that connects to the database and returns the drizzle instance\n */\n getDrizzle: (\n args: Pick<DrizzleConfig<Record<string, unknown>>, 'logger' | 'schema'>,\n ) => { drizzle: PostgresDB | TransactionPg } | Promise<{ drizzle: PostgresDB | TransactionPg }>\n idType: Args['idType']\n initializing: Promise<void>\n insert: Insert\n localesSuffix?: string\n logger: DrizzleConfig['logger']\n operators: Operators\n pgSchema?: Schema\n pool: 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 relations: Record<string, GenericRelation>\n relationshipsSuffix?: string\n resolveInitializing: () => void\n schemaName?: Args['schemaName']\n sessions: {\n [id: string]: {\n db: PostgresDB | TransactionPg\n reject: () => Promise<void>\n resolve: () => Promise<void>\n }\n }\n tableNameMap: Map<string, string>\n tables: Record<string, GenericTable>\n versionsSuffix?: string\n} & PostgresDrizzleAdapter\n\nexport type IDType = 'integer' | 'numeric' | 'uuid' | 'varchar'\n\nexport type MigrateUpArgs = { payload: Payload; req?: Partial<PayloadRequest> }\nexport type MigrateDownArgs = { payload: Payload; req?: Partial<PayloadRequest> }\n\ndeclare module 'payload' {\n export interface DatabaseAdapter\n extends Omit<Args, 'idType' | 'logger' | 'migrationDir' | 'pool'>,\n DrizzleAdapter {\n beginTransaction: (options?: PgTransactionConfig) => Promise<null | number | string>\n drizzle: PostgresDB\n enums: Record<string, GenericEnum>\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 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 versionsSuffix?: string\n }\n}\n"],"names":[],"mappings":"AAiLA,WAAiF"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@payloadcms/db-postgres",
|
3
|
-
"version": "3.0.0-canary.
|
3
|
+
"version": "3.0.0-canary.fb81f02",
|
4
4
|
"description": "The officially supported Postgres database adapter for Payload",
|
5
5
|
"homepage": "https://payloadcms.com",
|
6
6
|
"repository": {
|
@@ -14,13 +14,18 @@
|
|
14
14
|
"exports": {
|
15
15
|
".": {
|
16
16
|
"import": "./dist/index.js",
|
17
|
-
"
|
18
|
-
"
|
17
|
+
"types": "./dist/index.d.ts",
|
18
|
+
"default": "./dist/index.js"
|
19
19
|
},
|
20
20
|
"./types": {
|
21
21
|
"import": "./dist/types.js",
|
22
|
-
"
|
23
|
-
"
|
22
|
+
"types": "./dist/types.d.ts",
|
23
|
+
"default": "./dist/types.js"
|
24
|
+
},
|
25
|
+
"./migration-utils": {
|
26
|
+
"import": "./dist/exports/migration-utils.js",
|
27
|
+
"types": "./dist/exports/migration-utils.d.ts",
|
28
|
+
"default": "./dist/exports/migration-utils.js"
|
24
29
|
}
|
25
30
|
},
|
26
31
|
"main": "./dist/index.js",
|
@@ -30,28 +35,33 @@
|
|
30
35
|
"mock.js"
|
31
36
|
],
|
32
37
|
"dependencies": {
|
33
|
-
"@libsql/client": "^0.5.2",
|
34
38
|
"console-table-printer": "2.11.2",
|
35
|
-
"drizzle-kit": "0.
|
36
|
-
"drizzle-orm": "0.
|
39
|
+
"drizzle-kit": "0.23.2-df9e596",
|
40
|
+
"drizzle-orm": "0.32.1",
|
37
41
|
"pg": "8.11.3",
|
38
42
|
"prompts": "2.4.2",
|
39
43
|
"to-snake-case": "1.0.0",
|
40
|
-
"uuid": "
|
44
|
+
"uuid": "10.0.0",
|
45
|
+
"@payloadcms/drizzle": "3.0.0-canary.fb81f02"
|
41
46
|
},
|
42
47
|
"devDependencies": {
|
48
|
+
"@hyrious/esbuild-plugin-commonjs": "^0.2.4",
|
43
49
|
"@types/pg": "8.10.2",
|
44
50
|
"@types/to-snake-case": "1.0.0",
|
45
|
-
"@
|
46
|
-
"
|
51
|
+
"@vercel/postgres": "^0.9.0",
|
52
|
+
"esbuild": "0.23.0",
|
53
|
+
"payload": "3.0.0-canary.fb81f02",
|
54
|
+
"@payloadcms/eslint-config": "3.0.0-beta.59"
|
47
55
|
},
|
48
56
|
"peerDependencies": {
|
49
|
-
"payload": "3.0.0-canary.
|
57
|
+
"payload": "3.0.0-canary.fb81f02"
|
50
58
|
},
|
51
59
|
"scripts": {
|
52
|
-
"build": "pnpm build:swc && pnpm build:
|
53
|
-
"build:
|
60
|
+
"build": "rimraf .dist && rimraf tsconfig.tsbuildinfo && pnpm build:types && pnpm build:swc && pnpm build:esbuild && pnpm renamePredefinedMigrations",
|
61
|
+
"build:esbuild": "echo skipping esbuild",
|
62
|
+
"build:swc": "swc ./src -d ./dist --config-file .swcrc --strip-leading-paths",
|
54
63
|
"build:types": "tsc --emitDeclarationOnly --outDir dist",
|
55
|
-
"clean": "rimraf {dist,*.tsbuildinfo}"
|
64
|
+
"clean": "rimraf {dist,*.tsbuildinfo}",
|
65
|
+
"renamePredefinedMigrations": "tsx ./scripts/renamePredefinedMigrations.ts"
|
56
66
|
}
|
57
67
|
}
|
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,KAiDnB,CAAA"}
|
package/dist/count.js
DELETED
@@ -1,50 +0,0 @@
|
|
1
|
-
import { sql } from 'drizzle-orm';
|
2
|
-
import toSnakeCase from 'to-snake-case';
|
3
|
-
import { chainMethods } from './find/chainMethods.js';
|
4
|
-
import buildQuery from './queries/buildQuery.js';
|
5
|
-
export const count = async function count({ collection, locale, req, where: whereArg }) {
|
6
|
-
const collectionConfig = this.payload.collections[collection].config;
|
7
|
-
const tableName = this.tableNameMap.get(toSnakeCase(collectionConfig.slug));
|
8
|
-
const db = this.sessions[req.transactionID]?.db || this.drizzle;
|
9
|
-
const table = this.tables[tableName];
|
10
|
-
const { joinAliases, joins, where } = await buildQuery({
|
11
|
-
adapter: this,
|
12
|
-
fields: collectionConfig.fields,
|
13
|
-
locale,
|
14
|
-
tableName,
|
15
|
-
where: whereArg
|
16
|
-
});
|
17
|
-
const selectCountMethods = [];
|
18
|
-
joinAliases.forEach(({ condition, table })=>{
|
19
|
-
selectCountMethods.push({
|
20
|
-
args: [
|
21
|
-
table,
|
22
|
-
condition
|
23
|
-
],
|
24
|
-
method: 'leftJoin'
|
25
|
-
});
|
26
|
-
});
|
27
|
-
Object.entries(joins).forEach(([joinTable, condition])=>{
|
28
|
-
if (joinTable) {
|
29
|
-
selectCountMethods.push({
|
30
|
-
args: [
|
31
|
-
this.tables[joinTable],
|
32
|
-
condition
|
33
|
-
],
|
34
|
-
method: 'leftJoin'
|
35
|
-
});
|
36
|
-
}
|
37
|
-
});
|
38
|
-
const countResult = await chainMethods({
|
39
|
-
methods: selectCountMethods,
|
40
|
-
query: db.select({
|
41
|
-
count: sql`count
|
42
|
-
(DISTINCT ${this.tables[tableName].id})`
|
43
|
-
}).from(table).where(where)
|
44
|
-
});
|
45
|
-
return {
|
46
|
-
totalDocs: Number(countResult[0].count)
|
47
|
-
};
|
48
|
-
};
|
49
|
-
|
50
|
-
//# 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'\nimport toSnakeCase from 'to-snake-case'\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'\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 = this.tableNameMap.get(toSnakeCase(collectionConfig.slug))\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","toSnakeCase","chainMethods","buildQuery","count","collection","locale","req","where","whereArg","collectionConfig","payload","collections","config","tableName","tableNameMap","get","slug","db","sessions","transactionID","drizzle","table","tables","joinAliases","joins","adapter","fields","selectCountMethods","forEach","condition","push","args","method","Object","entries","joinTable","countResult","methods","query","select","id","from","totalDocs","Number"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAGA,SAASA,GAAG,QAAQ,cAAa;AACjC,OAAOC,iBAAiB,gBAAe;AAKvC,SAASC,YAAY,QAAQ,yBAAwB;AACrD,OAAOC,gBAAgB,0BAAyB;AAEhD,OAAO,MAAMC,QAAe,eAAeA,MAEzC,EAAEC,UAAU,EAAEC,MAAM,EAAEC,GAAG,EAAEC,OAAOC,QAAQ,EAAE;IAE5C,MAAMC,mBAA8C,IAAI,CAACC,OAAO,CAACC,WAAW,CAACP,WAAW,CAACQ,MAAM;IAE/F,MAAMC,YAAY,IAAI,CAACC,YAAY,CAACC,GAAG,CAACf,YAAYS,iBAAiBO,IAAI;IAEzE,MAAMC,KAAK,IAAI,CAACC,QAAQ,CAACZ,IAAIa,aAAa,CAAC,EAAEF,MAAM,IAAI,CAACG,OAAO;IAC/D,MAAMC,QAAQ,IAAI,CAACC,MAAM,CAACT,UAAU;IAEpC,MAAM,EAAEU,WAAW,EAAEC,KAAK,EAAEjB,KAAK,EAAE,GAAG,MAAML,WAAW;QACrDuB,SAAS,IAAI;QACbC,QAAQjB,iBAAiBiB,MAAM;QAC/BrB;QACAQ;QACAN,OAAOC;IACT;IAEA,MAAMmB,qBAAqC,EAAE;IAE7CJ,YAAYK,OAAO,CAAC,CAAC,EAAEC,SAAS,EAAER,KAAK,EAAE;QACvCM,mBAAmBG,IAAI,CAAC;YACtBC,MAAM;gBAACV;gBAAOQ;aAAU;YACxBG,QAAQ;QACV;IACF;IAEAC,OAAOC,OAAO,CAACV,OAAOI,OAAO,CAAC,CAAC,CAACO,WAAWN,UAAU;QACnD,IAAIM,WAAW;YACbR,mBAAmBG,IAAI,CAAC;gBACtBC,MAAM;oBAAC,IAAI,CAACT,MAAM,CAACa,UAAU;oBAAEN;iBAAU;gBACzCG,QAAQ;YACV;QACF;IACF;IAEA,MAAMI,cAAc,MAAMnC,aAAa;QACrCoC,SAASV;QACTW,OAAOrB,GACJsB,MAAM,CAAC;YACNpC,OAAOJ,GAAW,CAAC;sBACL,EAAE,IAAI,CAACuB,MAAM,CAACT,UAAU,CAAC2B,EAAE,CAAC,CAAC,CAAC;QAC9C,GACCC,IAAI,CAACpB,OACLd,KAAK,CAACA;IACX;IAEA,OAAO;QAAEmC,WAAWC,OAAOP,WAAW,CAAC,EAAE,CAACjC,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;AAQ9C,eAAO,MAAM,MAAM,EAAE,MAoBpB,CAAA"}
|
package/dist/create.js
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
import toSnakeCase from 'to-snake-case';
|
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 tableName = this.tableNameMap.get(toSnakeCase(collection.slug));
|
7
|
-
const result = await upsertRow({
|
8
|
-
adapter: this,
|
9
|
-
data,
|
10
|
-
db,
|
11
|
-
fields: collection.fields,
|
12
|
-
operation: 'create',
|
13
|
-
req,
|
14
|
-
tableName
|
15
|
-
});
|
16
|
-
return result;
|
17
|
-
};
|
18
|
-
|
19
|
-
//# 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 toSnakeCase from 'to-snake-case'\n\nimport type { PostgresAdapter } from './types.js'\n\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 tableName = this.tableNameMap.get(toSnakeCase(collection.slug))\n\n const result = await upsertRow({\n adapter: this,\n data,\n db,\n fields: collection.fields,\n operation: 'create',\n req,\n tableName,\n })\n\n return result\n}\n"],"names":["toSnakeCase","upsertRow","create","collection","collectionSlug","data","req","db","sessions","transactionID","drizzle","payload","collections","config","tableName","tableNameMap","get","slug","result","adapter","fields","operation"],"rangeMappings":";;;;;;;;;;;;;;;;","mappings":"AAEA,OAAOA,iBAAiB,gBAAe;AAIvC,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,YAAY,IAAI,CAACC,YAAY,CAACC,GAAG,CAAChB,YAAYG,WAAWc,IAAI;IAEnE,MAAMC,SAAS,MAAMjB,UAAU;QAC7BkB,SAAS,IAAI;QACbd;QACAE;QACAa,QAAQjB,WAAWiB,MAAM;QACzBC,WAAW;QACXf;QACAQ;IACF;IAEA,OAAOI;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,EAA0B,UAAU,EAAE,MAAM,eAAe,CAAA;AAIvE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAIjD,wBAAsB,YAAY,CAAC,CAAC,SAAS,UAAU,EACrD,IAAI,EAAE,eAAe,EACrB,EAAE,IAAI,EAAE,IAAI,EAAE,GAAkC,EAAE,EAAE,gBAAgB,GACnE,OAAO,CAAC,CAAC,CAAC,CAiBZ"}
|
package/dist/createGlobal.js
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
import toSnakeCase from 'to-snake-case';
|
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 tableName = this.tableNameMap.get(toSnakeCase(globalConfig.slug));
|
7
|
-
const result = await upsertRow({
|
8
|
-
adapter: this,
|
9
|
-
data,
|
10
|
-
db,
|
11
|
-
fields: globalConfig.fields,
|
12
|
-
operation: 'create',
|
13
|
-
req,
|
14
|
-
tableName
|
15
|
-
});
|
16
|
-
return result;
|
17
|
-
}
|
18
|
-
|
19
|
-
//# 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 { PayloadRequestWithData, TypeWithID } from 'payload/types'\n\nimport toSnakeCase from 'to-snake-case'\n\nimport type { PostgresAdapter } from './types.js'\n\nimport { upsertRow } from './upsertRow/index.js'\n\nexport async function createGlobal<T extends TypeWithID>(\n this: PostgresAdapter,\n { slug, data, req = {} as PayloadRequestWithData }: 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 tableName = this.tableNameMap.get(toSnakeCase(globalConfig.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,\n })\n\n return result\n}\n"],"names":["toSnakeCase","upsertRow","createGlobal","slug","data","req","db","sessions","transactionID","drizzle","globalConfig","payload","globals","config","find","tableName","tableNameMap","get","result","adapter","fields","operation"],"rangeMappings":";;;;;;;;;;;;;;;;","mappings":"AAGA,OAAOA,iBAAiB,gBAAe;AAIvC,SAASC,SAAS,QAAQ,uBAAsB;AAEhD,OAAO,eAAeC,aAEpB,EAAEC,IAAI,EAAEC,IAAI,EAAEC,MAAM,CAAC,CAA2B,EAAoB;IAEpE,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,YAAY,IAAI,CAACC,YAAY,CAACC,GAAG,CAACjB,YAAYU,aAAaP,IAAI;IAErE,MAAMe,SAAS,MAAMjB,UAAa;QAChCkB,SAAS,IAAI;QACbf;QACAE;QACAc,QAAQV,aAAaU,MAAM;QAC3BC,WAAW;QACXhB;QACAU;IACF;IAEA,OAAOG;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,EAA0B,UAAU,EAAE,MAAM,eAAe,CAAA;AAGvE,OAAO,EAAE,KAAK,uBAAuB,EAAE,MAAM,kBAAkB,CAAA;AAI/D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAIjD,wBAAsB,mBAAmB,CAAC,CAAC,SAAS,UAAU,EAC5D,IAAI,EAAE,eAAe,EACrB,EACE,QAAQ,EACR,UAAU,EACV,GAAkC,EAClC,WAAW,GACZ,EAAE,uBAAuB,+BAgC3B"}
|
@@ -1,33 +0,0 @@
|
|
1
|
-
import { sql } from 'drizzle-orm';
|
2
|
-
import { buildVersionGlobalFields } from 'payload/versions';
|
3
|
-
import toSnakeCase from 'to-snake-case';
|
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 = this.tableNameMap.get(`_${toSnakeCase(global.slug)}${this.versionsSuffix}`);
|
9
|
-
const result = await upsertRow({
|
10
|
-
adapter: this,
|
11
|
-
data: {
|
12
|
-
autosave,
|
13
|
-
latest: true,
|
14
|
-
version: versionData
|
15
|
-
},
|
16
|
-
db,
|
17
|
-
fields: buildVersionGlobalFields(global),
|
18
|
-
operation: 'create',
|
19
|
-
req,
|
20
|
-
tableName
|
21
|
-
});
|
22
|
-
const table = this.tables[tableName];
|
23
|
-
if (global.versions.drafts) {
|
24
|
-
await db.execute(sql`
|
25
|
-
UPDATE ${table}
|
26
|
-
SET latest = false
|
27
|
-
WHERE ${table.id} != ${result.id};
|
28
|
-
`);
|
29
|
-
}
|
30
|
-
return result;
|
31
|
-
}
|
32
|
-
|
33
|
-
//# sourceMappingURL=createGlobalVersion.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../src/createGlobalVersion.ts"],"sourcesContent":["import type { TypeWithVersion } from 'payload/database'\nimport type { PayloadRequestWithData, TypeWithID } from 'payload/types'\n\nimport { sql } from 'drizzle-orm'\nimport { type CreateGlobalVersionArgs } from 'payload/database'\nimport { buildVersionGlobalFields } from 'payload/versions'\nimport toSnakeCase from 'to-snake-case'\n\nimport type { PostgresAdapter } from './types.js'\n\nimport { upsertRow } from './upsertRow/index.js'\n\nexport async function createGlobalVersion<T extends TypeWithID>(\n this: PostgresAdapter,\n {\n autosave,\n globalSlug,\n req = {} as PayloadRequestWithData,\n versionData,\n }: CreateGlobalVersionArgs,\n) {\n const db = this.sessions[req.transactionID]?.db || this.drizzle\n const global = this.payload.globals.config.find(({ slug }) => slug === globalSlug)\n\n const tableName = this.tableNameMap.get(`_${toSnakeCase(global.slug)}${this.versionsSuffix}`)\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","toSnakeCase","upsertRow","createGlobalVersion","autosave","globalSlug","req","versionData","db","sessions","transactionID","drizzle","global","payload","globals","config","find","slug","tableName","tableNameMap","get","versionsSuffix","result","adapter","data","latest","version","fields","operation","table","tables","versions","drafts","execute","id"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAGA,SAASA,GAAG,QAAQ,cAAa;AAEjC,SAASC,wBAAwB,QAAQ,mBAAkB;AAC3D,OAAOC,iBAAiB,gBAAe;AAIvC,SAASC,SAAS,QAAQ,uBAAsB;AAEhD,OAAO,eAAeC,oBAEpB,EACEC,QAAQ,EACRC,UAAU,EACVC,MAAM,CAAC,CAA2B,EAClCC,WAAW,EACa;IAE1B,MAAMC,KAAK,IAAI,CAACC,QAAQ,CAACH,IAAII,aAAa,CAAC,EAAEF,MAAM,IAAI,CAACG,OAAO;IAC/D,MAAMC,SAAS,IAAI,CAACC,OAAO,CAACC,OAAO,CAACC,MAAM,CAACC,IAAI,CAAC,CAAC,EAAEC,IAAI,EAAE,GAAKA,SAASZ;IAEvE,MAAMa,YAAY,IAAI,CAACC,YAAY,CAACC,GAAG,CAAC,CAAC,CAAC,EAAEnB,YAAYW,OAAOK,IAAI,EAAE,EAAE,IAAI,CAACI,cAAc,CAAC,CAAC;IAE5F,MAAMC,SAAS,MAAMpB,UAA8B;QACjDqB,SAAS,IAAI;QACbC,MAAM;YACJpB;YACAqB,QAAQ;YACRC,SAASnB;QACX;QACAC;QACAmB,QAAQ3B,yBAAyBY;QACjCgB,WAAW;QACXtB;QACAY;IACF;IAEA,MAAMW,QAAQ,IAAI,CAACC,MAAM,CAACZ,UAAU;IAEpC,IAAIN,OAAOmB,QAAQ,CAACC,MAAM,EAAE;QAC1B,MAAMxB,GAAGyB,OAAO,CAAClC,GAAG,CAAC;aACZ,EAAE8B,MAAM;;YAET,EAAEA,MAAMK,EAAE,CAAC,IAAI,EAAEZ,OAAOY,EAAE,CAAC;IACnC,CAAC;IACH;IAEA,OAAOZ;AACT"}
|
package/dist/createVersion.d.ts
DELETED
@@ -1,5 +0,0 @@
|
|
1
|
-
import type { CreateVersionArgs, TypeWithVersion } from 'payload/database';
|
2
|
-
import type { TypeWithID } from 'payload/types';
|
3
|
-
import type { PostgresAdapter } from './types.js';
|
4
|
-
export declare function createVersion<T extends TypeWithID>(this: PostgresAdapter, { autosave, collectionSlug, parent, req, versionData, }: CreateVersionArgs<T>): Promise<TypeWithVersion<T>>;
|
5
|
-
//# sourceMappingURL=createVersion.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"createVersion.d.ts","sourceRoot":"","sources":["../src/createVersion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAC1E,OAAO,KAAK,EAA0B,UAAU,EAAE,MAAM,eAAe,CAAA;AAMvE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAIjD,wBAAsB,aAAa,CAAC,CAAC,SAAS,UAAU,EACtD,IAAI,EAAE,eAAe,EACrB,EACE,QAAQ,EACR,cAAc,EACd,MAAM,EACN,GAAkC,EAClC,WAAW,GACZ,EAAE,iBAAiB,CAAC,CAAC,CAAC,+BA4CxB"}
|
package/dist/createVersion.js
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
import { sql } from 'drizzle-orm';
|
2
|
-
import { buildVersionCollectionFields } from 'payload/versions';
|
3
|
-
import toSnakeCase from 'to-snake-case';
|
4
|
-
import { upsertRow } from './upsertRow/index.js';
|
5
|
-
export async function createVersion({ autosave, collectionSlug, parent, req = {}, versionData }) {
|
6
|
-
const db = this.sessions[req.transactionID]?.db || this.drizzle;
|
7
|
-
const collection = this.payload.collections[collectionSlug].config;
|
8
|
-
const defaultTableName = toSnakeCase(collection.slug);
|
9
|
-
const tableName = this.tableNameMap.get(`_${defaultTableName}${this.versionsSuffix}`);
|
10
|
-
const version = {
|
11
|
-
...versionData
|
12
|
-
};
|
13
|
-
if (version.id) delete version.id;
|
14
|
-
const result = await upsertRow({
|
15
|
-
adapter: this,
|
16
|
-
data: {
|
17
|
-
autosave,
|
18
|
-
latest: true,
|
19
|
-
parent,
|
20
|
-
version
|
21
|
-
},
|
22
|
-
db,
|
23
|
-
fields: buildVersionCollectionFields(collection),
|
24
|
-
operation: 'create',
|
25
|
-
req,
|
26
|
-
tableName
|
27
|
-
});
|
28
|
-
const table = this.tables[tableName];
|
29
|
-
const relationshipsTable = this.tables[`_${defaultTableName}${this.versionsSuffix}${this.relationshipsSuffix}`];
|
30
|
-
if (collection.versions.drafts) {
|
31
|
-
await db.execute(sql`
|
32
|
-
UPDATE ${table}
|
33
|
-
SET latest = false
|
34
|
-
FROM ${relationshipsTable}
|
35
|
-
WHERE ${table.id} = ${relationshipsTable.parent}
|
36
|
-
AND ${relationshipsTable.path} = ${'parent'}
|
37
|
-
AND ${relationshipsTable[`${collectionSlug}ID`]} = ${parent}
|
38
|
-
AND ${table.id} != ${result.id};
|
39
|
-
`);
|
40
|
-
}
|
41
|
-
return result;
|
42
|
-
}
|
43
|
-
|
44
|
-
//# sourceMappingURL=createVersion.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../src/createVersion.ts"],"sourcesContent":["import type { CreateVersionArgs, TypeWithVersion } from 'payload/database'\nimport type { PayloadRequestWithData, TypeWithID } from 'payload/types'\n\nimport { sql } from 'drizzle-orm'\nimport { buildVersionCollectionFields } from 'payload/versions'\nimport toSnakeCase from 'to-snake-case'\n\nimport type { PostgresAdapter } from './types.js'\n\nimport { upsertRow } from './upsertRow/index.js'\n\nexport async function createVersion<T extends TypeWithID>(\n this: PostgresAdapter,\n {\n autosave,\n collectionSlug,\n parent,\n req = {} as PayloadRequestWithData,\n versionData,\n }: CreateVersionArgs<T>,\n) {\n const db = this.sessions[req.transactionID]?.db || this.drizzle\n const collection = this.payload.collections[collectionSlug].config\n const defaultTableName = toSnakeCase(collection.slug)\n\n const tableName = this.tableNameMap.get(`_${defaultTableName}${this.versionsSuffix}`)\n\n const version = { ...versionData }\n if (version.id) delete version.id\n\n const result = await upsertRow<TypeWithVersion<T>>({\n adapter: this,\n data: {\n autosave,\n latest: true,\n parent,\n version,\n },\n db,\n fields: buildVersionCollectionFields(collection),\n operation: 'create',\n req,\n tableName,\n })\n\n const table = this.tables[tableName]\n\n const relationshipsTable =\n this.tables[`_${defaultTableName}${this.versionsSuffix}${this.relationshipsSuffix}`]\n\n if (collection.versions.drafts) {\n await db.execute(sql`\n UPDATE ${table}\n SET latest = false\n FROM ${relationshipsTable}\n WHERE ${table.id} = ${relationshipsTable.parent}\n AND ${relationshipsTable.path} = ${'parent'}\n AND ${relationshipsTable[`${collectionSlug}ID`]} = ${parent}\n AND ${table.id} != ${result.id};\n `)\n }\n\n return result\n}\n"],"names":["sql","buildVersionCollectionFields","toSnakeCase","upsertRow","createVersion","autosave","collectionSlug","parent","req","versionData","db","sessions","transactionID","drizzle","collection","payload","collections","config","defaultTableName","slug","tableName","tableNameMap","get","versionsSuffix","version","id","result","adapter","data","latest","fields","operation","table","tables","relationshipsTable","relationshipsSuffix","versions","drafts","execute","path"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAGA,SAASA,GAAG,QAAQ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C;YAC1C,EAAE2B,mBAAmBK,IAAI,CAAC,GAAG,EAAE,SAAS;YACxC,EAAEL,kBAAkB,CAAC,CAAC,EAAE5B,eAAe,EAAE,CAAC,CAAC,CAAC,GAAG,EAAEC,OAAO;YACxD,EAAEyB,MAAMP,EAAE,CAAC,IAAI,EAAEC,OAAOD,EAAE,CAAC;IACnC,CAAC;IACH;IAEA,OAAOC;AACT"}
|
package/dist/deleteMany.d.ts
DELETED
package/dist/deleteMany.d.ts.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"deleteMany.d.ts","sourceRoot":"","sources":["../src/deleteMany.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAUlD,eAAO,MAAM,UAAU,EAAE,UA8BxB,CAAA"}
|