@payloadcms/db-postgres 3.0.0-canary.cee5702 → 3.0.0-canary.e14c80d
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 +10 -6
- package/dist/connect.js.map +1 -1
- 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 +18 -29
- 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.js.map +1 -1
- 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 +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +40 -65
- 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 +15 -11
- 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.js.map +1 -1
- package/dist/predefinedMigrations/v2-v3/fetchAndResave/index.d.ts +5 -5
- package/dist/predefinedMigrations/v2-v3/fetchAndResave/index.d.ts.map +1 -1
- package/dist/predefinedMigrations/v2-v3/fetchAndResave/index.js +1 -2
- package/dist/predefinedMigrations/v2-v3/fetchAndResave/index.js.map +1 -1
- package/dist/predefinedMigrations/v2-v3/fetchAndResave/traverseFields.d.ts +1 -1
- package/dist/predefinedMigrations/v2-v3/fetchAndResave/traverseFields.d.ts.map +1 -1
- package/dist/predefinedMigrations/v2-v3/fetchAndResave/traverseFields.js +1 -1
- package/dist/predefinedMigrations/v2-v3/fetchAndResave/traverseFields.js.map +1 -1
- package/dist/predefinedMigrations/v2-v3/groupUpSQLStatements.d.ts.map +1 -1
- package/dist/predefinedMigrations/v2-v3/groupUpSQLStatements.js.map +1 -1
- package/dist/predefinedMigrations/v2-v3/index.d.ts +2 -3
- package/dist/predefinedMigrations/v2-v3/index.d.ts.map +1 -1
- package/dist/predefinedMigrations/v2-v3/index.js +7 -7
- package/dist/predefinedMigrations/v2-v3/index.js.map +1 -1
- package/dist/predefinedMigrations/v2-v3/migrateRelationships.d.ts +5 -4
- package/dist/predefinedMigrations/v2-v3/migrateRelationships.d.ts.map +1 -1
- package/dist/predefinedMigrations/v2-v3/migrateRelationships.js.map +1 -1
- package/dist/predefinedMigrations/v2-v3/traverseFields.d.ts +4 -4
- package/dist/predefinedMigrations/v2-v3/traverseFields.d.ts.map +1 -1
- package/dist/predefinedMigrations/v2-v3/traverseFields.js +1 -1
- package/dist/predefinedMigrations/v2-v3/traverseFields.js.map +1 -1
- package/dist/predefinedMigrations/v2-v3/types.js.map +1 -1
- 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 +5 -1
- package/dist/schema/build.d.ts.map +1 -1
- package/dist/schema/build.js +2 -2
- 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 +1 -1
- package/dist/schema/traverseFields.d.ts.map +1 -1
- package/dist/schema/traverseFields.js +15 -16
- 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 +97 -37
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +20 -17
- package/dist/count.d.ts +0 -3
- package/dist/count.d.ts.map +0 -1
- package/dist/count.js +0 -41
- 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 -40
- 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 -15
- package/dist/destroy.js.map +0 -1
- package/dist/find/buildFindManyArgs.d.ts +0 -17
- package/dist/find/buildFindManyArgs.d.ts.map +0 -1
- package/dist/find/buildFindManyArgs.js +0 -65
- 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 -152
- package/dist/find/findMany.js.map +0 -1
- package/dist/find/traverseFields.d.ts +0 -17
- package/dist/find/traverseFields.d.ts.map +0 -1
- package/dist/find/traverseFields.js +0 -156
- 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 -16
- package/dist/queries/buildAndOrConditions.d.ts.map +0 -1
- package/dist/queries/buildAndOrConditions.js +0 -28
- package/dist/queries/buildAndOrConditions.js.map +0 -1
- package/dist/queries/buildQuery.d.ts +0 -30
- package/dist/queries/buildQuery.d.ts.map +0 -1
- package/dist/queries/buildQuery.js +0 -72
- 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 -50
- package/dist/queries/getTableColumnFromPath.d.ts.map +0 -1
- package/dist/queries/getTableColumnFromPath.js +0 -517
- 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 -16
- package/dist/queries/parseParams.d.ts.map +0 -1
- package/dist/queries/parseParams.js +0 -183
- 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 -22
- package/dist/queries/selectDistinct.d.ts.map +0 -1
- package/dist/queries/selectDistinct.js +0 -30
- 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 -51
- 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 -14
- package/dist/transform/read/index.d.ts.map +0 -1
- package/dist/transform/read/index.js +0 -44
- 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 -60
- package/dist/transform/read/relationship.js.map +0 -1
- package/dist/transform/read/traverseFields.d.ts +0 -57
- package/dist/transform/read/traverseFields.d.ts.map +0 -1
- package/dist/transform/read/traverseFields.js +0 -435
- 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 -445
- 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 -54
- 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 -279
- 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 -32
- 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/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.e14c80d",
|
4
4
|
"description": "The officially supported Postgres database adapter for Payload",
|
5
5
|
"homepage": "https://payloadcms.com",
|
6
6
|
"repository": {
|
@@ -14,18 +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
24
|
},
|
25
25
|
"./migration-utils": {
|
26
26
|
"import": "./dist/exports/migration-utils.js",
|
27
|
-
"
|
28
|
-
"
|
27
|
+
"types": "./dist/exports/migration-utils.d.ts",
|
28
|
+
"default": "./dist/exports/migration-utils.js"
|
29
29
|
}
|
30
30
|
},
|
31
31
|
"main": "./dist/index.js",
|
@@ -35,29 +35,32 @@
|
|
35
35
|
"mock.js"
|
36
36
|
],
|
37
37
|
"dependencies": {
|
38
|
-
"@libsql/client": "^0.5.2",
|
39
38
|
"console-table-printer": "2.11.2",
|
40
|
-
"drizzle-kit": "0.
|
41
|
-
"drizzle-orm": "0.
|
39
|
+
"drizzle-kit": "0.23.2-df9e596",
|
40
|
+
"drizzle-orm": "0.32.1",
|
42
41
|
"pg": "8.11.3",
|
43
42
|
"prompts": "2.4.2",
|
44
43
|
"to-snake-case": "1.0.0",
|
45
|
-
"uuid": "
|
44
|
+
"uuid": "10.0.0",
|
45
|
+
"@payloadcms/drizzle": "3.0.0-canary.e14c80d"
|
46
46
|
},
|
47
47
|
"devDependencies": {
|
48
|
+
"@hyrious/esbuild-plugin-commonjs": "^0.2.4",
|
48
49
|
"@types/pg": "8.10.2",
|
49
50
|
"@types/to-snake-case": "1.0.0",
|
50
|
-
"
|
51
|
-
"
|
51
|
+
"esbuild": "0.23.0",
|
52
|
+
"@payloadcms/eslint-config": "3.0.0-beta.59",
|
53
|
+
"payload": "3.0.0-canary.e14c80d"
|
52
54
|
},
|
53
55
|
"peerDependencies": {
|
54
|
-
"payload": "3.0.0-canary.
|
56
|
+
"payload": "3.0.0-canary.e14c80d"
|
55
57
|
},
|
56
58
|
"scripts": {
|
57
|
-
"build": "pnpm build:swc && pnpm build:
|
58
|
-
"build:
|
59
|
+
"build": "rimraf .dist && rimraf tsconfig.tsbuildinfo && pnpm build:types && pnpm build:swc && pnpm build:esbuild && pnpm renamePredefinedMigrations",
|
60
|
+
"build:esbuild": "echo skipping esbuild",
|
61
|
+
"build:swc": "swc ./src -d ./dist --config-file .swcrc --strip-leading-paths",
|
59
62
|
"build:types": "tsc --emitDeclarationOnly --outDir dist",
|
60
63
|
"clean": "rimraf {dist,*.tsbuildinfo}",
|
61
|
-
"renamePredefinedMigrations": "
|
64
|
+
"renamePredefinedMigrations": "node --no-deprecation --import @swc-node/register/esm-register ./scripts/renamePredefinedMigrations.ts"
|
62
65
|
}
|
63
66
|
}
|
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,KA0CnB,CAAA"}
|
package/dist/count.js
DELETED
@@ -1,41 +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 { joins, where } = await buildQuery({
|
11
|
-
adapter: this,
|
12
|
-
fields: collectionConfig.fields,
|
13
|
-
locale,
|
14
|
-
tableName,
|
15
|
-
where: whereArg
|
16
|
-
});
|
17
|
-
const selectCountMethods = [];
|
18
|
-
Object.entries(joins).forEach(([joinTable, condition])=>{
|
19
|
-
if (joinTable) {
|
20
|
-
selectCountMethods.push({
|
21
|
-
args: [
|
22
|
-
this.tables[joinTable],
|
23
|
-
condition
|
24
|
-
],
|
25
|
-
method: 'leftJoin'
|
26
|
-
});
|
27
|
-
}
|
28
|
-
});
|
29
|
-
const countResult = await chainMethods({
|
30
|
-
methods: selectCountMethods,
|
31
|
-
query: db.select({
|
32
|
-
count: sql`count
|
33
|
-
(DISTINCT ${this.tables[tableName].id})`
|
34
|
-
}).from(table).where(where)
|
35
|
-
});
|
36
|
-
return {
|
37
|
-
totalDocs: Number(countResult[0].count)
|
38
|
-
};
|
39
|
-
};
|
40
|
-
|
41
|
-
//# 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 { 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 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","joins","adapter","fields","selectCountMethods","Object","entries","forEach","joinTable","condition","push","args","method","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,KAAK,EAAEhB,KAAK,EAAE,GAAG,MAAML,WAAW;QACxCsB,SAAS,IAAI;QACbC,QAAQhB,iBAAiBgB,MAAM;QAC/BpB;QACAQ;QACAN,OAAOC;IACT;IAEA,MAAMkB,qBAAqC,EAAE;IAE7CC,OAAOC,OAAO,CAACL,OAAOM,OAAO,CAAC,CAAC,CAACC,WAAWC,UAAU;QACnD,IAAID,WAAW;YACbJ,mBAAmBM,IAAI,CAAC;gBACtBC,MAAM;oBAAC,IAAI,CAACX,MAAM,CAACQ,UAAU;oBAAEC;iBAAU;gBACzCG,QAAQ;YACV;QACF;IACF;IAEA,MAAMC,cAAc,MAAMlC,aAAa;QACrCmC,SAASV;QACTW,OAAOpB,GACJqB,MAAM,CAAC;YACNnC,OAAOJ,GAAW,CAAC;sBACL,EAAE,IAAI,CAACuB,MAAM,CAACT,UAAU,CAAC0B,EAAE,CAAC,CAAC,CAAC;QAC9C,GACCC,IAAI,CAACnB,OACLd,KAAK,CAACA;IACX;IAEA,OAAO;QAAEkC,WAAWC,OAAOP,WAAW,CAAC,EAAE,CAAChC,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,+BAsCxB"}
|
package/dist/createVersion.js
DELETED
@@ -1,40 +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
|
-
if (collection.versions.drafts) {
|
30
|
-
await db.execute(sql`
|
31
|
-
UPDATE ${table}
|
32
|
-
SET latest = false
|
33
|
-
WHERE ${table.id} != ${result.id}
|
34
|
-
AND ${table.parent} = ${parent}
|
35
|
-
`);
|
36
|
-
}
|
37
|
-
return result;
|
38
|
-
}
|
39
|
-
|
40
|
-
//# 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 if (collection.versions.drafts) {\n await db.execute(sql`\n UPDATE ${table}\n SET latest = false\n WHERE ${table.id} != ${result.id}\n AND ${table.parent} = ${parent}\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","versions","drafts","execute"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAGA,SAASA,GAAG,QAAQ,cAAa;AACjC,SAASC,4BAA4B,QAAQ,mBAAkB;AAC/D,OAAOC,iBAAiB,gBAAe;AAIvC,SAASC,SAAS,QAAQ,uBAAsB;AAEhD,OAAO,eAAeC,cAEpB,EACEC,QAAQ,EACRC,cAAc,EACdC,MAAM,EACNC,MAAM,CAAC,CAA2B,EAClCC,WAAW,EACU;IAEvB,MAAMC,KAAK,IAAI,CAACC,QAAQ,CAACH,IAAII,aAAa,CAAC,EAAEF,MAAM,IAAI,CAACG,OAAO;IAC/D,MAAMC,aAAa,IAAI,CAACC,OAAO,CAACC,WAAW,CAACV,eAAe,CAACW,MAAM;IAClE,MAAMC,mBAAmBhB,YAAYY,WAAWK,IAAI;IAEpD,MAAMC,YAAY,IAAI,CAACC,YAAY,CAACC,GAAG,CAAC,CAAC,CAAC,EAAEJ,iBAAiB,EAAE,IAAI,CAACK,cAAc,CAAC,CAAC;IAEpF,MAAMC,UAAU;QAAE,GAAGf,WAAW;IAAC;IACjC,IAAIe,QAAQC,EAAE,EAAE,OAAOD,QAAQC,EAAE;IAEjC,MAAMC,SAAS,MAAMvB,UAA8B;QACjDwB,SAAS,IAAI;QACbC,MAAM;YACJvB;YACAwB,QAAQ;YACRtB;YACAiB;QACF;QACAd;QACAoB,QAAQ7B,6BAA6Ba;QACrCiB,WAAW;QACXvB;QACAY;IACF;IAEA,MAAMY,QAAQ,IAAI,CAACC,MAAM,CAACb,UAAU;IAEpC,IAAIN,WAAWoB,QAAQ,CAACC,MAAM,EAAE;QAC9B,MAAMzB,GAAG0B,OAAO,CAACpC,GAAG,CAAC;aACZ,EAAEgC,MAAM;;YAET,EAAEA,MAAMP,EAAE,CAAC,IAAI,EAAEC,OAAOD,EAAE,CAAC;YAC3B,EAAEO,MAAMzB,MAAM,CAAC,GAAG,EAAEA,OAAO;IACnC,CAAC;IACH;IAEA,OAAOmB;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"}
|
package/dist/deleteMany.js
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
import { inArray } from 'drizzle-orm';
|
2
|
-
import toSnakeCase from 'to-snake-case';
|
3
|
-
import { findMany } from './find/findMany.js';
|
4
|
-
export const deleteMany = async function deleteMany({ collection, req = {}, where }) {
|
5
|
-
const db = this.sessions[req.transactionID]?.db || this.drizzle;
|
6
|
-
const collectionConfig = this.payload.collections[collection].config;
|
7
|
-
const tableName = this.tableNameMap.get(toSnakeCase(collectionConfig.slug));
|
8
|
-
const result = await findMany({
|
9
|
-
adapter: this,
|
10
|
-
fields: collectionConfig.fields,
|
11
|
-
limit: 0,
|
12
|
-
locale: req.locale,
|
13
|
-
page: 1,
|
14
|
-
pagination: false,
|
15
|
-
req,
|
16
|
-
tableName,
|
17
|
-
where
|
18
|
-
});
|
19
|
-
const ids = [];
|
20
|
-
result.docs.forEach((data)=>{
|
21
|
-
ids.push(data.id);
|
22
|
-
});
|
23
|
-
if (ids.length > 0) {
|
24
|
-
await db.delete(this.tables[tableName]).where(inArray(this.tables[tableName].id, ids));
|
25
|
-
}
|
26
|
-
};
|
27
|
-
|
28
|
-
//# sourceMappingURL=deleteMany.js.map
|
package/dist/deleteMany.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../src/deleteMany.ts"],"sourcesContent":["import type { DeleteMany } from 'payload/database'\nimport type { PayloadRequestWithData } from 'payload/types'\n\nimport { inArray } from 'drizzle-orm'\nimport toSnakeCase from 'to-snake-case'\n\nimport type { PostgresAdapter } from './types.js'\n\nimport { findMany } from './find/findMany.js'\n\nexport const deleteMany: DeleteMany = async function deleteMany(\n this: PostgresAdapter,\n { collection, req = {} as PayloadRequestWithData, where },\n) {\n const db = this.sessions[req.transactionID]?.db || this.drizzle\n const collectionConfig = this.payload.collections[collection].config\n\n const tableName = this.tableNameMap.get(toSnakeCase(collectionConfig.slug))\n\n const result = await findMany({\n adapter: this,\n fields: collectionConfig.fields,\n limit: 0,\n locale: req.locale,\n page: 1,\n pagination: false,\n req,\n tableName,\n where,\n })\n\n const ids = []\n\n result.docs.forEach((data) => {\n ids.push(data.id)\n })\n\n if (ids.length > 0) {\n await db.delete(this.tables[tableName]).where(inArray(this.tables[tableName].id, ids))\n }\n}\n"],"names":["inArray","toSnakeCase","findMany","deleteMany","collection","req","where","db","sessions","transactionID","drizzle","collectionConfig","payload","collections","config","tableName","tableNameMap","get","slug","result","adapter","fields","limit","locale","page","pagination","ids","docs","forEach","data","push","id","length","delete","tables"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAGA,SAASA,OAAO,QAAQ,cAAa;AACrC,OAAOC,iBAAiB,gBAAe;AAIvC,SAASC,QAAQ,QAAQ,qBAAoB;AAE7C,OAAO,MAAMC,aAAyB,eAAeA,WAEnD,EAAEC,UAAU,EAAEC,MAAM,CAAC,CAA2B,EAAEC,KAAK,EAAE;IAEzD,MAAMC,KAAK,IAAI,CAACC,QAAQ,CAACH,IAAII,aAAa,CAAC,EAAEF,MAAM,IAAI,CAACG,OAAO;IAC/D,MAAMC,mBAAmB,IAAI,CAACC,OAAO,CAACC,WAAW,CAACT,WAAW,CAACU,MAAM;IAEpE,MAAMC,YAAY,IAAI,CAACC,YAAY,CAACC,GAAG,CAAChB,YAAYU,iBAAiBO,IAAI;IAEzE,MAAMC,SAAS,MAAMjB,SAAS;QAC5BkB,SAAS,IAAI;QACbC,QAAQV,iBAAiBU,MAAM;QAC/BC,OAAO;QACPC,QAAQlB,IAAIkB,MAAM;QAClBC,MAAM;QACNC,YAAY;QACZpB;QACAU;QACAT;IACF;IAEA,MAAMoB,MAAM,EAAE;IAEdP,OAAOQ,IAAI,CAACC,OAAO,CAAC,CAACC;QACnBH,IAAII,IAAI,CAACD,KAAKE,EAAE;IAClB;IAEA,IAAIL,IAAIM,MAAM,GAAG,GAAG;QAClB,MAAMzB,GAAG0B,MAAM,CAAC,IAAI,CAACC,MAAM,CAACnB,UAAU,EAAET,KAAK,CAACN,QAAQ,IAAI,CAACkC,MAAM,CAACnB,UAAU,CAACgB,EAAE,EAAEL;IACnF;AACF,EAAC"}
|
package/dist/deleteOne.d.ts
DELETED
package/dist/deleteOne.d.ts.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"deleteOne.d.ts","sourceRoot":"","sources":["../src/deleteOne.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAajD,eAAO,MAAM,SAAS,EAAE,SAwDvB,CAAA"}
|
package/dist/deleteOne.js
DELETED
@@ -1,59 +0,0 @@
|
|
1
|
-
import { eq } from 'drizzle-orm';
|
2
|
-
import toSnakeCase from 'to-snake-case';
|
3
|
-
import { buildFindManyArgs } from './find/buildFindManyArgs.js';
|
4
|
-
import buildQuery from './queries/buildQuery.js';
|
5
|
-
import { selectDistinct } from './queries/selectDistinct.js';
|
6
|
-
import { transform } from './transform/read/index.js';
|
7
|
-
export const deleteOne = async function deleteOne({ collection: collectionSlug, req = {}, where: whereArg }) {
|
8
|
-
const db = this.sessions[req.transactionID]?.db || this.drizzle;
|
9
|
-
const collection = this.payload.collections[collectionSlug].config;
|
10
|
-
const tableName = this.tableNameMap.get(toSnakeCase(collection.slug));
|
11
|
-
let docToDelete;
|
12
|
-
const { joins, selectFields, where } = await buildQuery({
|
13
|
-
adapter: this,
|
14
|
-
fields: collection.fields,
|
15
|
-
locale: req.locale,
|
16
|
-
tableName,
|
17
|
-
where: whereArg
|
18
|
-
});
|
19
|
-
const selectDistinctResult = await selectDistinct({
|
20
|
-
adapter: this,
|
21
|
-
chainedMethods: [
|
22
|
-
{
|
23
|
-
args: [
|
24
|
-
1
|
25
|
-
],
|
26
|
-
method: 'limit'
|
27
|
-
}
|
28
|
-
],
|
29
|
-
db,
|
30
|
-
joins,
|
31
|
-
selectFields,
|
32
|
-
tableName,
|
33
|
-
where
|
34
|
-
});
|
35
|
-
if (selectDistinctResult?.[0]?.id) {
|
36
|
-
docToDelete = await db.query[tableName].findFirst({
|
37
|
-
where: eq(this.tables[tableName].id, selectDistinctResult[0].id)
|
38
|
-
});
|
39
|
-
} else {
|
40
|
-
const findManyArgs = buildFindManyArgs({
|
41
|
-
adapter: this,
|
42
|
-
depth: 0,
|
43
|
-
fields: collection.fields,
|
44
|
-
tableName
|
45
|
-
});
|
46
|
-
findManyArgs.where = where;
|
47
|
-
docToDelete = await db.query[tableName].findFirst(findManyArgs);
|
48
|
-
}
|
49
|
-
const result = transform({
|
50
|
-
adapter: this,
|
51
|
-
config: this.payload.config,
|
52
|
-
data: docToDelete,
|
53
|
-
fields: collection.fields
|
54
|
-
});
|
55
|
-
await db.delete(this.tables[tableName]).where(eq(this.tables[tableName].id, docToDelete.id));
|
56
|
-
return result;
|
57
|
-
};
|
58
|
-
|
59
|
-
//# sourceMappingURL=deleteOne.js.map
|
package/dist/deleteOne.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../src/deleteOne.ts"],"sourcesContent":["import type { DeleteOne } from 'payload/database'\nimport type { PayloadRequestWithData } from 'payload/types'\n\nimport { eq } from 'drizzle-orm'\nimport toSnakeCase from 'to-snake-case'\n\nimport type { PostgresAdapter } from './types.js'\n\nimport { buildFindManyArgs } from './find/buildFindManyArgs.js'\nimport buildQuery from './queries/buildQuery.js'\nimport { selectDistinct } from './queries/selectDistinct.js'\nimport { transform } from './transform/read/index.js'\n\nexport const deleteOne: DeleteOne = async function deleteOne(\n this: PostgresAdapter,\n { collection: collectionSlug, req = {} as PayloadRequestWithData, where: whereArg },\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 let docToDelete: Record<string, unknown>\n\n const { joins, selectFields, where } = await buildQuery({\n adapter: this,\n fields: collection.fields,\n locale: req.locale,\n tableName,\n where: whereArg,\n })\n\n const selectDistinctResult = await selectDistinct({\n adapter: this,\n chainedMethods: [{ args: [1], method: 'limit' }],\n db,\n joins,\n selectFields,\n tableName,\n where,\n })\n\n if (selectDistinctResult?.[0]?.id) {\n docToDelete = await db.query[tableName].findFirst({\n where: eq(this.tables[tableName].id, selectDistinctResult[0].id),\n })\n } else {\n const findManyArgs = buildFindManyArgs({\n adapter: this,\n depth: 0,\n fields: collection.fields,\n tableName,\n })\n\n findManyArgs.where = where\n\n docToDelete = await db.query[tableName].findFirst(findManyArgs)\n }\n\n const result = transform({\n adapter: this,\n config: this.payload.config,\n data: docToDelete,\n fields: collection.fields,\n })\n\n await db.delete(this.tables[tableName]).where(eq(this.tables[tableName].id, docToDelete.id))\n\n return result\n}\n"],"names":["eq","toSnakeCase","buildFindManyArgs","buildQuery","selectDistinct","transform","deleteOne","collection","collectionSlug","req","where","whereArg","db","sessions","transactionID","drizzle","payload","collections","config","tableName","tableNameMap","get","slug","docToDelete","joins","selectFields","adapter","fields","locale","selectDistinctResult","chainedMethods","args","method","id","query","findFirst","tables","findManyArgs","depth","result","data","delete"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAGA,SAASA,EAAE,QAAQ,cAAa;AAChC,OAAOC,iBAAiB,gBAAe;AAIvC,SAASC,iBAAiB,QAAQ,8BAA6B;AAC/D,OAAOC,gBAAgB,0BAAyB;AAChD,SAASC,cAAc,QAAQ,8BAA6B;AAC5D,SAASC,SAAS,QAAQ,4BAA2B;AAErD,OAAO,MAAMC,YAAuB,eAAeA,UAEjD,EAAEC,YAAYC,cAAc,EAAEC,MAAM,CAAC,CAA2B,EAAEC,OAAOC,QAAQ,EAAE;IAEnF,MAAMC,KAAK,IAAI,CAACC,QAAQ,CAACJ,IAAIK,aAAa,CAAC,EAAEF,MAAM,IAAI,CAACG,OAAO;IAC/D,MAAMR,aAAa,IAAI,CAACS,OAAO,CAACC,WAAW,CAACT,eAAe,CAACU,MAAM;IAElE,MAAMC,YAAY,IAAI,CAACC,YAAY,CAACC,GAAG,CAACpB,YAAYM,WAAWe,IAAI;IAEnE,IAAIC;IAEJ,MAAM,EAAEC,KAAK,EAAEC,YAAY,EAAEf,KAAK,EAAE,GAAG,MAAMP,WAAW;QACtDuB,SAAS,IAAI;QACbC,QAAQpB,WAAWoB,MAAM;QACzBC,QAAQnB,IAAImB,MAAM;QAClBT;QACAT,OAAOC;IACT;IAEA,MAAMkB,uBAAuB,MAAMzB,eAAe;QAChDsB,SAAS,IAAI;QACbI,gBAAgB;YAAC;gBAAEC,MAAM;oBAAC;iBAAE;gBAAEC,QAAQ;YAAQ;SAAE;QAChDpB;QACAY;QACAC;QACAN;QACAT;IACF;IAEA,IAAImB,sBAAsB,CAAC,EAAE,EAAEI,IAAI;QACjCV,cAAc,MAAMX,GAAGsB,KAAK,CAACf,UAAU,CAACgB,SAAS,CAAC;YAChDzB,OAAOV,GAAG,IAAI,CAACoC,MAAM,CAACjB,UAAU,CAACc,EAAE,EAAEJ,oBAAoB,CAAC,EAAE,CAACI,EAAE;QACjE;IACF,OAAO;QACL,MAAMI,eAAenC,kBAAkB;YACrCwB,SAAS,IAAI;YACbY,OAAO;YACPX,QAAQpB,WAAWoB,MAAM;YACzBR;QACF;QAEAkB,aAAa3B,KAAK,GAAGA;QAErBa,cAAc,MAAMX,GAAGsB,KAAK,CAACf,UAAU,CAACgB,SAAS,CAACE;IACpD;IAEA,MAAME,SAASlC,UAAU;QACvBqB,SAAS,IAAI;QACbR,QAAQ,IAAI,CAACF,OAAO,CAACE,MAAM;QAC3BsB,MAAMjB;QACNI,QAAQpB,WAAWoB,MAAM;IAC3B;IAEA,MAAMf,GAAG6B,MAAM,CAAC,IAAI,CAACL,MAAM,CAACjB,UAAU,EAAET,KAAK,CAACV,GAAG,IAAI,CAACoC,MAAM,CAACjB,UAAU,CAACc,EAAE,EAAEV,YAAYU,EAAE;IAE1F,OAAOM;AACT,EAAC"}
|
package/dist/deleteVersions.d.ts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"deleteVersions.d.ts","sourceRoot":"","sources":["../src/deleteVersions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAWtD,eAAO,MAAM,cAAc,EAAE,cAoC5B,CAAA"}
|
package/dist/deleteVersions.js
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
import { inArray } from 'drizzle-orm';
|
2
|
-
import { buildVersionCollectionFields } from 'payload/versions';
|
3
|
-
import toSnakeCase from 'to-snake-case';
|
4
|
-
import { findMany } from './find/findMany.js';
|
5
|
-
export const deleteVersions = async function deleteVersion({ collection, locale, req = {}, where: where }) {
|
6
|
-
const db = this.sessions[req.transactionID]?.db || this.drizzle;
|
7
|
-
const collectionConfig = this.payload.collections[collection].config;
|
8
|
-
const tableName = this.tableNameMap.get(`_${toSnakeCase(collectionConfig.slug)}${this.versionsSuffix}`);
|
9
|
-
const fields = buildVersionCollectionFields(collectionConfig);
|
10
|
-
const { docs } = await findMany({
|
11
|
-
adapter: this,
|
12
|
-
fields,
|
13
|
-
limit: 0,
|
14
|
-
locale,
|
15
|
-
page: 1,
|
16
|
-
pagination: false,
|
17
|
-
req,
|
18
|
-
tableName,
|
19
|
-
where
|
20
|
-
});
|
21
|
-
const ids = [];
|
22
|
-
docs.forEach((doc)=>{
|
23
|
-
ids.push(doc.id);
|
24
|
-
});
|
25
|
-
if (ids.length > 0) {
|
26
|
-
await db.delete(this.tables[tableName]).where(inArray(this.tables[tableName].id, ids));
|
27
|
-
}
|
28
|
-
return docs;
|
29
|
-
};
|
30
|
-
|
31
|
-
//# sourceMappingURL=deleteVersions.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../src/deleteVersions.ts"],"sourcesContent":["import type { DeleteVersions } from 'payload/database'\nimport type { PayloadRequestWithData, SanitizedCollectionConfig } from 'payload/types'\n\nimport { inArray } from 'drizzle-orm'\nimport { buildVersionCollectionFields } from 'payload/versions'\nimport toSnakeCase from 'to-snake-case'\n\nimport type { PostgresAdapter } from './types.js'\n\nimport { findMany } from './find/findMany.js'\n\nexport const deleteVersions: DeleteVersions = async function deleteVersion(\n this: PostgresAdapter,\n { collection, locale, req = {} as PayloadRequestWithData, where: where },\n) {\n const db = this.sessions[req.transactionID]?.db || this.drizzle\n const collectionConfig: SanitizedCollectionConfig = this.payload.collections[collection].config\n\n const tableName = this.tableNameMap.get(\n `_${toSnakeCase(collectionConfig.slug)}${this.versionsSuffix}`,\n )\n\n const fields = buildVersionCollectionFields(collectionConfig)\n\n const { docs } = await findMany({\n adapter: this,\n fields,\n limit: 0,\n locale,\n page: 1,\n pagination: false,\n req,\n tableName,\n where,\n })\n\n const ids = []\n\n docs.forEach((doc) => {\n ids.push(doc.id)\n })\n\n if (ids.length > 0) {\n await db.delete(this.tables[tableName]).where(inArray(this.tables[tableName].id, ids))\n }\n\n return docs\n}\n"],"names":["inArray","buildVersionCollectionFields","toSnakeCase","findMany","deleteVersions","deleteVersion","collection","locale","req","where","db","sessions","transactionID","drizzle","collectionConfig","payload","collections","config","tableName","tableNameMap","get","slug","versionsSuffix","fields","docs","adapter","limit","page","pagination","ids","forEach","doc","push","id","length","delete","tables"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAGA,SAASA,OAAO,QAAQ,cAAa;AACrC,SAASC,4BAA4B,QAAQ,mBAAkB;AAC/D,OAAOC,iBAAiB,gBAAe;AAIvC,SAASC,QAAQ,QAAQ,qBAAoB;AAE7C,OAAO,MAAMC,iBAAiC,eAAeC,cAE3D,EAAEC,UAAU,EAAEC,MAAM,EAAEC,MAAM,CAAC,CAA2B,EAAEC,OAAOA,KAAK,EAAE;IAExE,MAAMC,KAAK,IAAI,CAACC,QAAQ,CAACH,IAAII,aAAa,CAAC,EAAEF,MAAM,IAAI,CAACG,OAAO;IAC/D,MAAMC,mBAA8C,IAAI,CAACC,OAAO,CAACC,WAAW,CAACV,WAAW,CAACW,MAAM;IAE/F,MAAMC,YAAY,IAAI,CAACC,YAAY,CAACC,GAAG,CACrC,CAAC,CAAC,EAAElB,YAAYY,iBAAiBO,IAAI,EAAE,EAAE,IAAI,CAACC,cAAc,CAAC,CAAC;IAGhE,MAAMC,SAAStB,6BAA6Ba;IAE5C,MAAM,EAAEU,IAAI,EAAE,GAAG,MAAMrB,SAAS;QAC9BsB,SAAS,IAAI;QACbF;QACAG,OAAO;QACPnB;QACAoB,MAAM;QACNC,YAAY;QACZpB;QACAU;QACAT;IACF;IAEA,MAAMoB,MAAM,EAAE;IAEdL,KAAKM,OAAO,CAAC,CAACC;QACZF,IAAIG,IAAI,CAACD,IAAIE,EAAE;IACjB;IAEA,IAAIJ,IAAIK,MAAM,GAAG,GAAG;QAClB,MAAMxB,GAAGyB,MAAM,CAAC,IAAI,CAACC,MAAM,CAAClB,UAAU,EAAET,KAAK,CAACT,QAAQ,IAAI,CAACoC,MAAM,CAAClB,UAAU,CAACe,EAAE,EAAEJ;IACnF;IAEA,OAAOL;AACT,EAAC"}
|
package/dist/destroy.d.ts
DELETED
package/dist/destroy.d.ts.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"destroy.d.ts","sourceRoot":"","sources":["../src/destroy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAK/C,eAAO,MAAM,OAAO,EAAE,OAWrB,CAAA"}
|
package/dist/destroy.js
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
// eslint-disable-next-line @typescript-eslint/require-await
|
2
|
-
export const destroy = async function destroy() {
|
3
|
-
this.enums = {};
|
4
|
-
this.schema = {};
|
5
|
-
this.tables = {};
|
6
|
-
this.relations = {};
|
7
|
-
this.fieldConstraints = {};
|
8
|
-
this.drizzle = undefined;
|
9
|
-
this.initializing = new Promise((res, rej)=>{
|
10
|
-
this.resolveInitializing = res;
|
11
|
-
this.rejectInitializing = rej;
|
12
|
-
});
|
13
|
-
};
|
14
|
-
|
15
|
-
//# sourceMappingURL=destroy.js.map
|
package/dist/destroy.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../src/destroy.ts"],"sourcesContent":["import type { Destroy } from 'payload/database'\n\nimport type { PostgresAdapter } from './types.js'\n\n// eslint-disable-next-line @typescript-eslint/require-await\nexport const destroy: Destroy = async function destroy(this: PostgresAdapter) {\n this.enums = {}\n this.schema = {}\n this.tables = {}\n this.relations = {}\n this.fieldConstraints = {}\n this.drizzle = undefined\n this.initializing = new Promise((res, rej) => {\n this.resolveInitializing = res\n this.rejectInitializing = rej\n })\n}\n"],"names":["destroy","enums","schema","tables","relations","fieldConstraints","drizzle","undefined","initializing","Promise","res","rej","resolveInitializing","rejectInitializing"],"rangeMappings":";;;;;;;;;;;;","mappings":"AAIA,4DAA4D;AAC5D,OAAO,MAAMA,UAAmB,eAAeA;IAC7C,IAAI,CAACC,KAAK,GAAG,CAAC;IACd,IAAI,CAACC,MAAM,GAAG,CAAC;IACf,IAAI,CAACC,MAAM,GAAG,CAAC;IACf,IAAI,CAACC,SAAS,GAAG,CAAC;IAClB,IAAI,CAACC,gBAAgB,GAAG,CAAC;IACzB,IAAI,CAACC,OAAO,GAAGC;IACf,IAAI,CAACC,YAAY,GAAG,IAAIC,QAAQ,CAACC,KAAKC;QACpC,IAAI,CAACC,mBAAmB,GAAGF;QAC3B,IAAI,CAACG,kBAAkB,GAAGF;IAC5B;AACF,EAAC"}
|
@@ -1,17 +0,0 @@
|
|
1
|
-
import type { DBQueryConfig } from 'drizzle-orm';
|
2
|
-
import type { Field } from 'payload/types';
|
3
|
-
import type { PostgresAdapter } from '../types.js';
|
4
|
-
type BuildFindQueryArgs = {
|
5
|
-
adapter: PostgresAdapter;
|
6
|
-
depth: number;
|
7
|
-
fields: Field[];
|
8
|
-
tableName: string;
|
9
|
-
};
|
10
|
-
export type Result = DBQueryConfig<'many', true, any, any> & {
|
11
|
-
with?: DBQueryConfig<'many', true, any, any> & {
|
12
|
-
_locales?: DBQueryConfig<'many', true, any, any>;
|
13
|
-
};
|
14
|
-
};
|
15
|
-
export declare const buildFindManyArgs: ({ adapter, depth, fields, tableName, }: BuildFindQueryArgs) => Record<string, unknown>;
|
16
|
-
export {};
|
17
|
-
//# sourceMappingURL=buildFindManyArgs.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"buildFindManyArgs.d.ts","sourceRoot":"","sources":["../../src/find/buildFindManyArgs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAChD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAE1C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAIlD,KAAK,kBAAkB,GAAG;IACxB,OAAO,EAAE,eAAe,CAAA;IACxB,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,KAAK,EAAE,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,MAAM,MAAM,MAAM,GAAG,aAAa,CAAC,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG;IAC3D,IAAI,CAAC,EAAE,aAAa,CAAC,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG;QAC7C,QAAQ,CAAC,EAAE,aAAa,CAAC,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA;KACjD,CAAA;CACF,CAAA;AAID,eAAO,MAAM,iBAAiB,2CAK3B,kBAAkB,KAAG,OAAO,MAAM,EAAE,OAAO,CA4D7C,CAAA"}
|
@@ -1,65 +0,0 @@
|
|
1
|
-
import { traverseFields } from './traverseFields.js';
|
2
|
-
// Generate the Drizzle query for findMany based on
|
3
|
-
// a collection field structure
|
4
|
-
export const buildFindManyArgs = ({ adapter, depth, fields, tableName })=>{
|
5
|
-
const result = {
|
6
|
-
with: {}
|
7
|
-
};
|
8
|
-
const _locales = {
|
9
|
-
columns: {
|
10
|
-
id: false,
|
11
|
-
_parentID: false
|
12
|
-
},
|
13
|
-
with: {}
|
14
|
-
};
|
15
|
-
if (adapter.tables[`${tableName}_texts`]) {
|
16
|
-
result.with._texts = {
|
17
|
-
columns: {
|
18
|
-
id: false,
|
19
|
-
parent: false
|
20
|
-
},
|
21
|
-
orderBy: ({ order }, { asc: ASC })=>[
|
22
|
-
ASC(order)
|
23
|
-
]
|
24
|
-
};
|
25
|
-
}
|
26
|
-
if (adapter.tables[`${tableName}_numbers`]) {
|
27
|
-
result.with._numbers = {
|
28
|
-
columns: {
|
29
|
-
id: false,
|
30
|
-
parent: false
|
31
|
-
},
|
32
|
-
orderBy: ({ order }, { asc: ASC })=>[
|
33
|
-
ASC(order)
|
34
|
-
]
|
35
|
-
};
|
36
|
-
}
|
37
|
-
if (adapter.tables[`${tableName}${adapter.relationshipsSuffix}`]) {
|
38
|
-
result.with._rels = {
|
39
|
-
columns: {
|
40
|
-
id: false,
|
41
|
-
parent: false
|
42
|
-
},
|
43
|
-
orderBy: ({ order }, { asc: ASC })=>[
|
44
|
-
ASC(order)
|
45
|
-
]
|
46
|
-
};
|
47
|
-
}
|
48
|
-
if (adapter.tables[`${tableName}${adapter.localesSuffix}`]) {
|
49
|
-
result.with._locales = _locales;
|
50
|
-
}
|
51
|
-
traverseFields({
|
52
|
-
_locales,
|
53
|
-
adapter,
|
54
|
-
currentArgs: result,
|
55
|
-
currentTableName: tableName,
|
56
|
-
depth,
|
57
|
-
fields,
|
58
|
-
path: '',
|
59
|
-
topLevelArgs: result,
|
60
|
-
topLevelTableName: tableName
|
61
|
-
});
|
62
|
-
return result;
|
63
|
-
};
|
64
|
-
|
65
|
-
//# sourceMappingURL=buildFindManyArgs.js.map
|