@constructive-io/graphql-codegen 4.25.0 → 4.26.0
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.
|
@@ -292,7 +292,7 @@ function buildSearchHandler(table, specialGroups, targetName, typeRegistry) {
|
|
|
292
292
|
const whereProps = [];
|
|
293
293
|
for (const group of specialGroups) {
|
|
294
294
|
for (const field of group.fields) {
|
|
295
|
-
if (field.type.
|
|
295
|
+
if (field.type.gqlType === 'FullText' && !field.type.isArray) {
|
|
296
296
|
// tsvector field: { query }
|
|
297
297
|
whereProps.push(t.objectProperty(t.identifier(field.name), t.objectExpression([
|
|
298
298
|
t.objectProperty(t.identifier('query'), t.identifier('query'), false, true),
|
|
@@ -117,16 +117,23 @@ function isPostGISField(f) {
|
|
|
117
117
|
return false;
|
|
118
118
|
}
|
|
119
119
|
function isEmbeddingField(f) {
|
|
120
|
-
|
|
121
|
-
|
|
120
|
+
// VectorCodecPlugin maps pgvector `vector` columns to the `Vector` GQL scalar.
|
|
121
|
+
// This is the primary detection path — no _meta or pgType enrichment needed.
|
|
122
|
+
if (f.type.gqlType === 'Vector')
|
|
122
123
|
return true;
|
|
124
|
+
// Legacy fallback: name-based heuristic for schemas without VectorCodecPlugin
|
|
123
125
|
if (/embedding$/i.test(f.name) && f.type.isArray && f.type.gqlType === 'Float')
|
|
124
126
|
return true;
|
|
125
127
|
return false;
|
|
126
128
|
}
|
|
127
129
|
function isTsvectorField(f) {
|
|
128
130
|
const pgType = f.type.pgType?.toLowerCase();
|
|
129
|
-
|
|
131
|
+
if (pgType === 'tsvector')
|
|
132
|
+
return true;
|
|
133
|
+
// Fallback: PostGraphile maps tsvector columns to the FullText GQL scalar
|
|
134
|
+
if (f.type.gqlType === 'FullText' && !f.type.isArray)
|
|
135
|
+
return true;
|
|
136
|
+
return false;
|
|
130
137
|
}
|
|
131
138
|
function isSearchComputedField(f) {
|
|
132
139
|
if (f.name === 'searchScore')
|
|
@@ -255,7 +255,7 @@ function buildSearchHandler(table, specialGroups, targetName, typeRegistry) {
|
|
|
255
255
|
const whereProps = [];
|
|
256
256
|
for (const group of specialGroups) {
|
|
257
257
|
for (const field of group.fields) {
|
|
258
|
-
if (field.type.
|
|
258
|
+
if (field.type.gqlType === 'FullText' && !field.type.isArray) {
|
|
259
259
|
// tsvector field: { query }
|
|
260
260
|
whereProps.push(t.objectProperty(t.identifier(field.name), t.objectExpression([
|
|
261
261
|
t.objectProperty(t.identifier('query'), t.identifier('query'), false, true),
|
|
@@ -96,16 +96,23 @@ function isPostGISField(f) {
|
|
|
96
96
|
return false;
|
|
97
97
|
}
|
|
98
98
|
function isEmbeddingField(f) {
|
|
99
|
-
|
|
100
|
-
|
|
99
|
+
// VectorCodecPlugin maps pgvector `vector` columns to the `Vector` GQL scalar.
|
|
100
|
+
// This is the primary detection path — no _meta or pgType enrichment needed.
|
|
101
|
+
if (f.type.gqlType === 'Vector')
|
|
101
102
|
return true;
|
|
103
|
+
// Legacy fallback: name-based heuristic for schemas without VectorCodecPlugin
|
|
102
104
|
if (/embedding$/i.test(f.name) && f.type.isArray && f.type.gqlType === 'Float')
|
|
103
105
|
return true;
|
|
104
106
|
return false;
|
|
105
107
|
}
|
|
106
108
|
function isTsvectorField(f) {
|
|
107
109
|
const pgType = f.type.pgType?.toLowerCase();
|
|
108
|
-
|
|
110
|
+
if (pgType === 'tsvector')
|
|
111
|
+
return true;
|
|
112
|
+
// Fallback: PostGraphile maps tsvector columns to the FullText GQL scalar
|
|
113
|
+
if (f.type.gqlType === 'FullText' && !f.type.isArray)
|
|
114
|
+
return true;
|
|
115
|
+
return false;
|
|
109
116
|
}
|
|
110
117
|
function isSearchComputedField(f) {
|
|
111
118
|
if (f.name === 'searchScore')
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@constructive-io/graphql-codegen",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.26.0",
|
|
4
4
|
"description": "GraphQL SDK generator for Constructive databases with React Query hooks",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"graphql",
|
|
@@ -56,26 +56,26 @@
|
|
|
56
56
|
"@0no-co/graphql.web": "^1.1.2",
|
|
57
57
|
"@babel/generator": "^7.29.1",
|
|
58
58
|
"@babel/types": "^7.29.0",
|
|
59
|
-
"@constructive-io/graphql-query": "^3.12.
|
|
60
|
-
"@constructive-io/graphql-types": "^3.4.
|
|
61
|
-
"@inquirerer/utils": "^3.3.
|
|
62
|
-
"@pgpmjs/core": "^6.10.
|
|
59
|
+
"@constructive-io/graphql-query": "^3.12.5",
|
|
60
|
+
"@constructive-io/graphql-types": "^3.4.2",
|
|
61
|
+
"@inquirerer/utils": "^3.3.5",
|
|
62
|
+
"@pgpmjs/core": "^6.10.3",
|
|
63
63
|
"ajv": "^8.18.0",
|
|
64
64
|
"deepmerge": "^4.3.1",
|
|
65
65
|
"find-and-require-package-json": "^0.9.1",
|
|
66
|
-
"gql-ast": "^3.4.
|
|
67
|
-
"graphile-schema": "^1.11.
|
|
66
|
+
"gql-ast": "^3.4.2",
|
|
67
|
+
"graphile-schema": "^1.11.2",
|
|
68
68
|
"graphql": "16.13.0",
|
|
69
69
|
"inflekt": "^0.6.0",
|
|
70
70
|
"inquirerer": "^4.7.0",
|
|
71
71
|
"jiti": "^2.6.1",
|
|
72
72
|
"komoji": "^0.9.0",
|
|
73
|
-
"oxfmt": "^0.
|
|
74
|
-
"pg-cache": "^3.4.
|
|
75
|
-
"pg-env": "^1.8.
|
|
76
|
-
"pgsql-client": "^3.7.
|
|
77
|
-
"pgsql-seed": "^2.7.
|
|
78
|
-
"undici": "^7.24.
|
|
73
|
+
"oxfmt": "^0.42.0",
|
|
74
|
+
"pg-cache": "^3.4.2",
|
|
75
|
+
"pg-env": "^1.8.2",
|
|
76
|
+
"pgsql-client": "^3.7.3",
|
|
77
|
+
"pgsql-seed": "^2.7.3",
|
|
78
|
+
"undici": "^7.24.6"
|
|
79
79
|
},
|
|
80
80
|
"peerDependencies": {
|
|
81
81
|
"@tanstack/react-query": "^5.0.0",
|
|
@@ -101,5 +101,5 @@
|
|
|
101
101
|
"tsx": "^4.21.0",
|
|
102
102
|
"typescript": "^5.9.3"
|
|
103
103
|
},
|
|
104
|
-
"gitHead": "
|
|
104
|
+
"gitHead": "baae875effd00af36577612c861d0f6f9a1a792a"
|
|
105
105
|
}
|