@stonecrop/rockfoil 0.7.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.
- package/dist/rockfoil.d.ts +44 -0
- package/dist/rockfoil.js +40009 -0
- package/dist/rockfoil.js.map +1 -0
- package/dist/rockfoil.tsbuildinfo +1 -0
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +2 -0
- package/dist/src/middleware/postgraphile.d.ts +7 -0
- package/dist/src/middleware/postgraphile.d.ts.map +1 -0
- package/dist/src/middleware/postgraphile.js +49 -0
- package/dist/src/types/index.d.ts +32 -0
- package/dist/src/types/index.d.ts.map +1 -0
- package/dist/src/types/index.js +0 -0
- package/dist/tests/postgraphile.test.d.ts +2 -0
- package/dist/tests/postgraphile.test.d.ts.map +1 -0
- package/dist/tests/postgraphile.test.js +58 -0
- package/dist/tsdoc-metadata.json +11 -0
- package/package.json +71 -0
- package/src/index.ts +2 -0
- package/src/middleware/postgraphile.ts +61 -0
- package/src/types/index.ts +33 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { ExecutableStep } from 'postgraphile/grafast';
|
|
2
|
+
import type { FieldArgs } from 'postgraphile/grafast';
|
|
3
|
+
import type { FieldInfo } from 'postgraphile/grafast';
|
|
4
|
+
import type { PlanWrapperFn } from 'postgraphile/utils';
|
|
5
|
+
import type { PlanWrapperRule } from 'postgraphile/utils';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Creates a PostGraphile plugin that wraps GraphQL query and mutation plans with before/after hooks
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
11
|
+
export declare const createPglRockfoilPlugin: (hookMap: HookConfig) => GraphileConfig.Plugin;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Configuration object mapping field names to their before/after hooks for queries and mutations
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
17
|
+
export declare interface HookConfig {
|
|
18
|
+
/**
|
|
19
|
+
* Hook configuration for a specific field
|
|
20
|
+
*/
|
|
21
|
+
[fieldName: string]: {
|
|
22
|
+
/** Function to execute before a query operation */
|
|
23
|
+
beforeQuery?: PlanWrapperFn;
|
|
24
|
+
/** Function to execute after a query operation */
|
|
25
|
+
afterQuery?: (result: any, plan: any, $source: ExecutableStep, fieldArgs: FieldArgs, info: FieldInfo) => any;
|
|
26
|
+
/** Function to execute before a mutation operation */
|
|
27
|
+
beforeMutation?: PlanWrapperFn;
|
|
28
|
+
/** Function to execute after a mutation operation */
|
|
29
|
+
afterMutation?: (result: any, plan: any, $source: ExecutableStep, fieldArgs: FieldArgs, info: FieldInfo) => any;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Internal mapping of field names to their plan wrapper rules
|
|
35
|
+
* @public
|
|
36
|
+
*/
|
|
37
|
+
export declare interface HookPlan {
|
|
38
|
+
/**
|
|
39
|
+
* Plan wrapper rule for a specific field
|
|
40
|
+
*/
|
|
41
|
+
[fieldName: string]: PlanWrapperRule;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export { }
|