-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrumbleInput.ts
More file actions
100 lines (98 loc) · 3.38 KB
/
rumbleInput.ts
File metadata and controls
100 lines (98 loc) · 3.38 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
import type { Tracer } from "@opentelemetry/api";
import type SchemaBuilder from "@pothos/core";
import type { TracingWrapperOptions } from "@pothos/tracing-opentelemetry";
import type { createPubSub } from "graphql-yoga";
import type { DrizzleInstance } from "./drizzleInstanceType";
export type CustomRumblePothosConfig = Omit<
ConstructorParameters<typeof SchemaBuilder>[0],
"smartSubscriptions" | "drizzle"
>;
export type RumbleInput<
UserContext extends Record<string, any>,
DB extends DrizzleInstance,
RequestEvent extends Record<string, any>,
Action extends string,
PothosConfig extends CustomRumblePothosConfig,
> = {
/**
* Your drizzle database instance
*/
db: DB;
/**
* A function for providing context for each request based on the incoming HTTP Request.
* The type of the parameter equals the HTTPRequest type of your chosen server.
*/
context?:
| ((event: RequestEvent) => Promise<UserContext> | UserContext)
| undefined;
/**
* If you only want to disable query, mutation or subscription default objects, you can do so here
*/
disableDefaultObjects?: {
mutation?: boolean;
subscription?: boolean;
query?: boolean;
};
/**
* The actions that are available
*/
actions?: Action[];
/**
* Customization for subscriptions. See https://the-guild.dev/graphql/yoga-server/docs/features/subscriptions#distributed-pubsub-for-production
*/
subscriptions?: Parameters<typeof createPubSub>;
/**
* Options passed along to the pothos schema builder.
*/
pothosConfig?: PothosConfig;
/**
* Limits the returned amount when querying lists. Set to null to disable.
* @default 100
*/
defaultLimit?: number | undefined | null;
/**
* rumble supports fuzzy search for the query helpers. This enables the users of your API to search for entities via fuzzy search inputs.
* This currently only is supported by postgres databases and will fail if enabled on other dialects.
*
* Please note that this will install the pg_trgm extension on startup if your database does not have it already installed.
* https://www.postgresql.org/docs/current/pgtrgm.html
*/
search?:
| {
/**
* Whether search is enabled
*/
enabled?: boolean;
/**
* The cuttoff factor to reduce the amount of returned results.
* Defaults to 0.3. Lower values will return more results.
*/
threshold?: number;
/**
* Will perform a local
* SET cpu_operator_cost = x;
* for search queries. This can help to make the planner
* use a potential index scan instead of a sequential scan.
* This will not affect queries that are not using the search feature.
*/
cpu_operator_cost?: number;
}
| undefined;
/**
* rumble can set up otel tracing if you want to. This will provide details of execution time and outcome to the provided tracer. See https://pothos-graphql.dev/docs/plugins/tracing#install for more information.
*/
otel?: {
/**
* Whether otel tracing should be enabled. This will create a tracer if none is provided.
*/
enabled?: boolean;
/**
* The tracer to use. If enabled is true and no tracer is provided, a tracer will be created.
*/
tracer?: Tracer;
/**
* You can pass options to the tracing wrapper
*/
options?: TracingWrapperOptions<unknown>;
};
};