@contember/engine-content-api 2.2.0-alpha.14 → 2.2.0-alpha.16
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/CLAUDE.md +1 -0
- package/dist/development/src/extensions/hasManyToHasOneReducer/HasManyToHasOneReducerExecutionHandler.cjs +1 -0
- package/dist/development/src/extensions/hasManyToHasOneReducer/HasManyToHasOneReducerExecutionHandler.cjs.map +1 -1
- package/dist/development/src/extensions/hasManyToHasOneReducer/HasManyToHasOneReducerExecutionHandler.js +1 -0
- package/dist/development/src/extensions/hasManyToHasOneReducer/HasManyToHasOneReducerExecutionHandler.js.map +1 -1
- package/dist/development/src/extensions/hasManyToHasOneReducer/HasManyToHasOneRelationReducerVisitor.cjs +1 -0
- package/dist/development/src/extensions/hasManyToHasOneReducer/HasManyToHasOneRelationReducerVisitor.cjs.map +1 -1
- package/dist/development/src/extensions/hasManyToHasOneReducer/HasManyToHasOneRelationReducerVisitor.js +1 -0
- package/dist/development/src/extensions/hasManyToHasOneReducer/HasManyToHasOneRelationReducerVisitor.js.map +1 -1
- package/dist/development/src/extensions/paginatedHasMany/PaginatedHasManyExecutionHandler.cjs +1 -0
- package/dist/development/src/extensions/paginatedHasMany/PaginatedHasManyExecutionHandler.cjs.map +1 -1
- package/dist/development/src/extensions/paginatedHasMany/PaginatedHasManyExecutionHandler.js +1 -0
- package/dist/development/src/extensions/paginatedHasMany/PaginatedHasManyExecutionHandler.js.map +1 -1
- package/dist/development/src/extensions/paginatedHasMany/PaginatedHasManyFieldProviderVisitor.cjs +1 -0
- package/dist/development/src/extensions/paginatedHasMany/PaginatedHasManyFieldProviderVisitor.cjs.map +1 -1
- package/dist/development/src/extensions/paginatedHasMany/PaginatedHasManyFieldProviderVisitor.js +1 -0
- package/dist/development/src/extensions/paginatedHasMany/PaginatedHasManyFieldProviderVisitor.js.map +1 -1
- package/dist/development/src/mapper/ErrorUtils.cjs +7 -1
- package/dist/development/src/mapper/ErrorUtils.cjs.map +1 -1
- package/dist/development/src/mapper/ErrorUtils.js +7 -1
- package/dist/development/src/mapper/ErrorUtils.js.map +1 -1
- package/dist/development/src/mapper/Mapper.cjs +2 -1
- package/dist/development/src/mapper/Mapper.cjs.map +1 -1
- package/dist/development/src/mapper/Mapper.js +2 -1
- package/dist/development/src/mapper/Mapper.js.map +1 -1
- package/dist/development/src/mapper/select/Path.cjs +23 -3
- package/dist/development/src/mapper/select/Path.cjs.map +1 -1
- package/dist/development/src/mapper/select/Path.js +23 -3
- package/dist/development/src/mapper/select/Path.js.map +1 -1
- package/dist/development/src/mapper/select/SelectBuilder.cjs +5 -5
- package/dist/development/src/mapper/select/SelectBuilder.cjs.map +1 -1
- package/dist/development/src/mapper/select/SelectBuilder.js +5 -5
- package/dist/development/src/mapper/select/SelectBuilder.js.map +1 -1
- package/dist/development/src/mapper/select/handlers/FieldsVisitor.cjs +1 -1
- package/dist/development/src/mapper/select/handlers/FieldsVisitor.cjs.map +1 -1
- package/dist/development/src/mapper/select/handlers/FieldsVisitor.js +1 -1
- package/dist/development/src/mapper/select/handlers/FieldsVisitor.js.map +1 -1
- package/dist/development/src/resolvers/MutationResolver.cjs +1 -0
- package/dist/development/src/resolvers/MutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/MutationResolver.js +1 -0
- package/dist/development/src/resolvers/MutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/ReadHelpers.cjs +1 -0
- package/dist/development/src/resolvers/ReadHelpers.cjs.map +1 -1
- package/dist/development/src/resolvers/ReadHelpers.js +1 -0
- package/dist/development/src/resolvers/ReadHelpers.js.map +1 -1
- package/dist/development/src/resolvers/ReadResolver.cjs +21 -7
- package/dist/development/src/resolvers/ReadResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/ReadResolver.js +21 -7
- package/dist/development/src/resolvers/ReadResolver.js.map +1 -1
- package/dist/development/src/schema/GraphQlSchemaBuilderFactory.cjs +1 -0
- package/dist/development/src/schema/GraphQlSchemaBuilderFactory.cjs.map +1 -1
- package/dist/development/src/schema/GraphQlSchemaBuilderFactory.js +1 -0
- package/dist/development/src/schema/GraphQlSchemaBuilderFactory.js.map +1 -1
- package/dist/production/src/extensions/hasManyToHasOneReducer/HasManyToHasOneReducerExecutionHandler.cjs +1 -0
- package/dist/production/src/extensions/hasManyToHasOneReducer/HasManyToHasOneReducerExecutionHandler.cjs.map +1 -1
- package/dist/production/src/extensions/hasManyToHasOneReducer/HasManyToHasOneReducerExecutionHandler.js +1 -0
- package/dist/production/src/extensions/hasManyToHasOneReducer/HasManyToHasOneReducerExecutionHandler.js.map +1 -1
- package/dist/production/src/extensions/hasManyToHasOneReducer/HasManyToHasOneRelationReducerVisitor.cjs +1 -0
- package/dist/production/src/extensions/hasManyToHasOneReducer/HasManyToHasOneRelationReducerVisitor.cjs.map +1 -1
- package/dist/production/src/extensions/hasManyToHasOneReducer/HasManyToHasOneRelationReducerVisitor.js +1 -0
- package/dist/production/src/extensions/hasManyToHasOneReducer/HasManyToHasOneRelationReducerVisitor.js.map +1 -1
- package/dist/production/src/extensions/paginatedHasMany/PaginatedHasManyExecutionHandler.cjs +1 -0
- package/dist/production/src/extensions/paginatedHasMany/PaginatedHasManyExecutionHandler.cjs.map +1 -1
- package/dist/production/src/extensions/paginatedHasMany/PaginatedHasManyExecutionHandler.js +1 -0
- package/dist/production/src/extensions/paginatedHasMany/PaginatedHasManyExecutionHandler.js.map +1 -1
- package/dist/production/src/extensions/paginatedHasMany/PaginatedHasManyFieldProviderVisitor.cjs +1 -0
- package/dist/production/src/extensions/paginatedHasMany/PaginatedHasManyFieldProviderVisitor.cjs.map +1 -1
- package/dist/production/src/extensions/paginatedHasMany/PaginatedHasManyFieldProviderVisitor.js +1 -0
- package/dist/production/src/extensions/paginatedHasMany/PaginatedHasManyFieldProviderVisitor.js.map +1 -1
- package/dist/production/src/mapper/ErrorUtils.cjs +7 -1
- package/dist/production/src/mapper/ErrorUtils.cjs.map +1 -1
- package/dist/production/src/mapper/ErrorUtils.js +7 -1
- package/dist/production/src/mapper/ErrorUtils.js.map +1 -1
- package/dist/production/src/mapper/Mapper.cjs +2 -1
- package/dist/production/src/mapper/Mapper.cjs.map +1 -1
- package/dist/production/src/mapper/Mapper.js +2 -1
- package/dist/production/src/mapper/Mapper.js.map +1 -1
- package/dist/production/src/mapper/select/Path.cjs +23 -3
- package/dist/production/src/mapper/select/Path.cjs.map +1 -1
- package/dist/production/src/mapper/select/Path.js +23 -3
- package/dist/production/src/mapper/select/Path.js.map +1 -1
- package/dist/production/src/mapper/select/SelectBuilder.cjs +5 -5
- package/dist/production/src/mapper/select/SelectBuilder.cjs.map +1 -1
- package/dist/production/src/mapper/select/SelectBuilder.js +5 -5
- package/dist/production/src/mapper/select/SelectBuilder.js.map +1 -1
- package/dist/production/src/mapper/select/handlers/FieldsVisitor.cjs +1 -1
- package/dist/production/src/mapper/select/handlers/FieldsVisitor.cjs.map +1 -1
- package/dist/production/src/mapper/select/handlers/FieldsVisitor.js +1 -1
- package/dist/production/src/mapper/select/handlers/FieldsVisitor.js.map +1 -1
- package/dist/production/src/resolvers/MutationResolver.cjs +1 -0
- package/dist/production/src/resolvers/MutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/MutationResolver.js +1 -0
- package/dist/production/src/resolvers/MutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/ReadHelpers.cjs +1 -0
- package/dist/production/src/resolvers/ReadHelpers.cjs.map +1 -1
- package/dist/production/src/resolvers/ReadHelpers.js +1 -0
- package/dist/production/src/resolvers/ReadHelpers.js.map +1 -1
- package/dist/production/src/resolvers/ReadResolver.cjs +21 -7
- package/dist/production/src/resolvers/ReadResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/ReadResolver.js +21 -7
- package/dist/production/src/resolvers/ReadResolver.js.map +1 -1
- package/dist/production/src/schema/GraphQlSchemaBuilderFactory.cjs +1 -0
- package/dist/production/src/schema/GraphQlSchemaBuilderFactory.cjs.map +1 -1
- package/dist/production/src/schema/GraphQlSchemaBuilderFactory.js +1 -0
- package/dist/production/src/schema/GraphQlSchemaBuilderFactory.js.map +1 -1
- package/dist/tests/cases/unit/mutationSqlError.test.d.ts +2 -0
- package/dist/tests/cases/unit/mutationSqlError.test.d.ts.map +1 -0
- package/dist/tests/cases/unit/pathAlias.test.d.ts +2 -0
- package/dist/tests/cases/unit/pathAlias.test.d.ts.map +1 -0
- package/dist/tests/tsconfig.tsbuildinfo +1 -1
- package/dist/types/mapper/ErrorUtils.d.ts.map +1 -1
- package/dist/types/mapper/select/Path.d.ts +1 -0
- package/dist/types/mapper/select/Path.d.ts.map +1 -1
- package/dist/types/mapper/select/SelectBuilder.d.ts.map +1 -1
- package/dist/types/resolvers/ReadResolver.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +9 -9
- package/src/mapper/ErrorUtils.ts +11 -1
- package/src/mapper/Mapper.ts +1 -1
- package/src/mapper/select/Path.ts +25 -5
- package/src/mapper/select/SelectBuilder.ts +5 -4
- package/src/mapper/select/handlers/FieldsVisitor.ts +1 -1
- package/src/resolvers/ReadResolver.ts +24 -7
- package/tests/cases/bugs/bug102.test.ts +4 -4
- package/tests/cases/integration/graphQlRequests/delete/deleteById.test.ts +4 -3
- package/tests/cases/integration/graphQlRequests/query/acl/differentRowAndFieldPredicate.test.ts +4 -4
- package/tests/cases/integration/graphQlRequests/query/acl/fieldRestrictedByLocale.test.ts +12 -10
- package/tests/cases/integration/graphQlRequests/query/acl/metaReadableThroughContext.test.ts +15 -15
- package/tests/cases/integration/graphQlRequests/query/acl/nestedPredicate.test.ts +7 -6
- package/tests/cases/integration/graphQlRequests/query/acl/nonAdjacentBackReference.test.ts +6 -6
- package/tests/cases/integration/graphQlRequests/query/acl/orderByCellPredicate.test.ts +6 -6
- package/tests/cases/integration/graphQlRequests/query/acl/predicateElimination.test.ts +25 -23
- package/tests/cases/integration/graphQlRequests/query/acl/relationAcl.test.ts +12 -9
- package/tests/cases/integration/graphQlRequests/query/acl/rowPredicateSubset.test.ts +6 -6
- package/tests/cases/integration/graphQlRequests/query/acl/throughScope.test.ts +14 -12
- package/tests/cases/integration/graphQlRequests/query/acl/throughScopeNullability.test.ts +4 -4
- package/tests/cases/integration/graphQlRequests/query/filter/backReferencedFilter.test.ts +3 -1
- package/tests/cases/integration/graphQlRequests/query/graphqlFeatures/alias.test.ts +2 -2
- package/tests/cases/integration/graphQlRequests/query/graphqlFeatures/fragments.test.ts +8 -8
- package/tests/cases/integration/graphQlRequests/query/misc/reducedHasMany.test.ts +10 -10
- package/tests/cases/integration/graphQlRequests/query/pagination/hasManyLimit.test.ts +8 -8
- package/tests/cases/integration/graphQlRequests/query/pagination/paginate.test.ts +5 -4
- package/tests/cases/integration/graphQlRequests/query/pagination/paginateAliased.test.ts +5 -4
- package/tests/cases/integration/graphQlRequests/query/relations/advanced.test.ts +17 -8
- package/tests/cases/integration/graphQlRequests/query/relations/manyHasManyInverse.test.ts +6 -6
- package/tests/cases/integration/graphQlRequests/query/relations/manyHasManyOwning.test.ts +6 -6
- package/tests/cases/integration/graphQlRequests/query/relations/manyHasOne.test.ts +12 -9
- package/tests/cases/integration/graphQlRequests/query/relations/oneHasMany.test.ts +12 -12
- package/tests/cases/integration/graphQlRequests/query/relations/oneHasOneInverse.test.ts +6 -4
- package/tests/cases/integration/graphQlRequests/query/relations/oneHasOneOwner.test.ts +6 -4
- package/tests/cases/integration/graphQlRequests/query/sorting/defaultOrdering.test.ts +4 -4
- package/tests/cases/integration/graphQlRequests/query/sorting/randomSort.test.ts +5 -5
- package/tests/cases/integration/graphQlRequests/query/sorting/sortedHasMany.test.ts +2 -2
- package/tests/cases/integration/graphQlRequests/query/view/view.test.ts +6 -6
- package/tests/cases/unit/mutationSqlError.test.ts +30 -0
- package/tests/cases/unit/pathAlias.test.ts +26 -0
|
@@ -87,7 +87,7 @@ test('predicate with OR', async () => {
|
|
|
87
87
|
}`,
|
|
88
88
|
executes: [
|
|
89
89
|
{
|
|
90
|
-
sql: SQL`SELECT "root_"."id" AS "root_id", "root_"."image_id"
|
|
90
|
+
sql: SQL`SELECT "root_"."id" AS "root_id", "root_"."image_id" as "root_$key_image"
|
|
91
91
|
FROM "public"."author" AS "root_"
|
|
92
92
|
WHERE "root_"."is_public" = ?`,
|
|
93
93
|
parameters: [true],
|
|
@@ -95,19 +95,20 @@ test('predicate with OR', async () => {
|
|
|
95
95
|
rows: [
|
|
96
96
|
{
|
|
97
97
|
root_id: testUuid(1),
|
|
98
|
-
|
|
98
|
+
'root_$key_image': testUuid(2),
|
|
99
99
|
},
|
|
100
100
|
],
|
|
101
101
|
},
|
|
102
102
|
},
|
|
103
103
|
{
|
|
104
104
|
sql:
|
|
105
|
-
`select "root_"."id" as "
|
|
105
|
+
`select "root_"."id" as "root_$index_id", "root_"."url" as "root_url", "root_"."id" as "root_id" from "public"."image" as "root_" where "root_"."id" in (?)`,
|
|
106
106
|
parameters: [testUuid(2)],
|
|
107
107
|
response: {
|
|
108
108
|
rows: [
|
|
109
109
|
{
|
|
110
110
|
root_id: testUuid(2),
|
|
111
|
+
'root_$index_id': testUuid(2),
|
|
111
112
|
root_url: 'abcd',
|
|
112
113
|
},
|
|
113
114
|
],
|
|
@@ -189,12 +190,13 @@ test('does apply primary filter even if relation predicate eliminates it', async
|
|
|
189
190
|
executes: [
|
|
190
191
|
{
|
|
191
192
|
sql:
|
|
192
|
-
SQL`select "root_"."title" as "root_title", "root_"."id" as "
|
|
193
|
+
SQL`select "root_"."title" as "root_title", "root_"."id" as "root_$key_id", "root_"."id" as "root_$key_id", "root_"."id" as "root_id" from "public"."article" as "root_" where "root_"."id" = ? and "root_"."id" in (?)`,
|
|
193
194
|
parameters: [testUuid(1), testUuid(1)],
|
|
194
195
|
response: {
|
|
195
196
|
rows: [
|
|
196
197
|
{
|
|
197
198
|
root_id: testUuid(1),
|
|
199
|
+
'root_$key_id': testUuid(1),
|
|
198
200
|
root_title: 'Article A',
|
|
199
201
|
},
|
|
200
202
|
],
|
|
@@ -210,7 +212,7 @@ test('does apply primary filter even if relation predicate eliminates it', async
|
|
|
210
212
|
},
|
|
211
213
|
{
|
|
212
214
|
sql:
|
|
213
|
-
SQL`select "root_"."article_id" as "
|
|
215
|
+
SQL`select "root_"."article_id" as "root_$index_article", "root_"."views" as "root_views", "root_"."id" as "root_id" from "public"."article_stats" as "root_" where "root_"."article_id" in (?)`,
|
|
214
216
|
parameters: [testUuid(1)],
|
|
215
217
|
response: {
|
|
216
218
|
rows: [],
|
|
@@ -266,11 +268,11 @@ test('self-referencing: children should have their own predicate applied', async
|
|
|
266
268
|
{
|
|
267
269
|
// Parent categories - must have isActive = true
|
|
268
270
|
sql:
|
|
269
|
-
SQL`select "root_"."name" as "root_name", "root_"."id" as "
|
|
271
|
+
SQL`select "root_"."name" as "root_name", "root_"."id" as "root_$key_id", "root_"."id" as "root_id" from "public"."category" as "root_" where "root_"."is_active" = ?`,
|
|
270
272
|
parameters: [true],
|
|
271
273
|
response: {
|
|
272
274
|
rows: [
|
|
273
|
-
{ root_id: testUuid(1), root_name: 'Parent Category' },
|
|
275
|
+
{ root_id: testUuid(1), 'root_$key_id': testUuid(1), root_name: 'Parent Category' },
|
|
274
276
|
],
|
|
275
277
|
},
|
|
276
278
|
},
|
|
@@ -350,11 +352,11 @@ test('multiple relations: articles via author should apply article predicate', a
|
|
|
350
352
|
{
|
|
351
353
|
// Persons - must have isActive = true
|
|
352
354
|
sql:
|
|
353
|
-
SQL`select "root_"."name" as "root_name", "root_"."id" as "
|
|
355
|
+
SQL`select "root_"."name" as "root_name", "root_"."id" as "root_$key_id", "root_"."id" as "root_id" from "public"."person" as "root_" where "root_"."is_active" = ?`,
|
|
354
356
|
parameters: [true],
|
|
355
357
|
response: {
|
|
356
358
|
rows: [
|
|
357
|
-
{ root_id: testUuid(1), root_name: 'John' },
|
|
359
|
+
{ root_id: testUuid(1), 'root_$key_id': testUuid(1), root_name: 'John' },
|
|
358
360
|
],
|
|
359
361
|
},
|
|
360
362
|
},
|
|
@@ -431,11 +433,11 @@ test('back-reference predicate should be eliminated but join filter preserved',
|
|
|
431
433
|
{
|
|
432
434
|
// Articles - must have isPublished = true
|
|
433
435
|
sql:
|
|
434
|
-
SQL`select "root_"."title" as "root_title", "root_"."id" as "
|
|
436
|
+
SQL`select "root_"."title" as "root_title", "root_"."id" as "root_$key_id", "root_"."id" as "root_id" from "public"."article" as "root_" where "root_"."is_published" = ?`,
|
|
435
437
|
parameters: [true],
|
|
436
438
|
response: {
|
|
437
439
|
rows: [
|
|
438
|
-
{ root_id: testUuid(1), root_title: 'Published Article' },
|
|
440
|
+
{ root_id: testUuid(1), 'root_$key_id': testUuid(1), root_title: 'Published Article' },
|
|
439
441
|
],
|
|
440
442
|
},
|
|
441
443
|
},
|
|
@@ -526,22 +528,22 @@ test('deep nesting: predicates should be properly eliminated at each level', asy
|
|
|
526
528
|
{
|
|
527
529
|
// Companies - must have isActive = true
|
|
528
530
|
sql:
|
|
529
|
-
SQL`select "root_"."name" as "root_name", "root_"."id" as "
|
|
531
|
+
SQL`select "root_"."name" as "root_name", "root_"."id" as "root_$key_id", "root_"."id" as "root_id" from "public"."company" as "root_" where "root_"."is_active" = ?`,
|
|
530
532
|
parameters: [true],
|
|
531
533
|
response: {
|
|
532
534
|
rows: [
|
|
533
|
-
{ root_id: testUuid(1), root_name: 'Acme Corp' },
|
|
535
|
+
{ root_id: testUuid(1), 'root_$key_id': testUuid(1), root_name: 'Acme Corp' },
|
|
534
536
|
],
|
|
535
537
|
},
|
|
536
538
|
},
|
|
537
539
|
{
|
|
538
540
|
// Departments - back-reference predicate eliminated, join filter preserved
|
|
539
541
|
sql:
|
|
540
|
-
SQL`select "root_"."company_id" as "__grouping_key", "root_"."name" as "root_name", "root_"."id" as "
|
|
542
|
+
SQL`select "root_"."company_id" as "__grouping_key", "root_"."name" as "root_name", "root_"."id" as "root_$key_id", "root_"."id" as "root_id" from "public"."department" as "root_" where "root_"."company_id" in (?)`,
|
|
541
543
|
parameters: [testUuid(1)],
|
|
542
544
|
response: {
|
|
543
545
|
rows: [
|
|
544
|
-
{ __grouping_key: testUuid(1), root_id: testUuid(2), root_name: 'Engineering' },
|
|
546
|
+
{ __grouping_key: testUuid(1), root_id: testUuid(2), 'root_$key_id': testUuid(2), root_name: 'Engineering' },
|
|
545
547
|
],
|
|
546
548
|
},
|
|
547
549
|
},
|
|
@@ -676,11 +678,11 @@ test('multi-level back-reference: predicates should be eliminated at each level'
|
|
|
676
678
|
{
|
|
677
679
|
// Companies - must have isActive = true
|
|
678
680
|
sql:
|
|
679
|
-
SQL`select "root_"."name" as "root_name", "root_"."id" as "
|
|
681
|
+
SQL`select "root_"."name" as "root_name", "root_"."id" as "root_$key_id", "root_"."id" as "root_id" from "public"."company" as "root_" where "root_"."is_active" = ?`,
|
|
680
682
|
parameters: [true],
|
|
681
683
|
response: {
|
|
682
684
|
rows: [
|
|
683
|
-
{ root_id: testUuid(1), root_name: 'Acme Corp' },
|
|
685
|
+
{ root_id: testUuid(1), 'root_$key_id': testUuid(1), root_name: 'Acme Corp' },
|
|
684
686
|
],
|
|
685
687
|
},
|
|
686
688
|
},
|
|
@@ -688,11 +690,11 @@ test('multi-level back-reference: predicates should be eliminated at each level'
|
|
|
688
690
|
// Departments - back-reference predicate (company.isActive) should be eliminated
|
|
689
691
|
// Only join filter preserved
|
|
690
692
|
sql:
|
|
691
|
-
SQL`select "root_"."company_id" as "__grouping_key", "root_"."name" as "root_name", "root_"."id" as "
|
|
693
|
+
SQL`select "root_"."company_id" as "__grouping_key", "root_"."name" as "root_name", "root_"."id" as "root_$key_id", "root_"."id" as "root_id" from "public"."department" as "root_" where "root_"."company_id" in (?)`,
|
|
692
694
|
parameters: [testUuid(1)],
|
|
693
695
|
response: {
|
|
694
696
|
rows: [
|
|
695
|
-
{ __grouping_key: testUuid(1), root_id: testUuid(2), root_name: 'Engineering' },
|
|
697
|
+
{ __grouping_key: testUuid(1), root_id: testUuid(2), 'root_$key_id': testUuid(2), root_name: 'Engineering' },
|
|
696
698
|
],
|
|
697
699
|
},
|
|
698
700
|
},
|
|
@@ -700,11 +702,11 @@ test('multi-level back-reference: predicates should be eliminated at each level'
|
|
|
700
702
|
// Employees - multi-level back-reference predicate (department.company.isActive) should be eliminated
|
|
701
703
|
// Only join filter preserved
|
|
702
704
|
sql:
|
|
703
|
-
SQL`select "root_"."department_id" as "__grouping_key", "root_"."name" as "root_name", "root_"."id" as "
|
|
705
|
+
SQL`select "root_"."department_id" as "__grouping_key", "root_"."name" as "root_name", "root_"."id" as "root_$key_id", "root_"."id" as "root_id" from "public"."employee" as "root_" where "root_"."department_id" in (?)`,
|
|
704
706
|
parameters: [testUuid(2)],
|
|
705
707
|
response: {
|
|
706
708
|
rows: [
|
|
707
|
-
{ __grouping_key: testUuid(2), root_id: testUuid(3), root_name: 'Alice' },
|
|
709
|
+
{ __grouping_key: testUuid(2), root_id: testUuid(3), 'root_$key_id': testUuid(3), root_name: 'Alice' },
|
|
708
710
|
],
|
|
709
711
|
},
|
|
710
712
|
},
|
|
@@ -768,11 +770,11 @@ test('user filter on has-many should be preserved alongside join filter', async
|
|
|
768
770
|
executes: [
|
|
769
771
|
{
|
|
770
772
|
sql:
|
|
771
|
-
SQL`select "root_"."name" as "root_name", "root_"."id" as "
|
|
773
|
+
SQL`select "root_"."name" as "root_name", "root_"."id" as "root_$key_id", "root_"."id" as "root_id" from "public"."company" as "root_" where "root_"."id" in (?)`,
|
|
772
774
|
parameters: [testUuid(1)],
|
|
773
775
|
response: {
|
|
774
776
|
rows: [
|
|
775
|
-
{ root_id: testUuid(1), root_name: 'Acme Corp' },
|
|
777
|
+
{ root_id: testUuid(1), 'root_$key_id': testUuid(1), root_name: 'Acme Corp' },
|
|
776
778
|
],
|
|
777
779
|
},
|
|
778
780
|
},
|
|
@@ -50,33 +50,34 @@ test('can read same entity only over relation of some rows - many has one', asyn
|
|
|
50
50
|
executes: [
|
|
51
51
|
{
|
|
52
52
|
sql:
|
|
53
|
-
SQL`select "root_"."title" as "root_title", "root_"."disclose_author" = ? as "
|
|
53
|
+
SQL`select "root_"."title" as "root_title", "root_"."disclose_author" = ? as "root_$predicate_discloseAuthor_eq_true", "root_"."author_id" as "root_$key_author", "root_"."id" as "root_id"
|
|
54
54
|
from "public"."article" as "root_"`,
|
|
55
55
|
response: {
|
|
56
56
|
rows: [
|
|
57
57
|
{
|
|
58
58
|
root_id: testUuid(1),
|
|
59
59
|
root_title: 'Article A',
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
'root_$predicate_discloseAuthor_eq_true': true,
|
|
61
|
+
'root_$key_author': testUuid(10),
|
|
62
62
|
},
|
|
63
63
|
{
|
|
64
64
|
root_id: testUuid(2),
|
|
65
65
|
root_title: 'Article B',
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
'root_$predicate_discloseAuthor_eq_true': false,
|
|
67
|
+
'root_$key_author': testUuid(10),
|
|
68
68
|
},
|
|
69
69
|
],
|
|
70
70
|
},
|
|
71
71
|
},
|
|
72
72
|
{
|
|
73
73
|
sql:
|
|
74
|
-
SQL`select "root_"."id" as "
|
|
74
|
+
SQL`select "root_"."id" as "root_$index_id", "root_"."name" as "root_name", "root_"."id" as "root_id" from "public"."author" as "root_" where "root_"."id" in (?)`,
|
|
75
75
|
parameters: [testUuid(10)],
|
|
76
76
|
response: {
|
|
77
77
|
rows: [
|
|
78
78
|
{
|
|
79
79
|
root_id: testUuid(10),
|
|
80
|
+
'root_$index_id': testUuid(10),
|
|
80
81
|
root_name: 'John doe',
|
|
81
82
|
},
|
|
82
83
|
],
|
|
@@ -147,19 +148,21 @@ test('can read same entity only over relation of some rows - many has many', asy
|
|
|
147
148
|
executes: [
|
|
148
149
|
{
|
|
149
150
|
sql:
|
|
150
|
-
SQL`select "root_"."title" as "root_title", "root_"."disclose_author" = ? as "
|
|
151
|
+
SQL`select "root_"."title" as "root_title", "root_"."disclose_author" = ? as "root_$predicate_discloseAuthor_eq_true", "root_"."id" as "root_$key_id", "root_"."id" as "root_id"
|
|
151
152
|
from "public"."article" as "root_"`,
|
|
152
153
|
response: {
|
|
153
154
|
rows: [
|
|
154
155
|
{
|
|
155
156
|
root_id: testUuid(1),
|
|
157
|
+
'root_$key_id': testUuid(1),
|
|
156
158
|
root_title: 'Article A',
|
|
157
|
-
|
|
159
|
+
'root_$predicate_discloseAuthor_eq_true': true,
|
|
158
160
|
},
|
|
159
161
|
{
|
|
160
162
|
root_id: testUuid(2),
|
|
163
|
+
'root_$key_id': testUuid(2),
|
|
161
164
|
root_title: 'Article B',
|
|
162
|
-
|
|
165
|
+
'root_$predicate_discloseAuthor_eq_true': false,
|
|
163
166
|
},
|
|
164
167
|
],
|
|
165
168
|
},
|
|
@@ -53,9 +53,9 @@ test('row level predicate includes main predicate', async () => {
|
|
|
53
53
|
{
|
|
54
54
|
sql: SQL`SELECT
|
|
55
55
|
"root_"."id" AS "root_id",
|
|
56
|
-
TRUE
|
|
56
|
+
TRUE as "root_$predicate_isPublished_eq_true",
|
|
57
57
|
"root_"."title" AS "root_title",
|
|
58
|
-
"root_"."is_unlocked" = ?
|
|
58
|
+
"root_"."is_unlocked" = ? as "root_$predicate_and_isUnlocked_eq_true_isPubl",
|
|
59
59
|
"root_"."content" AS "root_content"
|
|
60
60
|
FROM "public"."article" AS "root_"
|
|
61
61
|
WHERE "root_"."is_published" = ?`,
|
|
@@ -64,16 +64,16 @@ test('row level predicate includes main predicate', async () => {
|
|
|
64
64
|
rows: [
|
|
65
65
|
{
|
|
66
66
|
root_id: testUuid(1),
|
|
67
|
-
|
|
67
|
+
'root_$predicate_isPublished_eq_true': true,
|
|
68
68
|
root_title: 'Hello',
|
|
69
|
-
|
|
69
|
+
'root_$predicate_and_isUnlocked_eq_true_isPubl': false,
|
|
70
70
|
root_content: 'Foo bar',
|
|
71
71
|
},
|
|
72
72
|
{
|
|
73
73
|
root_id: testUuid(2),
|
|
74
|
-
|
|
74
|
+
'root_$predicate_isPublished_eq_true': true,
|
|
75
75
|
root_title: 'Hello 2',
|
|
76
|
-
|
|
76
|
+
'root_$predicate_and_isUnlocked_eq_true_isPubl': true,
|
|
77
77
|
root_content: 'Lorem ipsum',
|
|
78
78
|
},
|
|
79
79
|
],
|
|
@@ -57,26 +57,27 @@ test('reads a through-only field over a relation', async () => {
|
|
|
57
57
|
executes: [
|
|
58
58
|
{
|
|
59
59
|
sql:
|
|
60
|
-
SQL`select "root_"."title" as "root_title", "root_"."author_id" as "
|
|
60
|
+
SQL`select "root_"."title" as "root_title", "root_"."author_id" as "root_$key_author", "root_"."id" as "root_id" from "public"."article" as "root_"`,
|
|
61
61
|
parameters: [],
|
|
62
62
|
response: {
|
|
63
63
|
rows: [
|
|
64
|
-
{ root_id: testUuid(1), root_title: 'Article A',
|
|
64
|
+
{ root_id: testUuid(1), root_title: 'Article A', 'root_$key_author': testUuid(10) },
|
|
65
65
|
],
|
|
66
66
|
},
|
|
67
67
|
},
|
|
68
68
|
{
|
|
69
69
|
sql:
|
|
70
|
-
SQL`select "root_"."id" as "
|
|
70
|
+
SQL`select "root_"."id" as "root_$index_id", "root_"."name" as "root_name", "root_"."disclosed" = ? as "root_$predicate_disclosed_eq_true", "root_"."secret" as "root_secret", "root_"."id" as "root_id"
|
|
71
71
|
from "public"."author" as "root_" where "root_"."id" in (?)`,
|
|
72
72
|
parameters: [true, testUuid(10)],
|
|
73
73
|
response: {
|
|
74
74
|
rows: [
|
|
75
75
|
{
|
|
76
76
|
root_id: testUuid(10),
|
|
77
|
+
'root_$index_id': testUuid(10),
|
|
77
78
|
root_name: 'John Doe',
|
|
78
79
|
root_secret: 'shh',
|
|
79
|
-
|
|
80
|
+
'root_$predicate_disclosed_eq_true': true,
|
|
80
81
|
},
|
|
81
82
|
],
|
|
82
83
|
},
|
|
@@ -197,21 +198,21 @@ test('the same entity is readable over a relation', async () => {
|
|
|
197
198
|
}`,
|
|
198
199
|
executes: [
|
|
199
200
|
{
|
|
200
|
-
sql: SQL`select "root_"."image_id" as "
|
|
201
|
+
sql: SQL`select "root_"."image_id" as "root_$key_image", "root_"."id" as "root_id" from "public"."article" as "root_"`,
|
|
201
202
|
parameters: [],
|
|
202
203
|
response: {
|
|
203
204
|
rows: [
|
|
204
|
-
{ root_id: testUuid(1),
|
|
205
|
+
{ root_id: testUuid(1), 'root_$key_image': testUuid(20) },
|
|
205
206
|
],
|
|
206
207
|
},
|
|
207
208
|
},
|
|
208
209
|
{
|
|
209
210
|
sql:
|
|
210
|
-
SQL`select "root_"."id" as "
|
|
211
|
+
SQL`select "root_"."id" as "root_$index_id", "root_"."url" as "root_url", "root_"."id" as "root_id" from "public"."image" as "root_" where "root_"."id" in (?)`,
|
|
211
212
|
parameters: [testUuid(20)],
|
|
212
213
|
response: {
|
|
213
214
|
rows: [
|
|
214
|
-
{ root_id: testUuid(20), root_url: 'https://example.com/a.png' },
|
|
215
|
+
{ root_id: testUuid(20), 'root_$index_id': testUuid(20), root_url: 'https://example.com/a.png' },
|
|
215
216
|
],
|
|
216
217
|
},
|
|
217
218
|
},
|
|
@@ -277,25 +278,26 @@ test('row-level predicate over a relation is the union of the root and through f
|
|
|
277
278
|
}`,
|
|
278
279
|
executes: [
|
|
279
280
|
{
|
|
280
|
-
sql: SQL`select "root_"."author_id" as "
|
|
281
|
+
sql: SQL`select "root_"."author_id" as "root_$key_author", "root_"."id" as "root_id" from "public"."article" as "root_"`,
|
|
281
282
|
parameters: [],
|
|
282
283
|
response: {
|
|
283
284
|
rows: [
|
|
284
|
-
{ root_id: testUuid(1),
|
|
285
|
+
{ root_id: testUuid(1), 'root_$key_author': testUuid(10) },
|
|
285
286
|
],
|
|
286
287
|
},
|
|
287
288
|
},
|
|
288
289
|
{
|
|
289
290
|
sql:
|
|
290
|
-
SQL`select "root_"."id" as "
|
|
291
|
+
SQL`select "root_"."id" as "root_$index_id", "root_"."disclosed" = ? as "root_$predicate_disclosed_eq_true", "root_"."secret" as "root_secret", "root_"."id" as "root_id"
|
|
291
292
|
from "public"."author" as "root_" where "root_"."id" in (?) and ("root_"."published" = ? or "root_"."disclosed" = ?)`,
|
|
292
293
|
parameters: [true, testUuid(10), true, true],
|
|
293
294
|
response: {
|
|
294
295
|
rows: [
|
|
295
296
|
{
|
|
296
297
|
root_id: testUuid(10),
|
|
298
|
+
'root_$index_id': testUuid(10),
|
|
297
299
|
root_secret: 'shh',
|
|
298
|
-
|
|
300
|
+
'root_$predicate_disclosed_eq_true': true,
|
|
299
301
|
},
|
|
300
302
|
],
|
|
301
303
|
},
|
|
@@ -94,21 +94,21 @@ test('the same not-null column is read over a relation', async () => {
|
|
|
94
94
|
executes: [
|
|
95
95
|
{
|
|
96
96
|
sql:
|
|
97
|
-
SQL`select "root_"."title" as "root_title", "root_"."author_id" as "
|
|
97
|
+
SQL`select "root_"."title" as "root_title", "root_"."author_id" as "root_$key_author", "root_"."id" as "root_id" from "public"."article" as "root_"`,
|
|
98
98
|
parameters: [],
|
|
99
99
|
response: {
|
|
100
100
|
rows: [
|
|
101
|
-
{ root_id: testUuid(1), root_title: 'Article A',
|
|
101
|
+
{ root_id: testUuid(1), root_title: 'Article A', 'root_$key_author': testUuid(10) },
|
|
102
102
|
],
|
|
103
103
|
},
|
|
104
104
|
},
|
|
105
105
|
{
|
|
106
|
-
sql: SQL`select "root_"."id" as "
|
|
106
|
+
sql: SQL`select "root_"."id" as "root_$index_id", "root_"."name" as "root_name", "root_"."secret" as "root_secret", "root_"."id" as "root_id"
|
|
107
107
|
from "public"."author" as "root_" where "root_"."id" in (?)`,
|
|
108
108
|
parameters: [testUuid(10)],
|
|
109
109
|
response: {
|
|
110
110
|
rows: [
|
|
111
|
-
{ root_id: testUuid(10), root_name: 'John Doe', root_secret: 'shh' },
|
|
111
|
+
{ root_id: testUuid(10), 'root_$index_id': testUuid(10), root_name: 'John Doe', root_secret: 'shh' },
|
|
112
112
|
],
|
|
113
113
|
},
|
|
114
114
|
},
|
|
@@ -22,15 +22,17 @@ test('Categories with children filtered by back-referenced parent', async () =>
|
|
|
22
22
|
{
|
|
23
23
|
sql: SQL`select
|
|
24
24
|
"root_"."id" as "root_id",
|
|
25
|
-
"root_"."id" as "
|
|
25
|
+
"root_"."id" as "root_$key_id"
|
|
26
26
|
from "public"."category" as "root_"`,
|
|
27
27
|
response: {
|
|
28
28
|
rows: [
|
|
29
29
|
{
|
|
30
30
|
root_id: testUuid(1),
|
|
31
|
+
'root_$key_id': testUuid(1),
|
|
31
32
|
},
|
|
32
33
|
{
|
|
33
34
|
root_id: testUuid(2),
|
|
35
|
+
'root_$key_id': testUuid(2),
|
|
34
36
|
},
|
|
35
37
|
],
|
|
36
38
|
},
|
|
@@ -81,7 +81,7 @@ test('aliases', async () => {
|
|
|
81
81
|
"root_"."id" AS "root_idx",
|
|
82
82
|
"root_"."name" AS "root_name1",
|
|
83
83
|
"root_"."name" AS "root_name2",
|
|
84
|
-
"root_"."name" = ?
|
|
84
|
+
"root_"."name" = ? as "root_$predicate_name_eq",
|
|
85
85
|
"root_"."id" AS "root_id"
|
|
86
86
|
FROM "public"."author" AS "root_"`,
|
|
87
87
|
parameters: ['John'],
|
|
@@ -92,7 +92,7 @@ test('aliases', async () => {
|
|
|
92
92
|
root_idx: testUuid(1),
|
|
93
93
|
root_name1: 'John',
|
|
94
94
|
root_name2: 'John',
|
|
95
|
-
|
|
95
|
+
'root_$predicate_name_eq': true,
|
|
96
96
|
},
|
|
97
97
|
],
|
|
98
98
|
},
|
|
@@ -42,11 +42,11 @@ test('fragments', async () => {
|
|
|
42
42
|
sql: SQL`select
|
|
43
43
|
"root_"."id" as "root_id",
|
|
44
44
|
"root_"."name" as "root_name",
|
|
45
|
-
"root_"."id" as "
|
|
45
|
+
"root_"."id" as "root_$key_id"
|
|
46
46
|
from "public"."author" as "root_"`,
|
|
47
47
|
parameters: [],
|
|
48
48
|
response: {
|
|
49
|
-
rows: [{ root_id: testUuid(1), root_name: 'John' }],
|
|
49
|
+
rows: [{ root_id: testUuid(1), 'root_$key_id': testUuid(1), root_name: 'John' }],
|
|
50
50
|
},
|
|
51
51
|
},
|
|
52
52
|
{
|
|
@@ -105,23 +105,23 @@ test('fragments merge', async () => {
|
|
|
105
105
|
}`,
|
|
106
106
|
executes: [
|
|
107
107
|
{
|
|
108
|
-
sql: `select "root_"."id" as "
|
|
108
|
+
sql: `select "root_"."id" as "root_$key_id", "root_"."id" as "root_id" from "public"."product" as "root_"`,
|
|
109
109
|
parameters: [],
|
|
110
|
-
response: { rows: [{ root_id: testUuid(1) }] },
|
|
110
|
+
response: { rows: [{ root_id: testUuid(1), 'root_$key_id': testUuid(1) }] },
|
|
111
111
|
},
|
|
112
112
|
{
|
|
113
113
|
sql:
|
|
114
|
-
`select "root_"."product_id" as "__grouping_key", "root_"."name" as "root_name", "root_"."image_id" as "
|
|
114
|
+
`select "root_"."product_id" as "__grouping_key", "root_"."name" as "root_name", "root_"."image_id" as "root_$key_image", "root_"."id" as "root_id" from "public"."product_locale" as "root_" where "root_"."product_id" in (?)`,
|
|
115
115
|
parameters: [testUuid(1)],
|
|
116
116
|
response: {
|
|
117
|
-
rows: [{ __grouping_key: testUuid(1), root_name: 'foo', root_id: testUuid(2),
|
|
117
|
+
rows: [{ __grouping_key: testUuid(1), root_name: 'foo', root_id: testUuid(2), 'root_$key_image': testUuid(3) }],
|
|
118
118
|
},
|
|
119
119
|
},
|
|
120
120
|
{
|
|
121
121
|
sql:
|
|
122
|
-
`select "root_"."id" as "
|
|
122
|
+
`select "root_"."id" as "root_$index_id", "root_"."url" as "root_url", "root_"."id" as "root_id" from "public"."image" as "root_" where "root_"."id" in (?)`,
|
|
123
123
|
parameters: [testUuid(3)],
|
|
124
|
-
response: { rows: [{ root_id: testUuid(3), root_url: 'abcd' }] },
|
|
124
|
+
response: { rows: [{ root_id: testUuid(3), 'root_$index_id': testUuid(3), root_url: 'abcd' }] },
|
|
125
125
|
},
|
|
126
126
|
],
|
|
127
127
|
return: {
|
|
@@ -31,24 +31,24 @@ test('reduced has many', async () => {
|
|
|
31
31
|
{
|
|
32
32
|
sql: SQL`select
|
|
33
33
|
"root_"."id" as "root_id",
|
|
34
|
-
"root_"."id" as "
|
|
34
|
+
"root_"."id" as "root_$key_id"
|
|
35
35
|
from "public"."post" as "root_"`,
|
|
36
36
|
parameters: [],
|
|
37
37
|
response: {
|
|
38
|
-
rows: [{ root_id: testUuid(1) }, { root_id: testUuid(2) }],
|
|
38
|
+
rows: [{ root_id: testUuid(1), 'root_$key_id': testUuid(1) }, { root_id: testUuid(2), 'root_$key_id': testUuid(2) }],
|
|
39
39
|
},
|
|
40
40
|
},
|
|
41
41
|
{
|
|
42
42
|
sql: SQL`select
|
|
43
|
-
"root_"."post_id" as "
|
|
43
|
+
"root_"."post_id" as "root_$index_post",
|
|
44
44
|
"root_"."id" as "root_id"
|
|
45
45
|
from "public"."post_locale" as "root_"
|
|
46
46
|
where "root_"."locale" = ? and "root_"."post_id" in (?, ?)`,
|
|
47
47
|
parameters: ['cs', testUuid(1), testUuid(2)],
|
|
48
48
|
response: {
|
|
49
49
|
rows: [
|
|
50
|
-
{
|
|
51
|
-
{
|
|
50
|
+
{ 'root_$index_post': testUuid(1), root_id: testUuid(11) },
|
|
51
|
+
{ 'root_$index_post': testUuid(2), root_id: testUuid(12) },
|
|
52
52
|
],
|
|
53
53
|
},
|
|
54
54
|
},
|
|
@@ -96,24 +96,24 @@ test('universal reduced has many', async () => {
|
|
|
96
96
|
{
|
|
97
97
|
sql: SQL`select
|
|
98
98
|
"root_"."id" as "root_id",
|
|
99
|
-
"root_"."id" as "
|
|
99
|
+
"root_"."id" as "root_$key_id"
|
|
100
100
|
from "public"."post" as "root_"`,
|
|
101
101
|
parameters: [],
|
|
102
102
|
response: {
|
|
103
|
-
rows: [{ root_id: testUuid(1) }, { root_id: testUuid(2) }],
|
|
103
|
+
rows: [{ root_id: testUuid(1), 'root_$key_id': testUuid(1) }, { root_id: testUuid(2), 'root_$key_id': testUuid(2) }],
|
|
104
104
|
},
|
|
105
105
|
},
|
|
106
106
|
{
|
|
107
107
|
sql: SQL`select
|
|
108
|
-
"root_"."post_id" as "
|
|
108
|
+
"root_"."post_id" as "root_$index_post",
|
|
109
109
|
"root_"."id" as "root_id"
|
|
110
110
|
from "public"."post_locale" as "root_"
|
|
111
111
|
where "root_"."locale" = ? and "root_"."post_id" in (?, ?)`,
|
|
112
112
|
parameters: ['cs', testUuid(1), testUuid(2)],
|
|
113
113
|
response: {
|
|
114
114
|
rows: [
|
|
115
|
-
{
|
|
116
|
-
{
|
|
115
|
+
{ 'root_$index_post': testUuid(1), root_id: testUuid(11) },
|
|
116
|
+
{ 'root_$index_post': testUuid(2), root_id: testUuid(12) },
|
|
117
117
|
],
|
|
118
118
|
},
|
|
119
119
|
},
|
|
@@ -30,13 +30,13 @@ test('many has many with where, limit and orderBy', async () => {
|
|
|
30
30
|
sql: SQL`select
|
|
31
31
|
"root_"."id" as "root_id",
|
|
32
32
|
"root_"."title" as "root_title",
|
|
33
|
-
"root_"."id" as "
|
|
33
|
+
"root_"."id" as "root_$key_id"
|
|
34
34
|
from "public"."category" as "root_"`,
|
|
35
35
|
parameters: [],
|
|
36
36
|
response: {
|
|
37
37
|
rows: [
|
|
38
|
-
{ root_id: testUuid(1), root_title: 'Hello' },
|
|
39
|
-
{ root_id: testUuid(2), root_title: 'World' },
|
|
38
|
+
{ root_id: testUuid(1), 'root_$key_id': testUuid(1), root_title: 'Hello' },
|
|
39
|
+
{ root_id: testUuid(2), 'root_$key_id': testUuid(2), root_title: 'World' },
|
|
40
40
|
],
|
|
41
41
|
},
|
|
42
42
|
},
|
|
@@ -150,13 +150,13 @@ test('one has many with where, limit and orderBy', async () => {
|
|
|
150
150
|
sql: SQL`select
|
|
151
151
|
"root_"."id" as "root_id",
|
|
152
152
|
"root_"."name" as "root_name",
|
|
153
|
-
"root_"."id" as "
|
|
153
|
+
"root_"."id" as "root_$key_id"
|
|
154
154
|
from "public"."author" as "root_"`,
|
|
155
155
|
parameters: [],
|
|
156
156
|
response: {
|
|
157
157
|
rows: [
|
|
158
|
-
{ root_id: testUuid(1), root_name: 'John' },
|
|
159
|
-
{ root_id: testUuid(2), root_name: 'Jack' },
|
|
158
|
+
{ root_id: testUuid(1), 'root_$key_id': testUuid(1), root_name: 'John' },
|
|
159
|
+
{ root_id: testUuid(2), 'root_$key_id': testUuid(2), root_name: 'Jack' },
|
|
160
160
|
],
|
|
161
161
|
},
|
|
162
162
|
},
|
|
@@ -235,8 +235,8 @@ test('one has many with nulls first in a limited page', async () => {
|
|
|
235
235
|
}`,
|
|
236
236
|
executes: [
|
|
237
237
|
{
|
|
238
|
-
sql: SQL`select "root_"."id" as "
|
|
239
|
-
response: { rows: [{ root_id: testUuid(1) }] },
|
|
238
|
+
sql: SQL`select "root_"."id" as "root_$key_id", "root_"."id" as "root_id" from "public"."author" as "root_"`,
|
|
239
|
+
response: { rows: [{ root_id: testUuid(1), 'root_$key_id': testUuid(1) }] },
|
|
240
240
|
},
|
|
241
241
|
{
|
|
242
242
|
sql: SQL`with "data" as
|
|
@@ -41,7 +41,7 @@ where "root_author"."name" = ?`,
|
|
|
41
41
|
response: { rows: [{ row_count: 10 }] },
|
|
42
42
|
},
|
|
43
43
|
{
|
|
44
|
-
sql: SQL`select "root_"."id" as "root_id", "root_"."title" as "root_title", "root_"."author_id" as "
|
|
44
|
+
sql: SQL`select "root_"."id" as "root_id", "root_"."title" as "root_title", "root_"."author_id" as "root_$key_author"
|
|
45
45
|
from "public"."post" as "root_"
|
|
46
46
|
left join "public"."author" as "root_author" on "root_"."author_id" = "root_author"."id"
|
|
47
47
|
where "root_author"."name" = ? order by "root_"."id" asc limit 2 offset 1`,
|
|
@@ -50,12 +50,12 @@ where "root_author"."name" = ? order by "root_"."id" asc limit 2 offset 1`,
|
|
|
50
50
|
{
|
|
51
51
|
root_id: testUuid(1),
|
|
52
52
|
root_title: 'Foo',
|
|
53
|
-
|
|
53
|
+
'root_$key_author': testUuid(2),
|
|
54
54
|
},
|
|
55
55
|
{
|
|
56
56
|
root_id: testUuid(3),
|
|
57
57
|
root_title: 'Bar',
|
|
58
|
-
|
|
58
|
+
'root_$key_author': testUuid(2),
|
|
59
59
|
},
|
|
60
60
|
],
|
|
61
61
|
},
|
|
@@ -63,7 +63,7 @@ where "root_author"."name" = ? order by "root_"."id" asc limit 2 offset 1`,
|
|
|
63
63
|
{
|
|
64
64
|
sql: SQL`
|
|
65
65
|
select
|
|
66
|
-
"root_"."id" as "
|
|
66
|
+
"root_"."id" as "root_$index_id",
|
|
67
67
|
"root_"."name" as "root_name",
|
|
68
68
|
"root_"."id" as "root_id"
|
|
69
69
|
from "public"."author" as "root_"
|
|
@@ -74,6 +74,7 @@ where "root_author"."name" = ? order by "root_"."id" asc limit 2 offset 1`,
|
|
|
74
74
|
rows: [
|
|
75
75
|
{
|
|
76
76
|
root_id: testUuid(2),
|
|
77
|
+
'root_$index_id': testUuid(2),
|
|
77
78
|
root_name: 'jack',
|
|
78
79
|
},
|
|
79
80
|
],
|