@contember/engine-content-api 2.0.10 → 2.0.12
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/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/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 +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/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/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/tsconfig.tsbuildinfo +1 -1
- package/package.json +10 -10
- 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 +10 -5
- package/tests/cases/bugs/bug102.test.ts +4 -4
- package/tests/cases/integration/graphQlRequests/delete/deleteById.test.ts +7 -6
- package/tests/cases/integration/graphQlRequests/query/acl/differentRowAndFieldPredicate.test.ts +8 -8
- package/tests/cases/integration/graphQlRequests/query/acl/fieldRestrictedByLocale.test.ts +26 -24
- package/tests/cases/integration/graphQlRequests/query/acl/internalColumnAliases.test.ts +278 -0
- package/tests/cases/integration/graphQlRequests/query/acl/nestedPredicate.test.ts +11 -10
- package/tests/cases/integration/graphQlRequests/query/acl/predicateElimination.test.ts +7 -6
- package/tests/cases/integration/graphQlRequests/query/acl/relationAcl.test.ts +22 -19
- package/tests/cases/integration/graphQlRequests/query/acl/rowPredicateSubset.test.ts +12 -12
- package/tests/cases/integration/graphQlRequests/query/filter/backReferencedFilter.test.ts +5 -3
- package/tests/cases/integration/graphQlRequests/query/graphqlFeatures/alias.test.ts +6 -6
- 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 +13 -10
- package/tests/cases/integration/graphQlRequests/query/pagination/paginateAliased.test.ts +13 -10
- package/tests/cases/integration/graphQlRequests/query/relations/advanced.test.ts +34 -25
- 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 +21 -18
- package/tests/cases/integration/graphQlRequests/query/relations/oneHasMany.test.ts +12 -12
- package/tests/cases/integration/graphQlRequests/query/relations/oneHasOneInverse.test.ts +14 -12
- package/tests/cases/integration/graphQlRequests/query/relations/oneHasOneOwner.test.ts +14 -12
- package/tests/cases/integration/graphQlRequests/query/sorting/defaultOrdering.test.ts +4 -4
- package/tests/cases/integration/graphQlRequests/query/sorting/randomSort.test.ts +3 -3
- package/tests/cases/integration/graphQlRequests/query/sorting/sortedHasMany.test.ts +2 -2
- package/tests/cases/integration/graphQlRequests/query/view/view.test.ts +10 -10
- package/tests/cases/unit/mutationSqlError.test.ts +30 -0
- package/tests/cases/unit/pathAlias.test.ts +26 -0
|
@@ -73,26 +73,26 @@ test('querying post + author name', async () => {
|
|
|
73
73
|
{
|
|
74
74
|
sql: SQL`select
|
|
75
75
|
"root_"."id" as "root_id",
|
|
76
|
-
"root_"."author_id" as "
|
|
76
|
+
"root_"."author_id" as "root_$key_author"
|
|
77
77
|
from "public"."post" as "root_"`,
|
|
78
78
|
parameters: [],
|
|
79
79
|
response: {
|
|
80
80
|
rows: [
|
|
81
81
|
{
|
|
82
|
-
root_id: testUuid(1),
|
|
83
|
-
|
|
82
|
+
'root_id': testUuid(1),
|
|
83
|
+
'root_$key_author': testUuid(3),
|
|
84
84
|
},
|
|
85
85
|
{
|
|
86
|
-
root_id: testUuid(2),
|
|
87
|
-
|
|
86
|
+
'root_id': testUuid(2),
|
|
87
|
+
'root_$key_author': testUuid(4),
|
|
88
88
|
},
|
|
89
89
|
],
|
|
90
90
|
},
|
|
91
91
|
},
|
|
92
92
|
{
|
|
93
93
|
sql: SQL`SELECT
|
|
94
|
-
"root_"."id"
|
|
95
|
-
"root_country"."name" IN (?)
|
|
94
|
+
"root_"."id" as "root_$index_id",
|
|
95
|
+
"root_country"."name" IN (?) as "root_$predicate_countryPredicate",
|
|
96
96
|
"root_"."name" AS "root_name",
|
|
97
97
|
"root_"."id" AS "root_id"
|
|
98
98
|
FROM "public"."author" AS "root_"
|
|
@@ -102,9 +102,10 @@ test('querying post + author name', async () => {
|
|
|
102
102
|
response: {
|
|
103
103
|
rows: [
|
|
104
104
|
{
|
|
105
|
-
root_id: testUuid(3),
|
|
106
|
-
|
|
107
|
-
|
|
105
|
+
'root_id': testUuid(3),
|
|
106
|
+
'root_$index_id': testUuid(3),
|
|
107
|
+
'root_$predicate_countryPredicate': true,
|
|
108
|
+
'root_name': 'John',
|
|
108
109
|
},
|
|
109
110
|
],
|
|
110
111
|
},
|
|
@@ -86,27 +86,28 @@ test('predicate with OR', async () => {
|
|
|
86
86
|
}`,
|
|
87
87
|
executes: [
|
|
88
88
|
{
|
|
89
|
-
sql: SQL`SELECT "root_"."id" AS "root_id", "root_"."image_id"
|
|
89
|
+
sql: SQL`SELECT "root_"."id" AS "root_id", "root_"."image_id" as "root_$key_image"
|
|
90
90
|
FROM "public"."author" AS "root_"
|
|
91
91
|
WHERE "root_"."is_public" = ?`,
|
|
92
92
|
parameters: [true],
|
|
93
93
|
response: {
|
|
94
94
|
rows: [
|
|
95
95
|
{
|
|
96
|
-
root_id: testUuid(1),
|
|
97
|
-
|
|
96
|
+
'root_id': testUuid(1),
|
|
97
|
+
'root_$key_image': testUuid(2),
|
|
98
98
|
},
|
|
99
99
|
],
|
|
100
100
|
},
|
|
101
101
|
},
|
|
102
102
|
{
|
|
103
|
-
sql: `select "root_"."id" as "
|
|
103
|
+
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 (?)`,
|
|
104
104
|
parameters: [testUuid(2)],
|
|
105
105
|
response: {
|
|
106
106
|
rows: [
|
|
107
107
|
{
|
|
108
|
-
root_id: testUuid(2),
|
|
109
|
-
|
|
108
|
+
'root_id': testUuid(2),
|
|
109
|
+
'root_$index_id': testUuid(2),
|
|
110
|
+
'root_url': 'abcd',
|
|
110
111
|
},
|
|
111
112
|
],
|
|
112
113
|
},
|
|
@@ -51,33 +51,34 @@ test('can read same entity only over relation of some rows - many has one', asyn
|
|
|
51
51
|
}`,
|
|
52
52
|
executes: [
|
|
53
53
|
{
|
|
54
|
-
sql: SQL`select "root_"."title" as "root_title", "root_"."disclose_author" = ? as "
|
|
54
|
+
sql: 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"
|
|
55
55
|
from "public"."article" as "root_"`,
|
|
56
56
|
response: {
|
|
57
57
|
rows: [
|
|
58
58
|
{
|
|
59
|
-
root_id: testUuid(1),
|
|
60
|
-
root_title: 'Article A',
|
|
61
|
-
|
|
62
|
-
|
|
59
|
+
'root_id': testUuid(1),
|
|
60
|
+
'root_title': 'Article A',
|
|
61
|
+
'root_$predicate_discloseAuthor_eq_true': true,
|
|
62
|
+
'root_$key_author': testUuid(10),
|
|
63
63
|
},
|
|
64
64
|
{
|
|
65
|
-
root_id: testUuid(2),
|
|
66
|
-
root_title: 'Article B',
|
|
67
|
-
|
|
68
|
-
|
|
65
|
+
'root_id': testUuid(2),
|
|
66
|
+
'root_title': 'Article B',
|
|
67
|
+
'root_$predicate_discloseAuthor_eq_true': false,
|
|
68
|
+
'root_$key_author': testUuid(10),
|
|
69
69
|
},
|
|
70
70
|
],
|
|
71
71
|
},
|
|
72
72
|
},
|
|
73
73
|
{
|
|
74
|
-
sql: SQL`select "root_"."id" as "
|
|
74
|
+
sql: 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
|
-
root_id: testUuid(10),
|
|
80
|
-
|
|
79
|
+
'root_id': testUuid(10),
|
|
80
|
+
'root_$index_id': testUuid(10),
|
|
81
|
+
'root_name': 'John doe',
|
|
81
82
|
},
|
|
82
83
|
],
|
|
83
84
|
},
|
|
@@ -149,19 +150,21 @@ test('can read same entity only over relation of some rows - many has many', asy
|
|
|
149
150
|
}`,
|
|
150
151
|
executes: [
|
|
151
152
|
{
|
|
152
|
-
sql: SQL`select "root_"."title" as "root_title", "root_"."disclose_author" = ? as "
|
|
153
|
+
sql: 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"
|
|
153
154
|
from "public"."article" as "root_"`,
|
|
154
155
|
response: {
|
|
155
156
|
rows: [
|
|
156
157
|
{
|
|
157
|
-
root_id: testUuid(1),
|
|
158
|
-
|
|
159
|
-
|
|
158
|
+
'root_id': testUuid(1),
|
|
159
|
+
'root_$key_id': testUuid(1),
|
|
160
|
+
'root_title': 'Article A',
|
|
161
|
+
'root_$predicate_discloseAuthor_eq_true': true,
|
|
160
162
|
},
|
|
161
163
|
{
|
|
162
|
-
root_id: testUuid(2),
|
|
163
|
-
|
|
164
|
-
|
|
164
|
+
'root_id': testUuid(2),
|
|
165
|
+
'root_$key_id': testUuid(2),
|
|
166
|
+
'root_title': 'Article B',
|
|
167
|
+
'root_$predicate_discloseAuthor_eq_true': false,
|
|
165
168
|
},
|
|
166
169
|
],
|
|
167
170
|
},
|
|
@@ -55,9 +55,9 @@ test('row level predicate includes main predicate', async () => {
|
|
|
55
55
|
{
|
|
56
56
|
sql: SQL`SELECT
|
|
57
57
|
"root_"."id" AS "root_id",
|
|
58
|
-
TRUE
|
|
58
|
+
TRUE as "root_$predicate_isPublished_eq_true",
|
|
59
59
|
"root_"."title" AS "root_title",
|
|
60
|
-
"root_"."is_unlocked" = ?
|
|
60
|
+
"root_"."is_unlocked" = ? as "root_$predicate_and_isUnlocked_eq_true_isPubl",
|
|
61
61
|
"root_"."content" AS "root_content"
|
|
62
62
|
FROM "public"."article" AS "root_"
|
|
63
63
|
WHERE "root_"."is_published" = ?`,
|
|
@@ -65,18 +65,18 @@ test('row level predicate includes main predicate', async () => {
|
|
|
65
65
|
response: {
|
|
66
66
|
rows: [
|
|
67
67
|
{
|
|
68
|
-
root_id: testUuid(1),
|
|
69
|
-
|
|
70
|
-
root_title: 'Hello',
|
|
71
|
-
|
|
72
|
-
root_content: 'Foo bar',
|
|
68
|
+
'root_id': testUuid(1),
|
|
69
|
+
'root_$predicate_isPublished_eq_true': true,
|
|
70
|
+
'root_title': 'Hello',
|
|
71
|
+
'root_$predicate_and_isUnlocked_eq_true_isPubl': false,
|
|
72
|
+
'root_content': 'Foo bar',
|
|
73
73
|
},
|
|
74
74
|
{
|
|
75
|
-
root_id: testUuid(2),
|
|
76
|
-
|
|
77
|
-
root_title: 'Hello 2',
|
|
78
|
-
|
|
79
|
-
root_content: 'Lorem ipsum',
|
|
75
|
+
'root_id': testUuid(2),
|
|
76
|
+
'root_$predicate_isPublished_eq_true': true,
|
|
77
|
+
'root_title': 'Hello 2',
|
|
78
|
+
'root_$predicate_and_isUnlocked_eq_true_isPubl': true,
|
|
79
|
+
'root_content': 'Lorem ipsum',
|
|
80
80
|
},
|
|
81
81
|
],
|
|
82
82
|
},
|
|
@@ -24,15 +24,17 @@ test('Categories with children filtered by back-referenced parent', async () =>
|
|
|
24
24
|
{
|
|
25
25
|
sql: SQL`select
|
|
26
26
|
"root_"."id" as "root_id",
|
|
27
|
-
"root_"."id" as "
|
|
27
|
+
"root_"."id" as "root_$key_id"
|
|
28
28
|
from "public"."category" as "root_"`,
|
|
29
29
|
response: {
|
|
30
30
|
rows: [
|
|
31
31
|
{
|
|
32
|
-
root_id: testUuid(1),
|
|
32
|
+
'root_id': testUuid(1),
|
|
33
|
+
'root_$key_id': testUuid(1),
|
|
33
34
|
},
|
|
34
35
|
{
|
|
35
|
-
root_id: testUuid(2),
|
|
36
|
+
'root_id': testUuid(2),
|
|
37
|
+
'root_$key_id': testUuid(2),
|
|
36
38
|
},
|
|
37
39
|
],
|
|
38
40
|
},
|
|
@@ -81,18 +81,18 @@ 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'],
|
|
88
88
|
response: {
|
|
89
89
|
rows: [
|
|
90
90
|
{
|
|
91
|
-
root_id: testUuid(1),
|
|
92
|
-
root_idx: testUuid(1),
|
|
93
|
-
root_name1: 'John',
|
|
94
|
-
root_name2: 'John',
|
|
95
|
-
|
|
91
|
+
'root_id': testUuid(1),
|
|
92
|
+
'root_idx': testUuid(1),
|
|
93
|
+
'root_name1': 'John',
|
|
94
|
+
'root_name2': 'John',
|
|
95
|
+
'root_$predicate_name_eq': true,
|
|
96
96
|
},
|
|
97
97
|
],
|
|
98
98
|
},
|
|
@@ -43,11 +43,11 @@ test('fragments', async () => {
|
|
|
43
43
|
sql: SQL`select
|
|
44
44
|
"root_"."id" as "root_id",
|
|
45
45
|
"root_"."name" as "root_name",
|
|
46
|
-
"root_"."id" as "
|
|
46
|
+
"root_"."id" as "root_$key_id"
|
|
47
47
|
from "public"."author" as "root_"`,
|
|
48
48
|
parameters: [],
|
|
49
49
|
response: {
|
|
50
|
-
rows: [{ root_id: testUuid(1), root_name: 'John' }],
|
|
50
|
+
rows: [{ 'root_id': testUuid(1), 'root_$key_id': testUuid(1), 'root_name': 'John' }],
|
|
51
51
|
},
|
|
52
52
|
},
|
|
53
53
|
{
|
|
@@ -108,21 +108,21 @@ test('fragments merge', async () => {
|
|
|
108
108
|
}`,
|
|
109
109
|
executes: [
|
|
110
110
|
{
|
|
111
|
-
sql: `select "root_"."id" as "
|
|
111
|
+
sql: `select "root_"."id" as "root_$key_id", "root_"."id" as "root_id" from "public"."product" as "root_"`,
|
|
112
112
|
parameters: [],
|
|
113
|
-
response: { rows: [{ root_id: testUuid(1) }] },
|
|
113
|
+
response: { rows: [{ 'root_id': testUuid(1), 'root_$key_id': testUuid(1) }] },
|
|
114
114
|
},
|
|
115
115
|
{
|
|
116
|
-
sql: `select "root_"."product_id" as "__grouping_key", "root_"."name" as "root_name", "root_"."image_id" as "
|
|
116
|
+
sql: `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 (?)`,
|
|
117
117
|
parameters: [testUuid(1)],
|
|
118
118
|
response: {
|
|
119
|
-
rows: [{ __grouping_key: testUuid(1), root_name: 'foo', root_id: testUuid(2),
|
|
119
|
+
rows: [{ '__grouping_key': testUuid(1), 'root_name': 'foo', 'root_id': testUuid(2), 'root_$key_image': testUuid(3) }],
|
|
120
120
|
},
|
|
121
121
|
},
|
|
122
122
|
{
|
|
123
|
-
sql: `select "root_"."id" as "
|
|
123
|
+
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 (?)`,
|
|
124
124
|
parameters: [testUuid(3)],
|
|
125
|
-
response: { rows: [{ root_id: testUuid(3), root_url: 'abcd' }] },
|
|
125
|
+
response: { rows: [{ 'root_id': testUuid(3), 'root_$index_id': testUuid(3), 'root_url': 'abcd' }] },
|
|
126
126
|
},
|
|
127
127
|
],
|
|
128
128
|
return: {
|
|
@@ -34,24 +34,24 @@ test('reduced has many', async () => {
|
|
|
34
34
|
{
|
|
35
35
|
sql: SQL`select
|
|
36
36
|
"root_"."id" as "root_id",
|
|
37
|
-
"root_"."id" as "
|
|
37
|
+
"root_"."id" as "root_$key_id"
|
|
38
38
|
from "public"."post" as "root_"`,
|
|
39
39
|
parameters: [],
|
|
40
40
|
response: {
|
|
41
|
-
rows: [{ root_id: testUuid(1) }, { root_id: testUuid(2) }],
|
|
41
|
+
rows: [{ 'root_id': testUuid(1), 'root_$key_id': testUuid(1) }, { 'root_id': testUuid(2), 'root_$key_id': testUuid(2) }],
|
|
42
42
|
},
|
|
43
43
|
},
|
|
44
44
|
{
|
|
45
45
|
sql: SQL`select
|
|
46
|
-
"root_"."post_id" as "
|
|
46
|
+
"root_"."post_id" as "root_$index_post",
|
|
47
47
|
"root_"."id" as "root_id"
|
|
48
48
|
from "public"."post_locale" as "root_"
|
|
49
49
|
where "root_"."locale" = ? and "root_"."post_id" in (?, ?)`,
|
|
50
50
|
parameters: ['cs', testUuid(1), testUuid(2)],
|
|
51
51
|
response: {
|
|
52
52
|
rows: [
|
|
53
|
-
{
|
|
54
|
-
{
|
|
53
|
+
{ 'root_$index_post': testUuid(1), 'root_id': testUuid(11) },
|
|
54
|
+
{ 'root_$index_post': testUuid(2), 'root_id': testUuid(12) },
|
|
55
55
|
],
|
|
56
56
|
},
|
|
57
57
|
},
|
|
@@ -103,24 +103,24 @@ test('universal reduced has many', async () => {
|
|
|
103
103
|
{
|
|
104
104
|
sql: SQL`select
|
|
105
105
|
"root_"."id" as "root_id",
|
|
106
|
-
"root_"."id" as "
|
|
106
|
+
"root_"."id" as "root_$key_id"
|
|
107
107
|
from "public"."post" as "root_"`,
|
|
108
108
|
parameters: [],
|
|
109
109
|
response: {
|
|
110
|
-
rows: [{ root_id: testUuid(1) }, { root_id: testUuid(2) }],
|
|
110
|
+
rows: [{ 'root_id': testUuid(1), 'root_$key_id': testUuid(1) }, { 'root_id': testUuid(2), 'root_$key_id': testUuid(2) }],
|
|
111
111
|
},
|
|
112
112
|
},
|
|
113
113
|
{
|
|
114
114
|
sql: SQL`select
|
|
115
|
-
"root_"."post_id" as "
|
|
115
|
+
"root_"."post_id" as "root_$index_post",
|
|
116
116
|
"root_"."id" as "root_id"
|
|
117
117
|
from "public"."post_locale" as "root_"
|
|
118
118
|
where "root_"."locale" = ? and "root_"."post_id" in (?, ?)`,
|
|
119
119
|
parameters: ['cs', testUuid(1), testUuid(2)],
|
|
120
120
|
response: {
|
|
121
121
|
rows: [
|
|
122
|
-
{
|
|
123
|
-
{
|
|
122
|
+
{ 'root_$index_post': testUuid(1), 'root_id': testUuid(11) },
|
|
123
|
+
{ 'root_$index_post': testUuid(2), 'root_id': testUuid(12) },
|
|
124
124
|
],
|
|
125
125
|
},
|
|
126
126
|
},
|
|
@@ -33,13 +33,13 @@ test('many has many with where, limit and orderBy', async () => {
|
|
|
33
33
|
sql: SQL`select
|
|
34
34
|
"root_"."id" as "root_id",
|
|
35
35
|
"root_"."title" as "root_title",
|
|
36
|
-
"root_"."id" as "
|
|
36
|
+
"root_"."id" as "root_$key_id"
|
|
37
37
|
from "public"."category" as "root_"`,
|
|
38
38
|
parameters: [],
|
|
39
39
|
response: {
|
|
40
40
|
rows: [
|
|
41
|
-
{ root_id: testUuid(1), root_title: 'Hello' },
|
|
42
|
-
{ root_id: testUuid(2), root_title: 'World' },
|
|
41
|
+
{ 'root_id': testUuid(1), 'root_$key_id': testUuid(1), 'root_title': 'Hello' },
|
|
42
|
+
{ 'root_id': testUuid(2), 'root_$key_id': testUuid(2), 'root_title': 'World' },
|
|
43
43
|
],
|
|
44
44
|
},
|
|
45
45
|
},
|
|
@@ -156,13 +156,13 @@ test('one has many with where, limit and orderBy', async () => {
|
|
|
156
156
|
sql: SQL`select
|
|
157
157
|
"root_"."id" as "root_id",
|
|
158
158
|
"root_"."name" as "root_name",
|
|
159
|
-
"root_"."id" as "
|
|
159
|
+
"root_"."id" as "root_$key_id"
|
|
160
160
|
from "public"."author" as "root_"`,
|
|
161
161
|
parameters: [],
|
|
162
162
|
response: {
|
|
163
163
|
rows: [
|
|
164
|
-
{ root_id: testUuid(1), root_name: 'John' },
|
|
165
|
-
{ root_id: testUuid(2), root_name: 'Jack' },
|
|
164
|
+
{ 'root_id': testUuid(1), 'root_$key_id': testUuid(1), 'root_name': 'John' },
|
|
165
|
+
{ 'root_id': testUuid(2), 'root_$key_id': testUuid(2), 'root_name': 'Jack' },
|
|
166
166
|
],
|
|
167
167
|
},
|
|
168
168
|
},
|
|
@@ -241,8 +241,8 @@ test('one has many with nulls first in a limited page', async () => {
|
|
|
241
241
|
}`,
|
|
242
242
|
executes: [
|
|
243
243
|
{
|
|
244
|
-
sql: SQL`select "root_"."id" as "
|
|
245
|
-
response: { rows: [{ root_id: testUuid(1) }] },
|
|
244
|
+
sql: SQL`select "root_"."id" as "root_$key_id", "root_"."id" as "root_id" from "public"."author" as "root_"`,
|
|
245
|
+
response: { rows: [{ 'root_id': testUuid(1), 'root_$key_id': testUuid(1) }] },
|
|
246
246
|
},
|
|
247
247
|
{
|
|
248
248
|
sql: SQL`with "data" as
|
|
@@ -42,21 +42,23 @@ where "root_author"."name" = ?`,
|
|
|
42
42
|
response: { rows: [{ row_count: 10 }] },
|
|
43
43
|
},
|
|
44
44
|
{
|
|
45
|
-
sql: SQL`select "root_"."id" as "root_id", "root_"."title" as "root_title", "root_"."author_id" as "
|
|
45
|
+
sql: SQL`select "root_"."id" as "root_id", "root_"."title" as "root_title", "root_"."author_id" as "root_$key_author"
|
|
46
46
|
from "public"."post" as "root_"
|
|
47
47
|
left join "public"."author" as "root_author" on "root_"."author_id" = "root_author"."id"
|
|
48
48
|
where "root_author"."name" = ? order by "root_"."id" asc limit 2 offset 1`,
|
|
49
49
|
response: {
|
|
50
50
|
rows: [
|
|
51
51
|
{
|
|
52
|
-
root_id: testUuid(1),
|
|
53
|
-
root_title: 'Foo',
|
|
54
|
-
root_author: testUuid(2),
|
|
52
|
+
'root_id': testUuid(1),
|
|
53
|
+
'root_title': 'Foo',
|
|
54
|
+
'root_author': testUuid(2),
|
|
55
|
+
'root_$key_author': testUuid(2),
|
|
55
56
|
},
|
|
56
57
|
{
|
|
57
|
-
root_id: testUuid(3),
|
|
58
|
-
root_title: 'Bar',
|
|
59
|
-
root_author: testUuid(2),
|
|
58
|
+
'root_id': testUuid(3),
|
|
59
|
+
'root_title': 'Bar',
|
|
60
|
+
'root_author': testUuid(2),
|
|
61
|
+
'root_$key_author': testUuid(2),
|
|
60
62
|
},
|
|
61
63
|
],
|
|
62
64
|
},
|
|
@@ -64,7 +66,7 @@ where "root_author"."name" = ? order by "root_"."id" asc limit 2 offset 1`,
|
|
|
64
66
|
{
|
|
65
67
|
sql: SQL`
|
|
66
68
|
select
|
|
67
|
-
"root_"."id" as "
|
|
69
|
+
"root_"."id" as "root_$index_id",
|
|
68
70
|
"root_"."name" as "root_name",
|
|
69
71
|
"root_"."id" as "root_id"
|
|
70
72
|
from "public"."author" as "root_"
|
|
@@ -74,8 +76,9 @@ where "root_author"."name" = ? order by "root_"."id" asc limit 2 offset 1`,
|
|
|
74
76
|
response: {
|
|
75
77
|
rows: [
|
|
76
78
|
{
|
|
77
|
-
root_id: testUuid(2),
|
|
78
|
-
|
|
79
|
+
'root_id': testUuid(2),
|
|
80
|
+
'root_$index_id': testUuid(2),
|
|
81
|
+
'root_name': 'jack',
|
|
79
82
|
},
|
|
80
83
|
],
|
|
81
84
|
},
|
|
@@ -42,21 +42,23 @@ where "root_author"."name" = ?`,
|
|
|
42
42
|
response: { rows: [{ row_count: 10 }] },
|
|
43
43
|
},
|
|
44
44
|
{
|
|
45
|
-
sql: SQL`select "root_"."id" as "root_id", "root_"."title" as "root_title", "root_"."author_id" as "
|
|
45
|
+
sql: SQL`select "root_"."id" as "root_id", "root_"."title" as "root_title", "root_"."author_id" as "root_$key_author"
|
|
46
46
|
from "public"."post" as "root_"
|
|
47
47
|
left join "public"."author" as "root_author" on "root_"."author_id" = "root_author"."id"
|
|
48
48
|
where "root_author"."name" = ? order by "root_"."id" asc limit 2 offset 1`,
|
|
49
49
|
response: {
|
|
50
50
|
rows: [
|
|
51
51
|
{
|
|
52
|
-
root_id: testUuid(1),
|
|
53
|
-
root_title: 'Foo',
|
|
54
|
-
root_author: testUuid(2),
|
|
52
|
+
'root_id': testUuid(1),
|
|
53
|
+
'root_title': 'Foo',
|
|
54
|
+
'root_author': testUuid(2),
|
|
55
|
+
'root_$key_author': testUuid(2),
|
|
55
56
|
},
|
|
56
57
|
{
|
|
57
|
-
root_id: testUuid(3),
|
|
58
|
-
root_title: 'Bar',
|
|
59
|
-
root_author: testUuid(2),
|
|
58
|
+
'root_id': testUuid(3),
|
|
59
|
+
'root_title': 'Bar',
|
|
60
|
+
'root_author': testUuid(2),
|
|
61
|
+
'root_$key_author': testUuid(2),
|
|
60
62
|
},
|
|
61
63
|
],
|
|
62
64
|
},
|
|
@@ -64,7 +66,7 @@ where "root_author"."name" = ? order by "root_"."id" asc limit 2 offset 1`,
|
|
|
64
66
|
{
|
|
65
67
|
sql: SQL`
|
|
66
68
|
select
|
|
67
|
-
"root_"."id" as "
|
|
69
|
+
"root_"."id" as "root_$index_id",
|
|
68
70
|
"root_"."name" as "root_name",
|
|
69
71
|
"root_"."id" as "root_id"
|
|
70
72
|
from "public"."author" as "root_"
|
|
@@ -74,8 +76,9 @@ where "root_author"."name" = ? order by "root_"."id" asc limit 2 offset 1`,
|
|
|
74
76
|
response: {
|
|
75
77
|
rows: [
|
|
76
78
|
{
|
|
77
|
-
root_id: testUuid(2),
|
|
78
|
-
|
|
79
|
+
'root_id': testUuid(2),
|
|
80
|
+
'root_$index_id': testUuid(2),
|
|
81
|
+
'root_name': 'jack',
|
|
79
82
|
},
|
|
80
83
|
],
|
|
81
84
|
},
|
|
@@ -39,15 +39,17 @@ test('Posts with categories and its cz locale (many has many owning + one has ma
|
|
|
39
39
|
{
|
|
40
40
|
sql: SQL`select
|
|
41
41
|
"root_"."id" as "root_id",
|
|
42
|
-
"root_"."id" as "
|
|
42
|
+
"root_"."id" as "root_$key_id"
|
|
43
43
|
from "public"."post" as "root_"`,
|
|
44
44
|
response: {
|
|
45
45
|
rows: [
|
|
46
46
|
{
|
|
47
|
-
root_id: testUuid(1),
|
|
47
|
+
'root_id': testUuid(1),
|
|
48
|
+
'root_$key_id': testUuid(1),
|
|
48
49
|
},
|
|
49
50
|
{
|
|
50
|
-
root_id: testUuid(2),
|
|
51
|
+
'root_id': testUuid(2),
|
|
52
|
+
'root_$key_id': testUuid(2),
|
|
51
53
|
},
|
|
52
54
|
],
|
|
53
55
|
},
|
|
@@ -83,7 +85,7 @@ test('Posts with categories and its cz locale (many has many owning + one has ma
|
|
|
83
85
|
{
|
|
84
86
|
sql: SQL`select
|
|
85
87
|
"root_"."visible" as "root_visible",
|
|
86
|
-
"root_"."id" as "
|
|
88
|
+
"root_"."id" as "root_$key_id",
|
|
87
89
|
"root_"."id" as "root_id"
|
|
88
90
|
from "public"."category" as "root_"
|
|
89
91
|
where "root_"."id" in (?, ?, ?)`,
|
|
@@ -91,16 +93,19 @@ test('Posts with categories and its cz locale (many has many owning + one has ma
|
|
|
91
93
|
response: {
|
|
92
94
|
rows: [
|
|
93
95
|
{
|
|
94
|
-
root_id: testUuid(3),
|
|
95
|
-
|
|
96
|
+
'root_id': testUuid(3),
|
|
97
|
+
'root_$key_id': testUuid(3),
|
|
98
|
+
'root_visible': true,
|
|
96
99
|
},
|
|
97
100
|
{
|
|
98
|
-
root_id: testUuid(4),
|
|
99
|
-
|
|
101
|
+
'root_id': testUuid(4),
|
|
102
|
+
'root_$key_id': testUuid(4),
|
|
103
|
+
'root_visible': true,
|
|
100
104
|
},
|
|
101
105
|
{
|
|
102
|
-
root_id: testUuid(5),
|
|
103
|
-
|
|
106
|
+
'root_id': testUuid(5),
|
|
107
|
+
'root_$key_id': testUuid(5),
|
|
108
|
+
'root_visible': true,
|
|
104
109
|
},
|
|
105
110
|
],
|
|
106
111
|
},
|
|
@@ -222,15 +227,17 @@ test('Categories with posts and author (many has many inverse + many has one)',
|
|
|
222
227
|
{
|
|
223
228
|
sql: SQL`select
|
|
224
229
|
"root_"."id" as "root_id",
|
|
225
|
-
"root_"."id" as "
|
|
230
|
+
"root_"."id" as "root_$key_id"
|
|
226
231
|
from "public"."category" as "root_"`,
|
|
227
232
|
response: {
|
|
228
233
|
rows: [
|
|
229
234
|
{
|
|
230
|
-
root_id: testUuid(1),
|
|
235
|
+
'root_id': testUuid(1),
|
|
236
|
+
'root_$key_id': testUuid(1),
|
|
231
237
|
},
|
|
232
238
|
{
|
|
233
|
-
root_id: testUuid(2),
|
|
239
|
+
'root_id': testUuid(2),
|
|
240
|
+
'root_$key_id': testUuid(2),
|
|
234
241
|
},
|
|
235
242
|
],
|
|
236
243
|
},
|
|
@@ -265,7 +272,7 @@ test('Categories with posts and author (many has many inverse + many has one)',
|
|
|
265
272
|
},
|
|
266
273
|
{
|
|
267
274
|
sql: SQL`select
|
|
268
|
-
"root_"."author_id" as "
|
|
275
|
+
"root_"."author_id" as "root_$key_author",
|
|
269
276
|
"root_"."id" as "root_id"
|
|
270
277
|
from "public"."post" as "root_"
|
|
271
278
|
where "root_"."id" in (?, ?, ?)
|
|
@@ -274,23 +281,23 @@ test('Categories with posts and author (many has many inverse + many has one)',
|
|
|
274
281
|
response: {
|
|
275
282
|
rows: [
|
|
276
283
|
{
|
|
277
|
-
root_id: testUuid(3),
|
|
278
|
-
|
|
284
|
+
'root_id': testUuid(3),
|
|
285
|
+
'root_$key_author': testUuid(6),
|
|
279
286
|
},
|
|
280
287
|
{
|
|
281
|
-
root_id: testUuid(4),
|
|
282
|
-
|
|
288
|
+
'root_id': testUuid(4),
|
|
289
|
+
'root_$key_author': testUuid(7),
|
|
283
290
|
},
|
|
284
291
|
{
|
|
285
|
-
root_id: testUuid(5),
|
|
286
|
-
|
|
292
|
+
'root_id': testUuid(5),
|
|
293
|
+
'root_$key_author': testUuid(7),
|
|
287
294
|
},
|
|
288
295
|
],
|
|
289
296
|
},
|
|
290
297
|
},
|
|
291
298
|
{
|
|
292
299
|
sql: SQL`select
|
|
293
|
-
"root_"."id" as "
|
|
300
|
+
"root_"."id" as "root_$index_id",
|
|
294
301
|
"root_"."name" as "root_name",
|
|
295
302
|
"root_"."id" as "root_id"
|
|
296
303
|
from "public"."author" as "root_"
|
|
@@ -300,12 +307,14 @@ test('Categories with posts and author (many has many inverse + many has one)',
|
|
|
300
307
|
response: {
|
|
301
308
|
rows: [
|
|
302
309
|
{
|
|
303
|
-
root_id: testUuid(6),
|
|
304
|
-
|
|
310
|
+
'root_id': testUuid(6),
|
|
311
|
+
'root_$index_id': testUuid(6),
|
|
312
|
+
'root_name': 'John',
|
|
305
313
|
},
|
|
306
314
|
{
|
|
307
|
-
root_id: testUuid(7),
|
|
308
|
-
|
|
315
|
+
'root_id': testUuid(7),
|
|
316
|
+
'root_$index_id': testUuid(7),
|
|
317
|
+
'root_name': 'Jack',
|
|
309
318
|
},
|
|
310
319
|
],
|
|
311
320
|
},
|