@payloadcms/db-postgres 3.0.0-beta.12 → 3.0.0-beta.120
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 +44 -17
- package/dist/connect.js.map +1 -1
- package/dist/exports/migration-utils.d.ts +2 -0
- package/dist/exports/migration-utils.d.ts.map +1 -0
- package/dist/exports/migration-utils.js +3 -0
- package/dist/exports/migration-utils.js.map +1 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +51 -72
- package/dist/index.js.map +1 -1
- package/dist/predefinedMigrations/relationships-v2-v3.d.ts +4 -0
- package/dist/predefinedMigrations/relationships-v2-v3.d.ts.map +1 -0
- package/dist/predefinedMigrations/relationships-v2-v3.js.map +1 -0
- package/dist/predefinedMigrations/relationships-v2-v3.mjs +11 -0
- package/dist/predefinedMigrations/v2-v3/fetchAndResave/index.d.ts +20 -0
- package/dist/predefinedMigrations/v2-v3/fetchAndResave/index.d.ts.map +1 -0
- package/dist/predefinedMigrations/v2-v3/fetchAndResave/index.js +169 -0
- package/dist/predefinedMigrations/v2-v3/fetchAndResave/index.js.map +1 -0
- package/dist/predefinedMigrations/v2-v3/fetchAndResave/traverseFields.d.ts +11 -0
- package/dist/predefinedMigrations/v2-v3/fetchAndResave/traverseFields.d.ts.map +1 -0
- package/dist/predefinedMigrations/v2-v3/fetchAndResave/traverseFields.js +193 -0
- package/dist/predefinedMigrations/v2-v3/fetchAndResave/traverseFields.js.map +1 -0
- package/dist/predefinedMigrations/v2-v3/groupUpSQLStatements.d.ts +3 -0
- package/dist/predefinedMigrations/v2-v3/groupUpSQLStatements.d.ts.map +1 -0
- package/dist/predefinedMigrations/v2-v3/groupUpSQLStatements.js +56 -0
- package/dist/predefinedMigrations/v2-v3/groupUpSQLStatements.js.map +1 -0
- package/dist/predefinedMigrations/v2-v3/index.d.ts +23 -0
- package/dist/predefinedMigrations/v2-v3/index.d.ts.map +1 -0
- package/dist/predefinedMigrations/v2-v3/index.js +211 -0
- package/dist/predefinedMigrations/v2-v3/index.js.map +1 -0
- package/dist/predefinedMigrations/v2-v3/migrateRelationships.d.ts +20 -0
- package/dist/predefinedMigrations/v2-v3/migrateRelationships.d.ts.map +1 -0
- package/dist/predefinedMigrations/v2-v3/migrateRelationships.js +63 -0
- package/dist/predefinedMigrations/v2-v3/migrateRelationships.js.map +1 -0
- package/dist/predefinedMigrations/v2-v3/traverseFields.d.ts +23 -0
- package/dist/predefinedMigrations/v2-v3/traverseFields.d.ts.map +1 -0
- package/dist/predefinedMigrations/v2-v3/traverseFields.js +85 -0
- package/dist/predefinedMigrations/v2-v3/traverseFields.js.map +1 -0
- package/dist/predefinedMigrations/v2-v3/types.d.ts +9 -0
- package/dist/predefinedMigrations/v2-v3/types.d.ts.map +1 -0
- package/dist/predefinedMigrations/v2-v3/types.js +6 -0
- package/dist/predefinedMigrations/v2-v3/types.js.map +1 -0
- package/dist/types.d.ts +61 -80
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +40 -33
- package/dist/count.d.ts +0 -3
- package/dist/count.d.ts.map +0 -1
- package/dist/count.js +0 -53
- package/dist/count.js.map +0 -1
- package/dist/create.d.ts +0 -3
- package/dist/create.d.ts.map +0 -1
- package/dist/create.js +0 -21
- package/dist/create.js.map +0 -1
- package/dist/createGlobal.d.ts +0 -5
- package/dist/createGlobal.d.ts.map +0 -1
- package/dist/createGlobal.js +0 -21
- package/dist/createGlobal.js.map +0 -1
- package/dist/createGlobalVersion.d.ts +0 -6
- package/dist/createGlobalVersion.d.ts.map +0 -1
- package/dist/createGlobalVersion.js +0 -37
- package/dist/createGlobalVersion.js.map +0 -1
- package/dist/createMigration.d.ts +0 -3
- package/dist/createMigration.d.ts.map +0 -1
- package/dist/createMigration.js +0 -81
- package/dist/createMigration.js.map +0 -1
- package/dist/createVersion.d.ts +0 -5
- package/dist/createVersion.d.ts.map +0 -1
- package/dist/createVersion.js +0 -48
- package/dist/createVersion.js.map +0 -1
- package/dist/deleteMany.d.ts +0 -3
- package/dist/deleteMany.d.ts.map +0 -1
- package/dist/deleteMany.js +0 -31
- package/dist/deleteMany.js.map +0 -1
- package/dist/deleteOne.d.ts +0 -3
- package/dist/deleteOne.d.ts.map +0 -1
- package/dist/deleteOne.js +0 -62
- package/dist/deleteOne.js.map +0 -1
- package/dist/deleteVersions.d.ts +0 -3
- package/dist/deleteVersions.d.ts.map +0 -1
- package/dist/deleteVersions.js +0 -35
- package/dist/deleteVersions.js.map +0 -1
- package/dist/destroy.d.ts +0 -3
- package/dist/destroy.d.ts.map +0 -1
- package/dist/destroy.js +0 -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/init.d.ts +0 -3
- package/dist/init.d.ts.map +0 -1
- package/dist/init.js +0 -94
- package/dist/init.js.map +0 -1
- package/dist/migrate.d.ts +0 -3
- package/dist/migrate.d.ts.map +0 -1
- package/dist/migrate.js +0 -99
- package/dist/migrate.js.map +0 -1
- package/dist/migrateDown.d.ts +0 -3
- package/dist/migrateDown.d.ts.map +0 -1
- package/dist/migrateDown.js +0 -63
- package/dist/migrateDown.js.map +0 -1
- package/dist/migrateFresh.d.ts +0 -8
- package/dist/migrateFresh.d.ts.map +0 -1
- package/dist/migrateFresh.js +0 -72
- package/dist/migrateFresh.js.map +0 -1
- package/dist/migrateRefresh.d.ts +0 -6
- package/dist/migrateRefresh.d.ts.map +0 -1
- package/dist/migrateRefresh.js +0 -102
- package/dist/migrateRefresh.js.map +0 -1
- package/dist/migrateReset.d.ts +0 -6
- package/dist/migrateReset.d.ts.map +0 -1
- package/dist/migrateReset.js +0 -82
- package/dist/migrateReset.js.map +0 -1
- package/dist/migrateStatus.d.ts +0 -3
- package/dist/migrateStatus.d.ts.map +0 -1
- package/dist/migrateStatus.js +0 -44
- package/dist/migrateStatus.js.map +0 -1
- package/dist/queries/buildAndOrConditions.d.ts +0 -17
- package/dist/queries/buildAndOrConditions.d.ts.map +0 -1
- package/dist/queries/buildAndOrConditions.js +0 -29
- package/dist/queries/buildAndOrConditions.js.map +0 -1
- package/dist/queries/buildQuery.d.ts +0 -31
- package/dist/queries/buildQuery.d.ts.map +0 -1
- package/dist/queries/buildQuery.js +0 -76
- package/dist/queries/buildQuery.js.map +0 -1
- package/dist/queries/createJSONQuery/convertPathToJSONTraversal.d.ts +0 -2
- package/dist/queries/createJSONQuery/convertPathToJSONTraversal.d.ts.map +0 -1
- package/dist/queries/createJSONQuery/convertPathToJSONTraversal.js +0 -14
- package/dist/queries/createJSONQuery/convertPathToJSONTraversal.js.map +0 -1
- package/dist/queries/createJSONQuery/formatJSONPathSegment.d.ts +0 -2
- package/dist/queries/createJSONQuery/formatJSONPathSegment.d.ts.map +0 -1
- package/dist/queries/createJSONQuery/formatJSONPathSegment.js +0 -5
- package/dist/queries/createJSONQuery/formatJSONPathSegment.js.map +0 -1
- package/dist/queries/createJSONQuery/index.d.ts +0 -10
- package/dist/queries/createJSONQuery/index.d.ts.map +0 -1
- package/dist/queries/createJSONQuery/index.js +0 -54
- package/dist/queries/createJSONQuery/index.js.map +0 -1
- package/dist/queries/getTableColumnFromPath.d.ts +0 -51
- package/dist/queries/getTableColumnFromPath.d.ts.map +0 -1
- package/dist/queries/getTableColumnFromPath.js +0 -475
- package/dist/queries/getTableColumnFromPath.js.map +0 -1
- package/dist/queries/operatorMap.d.ts +0 -18
- package/dist/queries/operatorMap.d.ts.map +0 -1
- package/dist/queries/operatorMap.js +0 -24
- package/dist/queries/operatorMap.js.map +0 -1
- package/dist/queries/parseParams.d.ts +0 -17
- package/dist/queries/parseParams.d.ts.map +0 -1
- package/dist/queries/parseParams.js +0 -182
- package/dist/queries/parseParams.js.map +0 -1
- package/dist/queries/sanitizeQueryValue.d.ts +0 -15
- package/dist/queries/sanitizeQueryValue.d.ts.map +0 -1
- package/dist/queries/sanitizeQueryValue.js +0 -90
- package/dist/queries/sanitizeQueryValue.js.map +0 -1
- package/dist/queries/selectDistinct.d.ts +0 -23
- package/dist/queries/selectDistinct.d.ts.map +0 -1
- package/dist/queries/selectDistinct.js +0 -41
- package/dist/queries/selectDistinct.js.map +0 -1
- package/dist/queryDrafts.d.ts +0 -3
- package/dist/queryDrafts.d.ts.map +0 -1
- package/dist/queryDrafts.js +0 -45
- package/dist/queryDrafts.js.map +0 -1
- package/dist/schema/build.d.ts +0 -29
- package/dist/schema/build.d.ts.map +0 -1
- package/dist/schema/build.js +0 -279
- package/dist/schema/build.js.map +0 -1
- package/dist/schema/createIndex.d.ts +0 -12
- package/dist/schema/createIndex.d.ts.map +0 -1
- package/dist/schema/createIndex.js +0 -18
- package/dist/schema/createIndex.js.map +0 -1
- package/dist/schema/getTableName.d.ts +0 -32
- package/dist/schema/getTableName.d.ts.map +0 -1
- package/dist/schema/getTableName.js +0 -31
- package/dist/schema/getTableName.js.map +0 -1
- package/dist/schema/idToUUID.d.ts +0 -3
- package/dist/schema/idToUUID.d.ts.map +0 -1
- package/dist/schema/idToUUID.js +0 -11
- package/dist/schema/idToUUID.js.map +0 -1
- package/dist/schema/parentIDColumnMap.d.ts +0 -4
- package/dist/schema/parentIDColumnMap.d.ts.map +0 -1
- package/dist/schema/parentIDColumnMap.js +0 -9
- package/dist/schema/parentIDColumnMap.js.map +0 -1
- package/dist/schema/setColumnID.d.ts +0 -11
- package/dist/schema/setColumnID.d.ts.map +0 -1
- package/dist/schema/setColumnID.js +0 -24
- package/dist/schema/setColumnID.js.map +0 -1
- package/dist/schema/traverseFields.d.ts +0 -38
- package/dist/schema/traverseFields.d.ts.map +0 -1
- package/dist/schema/traverseFields.js +0 -529
- package/dist/schema/traverseFields.js.map +0 -1
- package/dist/schema/validateExistingBlockIsIdentical.d.ts +0 -12
- package/dist/schema/validateExistingBlockIsIdentical.d.ts.map +0 -1
- package/dist/schema/validateExistingBlockIsIdentical.js +0 -76
- package/dist/schema/validateExistingBlockIsIdentical.js.map +0 -1
- package/dist/transactions/beginTransaction.d.ts +0 -3
- package/dist/transactions/beginTransaction.d.ts.map +0 -1
- package/dist/transactions/beginTransaction.js +0 -47
- package/dist/transactions/beginTransaction.js.map +0 -1
- package/dist/transactions/commitTransaction.d.ts +0 -3
- package/dist/transactions/commitTransaction.d.ts.map +0 -1
- package/dist/transactions/commitTransaction.js +0 -14
- package/dist/transactions/commitTransaction.js.map +0 -1
- package/dist/transactions/rollbackTransaction.d.ts +0 -3
- package/dist/transactions/rollbackTransaction.d.ts.map +0 -1
- package/dist/transactions/rollbackTransaction.js +0 -13
- package/dist/transactions/rollbackTransaction.js.map +0 -1
- package/dist/transform/read/hasManyNumber.d.ts +0 -10
- package/dist/transform/read/hasManyNumber.d.ts.map +0 -1
- package/dist/transform/read/hasManyNumber.js +0 -10
- package/dist/transform/read/hasManyNumber.js.map +0 -1
- package/dist/transform/read/hasManyText.d.ts +0 -10
- package/dist/transform/read/hasManyText.d.ts.map +0 -1
- package/dist/transform/read/hasManyText.js +0 -10
- package/dist/transform/read/hasManyText.js.map +0 -1
- package/dist/transform/read/index.d.ts +0 -12
- package/dist/transform/read/index.d.ts.map +0 -1
- package/dist/transform/read/index.js +0 -43
- package/dist/transform/read/index.js.map +0 -1
- package/dist/transform/read/relationship.d.ts +0 -10
- package/dist/transform/read/relationship.d.ts.map +0 -1
- package/dist/transform/read/relationship.js +0 -64
- package/dist/transform/read/relationship.js.map +0 -1
- package/dist/transform/read/traverseFields.d.ts +0 -52
- package/dist/transform/read/traverseFields.d.ts.map +0 -1
- package/dist/transform/read/traverseFields.js +0 -421
- package/dist/transform/read/traverseFields.js.map +0 -1
- package/dist/transform/write/array.d.ts +0 -26
- package/dist/transform/write/array.d.ts.map +0 -1
- package/dist/transform/write/array.js +0 -58
- package/dist/transform/write/array.js.map +0 -1
- package/dist/transform/write/blocks.d.ts +0 -25
- package/dist/transform/write/blocks.d.ts.map +0 -1
- package/dist/transform/write/blocks.js +0 -54
- package/dist/transform/write/blocks.js.map +0 -1
- package/dist/transform/write/index.d.ts +0 -13
- package/dist/transform/write/index.d.ts.map +0 -1
- package/dist/transform/write/index.js +0 -41
- package/dist/transform/write/index.js.map +0 -1
- package/dist/transform/write/numbers.d.ts +0 -8
- package/dist/transform/write/numbers.d.ts.map +0 -1
- package/dist/transform/write/numbers.js +0 -11
- package/dist/transform/write/numbers.js.map +0 -1
- package/dist/transform/write/relationships.d.ts +0 -10
- package/dist/transform/write/relationships.d.ts.map +0 -1
- package/dist/transform/write/relationships.js +0 -23
- package/dist/transform/write/relationships.js.map +0 -1
- package/dist/transform/write/selects.d.ts +0 -8
- package/dist/transform/write/selects.d.ts.map +0 -1
- package/dist/transform/write/selects.js +0 -20
- package/dist/transform/write/selects.js.map +0 -1
- package/dist/transform/write/texts.d.ts +0 -8
- package/dist/transform/write/texts.d.ts.map +0 -1
- package/dist/transform/write/texts.js +0 -11
- package/dist/transform/write/texts.js.map +0 -1
- package/dist/transform/write/traverseFields.d.ts +0 -50
- package/dist/transform/write/traverseFields.d.ts.map +0 -1
- package/dist/transform/write/traverseFields.js +0 -428
- package/dist/transform/write/traverseFields.js.map +0 -1
- package/dist/transform/write/types.d.ts +0 -43
- package/dist/transform/write/types.d.ts.map +0 -1
- package/dist/transform/write/types.js +0 -3
- package/dist/transform/write/types.js.map +0 -1
- package/dist/update.d.ts +0 -3
- package/dist/update.d.ts.map +0 -1
- package/dist/update.js +0 -58
- package/dist/update.js.map +0 -1
- package/dist/updateGlobal.d.ts +0 -5
- package/dist/updateGlobal.d.ts.map +0 -1
- package/dist/updateGlobal.js +0 -28
- package/dist/updateGlobal.js.map +0 -1
- package/dist/updateGlobalVersion.d.ts +0 -5
- package/dist/updateGlobalVersion.d.ts.map +0 -1
- package/dist/updateGlobalVersion.js +0 -40
- package/dist/updateGlobalVersion.js.map +0 -1
- package/dist/updateVersion.d.ts +0 -5
- package/dist/updateVersion.d.ts.map +0 -1
- package/dist/updateVersion.js +0 -40
- package/dist/updateVersion.js.map +0 -1
- package/dist/upsertRow/deleteExistingArrayRows.d.ts +0 -10
- package/dist/upsertRow/deleteExistingArrayRows.d.ts.map +0 -1
- package/dist/upsertRow/deleteExistingArrayRows.js +0 -10
- package/dist/upsertRow/deleteExistingArrayRows.js.map +0 -1
- package/dist/upsertRow/deleteExistingRowsByPath.d.ts +0 -14
- package/dist/upsertRow/deleteExistingRowsByPath.d.ts.map +0 -1
- package/dist/upsertRow/deleteExistingRowsByPath.js +0 -33
- package/dist/upsertRow/deleteExistingRowsByPath.js.map +0 -1
- package/dist/upsertRow/index.d.ts +0 -4
- package/dist/upsertRow/index.d.ts.map +0 -1
- package/dist/upsertRow/index.js +0 -276
- package/dist/upsertRow/index.js.map +0 -1
- package/dist/upsertRow/insertArrays.d.ts +0 -13
- package/dist/upsertRow/insertArrays.d.ts.map +0 -1
- package/dist/upsertRow/insertArrays.js +0 -68
- package/dist/upsertRow/insertArrays.js.map +0 -1
- package/dist/upsertRow/types.d.ts +0 -27
- package/dist/upsertRow/types.d.ts.map +0 -1
- package/dist/upsertRow/types.js +0 -3
- package/dist/upsertRow/types.js.map +0 -1
- package/dist/utilities/appendPrefixToKeys.d.ts +0 -2
- package/dist/utilities/appendPrefixToKeys.d.ts.map +0 -1
- package/dist/utilities/appendPrefixToKeys.js +0 -6
- package/dist/utilities/appendPrefixToKeys.js.map +0 -1
- package/dist/utilities/createBlocksMap.d.ts +0 -5
- package/dist/utilities/createBlocksMap.d.ts.map +0 -1
- package/dist/utilities/createBlocksMap.js +0 -29
- package/dist/utilities/createBlocksMap.js.map +0 -1
- package/dist/utilities/createMigrationTable.d.ts +0 -3
- package/dist/utilities/createMigrationTable.d.ts.map +0 -1
- package/dist/utilities/createMigrationTable.js +0 -13
- package/dist/utilities/createMigrationTable.js.map +0 -1
- package/dist/utilities/createRelationshipMap.d.ts +0 -2
- package/dist/utilities/createRelationshipMap.d.ts.map +0 -1
- package/dist/utilities/createRelationshipMap.js +0 -19
- package/dist/utilities/createRelationshipMap.js.map +0 -1
- package/dist/utilities/hasLocalesTable.d.ts +0 -3
- package/dist/utilities/hasLocalesTable.d.ts.map +0 -1
- package/dist/utilities/hasLocalesTable.js +0 -11
- package/dist/utilities/hasLocalesTable.js.map +0 -1
- package/dist/utilities/isArrayOfRows.d.ts +0 -2
- package/dist/utilities/isArrayOfRows.d.ts.map +0 -1
- package/dist/utilities/isArrayOfRows.js +0 -5
- package/dist/utilities/isArrayOfRows.js.map +0 -1
- package/dist/utilities/migrationTableExists.d.ts +0 -3
- package/dist/utilities/migrationTableExists.d.ts.map +0 -1
- package/dist/utilities/migrationTableExists.js +0 -9
- package/dist/utilities/migrationTableExists.js.map +0 -1
- package/dist/utilities/parseError.d.ts +0 -5
- package/dist/utilities/parseError.d.ts.map +0 -1
- package/dist/utilities/parseError.js +0 -17
- package/dist/utilities/parseError.js.map +0 -1
- package/dist/utilities/pushDevSchema.d.ts +0 -9
- package/dist/utilities/pushDevSchema.d.ts.map +0 -1
- package/dist/utilities/pushDevSchema.js +0 -58
- package/dist/utilities/pushDevSchema.js.map +0 -1
@@ -1,529 +0,0 @@
|
|
1
|
-
/* eslint-disable no-param-reassign */ import { relations } from 'drizzle-orm';
|
2
|
-
import { PgNumericBuilder, PgUUIDBuilder, PgVarcharBuilder, boolean, index, integer, jsonb, numeric, pgEnum, text, timestamp, varchar } from 'drizzle-orm/pg-core';
|
3
|
-
import { InvalidConfiguration } from 'payload/errors';
|
4
|
-
import { fieldAffectsData, optionIsObject } from 'payload/types';
|
5
|
-
import toSnakeCase from 'to-snake-case';
|
6
|
-
import { hasLocalesTable } from '../utilities/hasLocalesTable.js';
|
7
|
-
import { buildTable } from './build.js';
|
8
|
-
import { createIndex } from './createIndex.js';
|
9
|
-
import { getTableName } from './getTableName.js';
|
10
|
-
import { idToUUID } from './idToUUID.js';
|
11
|
-
import { parentIDColumnMap } from './parentIDColumnMap.js';
|
12
|
-
import { validateExistingBlockIsIdentical } from './validateExistingBlockIsIdentical.js';
|
13
|
-
export const traverseFields = ({ adapter, buildNumbers, buildRelationships, buildTexts, columnPrefix, columns, disableNotNull, disableUnique = false, fieldPrefix, fields, forceLocalized, indexes, localesColumns, localesIndexes, newTableName, parentTableName, relationsToBuild, relationships, rootRelationsToBuild, rootTableIDColType, rootTableName, versions })=>{
|
14
|
-
const throwValidationError = true;
|
15
|
-
let hasLocalizedField = false;
|
16
|
-
let hasLocalizedRelationshipField = false;
|
17
|
-
let hasManyTextField = false;
|
18
|
-
let hasLocalizedManyTextField = false;
|
19
|
-
let hasManyNumberField = false;
|
20
|
-
let hasLocalizedManyNumberField = false;
|
21
|
-
let parentIDColType = 'integer';
|
22
|
-
if (columns.id instanceof PgUUIDBuilder) parentIDColType = 'uuid';
|
23
|
-
if (columns.id instanceof PgNumericBuilder) parentIDColType = 'numeric';
|
24
|
-
if (columns.id instanceof PgVarcharBuilder) parentIDColType = 'varchar';
|
25
|
-
fields.forEach((field)=>{
|
26
|
-
if ('name' in field && field.name === 'id') return;
|
27
|
-
let columnName;
|
28
|
-
let fieldName;
|
29
|
-
let targetTable = columns;
|
30
|
-
let targetIndexes = indexes;
|
31
|
-
if (fieldAffectsData(field)) {
|
32
|
-
columnName = `${columnPrefix || ''}${field.name[0] === '_' ? '_' : ''}${toSnakeCase(field.name)}`;
|
33
|
-
fieldName = `${fieldPrefix?.replace('.', '_') || ''}${field.name}`;
|
34
|
-
// If field is localized,
|
35
|
-
// add the column to the locale table instead of main table
|
36
|
-
if (adapter.payload.config.localization && (field.localized || forceLocalized)) {
|
37
|
-
hasLocalizedField = true;
|
38
|
-
targetTable = localesColumns;
|
39
|
-
targetIndexes = localesIndexes;
|
40
|
-
}
|
41
|
-
if ((field.unique || field.index) && ![
|
42
|
-
'array',
|
43
|
-
'blocks',
|
44
|
-
'group',
|
45
|
-
'point',
|
46
|
-
'relationship',
|
47
|
-
'upload'
|
48
|
-
].includes(field.type) && !('hasMany' in field && field.hasMany === true)) {
|
49
|
-
const unique = disableUnique !== true && field.unique;
|
50
|
-
if (unique) {
|
51
|
-
const constraintValue = `${fieldPrefix || ''}${field.name}`;
|
52
|
-
if (!adapter.fieldConstraints?.[rootTableName]) {
|
53
|
-
adapter.fieldConstraints[rootTableName] = {};
|
54
|
-
}
|
55
|
-
adapter.fieldConstraints[rootTableName][`${columnName}_idx`] = constraintValue;
|
56
|
-
}
|
57
|
-
targetIndexes[`${newTableName}_${field.name}Idx`] = createIndex({
|
58
|
-
name: fieldName,
|
59
|
-
columnName,
|
60
|
-
tableName: newTableName,
|
61
|
-
unique
|
62
|
-
});
|
63
|
-
}
|
64
|
-
}
|
65
|
-
switch(field.type){
|
66
|
-
case 'text':
|
67
|
-
{
|
68
|
-
if (field.hasMany) {
|
69
|
-
if (field.localized) {
|
70
|
-
hasLocalizedManyTextField = true;
|
71
|
-
}
|
72
|
-
if (field.index) {
|
73
|
-
hasManyTextField = 'index';
|
74
|
-
} else if (!hasManyTextField) {
|
75
|
-
hasManyTextField = true;
|
76
|
-
}
|
77
|
-
if (field.unique) {
|
78
|
-
throw new InvalidConfiguration('Unique is not supported in Postgres for hasMany text fields.');
|
79
|
-
}
|
80
|
-
} else {
|
81
|
-
targetTable[fieldName] = varchar(columnName);
|
82
|
-
}
|
83
|
-
break;
|
84
|
-
}
|
85
|
-
case 'email':
|
86
|
-
case 'code':
|
87
|
-
case 'textarea':
|
88
|
-
{
|
89
|
-
targetTable[fieldName] = varchar(columnName);
|
90
|
-
break;
|
91
|
-
}
|
92
|
-
case 'number':
|
93
|
-
{
|
94
|
-
if (field.hasMany) {
|
95
|
-
if (field.localized) {
|
96
|
-
hasLocalizedManyNumberField = true;
|
97
|
-
}
|
98
|
-
if (field.index) {
|
99
|
-
hasManyNumberField = 'index';
|
100
|
-
} else if (!hasManyNumberField) {
|
101
|
-
hasManyNumberField = true;
|
102
|
-
}
|
103
|
-
if (field.unique) {
|
104
|
-
throw new InvalidConfiguration('Unique is not supported in Postgres for hasMany number fields.');
|
105
|
-
}
|
106
|
-
} else {
|
107
|
-
targetTable[fieldName] = numeric(columnName);
|
108
|
-
}
|
109
|
-
break;
|
110
|
-
}
|
111
|
-
case 'richText':
|
112
|
-
case 'json':
|
113
|
-
{
|
114
|
-
targetTable[fieldName] = jsonb(columnName);
|
115
|
-
break;
|
116
|
-
}
|
117
|
-
case 'date':
|
118
|
-
{
|
119
|
-
targetTable[fieldName] = timestamp(columnName, {
|
120
|
-
mode: 'string',
|
121
|
-
precision: 3,
|
122
|
-
withTimezone: true
|
123
|
-
});
|
124
|
-
break;
|
125
|
-
}
|
126
|
-
case 'point':
|
127
|
-
{
|
128
|
-
break;
|
129
|
-
}
|
130
|
-
case 'radio':
|
131
|
-
case 'select':
|
132
|
-
{
|
133
|
-
const enumName = getTableName({
|
134
|
-
adapter,
|
135
|
-
config: field,
|
136
|
-
parentTableName: newTableName,
|
137
|
-
prefix: `enum_${newTableName}_`,
|
138
|
-
target: 'enumName',
|
139
|
-
throwValidationError
|
140
|
-
});
|
141
|
-
adapter.enums[enumName] = pgEnum(enumName, field.options.map((option)=>{
|
142
|
-
if (optionIsObject(option)) {
|
143
|
-
return option.value;
|
144
|
-
}
|
145
|
-
return option;
|
146
|
-
}));
|
147
|
-
if (field.type === 'select' && field.hasMany) {
|
148
|
-
const selectTableName = getTableName({
|
149
|
-
adapter,
|
150
|
-
config: field,
|
151
|
-
parentTableName: newTableName,
|
152
|
-
prefix: `${newTableName}_`,
|
153
|
-
throwValidationError
|
154
|
-
});
|
155
|
-
const baseColumns = {
|
156
|
-
order: integer('order').notNull(),
|
157
|
-
parent: parentIDColumnMap[parentIDColType]('parent_id').references(()=>adapter.tables[parentTableName].id, {
|
158
|
-
onDelete: 'cascade'
|
159
|
-
}).notNull(),
|
160
|
-
value: adapter.enums[enumName]('value')
|
161
|
-
};
|
162
|
-
const baseExtraConfig = {
|
163
|
-
orderIdx: (cols)=>index(`${selectTableName}_order_idx`).on(cols.order),
|
164
|
-
parentIdx: (cols)=>index(`${selectTableName}_parent_idx`).on(cols.parent)
|
165
|
-
};
|
166
|
-
if (field.localized) {
|
167
|
-
baseColumns.locale = adapter.enums.enum__locales('locale').notNull();
|
168
|
-
baseExtraConfig.localeIdx = (cols)=>index(`${selectTableName}_locale_idx`).on(cols.locale);
|
169
|
-
}
|
170
|
-
if (field.index) {
|
171
|
-
baseExtraConfig.value = (cols)=>index(`${selectTableName}_value_idx`).on(cols.value);
|
172
|
-
}
|
173
|
-
buildTable({
|
174
|
-
adapter,
|
175
|
-
baseColumns,
|
176
|
-
baseExtraConfig,
|
177
|
-
disableNotNull,
|
178
|
-
disableUnique,
|
179
|
-
fields: [],
|
180
|
-
tableName: selectTableName,
|
181
|
-
versions
|
182
|
-
});
|
183
|
-
relationsToBuild.set(fieldName, selectTableName);
|
184
|
-
const selectTableRelations = relations(adapter.tables[selectTableName], ({ one })=>{
|
185
|
-
const result = {
|
186
|
-
parent: one(adapter.tables[parentTableName], {
|
187
|
-
fields: [
|
188
|
-
adapter.tables[selectTableName].parent
|
189
|
-
],
|
190
|
-
references: [
|
191
|
-
adapter.tables[parentTableName].id
|
192
|
-
]
|
193
|
-
})
|
194
|
-
};
|
195
|
-
return result;
|
196
|
-
});
|
197
|
-
adapter.relations[`relation_${selectTableName}`] = selectTableRelations;
|
198
|
-
} else {
|
199
|
-
targetTable[fieldName] = adapter.enums[enumName](fieldName);
|
200
|
-
}
|
201
|
-
break;
|
202
|
-
}
|
203
|
-
case 'checkbox':
|
204
|
-
{
|
205
|
-
targetTable[fieldName] = boolean(columnName);
|
206
|
-
break;
|
207
|
-
}
|
208
|
-
case 'array':
|
209
|
-
{
|
210
|
-
const disableNotNullFromHere = Boolean(field.admin?.condition) || disableNotNull;
|
211
|
-
const arrayTableName = getTableName({
|
212
|
-
adapter,
|
213
|
-
config: field,
|
214
|
-
parentTableName: newTableName,
|
215
|
-
prefix: `${newTableName}_`,
|
216
|
-
throwValidationError
|
217
|
-
});
|
218
|
-
const baseColumns = {
|
219
|
-
_order: integer('_order').notNull(),
|
220
|
-
_parentID: parentIDColumnMap[parentIDColType]('_parent_id').references(()=>adapter.tables[parentTableName].id, {
|
221
|
-
onDelete: 'cascade'
|
222
|
-
}).notNull()
|
223
|
-
};
|
224
|
-
const baseExtraConfig = {
|
225
|
-
_orderIdx: (cols)=>index(`${arrayTableName}_order_idx`).on(cols._order),
|
226
|
-
_parentIDIdx: (cols)=>index(`${arrayTableName}_parent_id_idx`).on(cols._parentID)
|
227
|
-
};
|
228
|
-
if (field.localized && adapter.payload.config.localization) {
|
229
|
-
baseColumns._locale = adapter.enums.enum__locales('_locale').notNull();
|
230
|
-
baseExtraConfig._localeIdx = (cols)=>index(`${arrayTableName}_locale_idx`).on(cols._locale);
|
231
|
-
}
|
232
|
-
const { hasManyNumberField: subHasManyNumberField, hasManyTextField: subHasManyTextField, relationsToBuild: subRelationsToBuild } = buildTable({
|
233
|
-
adapter,
|
234
|
-
baseColumns,
|
235
|
-
baseExtraConfig,
|
236
|
-
disableNotNull: disableNotNullFromHere,
|
237
|
-
disableUnique,
|
238
|
-
fields: disableUnique ? idToUUID(field.fields) : field.fields,
|
239
|
-
rootRelationsToBuild,
|
240
|
-
rootRelationships: relationships,
|
241
|
-
rootTableIDColType,
|
242
|
-
rootTableName,
|
243
|
-
tableName: arrayTableName,
|
244
|
-
versions
|
245
|
-
});
|
246
|
-
if (subHasManyTextField) {
|
247
|
-
if (!hasManyTextField || subHasManyTextField === 'index') hasManyTextField = subHasManyTextField;
|
248
|
-
}
|
249
|
-
if (subHasManyNumberField) {
|
250
|
-
if (!hasManyNumberField || subHasManyNumberField === 'index') hasManyNumberField = subHasManyNumberField;
|
251
|
-
}
|
252
|
-
relationsToBuild.set(fieldName, arrayTableName);
|
253
|
-
const arrayTableRelations = relations(adapter.tables[arrayTableName], ({ many, one })=>{
|
254
|
-
const result = {
|
255
|
-
_parentID: one(adapter.tables[parentTableName], {
|
256
|
-
fields: [
|
257
|
-
adapter.tables[arrayTableName]._parentID
|
258
|
-
],
|
259
|
-
references: [
|
260
|
-
adapter.tables[parentTableName].id
|
261
|
-
]
|
262
|
-
})
|
263
|
-
};
|
264
|
-
if (hasLocalesTable(field.fields)) {
|
265
|
-
result._locales = many(adapter.tables[`${arrayTableName}${adapter.localesSuffix}`]);
|
266
|
-
}
|
267
|
-
subRelationsToBuild.forEach((val, key)=>{
|
268
|
-
result[key] = many(adapter.tables[val]);
|
269
|
-
});
|
270
|
-
return result;
|
271
|
-
});
|
272
|
-
adapter.relations[`relations_${arrayTableName}`] = arrayTableRelations;
|
273
|
-
break;
|
274
|
-
}
|
275
|
-
case 'blocks':
|
276
|
-
{
|
277
|
-
const disableNotNullFromHere = Boolean(field.admin?.condition) || disableNotNull;
|
278
|
-
field.blocks.forEach((block)=>{
|
279
|
-
const blockTableName = getTableName({
|
280
|
-
adapter,
|
281
|
-
config: block,
|
282
|
-
parentTableName: rootTableName,
|
283
|
-
prefix: `${rootTableName}_blocks_`,
|
284
|
-
throwValidationError
|
285
|
-
});
|
286
|
-
if (!adapter.tables[blockTableName]) {
|
287
|
-
const baseColumns = {
|
288
|
-
_order: integer('_order').notNull(),
|
289
|
-
_parentID: parentIDColumnMap[rootTableIDColType]('_parent_id').references(()=>adapter.tables[rootTableName].id, {
|
290
|
-
onDelete: 'cascade'
|
291
|
-
}).notNull(),
|
292
|
-
_path: text('_path').notNull()
|
293
|
-
};
|
294
|
-
const baseExtraConfig = {
|
295
|
-
_orderIdx: (cols)=>index(`${blockTableName}_order_idx`).on(cols._order),
|
296
|
-
_parentIDIdx: (cols)=>index(`${blockTableName}_parent_id_idx`).on(cols._parentID),
|
297
|
-
_pathIdx: (cols)=>index(`${blockTableName}_path_idx`).on(cols._path)
|
298
|
-
};
|
299
|
-
if (field.localized && adapter.payload.config.localization) {
|
300
|
-
baseColumns._locale = adapter.enums.enum__locales('_locale').notNull();
|
301
|
-
baseExtraConfig._localeIdx = (cols)=>index(`${blockTableName}_locale_idx`).on(cols._locale);
|
302
|
-
}
|
303
|
-
const { hasManyNumberField: subHasManyNumberField, hasManyTextField: subHasManyTextField, relationsToBuild: subRelationsToBuild } = buildTable({
|
304
|
-
adapter,
|
305
|
-
baseColumns,
|
306
|
-
baseExtraConfig,
|
307
|
-
disableNotNull: disableNotNullFromHere,
|
308
|
-
disableUnique,
|
309
|
-
fields: disableUnique ? idToUUID(block.fields) : block.fields,
|
310
|
-
rootRelationsToBuild,
|
311
|
-
rootRelationships: relationships,
|
312
|
-
rootTableIDColType,
|
313
|
-
rootTableName,
|
314
|
-
tableName: blockTableName,
|
315
|
-
versions
|
316
|
-
});
|
317
|
-
if (subHasManyTextField) {
|
318
|
-
if (!hasManyTextField || subHasManyTextField === 'index') hasManyTextField = subHasManyTextField;
|
319
|
-
}
|
320
|
-
if (subHasManyNumberField) {
|
321
|
-
if (!hasManyNumberField || subHasManyNumberField === 'index') hasManyNumberField = subHasManyNumberField;
|
322
|
-
}
|
323
|
-
const blockTableRelations = relations(adapter.tables[blockTableName], ({ many, one })=>{
|
324
|
-
const result = {
|
325
|
-
_parentID: one(adapter.tables[rootTableName], {
|
326
|
-
fields: [
|
327
|
-
adapter.tables[blockTableName]._parentID
|
328
|
-
],
|
329
|
-
references: [
|
330
|
-
adapter.tables[rootTableName].id
|
331
|
-
]
|
332
|
-
})
|
333
|
-
};
|
334
|
-
if (hasLocalesTable(block.fields)) {
|
335
|
-
result._locales = many(adapter.tables[`${blockTableName}${adapter.localesSuffix}`]);
|
336
|
-
}
|
337
|
-
subRelationsToBuild.forEach((val, key)=>{
|
338
|
-
result[key] = many(adapter.tables[val]);
|
339
|
-
});
|
340
|
-
return result;
|
341
|
-
});
|
342
|
-
adapter.relations[`relations_${blockTableName}`] = blockTableRelations;
|
343
|
-
} else if (process.env.NODE_ENV !== 'production' && !versions) {
|
344
|
-
validateExistingBlockIsIdentical({
|
345
|
-
block,
|
346
|
-
localized: field.localized,
|
347
|
-
rootTableName,
|
348
|
-
table: adapter.tables[blockTableName],
|
349
|
-
tableLocales: adapter.tables[`${blockTableName}${adapter.localesSuffix}`]
|
350
|
-
});
|
351
|
-
}
|
352
|
-
adapter.blockTableNames[`${rootTableName}.${toSnakeCase(block.slug)}`] = blockTableName;
|
353
|
-
rootRelationsToBuild.set(`_blocks_${block.slug}`, blockTableName);
|
354
|
-
});
|
355
|
-
break;
|
356
|
-
}
|
357
|
-
case 'tab':
|
358
|
-
case 'group':
|
359
|
-
{
|
360
|
-
if (!('name' in field)) {
|
361
|
-
const { hasLocalizedField: groupHasLocalizedField, hasLocalizedManyNumberField: groupHasLocalizedManyNumberField, hasLocalizedManyTextField: groupHasLocalizedManyTextField, hasLocalizedRelationshipField: groupHasLocalizedRelationshipField, hasManyNumberField: groupHasManyNumberField, hasManyTextField: groupHasManyTextField } = traverseFields({
|
362
|
-
adapter,
|
363
|
-
buildNumbers,
|
364
|
-
buildRelationships,
|
365
|
-
buildTexts,
|
366
|
-
columnPrefix,
|
367
|
-
columns,
|
368
|
-
disableNotNull,
|
369
|
-
disableUnique,
|
370
|
-
fieldPrefix,
|
371
|
-
fields: field.fields,
|
372
|
-
forceLocalized,
|
373
|
-
indexes,
|
374
|
-
localesColumns,
|
375
|
-
localesIndexes,
|
376
|
-
newTableName,
|
377
|
-
parentTableName,
|
378
|
-
relationsToBuild,
|
379
|
-
relationships,
|
380
|
-
rootRelationsToBuild,
|
381
|
-
rootTableIDColType,
|
382
|
-
rootTableName,
|
383
|
-
versions
|
384
|
-
});
|
385
|
-
if (groupHasLocalizedField) hasLocalizedField = true;
|
386
|
-
if (groupHasLocalizedRelationshipField) hasLocalizedRelationshipField = true;
|
387
|
-
if (groupHasManyTextField) hasManyTextField = true;
|
388
|
-
if (groupHasLocalizedManyTextField) hasLocalizedManyTextField = true;
|
389
|
-
if (groupHasManyNumberField) hasManyNumberField = true;
|
390
|
-
if (groupHasLocalizedManyNumberField) hasLocalizedManyNumberField = true;
|
391
|
-
break;
|
392
|
-
}
|
393
|
-
const disableNotNullFromHere = Boolean(field.admin?.condition) || disableNotNull;
|
394
|
-
const { hasLocalizedField: groupHasLocalizedField, hasLocalizedManyNumberField: groupHasLocalizedManyNumberField, hasLocalizedManyTextField: groupHasLocalizedManyTextField, hasLocalizedRelationshipField: groupHasLocalizedRelationshipField, hasManyNumberField: groupHasManyNumberField, hasManyTextField: groupHasManyTextField } = traverseFields({
|
395
|
-
adapter,
|
396
|
-
buildNumbers,
|
397
|
-
buildRelationships,
|
398
|
-
buildTexts,
|
399
|
-
columnPrefix: `${columnName}_`,
|
400
|
-
columns,
|
401
|
-
disableNotNull: disableNotNullFromHere,
|
402
|
-
disableUnique,
|
403
|
-
fieldPrefix: `${fieldName}.`,
|
404
|
-
fields: field.fields,
|
405
|
-
forceLocalized: field.localized,
|
406
|
-
indexes,
|
407
|
-
localesColumns,
|
408
|
-
localesIndexes,
|
409
|
-
newTableName: `${parentTableName}_${columnName}`,
|
410
|
-
parentTableName,
|
411
|
-
relationsToBuild,
|
412
|
-
relationships,
|
413
|
-
rootRelationsToBuild,
|
414
|
-
rootTableIDColType,
|
415
|
-
rootTableName,
|
416
|
-
versions
|
417
|
-
});
|
418
|
-
if (groupHasLocalizedField) hasLocalizedField = true;
|
419
|
-
if (groupHasLocalizedRelationshipField) hasLocalizedRelationshipField = true;
|
420
|
-
if (groupHasManyTextField) hasManyTextField = true;
|
421
|
-
if (groupHasLocalizedManyTextField) hasLocalizedManyTextField = true;
|
422
|
-
if (groupHasManyNumberField) hasManyNumberField = true;
|
423
|
-
if (groupHasLocalizedManyNumberField) hasLocalizedManyNumberField = true;
|
424
|
-
break;
|
425
|
-
}
|
426
|
-
case 'tabs':
|
427
|
-
{
|
428
|
-
const disableNotNullFromHere = Boolean(field.admin?.condition) || disableNotNull;
|
429
|
-
const { hasLocalizedField: tabHasLocalizedField, hasLocalizedManyNumberField: tabHasLocalizedManyNumberField, hasLocalizedManyTextField: tabHasLocalizedManyTextField, hasLocalizedRelationshipField: tabHasLocalizedRelationshipField, hasManyNumberField: tabHasManyNumberField, hasManyTextField: tabHasManyTextField } = traverseFields({
|
430
|
-
adapter,
|
431
|
-
buildNumbers,
|
432
|
-
buildRelationships,
|
433
|
-
buildTexts,
|
434
|
-
columnPrefix,
|
435
|
-
columns,
|
436
|
-
disableNotNull: disableNotNullFromHere,
|
437
|
-
disableUnique,
|
438
|
-
fieldPrefix,
|
439
|
-
fields: field.tabs.map((tab)=>({
|
440
|
-
...tab,
|
441
|
-
type: 'tab'
|
442
|
-
})),
|
443
|
-
forceLocalized,
|
444
|
-
indexes,
|
445
|
-
localesColumns,
|
446
|
-
localesIndexes,
|
447
|
-
newTableName,
|
448
|
-
parentTableName,
|
449
|
-
relationsToBuild,
|
450
|
-
relationships,
|
451
|
-
rootRelationsToBuild,
|
452
|
-
rootTableIDColType,
|
453
|
-
rootTableName,
|
454
|
-
versions
|
455
|
-
});
|
456
|
-
if (tabHasLocalizedField) hasLocalizedField = true;
|
457
|
-
if (tabHasLocalizedRelationshipField) hasLocalizedRelationshipField = true;
|
458
|
-
if (tabHasManyTextField) hasManyTextField = true;
|
459
|
-
if (tabHasLocalizedManyTextField) hasLocalizedManyTextField = true;
|
460
|
-
if (tabHasManyNumberField) hasManyNumberField = true;
|
461
|
-
if (tabHasLocalizedManyNumberField) hasLocalizedManyNumberField = true;
|
462
|
-
break;
|
463
|
-
}
|
464
|
-
case 'row':
|
465
|
-
case 'collapsible':
|
466
|
-
{
|
467
|
-
const disableNotNullFromHere = Boolean(field.admin?.condition) || disableNotNull;
|
468
|
-
const { hasLocalizedField: rowHasLocalizedField, hasLocalizedManyNumberField: rowHasLocalizedManyNumberField, hasLocalizedManyTextField: rowHasLocalizedManyTextField, hasLocalizedRelationshipField: rowHasLocalizedRelationshipField, hasManyNumberField: rowHasManyNumberField, hasManyTextField: rowHasManyTextField } = traverseFields({
|
469
|
-
adapter,
|
470
|
-
buildNumbers,
|
471
|
-
buildRelationships,
|
472
|
-
buildTexts,
|
473
|
-
columnPrefix,
|
474
|
-
columns,
|
475
|
-
disableNotNull: disableNotNullFromHere,
|
476
|
-
disableUnique,
|
477
|
-
fieldPrefix,
|
478
|
-
fields: field.fields,
|
479
|
-
forceLocalized,
|
480
|
-
indexes,
|
481
|
-
localesColumns,
|
482
|
-
localesIndexes,
|
483
|
-
newTableName,
|
484
|
-
parentTableName,
|
485
|
-
relationsToBuild,
|
486
|
-
relationships,
|
487
|
-
rootRelationsToBuild,
|
488
|
-
rootTableIDColType,
|
489
|
-
rootTableName,
|
490
|
-
versions
|
491
|
-
});
|
492
|
-
if (rowHasLocalizedField) hasLocalizedField = true;
|
493
|
-
if (rowHasLocalizedRelationshipField) hasLocalizedRelationshipField = true;
|
494
|
-
if (rowHasManyTextField) hasManyTextField = true;
|
495
|
-
if (rowHasLocalizedManyTextField) hasLocalizedManyTextField = true;
|
496
|
-
if (rowHasManyNumberField) hasManyNumberField = true;
|
497
|
-
if (rowHasLocalizedManyNumberField) hasLocalizedManyNumberField = true;
|
498
|
-
break;
|
499
|
-
}
|
500
|
-
case 'relationship':
|
501
|
-
case 'upload':
|
502
|
-
if (Array.isArray(field.relationTo)) {
|
503
|
-
field.relationTo.forEach((relation)=>relationships.add(relation));
|
504
|
-
} else {
|
505
|
-
relationships.add(field.relationTo);
|
506
|
-
}
|
507
|
-
if (field.localized && adapter.payload.config.localization) {
|
508
|
-
hasLocalizedRelationshipField = true;
|
509
|
-
}
|
510
|
-
break;
|
511
|
-
default:
|
512
|
-
break;
|
513
|
-
}
|
514
|
-
const condition = field.admin && field.admin.condition;
|
515
|
-
if (!disableNotNull && targetTable[fieldName] && 'required' in field && field.required && !condition) {
|
516
|
-
targetTable[fieldName].notNull();
|
517
|
-
}
|
518
|
-
});
|
519
|
-
return {
|
520
|
-
hasLocalizedField,
|
521
|
-
hasLocalizedManyNumberField,
|
522
|
-
hasLocalizedManyTextField,
|
523
|
-
hasLocalizedRelationshipField,
|
524
|
-
hasManyNumberField,
|
525
|
-
hasManyTextField
|
526
|
-
};
|
527
|
-
};
|
528
|
-
|
529
|
-
//# sourceMappingURL=traverseFields.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../../src/schema/traverseFields.ts"],"sourcesContent":["/* eslint-disable no-param-reassign */\nimport type { Relation } from 'drizzle-orm'\nimport type { IndexBuilder, PgColumnBuilder, UniqueConstraintBuilder } from 'drizzle-orm/pg-core'\nimport type { Field, TabAsField } from 'payload/types'\n\nimport { relations } from 'drizzle-orm'\nimport {\n PgNumericBuilder,\n PgUUIDBuilder,\n PgVarcharBuilder,\n boolean,\n index,\n integer,\n jsonb,\n numeric,\n pgEnum,\n text,\n timestamp,\n varchar,\n} from 'drizzle-orm/pg-core'\nimport { InvalidConfiguration } from 'payload/errors'\nimport { fieldAffectsData, optionIsObject } from 'payload/types'\nimport toSnakeCase from 'to-snake-case'\n\nimport type { GenericColumns, IDType, PostgresAdapter } from '../types.js'\n\nimport { hasLocalesTable } from '../utilities/hasLocalesTable.js'\nimport { buildTable } from './build.js'\nimport { createIndex } from './createIndex.js'\nimport { getTableName } from './getTableName.js'\nimport { idToUUID } from './idToUUID.js'\nimport { parentIDColumnMap } from './parentIDColumnMap.js'\nimport { validateExistingBlockIsIdentical } from './validateExistingBlockIsIdentical.js'\n\ntype Args = {\n adapter: PostgresAdapter\n buildNumbers: boolean\n buildRelationships: boolean\n buildTexts: boolean\n columnPrefix?: string\n columns: Record<string, PgColumnBuilder>\n disableNotNull: boolean\n disableUnique?: boolean\n fieldPrefix?: string\n fields: (Field | TabAsField)[]\n forceLocalized?: boolean\n indexes: Record<string, (cols: GenericColumns) => IndexBuilder>\n localesColumns: Record<string, PgColumnBuilder>\n localesIndexes: Record<string, (cols: GenericColumns) => IndexBuilder>\n newTableName: string\n parentTableName: string\n relationsToBuild: Map<string, string>\n relationships: Set<string>\n rootRelationsToBuild?: Map<string, string>\n rootTableIDColType: string\n rootTableName: string\n versions: boolean\n}\n\ntype Result = {\n hasLocalizedField: boolean\n hasLocalizedManyNumberField: boolean\n hasLocalizedManyTextField: boolean\n hasLocalizedRelationshipField: boolean\n hasManyNumberField: 'index' | boolean\n hasManyTextField: 'index' | boolean\n}\n\nexport const traverseFields = ({\n adapter,\n buildNumbers,\n buildRelationships,\n buildTexts,\n columnPrefix,\n columns,\n disableNotNull,\n disableUnique = false,\n fieldPrefix,\n fields,\n forceLocalized,\n indexes,\n localesColumns,\n localesIndexes,\n newTableName,\n parentTableName,\n relationsToBuild,\n relationships,\n rootRelationsToBuild,\n rootTableIDColType,\n rootTableName,\n versions,\n}: Args): Result => {\n const throwValidationError = true\n let hasLocalizedField = false\n let hasLocalizedRelationshipField = false\n let hasManyTextField: 'index' | boolean = false\n let hasLocalizedManyTextField = false\n let hasManyNumberField: 'index' | boolean = false\n let hasLocalizedManyNumberField = false\n\n let parentIDColType: IDType = 'integer'\n if (columns.id instanceof PgUUIDBuilder) parentIDColType = 'uuid'\n if (columns.id instanceof PgNumericBuilder) parentIDColType = 'numeric'\n if (columns.id instanceof PgVarcharBuilder) parentIDColType = 'varchar'\n\n fields.forEach((field) => {\n if ('name' in field && field.name === 'id') return\n let columnName: string\n let fieldName: string\n\n let targetTable = columns\n let targetIndexes = indexes\n\n if (fieldAffectsData(field)) {\n columnName = `${columnPrefix || ''}${field.name[0] === '_' ? '_' : ''}${toSnakeCase(\n field.name,\n )}`\n fieldName = `${fieldPrefix?.replace('.', '_') || ''}${field.name}`\n\n // If field is localized,\n // add the column to the locale table instead of main table\n if (adapter.payload.config.localization && (field.localized || forceLocalized)) {\n hasLocalizedField = true\n targetTable = localesColumns\n targetIndexes = localesIndexes\n }\n\n if (\n (field.unique || field.index) &&\n !['array', 'blocks', 'group', 'point', 'relationship', 'upload'].includes(field.type) &&\n !('hasMany' in field && field.hasMany === true)\n ) {\n const unique = disableUnique !== true && field.unique\n if (unique) {\n const constraintValue = `${fieldPrefix || ''}${field.name}`\n if (!adapter.fieldConstraints?.[rootTableName]) {\n adapter.fieldConstraints[rootTableName] = {}\n }\n adapter.fieldConstraints[rootTableName][`${columnName}_idx`] = constraintValue\n }\n targetIndexes[`${newTableName}_${field.name}Idx`] = createIndex({\n name: fieldName,\n columnName,\n tableName: newTableName,\n unique,\n })\n }\n }\n\n switch (field.type) {\n case 'text': {\n if (field.hasMany) {\n if (field.localized) {\n hasLocalizedManyTextField = true\n }\n\n if (field.index) {\n hasManyTextField = 'index'\n } else if (!hasManyTextField) {\n hasManyTextField = true\n }\n\n if (field.unique) {\n throw new InvalidConfiguration(\n 'Unique is not supported in Postgres for hasMany text fields.',\n )\n }\n } else {\n targetTable[fieldName] = varchar(columnName)\n }\n break\n }\n case 'email':\n case 'code':\n case 'textarea': {\n targetTable[fieldName] = varchar(columnName)\n break\n }\n\n case 'number': {\n if (field.hasMany) {\n if (field.localized) {\n hasLocalizedManyNumberField = true\n }\n\n if (field.index) {\n hasManyNumberField = 'index'\n } else if (!hasManyNumberField) {\n hasManyNumberField = true\n }\n\n if (field.unique) {\n throw new InvalidConfiguration(\n 'Unique is not supported in Postgres for hasMany number fields.',\n )\n }\n } else {\n targetTable[fieldName] = numeric(columnName)\n }\n break\n }\n\n case 'richText':\n case 'json': {\n targetTable[fieldName] = jsonb(columnName)\n break\n }\n\n case 'date': {\n targetTable[fieldName] = timestamp(columnName, {\n mode: 'string',\n precision: 3,\n withTimezone: true,\n })\n break\n }\n\n case 'point': {\n break\n }\n\n case 'radio':\n case 'select': {\n const enumName = getTableName({\n adapter,\n config: field,\n parentTableName: newTableName,\n prefix: `enum_${newTableName}_`,\n target: 'enumName',\n throwValidationError,\n })\n\n adapter.enums[enumName] = pgEnum(\n enumName,\n field.options.map((option) => {\n if (optionIsObject(option)) {\n return option.value\n }\n\n return option\n }) as [string, ...string[]],\n )\n\n if (field.type === 'select' && field.hasMany) {\n const selectTableName = getTableName({\n adapter,\n config: field,\n parentTableName: newTableName,\n prefix: `${newTableName}_`,\n throwValidationError,\n })\n const baseColumns: Record<string, PgColumnBuilder> = {\n order: integer('order').notNull(),\n parent: parentIDColumnMap[parentIDColType]('parent_id')\n .references(() => adapter.tables[parentTableName].id, { onDelete: 'cascade' })\n .notNull(),\n value: adapter.enums[enumName]('value'),\n }\n\n const baseExtraConfig: Record<\n string,\n (cols: GenericColumns) => IndexBuilder | UniqueConstraintBuilder\n > = {\n orderIdx: (cols) => index(`${selectTableName}_order_idx`).on(cols.order),\n parentIdx: (cols) => index(`${selectTableName}_parent_idx`).on(cols.parent),\n }\n\n if (field.localized) {\n baseColumns.locale = adapter.enums.enum__locales('locale').notNull()\n baseExtraConfig.localeIdx = (cols) =>\n index(`${selectTableName}_locale_idx`).on(cols.locale)\n }\n\n if (field.index) {\n baseExtraConfig.value = (cols) => index(`${selectTableName}_value_idx`).on(cols.value)\n }\n\n buildTable({\n adapter,\n baseColumns,\n baseExtraConfig,\n disableNotNull,\n disableUnique,\n fields: [],\n tableName: selectTableName,\n versions,\n })\n\n relationsToBuild.set(fieldName, selectTableName)\n\n const selectTableRelations = relations(adapter.tables[selectTableName], ({ one }) => {\n const result: Record<string, Relation<string>> = {\n parent: one(adapter.tables[parentTableName], {\n fields: [adapter.tables[selectTableName].parent],\n references: [adapter.tables[parentTableName].id],\n }),\n }\n\n return result\n })\n\n adapter.relations[`relation_${selectTableName}`] = selectTableRelations\n } else {\n targetTable[fieldName] = adapter.enums[enumName](fieldName)\n }\n break\n }\n\n case 'checkbox': {\n targetTable[fieldName] = boolean(columnName)\n break\n }\n\n case 'array': {\n const disableNotNullFromHere = Boolean(field.admin?.condition) || disableNotNull\n\n const arrayTableName = getTableName({\n adapter,\n config: field,\n parentTableName: newTableName,\n prefix: `${newTableName}_`,\n throwValidationError,\n })\n const baseColumns: Record<string, PgColumnBuilder> = {\n _order: integer('_order').notNull(),\n _parentID: parentIDColumnMap[parentIDColType]('_parent_id')\n .references(() => adapter.tables[parentTableName].id, { onDelete: 'cascade' })\n .notNull(),\n }\n\n const baseExtraConfig: Record<\n string,\n (cols: GenericColumns) => IndexBuilder | UniqueConstraintBuilder\n > = {\n _orderIdx: (cols) => index(`${arrayTableName}_order_idx`).on(cols._order),\n _parentIDIdx: (cols) => index(`${arrayTableName}_parent_id_idx`).on(cols._parentID),\n }\n\n if (field.localized && adapter.payload.config.localization) {\n baseColumns._locale = adapter.enums.enum__locales('_locale').notNull()\n baseExtraConfig._localeIdx = (cols) =>\n index(`${arrayTableName}_locale_idx`).on(cols._locale)\n }\n\n const {\n hasManyNumberField: subHasManyNumberField,\n hasManyTextField: subHasManyTextField,\n relationsToBuild: subRelationsToBuild,\n } = buildTable({\n adapter,\n baseColumns,\n baseExtraConfig,\n disableNotNull: disableNotNullFromHere,\n disableUnique,\n fields: disableUnique ? idToUUID(field.fields) : field.fields,\n rootRelationsToBuild,\n rootRelationships: relationships,\n rootTableIDColType,\n rootTableName,\n tableName: arrayTableName,\n versions,\n })\n\n if (subHasManyTextField) {\n if (!hasManyTextField || subHasManyTextField === 'index')\n hasManyTextField = subHasManyTextField\n }\n if (subHasManyNumberField) {\n if (!hasManyNumberField || subHasManyNumberField === 'index')\n hasManyNumberField = subHasManyNumberField\n }\n\n relationsToBuild.set(fieldName, arrayTableName)\n\n const arrayTableRelations = relations(adapter.tables[arrayTableName], ({ many, one }) => {\n const result: Record<string, Relation<string>> = {\n _parentID: one(adapter.tables[parentTableName], {\n fields: [adapter.tables[arrayTableName]._parentID],\n references: [adapter.tables[parentTableName].id],\n }),\n }\n\n if (hasLocalesTable(field.fields)) {\n result._locales = many(adapter.tables[`${arrayTableName}${adapter.localesSuffix}`])\n }\n\n subRelationsToBuild.forEach((val, key) => {\n result[key] = many(adapter.tables[val])\n })\n\n return result\n })\n\n adapter.relations[`relations_${arrayTableName}`] = arrayTableRelations\n\n break\n }\n\n case 'blocks': {\n const disableNotNullFromHere = Boolean(field.admin?.condition) || disableNotNull\n\n field.blocks.forEach((block) => {\n const blockTableName = getTableName({\n adapter,\n config: block,\n parentTableName: rootTableName,\n prefix: `${rootTableName}_blocks_`,\n throwValidationError,\n })\n if (!adapter.tables[blockTableName]) {\n const baseColumns: Record<string, PgColumnBuilder> = {\n _order: integer('_order').notNull(),\n _parentID: parentIDColumnMap[rootTableIDColType]('_parent_id')\n .references(() => adapter.tables[rootTableName].id, { onDelete: 'cascade' })\n .notNull(),\n _path: text('_path').notNull(),\n }\n\n const baseExtraConfig: Record<\n string,\n (cols: GenericColumns) => IndexBuilder | UniqueConstraintBuilder\n > = {\n _orderIdx: (cols) => index(`${blockTableName}_order_idx`).on(cols._order),\n _parentIDIdx: (cols) => index(`${blockTableName}_parent_id_idx`).on(cols._parentID),\n _pathIdx: (cols) => index(`${blockTableName}_path_idx`).on(cols._path),\n }\n\n if (field.localized && adapter.payload.config.localization) {\n baseColumns._locale = adapter.enums.enum__locales('_locale').notNull()\n baseExtraConfig._localeIdx = (cols) =>\n index(`${blockTableName}_locale_idx`).on(cols._locale)\n }\n\n const {\n hasManyNumberField: subHasManyNumberField,\n hasManyTextField: subHasManyTextField,\n relationsToBuild: subRelationsToBuild,\n } = buildTable({\n adapter,\n baseColumns,\n baseExtraConfig,\n disableNotNull: disableNotNullFromHere,\n disableUnique,\n fields: disableUnique ? idToUUID(block.fields) : block.fields,\n rootRelationsToBuild,\n rootRelationships: relationships,\n rootTableIDColType,\n rootTableName,\n tableName: blockTableName,\n versions,\n })\n\n if (subHasManyTextField) {\n if (!hasManyTextField || subHasManyTextField === 'index')\n hasManyTextField = subHasManyTextField\n }\n\n if (subHasManyNumberField) {\n if (!hasManyNumberField || subHasManyNumberField === 'index')\n hasManyNumberField = subHasManyNumberField\n }\n\n const blockTableRelations = relations(\n adapter.tables[blockTableName],\n ({ many, one }) => {\n const result: Record<string, Relation<string>> = {\n _parentID: one(adapter.tables[rootTableName], {\n fields: [adapter.tables[blockTableName]._parentID],\n references: [adapter.tables[rootTableName].id],\n }),\n }\n\n if (hasLocalesTable(block.fields)) {\n result._locales = many(\n adapter.tables[`${blockTableName}${adapter.localesSuffix}`],\n )\n }\n\n subRelationsToBuild.forEach((val, key) => {\n result[key] = many(adapter.tables[val])\n })\n\n return result\n },\n )\n\n adapter.relations[`relations_${blockTableName}`] = blockTableRelations\n } else if (process.env.NODE_ENV !== 'production' && !versions) {\n validateExistingBlockIsIdentical({\n block,\n localized: field.localized,\n rootTableName,\n table: adapter.tables[blockTableName],\n tableLocales: adapter.tables[`${blockTableName}${adapter.localesSuffix}`],\n })\n }\n adapter.blockTableNames[`${rootTableName}.${toSnakeCase(block.slug)}`] = blockTableName\n rootRelationsToBuild.set(`_blocks_${block.slug}`, blockTableName)\n })\n\n break\n }\n\n case 'tab':\n case 'group': {\n if (!('name' in field)) {\n const {\n hasLocalizedField: groupHasLocalizedField,\n hasLocalizedManyNumberField: groupHasLocalizedManyNumberField,\n hasLocalizedManyTextField: groupHasLocalizedManyTextField,\n hasLocalizedRelationshipField: groupHasLocalizedRelationshipField,\n hasManyNumberField: groupHasManyNumberField,\n hasManyTextField: groupHasManyTextField,\n } = traverseFields({\n adapter,\n buildNumbers,\n buildRelationships,\n buildTexts,\n columnPrefix,\n columns,\n disableNotNull,\n disableUnique,\n fieldPrefix,\n fields: field.fields,\n forceLocalized,\n indexes,\n localesColumns,\n localesIndexes,\n newTableName,\n parentTableName,\n relationsToBuild,\n relationships,\n rootRelationsToBuild,\n rootTableIDColType,\n rootTableName,\n versions,\n })\n\n if (groupHasLocalizedField) hasLocalizedField = true\n if (groupHasLocalizedRelationshipField) hasLocalizedRelationshipField = true\n if (groupHasManyTextField) hasManyTextField = true\n if (groupHasLocalizedManyTextField) hasLocalizedManyTextField = true\n if (groupHasManyNumberField) hasManyNumberField = true\n if (groupHasLocalizedManyNumberField) hasLocalizedManyNumberField = true\n break\n }\n\n const disableNotNullFromHere = Boolean(field.admin?.condition) || disableNotNull\n\n const {\n hasLocalizedField: groupHasLocalizedField,\n hasLocalizedManyNumberField: groupHasLocalizedManyNumberField,\n hasLocalizedManyTextField: groupHasLocalizedManyTextField,\n hasLocalizedRelationshipField: groupHasLocalizedRelationshipField,\n hasManyNumberField: groupHasManyNumberField,\n hasManyTextField: groupHasManyTextField,\n } = traverseFields({\n adapter,\n buildNumbers,\n buildRelationships,\n buildTexts,\n columnPrefix: `${columnName}_`,\n columns,\n disableNotNull: disableNotNullFromHere,\n disableUnique,\n fieldPrefix: `${fieldName}.`,\n fields: field.fields,\n forceLocalized: field.localized,\n indexes,\n localesColumns,\n localesIndexes,\n newTableName: `${parentTableName}_${columnName}`,\n parentTableName,\n relationsToBuild,\n relationships,\n rootRelationsToBuild,\n rootTableIDColType,\n rootTableName,\n versions,\n })\n\n if (groupHasLocalizedField) hasLocalizedField = true\n if (groupHasLocalizedRelationshipField) hasLocalizedRelationshipField = true\n if (groupHasManyTextField) hasManyTextField = true\n if (groupHasLocalizedManyTextField) hasLocalizedManyTextField = true\n if (groupHasManyNumberField) hasManyNumberField = true\n if (groupHasLocalizedManyNumberField) hasLocalizedManyNumberField = true\n break\n }\n\n case 'tabs': {\n const disableNotNullFromHere = Boolean(field.admin?.condition) || disableNotNull\n\n const {\n hasLocalizedField: tabHasLocalizedField,\n hasLocalizedManyNumberField: tabHasLocalizedManyNumberField,\n hasLocalizedManyTextField: tabHasLocalizedManyTextField,\n hasLocalizedRelationshipField: tabHasLocalizedRelationshipField,\n hasManyNumberField: tabHasManyNumberField,\n hasManyTextField: tabHasManyTextField,\n } = traverseFields({\n adapter,\n buildNumbers,\n buildRelationships,\n buildTexts,\n columnPrefix,\n columns,\n disableNotNull: disableNotNullFromHere,\n disableUnique,\n fieldPrefix,\n fields: field.tabs.map((tab) => ({ ...tab, type: 'tab' })),\n forceLocalized,\n indexes,\n localesColumns,\n localesIndexes,\n newTableName,\n parentTableName,\n relationsToBuild,\n relationships,\n rootRelationsToBuild,\n rootTableIDColType,\n rootTableName,\n versions,\n })\n\n if (tabHasLocalizedField) hasLocalizedField = true\n if (tabHasLocalizedRelationshipField) hasLocalizedRelationshipField = true\n if (tabHasManyTextField) hasManyTextField = true\n if (tabHasLocalizedManyTextField) hasLocalizedManyTextField = true\n if (tabHasManyNumberField) hasManyNumberField = true\n if (tabHasLocalizedManyNumberField) hasLocalizedManyNumberField = true\n break\n }\n\n case 'row':\n case 'collapsible': {\n const disableNotNullFromHere = Boolean(field.admin?.condition) || disableNotNull\n const {\n hasLocalizedField: rowHasLocalizedField,\n hasLocalizedManyNumberField: rowHasLocalizedManyNumberField,\n hasLocalizedManyTextField: rowHasLocalizedManyTextField,\n hasLocalizedRelationshipField: rowHasLocalizedRelationshipField,\n hasManyNumberField: rowHasManyNumberField,\n hasManyTextField: rowHasManyTextField,\n } = traverseFields({\n adapter,\n buildNumbers,\n buildRelationships,\n buildTexts,\n columnPrefix,\n columns,\n disableNotNull: disableNotNullFromHere,\n disableUnique,\n fieldPrefix,\n fields: field.fields,\n forceLocalized,\n indexes,\n localesColumns,\n localesIndexes,\n newTableName,\n parentTableName,\n relationsToBuild,\n relationships,\n rootRelationsToBuild,\n rootTableIDColType,\n rootTableName,\n versions,\n })\n\n if (rowHasLocalizedField) hasLocalizedField = true\n if (rowHasLocalizedRelationshipField) hasLocalizedRelationshipField = true\n if (rowHasManyTextField) hasManyTextField = true\n if (rowHasLocalizedManyTextField) hasLocalizedManyTextField = true\n if (rowHasManyNumberField) hasManyNumberField = true\n if (rowHasLocalizedManyNumberField) hasLocalizedManyNumberField = true\n break\n }\n\n case 'relationship':\n case 'upload':\n if (Array.isArray(field.relationTo)) {\n field.relationTo.forEach((relation) => relationships.add(relation))\n } else {\n relationships.add(field.relationTo)\n }\n\n if (field.localized && adapter.payload.config.localization) {\n hasLocalizedRelationshipField = true\n }\n break\n\n default:\n break\n }\n\n const condition = field.admin && field.admin.condition\n\n if (\n !disableNotNull &&\n targetTable[fieldName] &&\n 'required' in field &&\n field.required &&\n !condition\n ) {\n targetTable[fieldName].notNull()\n }\n })\n\n return {\n hasLocalizedField,\n hasLocalizedManyNumberField,\n hasLocalizedManyTextField,\n hasLocalizedRelationshipField,\n hasManyNumberField,\n hasManyTextField,\n }\n}\n"],"names":["relations","PgNumericBuilder","PgUUIDBuilder","PgVarcharBuilder","boolean","index","integer","jsonb","numeric","pgEnum","text","timestamp","varchar","InvalidConfiguration","fieldAffectsData","optionIsObject","toSnakeCase","hasLocalesTable","buildTable","createIndex","getTableName","idToUUID","parentIDColumnMap","validateExistingBlockIsIdentical","traverseFields","adapter","buildNumbers","buildRelationships","buildTexts","columnPrefix","columns","disableNotNull","disableUnique","fieldPrefix","fields","forceLocalized","indexes","localesColumns","localesIndexes","newTableName","parentTableName","relationsToBuild","relationships","rootRelationsToBuild","rootTableIDColType","rootTableName","versions","throwValidationError","hasLocalizedField","hasLocalizedRelationshipField","hasManyTextField","hasLocalizedManyTextField","hasManyNumberField","hasLocalizedManyNumberField","parentIDColType","id","forEach","field","name","columnName","fieldName","targetTable","targetIndexes","replace","payload","config","localization","localized","unique","includes","type","hasMany","constraintValue","fieldConstraints","tableName","mode","precision","withTimezone","enumName","prefix","target","enums","options","map","option","value","selectTableName","baseColumns","order","notNull","parent","references","tables","onDelete","baseExtraConfig","orderIdx","cols","on","parentIdx","locale","enum__locales","localeIdx","set","selectTableRelations","one","result","disableNotNullFromHere","Boolean","admin","condition","arrayTableName","_order","_parentID","_orderIdx","_parentIDIdx","_locale","_localeIdx","subHasManyNumberField","subHasManyTextField","subRelationsToBuild","rootRelationships","arrayTableRelations","many","_locales","localesSuffix","val","key","blocks","block","blockTableName","_path","_pathIdx","blockTableRelations","process","env","NODE_ENV","table","tableLocales","blockTableNames","slug","groupHasLocalizedField","groupHasLocalizedManyNumberField","groupHasLocalizedManyTextField","groupHasLocalizedRelationshipField","groupHasManyNumberField","groupHasManyTextField","tabHasLocalizedField","tabHasLocalizedManyNumberField","tabHasLocalizedManyTextField","tabHasLocalizedRelationshipField","tabHasManyNumberField","tabHasManyTextField","tabs","tab","rowHasLocalizedField","rowHasLocalizedManyNumberField","rowHasLocalizedManyTextField","rowHasLocalizedRelationshipField","rowHasManyNumberField","rowHasManyTextField","Array","isArray","relationTo","relation","add","required"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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G,MAAMyG,UAAU;gBACpC;gBAEA,IAAIzG,MAAMU,SAAS,IAAI1C,QAAQuC,OAAO,CAACC,MAAM,CAACC,YAAY,EAAE;oBAC1DjB,gCAAgC;gBAClC;gBACA;YAEF;gBACE;QACJ;QAEA,MAAM4D,YAAYpD,MAAMmD,KAAK,IAAInD,MAAMmD,KAAK,CAACC,SAAS;QAEtD,IACE,CAAC9E,kBACD8B,WAAW,CAACD,UAAU,IACtB,cAAcH,SACdA,MAAM4G,QAAQ,IACd,CAACxD,WACD;YACAhD,WAAW,CAACD,UAAU,CAAC6B,OAAO;QAChC;IACF;IAEA,OAAO;QACLzC;QACAK;QACAF;QACAF;QACAG;QACAF;IACF;AACF,EAAC"}
|
@@ -1,12 +0,0 @@
|
|
1
|
-
import type { Block } from 'payload/types';
|
2
|
-
import type { GenericTable } from '../types.js';
|
3
|
-
type Args = {
|
4
|
-
block: Block;
|
5
|
-
localized: boolean;
|
6
|
-
rootTableName: string;
|
7
|
-
table: GenericTable;
|
8
|
-
tableLocales?: GenericTable;
|
9
|
-
};
|
10
|
-
export declare const validateExistingBlockIsIdentical: ({ block, localized, rootTableName, table, tableLocales, }: Args) => void;
|
11
|
-
export {};
|
12
|
-
//# sourceMappingURL=validateExistingBlockIsIdentical.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"validateExistingBlockIsIdentical.d.ts","sourceRoot":"","sources":["../../src/schema/validateExistingBlockIsIdentical.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAS,MAAM,eAAe,CAAA;AAKjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE/C,KAAK,IAAI,GAAG;IACV,KAAK,EAAE,KAAK,CAAA;IACZ,SAAS,EAAE,OAAO,CAAA;IAClB,aAAa,EAAE,MAAM,CAAA;IACrB,KAAK,EAAE,YAAY,CAAA;IACnB,YAAY,CAAC,EAAE,YAAY,CAAA;CAC5B,CAAA;AAkDD,eAAO,MAAM,gCAAgC,8DAM1C,IAAI,KAAG,IA+BT,CAAA"}
|