Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions graphile/graphile-cache/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@
"dependencies": {
"@pgpmjs/logger": "workspace:^",
"express": "^5.2.1",
"grafserv": "1.0.0-rc.6",
"lru-cache": "^11.2.6",
"grafserv": "1.0.0-rc.7",
"lru-cache": "^11.2.7",
"pg-cache": "workspace:^",
"postgraphile": "5.0.0-rc.7"
"postgraphile": "5.0.0-rc.10"
},
"devDependencies": {
"@types/express": "^5.0.6",
Expand Down
14 changes: 7 additions & 7 deletions graphile/graphile-connection-filter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@
"pgsql-test": "workspace:^"
},
"peerDependencies": {
"@dataplan/pg": "1.0.0-rc.5",
"graphile-build": "5.0.0-rc.4",
"graphile-build-pg": "5.0.0-rc.5",
"graphile-config": "1.0.0-rc.5",
"graphql": "^16.9.0",
"pg-sql2": "5.0.0-rc.4",
"postgraphile": "5.0.0-rc.7"
"@dataplan/pg": "1.0.0-rc.8",
"graphile-build": "5.0.0-rc.6",
"graphile-build-pg": "5.0.0-rc.8",
"graphile-config": "1.0.0-rc.6",
"graphql": "16.13.0",
"pg-sql2": "5.0.0-rc.5",
"postgraphile": "5.0.0-rc.10"
}
}
18 changes: 9 additions & 9 deletions graphile/graphile-misc-plugins/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,20 @@
"test:watch": "jest --watch"
},
"dependencies": {
"@graphile-contrib/pg-many-to-many": "2.0.0-rc.1",
"@graphile-contrib/pg-many-to-many": "2.0.0-rc.2",
"@pgsql/quotes": "^17.1.0",
"graphile-utils": "5.0.0-rc.5",
"graphile-utils": "5.0.0-rc.8",
"inflekt": "^0.3.3",
"pg": "^8.19.0",
"pg": "^8.20.0",
"pg-query-context": "workspace:^"
},
"peerDependencies": {
"grafast": "1.0.0-rc.7",
"graphile-build": "5.0.0-rc.4",
"graphile-build-pg": "5.0.0-rc.5",
"graphile-config": "1.0.0-rc.5",
"graphql": "^16.9.0",
"pg-sql2": "5.0.0-rc.4"
"grafast": "1.0.0-rc.9",
"graphile-build": "5.0.0-rc.6",
"graphile-build-pg": "5.0.0-rc.8",
"graphile-config": "1.0.0-rc.6",
"graphql": "16.13.0",
"pg-sql2": "5.0.0-rc.5"
},
"devDependencies": {
"@types/node": "^22.19.11",
Expand Down
16 changes: 14 additions & 2 deletions graphile/graphile-misc-plugins/src/custom-inflector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,9 @@ export const InflektPlugin: GraphileConfig.Plugin = {
singleRelation(previous, _options, details) {
const { registry, codec, relationName } = details;
const relation = registry.pgRelations[codec.name]?.[relationName];
if (!relation) {
return previous!(details);
}
if (typeof relation.extensions?.tags?.fieldName === 'string') {
return relation.extensions.tags.fieldName;
}
Expand Down Expand Up @@ -255,6 +258,9 @@ export const InflektPlugin: GraphileConfig.Plugin = {
singleRelationBackwards(previous, _options, details) {
const { registry, codec, relationName } = details;
const relation = registry.pgRelations[codec.name]?.[relationName];
if (!relation) {
return previous!(details);
}
if (
typeof relation.extensions?.tags?.foreignSingleFieldName === 'string'
) {
Expand Down Expand Up @@ -294,7 +300,10 @@ export const InflektPlugin: GraphileConfig.Plugin = {
_manyRelation(previous, _options, details) {
const { registry, codec, relationName } = details;
const relation = registry.pgRelations[codec.name]?.[relationName];
const baseOverride = relation.extensions?.tags.foreignFieldName;
if (!relation) {
return previous!(details);
}
const baseOverride = relation.extensions?.tags?.foreignFieldName;
if (typeof baseOverride === 'string') {
return baseOverride;
}
Expand Down Expand Up @@ -352,7 +361,10 @@ export const InflektPlugin: GraphileConfig.Plugin = {
const { leftTable, rightTable, junctionTable, rightRelationName } =
details;

const junctionRightRelation = junctionTable.getRelation(rightRelationName);
const junctionRightRelation = junctionTable.getRelation?.(rightRelationName);
if (!junctionRightRelation) {
return previous!(details);
}
const baseOverride =
junctionRightRelation.extensions?.tags?.manyToManyFieldName;
if (typeof baseOverride === 'string') {
Expand Down
16 changes: 8 additions & 8 deletions graphile/graphile-postgis/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@
"url": "https://github.com/constructive-io/constructive/issues"
},
"peerDependencies": {
"@dataplan/pg": "1.0.0-rc.5",
"grafast": "1.0.0-rc.7",
"graphile-build": "5.0.0-rc.4",
"graphile-build-pg": "5.0.0-rc.5",
"graphile-config": "1.0.0-rc.5",
"@dataplan/pg": "1.0.0-rc.8",
"grafast": "1.0.0-rc.9",
"graphile-build": "5.0.0-rc.6",
"graphile-build-pg": "5.0.0-rc.8",
"graphile-config": "1.0.0-rc.6",
"graphile-connection-filter": "workspace:^",
"graphql": "^16.9.0",
"pg-sql2": "5.0.0-rc.4",
"postgraphile": "5.0.0-rc.7"
"graphql": "16.13.0",
"pg-sql2": "5.0.0-rc.5",
"postgraphile": "5.0.0-rc.10"
},
"peerDependenciesMeta": {
"graphile-connection-filter": {
Expand Down
14 changes: 7 additions & 7 deletions graphile/graphile-query/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@
"test:watch": "jest --watch"
},
"dependencies": {
"grafast": "1.0.0-rc.7",
"graphile-build": "5.0.0-rc.4",
"graphile-build-pg": "5.0.0-rc.5",
"graphile-config": "1.0.0-rc.5",
"grafast": "1.0.0-rc.9",
"graphile-build": "5.0.0-rc.6",
"graphile-build-pg": "5.0.0-rc.8",
"graphile-config": "1.0.0-rc.6",
"graphile-settings": "workspace:^",
"graphql": "^16.13.0",
"pg": "^8.19.0",
"postgraphile": "5.0.0-rc.7"
"graphql": "16.13.0",
"pg": "^8.20.0",
"postgraphile": "5.0.0-rc.10"
},
"devDependencies": {
"@types/pg": "^8.18.0",
Expand Down
6 changes: 3 additions & 3 deletions graphile/graphile-schema/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@
},
"dependencies": {
"deepmerge": "^4.3.1",
"graphile-build": "5.0.0-rc.4",
"graphile-config": "1.0.0-rc.5",
"graphile-build": "5.0.0-rc.6",
"graphile-config": "1.0.0-rc.6",
"graphile-settings": "workspace:^",
"graphql": "^16.13.0",
"graphql": "16.13.0",
"pg-cache": "workspace:^",
"pg-env": "workspace:^"
},
Expand Down
16 changes: 8 additions & 8 deletions graphile/graphile-search/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,17 @@
"graphile-connection-filter": "workspace:^",
"graphile-test": "workspace:^",
"makage": "^0.1.10",
"pg": "^8.19.0",
"pg": "^8.20.0",
"pgsql-test": "workspace:^"
},
"peerDependencies": {
"@dataplan/pg": "1.0.0-rc.5",
"graphile-build": "5.0.0-rc.4",
"graphile-build-pg": "5.0.0-rc.5",
"graphile-config": "1.0.0-rc.5",
"graphql": "^16.9.0",
"pg-sql2": "5.0.0-rc.4",
"postgraphile": "5.0.0-rc.7"
"@dataplan/pg": "1.0.0-rc.8",
"graphile-build": "5.0.0-rc.6",
"graphile-build-pg": "5.0.0-rc.8",
"graphile-config": "1.0.0-rc.6",
"graphql": "16.13.0",
"pg-sql2": "5.0.0-rc.5",
"postgraphile": "5.0.0-rc.10"
},
"keywords": [
"postgraphile",
Expand Down
8 changes: 6 additions & 2 deletions graphile/graphile-search/src/adapters/tsvector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,13 @@ import type { SearchAdapter, SearchableColumn, FilterApplyResult } from '../type
import type { SQL } from 'pg-sql2';

function isTsvectorCodec(codec: any): boolean {
// In graphile-build-pg >= 5.0.0-rc.8, the built-in TYPES.tsvector codec
// has name === 'tsvector' but does NOT have extensions.pg. We need to
// match both the built-in codec and our custom codec (for older versions).
return (
codec?.extensions?.pg?.schemaName === 'pg_catalog' &&
codec?.extensions?.pg?.name === 'tsvector'
codec?.name === 'tsvector' ||
(codec?.extensions?.pg?.schemaName === 'pg_catalog' &&
codec?.extensions?.pg?.name === 'tsvector')
);
}

Expand Down
66 changes: 44 additions & 22 deletions graphile/graphile-search/src/codecs/tsvector-codec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,20 @@
* TsvectorCodecPlugin
*
* Teaches PostGraphile v5 how to handle PostgreSQL's tsvector and tsquery types.
* Without this, tsvector columns are invisible to the schema builder and the
* search plugin cannot generate condition fields.
*
* This plugin:
* In graphile-build-pg >= 5.0.0-rc.8, tsvector/tsquery codecs are handled
* natively and tsvector columns are HIDDEN by default (PgAttributesPlugin
* HIDE_BY_DEFAULT). This plugin:
*
* 1. Creates codecs for tsvector/tsquery via gather.hooks.pgCodecs_findPgCodec
* (kept for backward compatibility with older versions; rc.8+ handles this
* natively so the hook returns early when event.pgCodec is already set)
* 2. Registers a custom "FullText" scalar type for tsvector columns
* 3. Maps tsvector codec to the FullText scalar (isolating filter operators)
* 4. Maps tsquery codec to GraphQL String
* 5. Optionally hides tsvector columns from output types
* 5. Re-enables tsvector columns for select/filterBy so that search plugins
* can detect and use them (overrides rc.8's HIDE_BY_DEFAULT)
* 6. Optionally hides tsvector columns from output types
*/

import type { GraphileConfig } from 'graphile-config';
Expand Down Expand Up @@ -178,25 +183,42 @@ export function createTsvectorCodecPlugin(
},
},

...(hideTsvectorColumns
? {
entityBehavior: {
pgCodecAttribute: {
inferred: {
after: ['postInferred'],
provides: ['hideTsvectorColumns'],
callback(behavior: any, [codec, attributeName]: [any, string]) {
const attr = codec.attributes?.[attributeName];
if (attr?.codec?.name === 'tsvector') {
return [behavior, '-select'] as any;
}
return behavior;
},
},
},
// In graphile-build-pg >= 5.0.0-rc.8, PgAttributesPlugin HIDE_BY_DEFAULT
// hides tsvector columns entirely (-attribute:select, -attribute:base,
// -condition:attribute:filterBy, etc.). We need entity behavior to
// re-enable them so search plugins can detect and use them.
entityBehavior: {
pgCodecAttribute: {
inferred: {
after: ['default'],
provides: ['tsvectorCodecPlugin'],
callback(behavior: any, [codec, attributeName]: [any, string]) {
const attr = codec.attributes?.[attributeName];
const attrCodec = attr?.codec;
const isTsvector =
attrCodec?.name === 'tsvector' ||
(attrCodec?.extensions?.pg?.schemaName === 'pg_catalog' &&
attrCodec?.extensions?.pg?.name === 'tsvector');
if (!isTsvector) {
return behavior;
}
if (hideTsvectorColumns) {
// User explicitly wants tsvector columns hidden from output
return [behavior, '-attribute:select'] as any;
}
// Re-enable tsvector columns that rc.8 hides by default.
// The search plugin needs attribute:select to detect columns,
// and condition:attribute:filterBy for standard filter support.
return [
behavior,
'attribute:select',
'attribute:base',
'condition:attribute:filterBy',
] as any;
},
}
: {}),
},
},
},
},
};
}
Expand Down
28 changes: 14 additions & 14 deletions graphile/graphile-settings/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,32 +33,32 @@
"@constructive-io/graphql-types": "workspace:^",
"@constructive-io/s3-streamer": "workspace:^",
"@constructive-io/upload-names": "workspace:^",
"@dataplan/json": "1.0.0-rc.5",
"@dataplan/pg": "1.0.0-rc.5",
"@graphile-contrib/pg-many-to-many": "2.0.0-rc.1",
"@dataplan/json": "1.0.0-rc.6",
"@dataplan/pg": "1.0.0-rc.8",
"@graphile-contrib/pg-many-to-many": "2.0.0-rc.2",
"@pgpmjs/logger": "workspace:^",
"@pgpmjs/types": "workspace:^",
"cors": "^2.8.6",
"express": "^5.2.1",
"grafast": "1.0.0-rc.7",
"grafserv": "1.0.0-rc.6",
"graphile-build": "5.0.0-rc.4",
"graphile-build-pg": "5.0.0-rc.5",
"graphile-config": "1.0.0-rc.5",
"grafast": "1.0.0-rc.9",
"grafserv": "1.0.0-rc.7",
"graphile-build": "5.0.0-rc.6",
"graphile-build-pg": "5.0.0-rc.8",
"graphile-config": "1.0.0-rc.6",
"graphile-connection-filter": "workspace:^",
"graphile-misc-plugins": "workspace:^",
"graphile-postgis": "workspace:^",
"graphile-search": "workspace:^",
"graphile-sql-expression-validator": "workspace:^",
"graphile-upload-plugin": "workspace:^",
"graphql": "^16.13.0",
"graphql": "16.13.0",
"inflekt": "^0.3.3",
"lru-cache": "^11.2.6",
"pg": "^8.19.0",
"pg-sql2": "5.0.0-rc.4",
"postgraphile": "5.0.0-rc.7",
"lru-cache": "^11.2.7",
"pg": "^8.20.0",
"pg-sql2": "5.0.0-rc.5",
"postgraphile": "5.0.0-rc.10",
"request-ip": "^3.3.0",
"tamedevil": "0.1.0-rc.4"
"tamedevil": "0.1.0-rc.6"
},
"devDependencies": {
"@types/cors": "^2.8.17",
Expand Down
14 changes: 7 additions & 7 deletions graphile/graphile-sql-expression-validator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@
"url": "https://github.com/constructive-io/constructive/issues"
},
"dependencies": {
"pgsql-deparser": "^17.18.0",
"pgsql-parser": "^17.9.12"
"pgsql-deparser": "^17.18.1",
"pgsql-parser": "^17.9.13"
},
"peerDependencies": {
"grafast": "1.0.0-rc.7",
"graphile-build": "5.0.0-rc.4",
"graphile-build-pg": "5.0.0-rc.5",
"graphile-config": "1.0.0-rc.5",
"graphql": "^16.9.0"
"grafast": "1.0.0-rc.9",
"graphile-build": "5.0.0-rc.6",
"graphile-build-pg": "5.0.0-rc.8",
"graphile-config": "1.0.0-rc.6",
"graphql": "16.13.0"
},
"devDependencies": {
"@types/node": "^22.19.11",
Expand Down
14 changes: 7 additions & 7 deletions graphile/graphile-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@
"@constructive-io/graphql-env": "workspace:^",
"@constructive-io/graphql-types": "workspace:^",
"@pgpmjs/types": "workspace:^",
"grafast": "1.0.0-rc.7",
"graphile-build": "5.0.0-rc.4",
"graphile-build-pg": "5.0.0-rc.5",
"graphile-config": "1.0.0-rc.5",
"graphql": "^16.13.0",
"grafast": "1.0.0-rc.9",
"graphile-build": "5.0.0-rc.6",
"graphile-build-pg": "5.0.0-rc.8",
"graphile-config": "1.0.0-rc.6",
"graphql": "16.13.0",
"mock-req": "^0.2.0",
"pg": "^8.19.0",
"pg": "^8.20.0",
"pgsql-test": "workspace:^",
"postgraphile": "5.0.0-rc.7"
"postgraphile": "5.0.0-rc.10"
},
"keywords": [
"testing",
Expand Down
Loading
Loading