@contember/engine-content-api 2.0.10 → 2.0.11

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.
Files changed (83) hide show
  1. package/dist/development/src/mapper/ErrorUtils.cjs +7 -1
  2. package/dist/development/src/mapper/ErrorUtils.cjs.map +1 -1
  3. package/dist/development/src/mapper/ErrorUtils.js +7 -1
  4. package/dist/development/src/mapper/ErrorUtils.js.map +1 -1
  5. package/dist/development/src/mapper/Mapper.cjs +2 -1
  6. package/dist/development/src/mapper/Mapper.cjs.map +1 -1
  7. package/dist/development/src/mapper/Mapper.js +2 -1
  8. package/dist/development/src/mapper/Mapper.js.map +1 -1
  9. package/dist/development/src/mapper/select/Path.cjs +23 -3
  10. package/dist/development/src/mapper/select/Path.cjs.map +1 -1
  11. package/dist/development/src/mapper/select/Path.js +23 -3
  12. package/dist/development/src/mapper/select/Path.js.map +1 -1
  13. package/dist/development/src/mapper/select/SelectBuilder.cjs +5 -5
  14. package/dist/development/src/mapper/select/SelectBuilder.cjs.map +1 -1
  15. package/dist/development/src/mapper/select/SelectBuilder.js +5 -5
  16. package/dist/development/src/mapper/select/SelectBuilder.js.map +1 -1
  17. package/dist/development/src/resolvers/MutationResolver.cjs +1 -0
  18. package/dist/development/src/resolvers/MutationResolver.cjs.map +1 -1
  19. package/dist/development/src/resolvers/MutationResolver.js +1 -0
  20. package/dist/development/src/resolvers/MutationResolver.js.map +1 -1
  21. package/dist/production/src/mapper/ErrorUtils.cjs +7 -1
  22. package/dist/production/src/mapper/ErrorUtils.cjs.map +1 -1
  23. package/dist/production/src/mapper/ErrorUtils.js +7 -1
  24. package/dist/production/src/mapper/ErrorUtils.js.map +1 -1
  25. package/dist/production/src/mapper/Mapper.cjs +2 -1
  26. package/dist/production/src/mapper/Mapper.cjs.map +1 -1
  27. package/dist/production/src/mapper/Mapper.js +2 -1
  28. package/dist/production/src/mapper/Mapper.js.map +1 -1
  29. package/dist/production/src/mapper/select/Path.cjs +23 -3
  30. package/dist/production/src/mapper/select/Path.cjs.map +1 -1
  31. package/dist/production/src/mapper/select/Path.js +23 -3
  32. package/dist/production/src/mapper/select/Path.js.map +1 -1
  33. package/dist/production/src/mapper/select/SelectBuilder.cjs +5 -5
  34. package/dist/production/src/mapper/select/SelectBuilder.cjs.map +1 -1
  35. package/dist/production/src/mapper/select/SelectBuilder.js +5 -5
  36. package/dist/production/src/mapper/select/SelectBuilder.js.map +1 -1
  37. package/dist/production/src/resolvers/MutationResolver.cjs +1 -0
  38. package/dist/production/src/resolvers/MutationResolver.cjs.map +1 -1
  39. package/dist/production/src/resolvers/MutationResolver.js +1 -0
  40. package/dist/production/src/resolvers/MutationResolver.js.map +1 -1
  41. package/dist/tests/cases/unit/mutationSqlError.test.d.ts +2 -0
  42. package/dist/tests/cases/unit/mutationSqlError.test.d.ts.map +1 -0
  43. package/dist/tests/cases/unit/pathAlias.test.d.ts +2 -0
  44. package/dist/tests/cases/unit/pathAlias.test.d.ts.map +1 -0
  45. package/dist/tests/tsconfig.tsbuildinfo +1 -1
  46. package/dist/types/mapper/ErrorUtils.d.ts.map +1 -1
  47. package/dist/types/mapper/select/Path.d.ts +1 -0
  48. package/dist/types/mapper/select/Path.d.ts.map +1 -1
  49. package/dist/types/mapper/select/SelectBuilder.d.ts.map +1 -1
  50. package/dist/types/tsconfig.tsbuildinfo +1 -1
  51. package/package.json +10 -10
  52. package/src/mapper/ErrorUtils.ts +11 -1
  53. package/src/mapper/Mapper.ts +1 -1
  54. package/src/mapper/select/Path.ts +25 -5
  55. package/src/mapper/select/SelectBuilder.ts +10 -5
  56. package/tests/cases/bugs/bug102.test.ts +4 -4
  57. package/tests/cases/integration/graphQlRequests/delete/deleteById.test.ts +7 -6
  58. package/tests/cases/integration/graphQlRequests/query/acl/differentRowAndFieldPredicate.test.ts +8 -8
  59. package/tests/cases/integration/graphQlRequests/query/acl/fieldRestrictedByLocale.test.ts +26 -24
  60. package/tests/cases/integration/graphQlRequests/query/acl/nestedPredicate.test.ts +11 -10
  61. package/tests/cases/integration/graphQlRequests/query/acl/predicateElimination.test.ts +7 -6
  62. package/tests/cases/integration/graphQlRequests/query/acl/relationAcl.test.ts +22 -19
  63. package/tests/cases/integration/graphQlRequests/query/acl/rowPredicateSubset.test.ts +12 -12
  64. package/tests/cases/integration/graphQlRequests/query/filter/backReferencedFilter.test.ts +5 -3
  65. package/tests/cases/integration/graphQlRequests/query/graphqlFeatures/alias.test.ts +6 -6
  66. package/tests/cases/integration/graphQlRequests/query/graphqlFeatures/fragments.test.ts +8 -8
  67. package/tests/cases/integration/graphQlRequests/query/misc/reducedHasMany.test.ts +10 -10
  68. package/tests/cases/integration/graphQlRequests/query/pagination/hasManyLimit.test.ts +8 -8
  69. package/tests/cases/integration/graphQlRequests/query/pagination/paginate.test.ts +13 -10
  70. package/tests/cases/integration/graphQlRequests/query/pagination/paginateAliased.test.ts +13 -10
  71. package/tests/cases/integration/graphQlRequests/query/relations/advanced.test.ts +34 -25
  72. package/tests/cases/integration/graphQlRequests/query/relations/manyHasManyInverse.test.ts +6 -6
  73. package/tests/cases/integration/graphQlRequests/query/relations/manyHasManyOwning.test.ts +6 -6
  74. package/tests/cases/integration/graphQlRequests/query/relations/manyHasOne.test.ts +21 -18
  75. package/tests/cases/integration/graphQlRequests/query/relations/oneHasMany.test.ts +12 -12
  76. package/tests/cases/integration/graphQlRequests/query/relations/oneHasOneInverse.test.ts +14 -12
  77. package/tests/cases/integration/graphQlRequests/query/relations/oneHasOneOwner.test.ts +14 -12
  78. package/tests/cases/integration/graphQlRequests/query/sorting/defaultOrdering.test.ts +4 -4
  79. package/tests/cases/integration/graphQlRequests/query/sorting/randomSort.test.ts +3 -3
  80. package/tests/cases/integration/graphQlRequests/query/sorting/sortedHasMany.test.ts +2 -2
  81. package/tests/cases/integration/graphQlRequests/query/view/view.test.ts +10 -10
  82. package/tests/cases/unit/mutationSqlError.test.ts +30 -0
  83. package/tests/cases/unit/pathAlias.test.ts +26 -0
