@m1212e/rumble 0.11.7 → 0.12.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/out/index.cjs +1901 -0
- package/out/index.cjs.map +1 -0
- package/out/index.d.cts +922 -0
- package/out/index.d.cts.map +1 -0
- package/out/index.d.ts +922 -0
- package/out/index.d.ts.map +1 -0
- package/out/index.js +1849 -0
- package/out/index.js.map +1 -0
- package/package.json +61 -1
- package/LICENSE +0 -201
- package/README.md +0 -285
- package/index.cjs +0 -65
- package/index.cjs.map +0 -1
- package/index.d.cts +0 -833
- package/index.d.ts +0 -833
- package/index.js +0 -65
- package/index.js.map +0 -1
package/index.d.ts
DELETED
|
@@ -1,833 +0,0 @@
|
|
|
1
|
-
import { GraphQLSchema, GraphQLFieldResolver, GraphQLError } from 'graphql';
|
|
2
|
-
import { Client } from '@urql/core';
|
|
3
|
-
import * as SchemaBuilder from '@pothos/core';
|
|
4
|
-
import SchemaBuilder__default, { SchemaTypes, BasePlugin, PothosOutputFieldConfig } from '@pothos/core';
|
|
5
|
-
import * as drizzle_orm_pg_core from 'drizzle-orm/pg-core';
|
|
6
|
-
import { PgDatabase, PgEnum } from 'drizzle-orm/pg-core';
|
|
7
|
-
import * as _pothos_plugin_drizzle from '@pothos/plugin-drizzle';
|
|
8
|
-
import { DrizzleClient } from '@pothos/plugin-drizzle';
|
|
9
|
-
import * as fets from 'fets';
|
|
10
|
-
import * as graphql_yoga from 'graphql-yoga';
|
|
11
|
-
import { createPubSub, YogaServerOptions } from 'graphql-yoga';
|
|
12
|
-
import * as drizzle_orm from 'drizzle-orm';
|
|
13
|
-
import { useSofa } from 'sofa-api';
|
|
14
|
-
import { MySqlDatabase } from 'drizzle-orm/mysql-core';
|
|
15
|
-
import { SingleStoreDatabase } from 'drizzle-orm/singlestore-core';
|
|
16
|
-
import { BaseSQLiteDatabase } from 'drizzle-orm/sqlite-core';
|
|
17
|
-
|
|
18
|
-
declare function generateFromSchema({ outputPath, schema, rumbleImportPath, apiUrl, useExternalUrqlClient, }: {
|
|
19
|
-
schema: GraphQLSchema;
|
|
20
|
-
outputPath: string;
|
|
21
|
-
rumbleImportPath?: string;
|
|
22
|
-
apiUrl?: string;
|
|
23
|
-
useExternalUrqlClient?: boolean | string;
|
|
24
|
-
}): Promise<void>;
|
|
25
|
-
|
|
26
|
-
declare const argsKey = "__args";
|
|
27
|
-
|
|
28
|
-
type UnArray<T> = T extends Array<infer U> ? U : T;
|
|
29
|
-
type RequireAtLeastOneFieldSet<T> = {
|
|
30
|
-
[K in keyof T]: Required<Pick<T, K>> & Partial<Omit<T, K>>;
|
|
31
|
-
}[keyof T];
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* A gql object defined from the generated types.
|
|
35
|
-
* Most keys are functions that take a selection set and return a promise of the selected data.
|
|
36
|
-
*/
|
|
37
|
-
type QueryableObjectFromGeneratedTypes<Q> = {
|
|
38
|
-
[Key in keyof Q]: QueryableObjectField$1<Q[Key]>;
|
|
39
|
-
};
|
|
40
|
-
type QueryableObjectField$1<T> = T extends (p: infer QueryArgs) => infer QueryResponse ? <Selected extends QueryArgs extends Record<string, any> ? // in that case we want to extend the object with an args key property
|
|
41
|
-
ObjectFieldSelection<UnArray<NonNullable<QueryResponse>>> & {
|
|
42
|
-
[argsKey]: QueryArgs;
|
|
43
|
-
} : ObjectFieldSelection<UnArray<NonNullable<QueryResponse>>>>(s: Selected) => QueryResponse extends null ? Response<QueryResponse extends Array<any> ? ApplySelection<NonNullable<UnArray<QueryResponse>>, Selected>[] : ApplySelection<NonNullable<UnArray<QueryResponse>>, Selected>> | null : Response<QueryResponse extends Array<any> ? ApplySelection<UnArray<QueryResponse>, Selected>[] : ApplySelection<UnArray<QueryResponse>, Selected>> : Response<T>;
|
|
44
|
-
/**
|
|
45
|
-
* The input to select fields for an object
|
|
46
|
-
*/
|
|
47
|
-
type ObjectFieldSelection<O> = RequireAtLeastOneFieldSet<{
|
|
48
|
-
[Key in keyof O]: NonNullable<UnArray<O[Key]>> extends (p: infer P) => infer A ? P extends Record<string, any> ? ObjectFieldSelection<UnArray<NonNullable<A>>> & {
|
|
49
|
-
[argsKey]: P;
|
|
50
|
-
} : ObjectFieldSelection<UnArray<NonNullable<A>>> : boolean;
|
|
51
|
-
}>;
|
|
52
|
-
type ApplySelection<Object, Selection> = {
|
|
53
|
-
[Key in keyof Selection & keyof Object]: Object[Key] extends (p: infer _P) => infer _A ? ReturnType<Object[Key]> extends Array<any> ? Array<ApplySelection<UnArray<ReturnType<Object[Key]>>, Selection[Key]>> : ApplySelection<UnArray<Object[Key]>, Selection[Key]> : Object[Key];
|
|
54
|
-
};
|
|
55
|
-
type Subscribeable<Data> = {
|
|
56
|
-
subscribe: (subscription: (value: Data) => void) => () => void;
|
|
57
|
-
};
|
|
58
|
-
type Response<Data> = {
|
|
59
|
-
then: (onFulfilled: (value: Subscribeable<Data> & Data) => void) => void;
|
|
60
|
-
} & Subscribeable<Data | undefined>;
|
|
61
|
-
|
|
62
|
-
declare function makeLiveQuery<Query extends Record<string, any>>({ urqlClient, availableSubscriptions, }: {
|
|
63
|
-
urqlClient: Client;
|
|
64
|
-
availableSubscriptions: Set<string>;
|
|
65
|
-
}): QueryableObjectFromGeneratedTypes<Query>;
|
|
66
|
-
|
|
67
|
-
declare function makeMutation<Mutation extends Record<string, any>>({ urqlClient, }: {
|
|
68
|
-
urqlClient: Client;
|
|
69
|
-
}): QueryableObjectFromGeneratedTypes<Mutation>;
|
|
70
|
-
|
|
71
|
-
declare function makeQuery<Query extends Record<string, any>>({ urqlClient, }: {
|
|
72
|
-
urqlClient: Client;
|
|
73
|
-
}): QueryableObjectFromGeneratedTypes<Query>;
|
|
74
|
-
|
|
75
|
-
declare function makeSubscription<Subscription extends Record<string, any>>({ urqlClient, }: {
|
|
76
|
-
urqlClient: Client;
|
|
77
|
-
}): SubscriptionObject<Subscription>;
|
|
78
|
-
type SubscriptionObject<Q> = {
|
|
79
|
-
[Key in keyof Q]: QueryableObjectField<Q[Key]>;
|
|
80
|
-
};
|
|
81
|
-
type QueryableObjectField<T> = T extends (p: infer QueryArgs) => infer QueryResponse ? <Selected extends QueryArgs extends Record<string, any> ? ObjectFieldSelection<UnArray<NonNullable<QueryResponse>>> & {
|
|
82
|
-
[argsKey]: QueryArgs;
|
|
83
|
-
} : ObjectFieldSelection<UnArray<NonNullable<QueryResponse>>>>(s: Selected) => QueryResponse extends null ? Subscribeable<NonNullable<QueryResponse> extends Array<any> ? ApplySelection<UnArray<NonNullable<QueryResponse>>, Selected>[] : ApplySelection<UnArray<NonNullable<QueryResponse>>, Selected>> | null : Subscribeable<QueryResponse extends Array<any> ? ApplySelection<UnArray<QueryResponse>, Selected>[] : ApplySelection<UnArray<QueryResponse>, Selected>> : Subscribeable<T>;
|
|
84
|
-
|
|
85
|
-
declare const pluginName = "ManualFiltersPlugin";
|
|
86
|
-
|
|
87
|
-
declare const applyFiltersKey = "applyFilters";
|
|
88
|
-
declare class ManualFiltersPlugin<Types extends SchemaTypes> extends BasePlugin<Types> {
|
|
89
|
-
wrapResolve(resolver: GraphQLFieldResolver<unknown, Types["Context"], object>, fieldConfig: PothosOutputFieldConfig<Types>): GraphQLFieldResolver<unknown, Types["Context"], object>;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
type Filter<Context, T> = (p: {
|
|
93
|
-
context: Context;
|
|
94
|
-
entities: T[];
|
|
95
|
-
}) => T[] | Promise<T[]>;
|
|
96
|
-
type ApplyFiltersField<Context, T> = Filter<Context, T> | Filter<Context, T>[] | undefined;
|
|
97
|
-
declare global {
|
|
98
|
-
export namespace PothosSchemaTypes {
|
|
99
|
-
interface Plugins<Types extends SchemaTypes> {
|
|
100
|
-
[pluginName]: ManualFiltersPlugin<Types>;
|
|
101
|
-
}
|
|
102
|
-
interface ObjectTypeOptions<Types extends SchemaTypes, Shape> {
|
|
103
|
-
[applyFiltersKey]?: ApplyFiltersField<Types["Context"], any>;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
*
|
|
110
|
-
* Helper function to map a drizzle findFirst query result,
|
|
111
|
-
* which may be optional, to a correct drizzle type.
|
|
112
|
-
*
|
|
113
|
-
* @throws RumbleError
|
|
114
|
-
*
|
|
115
|
-
* @example
|
|
116
|
-
*
|
|
117
|
-
* ```ts
|
|
118
|
-
* schemaBuilder.queryFields((t) => {
|
|
119
|
-
return {
|
|
120
|
-
findFirstUser: t.drizzleField({
|
|
121
|
-
type: UserRef,
|
|
122
|
-
resolve: (query, root, args, ctx, info) => {
|
|
123
|
-
return (
|
|
124
|
-
db.query.users
|
|
125
|
-
.findFirst({
|
|
126
|
-
...query,
|
|
127
|
-
where: ctx.abilities.users.filter("read").single.where,
|
|
128
|
-
})
|
|
129
|
-
// note that we need to manually raise an error if the value is not found
|
|
130
|
-
.then(assertFindFirstExists)
|
|
131
|
-
);
|
|
132
|
-
},
|
|
133
|
-
}),
|
|
134
|
-
};
|
|
135
|
-
});
|
|
136
|
-
* ```
|
|
137
|
-
*/
|
|
138
|
-
declare const assertFindFirstExists: <T>(value: T | undefined) => T;
|
|
139
|
-
/**
|
|
140
|
-
*
|
|
141
|
-
* Helper function to map a drizzle findFirst query result,
|
|
142
|
-
* which may be optional, to a correct drizzle type.
|
|
143
|
-
*
|
|
144
|
-
* @throws RumbleError
|
|
145
|
-
*
|
|
146
|
-
* @example
|
|
147
|
-
*
|
|
148
|
-
* ```ts
|
|
149
|
-
schemaBuilder.mutationFields((t) => {
|
|
150
|
-
return {
|
|
151
|
-
updateUsername: t.drizzleField({
|
|
152
|
-
type: UserRef,
|
|
153
|
-
args: {
|
|
154
|
-
userId: t.arg.int({ required: true }),
|
|
155
|
-
newName: t.arg.string({ required: true }),
|
|
156
|
-
},
|
|
157
|
-
resolve: (query, root, args, ctx, info) => {
|
|
158
|
-
return db
|
|
159
|
-
.update(schema.users)
|
|
160
|
-
.set({
|
|
161
|
-
name: args.newName,
|
|
162
|
-
})
|
|
163
|
-
.where(
|
|
164
|
-
and(
|
|
165
|
-
eq(schema.users.id, args.userId),
|
|
166
|
-
ctx.abilities.users.filter("update").single.where
|
|
167
|
-
)
|
|
168
|
-
)
|
|
169
|
-
.returning({ id: schema.users.id, name: schema.users.name })
|
|
170
|
-
// note that we need to manually raise an error if the value is not found
|
|
171
|
-
.then(assertFirstEntryExists);
|
|
172
|
-
},
|
|
173
|
-
}),
|
|
174
|
-
};
|
|
175
|
-
});
|
|
176
|
-
* ```
|
|
177
|
-
*/
|
|
178
|
-
declare const assertFirstEntryExists: <T>(value: T[]) => T;
|
|
179
|
-
/**
|
|
180
|
-
* Helper to map null fields to undefined
|
|
181
|
-
* @param obj The object to map
|
|
182
|
-
* @returns The mapped object with all fields of 'null' transformed to 'undefined'
|
|
183
|
-
*
|
|
184
|
-
* This becomes useful for update mutations where you do not want to pass null (unset value in db)
|
|
185
|
-
* but undefined (do not touch value in db) in case of a value not beeing set in the args of said mutation
|
|
186
|
-
* @example
|
|
187
|
-
* ```ts
|
|
188
|
-
* updateUser: t.drizzleField({
|
|
189
|
-
type: User,
|
|
190
|
-
args: {
|
|
191
|
-
id: t.arg.string({ required: true }),
|
|
192
|
-
email: t.arg.string(),
|
|
193
|
-
lastName: t.arg.string(),
|
|
194
|
-
firstName: t.arg.string(),
|
|
195
|
-
},
|
|
196
|
-
resolve: async (query, root, args, ctx, info) => {
|
|
197
|
-
const mappedArgs = mapNullFieldsToUndefined(args);
|
|
198
|
-
const user = await db.transaction(async (tx) => {
|
|
199
|
-
const user = await tx
|
|
200
|
-
.update(schema.user)
|
|
201
|
-
.set({
|
|
202
|
-
|
|
203
|
-
// email: args.email ?? undefined,
|
|
204
|
-
// lastName: args.lastName ?? undefined,
|
|
205
|
-
// firstName: args.firstName ?? undefined,
|
|
206
|
-
|
|
207
|
-
// becomes this
|
|
208
|
-
|
|
209
|
-
email: mappedArgs.email,
|
|
210
|
-
lastName: mappedArgs.lastName,
|
|
211
|
-
firstName: mappedArgs.firstName,
|
|
212
|
-
})
|
|
213
|
-
.returning()
|
|
214
|
-
.then(assertFirstEntryExists);
|
|
215
|
-
return user;
|
|
216
|
-
});
|
|
217
|
-
|
|
218
|
-
pubsub.updated(user.id);
|
|
219
|
-
|
|
220
|
-
return db.query.user
|
|
221
|
-
.findFirst(
|
|
222
|
-
query(
|
|
223
|
-
ctx.abilities.user.filter('read', {
|
|
224
|
-
inject: {
|
|
225
|
-
where: { id: user.id },
|
|
226
|
-
},
|
|
227
|
-
}).query.single,
|
|
228
|
-
),
|
|
229
|
-
)
|
|
230
|
-
.then(assertFindFirstExists);
|
|
231
|
-
},
|
|
232
|
-
}),
|
|
233
|
-
*
|
|
234
|
-
*
|
|
235
|
-
* ```
|
|
236
|
-
*/
|
|
237
|
-
declare function mapNullFieldsToUndefined<T extends object>(obj: T): { [K in keyof T]: T[K] extends null ? undefined : Exclude<T[K], null>; };
|
|
238
|
-
|
|
239
|
-
type GenericDrizzleDbTypeConstraints = {
|
|
240
|
-
query: {
|
|
241
|
-
[key: string]: {
|
|
242
|
-
findMany: (P: Partial<{
|
|
243
|
-
where: any;
|
|
244
|
-
columns: any;
|
|
245
|
-
limit: any;
|
|
246
|
-
}>) => any;
|
|
247
|
-
findFirst: (P: Partial<{
|
|
248
|
-
where: any;
|
|
249
|
-
columns: any;
|
|
250
|
-
}>) => any;
|
|
251
|
-
};
|
|
252
|
-
};
|
|
253
|
-
execute?: PgDatabase<any, any>["execute"] | MySqlDatabase<any, any>["execute"] | SingleStoreDatabase<any, any>["execute"] | undefined;
|
|
254
|
-
run?: BaseSQLiteDatabase<any, any>["run"];
|
|
255
|
-
} & DrizzleClient;
|
|
256
|
-
|
|
257
|
-
type CustomRumblePothosConfig = Omit<ConstructorParameters<typeof SchemaBuilder__default>[0], "smartSubscriptions" | "drizzle">;
|
|
258
|
-
type RumbleInput<UserContext extends Record<string, any>, DB extends GenericDrizzleDbTypeConstraints, RequestEvent extends Record<string, any>, Action extends string, PothosConfig extends CustomRumblePothosConfig> = {
|
|
259
|
-
/**
|
|
260
|
-
* Your drizzle database instance
|
|
261
|
-
*/
|
|
262
|
-
db: DB;
|
|
263
|
-
/**
|
|
264
|
-
* A function for providing context for each request based on the incoming HTTP Request.
|
|
265
|
-
* The type of the parameter equals the HTTPRequest type of your chosen server.
|
|
266
|
-
*/
|
|
267
|
-
context?: ((event: RequestEvent) => Promise<UserContext> | UserContext) | undefined;
|
|
268
|
-
/**
|
|
269
|
-
* If you only want to disable query, mutation or subscription default objects, you can do so here
|
|
270
|
-
*/
|
|
271
|
-
disableDefaultObjects?: {
|
|
272
|
-
mutation?: boolean;
|
|
273
|
-
subscription?: boolean;
|
|
274
|
-
query?: boolean;
|
|
275
|
-
};
|
|
276
|
-
/**
|
|
277
|
-
* The actions that are available
|
|
278
|
-
*/
|
|
279
|
-
actions?: Action[];
|
|
280
|
-
/**
|
|
281
|
-
* Customization for subscriptions. See https://the-guild.dev/graphql/yoga-server/docs/features/subscriptions#distributed-pubsub-for-production
|
|
282
|
-
*/
|
|
283
|
-
subscriptions?: Parameters<typeof createPubSub>;
|
|
284
|
-
/**
|
|
285
|
-
* Options passed along to the pothos schema builder.
|
|
286
|
-
*/
|
|
287
|
-
pothosConfig?: PothosConfig;
|
|
288
|
-
/**
|
|
289
|
-
* Limits the returned amount when querying lists. Set to null to disable.
|
|
290
|
-
* @default 100
|
|
291
|
-
*/
|
|
292
|
-
defaultLimit?: number | undefined | null;
|
|
293
|
-
/**
|
|
294
|
-
* rumble supports fuzzy search for the query helpers. This enables the users of your API to search for entities via fuzzy search inputs.
|
|
295
|
-
* This currently only is supported by postgres databases and will fail if enabled on other dialects.
|
|
296
|
-
*
|
|
297
|
-
* Please note that this will install the pg_trgm extension on startup if your database does not have it already installed.
|
|
298
|
-
* https://www.postgresql.org/docs/current/pgtrgm.html
|
|
299
|
-
*/
|
|
300
|
-
search?: {
|
|
301
|
-
/**
|
|
302
|
-
* Whether search is enabled
|
|
303
|
-
*/
|
|
304
|
-
enabled?: boolean;
|
|
305
|
-
/**
|
|
306
|
-
* The threshold for cutting off non matching results. Defaults to 0.1. Lower = more results.
|
|
307
|
-
*/
|
|
308
|
-
threshold?: number;
|
|
309
|
-
} | undefined;
|
|
310
|
-
};
|
|
311
|
-
|
|
312
|
-
type NumberWhereInputArgument = {
|
|
313
|
-
eq?: number;
|
|
314
|
-
ne?: number;
|
|
315
|
-
gt?: number;
|
|
316
|
-
gte?: number;
|
|
317
|
-
lt?: number;
|
|
318
|
-
lte?: number;
|
|
319
|
-
in?: number[];
|
|
320
|
-
notIn?: number[];
|
|
321
|
-
like?: string;
|
|
322
|
-
ilike?: string;
|
|
323
|
-
notLike?: string;
|
|
324
|
-
notIlike?: string;
|
|
325
|
-
isNull?: boolean;
|
|
326
|
-
isNotNull?: boolean;
|
|
327
|
-
arrayOverlaps?: number[];
|
|
328
|
-
arrayContained?: number[];
|
|
329
|
-
arrayContains?: number[];
|
|
330
|
-
AND?: NumberWhereInputArgument[];
|
|
331
|
-
OR?: NumberWhereInputArgument[];
|
|
332
|
-
NOT?: NumberWhereInputArgument;
|
|
333
|
-
};
|
|
334
|
-
type StringWhereInputArgument = {
|
|
335
|
-
eq?: string;
|
|
336
|
-
ne?: string;
|
|
337
|
-
gt?: string;
|
|
338
|
-
gte?: string;
|
|
339
|
-
lt?: string;
|
|
340
|
-
lte?: string;
|
|
341
|
-
in?: string[];
|
|
342
|
-
notIn?: string[];
|
|
343
|
-
like?: string;
|
|
344
|
-
ilike?: string;
|
|
345
|
-
notLike?: string;
|
|
346
|
-
notIlike?: string;
|
|
347
|
-
isNull?: boolean;
|
|
348
|
-
isNotNull?: boolean;
|
|
349
|
-
arrayOverlaps?: string[];
|
|
350
|
-
arrayContained?: string[];
|
|
351
|
-
arrayContains?: string[];
|
|
352
|
-
AND?: StringWhereInputArgument[];
|
|
353
|
-
OR?: StringWhereInputArgument[];
|
|
354
|
-
NOT?: StringWhereInputArgument;
|
|
355
|
-
};
|
|
356
|
-
type DateWhereInputArgument = {
|
|
357
|
-
eq?: Date;
|
|
358
|
-
ne?: Date;
|
|
359
|
-
gt?: Date;
|
|
360
|
-
gte?: Date;
|
|
361
|
-
lt?: Date;
|
|
362
|
-
lte?: Date;
|
|
363
|
-
in?: Date[];
|
|
364
|
-
notIn?: Date[];
|
|
365
|
-
like?: string;
|
|
366
|
-
ilike?: string;
|
|
367
|
-
notLike?: string;
|
|
368
|
-
notIlike?: string;
|
|
369
|
-
isNull?: boolean;
|
|
370
|
-
isNotNull?: boolean;
|
|
371
|
-
arrayOverlaps?: Date[];
|
|
372
|
-
arrayContained?: Date[];
|
|
373
|
-
arrayContains?: Date[];
|
|
374
|
-
AND?: DateWhereInputArgument[];
|
|
375
|
-
OR?: DateWhereInputArgument[];
|
|
376
|
-
NOT?: DateWhereInputArgument;
|
|
377
|
-
};
|
|
378
|
-
|
|
379
|
-
type EnumTypes = PgEnum<any>;
|
|
380
|
-
type NonEnumFields<T> = {
|
|
381
|
-
[K in keyof T as T[K] extends EnumTypes ? never : K]: T[K];
|
|
382
|
-
};
|
|
383
|
-
|
|
384
|
-
declare const rumble: <UserContext extends Record<string, any>, DB extends GenericDrizzleDbTypeConstraints, RequestEvent extends Record<string, any>, PothosConfig extends CustomRumblePothosConfig, Action extends string = "read" | "update" | "delete">(rumbleInput: RumbleInput<UserContext, DB, RequestEvent, Action, PothosConfig>) => {
|
|
385
|
-
/**
|
|
386
|
-
* The ability builder. Use it to declare whats allowed for each entity in your DB.
|
|
387
|
-
*
|
|
388
|
-
* @example
|
|
389
|
-
*
|
|
390
|
-
* ```ts
|
|
391
|
-
* // users can edit themselves
|
|
392
|
-
abilityBuilder.users
|
|
393
|
-
.allow(["read", "update", "delete"])
|
|
394
|
-
.when(({ userId }) => ({ where: eq(schema.users.id, userId) }));
|
|
395
|
-
|
|
396
|
-
// everyone can read posts
|
|
397
|
-
abilityBuilder.posts.allow("read");
|
|
398
|
-
*
|
|
399
|
-
* ```
|
|
400
|
-
*/
|
|
401
|
-
abilityBuilder: (keyof DB["query"] extends infer T extends keyof DB["query"] ? { [key in T]: {
|
|
402
|
-
allow: (action: Action | Action[]) => {
|
|
403
|
-
when: (queryFilter: Parameters<DB["query"][key]["findMany"]>[0] | ((context: UserContext) => "allow" | Parameters<DB["query"][key]["findMany"]>[0] | undefined)) => void;
|
|
404
|
-
};
|
|
405
|
-
filter: (action: Action | Action[]) => {
|
|
406
|
-
by: (explicitFilter: Filter<UserContext, NonNullable<Awaited<ReturnType<DB["query"][key]["findFirst"]>>>>) => void;
|
|
407
|
-
};
|
|
408
|
-
}; } : never) & {
|
|
409
|
-
z_registeredQueryFilters: keyof DB["query"] extends infer T_1 extends keyof DB["query"] ? { [key_1 in T_1]: { [key_2 in Action]: any[] | "unspecified"; }; } : never;
|
|
410
|
-
z_registeredFilters: keyof DB["query"] extends infer T_2 extends keyof DB["query"] ? { [key_3 in T_2]: { [key_4 in Action]: Filter<UserContext, any>[]; }; } : never;
|
|
411
|
-
z_buildWithUserContext: (userContext: UserContext) => keyof DB["query"] extends infer T_3 extends keyof DB["query"] ? { [key_5 in T_3]: {
|
|
412
|
-
filter: <Injection extends Parameters<DB["query"][key_5]["findMany"]>[0]>(action: Action, options?: {
|
|
413
|
-
inject?: Injection | undefined;
|
|
414
|
-
} | undefined) => {
|
|
415
|
-
query: {
|
|
416
|
-
single: Pick<NonNullable<NonNullable<Parameters<DB["query"][key_5]["findFirst"]>[0]>>, "columns" | "where">;
|
|
417
|
-
many: Pick<NonNullable<NonNullable<Parameters<DB["query"][key_5]["findMany"]>[0]>>, "columns" | "where" | "limit">;
|
|
418
|
-
};
|
|
419
|
-
sql: {
|
|
420
|
-
readonly where: drizzle_orm.SQL<unknown> | undefined;
|
|
421
|
-
};
|
|
422
|
-
};
|
|
423
|
-
runtimeFilters: (action: Action) => (keyof DB["query"] extends infer T_4 extends keyof DB["query"] ? { [key_3 in T_4]: { [key_4 in Action]: Filter<UserContext, any>[]; }; } : never)[key_5][Action];
|
|
424
|
-
}; } : never;
|
|
425
|
-
};
|
|
426
|
-
/**
|
|
427
|
-
* The pothos schema builder. See https://pothos-graphql.dev/docs/plugins/drizzle
|
|
428
|
-
*/
|
|
429
|
-
schemaBuilder: PothosSchemaTypes.SchemaBuilder<PothosSchemaTypes.ExtendDefaultTypes<{
|
|
430
|
-
Context: Awaited<UserContext & {
|
|
431
|
-
abilities: keyof DB["query"] extends infer T_3 extends keyof DB["query"] ? { [key_5 in T_3]: {
|
|
432
|
-
filter: <Injection extends Parameters<DB["query"][key_5]["findMany"]>[0]>(action: Action, options?: {
|
|
433
|
-
inject?: Injection | undefined;
|
|
434
|
-
} | undefined) => {
|
|
435
|
-
query: {
|
|
436
|
-
single: Pick<NonNullable<NonNullable<Parameters<DB["query"][key_5]["findFirst"]>[0]>>, "columns" | "where">;
|
|
437
|
-
many: Pick<NonNullable<NonNullable<Parameters<DB["query"][key_5]["findMany"]>[0]>>, "columns" | "where" | "limit">;
|
|
438
|
-
};
|
|
439
|
-
sql: {
|
|
440
|
-
readonly where: drizzle_orm.SQL<unknown> | undefined;
|
|
441
|
-
};
|
|
442
|
-
};
|
|
443
|
-
runtimeFilters: (action: Action) => (keyof DB["query"] extends infer T_4 extends keyof DB["query"] ? { [key_3 in T_4]: { [key_4 in Action]: Filter<UserContext, any>[]; }; } : never)[key_5][Action];
|
|
444
|
-
}; } : never;
|
|
445
|
-
}>;
|
|
446
|
-
DrizzleRelations: DB["_"]["relations"];
|
|
447
|
-
Scalars: {
|
|
448
|
-
JSON: {
|
|
449
|
-
Input: unknown;
|
|
450
|
-
Output: unknown;
|
|
451
|
-
};
|
|
452
|
-
Date: {
|
|
453
|
-
Input: Date;
|
|
454
|
-
Output: Date;
|
|
455
|
-
};
|
|
456
|
-
DateTime: {
|
|
457
|
-
Input: Date;
|
|
458
|
-
Output: Date;
|
|
459
|
-
};
|
|
460
|
-
};
|
|
461
|
-
Inputs: {
|
|
462
|
-
IntWhereInputArgument: NumberWhereInputArgument;
|
|
463
|
-
FloatWhereInputArgument: NumberWhereInputArgument;
|
|
464
|
-
StringWhereInputArgument: StringWhereInputArgument;
|
|
465
|
-
DateWhereInputArgument: DateWhereInputArgument;
|
|
466
|
-
};
|
|
467
|
-
}>>;
|
|
468
|
-
/**
|
|
469
|
-
* Creates the native yoga instance. Can be used to run an actual HTTP server.
|
|
470
|
-
*
|
|
471
|
-
* @example
|
|
472
|
-
*
|
|
473
|
-
* ```ts
|
|
474
|
-
*
|
|
475
|
-
import { createServer } from "node:http";
|
|
476
|
-
* const server = createServer(createYoga());
|
|
477
|
-
server.listen(3000, () => {
|
|
478
|
-
console.info("Visit http://localhost:3000/graphql");
|
|
479
|
-
});
|
|
480
|
-
* ```
|
|
481
|
-
* https://the-guild.dev/graphql/yoga-server/docs#server
|
|
482
|
-
*/
|
|
483
|
-
createYoga: (args?: (Omit<YogaServerOptions<RequestEvent, any>, "schema" | "context"> & {
|
|
484
|
-
/**
|
|
485
|
-
* Determines if the API should disclose various things about its structure.
|
|
486
|
-
* Defaults to `process.env.NODE_ENV === "development"`.
|
|
487
|
-
* If enabled, the api will allow introspection requests, provide the graphiql
|
|
488
|
-
* explorer and will not apply the additional envelop armor plugin.
|
|
489
|
-
*/
|
|
490
|
-
enableApiDocs?: boolean;
|
|
491
|
-
}) | undefined) => graphql_yoga.YogaServerInstance<RequestEvent, {}>;
|
|
492
|
-
/**
|
|
493
|
-
* Creates a sofa instance to offer a REST API.
|
|
494
|
-
```ts
|
|
495
|
-
import express from 'express';
|
|
496
|
-
|
|
497
|
-
const app = express();
|
|
498
|
-
const sofa = createSofa(...);
|
|
499
|
-
|
|
500
|
-
app.use('/api', useSofa({ schema }));
|
|
501
|
-
```
|
|
502
|
-
* https://the-guild.dev/graphql/sofa-api/docs#usage
|
|
503
|
-
*/
|
|
504
|
-
createSofa: (args: Omit<Parameters<typeof useSofa>[0], "schema" | "context">) => fets.Router<any, {}, {
|
|
505
|
-
[TKey: string]: never;
|
|
506
|
-
}>;
|
|
507
|
-
/**
|
|
508
|
-
* A function for creating default objects for your schema
|
|
509
|
-
*/
|
|
510
|
-
object: <ExplicitTableName extends keyof NonEnumFields<NonNullable<DB["_"]["relations"]["schema"]>>, RefName extends string>({ table, refName, readAction, adjust, }: {
|
|
511
|
-
table: ExplicitTableName;
|
|
512
|
-
refName?: RefName | undefined;
|
|
513
|
-
readAction?: Action | undefined;
|
|
514
|
-
adjust?: ((t: _pothos_plugin_drizzle.DrizzleObjectFieldBuilder<PothosSchemaTypes.ExtendDefaultTypes<{
|
|
515
|
-
Context: Awaited<UserContext & {
|
|
516
|
-
abilities: keyof DB["query"] extends infer T_4 extends keyof DB["query"] ? { [key_5 in T_4]: {
|
|
517
|
-
filter: <Injection extends Parameters<DB["query"][key_5]["findMany"]>[0]>(action: Action, options?: {
|
|
518
|
-
inject?: Injection | undefined;
|
|
519
|
-
} | undefined) => {
|
|
520
|
-
query: {
|
|
521
|
-
single: Pick<NonNullable<NonNullable<Parameters<DB["query"][key_5]["findFirst"]>[0]>>, "columns" | "where">;
|
|
522
|
-
many: Pick<NonNullable<NonNullable<Parameters<DB["query"][key_5]["findMany"]>[0]>>, "columns" | "where" | "limit">;
|
|
523
|
-
};
|
|
524
|
-
sql: {
|
|
525
|
-
readonly where: drizzle_orm.SQL<unknown> | undefined;
|
|
526
|
-
};
|
|
527
|
-
};
|
|
528
|
-
runtimeFilters: (action: Action) => (keyof DB["query"] extends infer T_5 extends keyof DB["query"] ? { [key_3 in T_5]: { [key_4 in Action]: Filter<UserContext, any>[]; }; } : never)[key_5][Action];
|
|
529
|
-
}; } : never;
|
|
530
|
-
}>;
|
|
531
|
-
DrizzleRelations: DB["_"]["relations"];
|
|
532
|
-
Scalars: {
|
|
533
|
-
JSON: {
|
|
534
|
-
Input: unknown;
|
|
535
|
-
Output: unknown;
|
|
536
|
-
};
|
|
537
|
-
Date: {
|
|
538
|
-
Input: Date;
|
|
539
|
-
Output: Date;
|
|
540
|
-
};
|
|
541
|
-
DateTime: {
|
|
542
|
-
Input: Date;
|
|
543
|
-
Output: Date;
|
|
544
|
-
};
|
|
545
|
-
};
|
|
546
|
-
Inputs: {
|
|
547
|
-
IntWhereInputArgument: NumberWhereInputArgument;
|
|
548
|
-
FloatWhereInputArgument: NumberWhereInputArgument;
|
|
549
|
-
StringWhereInputArgument: StringWhereInputArgument;
|
|
550
|
-
DateWhereInputArgument: DateWhereInputArgument;
|
|
551
|
-
};
|
|
552
|
-
}>, drizzle_orm.ExtractTablesWithRelations<DB["_"]["relations"] & {}, (DB["_"]["relations"] & {})["tables"]>[ExplicitTableName], NonNullable<Awaited<ReturnType<DB["query"][ExplicitTableName]["findFirst"]>>>, { [Key in keyof Extract<drizzle_orm.ExtractTablesWithRelations<DB["_"]["relations"] & {}, (DB["_"]["relations"] & {})["tables"]>[ExplicitTableName]["table"], {
|
|
553
|
-
_: {
|
|
554
|
-
brand: "Table";
|
|
555
|
-
};
|
|
556
|
-
}>["_"]["columns"] & string as Key]: Extract<drizzle_orm.ExtractTablesWithRelations<DB["_"]["relations"] & {}, (DB["_"]["relations"] & {})["tables"]>[ExplicitTableName]["table"], {
|
|
557
|
-
_: {
|
|
558
|
-
brand: "Table";
|
|
559
|
-
};
|
|
560
|
-
}>["_"]["columns"][Key]["_"]["notNull"] extends true ? Extract<drizzle_orm.ExtractTablesWithRelations<DB["_"]["relations"] & {}, (DB["_"]["relations"] & {})["tables"]>[ExplicitTableName]["table"], {
|
|
561
|
-
_: {
|
|
562
|
-
brand: "Table";
|
|
563
|
-
};
|
|
564
|
-
}>["_"]["columns"][Key]["_"]["data"] : Extract<drizzle_orm.ExtractTablesWithRelations<DB["_"]["relations"] & {}, (DB["_"]["relations"] & {})["tables"]>[ExplicitTableName]["table"], {
|
|
565
|
-
_: {
|
|
566
|
-
brand: "Table";
|
|
567
|
-
};
|
|
568
|
-
}>["_"]["columns"][Key]["_"]["data"] | null; } extends infer T_5 ? { [K in keyof T_5]: { [Key in keyof Extract<drizzle_orm.ExtractTablesWithRelations<DB["_"]["relations"] & {}, (DB["_"]["relations"] & {})["tables"]>[ExplicitTableName]["table"], {
|
|
569
|
-
_: {
|
|
570
|
-
brand: "Table";
|
|
571
|
-
};
|
|
572
|
-
}>["_"]["columns"] & string as Key]: Extract<drizzle_orm.ExtractTablesWithRelations<DB["_"]["relations"] & {}, (DB["_"]["relations"] & {})["tables"]>[ExplicitTableName]["table"], {
|
|
573
|
-
_: {
|
|
574
|
-
brand: "Table";
|
|
575
|
-
};
|
|
576
|
-
}>["_"]["columns"][Key]["_"]["notNull"] extends true ? Extract<drizzle_orm.ExtractTablesWithRelations<DB["_"]["relations"] & {}, (DB["_"]["relations"] & {})["tables"]>[ExplicitTableName]["table"], {
|
|
577
|
-
_: {
|
|
578
|
-
brand: "Table";
|
|
579
|
-
};
|
|
580
|
-
}>["_"]["columns"][Key]["_"]["data"] : Extract<drizzle_orm.ExtractTablesWithRelations<DB["_"]["relations"] & {}, (DB["_"]["relations"] & {})["tables"]>[ExplicitTableName]["table"], {
|
|
581
|
-
_: {
|
|
582
|
-
brand: "Table";
|
|
583
|
-
};
|
|
584
|
-
}>["_"]["columns"][Key]["_"]["data"] | null; }[K]; } : never>) => SchemaBuilder.FieldMap) | undefined;
|
|
585
|
-
}) => _pothos_plugin_drizzle.DrizzleObjectRef<PothosSchemaTypes.ExtendDefaultTypes<{
|
|
586
|
-
Context: Awaited<UserContext & {
|
|
587
|
-
abilities: keyof DB["query"] extends infer T_4 extends keyof DB["query"] ? { [key_5 in T_4]: {
|
|
588
|
-
filter: <Injection extends Parameters<DB["query"][key_5]["findMany"]>[0]>(action: Action, options?: {
|
|
589
|
-
inject?: Injection | undefined;
|
|
590
|
-
} | undefined) => {
|
|
591
|
-
query: {
|
|
592
|
-
single: Pick<NonNullable<NonNullable<Parameters<DB["query"][key_5]["findFirst"]>[0]>>, "columns" | "where">;
|
|
593
|
-
many: Pick<NonNullable<NonNullable<Parameters<DB["query"][key_5]["findMany"]>[0]>>, "columns" | "where" | "limit">;
|
|
594
|
-
};
|
|
595
|
-
sql: {
|
|
596
|
-
readonly where: drizzle_orm.SQL<unknown> | undefined;
|
|
597
|
-
};
|
|
598
|
-
};
|
|
599
|
-
runtimeFilters: (action: Action) => (keyof DB["query"] extends infer T_5 extends keyof DB["query"] ? { [key_3 in T_5]: { [key_4 in Action]: Filter<UserContext, any>[]; }; } : never)[key_5][Action];
|
|
600
|
-
}; } : never;
|
|
601
|
-
}>;
|
|
602
|
-
DrizzleRelations: DB["_"]["relations"];
|
|
603
|
-
Scalars: {
|
|
604
|
-
JSON: {
|
|
605
|
-
Input: unknown;
|
|
606
|
-
Output: unknown;
|
|
607
|
-
};
|
|
608
|
-
Date: {
|
|
609
|
-
Input: Date;
|
|
610
|
-
Output: Date;
|
|
611
|
-
};
|
|
612
|
-
DateTime: {
|
|
613
|
-
Input: Date;
|
|
614
|
-
Output: Date;
|
|
615
|
-
};
|
|
616
|
-
};
|
|
617
|
-
Inputs: {
|
|
618
|
-
IntWhereInputArgument: NumberWhereInputArgument;
|
|
619
|
-
FloatWhereInputArgument: NumberWhereInputArgument;
|
|
620
|
-
StringWhereInputArgument: StringWhereInputArgument;
|
|
621
|
-
DateWhereInputArgument: DateWhereInputArgument;
|
|
622
|
-
};
|
|
623
|
-
}>, ExplicitTableName, drizzle_orm.BuildQueryResult<drizzle_orm.ExtractTablesWithRelations<DB["_"]["relations"] & {}, (DB["_"]["relations"] & {})["tables"]>, drizzle_orm.ExtractTablesWithRelations<DB["_"]["relations"] & {}, (DB["_"]["relations"] & {})["tables"]>[ExplicitTableName], true | drizzle_orm.DBQueryConfig<"one", drizzle_orm.ExtractTablesWithRelations<DB["_"]["relations"] & {}, (DB["_"]["relations"] & {})["tables"]>, drizzle_orm.ExtractTablesWithRelations<DB["_"]["relations"] & {}, (DB["_"]["relations"] & {})["tables"]>[ExplicitTableName]>>>;
|
|
624
|
-
/**
|
|
625
|
-
* A function for creating where args to filter entities
|
|
626
|
-
*/
|
|
627
|
-
whereArg: <ExplicitTableName extends keyof NonEnumFields<NonNullable<DB["_"]["relations"]["schema"]>>, RefName_1 extends string>({ table, refName, dbName, }: Partial<{
|
|
628
|
-
table: ExplicitTableName;
|
|
629
|
-
refName: RefName_1 | undefined;
|
|
630
|
-
dbName: string;
|
|
631
|
-
}> & ({
|
|
632
|
-
dbName: string;
|
|
633
|
-
} | {
|
|
634
|
-
table: ExplicitTableName;
|
|
635
|
-
})) => PothosSchemaTypes.InputObjectRef<PothosSchemaTypes.ExtendDefaultTypes<{
|
|
636
|
-
Context: Awaited<UserContext & {
|
|
637
|
-
abilities: keyof DB["query"] extends infer T_4 extends keyof DB["query"] ? { [key_5 in T_4]: {
|
|
638
|
-
filter: <Injection extends Parameters<DB["query"][key_5]["findMany"]>[0]>(action: Action, options?: {
|
|
639
|
-
inject?: Injection | undefined;
|
|
640
|
-
} | undefined) => {
|
|
641
|
-
query: {
|
|
642
|
-
single: Pick<NonNullable<NonNullable<Parameters<DB["query"][key_5]["findFirst"]>[0]>>, "columns" | "where">;
|
|
643
|
-
many: Pick<NonNullable<NonNullable<Parameters<DB["query"][key_5]["findMany"]>[0]>>, "columns" | "where" | "limit">;
|
|
644
|
-
};
|
|
645
|
-
sql: {
|
|
646
|
-
readonly where: drizzle_orm.SQL<unknown> | undefined;
|
|
647
|
-
};
|
|
648
|
-
};
|
|
649
|
-
runtimeFilters: (action: Action) => (keyof DB["query"] extends infer T_5 extends keyof DB["query"] ? { [key_3 in T_5]: { [key_4 in Action]: Filter<UserContext, any>[]; }; } : never)[key_5][Action];
|
|
650
|
-
}; } : never;
|
|
651
|
-
}>;
|
|
652
|
-
DrizzleRelations: DB["_"]["relations"];
|
|
653
|
-
Scalars: {
|
|
654
|
-
JSON: {
|
|
655
|
-
Input: unknown;
|
|
656
|
-
Output: unknown;
|
|
657
|
-
};
|
|
658
|
-
Date: {
|
|
659
|
-
Input: Date;
|
|
660
|
-
Output: Date;
|
|
661
|
-
};
|
|
662
|
-
DateTime: {
|
|
663
|
-
Input: Date;
|
|
664
|
-
Output: Date;
|
|
665
|
-
};
|
|
666
|
-
};
|
|
667
|
-
Inputs: {
|
|
668
|
-
IntWhereInputArgument: NumberWhereInputArgument;
|
|
669
|
-
FloatWhereInputArgument: NumberWhereInputArgument;
|
|
670
|
-
StringWhereInputArgument: StringWhereInputArgument;
|
|
671
|
-
DateWhereInputArgument: DateWhereInputArgument;
|
|
672
|
-
};
|
|
673
|
-
}>, {
|
|
674
|
-
[x: string]: unknown;
|
|
675
|
-
}>;
|
|
676
|
-
/**
|
|
677
|
-
* A function for creating order args to sort entities
|
|
678
|
-
*/
|
|
679
|
-
orderArg: <ExplicitTableName extends keyof NonEnumFields<NonNullable<DB["_"]["relations"]["schema"]>>, RefName_2 extends string>({ table, refName, dbName, }: Partial<{
|
|
680
|
-
table: ExplicitTableName;
|
|
681
|
-
refName: RefName_2 | undefined;
|
|
682
|
-
dbName: string;
|
|
683
|
-
}> & ({
|
|
684
|
-
dbName: string;
|
|
685
|
-
} | {
|
|
686
|
-
table: ExplicitTableName;
|
|
687
|
-
})) => PothosSchemaTypes.InputObjectRef<PothosSchemaTypes.ExtendDefaultTypes<{
|
|
688
|
-
Context: Awaited<UserContext & {
|
|
689
|
-
abilities: keyof DB["query"] extends infer T_4 extends keyof DB["query"] ? { [key_5 in T_4]: {
|
|
690
|
-
filter: <Injection extends Parameters<DB["query"][key_5]["findMany"]>[0]>(action: Action, options?: {
|
|
691
|
-
inject?: Injection | undefined;
|
|
692
|
-
} | undefined) => {
|
|
693
|
-
query: {
|
|
694
|
-
single: Pick<NonNullable<NonNullable<Parameters<DB["query"][key_5]["findFirst"]>[0]>>, "columns" | "where">;
|
|
695
|
-
many: Pick<NonNullable<NonNullable<Parameters<DB["query"][key_5]["findMany"]>[0]>>, "columns" | "where" | "limit">;
|
|
696
|
-
};
|
|
697
|
-
sql: {
|
|
698
|
-
readonly where: drizzle_orm.SQL<unknown> | undefined;
|
|
699
|
-
};
|
|
700
|
-
};
|
|
701
|
-
runtimeFilters: (action: Action) => (keyof DB["query"] extends infer T_5 extends keyof DB["query"] ? { [key_3 in T_5]: { [key_4 in Action]: Filter<UserContext, any>[]; }; } : never)[key_5][Action];
|
|
702
|
-
}; } : never;
|
|
703
|
-
}>;
|
|
704
|
-
DrizzleRelations: DB["_"]["relations"];
|
|
705
|
-
Scalars: {
|
|
706
|
-
JSON: {
|
|
707
|
-
Input: unknown;
|
|
708
|
-
Output: unknown;
|
|
709
|
-
};
|
|
710
|
-
Date: {
|
|
711
|
-
Input: Date;
|
|
712
|
-
Output: Date;
|
|
713
|
-
};
|
|
714
|
-
DateTime: {
|
|
715
|
-
Input: Date;
|
|
716
|
-
Output: Date;
|
|
717
|
-
};
|
|
718
|
-
};
|
|
719
|
-
Inputs: {
|
|
720
|
-
IntWhereInputArgument: NumberWhereInputArgument;
|
|
721
|
-
FloatWhereInputArgument: NumberWhereInputArgument;
|
|
722
|
-
StringWhereInputArgument: StringWhereInputArgument;
|
|
723
|
-
DateWhereInputArgument: DateWhereInputArgument;
|
|
724
|
-
};
|
|
725
|
-
}>, {
|
|
726
|
-
[x: string]: unknown;
|
|
727
|
-
}>;
|
|
728
|
-
/**
|
|
729
|
-
* A function for creating default READ queries.
|
|
730
|
-
* Make sure the objects for the table you are creating the queries for are implemented
|
|
731
|
-
*/
|
|
732
|
-
query: <ExplicitTableName extends keyof NonEnumFields<NonNullable<DB["_"]["relations"]["schema"]>>>({ table, readAction, listAction, }: {
|
|
733
|
-
table: ExplicitTableName;
|
|
734
|
-
readAction?: Action | undefined;
|
|
735
|
-
listAction?: Action | undefined;
|
|
736
|
-
}) => void;
|
|
737
|
-
/**
|
|
738
|
-
* A function for creating a pubsub instance for a table. Use this to publish or subscribe events
|
|
739
|
-
*/
|
|
740
|
-
pubsub: <ExplicitTableName extends keyof NonEnumFields<NonNullable<DB["_"]["relations"]["schema"]>>>({ table, }: {
|
|
741
|
-
table: ExplicitTableName;
|
|
742
|
-
}) => {
|
|
743
|
-
registerOnInstance({ instance, action, primaryKeyValue, }: {
|
|
744
|
-
instance: {
|
|
745
|
-
register: (id: string) => void;
|
|
746
|
-
};
|
|
747
|
-
action: "created" | "removed" | "updated";
|
|
748
|
-
primaryKeyValue?: string;
|
|
749
|
-
}): void;
|
|
750
|
-
created(): void;
|
|
751
|
-
removed(): void;
|
|
752
|
-
updated(primaryKeyValue?: any | any[]): void;
|
|
753
|
-
};
|
|
754
|
-
/**
|
|
755
|
-
* A function to implement enums for graphql usage.
|
|
756
|
-
* The other helpers use this helper internally so in most cases you do not have to
|
|
757
|
-
* call this helper directly, unless you need the reference to an enum type
|
|
758
|
-
*/
|
|
759
|
-
enum_: <ExplicitEnumVariableName extends keyof (NonNullable<DB["_"]["relations"]["schema"]> extends infer T_4 ? { [K in keyof T_4 as NonNullable<DB["_"]["relations"]["schema"]>[K] extends drizzle_orm_pg_core.PgEnum<any> ? K : never]: NonNullable<DB["_"]["relations"]["schema"]>[K]; } : never), EnumColumn extends drizzle_orm_pg_core.PgEnum<any>, RefName_3 extends string>({ tsName, enumColumn, refName, }: Partial<{
|
|
760
|
-
tsName: ExplicitEnumVariableName;
|
|
761
|
-
enumColumn: EnumColumn;
|
|
762
|
-
refName?: RefName_3 | undefined;
|
|
763
|
-
}> & ({
|
|
764
|
-
tsName: ExplicitEnumVariableName;
|
|
765
|
-
} | {
|
|
766
|
-
enumColumn: EnumColumn;
|
|
767
|
-
})) => PothosSchemaTypes.EnumRef<PothosSchemaTypes.ExtendDefaultTypes<{
|
|
768
|
-
Context: Awaited<UserContext & {
|
|
769
|
-
abilities: keyof DB["query"] extends infer T_5 extends keyof DB["query"] ? { [key_5 in T_5]: {
|
|
770
|
-
filter: <Injection extends Parameters<DB["query"][key_5]["findMany"]>[0]>(action: Action, options?: {
|
|
771
|
-
inject?: Injection | undefined;
|
|
772
|
-
} | undefined) => {
|
|
773
|
-
query: {
|
|
774
|
-
single: Pick<NonNullable<NonNullable<Parameters<DB["query"][key_5]["findFirst"]>[0]>>, "columns" | "where">;
|
|
775
|
-
many: Pick<NonNullable<NonNullable<Parameters<DB["query"][key_5]["findMany"]>[0]>>, "columns" | "where" | "limit">;
|
|
776
|
-
};
|
|
777
|
-
sql: {
|
|
778
|
-
readonly where: drizzle_orm.SQL<unknown> | undefined;
|
|
779
|
-
};
|
|
780
|
-
};
|
|
781
|
-
runtimeFilters: (action: Action) => (keyof DB["query"] extends infer T_6 extends keyof DB["query"] ? { [key_3 in T_6]: { [key_4 in Action]: Filter<UserContext, any>[]; }; } : never)[key_5][Action];
|
|
782
|
-
}; } : never;
|
|
783
|
-
}>;
|
|
784
|
-
DrizzleRelations: DB["_"]["relations"];
|
|
785
|
-
Scalars: {
|
|
786
|
-
JSON: {
|
|
787
|
-
Input: unknown;
|
|
788
|
-
Output: unknown;
|
|
789
|
-
};
|
|
790
|
-
Date: {
|
|
791
|
-
Input: Date;
|
|
792
|
-
Output: Date;
|
|
793
|
-
};
|
|
794
|
-
DateTime: {
|
|
795
|
-
Input: Date;
|
|
796
|
-
Output: Date;
|
|
797
|
-
};
|
|
798
|
-
};
|
|
799
|
-
Inputs: {
|
|
800
|
-
IntWhereInputArgument: NumberWhereInputArgument;
|
|
801
|
-
FloatWhereInputArgument: NumberWhereInputArgument;
|
|
802
|
-
StringWhereInputArgument: StringWhereInputArgument;
|
|
803
|
-
DateWhereInputArgument: DateWhereInputArgument;
|
|
804
|
-
};
|
|
805
|
-
}>, any, any>;
|
|
806
|
-
/**
|
|
807
|
-
* Create a client to consume a rumble graphql api at the specified location.
|
|
808
|
-
* Requires GraphQL, does not work with the SOFA REST API.
|
|
809
|
-
*/
|
|
810
|
-
clientCreator: ({ apiUrl, outputPath, rumbleImportPath, useExternalUrqlClient, }: {
|
|
811
|
-
outputPath: string;
|
|
812
|
-
apiUrl?: string;
|
|
813
|
-
rumbleImportPath?: string;
|
|
814
|
-
useExternalUrqlClient?: string;
|
|
815
|
-
}) => Promise<void>;
|
|
816
|
-
};
|
|
817
|
-
|
|
818
|
-
/**
|
|
819
|
-
* An error that gets raised by rumble whenever something does not go according to plan.
|
|
820
|
-
* Mostly internals, configuration errors or other unexpected things.
|
|
821
|
-
*/
|
|
822
|
-
declare class RumbleError extends Error {
|
|
823
|
-
constructor(message: string);
|
|
824
|
-
}
|
|
825
|
-
/**
|
|
826
|
-
* An error that gets raised by rumble whenever an error occurs in a resolver, containing
|
|
827
|
-
* information safely exposeable to the user.
|
|
828
|
-
* E.g. the assert helpers issue these.
|
|
829
|
-
*/
|
|
830
|
-
declare class RumbleErrorSafe extends GraphQLError {
|
|
831
|
-
}
|
|
832
|
-
|
|
833
|
-
export { RumbleError, RumbleErrorSafe, assertFindFirstExists, assertFirstEntryExists, generateFromSchema, makeLiveQuery, makeMutation, makeQuery, makeSubscription, mapNullFieldsToUndefined, rumble };
|