@payloadcms/db-postgres 3.0.0-beta.7 → 3.0.0-beta.71
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 +16 -13
- 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 +56 -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 +16 -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 +3 -0
- package/dist/getMigrationTemplate.d.ts.map +1 -0
- package/dist/getMigrationTemplate.js +12 -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 +44 -71
- 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 +21 -24
- 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 +12 -7
- package/dist/schema/build.d.ts.map +1 -1
- package/dist/schema/build.js +209 -125
- package/dist/schema/build.js.map +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 +148 -66
- package/dist/schema/traverseFields.js.map +1 -1
- package/dist/types.d.ts +77 -34
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +35 -30
- package/dist/create.d.ts +0 -3
- package/dist/create.d.ts.map +0 -1
- package/dist/create.js +0 -21
- package/dist/create.js.map +0 -1
- package/dist/createGlobal.d.ts +0 -5
- package/dist/createGlobal.d.ts.map +0 -1
- package/dist/createGlobal.js +0 -21
- package/dist/createGlobal.js.map +0 -1
- package/dist/createGlobalVersion.d.ts +0 -6
- package/dist/createGlobalVersion.d.ts.map +0 -1
- package/dist/createGlobalVersion.js +0 -37
- package/dist/createGlobalVersion.js.map +0 -1
- package/dist/createVersion.d.ts +0 -5
- package/dist/createVersion.d.ts.map +0 -1
- package/dist/createVersion.js +0 -48
- package/dist/createVersion.js.map +0 -1
- package/dist/deleteMany.d.ts +0 -3
- package/dist/deleteMany.d.ts.map +0 -1
- package/dist/deleteMany.js +0 -31
- package/dist/deleteMany.js.map +0 -1
- package/dist/deleteOne.d.ts +0 -3
- package/dist/deleteOne.d.ts.map +0 -1
- package/dist/deleteOne.js +0 -62
- package/dist/deleteOne.js.map +0 -1
- package/dist/deleteVersions.d.ts +0 -3
- package/dist/deleteVersions.d.ts.map +0 -1
- package/dist/deleteVersions.js +0 -35
- package/dist/deleteVersions.js.map +0 -1
- package/dist/destroy.d.ts +0 -3
- package/dist/destroy.d.ts.map +0 -1
- package/dist/destroy.js +0 -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 -154
- package/dist/find/traverseFields.js.map +0 -1
- package/dist/find.d.ts +0 -3
- package/dist/find.d.ts.map +0 -1
- package/dist/find.js +0 -24
- package/dist/find.js.map +0 -1
- package/dist/findGlobal.d.ts +0 -3
- package/dist/findGlobal.d.ts.map +0 -1
- package/dist/findGlobal.js +0 -26
- package/dist/findGlobal.js.map +0 -1
- package/dist/findGlobalVersions.d.ts +0 -3
- package/dist/findGlobalVersions.d.ts.map +0 -1
- package/dist/findGlobalVersions.js +0 -28
- package/dist/findGlobalVersions.js.map +0 -1
- package/dist/findOne.d.ts +0 -5
- package/dist/findOne.d.ts.map +0 -1
- package/dist/findOne.js +0 -24
- package/dist/findOne.js.map +0 -1
- package/dist/findVersions.d.ts +0 -3
- package/dist/findVersions.d.ts.map +0 -1
- package/dist/findVersions.js +0 -28
- package/dist/findVersions.js.map +0 -1
- package/dist/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 -412
- package/dist/queries/getTableColumnFromPath.js.map +0 -1
- package/dist/queries/operatorMap.d.ts +0 -18
- package/dist/queries/operatorMap.d.ts.map +0 -1
- package/dist/queries/operatorMap.js +0 -24
- package/dist/queries/operatorMap.js.map +0 -1
- package/dist/queries/parseParams.d.ts +0 -17
- package/dist/queries/parseParams.d.ts.map +0 -1
- package/dist/queries/parseParams.js +0 -182
- package/dist/queries/parseParams.js.map +0 -1
- package/dist/queries/sanitizeQueryValue.d.ts +0 -15
- package/dist/queries/sanitizeQueryValue.d.ts.map +0 -1
- package/dist/queries/sanitizeQueryValue.js +0 -90
- package/dist/queries/sanitizeQueryValue.js.map +0 -1
- package/dist/queries/selectDistinct.d.ts +0 -23
- package/dist/queries/selectDistinct.d.ts.map +0 -1
- package/dist/queries/selectDistinct.js +0 -41
- package/dist/queries/selectDistinct.js.map +0 -1
- package/dist/queryDrafts.d.ts +0 -3
- package/dist/queryDrafts.d.ts.map +0 -1
- package/dist/queryDrafts.js +0 -45
- package/dist/queryDrafts.js.map +0 -1
- package/dist/schema/getTableName.d.ts +0 -32
- package/dist/schema/getTableName.d.ts.map +0 -1
- package/dist/schema/getTableName.js +0 -31
- package/dist/schema/getTableName.js.map +0 -1
- package/dist/schema/validateExistingBlockIsIdentical.d.ts +0 -11
- package/dist/schema/validateExistingBlockIsIdentical.d.ts.map +0 -1
- package/dist/schema/validateExistingBlockIsIdentical.js +0 -70
- package/dist/schema/validateExistingBlockIsIdentical.js.map +0 -1
- package/dist/transactions/beginTransaction.d.ts +0 -3
- package/dist/transactions/beginTransaction.d.ts.map +0 -1
- package/dist/transactions/beginTransaction.js +0 -47
- package/dist/transactions/beginTransaction.js.map +0 -1
- package/dist/transactions/commitTransaction.d.ts +0 -3
- package/dist/transactions/commitTransaction.d.ts.map +0 -1
- package/dist/transactions/commitTransaction.js +0 -14
- package/dist/transactions/commitTransaction.js.map +0 -1
- package/dist/transactions/rollbackTransaction.d.ts +0 -3
- package/dist/transactions/rollbackTransaction.d.ts.map +0 -1
- package/dist/transactions/rollbackTransaction.js +0 -13
- package/dist/transactions/rollbackTransaction.js.map +0 -1
- package/dist/transform/read/hasManyNumber.d.ts +0 -10
- package/dist/transform/read/hasManyNumber.d.ts.map +0 -1
- package/dist/transform/read/hasManyNumber.js +0 -10
- package/dist/transform/read/hasManyNumber.js.map +0 -1
- package/dist/transform/read/hasManyText.d.ts +0 -10
- package/dist/transform/read/hasManyText.d.ts.map +0 -1
- package/dist/transform/read/hasManyText.js +0 -10
- package/dist/transform/read/hasManyText.js.map +0 -1
- package/dist/transform/read/index.d.ts +0 -12
- package/dist/transform/read/index.d.ts.map +0 -1
- package/dist/transform/read/index.js +0 -43
- package/dist/transform/read/index.js.map +0 -1
- package/dist/transform/read/relationship.d.ts +0 -10
- package/dist/transform/read/relationship.d.ts.map +0 -1
- package/dist/transform/read/relationship.js +0 -64
- package/dist/transform/read/relationship.js.map +0 -1
- package/dist/transform/read/traverseFields.d.ts +0 -52
- package/dist/transform/read/traverseFields.d.ts.map +0 -1
- package/dist/transform/read/traverseFields.js +0 -421
- package/dist/transform/read/traverseFields.js.map +0 -1
- package/dist/transform/write/array.d.ts +0 -26
- package/dist/transform/write/array.d.ts.map +0 -1
- package/dist/transform/write/array.js +0 -58
- package/dist/transform/write/array.js.map +0 -1
- package/dist/transform/write/blocks.d.ts +0 -25
- package/dist/transform/write/blocks.d.ts.map +0 -1
- package/dist/transform/write/blocks.js +0 -54
- package/dist/transform/write/blocks.js.map +0 -1
- package/dist/transform/write/index.d.ts +0 -13
- package/dist/transform/write/index.d.ts.map +0 -1
- package/dist/transform/write/index.js +0 -41
- package/dist/transform/write/index.js.map +0 -1
- package/dist/transform/write/numbers.d.ts +0 -8
- package/dist/transform/write/numbers.d.ts.map +0 -1
- package/dist/transform/write/numbers.js +0 -11
- package/dist/transform/write/numbers.js.map +0 -1
- package/dist/transform/write/relationships.d.ts +0 -10
- package/dist/transform/write/relationships.d.ts.map +0 -1
- package/dist/transform/write/relationships.js +0 -23
- package/dist/transform/write/relationships.js.map +0 -1
- package/dist/transform/write/selects.d.ts +0 -8
- package/dist/transform/write/selects.d.ts.map +0 -1
- package/dist/transform/write/selects.js +0 -20
- package/dist/transform/write/selects.js.map +0 -1
- package/dist/transform/write/texts.d.ts +0 -8
- package/dist/transform/write/texts.d.ts.map +0 -1
- package/dist/transform/write/texts.js +0 -11
- package/dist/transform/write/texts.js.map +0 -1
- package/dist/transform/write/traverseFields.d.ts +0 -50
- package/dist/transform/write/traverseFields.d.ts.map +0 -1
- package/dist/transform/write/traverseFields.js +0 -428
- package/dist/transform/write/traverseFields.js.map +0 -1
- package/dist/transform/write/types.d.ts +0 -43
- package/dist/transform/write/types.d.ts.map +0 -1
- package/dist/transform/write/types.js +0 -3
- package/dist/transform/write/types.js.map +0 -1
- package/dist/update.d.ts +0 -3
- package/dist/update.d.ts.map +0 -1
- package/dist/update.js +0 -58
- package/dist/update.js.map +0 -1
- package/dist/updateGlobal.d.ts +0 -5
- package/dist/updateGlobal.d.ts.map +0 -1
- package/dist/updateGlobal.js +0 -28
- package/dist/updateGlobal.js.map +0 -1
- package/dist/updateGlobalVersion.d.ts +0 -5
- package/dist/updateGlobalVersion.d.ts.map +0 -1
- package/dist/updateGlobalVersion.js +0 -40
- package/dist/updateGlobalVersion.js.map +0 -1
- package/dist/updateVersion.d.ts +0 -5
- package/dist/updateVersion.d.ts.map +0 -1
- package/dist/updateVersion.js +0 -40
- package/dist/updateVersion.js.map +0 -1
- package/dist/upsertRow/deleteExistingArrayRows.d.ts +0 -10
- package/dist/upsertRow/deleteExistingArrayRows.d.ts.map +0 -1
- package/dist/upsertRow/deleteExistingArrayRows.js +0 -10
- package/dist/upsertRow/deleteExistingArrayRows.js.map +0 -1
- package/dist/upsertRow/deleteExistingRowsByPath.d.ts +0 -14
- package/dist/upsertRow/deleteExistingRowsByPath.d.ts.map +0 -1
- package/dist/upsertRow/deleteExistingRowsByPath.js +0 -33
- package/dist/upsertRow/deleteExistingRowsByPath.js.map +0 -1
- package/dist/upsertRow/index.d.ts +0 -4
- package/dist/upsertRow/index.d.ts.map +0 -1
- package/dist/upsertRow/index.js +0 -276
- package/dist/upsertRow/index.js.map +0 -1
- package/dist/upsertRow/insertArrays.d.ts +0 -13
- package/dist/upsertRow/insertArrays.d.ts.map +0 -1
- package/dist/upsertRow/insertArrays.js +0 -68
- package/dist/upsertRow/insertArrays.js.map +0 -1
- package/dist/upsertRow/types.d.ts +0 -27
- package/dist/upsertRow/types.d.ts.map +0 -1
- package/dist/upsertRow/types.js +0 -3
- package/dist/upsertRow/types.js.map +0 -1
- package/dist/utilities/appendPrefixToKeys.d.ts +0 -2
- package/dist/utilities/appendPrefixToKeys.d.ts.map +0 -1
- package/dist/utilities/appendPrefixToKeys.js +0 -6
- package/dist/utilities/appendPrefixToKeys.js.map +0 -1
- package/dist/utilities/createBlocksMap.d.ts +0 -5
- package/dist/utilities/createBlocksMap.d.ts.map +0 -1
- package/dist/utilities/createBlocksMap.js +0 -29
- package/dist/utilities/createBlocksMap.js.map +0 -1
- package/dist/utilities/createMigrationTable.d.ts +0 -3
- package/dist/utilities/createMigrationTable.d.ts.map +0 -1
- package/dist/utilities/createMigrationTable.js +0 -13
- package/dist/utilities/createMigrationTable.js.map +0 -1
- package/dist/utilities/createRelationshipMap.d.ts +0 -2
- package/dist/utilities/createRelationshipMap.d.ts.map +0 -1
- package/dist/utilities/createRelationshipMap.js +0 -19
- package/dist/utilities/createRelationshipMap.js.map +0 -1
- package/dist/utilities/hasLocalesTable.d.ts +0 -3
- package/dist/utilities/hasLocalesTable.d.ts.map +0 -1
- package/dist/utilities/hasLocalesTable.js +0 -11
- package/dist/utilities/hasLocalesTable.js.map +0 -1
- package/dist/utilities/isArrayOfRows.d.ts +0 -2
- package/dist/utilities/isArrayOfRows.d.ts.map +0 -1
- package/dist/utilities/isArrayOfRows.js +0 -5
- package/dist/utilities/isArrayOfRows.js.map +0 -1
- package/dist/utilities/migrationTableExists.d.ts +0 -3
- package/dist/utilities/migrationTableExists.d.ts.map +0 -1
- package/dist/utilities/migrationTableExists.js +0 -9
- package/dist/utilities/migrationTableExists.js.map +0 -1
- package/dist/utilities/parseError.d.ts +0 -5
- package/dist/utilities/parseError.d.ts.map +0 -1
- package/dist/utilities/parseError.js +0 -17
- package/dist/utilities/parseError.js.map +0 -1
- package/dist/utilities/pushDevSchema.d.ts +0 -9
- package/dist/utilities/pushDevSchema.d.ts.map +0 -1
- package/dist/utilities/pushDevSchema.js +0 -58
- package/dist/utilities/pushDevSchema.js.map +0 -1
- package/src/index.ts +0 -156
- /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/updateGlobal.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../src/updateGlobal.ts"],"sourcesContent":["import type { UpdateGlobalArgs } from 'payload/database'\nimport type { PayloadRequest, TypeWithID } from 'payload/types'\n\nimport type { PostgresAdapter } from './types.js'\n\nimport { getTableName } from './schema/getTableName.js'\nimport { upsertRow } from './upsertRow/index.js'\n\nexport async function updateGlobal<T extends TypeWithID>(\n this: PostgresAdapter,\n { slug, data, req = {} as PayloadRequest }: UpdateGlobalArgs,\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 const tableName = getTableName({\n adapter: this,\n config: globalConfig,\n })\n\n const existingGlobal = await db.query[tableName].findFirst({})\n\n const result = await upsertRow<T>({\n ...(existingGlobal ? { id: existingGlobal.id, operation: 'update' } : { operation: 'create' }),\n adapter: this,\n data,\n db,\n fields: globalConfig.fields,\n req,\n tableName,\n })\n\n return result\n}\n"],"names":["getTableName","upsertRow","updateGlobal","slug","data","req","db","sessions","transactionID","drizzle","globalConfig","payload","globals","config","find","tableName","adapter","existingGlobal","query","findFirst","result","id","operation","fields"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAKA,SAASA,YAAY,QAAQ,2BAA0B;AACvD,SAASC,SAAS,QAAQ,uBAAsB;AAEhD,OAAO,eAAeC,aAEpB,EAAEC,IAAI,EAAEC,IAAI,EAAEC,MAAM,CAAC,CAAmB,EAAoB;IAE5D,MAAMC,KAAK,IAAI,CAACC,QAAQ,CAACF,IAAIG,aAAa,CAAC,EAAEF,MAAM,IAAI,CAACG,OAAO;IAC/D,MAAMC,eAAe,IAAI,CAACC,OAAO,CAACC,OAAO,CAACC,MAAM,CAACC,IAAI,CAAC,CAACD,SAAWA,OAAOV,IAAI,KAAKA;IAClF,MAAMY,YAAYf,aAAa;QAC7BgB,SAAS,IAAI;QACbH,QAAQH;IACV;IAEA,MAAMO,iBAAiB,MAAMX,GAAGY,KAAK,CAACH,UAAU,CAACI,SAAS,CAAC,CAAC;IAE5D,MAAMC,SAAS,MAAMnB,UAAa;QAChC,GAAIgB,iBAAiB;YAAEI,IAAIJ,eAAeI,EAAE;YAAEC,WAAW;QAAS,IAAI;YAAEA,WAAW;QAAS,CAAC;QAC7FN,SAAS,IAAI;QACbZ;QACAE;QACAiB,QAAQb,aAAaa,MAAM;QAC3BlB;QACAU;IACF;IAEA,OAAOK;AACT"}
|
@@ -1,5 +0,0 @@
|
|
1
|
-
import type { TypeWithVersion, UpdateGlobalVersionArgs } from 'payload/database';
|
2
|
-
import type { TypeWithID } from 'payload/types';
|
3
|
-
import type { PostgresAdapter } from './types.js';
|
4
|
-
export declare function updateGlobalVersion<T extends TypeWithID>(this: PostgresAdapter, { id, global, locale, req, versionData, where: whereArg, }: UpdateGlobalVersionArgs<T>): Promise<TypeWithVersion<T>>;
|
5
|
-
//# sourceMappingURL=updateGlobalVersion.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"updateGlobalVersion.d.ts","sourceRoot":"","sources":["../src/updateGlobalVersion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAA;AAChF,OAAO,KAAK,EAAyC,UAAU,EAAE,MAAM,eAAe,CAAA;AAItF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAMjD,wBAAsB,mBAAmB,CAAC,CAAC,SAAS,UAAU,EAC5D,IAAI,EAAE,eAAe,EACrB,EACE,EAAE,EACF,MAAM,EACN,MAAM,EACN,GAA0B,EAC1B,WAAW,EACX,KAAK,EAAE,QAAQ,GAChB,EAAE,uBAAuB,CAAC,CAAC,CAAC,+BAmC9B"}
|
@@ -1,40 +0,0 @@
|
|
1
|
-
import { buildVersionGlobalFields } from 'payload/versions';
|
2
|
-
import buildQuery from './queries/buildQuery.js';
|
3
|
-
import { getTableName } from './schema/getTableName.js';
|
4
|
-
import { upsertRow } from './upsertRow/index.js';
|
5
|
-
export async function updateGlobalVersion({ id, global, locale, req = {}, versionData, where: whereArg }) {
|
6
|
-
const db = this.sessions[req.transactionID]?.db || this.drizzle;
|
7
|
-
const globalConfig = this.payload.globals.config.find(({ slug })=>slug === global);
|
8
|
-
const whereToUse = whereArg || {
|
9
|
-
id: {
|
10
|
-
equals: id
|
11
|
-
}
|
12
|
-
};
|
13
|
-
const tableName = getTableName({
|
14
|
-
adapter: this,
|
15
|
-
config: globalConfig,
|
16
|
-
versions: true
|
17
|
-
});
|
18
|
-
const fields = buildVersionGlobalFields(globalConfig);
|
19
|
-
const { where } = await buildQuery({
|
20
|
-
adapter: this,
|
21
|
-
fields,
|
22
|
-
locale,
|
23
|
-
tableName,
|
24
|
-
where: whereToUse
|
25
|
-
});
|
26
|
-
const result = await upsertRow({
|
27
|
-
id,
|
28
|
-
adapter: this,
|
29
|
-
data: versionData,
|
30
|
-
db,
|
31
|
-
fields,
|
32
|
-
operation: 'update',
|
33
|
-
req,
|
34
|
-
tableName,
|
35
|
-
where
|
36
|
-
});
|
37
|
-
return result;
|
38
|
-
}
|
39
|
-
|
40
|
-
//# sourceMappingURL=updateGlobalVersion.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../src/updateGlobalVersion.ts"],"sourcesContent":["import type { TypeWithVersion, UpdateGlobalVersionArgs } from 'payload/database'\nimport type { PayloadRequest, SanitizedGlobalConfig, TypeWithID } from 'payload/types'\n\nimport { buildVersionGlobalFields } from 'payload/versions'\n\nimport type { PostgresAdapter } from './types.js'\n\nimport buildQuery from './queries/buildQuery.js'\nimport { getTableName } from './schema/getTableName.js'\nimport { upsertRow } from './upsertRow/index.js'\n\nexport async function updateGlobalVersion<T extends TypeWithID>(\n this: PostgresAdapter,\n {\n id,\n global,\n locale,\n req = {} as PayloadRequest,\n versionData,\n where: whereArg,\n }: UpdateGlobalVersionArgs<T>,\n) {\n const db = this.sessions[req.transactionID]?.db || this.drizzle\n const globalConfig: SanitizedGlobalConfig = this.payload.globals.config.find(\n ({ slug }) => slug === global,\n )\n const whereToUse = whereArg || { id: { equals: id } }\n const tableName = getTableName({\n adapter: this,\n config: globalConfig,\n versions: true,\n })\n const fields = buildVersionGlobalFields(globalConfig)\n\n const { where } = await buildQuery({\n adapter: this,\n fields,\n locale,\n tableName,\n where: whereToUse,\n })\n\n const result = await upsertRow<TypeWithVersion<T>>({\n id,\n adapter: this,\n data: versionData,\n db,\n fields,\n operation: 'update',\n req,\n tableName,\n where,\n })\n\n return result\n}\n"],"names":["buildVersionGlobalFields","buildQuery","getTableName","upsertRow","updateGlobalVersion","id","global","locale","req","versionData","where","whereArg","db","sessions","transactionID","drizzle","globalConfig","payload","globals","config","find","slug","whereToUse","equals","tableName","adapter","versions","fields","result","data","operation"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAGA,SAASA,wBAAwB,QAAQ,mBAAkB;AAI3D,OAAOC,gBAAgB,0BAAyB;AAChD,SAASC,YAAY,QAAQ,2BAA0B;AACvD,SAASC,SAAS,QAAQ,uBAAsB;AAEhD,OAAO,eAAeC,oBAEpB,EACEC,EAAE,EACFC,MAAM,EACNC,MAAM,EACNC,MAAM,CAAC,CAAmB,EAC1BC,WAAW,EACXC,OAAOC,QAAQ,EACY;IAE7B,MAAMC,KAAK,IAAI,CAACC,QAAQ,CAACL,IAAIM,aAAa,CAAC,EAAEF,MAAM,IAAI,CAACG,OAAO;IAC/D,MAAMC,eAAsC,IAAI,CAACC,OAAO,CAACC,OAAO,CAACC,MAAM,CAACC,IAAI,CAC1E,CAAC,EAAEC,IAAI,EAAE,GAAKA,SAASf;IAEzB,MAAMgB,aAAaX,YAAY;QAAEN,IAAI;YAAEkB,QAAQlB;QAAG;IAAE;IACpD,MAAMmB,YAAYtB,aAAa;QAC7BuB,SAAS,IAAI;QACbN,QAAQH;QACRU,UAAU;IACZ;IACA,MAAMC,SAAS3B,yBAAyBgB;IAExC,MAAM,EAAEN,KAAK,EAAE,GAAG,MAAMT,WAAW;QACjCwB,SAAS,IAAI;QACbE;QACApB;QACAiB;QACAd,OAAOY;IACT;IAEA,MAAMM,SAAS,MAAMzB,UAA8B;QACjDE;QACAoB,SAAS,IAAI;QACbI,MAAMpB;QACNG;QACAe;QACAG,WAAW;QACXtB;QACAgB;QACAd;IACF;IAEA,OAAOkB;AACT"}
|
package/dist/updateVersion.d.ts
DELETED
@@ -1,5 +0,0 @@
|
|
1
|
-
import type { TypeWithVersion, UpdateVersionArgs } from 'payload/database';
|
2
|
-
import type { TypeWithID } from 'payload/types';
|
3
|
-
import type { PostgresAdapter } from './types.js';
|
4
|
-
export declare function updateVersion<T extends TypeWithID>(this: PostgresAdapter, { id, collection, locale, req, versionData, where: whereArg, }: UpdateVersionArgs<T>): Promise<TypeWithVersion<T>>;
|
5
|
-
//# sourceMappingURL=updateVersion.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"updateVersion.d.ts","sourceRoot":"","sources":["../src/updateVersion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AAC1E,OAAO,KAAK,EAA6C,UAAU,EAAE,MAAM,eAAe,CAAA;AAI1F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAMjD,wBAAsB,aAAa,CAAC,CAAC,SAAS,UAAU,EACtD,IAAI,EAAE,eAAe,EACrB,EACE,EAAE,EACF,UAAU,EACV,MAAM,EACN,GAA0B,EAC1B,WAAW,EACX,KAAK,EAAE,QAAQ,GAChB,EAAE,iBAAiB,CAAC,CAAC,CAAC,+BAiCxB"}
|
package/dist/updateVersion.js
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
import { buildVersionCollectionFields } from 'payload/versions';
|
2
|
-
import buildQuery from './queries/buildQuery.js';
|
3
|
-
import { getTableName } from './schema/getTableName.js';
|
4
|
-
import { upsertRow } from './upsertRow/index.js';
|
5
|
-
export async function updateVersion({ id, collection, locale, req = {}, versionData, where: whereArg }) {
|
6
|
-
const db = this.sessions[req.transactionID]?.db || this.drizzle;
|
7
|
-
const collectionConfig = this.payload.collections[collection].config;
|
8
|
-
const whereToUse = whereArg || {
|
9
|
-
id: {
|
10
|
-
equals: id
|
11
|
-
}
|
12
|
-
};
|
13
|
-
const tableName = getTableName({
|
14
|
-
adapter: this,
|
15
|
-
config: collectionConfig,
|
16
|
-
versions: true
|
17
|
-
});
|
18
|
-
const fields = buildVersionCollectionFields(collectionConfig);
|
19
|
-
const { where } = await buildQuery({
|
20
|
-
adapter: this,
|
21
|
-
fields,
|
22
|
-
locale,
|
23
|
-
tableName,
|
24
|
-
where: whereToUse
|
25
|
-
});
|
26
|
-
const result = await upsertRow({
|
27
|
-
id,
|
28
|
-
adapter: this,
|
29
|
-
data: versionData,
|
30
|
-
db,
|
31
|
-
fields,
|
32
|
-
operation: 'update',
|
33
|
-
req,
|
34
|
-
tableName,
|
35
|
-
where
|
36
|
-
});
|
37
|
-
return result;
|
38
|
-
}
|
39
|
-
|
40
|
-
//# sourceMappingURL=updateVersion.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../src/updateVersion.ts"],"sourcesContent":["import type { TypeWithVersion, UpdateVersionArgs } from 'payload/database'\nimport type { PayloadRequest, SanitizedCollectionConfig, TypeWithID } from 'payload/types'\n\nimport { buildVersionCollectionFields } from 'payload/versions'\n\nimport type { PostgresAdapter } from './types.js'\n\nimport buildQuery from './queries/buildQuery.js'\nimport { getTableName } from './schema/getTableName.js'\nimport { upsertRow } from './upsertRow/index.js'\n\nexport async function updateVersion<T extends TypeWithID>(\n this: PostgresAdapter,\n {\n id,\n collection,\n locale,\n req = {} as PayloadRequest,\n versionData,\n where: whereArg,\n }: UpdateVersionArgs<T>,\n) {\n const db = this.sessions[req.transactionID]?.db || this.drizzle\n const collectionConfig: SanitizedCollectionConfig = this.payload.collections[collection].config\n const whereToUse = whereArg || { id: { equals: id } }\n const tableName = getTableName({\n adapter: this,\n config: collectionConfig,\n versions: true,\n })\n const fields = buildVersionCollectionFields(collectionConfig)\n\n const { where } = await buildQuery({\n adapter: this,\n fields,\n locale,\n tableName,\n where: whereToUse,\n })\n\n const result = await upsertRow<TypeWithVersion<T>>({\n id,\n adapter: this,\n data: versionData,\n db,\n fields,\n operation: 'update',\n req,\n tableName,\n where,\n })\n\n return result\n}\n"],"names":["buildVersionCollectionFields","buildQuery","getTableName","upsertRow","updateVersion","id","collection","locale","req","versionData","where","whereArg","db","sessions","transactionID","drizzle","collectionConfig","payload","collections","config","whereToUse","equals","tableName","adapter","versions","fields","result","data","operation"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAGA,SAASA,4BAA4B,QAAQ,mBAAkB;AAI/D,OAAOC,gBAAgB,0BAAyB;AAChD,SAASC,YAAY,QAAQ,2BAA0B;AACvD,SAASC,SAAS,QAAQ,uBAAsB;AAEhD,OAAO,eAAeC,cAEpB,EACEC,EAAE,EACFC,UAAU,EACVC,MAAM,EACNC,MAAM,CAAC,CAAmB,EAC1BC,WAAW,EACXC,OAAOC,QAAQ,EACM;IAEvB,MAAMC,KAAK,IAAI,CAACC,QAAQ,CAACL,IAAIM,aAAa,CAAC,EAAEF,MAAM,IAAI,CAACG,OAAO;IAC/D,MAAMC,mBAA8C,IAAI,CAACC,OAAO,CAACC,WAAW,CAACZ,WAAW,CAACa,MAAM;IAC/F,MAAMC,aAAaT,YAAY;QAAEN,IAAI;YAAEgB,QAAQhB;QAAG;IAAE;IACpD,MAAMiB,YAAYpB,aAAa;QAC7BqB,SAAS,IAAI;QACbJ,QAAQH;QACRQ,UAAU;IACZ;IACA,MAAMC,SAASzB,6BAA6BgB;IAE5C,MAAM,EAAEN,KAAK,EAAE,GAAG,MAAMT,WAAW;QACjCsB,SAAS,IAAI;QACbE;QACAlB;QACAe;QACAZ,OAAOU;IACT;IAEA,MAAMM,SAAS,MAAMvB,UAA8B;QACjDE;QACAkB,SAAS,IAAI;QACbI,MAAMlB;QACNG;QACAa;QACAG,WAAW;QACXpB;QACAc;QACAZ;IACF;IAEA,OAAOgB;AACT"}
|
@@ -1,10 +0,0 @@
|
|
1
|
-
import type { DrizzleDB, PostgresAdapter } from '../types.js';
|
2
|
-
type Args = {
|
3
|
-
adapter: PostgresAdapter;
|
4
|
-
db: DrizzleDB;
|
5
|
-
parentID: unknown;
|
6
|
-
tableName: string;
|
7
|
-
};
|
8
|
-
export declare const deleteExistingArrayRows: ({ adapter, db, parentID, tableName, }: Args) => Promise<void>;
|
9
|
-
export {};
|
10
|
-
//# sourceMappingURL=deleteExistingArrayRows.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"deleteExistingArrayRows.d.ts","sourceRoot":"","sources":["../../src/upsertRow/deleteExistingArrayRows.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAE7D,KAAK,IAAI,GAAG;IACV,OAAO,EAAE,eAAe,CAAA;IACxB,EAAE,EAAE,SAAS,CAAA;IACb,QAAQ,EAAE,OAAO,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,eAAO,MAAM,uBAAuB,0CAKjC,IAAI,KAAG,QAAQ,IAAI,CAMrB,CAAA"}
|
@@ -1,10 +0,0 @@
|
|
1
|
-
import { and, eq } from 'drizzle-orm';
|
2
|
-
export const deleteExistingArrayRows = async ({ adapter, db, parentID, tableName })=>{
|
3
|
-
const table = adapter.tables[tableName];
|
4
|
-
const whereConstraints = [
|
5
|
-
eq(table._parentID, parentID)
|
6
|
-
];
|
7
|
-
await db.delete(table).where(and(...whereConstraints));
|
8
|
-
};
|
9
|
-
|
10
|
-
//# sourceMappingURL=deleteExistingArrayRows.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../../src/upsertRow/deleteExistingArrayRows.ts"],"sourcesContent":["import { and, eq } from 'drizzle-orm'\n\nimport type { DrizzleDB, PostgresAdapter } from '../types.js'\n\ntype Args = {\n adapter: PostgresAdapter\n db: DrizzleDB\n parentID: unknown\n tableName: string\n}\n\nexport const deleteExistingArrayRows = async ({\n adapter,\n db,\n parentID,\n tableName,\n}: Args): Promise<void> => {\n const table = adapter.tables[tableName]\n\n const whereConstraints = [eq(table._parentID, parentID)]\n\n await db.delete(table).where(and(...whereConstraints))\n}\n"],"names":["and","eq","deleteExistingArrayRows","adapter","db","parentID","tableName","table","tables","whereConstraints","_parentID","delete","where"],"rangeMappings":";;;;;;;","mappings":"AAAA,SAASA,GAAG,EAAEC,EAAE,QAAQ,cAAa;AAWrC,OAAO,MAAMC,0BAA0B,OAAO,EAC5CC,OAAO,EACPC,EAAE,EACFC,QAAQ,EACRC,SAAS,EACJ;IACL,MAAMC,QAAQJ,QAAQK,MAAM,CAACF,UAAU;IAEvC,MAAMG,mBAAmB;QAACR,GAAGM,MAAMG,SAAS,EAAEL;KAAU;IAExD,MAAMD,GAAGO,MAAM,CAACJ,OAAOK,KAAK,CAACZ,OAAOS;AACtC,EAAC"}
|
@@ -1,14 +0,0 @@
|
|
1
|
-
import type { DrizzleDB, PostgresAdapter } from '../types.js';
|
2
|
-
type Args = {
|
3
|
-
adapter: PostgresAdapter;
|
4
|
-
db: DrizzleDB;
|
5
|
-
localeColumnName?: string;
|
6
|
-
parentColumnName?: string;
|
7
|
-
parentID: unknown;
|
8
|
-
pathColumnName?: string;
|
9
|
-
rows: Record<string, unknown>[];
|
10
|
-
tableName: string;
|
11
|
-
};
|
12
|
-
export declare const deleteExistingRowsByPath: ({ adapter, db, localeColumnName, parentColumnName, parentID, pathColumnName, rows, tableName, }: Args) => Promise<void>;
|
13
|
-
export {};
|
14
|
-
//# sourceMappingURL=deleteExistingRowsByPath.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"deleteExistingRowsByPath.d.ts","sourceRoot":"","sources":["../../src/upsertRow/deleteExistingRowsByPath.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAE7D,KAAK,IAAI,GAAG;IACV,OAAO,EAAE,eAAe,CAAA;IACxB,EAAE,EAAE,SAAS,CAAA;IACb,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,QAAQ,EAAE,OAAO,CAAA;IACjB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAA;IAC/B,SAAS,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,eAAO,MAAM,wBAAwB,oGASlC,IAAI,KAAG,QAAQ,IAAI,CAkCrB,CAAA"}
|
@@ -1,33 +0,0 @@
|
|
1
|
-
import { and, eq, inArray } from 'drizzle-orm';
|
2
|
-
export const deleteExistingRowsByPath = async ({ adapter, db, localeColumnName = '_locale', parentColumnName = '_parentID', parentID, pathColumnName = '_path', rows, tableName })=>{
|
3
|
-
const localizedPathsToDelete = new Set();
|
4
|
-
const pathsToDelete = new Set();
|
5
|
-
const table = adapter.tables[tableName];
|
6
|
-
rows.forEach((row)=>{
|
7
|
-
const path = row[pathColumnName];
|
8
|
-
const localeData = row[localeColumnName];
|
9
|
-
if (typeof path === 'string') {
|
10
|
-
if (typeof localeData === 'string') {
|
11
|
-
localizedPathsToDelete.add(path);
|
12
|
-
} else {
|
13
|
-
pathsToDelete.add(path);
|
14
|
-
}
|
15
|
-
}
|
16
|
-
});
|
17
|
-
if (localizedPathsToDelete.size > 0) {
|
18
|
-
const whereConstraints = [
|
19
|
-
eq(table[parentColumnName], parentID)
|
20
|
-
];
|
21
|
-
if (pathColumnName) whereConstraints.push(inArray(table[pathColumnName], Array.from(localizedPathsToDelete)));
|
22
|
-
await db.delete(table).where(and(...whereConstraints));
|
23
|
-
}
|
24
|
-
if (pathsToDelete.size > 0) {
|
25
|
-
const whereConstraints = [
|
26
|
-
eq(table[parentColumnName], parentID)
|
27
|
-
];
|
28
|
-
if (pathColumnName) whereConstraints.push(inArray(table[pathColumnName], Array.from(pathsToDelete)));
|
29
|
-
await db.delete(table).where(and(...whereConstraints));
|
30
|
-
}
|
31
|
-
};
|
32
|
-
|
33
|
-
//# sourceMappingURL=deleteExistingRowsByPath.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../../src/upsertRow/deleteExistingRowsByPath.ts"],"sourcesContent":["import { and, eq, inArray } from 'drizzle-orm'\n\nimport type { DrizzleDB, PostgresAdapter } from '../types.js'\n\ntype Args = {\n adapter: PostgresAdapter\n db: DrizzleDB\n localeColumnName?: string\n parentColumnName?: string\n parentID: unknown\n pathColumnName?: string\n rows: Record<string, unknown>[]\n tableName: string\n}\n\nexport const deleteExistingRowsByPath = async ({\n adapter,\n db,\n localeColumnName = '_locale',\n parentColumnName = '_parentID',\n parentID,\n pathColumnName = '_path',\n rows,\n tableName,\n}: Args): Promise<void> => {\n const localizedPathsToDelete = new Set<string>()\n const pathsToDelete = new Set<string>()\n const table = adapter.tables[tableName]\n\n rows.forEach((row) => {\n const path = row[pathColumnName]\n const localeData = row[localeColumnName]\n if (typeof path === 'string') {\n if (typeof localeData === 'string') {\n localizedPathsToDelete.add(path)\n } else {\n pathsToDelete.add(path)\n }\n }\n })\n\n if (localizedPathsToDelete.size > 0) {\n const whereConstraints = [eq(table[parentColumnName], parentID)]\n\n if (pathColumnName)\n whereConstraints.push(inArray(table[pathColumnName], Array.from(localizedPathsToDelete)))\n\n await db.delete(table).where(and(...whereConstraints))\n }\n\n if (pathsToDelete.size > 0) {\n const whereConstraints = [eq(table[parentColumnName], parentID)]\n\n if (pathColumnName)\n whereConstraints.push(inArray(table[pathColumnName], Array.from(pathsToDelete)))\n\n await db.delete(table).where(and(...whereConstraints))\n }\n}\n"],"names":["and","eq","inArray","deleteExistingRowsByPath","adapter","db","localeColumnName","parentColumnName","parentID","pathColumnName","rows","tableName","localizedPathsToDelete","Set","pathsToDelete","table","tables","forEach","row","path","localeData","add","size","whereConstraints","push","Array","from","delete","where"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,GAAG,EAAEC,EAAE,EAAEC,OAAO,QAAQ,cAAa;AAe9C,OAAO,MAAMC,2BAA2B,OAAO,EAC7CC,OAAO,EACPC,EAAE,EACFC,mBAAmB,SAAS,EAC5BC,mBAAmB,WAAW,EAC9BC,QAAQ,EACRC,iBAAiB,OAAO,EACxBC,IAAI,EACJC,SAAS,EACJ;IACL,MAAMC,yBAAyB,IAAIC;IACnC,MAAMC,gBAAgB,IAAID;IAC1B,MAAME,QAAQX,QAAQY,MAAM,CAACL,UAAU;IAEvCD,KAAKO,OAAO,CAAC,CAACC;QACZ,MAAMC,OAAOD,GAAG,CAACT,eAAe;QAChC,MAAMW,aAAaF,GAAG,CAACZ,iBAAiB;QACxC,IAAI,OAAOa,SAAS,UAAU;YAC5B,IAAI,OAAOC,eAAe,UAAU;gBAClCR,uBAAuBS,GAAG,CAACF;YAC7B,OAAO;gBACLL,cAAcO,GAAG,CAACF;YACpB;QACF;IACF;IAEA,IAAIP,uBAAuBU,IAAI,GAAG,GAAG;QACnC,MAAMC,mBAAmB;YAACtB,GAAGc,KAAK,CAACR,iBAAiB,EAAEC;SAAU;QAEhE,IAAIC,gBACFc,iBAAiBC,IAAI,CAACtB,QAAQa,KAAK,CAACN,eAAe,EAAEgB,MAAMC,IAAI,CAACd;QAElE,MAAMP,GAAGsB,MAAM,CAACZ,OAAOa,KAAK,CAAC5B,OAAOuB;IACtC;IAEA,IAAIT,cAAcQ,IAAI,GAAG,GAAG;QAC1B,MAAMC,mBAAmB;YAACtB,GAAGc,KAAK,CAACR,iBAAiB,EAAEC;SAAU;QAEhE,IAAIC,gBACFc,iBAAiBC,IAAI,CAACtB,QAAQa,KAAK,CAACN,eAAe,EAAEgB,MAAMC,IAAI,CAACZ;QAElE,MAAMT,GAAGsB,MAAM,CAACZ,OAAOa,KAAK,CAAC5B,OAAOuB;IACtC;AACF,EAAC"}
|
@@ -1,4 +0,0 @@
|
|
1
|
-
import type { TypeWithID } from 'payload/types';
|
2
|
-
import type { Args } from './types.js';
|
3
|
-
export declare const upsertRow: <T extends TypeWithID>({ id, adapter, data, db, fields, operation, path, req, tableName, upsertTarget, where, }: Args) => Promise<T>;
|
4
|
-
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/upsertRow/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAM/C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAStC,eAAO,MAAM,SAAS,mHAYnB,IAAI,KAAG,QAAQ,CAAC,CAkUlB,CAAA"}
|
package/dist/upsertRow/index.js
DELETED
@@ -1,276 +0,0 @@
|
|
1
|
-
/* eslint-disable no-param-reassign */ import { eq } from 'drizzle-orm';
|
2
|
-
import { ValidationError } from 'payload/errors';
|
3
|
-
import { buildFindManyArgs } from '../find/buildFindManyArgs.js';
|
4
|
-
import { transform } from '../transform/read/index.js';
|
5
|
-
import { transformForWrite } from '../transform/write/index.js';
|
6
|
-
import { deleteExistingArrayRows } from './deleteExistingArrayRows.js';
|
7
|
-
import { deleteExistingRowsByPath } from './deleteExistingRowsByPath.js';
|
8
|
-
import { insertArrays } from './insertArrays.js';
|
9
|
-
export const upsertRow = async ({ id, adapter, data, db, fields, operation, path = '', req, tableName, upsertTarget, where })=>{
|
10
|
-
// Split out the incoming data into the corresponding:
|
11
|
-
// base row, locales, relationships, blocks, and arrays
|
12
|
-
const rowToInsert = transformForWrite({
|
13
|
-
adapter,
|
14
|
-
data,
|
15
|
-
fields,
|
16
|
-
path,
|
17
|
-
tableName
|
18
|
-
});
|
19
|
-
// First, we insert the main row
|
20
|
-
let insertedRow;
|
21
|
-
try {
|
22
|
-
if (operation === 'update') {
|
23
|
-
const target = upsertTarget || adapter.tables[tableName].id;
|
24
|
-
if (id) {
|
25
|
-
rowToInsert.row.id = id;
|
26
|
-
[insertedRow] = await db.insert(adapter.tables[tableName]).values(rowToInsert.row).onConflictDoUpdate({
|
27
|
-
set: rowToInsert.row,
|
28
|
-
target
|
29
|
-
}).returning();
|
30
|
-
} else {
|
31
|
-
[insertedRow] = await db.insert(adapter.tables[tableName]).values(rowToInsert.row).onConflictDoUpdate({
|
32
|
-
set: rowToInsert.row,
|
33
|
-
target,
|
34
|
-
where
|
35
|
-
}).returning();
|
36
|
-
}
|
37
|
-
} else {
|
38
|
-
[insertedRow] = await db.insert(adapter.tables[tableName]).values(rowToInsert.row).returning();
|
39
|
-
}
|
40
|
-
const localesToInsert = [];
|
41
|
-
const relationsToInsert = [];
|
42
|
-
const textsToInsert = [];
|
43
|
-
const numbersToInsert = [];
|
44
|
-
const blocksToInsert = {};
|
45
|
-
const selectsToInsert = {};
|
46
|
-
// If there are locale rows with data, add the parent and locale to each
|
47
|
-
if (Object.keys(rowToInsert.locales).length > 0) {
|
48
|
-
Object.entries(rowToInsert.locales).forEach(([locale, localeRow])=>{
|
49
|
-
localeRow._parentID = insertedRow.id;
|
50
|
-
localeRow._locale = locale;
|
51
|
-
localesToInsert.push(localeRow);
|
52
|
-
});
|
53
|
-
}
|
54
|
-
// If there are relationships, add parent to each
|
55
|
-
if (rowToInsert.relationships.length > 0) {
|
56
|
-
rowToInsert.relationships.forEach((relation)=>{
|
57
|
-
relation.parent = insertedRow.id;
|
58
|
-
relationsToInsert.push(relation);
|
59
|
-
});
|
60
|
-
}
|
61
|
-
// If there are texts, add parent to each
|
62
|
-
if (rowToInsert.texts.length > 0) {
|
63
|
-
rowToInsert.texts.forEach((textRow)=>{
|
64
|
-
textRow.parent = insertedRow.id;
|
65
|
-
textsToInsert.push(textRow);
|
66
|
-
});
|
67
|
-
}
|
68
|
-
// If there are numbers, add parent to each
|
69
|
-
if (rowToInsert.numbers.length > 0) {
|
70
|
-
rowToInsert.numbers.forEach((numberRow)=>{
|
71
|
-
numberRow.parent = insertedRow.id;
|
72
|
-
numbersToInsert.push(numberRow);
|
73
|
-
});
|
74
|
-
}
|
75
|
-
// If there are selects, add parent to each, and then
|
76
|
-
// store by table name and rows
|
77
|
-
if (Object.keys(rowToInsert.selects).length > 0) {
|
78
|
-
Object.entries(rowToInsert.selects).forEach(([selectTableName, selectRows])=>{
|
79
|
-
selectRows.forEach((row)=>{
|
80
|
-
if (typeof row.parent === 'undefined') {
|
81
|
-
row.parent = insertedRow.id;
|
82
|
-
}
|
83
|
-
if (!selectsToInsert[selectTableName]) selectsToInsert[selectTableName] = [];
|
84
|
-
selectsToInsert[selectTableName].push(row);
|
85
|
-
});
|
86
|
-
});
|
87
|
-
}
|
88
|
-
// If there are blocks, add parent to each, and then
|
89
|
-
// store by table name and rows
|
90
|
-
Object.keys(rowToInsert.blocks).forEach((blockName)=>{
|
91
|
-
rowToInsert.blocks[blockName].forEach((blockRow)=>{
|
92
|
-
blockRow.row._parentID = insertedRow.id;
|
93
|
-
if (!blocksToInsert[blockName]) blocksToInsert[blockName] = [];
|
94
|
-
if (blockRow.row.uuid) {
|
95
|
-
delete blockRow.row.uuid;
|
96
|
-
}
|
97
|
-
blocksToInsert[blockName].push(blockRow);
|
98
|
-
});
|
99
|
-
});
|
100
|
-
// //////////////////////////////////
|
101
|
-
// INSERT LOCALES
|
102
|
-
// //////////////////////////////////
|
103
|
-
if (localesToInsert.length > 0) {
|
104
|
-
const localeTable = adapter.tables[`${tableName}_locales`];
|
105
|
-
if (operation === 'update') {
|
106
|
-
await db.delete(localeTable).where(eq(localeTable._parentID, insertedRow.id));
|
107
|
-
}
|
108
|
-
await db.insert(localeTable).values(localesToInsert);
|
109
|
-
}
|
110
|
-
// //////////////////////////////////
|
111
|
-
// INSERT RELATIONSHIPS
|
112
|
-
// //////////////////////////////////
|
113
|
-
const relationshipsTableName = `${tableName}_rels`;
|
114
|
-
if (operation === 'update') {
|
115
|
-
await deleteExistingRowsByPath({
|
116
|
-
adapter,
|
117
|
-
db,
|
118
|
-
localeColumnName: 'locale',
|
119
|
-
parentColumnName: 'parent',
|
120
|
-
parentID: insertedRow.id,
|
121
|
-
pathColumnName: 'path',
|
122
|
-
rows: [
|
123
|
-
...relationsToInsert,
|
124
|
-
...rowToInsert.relationshipsToDelete
|
125
|
-
],
|
126
|
-
tableName: relationshipsTableName
|
127
|
-
});
|
128
|
-
}
|
129
|
-
if (relationsToInsert.length > 0) {
|
130
|
-
await db.insert(adapter.tables[relationshipsTableName]).values(relationsToInsert);
|
131
|
-
}
|
132
|
-
// //////////////////////////////////
|
133
|
-
// INSERT hasMany TEXTS
|
134
|
-
// //////////////////////////////////
|
135
|
-
const textsTableName = `${tableName}_texts`;
|
136
|
-
if (operation === 'update') {
|
137
|
-
await deleteExistingRowsByPath({
|
138
|
-
adapter,
|
139
|
-
db,
|
140
|
-
localeColumnName: 'locale',
|
141
|
-
parentColumnName: 'parent',
|
142
|
-
parentID: insertedRow.id,
|
143
|
-
pathColumnName: 'path',
|
144
|
-
rows: textsToInsert,
|
145
|
-
tableName: textsTableName
|
146
|
-
});
|
147
|
-
}
|
148
|
-
if (textsToInsert.length > 0) {
|
149
|
-
await db.insert(adapter.tables[textsTableName]).values(textsToInsert).returning();
|
150
|
-
}
|
151
|
-
// //////////////////////////////////
|
152
|
-
// INSERT hasMany NUMBERS
|
153
|
-
// //////////////////////////////////
|
154
|
-
const numbersTableName = `${tableName}_numbers`;
|
155
|
-
if (operation === 'update') {
|
156
|
-
await deleteExistingRowsByPath({
|
157
|
-
adapter,
|
158
|
-
db,
|
159
|
-
localeColumnName: 'locale',
|
160
|
-
parentColumnName: 'parent',
|
161
|
-
parentID: insertedRow.id,
|
162
|
-
pathColumnName: 'path',
|
163
|
-
rows: numbersToInsert,
|
164
|
-
tableName: numbersTableName
|
165
|
-
});
|
166
|
-
}
|
167
|
-
if (numbersToInsert.length > 0) {
|
168
|
-
await db.insert(adapter.tables[numbersTableName]).values(numbersToInsert).returning();
|
169
|
-
}
|
170
|
-
// //////////////////////////////////
|
171
|
-
// INSERT BLOCKS
|
172
|
-
// //////////////////////////////////
|
173
|
-
const insertedBlockRows = {};
|
174
|
-
if (operation === 'update') {
|
175
|
-
for (const blockName of rowToInsert.blocksToDelete){
|
176
|
-
const blockTableName = `${tableName}_blocks_${blockName}`;
|
177
|
-
const blockTable = adapter.tables[blockTableName];
|
178
|
-
await db.delete(blockTable).where(eq(blockTable._parentID, insertedRow.id));
|
179
|
-
}
|
180
|
-
}
|
181
|
-
for (const [blockName, blockRows] of Object.entries(blocksToInsert)){
|
182
|
-
insertedBlockRows[blockName] = await db.insert(adapter.tables[`${tableName}_blocks_${blockName}`]).values(blockRows.map(({ row })=>row)).returning();
|
183
|
-
insertedBlockRows[blockName].forEach((row, i)=>{
|
184
|
-
blockRows[i].row = row;
|
185
|
-
});
|
186
|
-
const blockLocaleIndexMap = [];
|
187
|
-
const blockLocaleRowsToInsert = blockRows.reduce((acc, blockRow, i)=>{
|
188
|
-
if (Object.entries(blockRow.locales).length > 0) {
|
189
|
-
Object.entries(blockRow.locales).forEach(([blockLocale, blockLocaleData])=>{
|
190
|
-
if (Object.keys(blockLocaleData).length > 0) {
|
191
|
-
blockLocaleData._parentID = blockRow.row.id;
|
192
|
-
blockLocaleData._locale = blockLocale;
|
193
|
-
acc.push(blockLocaleData);
|
194
|
-
blockLocaleIndexMap.push(i);
|
195
|
-
}
|
196
|
-
});
|
197
|
-
}
|
198
|
-
return acc;
|
199
|
-
}, []);
|
200
|
-
if (blockLocaleRowsToInsert.length > 0) {
|
201
|
-
await db.insert(adapter.tables[`${tableName}_blocks_${blockName}_locales`]).values(blockLocaleRowsToInsert).returning();
|
202
|
-
}
|
203
|
-
await insertArrays({
|
204
|
-
adapter,
|
205
|
-
arrays: blockRows.map(({ arrays })=>arrays),
|
206
|
-
db,
|
207
|
-
parentRows: insertedBlockRows[blockName]
|
208
|
-
});
|
209
|
-
}
|
210
|
-
// //////////////////////////////////
|
211
|
-
// INSERT ARRAYS RECURSIVELY
|
212
|
-
// //////////////////////////////////
|
213
|
-
if (operation === 'update') {
|
214
|
-
for (const arrayTableName of Object.keys(rowToInsert.arrays)){
|
215
|
-
await deleteExistingArrayRows({
|
216
|
-
adapter,
|
217
|
-
db,
|
218
|
-
parentID: insertedRow.id,
|
219
|
-
tableName: arrayTableName
|
220
|
-
});
|
221
|
-
}
|
222
|
-
}
|
223
|
-
await insertArrays({
|
224
|
-
adapter,
|
225
|
-
arrays: [
|
226
|
-
rowToInsert.arrays
|
227
|
-
],
|
228
|
-
db,
|
229
|
-
parentRows: [
|
230
|
-
insertedRow
|
231
|
-
]
|
232
|
-
});
|
233
|
-
// //////////////////////////////////
|
234
|
-
// INSERT hasMany SELECTS
|
235
|
-
// //////////////////////////////////
|
236
|
-
for (const [selectTableName, tableRows] of Object.entries(selectsToInsert)){
|
237
|
-
const selectTable = adapter.tables[selectTableName];
|
238
|
-
if (operation === 'update') {
|
239
|
-
await db.delete(selectTable).where(eq(selectTable.parent, insertedRow.id));
|
240
|
-
}
|
241
|
-
await db.insert(selectTable).values(tableRows).returning();
|
242
|
-
}
|
243
|
-
// //////////////////////////////////
|
244
|
-
// Error Handling
|
245
|
-
// //////////////////////////////////
|
246
|
-
} catch (error) {
|
247
|
-
throw error.code === '23505' ? new ValidationError([
|
248
|
-
{
|
249
|
-
field: adapter.fieldConstraints[tableName][error.constraint],
|
250
|
-
message: req.t('error:valueMustBeUnique')
|
251
|
-
}
|
252
|
-
], req.t) : error;
|
253
|
-
}
|
254
|
-
// //////////////////////////////////
|
255
|
-
// RETRIEVE NEWLY UPDATED ROW
|
256
|
-
// //////////////////////////////////
|
257
|
-
const findManyArgs = buildFindManyArgs({
|
258
|
-
adapter,
|
259
|
-
depth: 0,
|
260
|
-
fields,
|
261
|
-
tableName
|
262
|
-
});
|
263
|
-
findManyArgs.where = eq(adapter.tables[tableName].id, insertedRow.id);
|
264
|
-
const doc = await db.query[tableName].findFirst(findManyArgs);
|
265
|
-
// //////////////////////////////////
|
266
|
-
// TRANSFORM DATA
|
267
|
-
// //////////////////////////////////
|
268
|
-
const result = transform({
|
269
|
-
config: adapter.payload.config,
|
270
|
-
data: doc,
|
271
|
-
fields
|
272
|
-
});
|
273
|
-
return result;
|
274
|
-
};
|
275
|
-
|
276
|
-
//# sourceMappingURL=index.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../../src/upsertRow/index.ts"],"sourcesContent":["/* eslint-disable no-param-reassign */\nimport type { TypeWithID } from 'payload/types'\n\nimport { eq } from 'drizzle-orm'\nimport { ValidationError } from 'payload/errors'\n\nimport type { BlockRowToInsert } from '../transform/write/types.js'\nimport type { Args } from './types.js'\n\nimport { buildFindManyArgs } from '../find/buildFindManyArgs.js'\nimport { transform } from '../transform/read/index.js'\nimport { transformForWrite } from '../transform/write/index.js'\nimport { deleteExistingArrayRows } from './deleteExistingArrayRows.js'\nimport { deleteExistingRowsByPath } from './deleteExistingRowsByPath.js'\nimport { insertArrays } from './insertArrays.js'\n\nexport const upsertRow = async <T extends TypeWithID>({\n id,\n adapter,\n data,\n db,\n fields,\n operation,\n path = '',\n req,\n tableName,\n upsertTarget,\n where,\n}: Args): Promise<T> => {\n // Split out the incoming data into the corresponding:\n // base row, locales, relationships, blocks, and arrays\n const rowToInsert = transformForWrite({\n adapter,\n data,\n fields,\n path,\n tableName,\n })\n\n // First, we insert the main row\n let insertedRow: Record<string, unknown>\n\n try {\n if (operation === 'update') {\n const target = upsertTarget || adapter.tables[tableName].id\n\n if (id) {\n rowToInsert.row.id = id\n ;[insertedRow] = await db\n .insert(adapter.tables[tableName])\n .values(rowToInsert.row)\n .onConflictDoUpdate({ set: rowToInsert.row, target })\n .returning()\n } else {\n ;[insertedRow] = await db\n .insert(adapter.tables[tableName])\n .values(rowToInsert.row)\n .onConflictDoUpdate({ set: rowToInsert.row, target, where })\n .returning()\n }\n } else {\n ;[insertedRow] = await db\n .insert(adapter.tables[tableName])\n .values(rowToInsert.row)\n .returning()\n }\n\n const localesToInsert: Record<string, unknown>[] = []\n const relationsToInsert: Record<string, unknown>[] = []\n const textsToInsert: Record<string, unknown>[] = []\n const numbersToInsert: Record<string, unknown>[] = []\n const blocksToInsert: { [blockType: string]: BlockRowToInsert[] } = {}\n const selectsToInsert: { [selectTableName: string]: Record<string, unknown>[] } = {}\n\n // If there are locale rows with data, add the parent and locale to each\n if (Object.keys(rowToInsert.locales).length > 0) {\n Object.entries(rowToInsert.locales).forEach(([locale, localeRow]) => {\n localeRow._parentID = insertedRow.id\n localeRow._locale = locale\n localesToInsert.push(localeRow)\n })\n }\n\n // If there are relationships, add parent to each\n if (rowToInsert.relationships.length > 0) {\n rowToInsert.relationships.forEach((relation) => {\n relation.parent = insertedRow.id\n relationsToInsert.push(relation)\n })\n }\n\n // If there are texts, add parent to each\n if (rowToInsert.texts.length > 0) {\n rowToInsert.texts.forEach((textRow) => {\n textRow.parent = insertedRow.id\n textsToInsert.push(textRow)\n })\n }\n\n // If there are numbers, add parent to each\n if (rowToInsert.numbers.length > 0) {\n rowToInsert.numbers.forEach((numberRow) => {\n numberRow.parent = insertedRow.id\n numbersToInsert.push(numberRow)\n })\n }\n\n // If there are selects, add parent to each, and then\n // store by table name and rows\n if (Object.keys(rowToInsert.selects).length > 0) {\n Object.entries(rowToInsert.selects).forEach(([selectTableName, selectRows]) => {\n selectRows.forEach((row) => {\n if (typeof row.parent === 'undefined') {\n row.parent = insertedRow.id\n }\n if (!selectsToInsert[selectTableName]) selectsToInsert[selectTableName] = []\n selectsToInsert[selectTableName].push(row)\n })\n })\n }\n\n // If there are blocks, add parent to each, and then\n // store by table name and rows\n Object.keys(rowToInsert.blocks).forEach((blockName) => {\n rowToInsert.blocks[blockName].forEach((blockRow) => {\n blockRow.row._parentID = insertedRow.id\n if (!blocksToInsert[blockName]) blocksToInsert[blockName] = []\n if (blockRow.row.uuid) {\n delete blockRow.row.uuid\n }\n blocksToInsert[blockName].push(blockRow)\n })\n })\n\n // //////////////////////////////////\n // INSERT LOCALES\n // //////////////////////////////////\n\n if (localesToInsert.length > 0) {\n const localeTable = adapter.tables[`${tableName}_locales`]\n\n if (operation === 'update') {\n await db.delete(localeTable).where(eq(localeTable._parentID, insertedRow.id))\n }\n\n await db.insert(localeTable).values(localesToInsert)\n }\n\n // //////////////////////////////////\n // INSERT RELATIONSHIPS\n // //////////////////////////////////\n\n const relationshipsTableName = `${tableName}_rels`\n\n if (operation === 'update') {\n await deleteExistingRowsByPath({\n adapter,\n db,\n localeColumnName: 'locale',\n parentColumnName: 'parent',\n parentID: insertedRow.id,\n pathColumnName: 'path',\n rows: [...relationsToInsert, ...rowToInsert.relationshipsToDelete],\n tableName: relationshipsTableName,\n })\n }\n\n if (relationsToInsert.length > 0) {\n await db.insert(adapter.tables[relationshipsTableName]).values(relationsToInsert)\n }\n\n // //////////////////////////////////\n // INSERT hasMany TEXTS\n // //////////////////////////////////\n\n const textsTableName = `${tableName}_texts`\n\n if (operation === 'update') {\n await deleteExistingRowsByPath({\n adapter,\n db,\n localeColumnName: 'locale',\n parentColumnName: 'parent',\n parentID: insertedRow.id,\n pathColumnName: 'path',\n rows: textsToInsert,\n tableName: textsTableName,\n })\n }\n\n if (textsToInsert.length > 0) {\n await db.insert(adapter.tables[textsTableName]).values(textsToInsert).returning()\n }\n\n // //////////////////////////////////\n // INSERT hasMany NUMBERS\n // //////////////////////////////////\n\n const numbersTableName = `${tableName}_numbers`\n\n if (operation === 'update') {\n await deleteExistingRowsByPath({\n adapter,\n db,\n localeColumnName: 'locale',\n parentColumnName: 'parent',\n parentID: insertedRow.id,\n pathColumnName: 'path',\n rows: numbersToInsert,\n tableName: numbersTableName,\n })\n }\n\n if (numbersToInsert.length > 0) {\n await db.insert(adapter.tables[numbersTableName]).values(numbersToInsert).returning()\n }\n\n // //////////////////////////////////\n // INSERT BLOCKS\n // //////////////////////////////////\n\n const insertedBlockRows: Record<string, Record<string, unknown>[]> = {}\n\n if (operation === 'update') {\n for (const blockName of rowToInsert.blocksToDelete) {\n const blockTableName = `${tableName}_blocks_${blockName}`\n const blockTable = adapter.tables[blockTableName]\n await db.delete(blockTable).where(eq(blockTable._parentID, insertedRow.id))\n }\n }\n\n for (const [blockName, blockRows] of Object.entries(blocksToInsert)) {\n insertedBlockRows[blockName] = await db\n .insert(adapter.tables[`${tableName}_blocks_${blockName}`])\n .values(blockRows.map(({ row }) => row))\n .returning()\n\n insertedBlockRows[blockName].forEach((row, i) => {\n blockRows[i].row = row\n })\n\n const blockLocaleIndexMap: number[] = []\n\n const blockLocaleRowsToInsert = blockRows.reduce((acc, blockRow, i) => {\n if (Object.entries(blockRow.locales).length > 0) {\n Object.entries(blockRow.locales).forEach(([blockLocale, blockLocaleData]) => {\n if (Object.keys(blockLocaleData).length > 0) {\n blockLocaleData._parentID = blockRow.row.id\n blockLocaleData._locale = blockLocale\n acc.push(blockLocaleData)\n blockLocaleIndexMap.push(i)\n }\n })\n }\n\n return acc\n }, [])\n\n if (blockLocaleRowsToInsert.length > 0) {\n await db\n .insert(adapter.tables[`${tableName}_blocks_${blockName}_locales`])\n .values(blockLocaleRowsToInsert)\n .returning()\n }\n\n await insertArrays({\n adapter,\n arrays: blockRows.map(({ arrays }) => arrays),\n db,\n parentRows: insertedBlockRows[blockName],\n })\n }\n\n // //////////////////////////////////\n // INSERT ARRAYS RECURSIVELY\n // //////////////////////////////////\n\n if (operation === 'update') {\n for (const arrayTableName of Object.keys(rowToInsert.arrays)) {\n await deleteExistingArrayRows({\n adapter,\n db,\n parentID: insertedRow.id,\n tableName: arrayTableName,\n })\n }\n }\n\n await insertArrays({\n adapter,\n arrays: [rowToInsert.arrays],\n db,\n parentRows: [insertedRow],\n })\n\n // //////////////////////////////////\n // INSERT hasMany SELECTS\n // //////////////////////////////////\n\n for (const [selectTableName, tableRows] of Object.entries(selectsToInsert)) {\n const selectTable = adapter.tables[selectTableName]\n if (operation === 'update') {\n await db.delete(selectTable).where(eq(selectTable.parent, insertedRow.id))\n }\n await db.insert(selectTable).values(tableRows).returning()\n }\n\n // //////////////////////////////////\n // Error Handling\n // //////////////////////////////////\n } catch (error) {\n throw error.code === '23505'\n ? new ValidationError(\n [\n {\n field: adapter.fieldConstraints[tableName][error.constraint],\n message: req.t('error:valueMustBeUnique'),\n },\n ],\n req.t,\n )\n : error\n }\n\n // //////////////////////////////////\n // RETRIEVE NEWLY UPDATED ROW\n // //////////////////////////////////\n\n const findManyArgs = buildFindManyArgs({\n adapter,\n depth: 0,\n fields,\n tableName,\n })\n\n findManyArgs.where = eq(adapter.tables[tableName].id, insertedRow.id)\n\n const doc = await db.query[tableName].findFirst(findManyArgs)\n\n // //////////////////////////////////\n // TRANSFORM DATA\n // //////////////////////////////////\n\n const result = transform<T>({\n config: adapter.payload.config,\n data: doc,\n fields,\n })\n\n return result\n}\n"],"names":["eq","ValidationError","buildFindManyArgs","transform","transformForWrite","deleteExistingArrayRows","deleteExistingRowsByPath","insertArrays","upsertRow","id","adapter","data","db","fields","operation","path","req","tableName","upsertTarget","where","rowToInsert","insertedRow","target","tables","row","insert","values","onConflictDoUpdate","set","returning","localesToInsert","relationsToInsert","textsToInsert","numbersToInsert","blocksToInsert","selectsToInsert","Object","keys","locales","length","entries","forEach","locale","localeRow","_parentID","_locale","push","relationships","relation","parent","texts","textRow","numbers","numberRow","selects","selectTableName","selectRows","blocks","blockName","blockRow","uuid","localeTable","delete","relationshipsTableName","localeColumnName","parentColumnName","parentID","pathColumnName","rows","relationshipsToDelete","textsTableName","numbersTableName","insertedBlockRows","blocksToDelete","blockTableName","blockTable","blockRows","map","i","blockLocaleIndexMap","blockLocaleRowsToInsert","reduce","acc","blockLocale","blockLocaleData","arrays","parentRows","arrayTableName","tableRows","selectTable","error","code","field","fieldConstraints","constraint","message","t","findManyArgs","depth","doc","query","findFirst","result","config","payload"],"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leDB, PostgresAdapter } from '../types.js';
|
3
|
-
type Args = {
|
4
|
-
adapter: PostgresAdapter;
|
5
|
-
arrays: {
|
6
|
-
[tableName: string]: ArrayRowToInsert[];
|
7
|
-
}[];
|
8
|
-
db: DrizzleDB;
|
9
|
-
parentRows: Record<string, unknown>[];
|
10
|
-
};
|
11
|
-
export declare const insertArrays: ({ adapter, arrays, db, parentRows }: Args) => Promise<void>;
|
12
|
-
export {};
|
13
|
-
//# sourceMappingURL=insertArrays.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"insertArrays.d.ts","sourceRoot":"","sources":["../../src/upsertRow/insertArrays.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AACnE,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAE7D,KAAK,IAAI,GAAG;IACV,OAAO,EAAE,eAAe,CAAA;IACxB,MAAM,EAAE;QACN,CAAC,SAAS,EAAE,MAAM,GAAG,gBAAgB,EAAE,CAAA;KACxC,EAAE,CAAA;IACH,EAAE,EAAE,SAAS,CAAA;IACb,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAA;CACtC,CAAA;AAYD,eAAO,MAAM,YAAY,wCAA+C,IAAI,KAAG,QAAQ,IAAI,CAyE1F,CAAA"}
|