-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathindex.ts
More file actions
74 lines (70 loc) · 2.02 KB
/
index.ts
File metadata and controls
74 lines (70 loc) · 2.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/**
* graphile-connection-filter
*
* A PostGraphile v5 native connection filter plugin.
* Adds advanced filtering capabilities to connection and list fields.
*
* @example
* ```typescript
* import { ConnectionFilterPreset } from 'graphile-connection-filter';
*
* const preset = {
* extends: [
* ConnectionFilterPreset(),
* ],
* };
* ```
*
* For satellite plugins that need to register custom operators:
* ```typescript
* // In your plugin's init hook:
* if (typeof build.addConnectionFilterOperator === 'function') {
* build.addConnectionFilterOperator('MyType', 'myOperator', {
* description: 'My custom operator',
* resolve: (sqlIdentifier, sqlValue) => sql`${sqlIdentifier} OP ${sqlValue}`,
* });
* }
* ```
*
* For satellite plugins that need to access the query builder from a filter apply:
* ```typescript
* import { getQueryBuilder } from 'graphile-connection-filter';
* // In your filter field's apply callback:
* const qb = getQueryBuilder(build, $condition);
* if (qb) {
* const idx = qb.selectAndReturnIndex(sql`...`);
* qb.setMeta('key', { selectIndex: idx });
* }
* ```
*/
export { ConnectionFilterPreset } from './preset';
// Re-export all plugins for granular use
export {
ConnectionFilterInflectionPlugin,
ConnectionFilterTypesPlugin,
ConnectionFilterArgPlugin,
ConnectionFilterAttributesPlugin,
ConnectionFilterOperatorsPlugin,
ConnectionFilterCustomOperatorsPlugin,
ConnectionFilterLogicalOperatorsPlugin,
ConnectionFilterComputedAttributesPlugin,
ConnectionFilterForwardRelationsPlugin,
ConnectionFilterBackwardRelationsPlugin,
makeApplyFromOperatorSpec,
} from './plugins';
// Re-export types
export type {
ConnectionFilterOperatorSpec,
ConnectionFilterOptions,
ConnectionFilterOperatorsDigest,
PgConnectionFilterOperatorsScope,
} from './types';
export { $$filters } from './types';
// Re-export utilities
export {
isEmpty,
makeAssertAllowed,
getQueryBuilder,
isComputedScalarAttributeResource,
getComputedAttributeResources,
} from './utils';