@contember/engine-content-api 2.1.0-rc.6 → 2.1.0-rc.8
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 +2 -0
- 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 +13 -10
- package/dist/development/src/mapper/select/SelectBuilder.cjs.map +1 -1
- package/dist/development/src/mapper/select/SelectBuilder.js +13 -10
- 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/mapper/select/handlers/MetaHandler.cjs +4 -3
- package/dist/development/src/mapper/select/handlers/MetaHandler.cjs.map +1 -1
- package/dist/development/src/mapper/select/handlers/MetaHandler.js +4 -3
- package/dist/development/src/mapper/select/handlers/MetaHandler.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/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 +13 -10
- package/dist/production/src/mapper/select/SelectBuilder.cjs.map +1 -1
- package/dist/production/src/mapper/select/SelectBuilder.js +13 -10
- 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/mapper/select/handlers/MetaHandler.cjs +4 -3
- package/dist/production/src/mapper/select/handlers/MetaHandler.cjs.map +1 -1
- package/dist/production/src/mapper/select/handlers/MetaHandler.js +4 -3
- package/dist/production/src/mapper/select/handlers/MetaHandler.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/tests/cases/integration/graphQlRequests/query/acl/internalColumnAliases.test.d.ts +2 -0
- package/dist/tests/cases/integration/graphQlRequests/query/acl/internalColumnAliases.test.d.ts.map +1 -0
- package/dist/tests/cases/integration/graphQlRequests/query/acl/mergedRolePredicate.test.d.ts +2 -0
- package/dist/tests/cases/integration/graphQlRequests/query/acl/mergedRolePredicate.test.d.ts.map +1 -0
- package/dist/tests/cases/integration/graphQlRequests/query/acl/nestedThroughPredicate.test.d.ts +2 -0
- package/dist/tests/cases/integration/graphQlRequests/query/acl/nestedThroughPredicate.test.d.ts.map +1 -0
- package/dist/tests/cases/unit/internalColumnAliases.test.d.ts +2 -0
- package/dist/tests/cases/unit/internalColumnAliases.test.d.ts.map +1 -0
- 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/src/test.d.ts +1 -0
- package/dist/tests/src/test.d.ts.map +1 -1
- 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/mapper/select/SelectExecutionHandler.d.ts +11 -1
- package/dist/types/mapper/select/SelectExecutionHandler.d.ts.map +1 -1
- package/dist/types/mapper/select/handlers/MetaHandler.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 +22 -11
- package/src/mapper/select/SelectExecutionHandler.ts +9 -1
- package/src/mapper/select/handlers/FieldsVisitor.ts +1 -1
- package/src/mapper/select/handlers/MetaHandler.ts +8 -3
- 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/internalColumnAliases.test.ts +326 -0
- package/tests/cases/integration/graphQlRequests/query/acl/mergedRolePredicate.test.ts +124 -0
- package/tests/cases/integration/graphQlRequests/query/acl/nestedPredicate.test.ts +7 -6
- package/tests/cases/integration/graphQlRequests/query/acl/nestedThroughPredicate.test.ts +345 -0
- 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/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/internalColumnAliases.test.ts +41 -0
- package/tests/cases/unit/mutationSqlError.test.ts +30 -0
- package/tests/cases/unit/pathAlias.test.ts +26 -0
- package/tests/src/test.ts +5 -1
|
@@ -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
|
],
|
|
@@ -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
|
],
|
|
@@ -37,15 +37,17 @@ test('Posts with categories and its cz locale (many has many owning + one has ma
|
|
|
37
37
|
{
|
|
38
38
|
sql: SQL`select
|
|
39
39
|
"root_"."id" as "root_id",
|
|
40
|
-
"root_"."id" as "
|
|
40
|
+
"root_"."id" as "root_$key_id"
|
|
41
41
|
from "public"."post" as "root_"`,
|
|
42
42
|
response: {
|
|
43
43
|
rows: [
|
|
44
44
|
{
|
|
45
45
|
root_id: testUuid(1),
|
|
46
|
+
'root_$key_id': testUuid(1),
|
|
46
47
|
},
|
|
47
48
|
{
|
|
48
49
|
root_id: testUuid(2),
|
|
50
|
+
'root_$key_id': testUuid(2),
|
|
49
51
|
},
|
|
50
52
|
],
|
|
51
53
|
},
|
|
@@ -81,7 +83,7 @@ test('Posts with categories and its cz locale (many has many owning + one has ma
|
|
|
81
83
|
{
|
|
82
84
|
sql: SQL`select
|
|
83
85
|
"root_"."visible" as "root_visible",
|
|
84
|
-
"root_"."id" as "
|
|
86
|
+
"root_"."id" as "root_$key_id",
|
|
85
87
|
"root_"."id" as "root_id"
|
|
86
88
|
from "public"."category" as "root_"
|
|
87
89
|
where "root_"."id" in (?, ?, ?)`,
|
|
@@ -90,14 +92,17 @@ test('Posts with categories and its cz locale (many has many owning + one has ma
|
|
|
90
92
|
rows: [
|
|
91
93
|
{
|
|
92
94
|
root_id: testUuid(3),
|
|
95
|
+
'root_$key_id': testUuid(3),
|
|
93
96
|
root_visible: true,
|
|
94
97
|
},
|
|
95
98
|
{
|
|
96
99
|
root_id: testUuid(4),
|
|
100
|
+
'root_$key_id': testUuid(4),
|
|
97
101
|
root_visible: true,
|
|
98
102
|
},
|
|
99
103
|
{
|
|
100
104
|
root_id: testUuid(5),
|
|
105
|
+
'root_$key_id': testUuid(5),
|
|
101
106
|
root_visible: true,
|
|
102
107
|
},
|
|
103
108
|
],
|
|
@@ -219,15 +224,17 @@ test('Categories with posts and author (many has many inverse + many has one)',
|
|
|
219
224
|
{
|
|
220
225
|
sql: SQL`select
|
|
221
226
|
"root_"."id" as "root_id",
|
|
222
|
-
"root_"."id" as "
|
|
227
|
+
"root_"."id" as "root_$key_id"
|
|
223
228
|
from "public"."category" as "root_"`,
|
|
224
229
|
response: {
|
|
225
230
|
rows: [
|
|
226
231
|
{
|
|
227
232
|
root_id: testUuid(1),
|
|
233
|
+
'root_$key_id': testUuid(1),
|
|
228
234
|
},
|
|
229
235
|
{
|
|
230
236
|
root_id: testUuid(2),
|
|
237
|
+
'root_$key_id': testUuid(2),
|
|
231
238
|
},
|
|
232
239
|
],
|
|
233
240
|
},
|
|
@@ -262,7 +269,7 @@ test('Categories with posts and author (many has many inverse + many has one)',
|
|
|
262
269
|
},
|
|
263
270
|
{
|
|
264
271
|
sql: SQL`select
|
|
265
|
-
"root_"."author_id" as "
|
|
272
|
+
"root_"."author_id" as "root_$key_author",
|
|
266
273
|
"root_"."id" as "root_id"
|
|
267
274
|
from "public"."post" as "root_"
|
|
268
275
|
where "root_"."id" in (?, ?, ?)
|
|
@@ -272,22 +279,22 @@ test('Categories with posts and author (many has many inverse + many has one)',
|
|
|
272
279
|
rows: [
|
|
273
280
|
{
|
|
274
281
|
root_id: testUuid(3),
|
|
275
|
-
|
|
282
|
+
'root_$key_author': testUuid(6),
|
|
276
283
|
},
|
|
277
284
|
{
|
|
278
285
|
root_id: testUuid(4),
|
|
279
|
-
|
|
286
|
+
'root_$key_author': testUuid(7),
|
|
280
287
|
},
|
|
281
288
|
{
|
|
282
289
|
root_id: testUuid(5),
|
|
283
|
-
|
|
290
|
+
'root_$key_author': testUuid(7),
|
|
284
291
|
},
|
|
285
292
|
],
|
|
286
293
|
},
|
|
287
294
|
},
|
|
288
295
|
{
|
|
289
296
|
sql: SQL`select
|
|
290
|
-
"root_"."id" as "
|
|
297
|
+
"root_"."id" as "root_$index_id",
|
|
291
298
|
"root_"."name" as "root_name",
|
|
292
299
|
"root_"."id" as "root_id"
|
|
293
300
|
from "public"."author" as "root_"
|
|
@@ -298,10 +305,12 @@ test('Categories with posts and author (many has many inverse + many has one)',
|
|
|
298
305
|
rows: [
|
|
299
306
|
{
|
|
300
307
|
root_id: testUuid(6),
|
|
308
|
+
'root_$index_id': testUuid(6),
|
|
301
309
|
root_name: 'John',
|
|
302
310
|
},
|
|
303
311
|
{
|
|
304
312
|
root_id: testUuid(7),
|
|
313
|
+
'root_$index_id': testUuid(7),
|
|
305
314
|
root_name: 'Jack',
|
|
306
315
|
},
|
|
307
316
|
],
|
|
@@ -30,10 +30,10 @@ test('Tags with paginated posts (many has many inverse)', async () => {
|
|
|
30
30
|
executes: [
|
|
31
31
|
{
|
|
32
32
|
sql: SQL`select "root_"."id" as "root_id",
|
|
33
|
-
"root_"."id" as "
|
|
33
|
+
"root_"."id" as "root_$key_id"
|
|
34
34
|
from "public"."tag" as "root_"`,
|
|
35
35
|
response: {
|
|
36
|
-
rows: [{ root_id: testUuid(1) }, { root_id: testUuid(2) }],
|
|
36
|
+
rows: [{ root_id: testUuid(1), 'root_$key_id': testUuid(1) }, { root_id: testUuid(2), 'root_$key_id': testUuid(2) }],
|
|
37
37
|
},
|
|
38
38
|
},
|
|
39
39
|
{
|
|
@@ -135,10 +135,10 @@ test('empty many-has-many inverse relation', async () => {
|
|
|
135
135
|
executes: [
|
|
136
136
|
{
|
|
137
137
|
sql: SQL`select "root_"."id" as "root_id",
|
|
138
|
-
"root_"."id" as "
|
|
138
|
+
"root_"."id" as "root_$key_id"
|
|
139
139
|
from "public"."tag" as "root_"`,
|
|
140
140
|
response: {
|
|
141
|
-
rows: [{ root_id: testUuid(1) }, { root_id: testUuid(2) }],
|
|
141
|
+
rows: [{ root_id: testUuid(1), 'root_$key_id': testUuid(1) }, { root_id: testUuid(2), 'root_$key_id': testUuid(2) }],
|
|
142
142
|
},
|
|
143
143
|
},
|
|
144
144
|
{
|
|
@@ -185,10 +185,10 @@ test('Posts with filtered tags', async () => {
|
|
|
185
185
|
executes: [
|
|
186
186
|
{
|
|
187
187
|
sql: SQL`select "root_"."id" as "root_id",
|
|
188
|
-
"root_"."id" as "
|
|
188
|
+
"root_"."id" as "root_$key_id"
|
|
189
189
|
from "public"."post" as "root_"`,
|
|
190
190
|
response: {
|
|
191
|
-
rows: [{ root_id: testUuid(1) }, { root_id: testUuid(2) }],
|
|
191
|
+
rows: [{ root_id: testUuid(1), 'root_$key_id': testUuid(1) }, { root_id: testUuid(2), 'root_$key_id': testUuid(2) }],
|
|
192
192
|
},
|
|
193
193
|
},
|
|
194
194
|
{
|
|
@@ -23,10 +23,10 @@ test('Posts with filtered tags', async () => {
|
|
|
23
23
|
executes: [
|
|
24
24
|
{
|
|
25
25
|
sql: SQL`select "root_"."id" as "root_id",
|
|
26
|
-
"root_"."id" as "
|
|
26
|
+
"root_"."id" as "root_$key_id"
|
|
27
27
|
from "public"."post" as "root_"`,
|
|
28
28
|
response: {
|
|
29
|
-
rows: [{ root_id: testUuid(1) }, { root_id: testUuid(2) }],
|
|
29
|
+
rows: [{ root_id: testUuid(1), 'root_$key_id': testUuid(1) }, { root_id: testUuid(2), 'root_$key_id': testUuid(2) }],
|
|
30
30
|
},
|
|
31
31
|
},
|
|
32
32
|
{
|
|
@@ -105,10 +105,10 @@ test('Posts with paginated tags (many has many owning)', async () => {
|
|
|
105
105
|
executes: [
|
|
106
106
|
{
|
|
107
107
|
sql: SQL`select "root_"."id" as "root_id",
|
|
108
|
-
"root_"."id" as "
|
|
108
|
+
"root_"."id" as "root_$key_id"
|
|
109
109
|
from "public"."post" as "root_"`,
|
|
110
110
|
response: {
|
|
111
|
-
rows: [{ root_id: testUuid(1) }, { root_id: testUuid(2) }],
|
|
111
|
+
rows: [{ root_id: testUuid(1), 'root_$key_id': testUuid(1) }, { root_id: testUuid(2), 'root_$key_id': testUuid(2) }],
|
|
112
112
|
},
|
|
113
113
|
},
|
|
114
114
|
{
|
|
@@ -211,10 +211,10 @@ test('large number of posts - use array', async () => {
|
|
|
211
211
|
executes: [
|
|
212
212
|
{
|
|
213
213
|
sql: SQL`select "root_"."id" as "root_id",
|
|
214
|
-
"root_"."id" as "
|
|
214
|
+
"root_"."id" as "root_$key_id"
|
|
215
215
|
from "public"."post" as "root_"`,
|
|
216
216
|
response: {
|
|
217
|
-
rows: ids.map(id => ({ root_id: id })),
|
|
217
|
+
rows: ids.map(id => ({ root_id: id, 'root_$key_id': id })),
|
|
218
218
|
},
|
|
219
219
|
},
|
|
220
220
|
{
|
|
@@ -26,18 +26,18 @@ test('Post with author query (many has one)', async () => {
|
|
|
26
26
|
sql: SQL`
|
|
27
27
|
select
|
|
28
28
|
"root_"."id" as "root_id",
|
|
29
|
-
"root_"."author_id" as "
|
|
29
|
+
"root_"."author_id" as "root_$key_author"
|
|
30
30
|
from "public"."post" as "root_"
|
|
31
31
|
`,
|
|
32
32
|
response: {
|
|
33
33
|
rows: [
|
|
34
34
|
{
|
|
35
35
|
root_id: testUuid(1),
|
|
36
|
-
|
|
36
|
+
'root_$key_author': testUuid(2),
|
|
37
37
|
},
|
|
38
38
|
{
|
|
39
39
|
root_id: testUuid(3),
|
|
40
|
-
|
|
40
|
+
'root_$key_author': testUuid(4),
|
|
41
41
|
},
|
|
42
42
|
],
|
|
43
43
|
},
|
|
@@ -45,7 +45,7 @@ test('Post with author query (many has one)', async () => {
|
|
|
45
45
|
{
|
|
46
46
|
sql: SQL`
|
|
47
47
|
select
|
|
48
|
-
"root_"."id" as "
|
|
48
|
+
"root_"."id" as "root_$index_id",
|
|
49
49
|
"root_"."id" as "root_id",
|
|
50
50
|
"root_"."name" as "root_name"
|
|
51
51
|
from "public"."author" as "root_"
|
|
@@ -56,10 +56,12 @@ test('Post with author query (many has one)', async () => {
|
|
|
56
56
|
rows: [
|
|
57
57
|
{
|
|
58
58
|
root_id: testUuid(2),
|
|
59
|
+
'root_$index_id': testUuid(2),
|
|
59
60
|
root_name: 'John',
|
|
60
61
|
},
|
|
61
62
|
{
|
|
62
63
|
root_id: testUuid(4),
|
|
64
|
+
'root_$index_id': testUuid(4),
|
|
63
65
|
root_name: 'Jack',
|
|
64
66
|
},
|
|
65
67
|
],
|
|
@@ -110,7 +112,7 @@ test('Post with author query with no result', async () => {
|
|
|
110
112
|
sql: SQL`
|
|
111
113
|
select
|
|
112
114
|
"root_"."id" as "root_id",
|
|
113
|
-
"root_"."author_id" as "
|
|
115
|
+
"root_"."author_id" as "root_$key_author"
|
|
114
116
|
from "public"."post" as "root_"
|
|
115
117
|
`,
|
|
116
118
|
response: {
|
|
@@ -145,24 +147,24 @@ test('Post with author filtered by name (where many has one)', async () => {
|
|
|
145
147
|
{
|
|
146
148
|
sql: SQL`select
|
|
147
149
|
"root_"."id" as "root_id",
|
|
148
|
-
"root_"."author_id" as "
|
|
150
|
+
"root_"."author_id" as "root_$key_author"
|
|
149
151
|
from "public"."post" as "root_"`,
|
|
150
152
|
response: {
|
|
151
153
|
rows: [
|
|
152
154
|
{
|
|
153
155
|
root_id: testUuid(1),
|
|
154
|
-
|
|
156
|
+
'root_$key_author': testUuid(2),
|
|
155
157
|
},
|
|
156
158
|
{
|
|
157
159
|
root_id: testUuid(3),
|
|
158
|
-
|
|
160
|
+
'root_$key_author': testUuid(4),
|
|
159
161
|
},
|
|
160
162
|
],
|
|
161
163
|
},
|
|
162
164
|
},
|
|
163
165
|
{
|
|
164
166
|
sql: SQL`select
|
|
165
|
-
"root_"."id" as "
|
|
167
|
+
"root_"."id" as "root_$index_id",
|
|
166
168
|
"root_"."id" as "root_id"
|
|
167
169
|
from "public"."author" as "root_"
|
|
168
170
|
where "root_"."id" in (?, ?) and "root_"."name" = ?`,
|
|
@@ -171,6 +173,7 @@ test('Post with author filtered by name (where many has one)', async () => {
|
|
|
171
173
|
rows: [
|
|
172
174
|
{
|
|
173
175
|
root_id: testUuid(2),
|
|
176
|
+
'root_$index_id': testUuid(2),
|
|
174
177
|
},
|
|
175
178
|
],
|
|
176
179
|
},
|
|
@@ -30,9 +30,9 @@ test('Posts with locales query (one has many)', async () => {
|
|
|
30
30
|
{
|
|
31
31
|
sql: SQL`select
|
|
32
32
|
"root_"."id" as "root_id",
|
|
33
|
-
"root_"."id" as "
|
|
33
|
+
"root_"."id" as "root_$key_id"
|
|
34
34
|
from "public"."post" as "root_"`,
|
|
35
|
-
response: { rows: [{ root_id: testUuid(1) }, { root_id: testUuid(2) }] },
|
|
35
|
+
response: { rows: [{ root_id: testUuid(1), 'root_$key_id': testUuid(1) }, { root_id: testUuid(2), 'root_$key_id': testUuid(2) }] },
|
|
36
36
|
},
|
|
37
37
|
{
|
|
38
38
|
sql: SQL`select
|
|
@@ -111,10 +111,10 @@ test('Posts with locales query with where (one has many)', async () => {
|
|
|
111
111
|
{
|
|
112
112
|
sql: SQL`select
|
|
113
113
|
"root_"."id" as "root_id",
|
|
114
|
-
"root_"."id" as "
|
|
114
|
+
"root_"."id" as "root_$key_id"
|
|
115
115
|
from "public"."post" as "root_"`,
|
|
116
116
|
response: {
|
|
117
|
-
rows: [{ root_id: testUuid(1) }, { root_id: testUuid(2) }],
|
|
117
|
+
rows: [{ root_id: testUuid(1), 'root_$key_id': testUuid(1) }, { root_id: testUuid(2), 'root_$key_id': testUuid(2) }],
|
|
118
118
|
},
|
|
119
119
|
},
|
|
120
120
|
{
|
|
@@ -190,10 +190,10 @@ test('Posts with paginated comments (one has many)', async () => {
|
|
|
190
190
|
{
|
|
191
191
|
sql: SQL`select
|
|
192
192
|
"root_"."id" as "root_id",
|
|
193
|
-
"root_"."id" as "
|
|
193
|
+
"root_"."id" as "root_$key_id"
|
|
194
194
|
from "public"."post" as "root_"`,
|
|
195
195
|
response: {
|
|
196
|
-
rows: [{ root_id: testUuid(1) }, { root_id: testUuid(2) }],
|
|
196
|
+
rows: [{ root_id: testUuid(1), 'root_$key_id': testUuid(1) }, { root_id: testUuid(2), 'root_$key_id': testUuid(2) }],
|
|
197
197
|
},
|
|
198
198
|
},
|
|
199
199
|
{
|
|
@@ -288,10 +288,10 @@ test('Posts with comment count (one has many)', async () => {
|
|
|
288
288
|
{
|
|
289
289
|
sql: SQL`select
|
|
290
290
|
"root_"."id" as "root_id",
|
|
291
|
-
"root_"."id" as "
|
|
291
|
+
"root_"."id" as "root_$key_id"
|
|
292
292
|
from "public"."post" as "root_"`,
|
|
293
293
|
response: {
|
|
294
|
-
rows: [{ root_id: testUuid(1) }, { root_id: testUuid(2) }],
|
|
294
|
+
rows: [{ root_id: testUuid(1), 'root_$key_id': testUuid(1) }, { root_id: testUuid(2), 'root_$key_id': testUuid(2) }],
|
|
295
295
|
},
|
|
296
296
|
},
|
|
297
297
|
{
|
|
@@ -358,10 +358,10 @@ test('Posts with paginated comments without count (one has many)', async () => {
|
|
|
358
358
|
{
|
|
359
359
|
sql: SQL`select
|
|
360
360
|
"root_"."id" as "root_id",
|
|
361
|
-
"root_"."id" as "
|
|
361
|
+
"root_"."id" as "root_$key_id"
|
|
362
362
|
from "public"."post" as "root_"`,
|
|
363
363
|
response: {
|
|
364
|
-
rows: [{ root_id: testUuid(1) }, { root_id: testUuid(2) }],
|
|
364
|
+
rows: [{ root_id: testUuid(1), 'root_$key_id': testUuid(1) }, { root_id: testUuid(2), 'root_$key_id': testUuid(2) }],
|
|
365
365
|
},
|
|
366
366
|
},
|
|
367
367
|
{
|
|
@@ -441,10 +441,10 @@ test('Posts with paginated comments (one has many)', async () => {
|
|
|
441
441
|
{
|
|
442
442
|
sql: SQL`select
|
|
443
443
|
"root_"."id" as "root_id",
|
|
444
|
-
"root_"."id" as "
|
|
444
|
+
"root_"."id" as "root_$key_id"
|
|
445
445
|
from "public"."post" as "root_"`,
|
|
446
446
|
response: {
|
|
447
|
-
rows: [{ root_id: testUuid(1) }],
|
|
447
|
+
rows: [{ root_id: testUuid(1), 'root_$key_id': testUuid(1) }],
|
|
448
448
|
},
|
|
449
449
|
},
|
|
450
450
|
{
|
|
@@ -29,16 +29,18 @@ test('Settings with sites (one-has-one inverse)', async () => {
|
|
|
29
29
|
sql: SQL`select
|
|
30
30
|
"root_"."id" as "root_id",
|
|
31
31
|
"root_"."url" as "root_url",
|
|
32
|
-
"root_"."id" as "
|
|
32
|
+
"root_"."id" as "root_$key_id"
|
|
33
33
|
from "public"."site_setting" as "root_"`,
|
|
34
34
|
response: {
|
|
35
35
|
rows: [
|
|
36
36
|
{
|
|
37
37
|
root_id: testUuid(1),
|
|
38
|
+
'root_$key_id': testUuid(1),
|
|
38
39
|
root_url: 'http://site1.cz',
|
|
39
40
|
},
|
|
40
41
|
{
|
|
41
42
|
root_id: testUuid(3),
|
|
43
|
+
'root_$key_id': testUuid(3),
|
|
42
44
|
root_url: 'http://site2.cz',
|
|
43
45
|
},
|
|
44
46
|
],
|
|
@@ -46,7 +48,7 @@ test('Settings with sites (one-has-one inverse)', async () => {
|
|
|
46
48
|
},
|
|
47
49
|
{
|
|
48
50
|
sql: SQL`select
|
|
49
|
-
"root_"."setting_id" as "
|
|
51
|
+
"root_"."setting_id" as "root_$index_setting",
|
|
50
52
|
"root_"."id" as "root_id",
|
|
51
53
|
"root_"."name" as "root_name"
|
|
52
54
|
from "public"."site" as "root_"
|
|
@@ -56,12 +58,12 @@ test('Settings with sites (one-has-one inverse)', async () => {
|
|
|
56
58
|
rows: [
|
|
57
59
|
{
|
|
58
60
|
root_id: testUuid(2),
|
|
59
|
-
|
|
61
|
+
'root_$index_setting': testUuid(1),
|
|
60
62
|
root_name: 'Site 1',
|
|
61
63
|
},
|
|
62
64
|
{
|
|
63
65
|
root_id: testUuid(4),
|
|
64
|
-
|
|
66
|
+
'root_$index_setting': testUuid(3),
|
|
65
67
|
root_name: 'Site 2',
|
|
66
68
|
},
|
|
67
69
|
],
|