@payloadcms/drizzle 4.0.0-internal.e55ccef → 4.0.0-internal.ea6e8f8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/count.d.ts.map +1 -1
- package/dist/count.js +25 -3
- package/dist/count.js.map +1 -1
- package/dist/countVersions.d.ts.map +1 -1
- package/dist/countVersions.js +28 -4
- package/dist/countVersions.js.map +1 -1
- package/dist/createGlobalVersion.d.ts.map +1 -1
- package/dist/createGlobalVersion.js +15 -2
- package/dist/createGlobalVersion.js.map +1 -1
- package/dist/createTableName.d.ts.map +1 -1
- package/dist/createTableName.js +2 -7
- package/dist/createTableName.js.map +1 -1
- package/dist/createVersion.d.ts.map +1 -1
- package/dist/createVersion.js +12 -1
- package/dist/createVersion.js.map +1 -1
- package/dist/deleteBranchGlobal.d.ts +10 -0
- package/dist/deleteBranchGlobal.d.ts.map +1 -0
- package/dist/deleteBranchGlobal.js +27 -0
- package/dist/deleteBranchGlobal.js.map +1 -0
- package/dist/deleteOne.d.ts.map +1 -1
- package/dist/deleteOne.js +18 -1
- package/dist/deleteOne.js.map +1 -1
- package/dist/exports/postgres.d.ts +3 -0
- package/dist/exports/postgres.d.ts.map +1 -1
- package/dist/exports/postgres.js +3 -0
- package/dist/exports/postgres.js.map +1 -1
- package/dist/exports/sqlite.d.ts +1 -0
- package/dist/exports/sqlite.d.ts.map +1 -1
- package/dist/exports/sqlite.js +1 -0
- package/dist/exports/sqlite.js.map +1 -1
- package/dist/find/buildFindManyArgs.d.ts +3 -2
- package/dist/find/buildFindManyArgs.d.ts.map +1 -1
- package/dist/find/buildFindManyArgs.js +2 -1
- package/dist/find/buildFindManyArgs.js.map +1 -1
- package/dist/find/buildPolymorphicJoinQuery.d.ts +39 -0
- package/dist/find/buildPolymorphicJoinQuery.d.ts.map +1 -0
- package/dist/find/buildPolymorphicJoinQuery.js +152 -0
- package/dist/find/buildPolymorphicJoinQuery.js.map +1 -0
- package/dist/find/buildPolymorphicJoinWhere.d.ts +20 -0
- package/dist/find/buildPolymorphicJoinWhere.d.ts.map +1 -0
- package/dist/find/buildPolymorphicJoinWhere.js +301 -0
- package/dist/find/buildPolymorphicJoinWhere.js.map +1 -0
- package/dist/find/createPolymorphicJoinWherePlan.d.ts +37 -0
- package/dist/find/createPolymorphicJoinWherePlan.d.ts.map +1 -0
- package/dist/find/createPolymorphicJoinWherePlan.js +191 -0
- package/dist/find/createPolymorphicJoinWherePlan.js.map +1 -0
- package/dist/find/findMany.d.ts +6 -1
- package/dist/find/findMany.d.ts.map +1 -1
- package/dist/find/findMany.js +16 -3
- package/dist/find/findMany.js.map +1 -1
- package/dist/find/traverseFields.d.ts +3 -2
- package/dist/find/traverseFields.d.ts.map +1 -1
- package/dist/find/traverseFields.js +72 -197
- package/dist/find/traverseFields.js.map +1 -1
- package/dist/find.d.ts.map +1 -1
- package/dist/find.js +32 -4
- package/dist/find.js.map +1 -1
- package/dist/findDistinct.d.ts.map +1 -1
- package/dist/findDistinct.js +107 -8
- package/dist/findDistinct.js.map +1 -1
- package/dist/findGlobal.d.ts.map +1 -1
- package/dist/findGlobal.js +22 -5
- package/dist/findGlobal.js.map +1 -1
- package/dist/findGlobalVersions.js +8 -3
- package/dist/findGlobalVersions.js.map +1 -1
- package/dist/findOne.d.ts +1 -1
- package/dist/findOne.d.ts.map +1 -1
- package/dist/findOne.js +30 -3
- package/dist/findOne.js.map +1 -1
- package/dist/findVersions.d.ts.map +1 -1
- package/dist/findVersions.js +32 -5
- package/dist/findVersions.js.map +1 -1
- package/dist/index.d.ts +6 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/migrate.d.ts.map +1 -1
- package/dist/migrate.js +41 -15
- package/dist/migrate.js.map +1 -1
- package/dist/migrateDown.d.ts +2 -1
- package/dist/migrateDown.d.ts.map +1 -1
- package/dist/migrateDown.js +17 -4
- package/dist/migrateDown.js.map +1 -1
- package/dist/migrateFresh.d.ts +4 -2
- package/dist/migrateFresh.d.ts.map +1 -1
- package/dist/migrateFresh.js +26 -9
- package/dist/migrateFresh.js.map +1 -1
- package/dist/migrateRefresh.d.ts +2 -1
- package/dist/migrateRefresh.d.ts.map +1 -1
- package/dist/migrateRefresh.js +20 -5
- package/dist/migrateRefresh.js.map +1 -1
- package/dist/migrateReset.d.ts +2 -1
- package/dist/migrateReset.d.ts.map +1 -1
- package/dist/migrateReset.js +18 -4
- package/dist/migrateReset.js.map +1 -1
- package/dist/migrateStatus.d.ts +2 -1
- package/dist/migrateStatus.d.ts.map +1 -1
- package/dist/migrateStatus.js +11 -6
- package/dist/migrateStatus.js.map +1 -1
- package/dist/postgres/createJSONQuery/index.js +3 -3
- package/dist/postgres/createJSONQuery/index.js.map +1 -1
- package/dist/postgres/init.d.ts.map +1 -1
- package/dist/postgres/init.js +6 -0
- package/dist/postgres/init.js.map +1 -1
- package/dist/postgres/insert.d.ts.map +1 -1
- package/dist/postgres/insert.js +4 -2
- package/dist/postgres/insert.js.map +1 -1
- package/dist/postgres/predefinedMigrations/sizes-to-variants/index.d.ts +35 -0
- package/dist/postgres/predefinedMigrations/sizes-to-variants/index.d.ts.map +1 -0
- package/dist/postgres/predefinedMigrations/sizes-to-variants/index.js +185 -0
- package/dist/postgres/predefinedMigrations/sizes-to-variants/index.js.map +1 -0
- package/dist/postgres/predefinedMigrations/v2-v3/fetchAndResave/index.d.ts.map +1 -1
- package/dist/postgres/predefinedMigrations/v2-v3/fetchAndResave/index.js +8 -4
- package/dist/postgres/predefinedMigrations/v2-v3/fetchAndResave/index.js.map +1 -1
- package/dist/postgres/predefinedMigrations/v2-v3/index.js +1 -1
- package/dist/postgres/predefinedMigrations/v2-v3/index.js.map +1 -1
- package/dist/postgres/query/assertOperatorHandlerExtensionsInstalled.d.ts +15 -0
- package/dist/postgres/query/assertOperatorHandlerExtensionsInstalled.d.ts.map +1 -0
- package/dist/postgres/query/assertOperatorHandlerExtensionsInstalled.js +25 -0
- package/dist/postgres/query/assertOperatorHandlerExtensionsInstalled.js.map +1 -0
- package/dist/postgres/query/postgresUnaccent.d.ts +13 -0
- package/dist/postgres/query/postgresUnaccent.d.ts.map +1 -0
- package/dist/postgres/query/postgresUnaccent.js +40 -0
- package/dist/postgres/query/postgresUnaccent.js.map +1 -0
- package/dist/postgres/types.d.ts +17 -2
- package/dist/postgres/types.d.ts.map +1 -1
- package/dist/postgres/types.js.map +1 -1
- package/dist/queries/buildAndOrConditions.d.ts +3 -2
- package/dist/queries/buildAndOrConditions.d.ts.map +1 -1
- package/dist/queries/buildAndOrConditions.js +2 -1
- package/dist/queries/buildAndOrConditions.js.map +1 -1
- package/dist/queries/buildBranchVisibility.d.ts +11 -0
- package/dist/queries/buildBranchVisibility.d.ts.map +1 -0
- package/dist/queries/buildBranchVisibility.js +48 -0
- package/dist/queries/buildBranchVisibility.js.map +1 -0
- package/dist/queries/buildOperatorConstraint.d.ts +22 -0
- package/dist/queries/buildOperatorConstraint.d.ts.map +1 -0
- package/dist/queries/buildOperatorConstraint.js +63 -0
- package/dist/queries/buildOperatorConstraint.js.map +1 -0
- package/dist/queries/buildOrderBy.d.ts +3 -2
- package/dist/queries/buildOrderBy.d.ts.map +1 -1
- package/dist/queries/buildOrderBy.js +2 -1
- package/dist/queries/buildOrderBy.js.map +1 -1
- package/dist/queries/buildQuery.d.ts +3 -2
- package/dist/queries/buildQuery.d.ts.map +1 -1
- package/dist/queries/buildQuery.js +4 -2
- package/dist/queries/buildQuery.js.map +1 -1
- package/dist/queries/getTableColumnFromPath.d.ts +15 -5
- package/dist/queries/getTableColumnFromPath.d.ts.map +1 -1
- package/dist/queries/getTableColumnFromPath.js +225 -54
- package/dist/queries/getTableColumnFromPath.js.map +1 -1
- package/dist/queries/operatorMap.d.ts +7 -3
- package/dist/queries/operatorMap.d.ts.map +1 -1
- package/dist/queries/operatorMap.js.map +1 -1
- package/dist/queries/parseParams.d.ts +3 -2
- package/dist/queries/parseParams.d.ts.map +1 -1
- package/dist/queries/parseParams.js +266 -11
- package/dist/queries/parseParams.js.map +1 -1
- package/dist/queries/resolveRelationshipPath.d.ts +36 -0
- package/dist/queries/resolveRelationshipPath.d.ts.map +1 -0
- package/dist/queries/resolveRelationshipPath.js +66 -0
- package/dist/queries/resolveRelationshipPath.js.map +1 -0
- package/dist/queries/validateOperatorHandlers.d.ts +8 -0
- package/dist/queries/validateOperatorHandlers.d.ts.map +1 -0
- package/dist/queries/validateOperatorHandlers.js +30 -0
- package/dist/queries/validateOperatorHandlers.js.map +1 -0
- package/dist/queryDrafts.d.ts.map +1 -1
- package/dist/queryDrafts.js +23 -4
- package/dist/queryDrafts.js.map +1 -1
- package/dist/schema/build.d.ts.map +1 -1
- package/dist/schema/build.js +20 -17
- package/dist/schema/build.js.map +1 -1
- package/dist/schema/traverseFields.js +5 -5
- package/dist/schema/traverseFields.js.map +1 -1
- package/dist/sqlite/createJSONQuery/convertPathToJSONTraversal.js +3 -2
- package/dist/sqlite/createJSONQuery/convertPathToJSONTraversal.js.map +1 -1
- package/dist/sqlite/createJSONQuery/index.d.ts.map +1 -1
- package/dist/sqlite/createJSONQuery/index.js +6 -5
- package/dist/sqlite/createJSONQuery/index.js.map +1 -1
- package/dist/sqlite/insert.d.ts.map +1 -1
- package/dist/sqlite/insert.js +9 -4
- package/dist/sqlite/insert.js.map +1 -1
- package/dist/sqlite/predefinedMigrations/sizes-to-variants/index.d.ts +15 -0
- package/dist/sqlite/predefinedMigrations/sizes-to-variants/index.d.ts.map +1 -0
- package/dist/sqlite/predefinedMigrations/sizes-to-variants/index.js +114 -0
- package/dist/sqlite/predefinedMigrations/sizes-to-variants/index.js.map +1 -0
- package/dist/sqlite/types.d.ts +4 -0
- package/dist/sqlite/types.d.ts.map +1 -1
- package/dist/sqlite/types.js.map +1 -1
- package/dist/transactions/beginTransaction.d.ts.map +1 -1
- package/dist/transactions/beginTransaction.js +13 -5
- package/dist/transactions/beginTransaction.js.map +1 -1
- package/dist/transactions/commitTransaction.d.ts.map +1 -1
- package/dist/transactions/commitTransaction.js +1 -5
- package/dist/transactions/commitTransaction.js.map +1 -1
- package/dist/transform/write/array.d.ts +3 -2
- package/dist/transform/write/array.d.ts.map +1 -1
- package/dist/transform/write/array.js +2 -1
- package/dist/transform/write/array.js.map +1 -1
- package/dist/transform/write/blocks.d.ts +3 -2
- package/dist/transform/write/blocks.d.ts.map +1 -1
- package/dist/transform/write/blocks.js +2 -1
- package/dist/transform/write/blocks.js.map +1 -1
- package/dist/transform/write/index.d.ts.map +1 -1
- package/dist/transform/write/index.js +2 -0
- package/dist/transform/write/index.js.map +1 -1
- package/dist/transform/write/traverseFields.d.ts +2 -1
- package/dist/transform/write/traverseFields.d.ts.map +1 -1
- package/dist/transform/write/traverseFields.js +40 -20
- package/dist/transform/write/traverseFields.js.map +1 -1
- package/dist/transform/write/types.d.ts +7 -0
- package/dist/transform/write/types.d.ts.map +1 -1
- package/dist/transform/write/types.js.map +1 -1
- package/dist/types.d.ts +51 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/updateGlobal.d.ts +5 -1
- package/dist/updateGlobal.d.ts.map +1 -1
- package/dist/updateGlobal.js +96 -4
- package/dist/updateGlobal.js.map +1 -1
- package/dist/updateJobs.d.ts.map +1 -1
- package/dist/updateJobs.js +37 -0
- package/dist/updateJobs.js.map +1 -1
- package/dist/updateOne.d.ts.map +1 -1
- package/dist/updateOne.js +86 -4
- package/dist/updateOne.js.map +1 -1
- package/dist/upsertBranchGlobalChange.d.ts +3 -0
- package/dist/upsertBranchGlobalChange.d.ts.map +1 -0
- package/dist/upsertBranchGlobalChange.js +35 -0
- package/dist/upsertBranchGlobalChange.js.map +1 -0
- package/dist/upsertRow/deleteExistingRowsByPath.d.ts.map +1 -1
- package/dist/upsertRow/deleteExistingRowsByPath.js +17 -12
- package/dist/upsertRow/deleteExistingRowsByPath.js.map +1 -1
- package/dist/upsertRow/index.d.ts +1 -1
- package/dist/upsertRow/index.d.ts.map +1 -1
- package/dist/upsertRow/index.js +156 -46
- package/dist/upsertRow/index.js.map +1 -1
- package/dist/upsertRow/types.d.ts +3 -0
- package/dist/upsertRow/types.d.ts.map +1 -1
- package/dist/upsertRow/types.js.map +1 -1
- package/dist/utilities/buildCreateMigration.d.ts.map +1 -1
- package/dist/utilities/buildCreateMigration.js +12 -8
- package/dist/utilities/buildCreateMigration.js.map +1 -1
- package/dist/utilities/buildDynamicPredefinedSizesToVariantsMigration.d.ts +15 -0
- package/dist/utilities/buildDynamicPredefinedSizesToVariantsMigration.d.ts.map +1 -0
- package/dist/utilities/buildDynamicPredefinedSizesToVariantsMigration.js +110 -0
- package/dist/utilities/buildDynamicPredefinedSizesToVariantsMigration.js.map +1 -0
- package/dist/utilities/buildForeignKeyName.d.ts.map +1 -1
- package/dist/utilities/buildForeignKeyName.js +3 -2
- package/dist/utilities/buildForeignKeyName.js.map +1 -1
- package/dist/utilities/buildIndexName.d.ts.map +1 -1
- package/dist/utilities/buildIndexName.js +3 -2
- package/dist/utilities/buildIndexName.js.map +1 -1
- package/dist/utilities/checkTruncatedIdentifiers.d.ts +13 -0
- package/dist/utilities/checkTruncatedIdentifiers.d.ts.map +1 -0
- package/dist/utilities/checkTruncatedIdentifiers.js +56 -0
- package/dist/utilities/checkTruncatedIdentifiers.js.map +1 -0
- package/dist/utilities/createSchemaGenerator.d.ts.map +1 -1
- package/dist/utilities/createSchemaGenerator.js +3 -0
- package/dist/utilities/createSchemaGenerator.js.map +1 -1
- package/dist/utilities/getSizesToVariantsRenames.d.ts +54 -0
- package/dist/utilities/getSizesToVariantsRenames.d.ts.map +1 -0
- package/dist/utilities/getSizesToVariantsRenames.js +251 -0
- package/dist/utilities/getSizesToVariantsRenames.js.map +1 -0
- package/dist/utilities/parseJSONPathSegment.d.ts +9 -0
- package/dist/utilities/parseJSONPathSegment.d.ts.map +1 -0
- package/dist/utilities/parseJSONPathSegment.js +17 -0
- package/dist/utilities/parseJSONPathSegment.js.map +1 -0
- package/dist/utilities/validateExistingBlockIsIdentical.d.ts +1 -5
- package/dist/utilities/validateExistingBlockIsIdentical.d.ts.map +1 -1
- package/dist/utilities/validateExistingBlockIsIdentical.js.map +1 -1
- package/dist/utilities/validateIdentifierLength.d.ts +12 -0
- package/dist/utilities/validateIdentifierLength.d.ts.map +1 -0
- package/dist/utilities/validateIdentifierLength.js +18 -0
- package/dist/utilities/validateIdentifierLength.js.map +1 -0
- package/package.json +3 -3
- package/dist/upsertRow/handleUpsertError.spec.js +0 -42
- package/dist/upsertRow/handleUpsertError.spec.js.map +0 -1
- package/dist/utilities/isValidStringID.spec.js +0 -15
- package/dist/utilities/isValidStringID.spec.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { and, eq, getTableName, like, sql } from 'drizzle-orm';
|
|
2
|
-
import { APIError, getFieldByPath } from 'payload';
|
|
1
|
+
import { and, eq, getTableName, isNull, like, notInArray, or, sql } from 'drizzle-orm';
|
|
2
|
+
import { APIError, getBranchPredicateSync, getFieldByPath, resolveBranchReadState } from 'payload';
|
|
3
3
|
import { fieldShouldBeLocalized, tabHasName } from 'payload/shared';
|
|
4
4
|
import toSnakeCase from 'to-snake-case';
|
|
5
5
|
import { validate as uuidValidate } from 'uuid';
|
|
@@ -9,20 +9,98 @@ import { jsonBuildObject } from '../utilities/json.js';
|
|
|
9
9
|
import { DistinctSymbol } from '../utilities/rawConstraint.js';
|
|
10
10
|
import { resolveBlockTableName } from '../utilities/validateExistingBlockIsIdentical.js';
|
|
11
11
|
import { addJoinTable } from './addJoinTable.js';
|
|
12
|
+
import { buildBranchVisibility } from './buildBranchVisibility.js';
|
|
12
13
|
import { getTableAlias } from './getTableAlias.js';
|
|
14
|
+
import { appendFieldToStoragePath, resolveRelationshipPath } from './resolveRelationshipPath.js';
|
|
15
|
+
const getRelationshipJoinCondition = ({ adapter, collectionSlug, relationshipID, req, table, value })=>{
|
|
16
|
+
const branchReadState = resolveBranchReadState({
|
|
17
|
+
collectionSlug,
|
|
18
|
+
req
|
|
19
|
+
});
|
|
20
|
+
const branchPredicate = branchReadState.useBranching ? null : getBranchPredicateSync({
|
|
21
|
+
collectionSlug,
|
|
22
|
+
req
|
|
23
|
+
});
|
|
24
|
+
const shouldMatchCanonicalID = Boolean(table._branchDocID && (branchReadState.useBranching || branchPredicate || value === DistinctSymbol));
|
|
25
|
+
const identityCondition = shouldMatchCanonicalID ? or(eq(table.id, relationshipID), eq(table._branchDocID, relationshipID)) : eq(table.id, relationshipID);
|
|
26
|
+
const branchCondition = getBranchTableCondition({
|
|
27
|
+
adapter,
|
|
28
|
+
collectionSlug,
|
|
29
|
+
req,
|
|
30
|
+
table
|
|
31
|
+
});
|
|
32
|
+
return branchCondition ? and(identityCondition, branchCondition) : identityCondition;
|
|
33
|
+
};
|
|
34
|
+
const getBranchTableCondition = ({ adapter, collectionSlug, req, table })=>{
|
|
35
|
+
const branchReadState = resolveBranchReadState({
|
|
36
|
+
collectionSlug,
|
|
37
|
+
req
|
|
38
|
+
});
|
|
39
|
+
if (branchReadState.useBranching) {
|
|
40
|
+
return buildBranchVisibility({
|
|
41
|
+
adapter,
|
|
42
|
+
branch: branchReadState.branch,
|
|
43
|
+
collectionSlug,
|
|
44
|
+
table
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
const branchPredicate = getBranchPredicateSync({
|
|
48
|
+
collectionSlug,
|
|
49
|
+
req
|
|
50
|
+
});
|
|
51
|
+
return branchPredicate ? buildBranchPredicateCondition({
|
|
52
|
+
table,
|
|
53
|
+
where: branchPredicate
|
|
54
|
+
}) : undefined;
|
|
55
|
+
};
|
|
56
|
+
const buildBranchPredicateCondition = ({ table, where })=>{
|
|
57
|
+
const conditions = [];
|
|
58
|
+
for (const [fieldName, condition] of Object.entries(where)){
|
|
59
|
+
if ((fieldName === 'and' || fieldName === 'or') && Array.isArray(condition)) {
|
|
60
|
+
const nestedConditions = condition.map((nestedWhere)=>buildBranchPredicateCondition({
|
|
61
|
+
table,
|
|
62
|
+
where: nestedWhere
|
|
63
|
+
})).filter((nestedCondition)=>Boolean(nestedCondition));
|
|
64
|
+
const nestedResult = fieldName === 'and' ? and(...nestedConditions) : or(...nestedConditions);
|
|
65
|
+
if (nestedResult) {
|
|
66
|
+
conditions.push(nestedResult);
|
|
67
|
+
}
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
const column = table[fieldName];
|
|
71
|
+
if (!column || !condition || typeof condition !== 'object') {
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
if ('equals' in condition) {
|
|
75
|
+
conditions.push(condition.equals === null ? isNull(column) : eq(column, condition.equals));
|
|
76
|
+
}
|
|
77
|
+
if ('not_in' in condition && Array.isArray(condition.not_in) && condition.not_in.length > 0) {
|
|
78
|
+
conditions.push(notInArray(column, condition.not_in));
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return conditions.length === 1 ? conditions[0] : and(...conditions);
|
|
82
|
+
};
|
|
13
83
|
/**
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
|
|
84
|
+
* Resolves a field path to the database table and column that store its value.
|
|
85
|
+
*
|
|
86
|
+
* While walking through relationships, arrays, and blocks, the function adds the joins required
|
|
87
|
+
* to reach the final column. Table aliases are used when the path is resolved inside a subquery.
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* Resolving `movies.name` adds joins from the parent collection to its relationship table and then
|
|
91
|
+
* to the `movies` table. The returned column is `movies.name`.
|
|
92
|
+
*
|
|
93
|
+
* @returns The final field and column, plus any extra constraints discovered while resolving it.
|
|
94
|
+
*/ export const getTableColumnFromPath = ({ adapter, aliasTable, collectionPath, columnPrefix = '', constraintPath: incomingConstraintPath, constraints = [], fields, joins, locale: incomingLocale, parentAliasTable, parentIsLocalized, pathSegments: incomingSegments, req, rootTableName: incomingRootTableName, selectFields, selectLocale, tableName, tableNameSuffix = '', value })=>{
|
|
18
95
|
const fieldPath = incomingSegments[0];
|
|
19
96
|
let locale = incomingLocale;
|
|
20
97
|
const rootTableName = incomingRootTableName || tableName;
|
|
98
|
+
const tableContainingField = parentAliasTable ?? aliasTable ?? adapter.tables[rootTableName];
|
|
21
99
|
let constraintPath = incomingConstraintPath || '';
|
|
22
100
|
const field = fields.find((fieldToFind)=>fieldToFind.name === fieldPath);
|
|
23
101
|
let newTableName = tableName;
|
|
24
102
|
if (!field && fieldPath === 'id') {
|
|
25
|
-
|
|
103
|
+
const idTable = aliasTable ?? adapter.tables[newTableName];
|
|
26
104
|
return {
|
|
27
105
|
columnName: 'id',
|
|
28
106
|
constraints,
|
|
@@ -30,7 +108,7 @@ import { getTableAlias } from './getTableAlias.js';
|
|
|
30
108
|
name: 'id',
|
|
31
109
|
type: isUUIDType(adapter.idType) ? 'text' : 'number'
|
|
32
110
|
},
|
|
33
|
-
table:
|
|
111
|
+
table: idTable
|
|
34
112
|
};
|
|
35
113
|
}
|
|
36
114
|
let localizedPathQuery = false;
|
|
@@ -38,6 +116,10 @@ import { getTableAlias } from './getTableAlias.js';
|
|
|
38
116
|
const pathSegments = [
|
|
39
117
|
...incomingSegments
|
|
40
118
|
];
|
|
119
|
+
const fieldStoragePath = appendFieldToStoragePath({
|
|
120
|
+
field,
|
|
121
|
+
path: constraintPath
|
|
122
|
+
});
|
|
41
123
|
const isFieldLocalized = fieldShouldBeLocalized({
|
|
42
124
|
field,
|
|
43
125
|
parentIsLocalized
|
|
@@ -57,7 +139,7 @@ import { getTableAlias } from './getTableAlias.js';
|
|
|
57
139
|
{
|
|
58
140
|
newTableName = adapter.tableNameMap.get(`${tableName}_${tableNameSuffix}${toSnakeCase(field.name)}`);
|
|
59
141
|
const arrayParentTable = aliasTable || adapter.tables[tableName];
|
|
60
|
-
constraintPath = `${
|
|
142
|
+
constraintPath = `${fieldStoragePath}.`;
|
|
61
143
|
if (locale && isFieldLocalized && adapter.payload.config.localization) {
|
|
62
144
|
const conditions = [
|
|
63
145
|
eq(arrayParentTable.id, adapter.tables[newTableName]._parentID)
|
|
@@ -93,6 +175,7 @@ import { getTableAlias } from './getTableAlias.js';
|
|
|
93
175
|
parentAliasTable: aliasTable,
|
|
94
176
|
parentIsLocalized: parentIsLocalized || field.localized,
|
|
95
177
|
pathSegments: pathSegments.slice(1),
|
|
178
|
+
req,
|
|
96
179
|
rootTableName,
|
|
97
180
|
selectFields,
|
|
98
181
|
selectLocale,
|
|
@@ -140,7 +223,6 @@ import { getTableAlias } from './getTableAlias.js';
|
|
|
140
223
|
const hasBlockField = field.blocks.some((_block)=>{
|
|
141
224
|
const block = typeof _block === 'string' ? adapter.payload.blocks[_block] : _block;
|
|
142
225
|
newTableName = resolveBlockTableName(block, adapter.tableNameMap.get(`${tableName}_blocks_${toSnakeCase(block.slug)}`));
|
|
143
|
-
constraintPath = `${constraintPath}${field.name}.%.`;
|
|
144
226
|
let result;
|
|
145
227
|
const blockConstraints = [];
|
|
146
228
|
const blockSelectFields = {};
|
|
@@ -170,13 +252,14 @@ import { getTableAlias } from './getTableAlias.js';
|
|
|
170
252
|
result = getTableColumnFromPath({
|
|
171
253
|
adapter,
|
|
172
254
|
collectionPath,
|
|
173
|
-
constraintPath
|
|
255
|
+
constraintPath: `${fieldStoragePath}.`,
|
|
174
256
|
constraints: blockConstraints,
|
|
175
257
|
fields: block.flattenedFields,
|
|
176
258
|
joins: newJoins,
|
|
177
259
|
locale,
|
|
178
260
|
parentIsLocalized: parentIsLocalized || field.localized,
|
|
179
261
|
pathSegments: pathSegments.slice(1),
|
|
262
|
+
req,
|
|
180
263
|
rootTableName,
|
|
181
264
|
selectFields: blockSelectFields,
|
|
182
265
|
selectLocale,
|
|
@@ -236,13 +319,14 @@ import { getTableAlias } from './getTableAlias.js';
|
|
|
236
319
|
aliasTable,
|
|
237
320
|
collectionPath,
|
|
238
321
|
columnPrefix: `${columnPrefix}${field.name}_`,
|
|
239
|
-
constraintPath: `${
|
|
322
|
+
constraintPath: `${fieldStoragePath}.`,
|
|
240
323
|
constraints,
|
|
241
324
|
fields: field.flattenedFields,
|
|
242
325
|
joins,
|
|
243
326
|
locale,
|
|
244
327
|
parentIsLocalized: parentIsLocalized || field.localized,
|
|
245
328
|
pathSegments: pathSegments.slice(1),
|
|
329
|
+
req,
|
|
246
330
|
rootTableName,
|
|
247
331
|
selectFields,
|
|
248
332
|
selectLocale,
|
|
@@ -257,6 +341,15 @@ import { getTableAlias } from './getTableAlias.js';
|
|
|
257
341
|
throw new APIError('Not supported');
|
|
258
342
|
}
|
|
259
343
|
const newCollectionPath = pathSegments.slice(1).join('.');
|
|
344
|
+
// Filtering through a polymorphic `on` relationship is not supported: it is stored in the
|
|
345
|
+
// `_rels` table with no direct column to correlate on, which would otherwise build invalid SQL.
|
|
346
|
+
const onRelationshipField = getFieldByPath({
|
|
347
|
+
fields: adapter.payload.collections[field.collection].config.flattenedFields,
|
|
348
|
+
path: field.on
|
|
349
|
+
})?.field;
|
|
350
|
+
if (onRelationshipField && (onRelationshipField.type === 'relationship' || onRelationshipField.type === 'upload') && Array.isArray(onRelationshipField.relationTo)) {
|
|
351
|
+
throw new APIError('Not supported');
|
|
352
|
+
}
|
|
260
353
|
if (field.hasMany) {
|
|
261
354
|
const relationTableName = `${adapter.tableNameMap.get(toSnakeCase(field.collection))}${adapter.relationshipsSuffix}`;
|
|
262
355
|
const existingTable = joins.find((e)=>e.queryPath === `${constraintPath}${field.name}._rels`);
|
|
@@ -273,7 +366,7 @@ import { getTableAlias } from './getTableAlias.js';
|
|
|
273
366
|
}
|
|
274
367
|
if (!existingTable) {
|
|
275
368
|
addJoinTable({
|
|
276
|
-
condition: and(eq(
|
|
369
|
+
condition: and(eq(tableContainingField.id, aliasRelationshipTable[`${relationshipField.field.relationTo}ID`]), like(aliasRelationshipTable.path, field.on)),
|
|
277
370
|
joins,
|
|
278
371
|
queryPath: `${constraintPath}${field.name}._rels`,
|
|
279
372
|
table: aliasRelationshipTable
|
|
@@ -300,8 +393,15 @@ import { getTableAlias } from './getTableAlias.js';
|
|
|
300
393
|
tableName: relationshipTableName
|
|
301
394
|
}).newAliasTable;
|
|
302
395
|
if (!existingMainTable) {
|
|
396
|
+
const branchCondition = getBranchTableCondition({
|
|
397
|
+
adapter,
|
|
398
|
+
collectionSlug: field.collection,
|
|
399
|
+
req,
|
|
400
|
+
table: relationshipTable
|
|
401
|
+
});
|
|
402
|
+
const relationshipCondition = eq(aliasRelationshipTable.parent, relationshipTable.id);
|
|
303
403
|
joins.push({
|
|
304
|
-
condition:
|
|
404
|
+
condition: branchCondition ? and(relationshipCondition, branchCondition) : relationshipCondition,
|
|
305
405
|
queryPath: `${constraintPath}${field.name}`,
|
|
306
406
|
table: relationshipTable
|
|
307
407
|
});
|
|
@@ -311,12 +411,13 @@ import { getTableAlias } from './getTableAlias.js';
|
|
|
311
411
|
aliasTable: relationshipTable,
|
|
312
412
|
collectionPath: newCollectionPath,
|
|
313
413
|
constraints,
|
|
314
|
-
// relationshipFields are fields from a different collection => no parentIsLocalized
|
|
315
414
|
fields: relationshipFields,
|
|
316
415
|
joins,
|
|
317
416
|
locale,
|
|
417
|
+
// A join reads from a different collection, so localization does not carry over
|
|
318
418
|
parentIsLocalized: false,
|
|
319
419
|
pathSegments: pathSegments.slice(1),
|
|
420
|
+
req,
|
|
320
421
|
rootTableName: relationshipTableName,
|
|
321
422
|
selectFields,
|
|
322
423
|
selectLocale,
|
|
@@ -347,13 +448,29 @@ import { getTableAlias } from './getTableAlias.js';
|
|
|
347
448
|
table: arrayAliasTable
|
|
348
449
|
});
|
|
349
450
|
joins.push({
|
|
350
|
-
condition:
|
|
451
|
+
condition: (()=>{
|
|
452
|
+
const relationshipCondition = eq(newAliasTable['id'], arrayAliasTable._parentID);
|
|
453
|
+
const branchCondition = getBranchTableCondition({
|
|
454
|
+
adapter,
|
|
455
|
+
collectionSlug: field.collection,
|
|
456
|
+
req,
|
|
457
|
+
table: newAliasTable
|
|
458
|
+
});
|
|
459
|
+
return branchCondition ? and(relationshipCondition, branchCondition) : relationshipCondition;
|
|
460
|
+
})(),
|
|
351
461
|
queryPath: `${constraintPath}${field.name}`,
|
|
352
462
|
table: newAliasTable
|
|
353
463
|
});
|
|
354
464
|
} else {
|
|
465
|
+
const relationshipCondition = eq(newAliasTable[field.on.replaceAll('.', '_')], aliasTable ? aliasTable.id : adapter.tables[tableName].id);
|
|
466
|
+
const branchCondition = getBranchTableCondition({
|
|
467
|
+
adapter,
|
|
468
|
+
collectionSlug: field.collection,
|
|
469
|
+
req,
|
|
470
|
+
table: newAliasTable
|
|
471
|
+
});
|
|
355
472
|
joins.push({
|
|
356
|
-
condition:
|
|
473
|
+
condition: branchCondition ? and(relationshipCondition, branchCondition) : relationshipCondition,
|
|
357
474
|
queryPath: `${constraintPath}${field.name}`,
|
|
358
475
|
table: newAliasTable
|
|
359
476
|
});
|
|
@@ -379,8 +496,10 @@ import { getTableAlias } from './getTableAlias.js';
|
|
|
379
496
|
fields: adapter.payload.collections[field.collection].config.flattenedFields,
|
|
380
497
|
joins,
|
|
381
498
|
locale,
|
|
382
|
-
|
|
499
|
+
// A join reads from a different collection, so localization does not carry over
|
|
500
|
+
parentIsLocalized: false,
|
|
383
501
|
pathSegments: pathSegments.slice(1),
|
|
502
|
+
req,
|
|
384
503
|
selectFields,
|
|
385
504
|
tableName: newTableName,
|
|
386
505
|
value
|
|
@@ -398,14 +517,14 @@ import { getTableAlias } from './getTableAlias.js';
|
|
|
398
517
|
columnName = 'number';
|
|
399
518
|
}
|
|
400
519
|
newTableName = `${rootTableName}_${tableType}`;
|
|
401
|
-
const existingTable = joins.find((e)=>e.queryPath ===
|
|
520
|
+
const existingTable = joins.find((e)=>e.queryPath === fieldStoragePath);
|
|
402
521
|
const table = existingTable?.table ?? getTableAlias({
|
|
403
522
|
adapter,
|
|
404
523
|
tableName: newTableName
|
|
405
524
|
}).newAliasTable;
|
|
406
525
|
const joinConstraints = [
|
|
407
|
-
eq(
|
|
408
|
-
like(table.path,
|
|
526
|
+
eq(tableContainingField.id, table.parent),
|
|
527
|
+
like(table.path, fieldStoragePath)
|
|
409
528
|
];
|
|
410
529
|
if (locale && isFieldLocalized && adapter.payload.config.localization) {
|
|
411
530
|
const conditions = [
|
|
@@ -417,14 +536,14 @@ import { getTableAlias } from './getTableAlias.js';
|
|
|
417
536
|
addJoinTable({
|
|
418
537
|
condition: and(...conditions),
|
|
419
538
|
joins,
|
|
420
|
-
queryPath:
|
|
539
|
+
queryPath: fieldStoragePath,
|
|
421
540
|
table
|
|
422
541
|
});
|
|
423
542
|
} else {
|
|
424
543
|
addJoinTable({
|
|
425
544
|
condition: and(...joinConstraints),
|
|
426
545
|
joins,
|
|
427
|
-
queryPath:
|
|
546
|
+
queryPath: fieldStoragePath,
|
|
428
547
|
table
|
|
429
548
|
});
|
|
430
549
|
}
|
|
@@ -441,10 +560,23 @@ import { getTableAlias } from './getTableAlias.js';
|
|
|
441
560
|
case 'upload':
|
|
442
561
|
{
|
|
443
562
|
const newCollectionPath = pathSegments.slice(1).join('.');
|
|
563
|
+
const relationshipQueryPath = `${getTableName(tableContainingField)}.${fieldStoragePath}._rels`;
|
|
564
|
+
const targetQueryPath = `${getTableName(tableContainingField)}.${fieldStoragePath}._target`;
|
|
444
565
|
if (Array.isArray(field.relationTo) || field.hasMany) {
|
|
566
|
+
const relationshipPath = resolveRelationshipPath({
|
|
567
|
+
adapter,
|
|
568
|
+
fields,
|
|
569
|
+
locale,
|
|
570
|
+
parentIsLocalized,
|
|
571
|
+
path: field.name,
|
|
572
|
+
pathPrefix: constraintPath
|
|
573
|
+
});
|
|
574
|
+
if (!relationshipPath) {
|
|
575
|
+
throw new APIError(`Relationship path could not be resolved: ${collectionPath}`);
|
|
576
|
+
}
|
|
445
577
|
let relationshipFields;
|
|
446
578
|
const relationTableName = `${rootTableName}${adapter.relationshipsSuffix}`;
|
|
447
|
-
const existingJoin = joins.find((e)=>e.queryPath ===
|
|
579
|
+
const existingJoin = joins.find((e)=>e.queryPath === relationshipQueryPath);
|
|
448
580
|
let aliasRelationshipTable;
|
|
449
581
|
let aliasRelationshipTableName;
|
|
450
582
|
if (existingJoin) {
|
|
@@ -458,30 +590,28 @@ import { getTableAlias } from './getTableAlias.js';
|
|
|
458
590
|
aliasRelationshipTable = res.newAliasTable;
|
|
459
591
|
aliasRelationshipTableName = res.newAliasTableName;
|
|
460
592
|
}
|
|
461
|
-
if (selectLocale &&
|
|
593
|
+
if (selectLocale && relationshipPath.isLocalized && adapter.payload.config.localization) {
|
|
462
594
|
selectFields._locale = aliasRelationshipTable.locale;
|
|
463
595
|
}
|
|
464
596
|
// Join in the relationships table
|
|
465
|
-
if (locale &&
|
|
597
|
+
if (relationshipPath.locale && relationshipPath.locale !== 'all' && relationshipPath.isLocalized && adapter.payload.config.localization) {
|
|
466
598
|
const conditions = [
|
|
467
|
-
eq(
|
|
468
|
-
like(aliasRelationshipTable.path,
|
|
599
|
+
eq(tableContainingField.id, aliasRelationshipTable.parent),
|
|
600
|
+
like(aliasRelationshipTable.path, relationshipPath.path)
|
|
469
601
|
];
|
|
470
|
-
|
|
471
|
-
conditions.push(eq(aliasRelationshipTable.locale, locale));
|
|
472
|
-
}
|
|
602
|
+
conditions.push(eq(aliasRelationshipTable.locale, relationshipPath.locale));
|
|
473
603
|
addJoinTable({
|
|
474
604
|
condition: and(...conditions),
|
|
475
605
|
joins,
|
|
476
|
-
queryPath:
|
|
606
|
+
queryPath: relationshipQueryPath,
|
|
477
607
|
table: aliasRelationshipTable
|
|
478
608
|
});
|
|
479
609
|
} else {
|
|
480
610
|
// Join in the relationships table
|
|
481
611
|
addJoinTable({
|
|
482
|
-
condition: and(eq(
|
|
612
|
+
condition: and(eq(tableContainingField.id, aliasRelationshipTable.parent), like(aliasRelationshipTable.path, relationshipPath.path)),
|
|
483
613
|
joins,
|
|
484
|
-
queryPath:
|
|
614
|
+
queryPath: relationshipQueryPath,
|
|
485
615
|
table: aliasRelationshipTable
|
|
486
616
|
});
|
|
487
617
|
}
|
|
@@ -492,15 +622,31 @@ import { getTableAlias } from './getTableAlias.js';
|
|
|
492
622
|
newTableName = adapter.tableNameMap.get(toSnakeCase(relationshipConfig.slug));
|
|
493
623
|
// parent to relationship join table
|
|
494
624
|
relationshipFields = relationshipConfig.flattenedFields;
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
}
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
625
|
+
const existingTargetJoin = joins.find((join)=>join.queryPath === targetQueryPath);
|
|
626
|
+
if (existingTargetJoin) {
|
|
627
|
+
newAliasTable = existingTargetJoin.table;
|
|
628
|
+
} else {
|
|
629
|
+
;
|
|
630
|
+
({ newAliasTable } = getTableAlias({
|
|
631
|
+
adapter,
|
|
632
|
+
tableName: newTableName
|
|
633
|
+
}));
|
|
634
|
+
const relationshipID = aliasRelationshipTable[`${field.relationTo}ID`];
|
|
635
|
+
const condition = getRelationshipJoinCondition({
|
|
636
|
+
adapter,
|
|
637
|
+
collectionSlug: field.relationTo,
|
|
638
|
+
relationshipID,
|
|
639
|
+
req,
|
|
640
|
+
table: newAliasTable,
|
|
641
|
+
value
|
|
642
|
+
});
|
|
643
|
+
joins.push({
|
|
644
|
+
condition,
|
|
645
|
+
queryPath: targetQueryPath,
|
|
646
|
+
table: newAliasTable
|
|
647
|
+
});
|
|
648
|
+
}
|
|
649
|
+
if (newCollectionPath === '' || newCollectionPath === 'id' && !existingTargetJoin) {
|
|
504
650
|
return {
|
|
505
651
|
columnName: `${field.relationTo}ID`,
|
|
506
652
|
constraints,
|
|
@@ -597,33 +743,35 @@ import { getTableAlias } from './getTableAlias.js';
|
|
|
597
743
|
aliasTable: newAliasTable,
|
|
598
744
|
collectionPath: newCollectionPath,
|
|
599
745
|
constraints,
|
|
600
|
-
// relationshipFields are fields from a different collection => no parentIsLocalized
|
|
601
746
|
fields: relationshipFields,
|
|
602
747
|
joins,
|
|
603
748
|
locale,
|
|
749
|
+
// A relationship jumps to a different collection, so localization does not carry over
|
|
604
750
|
parentIsLocalized: false,
|
|
605
751
|
pathSegments: pathSegments.slice(1),
|
|
752
|
+
req,
|
|
606
753
|
rootTableName: newTableName,
|
|
607
754
|
selectFields,
|
|
608
755
|
selectLocale,
|
|
609
756
|
tableName: newTableName,
|
|
610
757
|
value
|
|
611
758
|
});
|
|
612
|
-
} else if (pathSegments.length > 1 && !(pathSegments.length === 2 && pathSegments[1] === 'id')) {
|
|
759
|
+
} else if (pathSegments.length > 1 && (!(pathSegments.length === 2 && pathSegments[1] === 'id') || joins.some((join)=>join.queryPath === targetQueryPath))) {
|
|
613
760
|
// simple relationships
|
|
614
761
|
const columnName = `${columnPrefix}${field.name}`;
|
|
615
762
|
const newTableName = adapter.tableNameMap.get(toSnakeCase(adapter.payload.collections[field.relationTo].config.slug));
|
|
616
|
-
const
|
|
763
|
+
const existingTargetJoin = joins.find((join)=>join.queryPath === targetQueryPath);
|
|
764
|
+
const newAliasTable = existingTargetJoin?.table ?? getTableAlias({
|
|
617
765
|
adapter,
|
|
618
766
|
tableName: newTableName
|
|
619
|
-
});
|
|
620
|
-
if (isFieldLocalized && adapter.payload.config.localization) {
|
|
767
|
+
}).newAliasTable;
|
|
768
|
+
if (!existingTargetJoin && isFieldLocalized && adapter.payload.config.localization) {
|
|
621
769
|
const { newAliasTable: aliasLocaleTable } = getTableAlias({
|
|
622
770
|
adapter,
|
|
623
771
|
tableName: `${rootTableName}${adapter.localesSuffix}`
|
|
624
772
|
});
|
|
625
773
|
const condtions = [
|
|
626
|
-
eq(aliasLocaleTable._parentID,
|
|
774
|
+
eq(aliasLocaleTable._parentID, tableContainingField.id)
|
|
627
775
|
];
|
|
628
776
|
if (selectLocale) {
|
|
629
777
|
selectFields._locale = aliasLocaleTable._locale;
|
|
@@ -637,13 +785,32 @@ import { getTableAlias } from './getTableAlias.js';
|
|
|
637
785
|
joins,
|
|
638
786
|
table: localesTable
|
|
639
787
|
});
|
|
788
|
+
const condition = getRelationshipJoinCondition({
|
|
789
|
+
adapter,
|
|
790
|
+
collectionSlug: field.relationTo,
|
|
791
|
+
relationshipID: localesTable[columnName],
|
|
792
|
+
req,
|
|
793
|
+
table: newAliasTable,
|
|
794
|
+
value
|
|
795
|
+
});
|
|
640
796
|
joins.push({
|
|
641
|
-
condition
|
|
797
|
+
condition,
|
|
798
|
+
queryPath: targetQueryPath,
|
|
642
799
|
table: newAliasTable
|
|
643
800
|
});
|
|
644
|
-
} else {
|
|
801
|
+
} else if (!existingTargetJoin) {
|
|
802
|
+
const relationshipID = aliasTable ? aliasTable[columnName] : adapter.tables[tableName][columnName];
|
|
803
|
+
const condition = getRelationshipJoinCondition({
|
|
804
|
+
adapter,
|
|
805
|
+
collectionSlug: field.relationTo,
|
|
806
|
+
relationshipID,
|
|
807
|
+
req,
|
|
808
|
+
table: newAliasTable,
|
|
809
|
+
value
|
|
810
|
+
});
|
|
645
811
|
joins.push({
|
|
646
|
-
condition
|
|
812
|
+
condition,
|
|
813
|
+
queryPath: targetQueryPath,
|
|
647
814
|
table: newAliasTable
|
|
648
815
|
});
|
|
649
816
|
}
|
|
@@ -656,8 +823,10 @@ import { getTableAlias } from './getTableAlias.js';
|
|
|
656
823
|
fields: adapter.payload.collections[field.relationTo].config.flattenedFields,
|
|
657
824
|
joins,
|
|
658
825
|
locale,
|
|
659
|
-
|
|
826
|
+
// A relationship jumps to a different collection, so localization does not carry over
|
|
827
|
+
parentIsLocalized: false,
|
|
660
828
|
pathSegments: pathSegments.slice(1),
|
|
829
|
+
req,
|
|
661
830
|
selectFields,
|
|
662
831
|
tableName: newTableName,
|
|
663
832
|
value
|
|
@@ -707,13 +876,14 @@ import { getTableAlias } from './getTableAlias.js';
|
|
|
707
876
|
aliasTable,
|
|
708
877
|
collectionPath,
|
|
709
878
|
columnPrefix: `${columnPrefix}${field.name}_`,
|
|
710
|
-
constraintPath: `${
|
|
879
|
+
constraintPath: `${fieldStoragePath}.`,
|
|
711
880
|
constraints,
|
|
712
881
|
fields: field.flattenedFields,
|
|
713
882
|
joins,
|
|
714
883
|
locale,
|
|
715
884
|
parentIsLocalized: parentIsLocalized || field.localized,
|
|
716
885
|
pathSegments: pathSegments.slice(1),
|
|
886
|
+
req,
|
|
717
887
|
rootTableName,
|
|
718
888
|
selectFields,
|
|
719
889
|
selectLocale,
|
|
@@ -734,6 +904,7 @@ import { getTableAlias } from './getTableAlias.js';
|
|
|
734
904
|
locale,
|
|
735
905
|
parentIsLocalized: parentIsLocalized || field.localized,
|
|
736
906
|
pathSegments: pathSegments.slice(1),
|
|
907
|
+
req,
|
|
737
908
|
rootTableName,
|
|
738
909
|
selectFields,
|
|
739
910
|
selectLocale,
|