@contember/engine-content-api 1.1.0-beta.0 → 1.1.0-beta.3
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/src/mapper/select/JoinVisitor.js +2 -2
- package/dist/src/mapper/select/JoinVisitor.js.map +1 -1
- package/dist/src/tsconfig.tsbuildinfo +1 -1
- package/dist/tests/cases/integration/graphQlRequests/query/filter/manyHasManyOwnerRelation.test.js +48 -0
- package/dist/tests/cases/integration/graphQlRequests/query/filter/manyHasManyOwnerRelation.test.js.map +1 -1
- package/dist/tests/tsconfig.tsbuildinfo +1 -1
- package/package.json +10 -10
- package/src/mapper/select/JoinVisitor.ts +2 -2
- package/tests/cases/integration/graphQlRequests/query/filter/manyHasManyOwnerRelation.test.ts +59 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contember/engine-content-api",
|
|
3
|
-
"version": "1.1.0-beta.
|
|
3
|
+
"version": "1.1.0-beta.3",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "dist/src/index.js",
|
|
6
6
|
"typings": "dist/src/index.d.ts",
|
|
@@ -10,19 +10,19 @@
|
|
|
10
10
|
"test": "vitest --no-threads"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@contember/database": "^1.1.0-beta.
|
|
14
|
-
"@contember/dic": "^1.1.0-beta.
|
|
15
|
-
"@contember/engine-common": "^1.1.0-beta.
|
|
16
|
-
"@contember/graphql-utils": "^1.1.0-beta.
|
|
17
|
-
"@contember/schema": "^1.1.0-beta.
|
|
18
|
-
"@contember/schema-utils": "^1.1.0-beta.
|
|
13
|
+
"@contember/database": "^1.1.0-beta.3",
|
|
14
|
+
"@contember/dic": "^1.1.0-beta.3",
|
|
15
|
+
"@contember/engine-common": "^1.1.0-beta.3",
|
|
16
|
+
"@contember/graphql-utils": "^1.1.0-beta.3",
|
|
17
|
+
"@contember/schema": "^1.1.0-beta.3",
|
|
18
|
+
"@contember/schema-utils": "^1.1.0-beta.3",
|
|
19
19
|
"@graphql-tools/schema": "^8.3.5",
|
|
20
20
|
"graphql-tag": "^2.12.5"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
|
-
"@contember/database-tester": "^1.1.0-beta.
|
|
24
|
-
"@contember/engine-api-tester": "^1.1.0-beta.
|
|
25
|
-
"@contember/schema-definition": "^1.1.0-beta.
|
|
23
|
+
"@contember/database-tester": "^1.1.0-beta.3",
|
|
24
|
+
"@contember/engine-api-tester": "^1.1.0-beta.3",
|
|
25
|
+
"@contember/schema-definition": "^1.1.0-beta.3",
|
|
26
26
|
"@graphql-codegen/cli": "^1.15.2",
|
|
27
27
|
"@graphql-codegen/typescript": "^1.15.2",
|
|
28
28
|
"@graphql-codegen/typescript-operations": "^1.15.2",
|
|
@@ -70,7 +70,7 @@ export class JoinVisitor implements Model.RelationByTypeVisitor<JoinDefinition[]
|
|
|
70
70
|
): JoinDefinition[] {
|
|
71
71
|
const sourceAlias = this.path.back().alias
|
|
72
72
|
const targetAlias = this.path.alias
|
|
73
|
-
const joiningAlias =
|
|
73
|
+
const joiningAlias = this.path.back().for('x_' + this.path.alias).alias
|
|
74
74
|
return [
|
|
75
75
|
{
|
|
76
76
|
tableName: relation.joiningTable.tableName,
|
|
@@ -98,7 +98,7 @@ export class JoinVisitor implements Model.RelationByTypeVisitor<JoinDefinition[]
|
|
|
98
98
|
): JoinDefinition[] {
|
|
99
99
|
const sourceAlias = this.path.back().alias
|
|
100
100
|
const targetAlias = this.path.alias
|
|
101
|
-
const joiningAlias =
|
|
101
|
+
const joiningAlias = this.path.back().for('x_' + this.path.alias).alias
|
|
102
102
|
return [
|
|
103
103
|
{
|
|
104
104
|
tableName: targetRelation.joiningTable.tableName,
|
package/tests/cases/integration/graphQlRequests/query/filter/manyHasManyOwnerRelation.test.ts
CHANGED
|
@@ -105,3 +105,62 @@ test('Post by category ids (where many has many owning)', async () => {
|
|
|
105
105
|
})
|
|
106
106
|
})
|
|
107
107
|
|
|
108
|
+
|
|
109
|
+
test('Post by category tag name (where multiple many has many owning)', async () => {
|
|
110
|
+
await execute({
|
|
111
|
+
schema: new SchemaBuilder()
|
|
112
|
+
.entity('Post', entity =>
|
|
113
|
+
entity.manyHasMany('categories', relation =>
|
|
114
|
+
relation.target('Category', e =>
|
|
115
|
+
e.manyHasMany('tagsButWithVeryVeryVeryLongNameSoItReachesPostgresqlAliasLengthLimit', relation =>
|
|
116
|
+
relation.target('Tag', e =>
|
|
117
|
+
e.column('name', c => c.type(Model.ColumnType.String)),
|
|
118
|
+
),
|
|
119
|
+
),
|
|
120
|
+
),
|
|
121
|
+
),
|
|
122
|
+
)
|
|
123
|
+
.buildSchema(),
|
|
124
|
+
query: GQL`
|
|
125
|
+
query {
|
|
126
|
+
listPost(filter: {categories: {tagsButWithVeryVeryVeryLongNameSoItReachesPostgresqlAliasLengthLimit: {name: {eq: "Stuff"}}}}) {
|
|
127
|
+
id
|
|
128
|
+
}
|
|
129
|
+
}`,
|
|
130
|
+
executes: [
|
|
131
|
+
{
|
|
132
|
+
sql: SQL`
|
|
133
|
+
select "root_"."id" as "root_id" from "public"."post" as "root_"
|
|
134
|
+
where exists (select 1
|
|
135
|
+
from "public"."post_categories" as "junction_"
|
|
136
|
+
inner join "public"."category" as "sub_" on "junction_"."category_id" = "sub_"."id"
|
|
137
|
+
left join "public"."category_tags_but_with_very_very_very_long_name_so_it_reaches_postgresql_alias_length_limit" as "sub_x_sub_tagsButWithVeryVeryVeryLongNameSoItReachesPostgresq_2" on "sub_"."id" = "sub_x_sub_tagsButWithVeryVeryVeryLongNameSoItReachesPostgresq_2"."category_id"
|
|
138
|
+
left join "public"."tag" as "sub_tagsButWithVeryVeryVeryLongNameSoItReachesPostgresqlAlias_1" on "sub_x_sub_tagsButWithVeryVeryVeryLongNameSoItReachesPostgresq_2"."tag_id" = "sub_tagsButWithVeryVeryVeryLongNameSoItReachesPostgresqlAlias_1"."id"
|
|
139
|
+
where "root_"."id" = "junction_"."post_id" and "sub_tagsButWithVeryVeryVeryLongNameSoItReachesPostgresqlAlias_1"."name" = ?)`,
|
|
140
|
+
parameters: ['Stuff'],
|
|
141
|
+
response: {
|
|
142
|
+
rows: [
|
|
143
|
+
{
|
|
144
|
+
root_id: testUuid(1),
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
root_id: testUuid(3),
|
|
148
|
+
},
|
|
149
|
+
],
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
],
|
|
153
|
+
return: {
|
|
154
|
+
data: {
|
|
155
|
+
listPost: [
|
|
156
|
+
{
|
|
157
|
+
id: testUuid(1),
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
id: testUuid(3),
|
|
161
|
+
},
|
|
162
|
+
],
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
})
|
|
166
|
+
})
|