@@ -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 "root_id"
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 "root_id", "root_"."id" as "root_id" from "public"."product" as "root_"`,
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 "root_image", "root_"."id" as "root_id" from "public"."product_locale" as "root_" where "root_"."product_id" in (?)`,
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), root_image: testUuid(3) }],
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 "root_id", "root_"."url" as "root_url", "root_"."id" as "root_id" from "public"."image" as "root_" where "root_"."id" in (?)`,
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 "root_id"
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 "root_post",
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
- { root_post: testUuid(1), root_id: testUuid(11) },
54
- { root_post: testUuid(2), root_id: testUuid(12) },
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 "root_id"
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 "root_post",
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
- { root_post: testUuid(1), root_id: testUuid(11) },
123
- { root_post: testUuid(2), root_id: testUuid(12) },
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 "root_id"
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 "root_id"
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 "root_id", "root_"."id" as "root_id" from "public"."author" as "root_"`,
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 "root_author"
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 "root_id",
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
- root_name: 'jack',
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 "root_author"
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 "root_id",
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
- root_name: 'jack',
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 "root_id"
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 "root_id",
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
- root_visible: true,
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
- root_visible: true,
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
- root_visible: true,
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 "root_id"
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 "root_author",
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
- root_author: testUuid(6),
284
+ 'root_id': testUuid(3),
285
+ 'root_$key_author': testUuid(6),
279
286
  },
280
287
  {
281
- root_id: testUuid(4),
282
- root_author: testUuid(7),
288
+ 'root_id': testUuid(4),
289
+ 'root_$key_author': testUuid(7),
283
290
  },
284
291
  {
285
- root_id: testUuid(5),
286
- root_author: testUuid(7),
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 "root_id",
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
- root_name: 'John',
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
- root_name: 'Jack',
315
+ 'root_id': testUuid(7),
316
+ 'root_$index_id': testUuid(7),
317
+ 'root_name': 'Jack',
309
318
  },
