@payloadcms/db-postgres 3.0.0-canary.6d9b462 → 3.0.0-canary.71da5b9
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 +29 -11
- package/dist/connect.js.map +1 -1
- package/dist/exports/migration-utils.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +39 -69
- package/dist/index.js.map +1 -1
- 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 +4 -2
- 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 +5 -5
- 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 +9 -3
- 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/types.d.ts +61 -80
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +23 -18
- 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/createMigration.d.ts +0 -3
- package/dist/createMigration.d.ts.map +0 -1
- package/dist/createMigration.js +0 -102
- package/dist/createMigration.js.map +0 -1
- package/dist/createVersion.d.ts +0 -5
- package/dist/createVersion.d.ts.map +0 -1
- package/dist/createVersion.js +0 -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/init.d.ts +0 -3
- package/dist/init.d.ts.map +0 -1
- package/dist/init.js +0 -91
- package/dist/init.js.map +0 -1
- package/dist/migrate.d.ts +0 -3
- package/dist/migrate.d.ts.map +0 -1
- package/dist/migrate.js +0 -99
- package/dist/migrate.js.map +0 -1
- package/dist/migrateDown.d.ts +0 -3
- package/dist/migrateDown.d.ts.map +0 -1
- package/dist/migrateDown.js +0 -63
- package/dist/migrateDown.js.map +0 -1
- package/dist/migrateFresh.d.ts +0 -8
- package/dist/migrateFresh.d.ts.map +0 -1
- package/dist/migrateFresh.js +0 -72
- package/dist/migrateFresh.js.map +0 -1
- package/dist/migrateRefresh.d.ts +0 -6
- package/dist/migrateRefresh.d.ts.map +0 -1
- package/dist/migrateRefresh.js +0 -102
- package/dist/migrateRefresh.js.map +0 -1
- package/dist/migrateReset.d.ts +0 -6
- package/dist/migrateReset.d.ts.map +0 -1
- package/dist/migrateReset.js +0 -82
- package/dist/migrateReset.js.map +0 -1
- package/dist/migrateStatus.d.ts +0 -3
- package/dist/migrateStatus.d.ts.map +0 -1
- package/dist/migrateStatus.js +0 -44
- package/dist/migrateStatus.js.map +0 -1
- package/dist/queries/buildAndOrConditions.d.ts +0 -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 +0 -2
- package/dist/queries/createJSONQuery/convertPathToJSONTraversal.d.ts.map +0 -1
- package/dist/queries/createJSONQuery/convertPathToJSONTraversal.js +0 -14
- package/dist/queries/createJSONQuery/convertPathToJSONTraversal.js.map +0 -1
- package/dist/queries/createJSONQuery/formatJSONPathSegment.d.ts +0 -2
- package/dist/queries/createJSONQuery/formatJSONPathSegment.d.ts.map +0 -1
- package/dist/queries/createJSONQuery/formatJSONPathSegment.js +0 -5
- package/dist/queries/createJSONQuery/formatJSONPathSegment.js.map +0 -1
- package/dist/queries/createJSONQuery/index.d.ts +0 -10
- package/dist/queries/createJSONQuery/index.d.ts.map +0 -1
- package/dist/queries/createJSONQuery/index.js +0 -54
- package/dist/queries/createJSONQuery/index.js.map +0 -1
- package/dist/queries/getTableColumnFromPath.d.ts +0 -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/build.d.ts +0 -34
- package/dist/schema/build.d.ts.map +0 -1
- package/dist/schema/build.js +0 -369
- package/dist/schema/build.js.map +0 -1
- package/dist/schema/createIndex.d.ts +0 -12
- package/dist/schema/createIndex.d.ts.map +0 -1
- package/dist/schema/createIndex.js +0 -18
- package/dist/schema/createIndex.js.map +0 -1
- package/dist/schema/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/idToUUID.d.ts +0 -3
- package/dist/schema/idToUUID.d.ts.map +0 -1
- package/dist/schema/idToUUID.js +0 -11
- package/dist/schema/idToUUID.js.map +0 -1
- package/dist/schema/parentIDColumnMap.d.ts +0 -4
- package/dist/schema/parentIDColumnMap.d.ts.map +0 -1
- package/dist/schema/parentIDColumnMap.js +0 -9
- package/dist/schema/parentIDColumnMap.js.map +0 -1
- package/dist/schema/setColumnID.d.ts +0 -11
- package/dist/schema/setColumnID.d.ts.map +0 -1
- package/dist/schema/setColumnID.js +0 -24
- package/dist/schema/setColumnID.js.map +0 -1
- package/dist/schema/traverseFields.d.ts +0 -36
- package/dist/schema/traverseFields.d.ts.map +0 -1
- package/dist/schema/traverseFields.js +0 -614
- package/dist/schema/traverseFields.js.map +0 -1
- package/dist/schema/validateExistingBlockIsIdentical.d.ts +0 -12
- package/dist/schema/validateExistingBlockIsIdentical.d.ts.map +0 -1
- package/dist/schema/validateExistingBlockIsIdentical.js +0 -76
- package/dist/schema/validateExistingBlockIsIdentical.js.map +0 -1
- package/dist/transactions/beginTransaction.d.ts +0 -3
- package/dist/transactions/beginTransaction.d.ts.map +0 -1
- package/dist/transactions/beginTransaction.js +0 -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
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/transform/write/array.ts"],"sourcesContent":["/* eslint-disable no-param-reassign */\nimport type { ArrayField } from 'payload/types'\n\nimport type { PostgresAdapter } from '../../types.js'\nimport type { ArrayRowToInsert, BlockRowToInsert, RelationshipToDelete } from './types.js'\n\nimport { isArrayOfRows } from '../../utilities/isArrayOfRows.js'\nimport { traverseFields } from './traverseFields.js'\n\ntype Args = {\n adapter: PostgresAdapter\n arrayTableName: string\n baseTableName: string\n blocks: {\n [blockType: string]: BlockRowToInsert[]\n }\n blocksToDelete: Set<string>\n data: unknown\n field: ArrayField\n locale?: string\n numbers: Record<string, unknown>[]\n path: string\n relationships: Record<string, unknown>[]\n relationshipsToDelete: RelationshipToDelete[]\n selects: {\n [tableName: string]: Record<string, unknown>[]\n }\n texts: Record<string, unknown>[]\n}\n\nexport const transformArray = ({\n adapter,\n arrayTableName,\n baseTableName,\n blocks,\n blocksToDelete,\n data,\n field,\n locale,\n numbers,\n path,\n relationships,\n relationshipsToDelete,\n selects,\n texts,\n}: Args) => {\n const newRows: ArrayRowToInsert[] = []\n\n const hasUUID = adapter.tables[arrayTableName]._uuid\n\n if (isArrayOfRows(data)) {\n data.forEach((arrayRow, i) => {\n const newRow: ArrayRowToInsert = {\n arrays: {},\n locales: {},\n row: {\n _order: i + 1,\n },\n }\n\n // If we have declared a _uuid field on arrays,\n // that means the ID has to be unique,\n // and our ids within arrays are not unique.\n // So move the ID to a uuid field for storage\n // and allow the database to generate a serial id automatically\n if (hasUUID) {\n newRow.row._uuid = arrayRow.id\n delete arrayRow.id\n }\n\n if (locale) {\n newRow.locales[locale] = {\n _locale: locale,\n }\n }\n\n if (field.localized) {\n newRow.row._locale = locale\n }\n\n traverseFields({\n adapter,\n arrays: newRow.arrays,\n baseTableName,\n blocks,\n blocksToDelete,\n columnPrefix: '',\n data: arrayRow,\n fieldPrefix: '',\n fields: field.fields,\n locales: newRow.locales,\n numbers,\n parentTableName: arrayTableName,\n path: `${path || ''}${field.name}.${i}.`,\n relationships,\n relationshipsToDelete,\n row: newRow.row,\n selects,\n texts,\n })\n\n newRows.push(newRow)\n })\n }\n\n return newRows\n}\n"],"names":["isArrayOfRows","traverseFields","transformArray","adapter","arrayTableName","baseTableName","blocks","blocksToDelete","data","field","locale","numbers","path","relationships","relationshipsToDelete","selects","texts","newRows","hasUUID","tables","_uuid","forEach","arrayRow","i","newRow","arrays","locales","row","_order","id","_locale","localized","columnPrefix","fieldPrefix","fields","parentTableName","name","push"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,oCAAoC,GAMpC,SAASA,aAAa,QAAQ,mCAAkC;AAChE,SAASC,cAAc,QAAQ,sBAAqB;AAuBpD,OAAO,MAAMC,iBAAiB,CAAC,EAC7BC,OAAO,EACPC,cAAc,EACdC,aAAa,EACbC,MAAM,EACNC,cAAc,EACdC,IAAI,EACJC,KAAK,EACLC,MAAM,EACNC,OAAO,EACPC,IAAI,EACJC,aAAa,EACbC,qBAAqB,EACrBC,OAAO,EACPC,KAAK,EACA;IACL,MAAMC,UAA8B,EAAE;IAEtC,MAAMC,UAAUf,QAAQgB,MAAM,CAACf,eAAe,CAACgB,KAAK;IAEpD,IAAIpB,cAAcQ,OAAO;QACvBA,KAAKa,OAAO,CAAC,CAACC,UAAUC;YACtB,MAAMC,SAA2B;gBAC/BC,QAAQ,CAAC;gBACTC,SAAS,CAAC;gBACVC,KAAK;oBACHC,QAAQL,IAAI;gBACd;YACF;YAEA,+CAA+C;YAC/C,sCAAsC;YACtC,4CAA4C;YAC5C,6CAA6C;YAC7C,+DAA+D;YAC/D,IAAIL,SAAS;gBACXM,OAAOG,GAAG,CAACP,KAAK,GAAGE,SAASO,EAAE;gBAC9B,OAAOP,SAASO,EAAE;YACpB;YAEA,IAAInB,QAAQ;gBACVc,OAAOE,OAAO,CAAChB,OAAO,GAAG;oBACvBoB,SAASpB;gBACX;YACF;YAEA,IAAID,MAAMsB,SAAS,EAAE;gBACnBP,OAAOG,GAAG,CAACG,OAAO,GAAGpB;YACvB;YAEAT,eAAe;gBACbE;gBACAsB,QAAQD,OAAOC,MAAM;gBACrBpB;gBACAC;gBACAC;gBACAyB,cAAc;gBACdxB,MAAMc;gBACNW,aAAa;gBACbC,QAAQzB,MAAMyB,MAAM;gBACpBR,SAASF,OAAOE,OAAO;gBACvBf;gBACAwB,iBAAiB/B;gBACjBQ,MAAM,CAAC,EAAEA,QAAQ,GAAG,EAAEH,MAAM2B,IAAI,CAAC,CAAC,EAAEb,EAAE,CAAC,CAAC;gBACxCV;gBACAC;gBACAa,KAAKH,OAAOG,GAAG;gBACfZ;gBACAC;YACF;YAEAC,QAAQoB,IAAI,CAACb;QACf;IACF;IAEA,OAAOP;AACT,EAAC"}
|
@@ -1,25 +0,0 @@
|
|
1
|
-
import type { BlockField } from 'payload/types';
|
2
|
-
import type { PostgresAdapter } from '../../types.js';
|
3
|
-
import type { BlockRowToInsert, RelationshipToDelete } from './types.js';
|
4
|
-
type Args = {
|
5
|
-
adapter: PostgresAdapter;
|
6
|
-
baseTableName: string;
|
7
|
-
blocks: {
|
8
|
-
[blockType: string]: BlockRowToInsert[];
|
9
|
-
};
|
10
|
-
blocksToDelete: Set<string>;
|
11
|
-
data: Record<string, unknown>[];
|
12
|
-
field: BlockField;
|
13
|
-
locale?: string;
|
14
|
-
numbers: Record<string, unknown>[];
|
15
|
-
path: string;
|
16
|
-
relationships: Record<string, unknown>[];
|
17
|
-
relationshipsToDelete: RelationshipToDelete[];
|
18
|
-
selects: {
|
19
|
-
[tableName: string]: Record<string, unknown>[];
|
20
|
-
};
|
21
|
-
texts: Record<string, unknown>[];
|
22
|
-
};
|
23
|
-
export declare const transformBlocks: ({ adapter, baseTableName, blocks, blocksToDelete, data, field, locale, numbers, path, relationships, relationshipsToDelete, selects, texts, }: Args) => void;
|
24
|
-
export {};
|
25
|
-
//# sourceMappingURL=blocks.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"blocks.d.ts","sourceRoot":"","sources":["../../../src/transform/write/blocks.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAI/C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AACrD,OAAO,KAAK,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AAIxE,KAAK,IAAI,GAAG;IACV,OAAO,EAAE,eAAe,CAAA;IACxB,aAAa,EAAE,MAAM,CAAA;IACrB,MAAM,EAAE;QACN,CAAC,SAAS,EAAE,MAAM,GAAG,gBAAgB,EAAE,CAAA;KACxC,CAAA;IACD,cAAc,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IAC3B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAA;IAC/B,KAAK,EAAE,UAAU,CAAA;IACjB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAA;IAClC,IAAI,EAAE,MAAM,CAAA;IACZ,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAA;IACxC,qBAAqB,EAAE,oBAAoB,EAAE,CAAA;IAC7C,OAAO,EAAE;QACP,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAA;KAC/C,CAAA;IACD,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAA;CACjC,CAAA;AACD,eAAO,MAAM,eAAe,kJAczB,IAAI,SAyDN,CAAA"}
|
@@ -1,54 +0,0 @@
|
|
1
|
-
/* eslint-disable no-param-reassign */ import toSnakeCase from 'to-snake-case';
|
2
|
-
import { traverseFields } from './traverseFields.js';
|
3
|
-
export const transformBlocks = ({ adapter, baseTableName, blocks, blocksToDelete, data, field, locale, numbers, path, relationships, relationshipsToDelete, selects, texts })=>{
|
4
|
-
data.forEach((blockRow, i)=>{
|
5
|
-
if (typeof blockRow.blockType !== 'string') return;
|
6
|
-
const matchedBlock = field.blocks.find(({ slug })=>slug === blockRow.blockType);
|
7
|
-
if (!matchedBlock) return;
|
8
|
-
const blockType = toSnakeCase(blockRow.blockType);
|
9
|
-
if (!blocks[blockType]) blocks[blockType] = [];
|
10
|
-
const newRow = {
|
11
|
-
arrays: {},
|
12
|
-
locales: {},
|
13
|
-
row: {
|
14
|
-
_order: i + 1,
|
15
|
-
_path: `${path}${field.name}`
|
16
|
-
}
|
17
|
-
};
|
18
|
-
if (field.localized && locale) newRow.row._locale = locale;
|
19
|
-
const blockTableName = adapter.tableNameMap.get(`${baseTableName}_blocks_${blockType}`);
|
20
|
-
const hasUUID = adapter.tables[blockTableName]._uuid;
|
21
|
-
// If we have declared a _uuid field on arrays,
|
22
|
-
// that means the ID has to be unique,
|
23
|
-
// and our ids within arrays are not unique.
|
24
|
-
// So move the ID to a uuid field for storage
|
25
|
-
// and allow the database to generate a serial id automatically
|
26
|
-
if (hasUUID) {
|
27
|
-
newRow.row._uuid = blockRow.id;
|
28
|
-
delete blockRow.id;
|
29
|
-
}
|
30
|
-
traverseFields({
|
31
|
-
adapter,
|
32
|
-
arrays: newRow.arrays,
|
33
|
-
baseTableName,
|
34
|
-
blocks,
|
35
|
-
blocksToDelete,
|
36
|
-
columnPrefix: '',
|
37
|
-
data: blockRow,
|
38
|
-
fieldPrefix: '',
|
39
|
-
fields: matchedBlock.fields,
|
40
|
-
locales: newRow.locales,
|
41
|
-
numbers,
|
42
|
-
parentTableName: blockTableName,
|
43
|
-
path: `${path || ''}${field.name}.${i}.`,
|
44
|
-
relationships,
|
45
|
-
relationshipsToDelete,
|
46
|
-
row: newRow.row,
|
47
|
-
selects,
|
48
|
-
texts
|
49
|
-
});
|
50
|
-
blocks[blockType].push(newRow);
|
51
|
-
});
|
52
|
-
};
|
53
|
-
|
54
|
-
//# sourceMappingURL=blocks.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/transform/write/blocks.ts"],"sourcesContent":["/* eslint-disable no-param-reassign */\nimport type { BlockField } from 'payload/types'\n\nimport toSnakeCase from 'to-snake-case'\n\nimport type { PostgresAdapter } from '../../types.js'\nimport type { BlockRowToInsert, RelationshipToDelete } from './types.js'\n\nimport { traverseFields } from './traverseFields.js'\n\ntype Args = {\n adapter: PostgresAdapter\n baseTableName: string\n blocks: {\n [blockType: string]: BlockRowToInsert[]\n }\n blocksToDelete: Set<string>\n data: Record<string, unknown>[]\n field: BlockField\n locale?: string\n numbers: Record<string, unknown>[]\n path: string\n relationships: Record<string, unknown>[]\n relationshipsToDelete: RelationshipToDelete[]\n selects: {\n [tableName: string]: Record<string, unknown>[]\n }\n texts: Record<string, unknown>[]\n}\nexport const transformBlocks = ({\n adapter,\n baseTableName,\n blocks,\n blocksToDelete,\n data,\n field,\n locale,\n numbers,\n path,\n relationships,\n relationshipsToDelete,\n selects,\n texts,\n}: Args) => {\n data.forEach((blockRow, i) => {\n if (typeof blockRow.blockType !== 'string') return\n const matchedBlock = field.blocks.find(({ slug }) => slug === blockRow.blockType)\n if (!matchedBlock) return\n const blockType = toSnakeCase(blockRow.blockType)\n\n if (!blocks[blockType]) blocks[blockType] = []\n\n const newRow: BlockRowToInsert = {\n arrays: {},\n locales: {},\n row: {\n _order: i + 1,\n _path: `${path}${field.name}`,\n },\n }\n\n if (field.localized && locale) newRow.row._locale = locale\n\n const blockTableName = adapter.tableNameMap.get(`${baseTableName}_blocks_${blockType}`)\n\n const hasUUID = adapter.tables[blockTableName]._uuid\n\n // If we have declared a _uuid field on arrays,\n // that means the ID has to be unique,\n // and our ids within arrays are not unique.\n // So move the ID to a uuid field for storage\n // and allow the database to generate a serial id automatically\n if (hasUUID) {\n newRow.row._uuid = blockRow.id\n delete blockRow.id\n }\n\n traverseFields({\n adapter,\n arrays: newRow.arrays,\n baseTableName,\n blocks,\n blocksToDelete,\n columnPrefix: '',\n data: blockRow,\n fieldPrefix: '',\n fields: matchedBlock.fields,\n locales: newRow.locales,\n numbers,\n parentTableName: blockTableName,\n path: `${path || ''}${field.name}.${i}.`,\n relationships,\n relationshipsToDelete,\n row: newRow.row,\n selects,\n texts,\n })\n\n blocks[blockType].push(newRow)\n })\n}\n"],"names":["toSnakeCase","traverseFields","transformBlocks","adapter","baseTableName","blocks","blocksToDelete","data","field","locale","numbers","path","relationships","relationshipsToDelete","selects","texts","forEach","blockRow","i","blockType","matchedBlock","find","slug","newRow","arrays","locales","row","_order","_path","name","localized","_locale","blockTableName","tableNameMap","get","hasUUID","tables","_uuid","id","columnPrefix","fieldPrefix","fields","parentTableName","push"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,oCAAoC,GAGpC,OAAOA,iBAAiB,gBAAe;AAKvC,SAASC,cAAc,QAAQ,sBAAqB;AAqBpD,OAAO,MAAMC,kBAAkB,CAAC,EAC9BC,OAAO,EACPC,aAAa,EACbC,MAAM,EACNC,cAAc,EACdC,IAAI,EACJC,KAAK,EACLC,MAAM,EACNC,OAAO,EACPC,IAAI,EACJC,aAAa,EACbC,qBAAqB,EACrBC,OAAO,EACPC,KAAK,EACA;IACLR,KAAKS,OAAO,CAAC,CAACC,UAAUC;QACtB,IAAI,OAAOD,SAASE,SAAS,KAAK,UAAU;QAC5C,MAAMC,eAAeZ,MAAMH,MAAM,CAACgB,IAAI,CAAC,CAAC,EAAEC,IAAI,EAAE,GAAKA,SAASL,SAASE,SAAS;QAChF,IAAI,CAACC,cAAc;QACnB,MAAMD,YAAYnB,YAAYiB,SAASE,SAAS;QAEhD,IAAI,CAACd,MAAM,CAACc,UAAU,EAAEd,MAAM,CAACc,UAAU,GAAG,EAAE;QAE9C,MAAMI,SAA2B;YAC/BC,QAAQ,CAAC;YACTC,SAAS,CAAC;YACVC,KAAK;gBACHC,QAAQT,IAAI;gBACZU,OAAO,CAAC,EAAEjB,KAAK,EAAEH,MAAMqB,IAAI,CAAC,CAAC;YAC/B;QACF;QAEA,IAAIrB,MAAMsB,SAAS,IAAIrB,QAAQc,OAAOG,GAAG,CAACK,OAAO,GAAGtB;QAEpD,MAAMuB,iBAAiB7B,QAAQ8B,YAAY,CAACC,GAAG,CAAC,CAAC,EAAE9B,cAAc,QAAQ,EAAEe,UAAU,CAAC;QAEtF,MAAMgB,UAAUhC,QAAQiC,MAAM,CAACJ,eAAe,CAACK,KAAK;QAEpD,+CAA+C;QAC/C,sCAAsC;QACtC,4CAA4C;QAC5C,6CAA6C;QAC7C,+DAA+D;QAC/D,IAAIF,SAAS;YACXZ,OAAOG,GAAG,CAACW,KAAK,GAAGpB,SAASqB,EAAE;YAC9B,OAAOrB,SAASqB,EAAE;QACpB;QAEArC,eAAe;YACbE;YACAqB,QAAQD,OAAOC,MAAM;YACrBpB;YACAC;YACAC;YACAiC,cAAc;YACdhC,MAAMU;YACNuB,aAAa;YACbC,QAAQrB,aAAaqB,MAAM;YAC3BhB,SAASF,OAAOE,OAAO;YACvBf;YACAgC,iBAAiBV;YACjBrB,MAAM,CAAC,EAAEA,QAAQ,GAAG,EAAEH,MAAMqB,IAAI,CAAC,CAAC,EAAEX,EAAE,CAAC,CAAC;YACxCN;YACAC;YACAa,KAAKH,OAAOG,GAAG;YACfZ;YACAC;QACF;QAEAV,MAAM,CAACc,UAAU,CAACwB,IAAI,CAACpB;IACzB;AACF,EAAC"}
|
@@ -1,13 +0,0 @@
|
|
1
|
-
import type { Field } from 'payload/types';
|
2
|
-
import type { PostgresAdapter } from '../../types.js';
|
3
|
-
import type { RowToInsert } from './types.js';
|
4
|
-
type Args = {
|
5
|
-
adapter: PostgresAdapter;
|
6
|
-
data: Record<string, unknown>;
|
7
|
-
fields: Field[];
|
8
|
-
path?: string;
|
9
|
-
tableName: string;
|
10
|
-
};
|
11
|
-
export declare const transformForWrite: ({ adapter, data, fields, path, tableName, }: Args) => RowToInsert;
|
12
|
-
export {};
|
13
|
-
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/transform/write/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAE1C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAI7C,KAAK,IAAI,GAAG;IACV,OAAO,EAAE,eAAe,CAAA;IACxB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC7B,MAAM,EAAE,KAAK,EAAE,CAAA;IACf,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,SAAS,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,eAAO,MAAM,iBAAiB,gDAM3B,IAAI,KAAG,WAuCT,CAAA"}
|
@@ -1,41 +0,0 @@
|
|
1
|
-
/* eslint-disable no-param-reassign */ import { traverseFields } from './traverseFields.js';
|
2
|
-
export const transformForWrite = ({ adapter, data, fields, path = '', tableName })=>{
|
3
|
-
// Split out the incoming data into rows to insert / delete
|
4
|
-
const rowToInsert = {
|
5
|
-
arrays: {},
|
6
|
-
blocks: {},
|
7
|
-
blocksToDelete: new Set(),
|
8
|
-
locales: {},
|
9
|
-
numbers: [],
|
10
|
-
relationships: [],
|
11
|
-
relationshipsToDelete: [],
|
12
|
-
row: {},
|
13
|
-
selects: {},
|
14
|
-
texts: []
|
15
|
-
};
|
16
|
-
// This function is responsible for building up the
|
17
|
-
// above rowToInsert
|
18
|
-
traverseFields({
|
19
|
-
adapter,
|
20
|
-
arrays: rowToInsert.arrays,
|
21
|
-
baseTableName: tableName,
|
22
|
-
blocks: rowToInsert.blocks,
|
23
|
-
blocksToDelete: rowToInsert.blocksToDelete,
|
24
|
-
columnPrefix: '',
|
25
|
-
data,
|
26
|
-
fieldPrefix: '',
|
27
|
-
fields,
|
28
|
-
locales: rowToInsert.locales,
|
29
|
-
numbers: rowToInsert.numbers,
|
30
|
-
parentTableName: tableName,
|
31
|
-
path,
|
32
|
-
relationships: rowToInsert.relationships,
|
33
|
-
relationshipsToDelete: rowToInsert.relationshipsToDelete,
|
34
|
-
row: rowToInsert.row,
|
35
|
-
selects: rowToInsert.selects,
|
36
|
-
texts: rowToInsert.texts
|
37
|
-
});
|
38
|
-
return rowToInsert;
|
39
|
-
};
|
40
|
-
|
41
|
-
//# sourceMappingURL=index.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/transform/write/index.ts"],"sourcesContent":["/* eslint-disable no-param-reassign */\nimport type { Field } from 'payload/types'\n\nimport type { PostgresAdapter } from '../../types.js'\nimport type { RowToInsert } from './types.js'\n\nimport { traverseFields } from './traverseFields.js'\n\ntype Args = {\n adapter: PostgresAdapter\n data: Record<string, unknown>\n fields: Field[]\n path?: string\n tableName: string\n}\n\nexport const transformForWrite = ({\n adapter,\n data,\n fields,\n path = '',\n tableName,\n}: Args): RowToInsert => {\n // Split out the incoming data into rows to insert / delete\n const rowToInsert: RowToInsert = {\n arrays: {},\n blocks: {},\n blocksToDelete: new Set(),\n locales: {},\n numbers: [],\n relationships: [],\n relationshipsToDelete: [],\n row: {},\n selects: {},\n texts: [],\n }\n\n // This function is responsible for building up the\n // above rowToInsert\n traverseFields({\n adapter,\n arrays: rowToInsert.arrays,\n baseTableName: tableName,\n blocks: rowToInsert.blocks,\n blocksToDelete: rowToInsert.blocksToDelete,\n columnPrefix: '',\n data,\n fieldPrefix: '',\n fields,\n locales: rowToInsert.locales,\n numbers: rowToInsert.numbers,\n parentTableName: tableName,\n path,\n relationships: rowToInsert.relationships,\n relationshipsToDelete: rowToInsert.relationshipsToDelete,\n row: rowToInsert.row,\n selects: rowToInsert.selects,\n texts: rowToInsert.texts,\n })\n\n return rowToInsert\n}\n"],"names":["traverseFields","transformForWrite","adapter","data","fields","path","tableName","rowToInsert","arrays","blocks","blocksToDelete","Set","locales","numbers","relationships","relationshipsToDelete","row","selects","texts","baseTableName","columnPrefix","fieldPrefix","parentTableName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,oCAAoC,GAMpC,SAASA,cAAc,QAAQ,sBAAqB;AAUpD,OAAO,MAAMC,oBAAoB,CAAC,EAChCC,OAAO,EACPC,IAAI,EACJC,MAAM,EACNC,OAAO,EAAE,EACTC,SAAS,EACJ;IACL,2DAA2D;IAC3D,MAAMC,cAA2B;QAC/BC,QAAQ,CAAC;QACTC,QAAQ,CAAC;QACTC,gBAAgB,IAAIC;QACpBC,SAAS,CAAC;QACVC,SAAS,EAAE;QACXC,eAAe,EAAE;QACjBC,uBAAuB,EAAE;QACzBC,KAAK,CAAC;QACNC,SAAS,CAAC;QACVC,OAAO,EAAE;IACX;IAEA,mDAAmD;IACnD,oBAAoB;IACpBlB,eAAe;QACbE;QACAM,QAAQD,YAAYC,MAAM;QAC1BW,eAAeb;QACfG,QAAQF,YAAYE,MAAM;QAC1BC,gBAAgBH,YAAYG,cAAc;QAC1CU,cAAc;QACdjB;QACAkB,aAAa;QACbjB;QACAQ,SAASL,YAAYK,OAAO;QAC5BC,SAASN,YAAYM,OAAO;QAC5BS,iBAAiBhB;QACjBD;QACAS,eAAeP,YAAYO,aAAa;QACxCC,uBAAuBR,YAAYQ,qBAAqB;QACxDC,KAAKT,YAAYS,GAAG;QACpBC,SAASV,YAAYU,OAAO;QAC5BC,OAAOX,YAAYW,KAAK;IAC1B;IAEA,OAAOX;AACT,EAAC"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"numbers.d.ts","sourceRoot":"","sources":["../../../src/transform/write/numbers.ts"],"names":[],"mappings":"AAAA,KAAK,IAAI,GAAG;IACV,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAChC,IAAI,EAAE,OAAO,EAAE,CAAA;IACf,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAA;CACnC,CAAA;AAED,eAAO,MAAM,gBAAgB,+BAAgC,IAAI,SAQhE,CAAA"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/transform/write/numbers.ts"],"sourcesContent":["type Args = {\n baseRow: Record<string, unknown>\n data: unknown[]\n numbers: Record<string, unknown>[]\n}\n\nexport const transformNumbers = ({ baseRow, data, numbers }: Args) => {\n data.forEach((val, i) => {\n numbers.push({\n ...baseRow,\n number: val,\n order: i + 1,\n })\n })\n}\n"],"names":["transformNumbers","baseRow","data","numbers","forEach","val","i","push","number","order"],"rangeMappings":";;;;;;;;","mappings":"AAMA,OAAO,MAAMA,mBAAmB,CAAC,EAAEC,OAAO,EAAEC,IAAI,EAAEC,OAAO,EAAQ;IAC/DD,KAAKE,OAAO,CAAC,CAACC,KAAKC;QACjBH,QAAQI,IAAI,CAAC;YACX,GAAGN,OAAO;YACVO,QAAQH;YACRI,OAAOH,IAAI;QACb;IACF;AACF,EAAC"}
|
@@ -1,10 +0,0 @@
|
|
1
|
-
import type { RelationshipField, UploadField } from 'payload/types';
|
2
|
-
type Args = {
|
3
|
-
baseRow: Record<string, unknown>;
|
4
|
-
data: unknown;
|
5
|
-
field: RelationshipField | UploadField;
|
6
|
-
relationships: Record<string, unknown>[];
|
7
|
-
};
|
8
|
-
export declare const transformRelationship: ({ baseRow, data, field, relationships }: Args) => void;
|
9
|
-
export {};
|
10
|
-
//# sourceMappingURL=relationships.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"relationships.d.ts","sourceRoot":"","sources":["../../../src/transform/write/relationships.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAInE,KAAK,IAAI,GAAG;IACV,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAChC,IAAI,EAAE,OAAO,CAAA;IACb,KAAK,EAAE,iBAAiB,GAAG,WAAW,CAAA;IACtC,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAA;CACzC,CAAA;AAED,eAAO,MAAM,qBAAqB,4CAA6C,IAAI,SAiBlF,CAAA"}
|
@@ -1,23 +0,0 @@
|
|
1
|
-
import { valueIsValueWithRelation } from 'payload/types';
|
2
|
-
export const transformRelationship = ({ baseRow, data, field, relationships })=>{
|
3
|
-
const relations = Array.isArray(data) ? data : [
|
4
|
-
data
|
5
|
-
];
|
6
|
-
relations.forEach((relation, i)=>{
|
7
|
-
if (relation) {
|
8
|
-
const relationRow = {
|
9
|
-
...baseRow
|
10
|
-
};
|
11
|
-
if ('hasMany' in field && field.hasMany) relationRow.order = i + 1;
|
12
|
-
if (Array.isArray(field.relationTo) && valueIsValueWithRelation(relation)) {
|
13
|
-
relationRow[`${relation.relationTo}ID`] = relation.value;
|
14
|
-
relationships.push(relationRow);
|
15
|
-
} else {
|
16
|
-
relationRow[`${field.relationTo}ID`] = relation;
|
17
|
-
if (relation) relationships.push(relationRow);
|
18
|
-
}
|
19
|
-
}
|
20
|
-
});
|
21
|
-
};
|
22
|
-
|
23
|
-
//# sourceMappingURL=relationships.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/transform/write/relationships.ts"],"sourcesContent":["import type { RelationshipField, UploadField } from 'payload/types'\n\nimport { valueIsValueWithRelation } from 'payload/types'\n\ntype Args = {\n baseRow: Record<string, unknown>\n data: unknown\n field: RelationshipField | UploadField\n relationships: Record<string, unknown>[]\n}\n\nexport const transformRelationship = ({ baseRow, data, field, relationships }: Args) => {\n const relations = Array.isArray(data) ? data : [data]\n\n relations.forEach((relation, i) => {\n if (relation) {\n const relationRow = { ...baseRow }\n if ('hasMany' in field && field.hasMany) relationRow.order = i + 1\n\n if (Array.isArray(field.relationTo) && valueIsValueWithRelation(relation)) {\n relationRow[`${relation.relationTo}ID`] = relation.value\n relationships.push(relationRow)\n } else {\n relationRow[`${field.relationTo}ID`] = relation\n if (relation) relationships.push(relationRow)\n }\n }\n })\n}\n"],"names":["valueIsValueWithRelation","transformRelationship","baseRow","data","field","relationships","relations","Array","isArray","forEach","relation","i","relationRow","hasMany","order","relationTo","value","push"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;","mappings":"AAEA,SAASA,wBAAwB,QAAQ,gBAAe;AASxD,OAAO,MAAMC,wBAAwB,CAAC,EAAEC,OAAO,EAAEC,IAAI,EAAEC,KAAK,EAAEC,aAAa,EAAQ;IACjF,MAAMC,YAAYC,MAAMC,OAAO,CAACL,QAAQA,OAAO;QAACA;KAAK;IAErDG,UAAUG,OAAO,CAAC,CAACC,UAAUC;QAC3B,IAAID,UAAU;YACZ,MAAME,cAAc;gBAAE,GAAGV,OAAO;YAAC;YACjC,IAAI,aAAaE,SAASA,MAAMS,OAAO,EAAED,YAAYE,KAAK,GAAGH,IAAI;YAEjE,IAAIJ,MAAMC,OAAO,CAACJ,MAAMW,UAAU,KAAKf,yBAAyBU,WAAW;gBACzEE,WAAW,CAAC,CAAC,EAAEF,SAASK,UAAU,CAAC,EAAE,CAAC,CAAC,GAAGL,SAASM,KAAK;gBACxDX,cAAcY,IAAI,CAACL;YACrB,OAAO;gBACLA,WAAW,CAAC,CAAC,EAAER,MAAMW,UAAU,CAAC,EAAE,CAAC,CAAC,GAAGL;gBACvC,IAAIA,UAAUL,cAAcY,IAAI,CAACL;YACnC;QACF;IACF;AACF,EAAC"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"selects.d.ts","sourceRoot":"","sources":["../../../src/transform/write/selects.ts"],"names":[],"mappings":"AAGA,KAAK,IAAI,GAAG;IACV,IAAI,EAAE,OAAO,CAAA;IACb,EAAE,CAAC,EAAE,OAAO,CAAA;IACZ,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,eAAO,MAAM,gBAAgB,yBAA0B,IAAI,8BAoB1D,CAAA"}
|
@@ -1,20 +0,0 @@
|
|
1
|
-
/* eslint-disable no-param-reassign */ import { isArrayOfRows } from '../../utilities/isArrayOfRows.js';
|
2
|
-
export const transformSelects = ({ id, data, locale })=>{
|
3
|
-
const newRows = [];
|
4
|
-
if (isArrayOfRows(data)) {
|
5
|
-
data.forEach((value, i)=>{
|
6
|
-
const newRow = {
|
7
|
-
order: i + 1,
|
8
|
-
parent: id,
|
9
|
-
value
|
10
|
-
};
|
11
|
-
if (locale) {
|
12
|
-
newRow.locale = locale;
|
13
|
-
}
|
14
|
-
newRows.push(newRow);
|
15
|
-
});
|
16
|
-
}
|
17
|
-
return newRows;
|
18
|
-
};
|
19
|
-
|
20
|
-
//# sourceMappingURL=selects.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/transform/write/selects.ts"],"sourcesContent":["/* eslint-disable no-param-reassign */\nimport { isArrayOfRows } from '../../utilities/isArrayOfRows.js'\n\ntype Args = {\n data: unknown\n id?: unknown\n locale?: string\n}\n\nexport const transformSelects = ({ id, data, locale }: Args) => {\n const newRows: Record<string, unknown>[] = []\n\n if (isArrayOfRows(data)) {\n data.forEach((value, i) => {\n const newRow: Record<string, unknown> = {\n order: i + 1,\n parent: id,\n value,\n }\n\n if (locale) {\n newRow.locale = locale\n }\n\n newRows.push(newRow)\n })\n }\n\n return newRows\n}\n"],"names":["isArrayOfRows","transformSelects","id","data","locale","newRows","forEach","value","i","newRow","order","parent","push"],"rangeMappings":";;;;;;;;;;;;;;;;;","mappings":"AAAA,oCAAoC,GACpC,SAASA,aAAa,QAAQ,mCAAkC;AAQhE,OAAO,MAAMC,mBAAmB,CAAC,EAAEC,EAAE,EAAEC,IAAI,EAAEC,MAAM,EAAQ;IACzD,MAAMC,UAAqC,EAAE;IAE7C,IAAIL,cAAcG,OAAO;QACvBA,KAAKG,OAAO,CAAC,CAACC,OAAOC;YACnB,MAAMC,SAAkC;gBACtCC,OAAOF,IAAI;gBACXG,QAAQT;gBACRK;YACF;YAEA,IAAIH,QAAQ;gBACVK,OAAOL,MAAM,GAAGA;YAClB;YAEAC,QAAQO,IAAI,CAACH;QACf;IACF;IAEA,OAAOJ;AACT,EAAC"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"texts.d.ts","sourceRoot":"","sources":["../../../src/transform/write/texts.ts"],"names":[],"mappings":"AAAA,KAAK,IAAI,GAAG;IACV,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAChC,IAAI,EAAE,OAAO,EAAE,CAAA;IACf,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAA;CACjC,CAAA;AAED,eAAO,MAAM,cAAc,6BAA8B,IAAI,SAQ5D,CAAA"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/transform/write/texts.ts"],"sourcesContent":["type Args = {\n baseRow: Record<string, unknown>\n data: unknown[]\n texts: Record<string, unknown>[]\n}\n\nexport const transformTexts = ({ baseRow, data, texts }: Args) => {\n data.forEach((val, i) => {\n texts.push({\n ...baseRow,\n order: i + 1,\n text: val,\n })\n })\n}\n"],"names":["transformTexts","baseRow","data","texts","forEach","val","i","push","order","text"],"rangeMappings":";;;;;;;;","mappings":"AAMA,OAAO,MAAMA,iBAAiB,CAAC,EAAEC,OAAO,EAAEC,IAAI,EAAEC,KAAK,EAAQ;IAC3DD,KAAKE,OAAO,CAAC,CAACC,KAAKC;QACjBH,MAAMI,IAAI,CAAC;YACT,GAAGN,OAAO;YACVO,OAAOF,IAAI;YACXG,MAAMJ;QACR;IACF;AACF,EAAC"}
|
@@ -1,50 +0,0 @@
|
|
1
|
-
import type { Field } from 'payload/types';
|
2
|
-
import type { PostgresAdapter } from '../../types.js';
|
3
|
-
import type { ArrayRowToInsert, BlockRowToInsert, RelationshipToDelete } from './types.js';
|
4
|
-
type Args = {
|
5
|
-
adapter: PostgresAdapter;
|
6
|
-
arrays: {
|
7
|
-
[tableName: string]: ArrayRowToInsert[];
|
8
|
-
};
|
9
|
-
/**
|
10
|
-
* This is the name of the base table
|
11
|
-
*/
|
12
|
-
baseTableName: string;
|
13
|
-
blocks: {
|
14
|
-
[blockType: string]: BlockRowToInsert[];
|
15
|
-
};
|
16
|
-
blocksToDelete: Set<string>;
|
17
|
-
/**
|
18
|
-
* A snake-case field prefix, representing prior fields
|
19
|
-
* Ex: my_group_my_named_tab_
|
20
|
-
*/
|
21
|
-
columnPrefix: string;
|
22
|
-
data: Record<string, unknown>;
|
23
|
-
existingLocales?: Record<string, unknown>[];
|
24
|
-
/**
|
25
|
-
* A prefix that will retain camel-case formatting, representing prior fields
|
26
|
-
* Ex: myGroup_myNamedTab_
|
27
|
-
*/
|
28
|
-
fieldPrefix: string;
|
29
|
-
fields: Field[];
|
30
|
-
forcedLocale?: string;
|
31
|
-
locales: {
|
32
|
-
[locale: string]: Record<string, unknown>;
|
33
|
-
};
|
34
|
-
numbers: Record<string, unknown>[];
|
35
|
-
/**
|
36
|
-
* This is the name of the parent table
|
37
|
-
*/
|
38
|
-
parentTableName: string;
|
39
|
-
path: string;
|
40
|
-
relationships: Record<string, unknown>[];
|
41
|
-
relationshipsToDelete: RelationshipToDelete[];
|
42
|
-
row: Record<string, unknown>;
|
43
|
-
selects: {
|
44
|
-
[tableName: string]: Record<string, unknown>[];
|
45
|
-
};
|
46
|
-
texts: Record<string, unknown>[];
|
47
|
-
};
|
48
|
-
export declare const traverseFields: ({ adapter, arrays, baseTableName, blocks, blocksToDelete, columnPrefix, data, existingLocales, fieldPrefix, fields, forcedLocale, locales, numbers, parentTableName, path, relationships, relationshipsToDelete, row, selects, texts, }: Args) => void;
|
49
|
-
export {};
|
50
|
-
//# sourceMappingURL=traverseFields.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"traverseFields.d.ts","sourceRoot":"","sources":["../../../src/transform/write/traverseFields.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAK1C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AACrD,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AAU1F,KAAK,IAAI,GAAG;IACV,OAAO,EAAE,eAAe,CAAA;IACxB,MAAM,EAAE;QACN,CAAC,SAAS,EAAE,MAAM,GAAG,gBAAgB,EAAE,CAAA;KACxC,CAAA;IACD;;OAEG;IACH,aAAa,EAAE,MAAM,CAAA;IACrB,MAAM,EAAE;QACN,CAAC,SAAS,EAAE,MAAM,GAAG,gBAAgB,EAAE,CAAA;KACxC,CAAA;IACD,cAAc,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IAC3B;;;OAGG;IACH,YAAY,EAAE,MAAM,CAAA;IACpB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC7B,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAA;IAC3C;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAA;IACnB,MAAM,EAAE,KAAK,EAAE,CAAA;IACf,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,OAAO,EAAE;QACP,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAC1C,CAAA;IACD,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAA;IAClC;;OAEG;IACH,eAAe,EAAE,MAAM,CAAA;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAA;IACxC,qBAAqB,EAAE,oBAAoB,EAAE,CAAA;IAC7C,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC5B,OAAO,EAAE;QACP,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAA;KAC/C,CAAA;IACD,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAA;CACjC,CAAA;AAED,eAAO,MAAM,cAAc,4OAqBxB,IAAI,SA0dN,CAAA"}
|