graphile-settings 4.8.4 → 4.9.1
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/esm/plugins/index.d.ts +2 -6
- package/esm/plugins/index.js +10 -6
- package/esm/presets/constructive-preset.d.ts +12 -5
- package/esm/presets/constructive-preset.js +40 -52
- package/package.json +28 -29
- package/plugins/index.d.ts +2 -6
- package/plugins/index.js +23 -21
- package/presets/constructive-preset.d.ts +12 -5
- package/presets/constructive-preset.js +39 -51
package/esm/plugins/index.d.ts
CHANGED
|
@@ -6,9 +6,5 @@
|
|
|
6
6
|
*/
|
|
7
7
|
export { MinimalPreset, InflektPlugin, InflektPreset, CustomInflectorPlugin, CustomInflectorPreset, ConflictDetectorPlugin, ConflictDetectorPreset, InflectorLoggerPlugin, InflectorLoggerPreset, EnableAllFilterColumnsPlugin, EnableAllFilterColumnsPreset, ManyToManyOptInPlugin, ManyToManyOptInPreset, createUniqueLookupPlugin, PrimaryKeyOnlyPlugin, NoUniqueLookupPlugin, PrimaryKeyOnlyPreset, NoUniqueLookupPreset, MetaSchemaPlugin, MetaSchemaPreset, PgTypeMappingsPlugin, PgTypeMappingsPreset, PublicKeySignature, _cachedTablesMeta, _pgTypeToGqlType, _buildFieldMeta, } from 'graphile-misc-plugins';
|
|
8
8
|
export type { UniqueLookupOptions, TypeMapping, PublicKeyChallengeConfig } from 'graphile-misc-plugins';
|
|
9
|
-
export { VectorCodecPlugin, VectorCodecPreset,
|
|
10
|
-
export type {
|
|
11
|
-
export { PgSearchPlugin, PgSearchPreset, createPgSearchPlugin, TsvectorCodecPlugin, TsvectorCodecPreset, } from 'graphile-search-plugin';
|
|
12
|
-
export type { PgSearchPluginOptions } from 'graphile-search-plugin';
|
|
13
|
-
export { Bm25CodecPlugin, Bm25CodecPreset, Bm25SearchPlugin, createBm25SearchPlugin, Bm25SearchPreset, } from 'graphile-pg-textsearch-plugin';
|
|
14
|
-
export type { Bm25SearchPluginOptions, Bm25IndexInfo } from 'graphile-pg-textsearch-plugin';
|
|
9
|
+
export { createUnifiedSearchPlugin, UnifiedSearchPreset, TsvectorCodecPlugin, TsvectorCodecPreset, createTsvectorCodecPlugin, Bm25CodecPlugin, Bm25CodecPreset, bm25IndexStore, VectorCodecPlugin, VectorCodecPreset, createTsvectorAdapter, createBm25Adapter, createTrgmAdapter, createPgvectorAdapter, createMatchesOperatorFactory, createTrgmOperatorFactories, } from 'graphile-search';
|
|
10
|
+
export type { SearchAdapter, SearchableColumn, UnifiedSearchOptions, UnifiedSearchPresetOptions, TsvectorCodecPluginOptions, Bm25IndexInfo, TsvectorAdapterOptions, Bm25AdapterOptions, TrgmAdapterOptions, PgvectorAdapterOptions, } from 'graphile-search';
|
package/esm/plugins/index.js
CHANGED
|
@@ -6,9 +6,13 @@
|
|
|
6
6
|
*/
|
|
7
7
|
// Re-export all plugins from graphile-misc-plugins
|
|
8
8
|
export { MinimalPreset, InflektPlugin, InflektPreset, CustomInflectorPlugin, CustomInflectorPreset, ConflictDetectorPlugin, ConflictDetectorPreset, InflectorLoggerPlugin, InflectorLoggerPreset, EnableAllFilterColumnsPlugin, EnableAllFilterColumnsPreset, ManyToManyOptInPlugin, ManyToManyOptInPreset, createUniqueLookupPlugin, PrimaryKeyOnlyPlugin, NoUniqueLookupPlugin, PrimaryKeyOnlyPreset, NoUniqueLookupPreset, MetaSchemaPlugin, MetaSchemaPreset, PgTypeMappingsPlugin, PgTypeMappingsPreset, PublicKeySignature, _cachedTablesMeta, _pgTypeToGqlType, _buildFieldMeta, } from 'graphile-misc-plugins';
|
|
9
|
-
//
|
|
10
|
-
export {
|
|
11
|
-
//
|
|
12
|
-
|
|
13
|
-
//
|
|
14
|
-
|
|
9
|
+
// Unified search — tsvector + BM25 + pg_trgm + pgvector behind a single adapter architecture
|
|
10
|
+
export {
|
|
11
|
+
// Core plugin + preset
|
|
12
|
+
createUnifiedSearchPlugin, UnifiedSearchPreset,
|
|
13
|
+
// Codec plugins (tree-shakable)
|
|
14
|
+
TsvectorCodecPlugin, TsvectorCodecPreset, createTsvectorCodecPlugin, Bm25CodecPlugin, Bm25CodecPreset, bm25IndexStore, VectorCodecPlugin, VectorCodecPreset,
|
|
15
|
+
// Adapters
|
|
16
|
+
createTsvectorAdapter, createBm25Adapter, createTrgmAdapter, createPgvectorAdapter,
|
|
17
|
+
// Operator factories for connection filter integration
|
|
18
|
+
createMatchesOperatorFactory, createTrgmOperatorFactories, } from 'graphile-search';
|
|
@@ -19,14 +19,21 @@ import type { GraphileConfig } from 'graphile-config';
|
|
|
19
19
|
* - Upload plugin (file upload to S3/MinIO for image, upload, attachment domain columns)
|
|
20
20
|
* - SQL expression validator (validates @sqlExpression columns in mutations)
|
|
21
21
|
* - PG type mappings (maps custom types like email, url to GraphQL scalars)
|
|
22
|
-
* - pgvector search (auto-discovers vector columns:
|
|
22
|
+
* - pgvector search (auto-discovers vector columns: filter fields, distance computed fields,
|
|
23
23
|
* orderBy distance — zero config)
|
|
24
|
-
* - pg_textsearch BM25 search (auto-discovers BM25 indexes:
|
|
24
|
+
* - pg_textsearch BM25 search (auto-discovers BM25 indexes: filter fields, score computed fields,
|
|
25
25
|
* orderBy score — zero config)
|
|
26
|
+
* - pg_trgm fuzzy matching (similarTo/wordSimilarTo on text columns, similarity score fields,
|
|
27
|
+
* orderBy similarity — zero config, typo-tolerant)
|
|
26
28
|
*
|
|
27
|
-
*
|
|
28
|
-
* -
|
|
29
|
-
*
|
|
29
|
+
* DEPRECATED:
|
|
30
|
+
* - The `condition` argument has been removed. All filtering lives under `filter`.
|
|
31
|
+
* PgConditionArgumentPlugin and PgConditionCustomFieldsPlugin are disabled.
|
|
32
|
+
*
|
|
33
|
+
* RELATION FILTERS:
|
|
34
|
+
* - Enabled via connectionFilterRelations: true
|
|
35
|
+
* - Forward: filter child by parent (e.g. allOrders(filter: { clientByClientId: { name: { startsWith: "Acme" } } }))
|
|
36
|
+
* - Backward: filter parent by children (e.g. allClients(filter: { ordersByClientId: { some: { total: { greaterThan: 1000 } } } }))
|
|
30
37
|
*
|
|
31
38
|
* USAGE:
|
|
32
39
|
* ```typescript
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ConnectionFilterPreset } from 'graphile-connection-filter';
|
|
2
2
|
import { MinimalPreset, InflektPreset, ConflictDetectorPreset, InflectorLoggerPreset, NoUniqueLookupPreset, EnableAllFilterColumnsPreset, ManyToManyOptInPreset, MetaSchemaPreset, PgTypeMappingsPreset, } from 'graphile-misc-plugins';
|
|
3
|
-
import {
|
|
4
|
-
import { GraphilePostgisPreset } from 'graphile-postgis';
|
|
5
|
-
import { VectorCodecPreset, createVectorSearchPlugin } from 'graphile-pgvector-plugin';
|
|
6
|
-
import { Bm25SearchPreset } from 'graphile-pg-textsearch-plugin';
|
|
7
|
-
import { PostgisConnectionFilterPreset } from 'graphile-plugin-connection-filter-postgis';
|
|
3
|
+
import { UnifiedSearchPreset, createMatchesOperatorFactory, createTrgmOperatorFactories } from 'graphile-search';
|
|
4
|
+
import { GraphilePostgisPreset, createPostgisOperatorFactory } from 'graphile-postgis';
|
|
8
5
|
import { UploadPreset } from 'graphile-upload-plugin';
|
|
9
6
|
import { SqlExpressionValidatorPreset } from 'graphile-sql-expression-validator';
|
|
10
7
|
import { constructiveUploadFieldDefinitions } from '../upload-resolver';
|
|
@@ -28,14 +25,21 @@ import { constructiveUploadFieldDefinitions } from '../upload-resolver';
|
|
|
28
25
|
* - Upload plugin (file upload to S3/MinIO for image, upload, attachment domain columns)
|
|
29
26
|
* - SQL expression validator (validates @sqlExpression columns in mutations)
|
|
30
27
|
* - PG type mappings (maps custom types like email, url to GraphQL scalars)
|
|
31
|
-
* - pgvector search (auto-discovers vector columns:
|
|
28
|
+
* - pgvector search (auto-discovers vector columns: filter fields, distance computed fields,
|
|
32
29
|
* orderBy distance — zero config)
|
|
33
|
-
* - pg_textsearch BM25 search (auto-discovers BM25 indexes:
|
|
30
|
+
* - pg_textsearch BM25 search (auto-discovers BM25 indexes: filter fields, score computed fields,
|
|
34
31
|
* orderBy score — zero config)
|
|
32
|
+
* - pg_trgm fuzzy matching (similarTo/wordSimilarTo on text columns, similarity score fields,
|
|
33
|
+
* orderBy similarity — zero config, typo-tolerant)
|
|
35
34
|
*
|
|
36
|
-
*
|
|
37
|
-
* -
|
|
38
|
-
*
|
|
35
|
+
* DEPRECATED:
|
|
36
|
+
* - The `condition` argument has been removed. All filtering lives under `filter`.
|
|
37
|
+
* PgConditionArgumentPlugin and PgConditionCustomFieldsPlugin are disabled.
|
|
38
|
+
*
|
|
39
|
+
* RELATION FILTERS:
|
|
40
|
+
* - Enabled via connectionFilterRelations: true
|
|
41
|
+
* - Forward: filter child by parent (e.g. allOrders(filter: { clientByClientId: { name: { startsWith: "Acme" } } }))
|
|
42
|
+
* - Backward: filter parent by children (e.g. allClients(filter: { ordersByClientId: { some: { total: { greaterThan: 1000 } } } }))
|
|
39
43
|
*
|
|
40
44
|
* USAGE:
|
|
41
45
|
* ```typescript
|
|
@@ -60,18 +64,12 @@ export const ConstructivePreset = {
|
|
|
60
64
|
InflektPreset,
|
|
61
65
|
InflectorLoggerPreset,
|
|
62
66
|
NoUniqueLookupPreset,
|
|
63
|
-
|
|
67
|
+
ConnectionFilterPreset({ connectionFilterRelations: true }),
|
|
64
68
|
EnableAllFilterColumnsPreset,
|
|
65
69
|
ManyToManyOptInPreset,
|
|
66
70
|
MetaSchemaPreset,
|
|
67
|
-
|
|
71
|
+
UnifiedSearchPreset({ fullTextScalarName: 'FullText', tsConfig: 'english' }),
|
|
68
72
|
GraphilePostgisPreset,
|
|
69
|
-
VectorCodecPreset,
|
|
70
|
-
{
|
|
71
|
-
plugins: [createVectorSearchPlugin()],
|
|
72
|
-
},
|
|
73
|
-
Bm25SearchPreset(),
|
|
74
|
-
PostgisConnectionFilterPreset,
|
|
75
73
|
UploadPreset({
|
|
76
74
|
uploadFieldDefinitions: constructiveUploadFieldDefinitions,
|
|
77
75
|
maxFileSize: 10 * 1024 * 1024, // 10MB
|
|
@@ -80,52 +78,28 @@ export const ConstructivePreset = {
|
|
|
80
78
|
PgTypeMappingsPreset,
|
|
81
79
|
],
|
|
82
80
|
/**
|
|
83
|
-
* Disable
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
* PgConnectionArgFilterForwardRelationsPlugin which add relation filter fields like
|
|
88
|
-
* `apiExtensions`, `apiExtensionsExist`, `database`, `domains`, etc. to every filter type.
|
|
89
|
-
*
|
|
90
|
-
* The `connectionFilterRelations: false` schema option does NOT work - it's defined in the
|
|
91
|
-
* plugin's TypeScript types but the actual code always includes the plugins regardless.
|
|
92
|
-
* See: https://github.com/graphile-contrib/postgraphile-plugin-connection-filter/blob/master/src/index.ts
|
|
93
|
-
* The comments `//if (connectionFilterRelations)` are just comments, not actual conditional logic.
|
|
94
|
-
*
|
|
95
|
-
* The entityBehavior approach (setting `pgCodecRelation: '-filterBy'`) also doesn't work
|
|
96
|
-
* because the behavior system doesn't properly negate the plugin's default `filterBy` behavior.
|
|
97
|
-
*
|
|
98
|
-
* OUR FIX:
|
|
99
|
-
* We use `disablePlugins` to directly disable the two relation filter plugins.
|
|
100
|
-
* This is the most reliable way to prevent relation filter fields from being generated.
|
|
81
|
+
* Disable PostGraphile core's condition argument entirely.
|
|
82
|
+
* All filtering now lives under the `filter` argument via our v5-native
|
|
83
|
+
* graphile-connection-filter plugin. Search, BM25, pgvector, and PostGIS
|
|
84
|
+
* filter fields all hook into `isPgConnectionFilter` instead of `isPgCondition`.
|
|
101
85
|
*/
|
|
102
86
|
disablePlugins: [
|
|
103
|
-
'
|
|
104
|
-
'
|
|
87
|
+
'PgConditionArgumentPlugin',
|
|
88
|
+
'PgConditionCustomFieldsPlugin',
|
|
105
89
|
],
|
|
106
90
|
/**
|
|
107
91
|
* Connection Filter Plugin Configuration
|
|
108
92
|
*
|
|
109
93
|
* These options control what fields appear in the `filter` argument on connections.
|
|
110
|
-
*
|
|
94
|
+
* Our v5-native graphile-connection-filter plugin controls relation filters via the
|
|
95
|
+
* `connectionFilterRelations` option passed to ConnectionFilterPreset().
|
|
111
96
|
*
|
|
112
97
|
* NOTE: By default, PostGraphile v5 only allows filtering on INDEXED columns.
|
|
113
98
|
* We override this with EnableAllFilterColumnsPreset to allow filtering on ALL columns.
|
|
114
99
|
* This gives developers flexibility but requires monitoring for slow queries on
|
|
115
|
-
* non-indexed columns.
|
|
116
|
-
*
|
|
117
|
-
* NOTE: Relation filtering is disabled via `disablePlugins` above.
|
|
118
|
-
*
|
|
119
|
-
* Documentation: https://github.com/graphile-contrib/postgraphile-plugin-connection-filter
|
|
100
|
+
* non-indexed columns.
|
|
120
101
|
*/
|
|
121
102
|
schema: {
|
|
122
|
-
/**
|
|
123
|
-
* connectionFilterRelations: false
|
|
124
|
-
* This option is defined in the plugin's types but does NOT actually work.
|
|
125
|
-
* The relation filter plugins are disabled via `disablePlugins` above.
|
|
126
|
-
* We keep this option set to false for documentation purposes.
|
|
127
|
-
*/
|
|
128
|
-
connectionFilterRelations: false,
|
|
129
103
|
/**
|
|
130
104
|
* connectionFilterComputedColumns: false
|
|
131
105
|
* Disables filtering on computed columns (functions that return a value for a row).
|
|
@@ -151,6 +125,20 @@ export const ConstructivePreset = {
|
|
|
151
125
|
* Example: filter: { tags: { contains: ["important"] } }
|
|
152
126
|
*/
|
|
153
127
|
connectionFilterArrays: true,
|
|
128
|
+
/**
|
|
129
|
+
* connectionFilterOperatorFactories
|
|
130
|
+
* Aggregates all satellite plugin operator factories into a single array.
|
|
131
|
+
* graphile-config replaces (not concatenates) arrays when merging presets,
|
|
132
|
+
* so we must explicitly collect all factories here at the top level.
|
|
133
|
+
*/
|
|
134
|
+
connectionFilterOperatorFactories: [
|
|
135
|
+
createMatchesOperatorFactory('FullText', 'english'),
|
|
136
|
+
createTrgmOperatorFactories(),
|
|
137
|
+
createPostgisOperatorFactory(),
|
|
138
|
+
],
|
|
139
|
+
// NOTE: The UnifiedSearchPreset also registers matches + trgm operator factories.
|
|
140
|
+
// graphile-config merges arrays from presets, so having them here as well is fine
|
|
141
|
+
// and ensures they're present even if the preset order changes.
|
|
154
142
|
},
|
|
155
143
|
};
|
|
156
144
|
export default ConstructivePreset;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "graphile-settings",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.9.1",
|
|
4
4
|
"author": "Constructive <developers@constructive.io>",
|
|
5
5
|
"description": "graphile settings",
|
|
6
6
|
"main": "index.js",
|
|
@@ -29,47 +29,46 @@
|
|
|
29
29
|
"test:watch": "jest --watch"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@constructive-io/graphql-env": "^3.4.
|
|
33
|
-
"@constructive-io/graphql-types": "^3.3.
|
|
34
|
-
"@constructive-io/s3-streamer": "^2.16.
|
|
35
|
-
"@constructive-io/upload-names": "^2.9.
|
|
36
|
-
"@dataplan/json": "1.0.0-rc.
|
|
37
|
-
"@dataplan/pg": "1.0.0-rc.
|
|
38
|
-
"@graphile-contrib/pg-many-to-many": "2.0.0-rc.
|
|
32
|
+
"@constructive-io/graphql-env": "^3.4.3",
|
|
33
|
+
"@constructive-io/graphql-types": "^3.3.3",
|
|
34
|
+
"@constructive-io/s3-streamer": "^2.16.3",
|
|
35
|
+
"@constructive-io/upload-names": "^2.9.3",
|
|
36
|
+
"@dataplan/json": "1.0.0-rc.6",
|
|
37
|
+
"@dataplan/pg": "1.0.0-rc.8",
|
|
38
|
+
"@graphile-contrib/pg-many-to-many": "2.0.0-rc.2",
|
|
39
39
|
"@pgpmjs/logger": "^2.4.2",
|
|
40
40
|
"@pgpmjs/types": "^2.19.2",
|
|
41
41
|
"cors": "^2.8.6",
|
|
42
42
|
"express": "^5.2.1",
|
|
43
|
-
"grafast": "1.0.0-rc.
|
|
44
|
-
"grafserv": "1.0.0-rc.
|
|
45
|
-
"graphile-build": "5.0.0-rc.
|
|
46
|
-
"graphile-build-pg": "5.0.0-rc.
|
|
47
|
-
"graphile-config": "1.0.0-rc.
|
|
48
|
-
"graphile-
|
|
49
|
-
"graphile-
|
|
50
|
-
"graphile-
|
|
51
|
-
"graphile-
|
|
52
|
-
"graphile-
|
|
53
|
-
"graphile-
|
|
54
|
-
"
|
|
55
|
-
"graphile-upload-plugin": "^2.4.2",
|
|
56
|
-
"graphql": "^16.13.0",
|
|
43
|
+
"grafast": "1.0.0-rc.9",
|
|
44
|
+
"grafserv": "1.0.0-rc.7",
|
|
45
|
+
"graphile-build": "5.0.0-rc.6",
|
|
46
|
+
"graphile-build-pg": "5.0.0-rc.8",
|
|
47
|
+
"graphile-config": "1.0.0-rc.6",
|
|
48
|
+
"graphile-connection-filter": "^1.1.1",
|
|
49
|
+
"graphile-misc-plugins": "^1.4.3",
|
|
50
|
+
"graphile-postgis": "^2.6.1",
|
|
51
|
+
"graphile-search": "^1.1.1",
|
|
52
|
+
"graphile-sql-expression-validator": "^2.4.3",
|
|
53
|
+
"graphile-upload-plugin": "^2.4.3",
|
|
54
|
+
"graphql": "16.13.0",
|
|
57
55
|
"inflekt": "^0.3.3",
|
|
58
|
-
"lru-cache": "^11.2.
|
|
59
|
-
"pg": "^8.
|
|
60
|
-
"pg-sql2": "5.0.0-rc.
|
|
61
|
-
"postgraphile": "5.0.0-rc.
|
|
62
|
-
"postgraphile-plugin-connection-filter": "3.0.0-rc.1",
|
|
56
|
+
"lru-cache": "^11.2.7",
|
|
57
|
+
"pg": "^8.20.0",
|
|
58
|
+
"pg-sql2": "5.0.0-rc.5",
|
|
59
|
+
"postgraphile": "5.0.0-rc.10",
|
|
63
60
|
"request-ip": "^3.3.0",
|
|
64
|
-
"tamedevil": "0.1.0-rc.
|
|
61
|
+
"tamedevil": "0.1.0-rc.6"
|
|
65
62
|
},
|
|
66
63
|
"devDependencies": {
|
|
67
64
|
"@types/cors": "^2.8.17",
|
|
68
65
|
"@types/express": "^5.0.6",
|
|
69
66
|
"@types/pg": "^8.18.0",
|
|
70
67
|
"@types/request-ip": "^0.0.41",
|
|
68
|
+
"graphile-test": "^4.5.3",
|
|
71
69
|
"makage": "^0.1.10",
|
|
72
70
|
"nodemon": "^3.1.14",
|
|
71
|
+
"pgsql-test": "^4.5.3",
|
|
73
72
|
"ts-node": "^10.9.2"
|
|
74
73
|
},
|
|
75
74
|
"keywords": [
|
|
@@ -79,5 +78,5 @@
|
|
|
79
78
|
"constructive",
|
|
80
79
|
"graphql"
|
|
81
80
|
],
|
|
82
|
-
"gitHead": "
|
|
81
|
+
"gitHead": "21fd7c2c30663548cf15aa448c1935ab56e5497d"
|
|
83
82
|
}
|
package/plugins/index.d.ts
CHANGED
|
@@ -6,9 +6,5 @@
|
|
|
6
6
|
*/
|
|
7
7
|
export { MinimalPreset, InflektPlugin, InflektPreset, CustomInflectorPlugin, CustomInflectorPreset, ConflictDetectorPlugin, ConflictDetectorPreset, InflectorLoggerPlugin, InflectorLoggerPreset, EnableAllFilterColumnsPlugin, EnableAllFilterColumnsPreset, ManyToManyOptInPlugin, ManyToManyOptInPreset, createUniqueLookupPlugin, PrimaryKeyOnlyPlugin, NoUniqueLookupPlugin, PrimaryKeyOnlyPreset, NoUniqueLookupPreset, MetaSchemaPlugin, MetaSchemaPreset, PgTypeMappingsPlugin, PgTypeMappingsPreset, PublicKeySignature, _cachedTablesMeta, _pgTypeToGqlType, _buildFieldMeta, } from 'graphile-misc-plugins';
|
|
8
8
|
export type { UniqueLookupOptions, TypeMapping, PublicKeyChallengeConfig } from 'graphile-misc-plugins';
|
|
9
|
-
export { VectorCodecPlugin, VectorCodecPreset,
|
|
10
|
-
export type {
|
|
11
|
-
export { PgSearchPlugin, PgSearchPreset, createPgSearchPlugin, TsvectorCodecPlugin, TsvectorCodecPreset, } from 'graphile-search-plugin';
|
|
12
|
-
export type { PgSearchPluginOptions } from 'graphile-search-plugin';
|
|
13
|
-
export { Bm25CodecPlugin, Bm25CodecPreset, Bm25SearchPlugin, createBm25SearchPlugin, Bm25SearchPreset, } from 'graphile-pg-textsearch-plugin';
|
|
14
|
-
export type { Bm25SearchPluginOptions, Bm25IndexInfo } from 'graphile-pg-textsearch-plugin';
|
|
9
|
+
export { createUnifiedSearchPlugin, UnifiedSearchPreset, TsvectorCodecPlugin, TsvectorCodecPreset, createTsvectorCodecPlugin, Bm25CodecPlugin, Bm25CodecPreset, bm25IndexStore, VectorCodecPlugin, VectorCodecPreset, createTsvectorAdapter, createBm25Adapter, createTrgmAdapter, createPgvectorAdapter, createMatchesOperatorFactory, createTrgmOperatorFactories, } from 'graphile-search';
|
|
10
|
+
export type { SearchAdapter, SearchableColumn, UnifiedSearchOptions, UnifiedSearchPresetOptions, TsvectorCodecPluginOptions, Bm25IndexInfo, TsvectorAdapterOptions, Bm25AdapterOptions, TrgmAdapterOptions, PgvectorAdapterOptions, } from 'graphile-search';
|
package/plugins/index.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* Plugin implementations have been moved to graphile-misc-plugins.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.
|
|
9
|
+
exports.createTrgmOperatorFactories = exports.createMatchesOperatorFactory = exports.createPgvectorAdapter = exports.createTrgmAdapter = exports.createBm25Adapter = exports.createTsvectorAdapter = exports.VectorCodecPreset = exports.VectorCodecPlugin = exports.bm25IndexStore = exports.Bm25CodecPreset = exports.Bm25CodecPlugin = exports.createTsvectorCodecPlugin = exports.TsvectorCodecPreset = exports.TsvectorCodecPlugin = exports.UnifiedSearchPreset = exports.createUnifiedSearchPlugin = exports._buildFieldMeta = exports._pgTypeToGqlType = exports._cachedTablesMeta = exports.PublicKeySignature = exports.PgTypeMappingsPreset = exports.PgTypeMappingsPlugin = exports.MetaSchemaPreset = exports.MetaSchemaPlugin = exports.NoUniqueLookupPreset = exports.PrimaryKeyOnlyPreset = exports.NoUniqueLookupPlugin = exports.PrimaryKeyOnlyPlugin = exports.createUniqueLookupPlugin = exports.ManyToManyOptInPreset = exports.ManyToManyOptInPlugin = exports.EnableAllFilterColumnsPreset = exports.EnableAllFilterColumnsPlugin = exports.InflectorLoggerPreset = exports.InflectorLoggerPlugin = exports.ConflictDetectorPreset = exports.ConflictDetectorPlugin = exports.CustomInflectorPreset = exports.CustomInflectorPlugin = exports.InflektPreset = exports.InflektPlugin = exports.MinimalPreset = void 0;
|
|
10
10
|
// Re-export all plugins from graphile-misc-plugins
|
|
11
11
|
var graphile_misc_plugins_1 = require("graphile-misc-plugins");
|
|
12
12
|
Object.defineProperty(exports, "MinimalPreset", { enumerable: true, get: function () { return graphile_misc_plugins_1.MinimalPreset; } });
|
|
@@ -35,23 +35,25 @@ Object.defineProperty(exports, "PublicKeySignature", { enumerable: true, get: fu
|
|
|
35
35
|
Object.defineProperty(exports, "_cachedTablesMeta", { enumerable: true, get: function () { return graphile_misc_plugins_1._cachedTablesMeta; } });
|
|
36
36
|
Object.defineProperty(exports, "_pgTypeToGqlType", { enumerable: true, get: function () { return graphile_misc_plugins_1._pgTypeToGqlType; } });
|
|
37
37
|
Object.defineProperty(exports, "_buildFieldMeta", { enumerable: true, get: function () { return graphile_misc_plugins_1._buildFieldMeta; } });
|
|
38
|
-
//
|
|
39
|
-
var
|
|
40
|
-
|
|
41
|
-
Object.defineProperty(exports, "
|
|
42
|
-
Object.defineProperty(exports, "
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
Object.defineProperty(exports, "
|
|
47
|
-
Object.defineProperty(exports, "
|
|
48
|
-
Object.defineProperty(exports, "
|
|
49
|
-
Object.defineProperty(exports, "
|
|
50
|
-
Object.defineProperty(exports, "
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
Object.defineProperty(exports, "
|
|
54
|
-
Object.defineProperty(exports, "
|
|
55
|
-
Object.defineProperty(exports, "
|
|
56
|
-
Object.defineProperty(exports, "
|
|
57
|
-
|
|
38
|
+
// Unified search — tsvector + BM25 + pg_trgm + pgvector behind a single adapter architecture
|
|
39
|
+
var graphile_search_1 = require("graphile-search");
|
|
40
|
+
// Core plugin + preset
|
|
41
|
+
Object.defineProperty(exports, "createUnifiedSearchPlugin", { enumerable: true, get: function () { return graphile_search_1.createUnifiedSearchPlugin; } });
|
|
42
|
+
Object.defineProperty(exports, "UnifiedSearchPreset", { enumerable: true, get: function () { return graphile_search_1.UnifiedSearchPreset; } });
|
|
43
|
+
// Codec plugins (tree-shakable)
|
|
44
|
+
Object.defineProperty(exports, "TsvectorCodecPlugin", { enumerable: true, get: function () { return graphile_search_1.TsvectorCodecPlugin; } });
|
|
45
|
+
Object.defineProperty(exports, "TsvectorCodecPreset", { enumerable: true, get: function () { return graphile_search_1.TsvectorCodecPreset; } });
|
|
46
|
+
Object.defineProperty(exports, "createTsvectorCodecPlugin", { enumerable: true, get: function () { return graphile_search_1.createTsvectorCodecPlugin; } });
|
|
47
|
+
Object.defineProperty(exports, "Bm25CodecPlugin", { enumerable: true, get: function () { return graphile_search_1.Bm25CodecPlugin; } });
|
|
48
|
+
Object.defineProperty(exports, "Bm25CodecPreset", { enumerable: true, get: function () { return graphile_search_1.Bm25CodecPreset; } });
|
|
49
|
+
Object.defineProperty(exports, "bm25IndexStore", { enumerable: true, get: function () { return graphile_search_1.bm25IndexStore; } });
|
|
50
|
+
Object.defineProperty(exports, "VectorCodecPlugin", { enumerable: true, get: function () { return graphile_search_1.VectorCodecPlugin; } });
|
|
51
|
+
Object.defineProperty(exports, "VectorCodecPreset", { enumerable: true, get: function () { return graphile_search_1.VectorCodecPreset; } });
|
|
52
|
+
// Adapters
|
|
53
|
+
Object.defineProperty(exports, "createTsvectorAdapter", { enumerable: true, get: function () { return graphile_search_1.createTsvectorAdapter; } });
|
|
54
|
+
Object.defineProperty(exports, "createBm25Adapter", { enumerable: true, get: function () { return graphile_search_1.createBm25Adapter; } });
|
|
55
|
+
Object.defineProperty(exports, "createTrgmAdapter", { enumerable: true, get: function () { return graphile_search_1.createTrgmAdapter; } });
|
|
56
|
+
Object.defineProperty(exports, "createPgvectorAdapter", { enumerable: true, get: function () { return graphile_search_1.createPgvectorAdapter; } });
|
|
57
|
+
// Operator factories for connection filter integration
|
|
58
|
+
Object.defineProperty(exports, "createMatchesOperatorFactory", { enumerable: true, get: function () { return graphile_search_1.createMatchesOperatorFactory; } });
|
|
59
|
+
Object.defineProperty(exports, "createTrgmOperatorFactories", { enumerable: true, get: function () { return graphile_search_1.createTrgmOperatorFactories; } });
|
|
@@ -19,14 +19,21 @@ import type { GraphileConfig } from 'graphile-config';
|
|
|
19
19
|
* - Upload plugin (file upload to S3/MinIO for image, upload, attachment domain columns)
|
|
20
20
|
* - SQL expression validator (validates @sqlExpression columns in mutations)
|
|
21
21
|
* - PG type mappings (maps custom types like email, url to GraphQL scalars)
|
|
22
|
-
* - pgvector search (auto-discovers vector columns:
|
|
22
|
+
* - pgvector search (auto-discovers vector columns: filter fields, distance computed fields,
|
|
23
23
|
* orderBy distance — zero config)
|
|
24
|
-
* - pg_textsearch BM25 search (auto-discovers BM25 indexes:
|
|
24
|
+
* - pg_textsearch BM25 search (auto-discovers BM25 indexes: filter fields, score computed fields,
|
|
25
25
|
* orderBy score — zero config)
|
|
26
|
+
* - pg_trgm fuzzy matching (similarTo/wordSimilarTo on text columns, similarity score fields,
|
|
27
|
+
* orderBy similarity — zero config, typo-tolerant)
|
|
26
28
|
*
|
|
27
|
-
*
|
|
28
|
-
* -
|
|
29
|
-
*
|
|
29
|
+
* DEPRECATED:
|
|
30
|
+
* - The `condition` argument has been removed. All filtering lives under `filter`.
|
|
31
|
+
* PgConditionArgumentPlugin and PgConditionCustomFieldsPlugin are disabled.
|
|
32
|
+
*
|
|
33
|
+
* RELATION FILTERS:
|
|
34
|
+
* - Enabled via connectionFilterRelations: true
|
|
35
|
+
* - Forward: filter child by parent (e.g. allOrders(filter: { clientByClientId: { name: { startsWith: "Acme" } } }))
|
|
36
|
+
* - Backward: filter parent by children (e.g. allClients(filter: { ordersByClientId: { some: { total: { greaterThan: 1000 } } } }))
|
|
30
37
|
*
|
|
31
38
|
* USAGE:
|
|
32
39
|
* ```typescript
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ConstructivePreset = void 0;
|
|
4
|
-
const
|
|
4
|
+
const graphile_connection_filter_1 = require("graphile-connection-filter");
|
|
5
5
|
const graphile_misc_plugins_1 = require("graphile-misc-plugins");
|
|
6
|
-
const
|
|
6
|
+
const graphile_search_1 = require("graphile-search");
|
|
7
7
|
const graphile_postgis_1 = require("graphile-postgis");
|
|
8
|
-
const graphile_pgvector_plugin_1 = require("graphile-pgvector-plugin");
|
|
9
|
-
const graphile_pg_textsearch_plugin_1 = require("graphile-pg-textsearch-plugin");
|
|
10
|
-
const graphile_plugin_connection_filter_postgis_1 = require("graphile-plugin-connection-filter-postgis");
|
|
11
8
|
const graphile_upload_plugin_1 = require("graphile-upload-plugin");
|
|
12
9
|
const graphile_sql_expression_validator_1 = require("graphile-sql-expression-validator");
|
|
13
10
|
const upload_resolver_1 = require("../upload-resolver");
|
|
@@ -31,14 +28,21 @@ const upload_resolver_1 = require("../upload-resolver");
|
|
|
31
28
|
* - Upload plugin (file upload to S3/MinIO for image, upload, attachment domain columns)
|
|
32
29
|
* - SQL expression validator (validates @sqlExpression columns in mutations)
|
|
33
30
|
* - PG type mappings (maps custom types like email, url to GraphQL scalars)
|
|
34
|
-
* - pgvector search (auto-discovers vector columns:
|
|
31
|
+
* - pgvector search (auto-discovers vector columns: filter fields, distance computed fields,
|
|
35
32
|
* orderBy distance — zero config)
|
|
36
|
-
* - pg_textsearch BM25 search (auto-discovers BM25 indexes:
|
|
33
|
+
* - pg_textsearch BM25 search (auto-discovers BM25 indexes: filter fields, score computed fields,
|
|
37
34
|
* orderBy score — zero config)
|
|
35
|
+
* - pg_trgm fuzzy matching (similarTo/wordSimilarTo on text columns, similarity score fields,
|
|
36
|
+
* orderBy similarity — zero config, typo-tolerant)
|
|
38
37
|
*
|
|
39
|
-
*
|
|
40
|
-
* -
|
|
41
|
-
*
|
|
38
|
+
* DEPRECATED:
|
|
39
|
+
* - The `condition` argument has been removed. All filtering lives under `filter`.
|
|
40
|
+
* PgConditionArgumentPlugin and PgConditionCustomFieldsPlugin are disabled.
|
|
41
|
+
*
|
|
42
|
+
* RELATION FILTERS:
|
|
43
|
+
* - Enabled via connectionFilterRelations: true
|
|
44
|
+
* - Forward: filter child by parent (e.g. allOrders(filter: { clientByClientId: { name: { startsWith: "Acme" } } }))
|
|
45
|
+
* - Backward: filter parent by children (e.g. allClients(filter: { ordersByClientId: { some: { total: { greaterThan: 1000 } } } }))
|
|
42
46
|
*
|
|
43
47
|
* USAGE:
|
|
44
48
|
* ```typescript
|
|
@@ -63,18 +67,12 @@ exports.ConstructivePreset = {
|
|
|
63
67
|
graphile_misc_plugins_1.InflektPreset,
|
|
64
68
|
graphile_misc_plugins_1.InflectorLoggerPreset,
|
|
65
69
|
graphile_misc_plugins_1.NoUniqueLookupPreset,
|
|
66
|
-
|
|
70
|
+
(0, graphile_connection_filter_1.ConnectionFilterPreset)({ connectionFilterRelations: true }),
|
|
67
71
|
graphile_misc_plugins_1.EnableAllFilterColumnsPreset,
|
|
68
72
|
graphile_misc_plugins_1.ManyToManyOptInPreset,
|
|
69
73
|
graphile_misc_plugins_1.MetaSchemaPreset,
|
|
70
|
-
(0,
|
|
74
|
+
(0, graphile_search_1.UnifiedSearchPreset)({ fullTextScalarName: 'FullText', tsConfig: 'english' }),
|
|
71
75
|
graphile_postgis_1.GraphilePostgisPreset,
|
|
72
|
-
graphile_pgvector_plugin_1.VectorCodecPreset,
|
|
73
|
-
{
|
|
74
|
-
plugins: [(0, graphile_pgvector_plugin_1.createVectorSearchPlugin)()],
|
|
75
|
-
},
|
|
76
|
-
(0, graphile_pg_textsearch_plugin_1.Bm25SearchPreset)(),
|
|
77
|
-
graphile_plugin_connection_filter_postgis_1.PostgisConnectionFilterPreset,
|
|
78
76
|
(0, graphile_upload_plugin_1.UploadPreset)({
|
|
79
77
|
uploadFieldDefinitions: upload_resolver_1.constructiveUploadFieldDefinitions,
|
|
80
78
|
maxFileSize: 10 * 1024 * 1024, // 10MB
|
|
@@ -83,52 +81,28 @@ exports.ConstructivePreset = {
|
|
|
83
81
|
graphile_misc_plugins_1.PgTypeMappingsPreset,
|
|
84
82
|
],
|
|
85
83
|
/**
|
|
86
|
-
* Disable
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
* PgConnectionArgFilterForwardRelationsPlugin which add relation filter fields like
|
|
91
|
-
* `apiExtensions`, `apiExtensionsExist`, `database`, `domains`, etc. to every filter type.
|
|
92
|
-
*
|
|
93
|
-
* The `connectionFilterRelations: false` schema option does NOT work - it's defined in the
|
|
94
|
-
* plugin's TypeScript types but the actual code always includes the plugins regardless.
|
|
95
|
-
* See: https://github.com/graphile-contrib/postgraphile-plugin-connection-filter/blob/master/src/index.ts
|
|
96
|
-
* The comments `//if (connectionFilterRelations)` are just comments, not actual conditional logic.
|
|
97
|
-
*
|
|
98
|
-
* The entityBehavior approach (setting `pgCodecRelation: '-filterBy'`) also doesn't work
|
|
99
|
-
* because the behavior system doesn't properly negate the plugin's default `filterBy` behavior.
|
|
100
|
-
*
|
|
101
|
-
* OUR FIX:
|
|
102
|
-
* We use `disablePlugins` to directly disable the two relation filter plugins.
|
|
103
|
-
* This is the most reliable way to prevent relation filter fields from being generated.
|
|
84
|
+
* Disable PostGraphile core's condition argument entirely.
|
|
85
|
+
* All filtering now lives under the `filter` argument via our v5-native
|
|
86
|
+
* graphile-connection-filter plugin. Search, BM25, pgvector, and PostGIS
|
|
87
|
+
* filter fields all hook into `isPgConnectionFilter` instead of `isPgCondition`.
|
|
104
88
|
*/
|
|
105
89
|
disablePlugins: [
|
|
106
|
-
'
|
|
107
|
-
'
|
|
90
|
+
'PgConditionArgumentPlugin',
|
|
91
|
+
'PgConditionCustomFieldsPlugin',
|
|
108
92
|
],
|
|
109
93
|
/**
|
|
110
94
|
* Connection Filter Plugin Configuration
|
|
111
95
|
*
|
|
112
96
|
* These options control what fields appear in the `filter` argument on connections.
|
|
113
|
-
*
|
|
97
|
+
* Our v5-native graphile-connection-filter plugin controls relation filters via the
|
|
98
|
+
* `connectionFilterRelations` option passed to ConnectionFilterPreset().
|
|
114
99
|
*
|
|
115
100
|
* NOTE: By default, PostGraphile v5 only allows filtering on INDEXED columns.
|
|
116
101
|
* We override this with EnableAllFilterColumnsPreset to allow filtering on ALL columns.
|
|
117
102
|
* This gives developers flexibility but requires monitoring for slow queries on
|
|
118
|
-
* non-indexed columns.
|
|
119
|
-
*
|
|
120
|
-
* NOTE: Relation filtering is disabled via `disablePlugins` above.
|
|
121
|
-
*
|
|
122
|
-
* Documentation: https://github.com/graphile-contrib/postgraphile-plugin-connection-filter
|
|
103
|
+
* non-indexed columns.
|
|
123
104
|
*/
|
|
124
105
|
schema: {
|
|
125
|
-
/**
|
|
126
|
-
* connectionFilterRelations: false
|
|
127
|
-
* This option is defined in the plugin's types but does NOT actually work.
|
|
128
|
-
* The relation filter plugins are disabled via `disablePlugins` above.
|
|
129
|
-
* We keep this option set to false for documentation purposes.
|
|
130
|
-
*/
|
|
131
|
-
connectionFilterRelations: false,
|
|
132
106
|
/**
|
|
133
107
|
* connectionFilterComputedColumns: false
|
|
134
108
|
* Disables filtering on computed columns (functions that return a value for a row).
|
|
@@ -154,6 +128,20 @@ exports.ConstructivePreset = {
|
|
|
154
128
|
* Example: filter: { tags: { contains: ["important"] } }
|
|
155
129
|
*/
|
|
156
130
|
connectionFilterArrays: true,
|
|
131
|
+
/**
|
|
132
|
+
* connectionFilterOperatorFactories
|
|
133
|
+
* Aggregates all satellite plugin operator factories into a single array.
|
|
134
|
+
* graphile-config replaces (not concatenates) arrays when merging presets,
|
|
135
|
+
* so we must explicitly collect all factories here at the top level.
|
|
136
|
+
*/
|
|
137
|
+
connectionFilterOperatorFactories: [
|
|
138
|
+
(0, graphile_search_1.createMatchesOperatorFactory)('FullText', 'english'),
|
|
139
|
+
(0, graphile_search_1.createTrgmOperatorFactories)(),
|
|
140
|
+
(0, graphile_postgis_1.createPostgisOperatorFactory)(),
|
|
141
|
+
],
|
|
142
|
+
// NOTE: The UnifiedSearchPreset also registers matches + trgm operator factories.
|
|
143
|
+
// graphile-config merges arrays from presets, so having them here as well is fine
|
|
144
|
+
// and ensures they're present even if the preset order changes.
|
|
157
145
|
},
|
|
158
146
|
};
|
|
159
147
|
exports.default = exports.ConstructivePreset;
|