310
319
  ],
311
320
  },
@@ -32,10 +32,10 @@ test('Tags with paginated posts (many has many inverse)', async () => {
32
32
  executes: [
33
33
  {
34
34
  sql: SQL`select "root_"."id" as "root_id",
35
- "root_"."id" as "root_id"
35
+ "root_"."id" as "root_$key_id"
36
36
  from "public"."tag" as "root_"`,
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
  {
@@ -139,10 +139,10 @@ test('empty many-has-many inverse relation', async () => {
139
139
  executes: [
140
140
  {
141
141
  sql: SQL`select "root_"."id" as "root_id",
142
- "root_"."id" as "root_id"
142
+ "root_"."id" as "root_$key_id"
143
143
  from "public"."tag" as "root_"`,
144
144
  response: {
145
- rows: [{ root_id: testUuid(1) }, { root_id: testUuid(2) }],
145
+ rows: [{ 'root_id': testUuid(1), 'root_$key_id': testUuid(1) }, { 'root_id': testUuid(2), 'root_$key_id': testUuid(2) }],
146
146
  },
147
147
  },
148
148
  {
@@ -190,10 +190,10 @@ test('Posts with filtered tags', async () => {
190
190
  executes: [
191
191
  {
192
192
  sql: SQL`select "root_"."id" as "root_id",
193
- "root_"."id" as "root_id"
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
  {
@@ -24,10 +24,10 @@ test('Posts with filtered tags', async () => {
24
24
  executes: [
25
25
  {
26
26
  sql: SQL`select "root_"."id" as "root_id",
27
- "root_"."id" as "root_id"
27
+ "root_"."id" as "root_$key_id"
28
28
  from "public"."post" as "root_"`,
29
29
  response: {
30
- rows: [{ root_id: testUuid(1) }, { root_id: testUuid(2) }],
30
+ rows: [{ 'root_id': testUuid(1), 'root_$key_id': testUuid(1) }, { 'root_id': testUuid(2), 'root_$key_id': testUuid(2) }],
31
31
  },
32
32
  },
33
33
  {
@@ -107,10 +107,10 @@ test('Posts with paginated tags (many has many owning)', async () => {
107
107
  executes: [
108
108
  {
109
109
  sql: SQL`select "root_"."id" as "root_id",
110
- "root_"."id" as "root_id"
110
+ "root_"."id" as "root_$key_id"
111
111
  from "public"."post" as "root_"`,
112
112
  response: {
113
- rows: [{ root_id: testUuid(1) }, { root_id: testUuid(2) }],
113
+ rows: [{ 'root_id': testUuid(1), 'root_$key_id': testUuid(1) }, { 'root_id': testUuid(2), 'root_$key_id': testUuid(2) }],
114
114
  },
115
115
  },
116
116
  {
@@ -214,10 +214,10 @@ test.only('large number of posts - use array', async () => {
214
214
  executes: [
215
215
  {
216
216
  sql: SQL`select "root_"."id" as "root_id",
217
- "root_"."id" as "root_id"
217
+ "root_"."id" as "root_$key_id"
218
218
  from "public"."post" as "root_"`,
219
219
  response: {
220
- rows: ids.map(id => ({ root_id: id })),
220
+ rows: ids.map(id => ({ 'root_id': id, 'root_$key_id': id })),
221
221
  },
222
222
  },
223
223
  {
@@ -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 "root_author"
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
- root_id: testUuid(1),
36
- root_author: testUuid(2),
35
+ 'root_id': testUuid(1),
36
+ 'root_$key_author': testUuid(2),
37
37
  },
38
38
  {
39
- root_id: testUuid(3),
40
- root_author: testUuid(4),
39
+ 'root_id': testUuid(3),
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 "root_id",
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_"
@@ -55,12 +55,14 @@ test('Post with author query (many has one)', async () => {
55
55
  response: {
56
56
  rows: [
57
57
  {
58
- root_id: testUuid(2),
59
- root_name: 'John',
58
+ 'root_id': testUuid(2),
59
+ 'root_$index_id': testUuid(2),
60
+ 'root_name': 'John',
60
61
  },
61
62
  {
62
- root_id: testUuid(4),
63
- root_name: 'Jack',
63
+ 'root_id': testUuid(4),
64
+ 'root_$index_id': testUuid(4),
65
+ 'root_name': 'Jack',
64
66
  },
65
67
  ],
66
68
  },
@@ -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 "root_author"
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 "root_author"
150
+ "root_"."author_id" as "root_$key_author"
149
151
  from "public"."post" as "root_"`,
150
152
  response: {
151
153
  rows: [
152
154
  {
153
- root_id: testUuid(1),
154
- root_author: testUuid(2),
155
+ 'root_id': testUuid(1),
156
+ 'root_$key_author': testUuid(2),
155
157
  },
156
158
  {
157
- root_id: testUuid(3),
158
- root_author: testUuid(4),
159
+ 'root_id': testUuid(3),
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 "root_id",
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" = ?`,
@@ -170,7 +172,8 @@ test('Post with author filtered by name (where many has one)', async () => {
170
172
  response: {
171
173
  rows: [
172
174
  {
173
- root_id: testUuid(2),
175
+ 'root_id': testUuid(2),
176
+ 'root_$index_id': testUuid(2),
174
177
  },
175
178
  ],
176
179
  },
@@ -31,9 +31,9 @@ test('Posts with locales query (one has many)', async () => {
31
31
  {
32
32
  sql: SQL`select
33
33
  "root_"."id" as "root_id",
34
- "root_"."id" as "root_id"
34
+ "root_"."id" as "root_$key_id"
35
35
  from "public"."post" as "root_"`,
36
- response: { rows: [{ root_id: testUuid(1) }, { root_id: testUuid(2) }] },
36
+ response: { 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
  sql: SQL`select
@@ -113,10 +113,10 @@ test('Posts with locales query with where (one has many)', async () => {
113
113
  {
114
114
  sql: SQL`select
115
115
  "root_"."id" as "root_id",
116
- "root_"."id" as "root_id"
116
+ "root_"."id" as "root_$key_id"
117
117
  from "public"."post" as "root_"`,
118
118
  response: {
119
- rows: [{ root_id: testUuid(1) }, { root_id: testUuid(2) }],
119
+ rows: [{ 'root_id': testUuid(1), 'root_$key_id': testUuid(1) }, { 'root_id': testUuid(2), 'root_$key_id': testUuid(2) }],
120
120
  },
121
121
  },
122
122
  {
@@ -192,10 +192,10 @@ test('Posts with paginated comments (one has many)', async () => {
192
192
  {
193
193
  sql: SQL`select
194
194
  "root_"."id" as "root_id",
195
- "root_"."id" as "root_id"
195
+ "root_"."id" as "root_$key_id"
196
196
  from "public"."post" as "root_"`,
197
197
  response: {
198
- rows: [{ root_id: testUuid(1) }, { root_id: testUuid(2) }],
198
+ rows: [{ 'root_id': testUuid(1), 'root_$key_id': testUuid(1) }, { 'root_id': testUuid(2), 'root_$key_id': testUuid(2) }],
199
199
  },
200
200
  },
201
201
  {
@@ -290,10 +290,10 @@ test('Posts with comment count (one has many)', async () => {
290
290
  {
291
291
  sql: SQL`select
292
292
  "root_"."id" as "root_id",
293
- "root_"."id" as "root_id"
293
+ "root_"."id" as "root_$key_id"
294
294
  from "public"."post" as "root_"`,
295
295
  response: {
296
- rows: [{ root_id: testUuid(1) }, { root_id: testUuid(2) }],
296
+ rows: [{ 'root_id': testUuid(1), 'root_$key_id': testUuid(1) }, { 'root_id': testUuid(2), 'root_$key_id': testUuid(2) }],
297
297
  },
298
298
  },
299
299
  {
@@ -360,10 +360,10 @@ test('Posts with paginated comments without count (one has many)', async () => {
360
360
  {
361
361
  sql: SQL`select
362
362
  "root_"."id" as "root_id",
363
- "root_"."id" as "root_id"
363
+ "root_"."id" as "root_$key_id"
364
364
  from "public"."post" as "root_"`,
365
365
  response: {
366
- rows: [{ root_id: testUuid(1) }, { root_id: testUuid(2) }],
366
+ rows: [{ 'root_id': testUuid(1), 'root_$key_id': testUuid(1) }, { 'root_id': testUuid(2), 'root_$key_id': testUuid(2) }],
367
367
  },
368
368
  },
369
369
  {
@@ -444,10 +444,10 @@ test('Posts with paginated comments (one has many)', async () => {
444
444
  {
445
445
  sql: SQL`select
446
446
  "root_"."id" as "root_id",
447
- "root_"."id" as "root_id"
447
+ "root_"."id" as "root_$key_id"
448
448
  from "public"."post" as "root_"`,
449
449
  response: {
450
- rows: [{ root_id: testUuid(1) }],
450
+ rows: [{ 'root_id': testUuid(1), 'root_$key_id': testUuid(1) }],
451
451
  },
452
452
  },
453
453
  {