@m1212e/rumble 0.5.5 → 0.6.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/index.d.ts CHANGED
@@ -1,10 +1,8 @@
1
- import * as drizzle_orm_mysql_core from 'drizzle-orm/mysql-core';
2
- import * as drizzle_orm_singlestore_core from 'drizzle-orm/singlestore-core';
3
1
  import * as drizzle_orm_pg_core from 'drizzle-orm/pg-core';
4
- import * as _pothos_plugin_drizzle from '@pothos/plugin-drizzle';
5
- import { DrizzleClient } from '@pothos/plugin-drizzle';
6
2
  import * as SchemaBuilder from '@pothos/core';
7
3
  import SchemaBuilder__default, { SchemaTypes, BasePlugin, PothosOutputFieldConfig } from '@pothos/core';
4
+ import * as _pothos_plugin_drizzle from '@pothos/plugin-drizzle';
5
+ import { DrizzleClient } from '@pothos/plugin-drizzle';
8
6
  import * as graphql_yoga from 'graphql-yoga';
9
7
  import { createPubSub, YogaServerOptions } from 'graphql-yoga';
10
8
  import * as drizzle_orm from 'drizzle-orm';
@@ -33,7 +31,7 @@ declare global {
33
31
  }
34
32
  }
35
33
 
36
- type QueryConditionObject = Partial<{
34
+ type QueryFilterObject = Partial<{
37
35
  where: any;
38
36
  columns: any;
39
37
  limit: any;
@@ -41,8 +39,8 @@ type QueryConditionObject = Partial<{
41
39
  type GenericDrizzleDbTypeConstraints = {
42
40
  query: {
43
41
  [key: string]: {
44
- findMany: (P: QueryConditionObject) => any;
45
- findFirst: (P: QueryConditionObject) => any;
42
+ findMany: (P: QueryFilterObject) => any;
43
+ findFirst: (P: QueryFilterObject) => any;
46
44
  };
47
45
  };
48
46
  } & DrizzleClient;
@@ -104,38 +102,33 @@ declare const rumble: <UserContext extends Record<string, any>, DB extends Gener
104
102
  */
105
103
  abilityBuilder: (keyof DB["query"] extends infer T extends keyof DB["query"] ? { [key in T]: {
106
104
  allow: (action: Action | Action[]) => {
107
- when: (condition: Parameters<DB["query"][keyof DB["query"]]["findMany"]>[0] | ((context: UserContext) => "allow" | Parameters<DB["query"][keyof DB["query"]]["findMany"]>[0] | undefined)) => void;
105
+ when: (queryFilter: Parameters<DB["query"][key]["findMany"]>[0] | ((context: UserContext) => "allow" | Parameters<DB["query"][key]["findMany"]>[0] | undefined)) => void;
108
106
  };
109
107
  filter: (action: Action | Action[]) => {
110
108
  by: (explicitFilter: Filter<UserContext, NonNullable<Awaited<ReturnType<DB["query"][key]["findFirst"]>>>>) => void;
111
109
  };
112
110
  }; } : never) & {
113
- registeredConditions: keyof DB["query"] extends infer T_1 extends keyof DB["query"] ? { [key_1 in T_1]: { [key_2 in Action]: "wildcard" | (Partial<{
114
- where: any;
115
- columns: any;
116
- limit: any;
117
- }> | ((context: UserContext) => "allow" | Partial<{
118
- where: any;
119
- columns: any;
120
- limit: any;
121
- }> | undefined))[]; }; } : never;
111
+ registeredQueryFilters: keyof DB["query"] extends infer T_1 extends keyof DB["query"] ? { [key_1 in T_1]: { [key_2 in Action]: any[] | "unspecified"; }; } : never;
122
112
  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;
123
113
  buildWithUserContext: (userContext: UserContext) => keyof DB["query"] extends infer T_3 extends keyof DB["query"] ? { [key_5 in T_3]: {
124
- filter: (action: Action, options?: {
125
- inject?: Partial<{
126
- where: any;
127
- columns: any;
128
- limit: any;
129
- }> | undefined;
114
+ filter: <Injection extends Parameters<DB["query"][key_5]["findMany"]>[0]>(action: Action, options?: {
115
+ inject?: Injection | undefined;
130
116
  } | undefined) => {
131
- single: {
132
- where: drizzle_orm.SQL<unknown> | undefined;
133
- columns: Record<string, any> | undefined;
117
+ query: {
118
+ single: {
119
+ readonly where: any;
120
+ readonly columns: undefined;
121
+ };
122
+ many: {
123
+ readonly where: any;
124
+ readonly columns: undefined;
125
+ readonly limit: any;
126
+ };
134
127
  };
135
- many: {
136
- where: drizzle_orm.SQL<unknown> | undefined;
137
- columns: Record<string, any> | undefined;
138
- limit: number | undefined;
128
+ sql: {
129
+ readonly where: drizzle_orm.SQL<unknown> | undefined;
130
+ readonly columns: undefined;
131
+ readonly limit: any;
139
132
  };
140
133
  };
141
134
  explicitFilters: (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];
@@ -147,27 +140,30 @@ declare const rumble: <UserContext extends Record<string, any>, DB extends Gener
147
140
  schemaBuilder: PothosSchemaTypes.SchemaBuilder<PothosSchemaTypes.ExtendDefaultTypes<{
148
141
  Context: Awaited<UserContext & {
149
142
  abilities: keyof DB["query"] extends infer T_3 extends keyof DB["query"] ? { [key_5 in T_3]: {
150
- filter: (action: Action, options?: {
151
- inject?: Partial<{
152
- where: any;
153
- columns: any;
154
- limit: any;
155
- }> | undefined;
143
+ filter: <Injection extends Parameters<DB["query"][key_5]["findMany"]>[0]>(action: Action, options?: {
144
+ inject?: Injection | undefined;
156
145
  } | undefined) => {
157
- single: {
158
- where: drizzle_orm.SQL<unknown> | undefined;
159
- columns: Record<string, any> | undefined;
146
+ query: {
147
+ single: {
148
+ readonly where: any;
149
+ readonly columns: undefined;
150
+ };
151
+ many: {
152
+ readonly where: any;
153
+ readonly columns: undefined;
154
+ readonly limit: any;
155
+ };
160
156
  };
161
- many: {
162
- where: drizzle_orm.SQL<unknown> | undefined;
163
- columns: Record<string, any> | undefined;
164
- limit: number | undefined;
157
+ sql: {
158
+ readonly where: drizzle_orm.SQL<unknown> | undefined;
159
+ readonly columns: undefined;
160
+ readonly limit: any;
165
161
  };
166
162
  };
167
163
  explicitFilters: (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];
168
164
  }; } : never;
169
165
  }>;
170
- DrizzleSchema: DB["_"]["fullSchema"];
166
+ DrizzleRelations: DB["_"]["relations"];
171
167
  Scalars: {
172
168
  JSON: {
173
169
  Input: unknown;
@@ -200,35 +196,79 @@ declare const rumble: <UserContext extends Record<string, any>, DB extends Gener
200
196
  /**
201
197
  * A function for creating default objects for your schema
202
198
  */
203
- object: <ExplicitTableName extends keyof NonNullable<DB["_"]["schema"]>, RefName extends string, Extender extends ((t: any) => SchemaBuilder.FieldMap) | undefined>({ tableName, name, readAction, extend, }: {
204
- tableName: ExplicitTableName;
205
- name?: RefName | undefined;
199
+ object: <ExplicitTableName extends keyof NonNullable<DB["_"]["relations"]["schema"]>, RefName extends string>({ table, refName, readAction, extend, }: {
200
+ table: ExplicitTableName;
201
+ refName?: RefName | undefined;
206
202
  readAction?: Action | undefined;
207
- extend?: Extender | undefined;
203
+ extend?: ((t: _pothos_plugin_drizzle.DrizzleObjectFieldBuilder<PothosSchemaTypes.ExtendDefaultTypes<{
204
+ Context: Awaited<UserContext & {
205
+ abilities: keyof DB["query"] extends infer T_4 extends keyof DB["query"] ? { [key_5 in T_4]: {
206
+ filter: <Injection extends Parameters<DB["query"][key_5]["findMany"]>[0]>(action: Action, options?: {
207
+ inject?: Injection | undefined;
208
+ } | undefined) => {
209
+ query: {
210
+ single: {
211
+ readonly where: any;
212
+ readonly columns: undefined;
213
+ };
214
+ many: {
215
+ readonly where: any;
216
+ readonly columns: undefined;
217
+ readonly limit: any;
218
+ };
219
+ };
220
+ sql: {
221
+ readonly where: drizzle_orm.SQL<unknown> | undefined;
222
+ readonly columns: undefined;
223
+ readonly limit: any;
224
+ };
225
+ };
226
+ explicitFilters: (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];
227
+ }; } : never;
228
+ }>;
229
+ DrizzleRelations: DB["_"]["relations"];
230
+ Scalars: {
231
+ JSON: {
232
+ Input: unknown;
233
+ Output: unknown;
234
+ };
235
+ Date: {
236
+ Input: Date;
237
+ Output: Date;
238
+ };
239
+ DateTime: {
240
+ Input: Date;
241
+ Output: Date;
242
+ };
243
+ };
244
+ }>, any, any, any>) => SchemaBuilder.FieldMap) | undefined;
208
245
  }) => _pothos_plugin_drizzle.DrizzleObjectRef<PothosSchemaTypes.ExtendDefaultTypes<{
209
246
  Context: Awaited<UserContext & {
210
247
  abilities: keyof DB["query"] extends infer T_4 extends keyof DB["query"] ? { [key_5 in T_4]: {
211
- filter: (action: Action, options?: {
212
- inject?: Partial<{
213
- where: any;
214
- columns: any;
215
- limit: any;
216
- }> | undefined;
248
+ filter: <Injection extends Parameters<DB["query"][key_5]["findMany"]>[0]>(action: Action, options?: {
249
+ inject?: Injection | undefined;
217
250
  } | undefined) => {
218
- single: {
219
- where: drizzle_orm.SQL<unknown> | undefined;
220
- columns: Record<string, any> | undefined;
251
+ query: {
252
+ single: {
253
+ readonly where: any;
254
+ readonly columns: undefined;
255
+ };
256
+ many: {
257
+ readonly where: any;
258
+ readonly columns: undefined;
259
+ readonly limit: any;
260
+ };
221
261
  };
222
- many: {
223
- where: drizzle_orm.SQL<unknown> | undefined;
224
- columns: Record<string, any> | undefined;
225
- limit: number | undefined;
262
+ sql: {
263
+ readonly where: drizzle_orm.SQL<unknown> | undefined;
264
+ readonly columns: undefined;
265
+ readonly limit: any;
226
266
  };
227
267
  };
228
268
  explicitFilters: (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];
229
269
  }; } : never;
230
270
  }>;
231
- DrizzleSchema: DB["_"]["fullSchema"];
271
+ DrizzleRelations: DB["_"]["relations"];
232
272
  Scalars: {
233
273
  JSON: {
234
274
  Input: unknown;
@@ -243,74 +283,76 @@ declare const rumble: <UserContext extends Record<string, any>, DB extends Gener
243
283
  Output: Date;
244
284
  };
245
285
  };
246
- }>, ExplicitTableName, ({ [K_1 in keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]]?: boolean | undefined; } | undefined extends Record<string, unknown> ? { [Key in (drizzle_orm.Equal<Exclude<(Record<string, unknown> & { [K_1 in keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]]?: boolean | undefined; })[keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"] | (string & keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"])], undefined>, false> extends true ? Exclude<keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"], drizzle_orm.NonUndefinedKeysOnly<Record<string, unknown> & { [K_1 in keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]]?: boolean | undefined; }>> : { [K_3 in keyof (Record<string, unknown> & { [K_1 in keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]]?: boolean | undefined; })]: drizzle_orm.Equal<(Record<string, unknown> & { [K_1 in keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]]?: boolean | undefined; })[K_3], true> extends true ? K_3 : never; }[string | keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]] & keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]) & string as Key]: { [K_4 in drizzle_orm.Equal<Exclude<(Record<string, unknown> & { [K_1 in keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]]?: boolean | undefined; })[keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"] | (string & keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"])], undefined>, false> extends true ? Exclude<keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"], drizzle_orm.NonUndefinedKeysOnly<Record<string, unknown> & { [K_1 in keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]]?: boolean | undefined; }>> : { [K_3 in keyof (Record<string, unknown> & { [K_1 in keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]]?: boolean | undefined; })]: drizzle_orm.Equal<(Record<string, unknown> & { [K_1 in keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]]?: boolean | undefined; })[K_3], true> extends true ? K_3 : never; }[string | keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]] & keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]]: drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"][K_4]; }[Key]["_"]["notNull"] extends true ? { [K_4 in drizzle_orm.Equal<Exclude<(Record<string, unknown> & { [K_1 in keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]]?: boolean | undefined; })[keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"] | (string & keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"])], undefined>, false> extends true ? Exclude<keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"], drizzle_orm.NonUndefinedKeysOnly<Record<string, unknown> & { [K_1 in keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]]?: boolean | undefined; }>> : { [K_3 in keyof (Record<string, unknown> & { [K_1 in keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]]?: boolean | undefined; })]: drizzle_orm.Equal<(Record<string, unknown> & { [K_1 in keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]]?: boolean | undefined; })[K_3], true> extends true ? K_3 : never; }[string | keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]] & keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]]: drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"][K_4]; }[Key]["_"]["data"] : { [K_4 in drizzle_orm.Equal<Exclude<(Record<string, unknown> & { [K_1 in keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]]?: boolean | undefined; })[keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"] | (string & keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"])], undefined>, false> extends true ? Exclude<keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"], drizzle_orm.NonUndefinedKeysOnly<Record<string, unknown> & { [K_1 in keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]]?: boolean | undefined; }>> : { [K_3 in keyof (Record<string, unknown> & { [K_1 in keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]]?: boolean | undefined; })]: drizzle_orm.Equal<(Record<string, unknown> & { [K_1 in keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]]?: boolean | undefined; })[K_3], true> extends true ? K_3 : never; }[string | keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]] & keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]]: drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"][K_4]; }[Key]["_"]["data"] | null; } extends infer T_8 ? { [K_2 in keyof T_8]: { [Key in (drizzle_orm.Equal<Exclude<(Record<string, unknown> & { [K_1 in keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]]?: boolean | undefined; })[keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"] | (string & keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"])], undefined>, false> extends true ? Exclude<keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"], drizzle_orm.NonUndefinedKeysOnly<Record<string, unknown> & { [K_1 in keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]]?: boolean | undefined; }>> : { [K_3 in keyof (Record<string, unknown> & { [K_1 in keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]]?: boolean | undefined; })]: drizzle_orm.Equal<(Record<string, unknown> & { [K_1 in keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]]?: boolean | undefined; })[K_3], true> extends true ? K_3 : never; }[string | keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]] & keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]) & string as Key]: { [K_4 in drizzle_orm.Equal<Exclude<(Record<string, unknown> & { [K_1 in keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]]?: boolean | undefined; })[keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"] | (string & keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"])], undefined>, false> extends true ? Exclude<keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"], drizzle_orm.NonUndefinedKeysOnly<Record<string, unknown> & { [K_1 in keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]]?: boolean | undefined; }>> : { [K_3 in keyof (Record<string, unknown> & { [K_1 in keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]]?: boolean | undefined; })]: drizzle_orm.Equal<(Record<string, unknown> & { [K_1 in keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]]?: boolean | undefined; })[K_3], true> extends true ? K_3 : never; }[string | keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]] & keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]]: drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"][K_4]; }[Key]["_"]["notNull"] extends true ? { [K_4 in drizzle_orm.Equal<Exclude<(Record<string, unknown> & { [K_1 in keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]]?: boolean | undefined; })[keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"] | (string & keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"])], undefined>, false> extends true ? Exclude<keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"], drizzle_orm.NonUndefinedKeysOnly<Record<string, unknown> & { [K_1 in keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]]?: boolean | undefined; }>> : { [K_3 in keyof (Record<string, unknown> & { [K_1 in keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]]?: boolean | undefined; })]: drizzle_orm.Equal<(Record<string, unknown> & { [K_1 in keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]]?: boolean | undefined; })[K_3], true> extends true ? K_3 : never; }[string | keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]] & keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]]: drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"][K_4]; }[Key]["_"]["data"] : { [K_4 in drizzle_orm.Equal<Exclude<(Record<string, unknown> & { [K_1 in keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]]?: boolean | undefined; })[keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"] | (string & keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"])], undefined>, false> extends true ? Exclude<keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"], drizzle_orm.NonUndefinedKeysOnly<Record<string, unknown> & { [K_1 in keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]]?: boolean | undefined; }>> : { [K_3 in keyof (Record<string, unknown> & { [K_1 in keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]]?: boolean | undefined; })]: drizzle_orm.Equal<(Record<string, unknown> & { [K_1 in keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]]?: boolean | undefined; })[K_3], true> extends true ? K_3 : never; }[string | keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]] & keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]]: drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"][K_4]; }[Key]["_"]["data"] | null; }[K_2]; } : never : { [Key_1 in keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"] & string as Key_1]: drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"][Key_1]["_"]["notNull"] extends true ? drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"][Key_1]["_"]["data"] : drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"][Key_1]["_"]["data"] | null; } extends infer T_9 ? { [K_5 in keyof T_9]: { [Key_1 in keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"] & string as Key_1]: drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"][Key_1]["_"]["notNull"] extends true ? drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"][Key_1]["_"]["data"] : drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"][Key_1]["_"]["data"] | null; }[K_5]; } : never) & {} & ({ [K_6 in keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["relations"]]?: true | drizzle_orm.DBQueryConfig<drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["relations"][K_6] extends drizzle_orm.One<string, boolean> ? "one" : "many", false, drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>, drizzle_orm.FindTableByDBName<drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>, drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["relations"][K_6]["referencedTableName"]>> | undefined; } | undefined extends Record<string, unknown> ? drizzle_orm.BuildRelationResult<drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>, Record<string, unknown> & { [K_6 in keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["relations"]]?: true | drizzle_orm.DBQueryConfig<drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["relations"][K_6] extends drizzle_orm.One<string, boolean> ? "one" : "many", false, drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>, drizzle_orm.FindTableByDBName<drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>, drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["relations"][K_6]["referencedTableName"]>> | undefined; }, drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["relations"]> : {}) extends infer T_5 ? { [K in keyof T_5]: (({ [K_1 in keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]]?: boolean | undefined; } | undefined extends Record<string, unknown> ? { [Key in (drizzle_orm.Equal<Exclude<(Record<string, unknown> & { [K_1 in keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]]?: boolean | undefined; })[keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"] | (string & keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"])], undefined>, false> extends true ? Exclude<keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"], drizzle_orm.NonUndefinedKeysOnly<Record<string, unknown> & { [K_1 in keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]]?: boolean | undefined; }>> : { [K_3 in keyof (Record<string, unknown> & { [K_1 in keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]]?: boolean | undefined; })]: drizzle_orm.Equal<(Record<string, unknown> & { [K_1 in keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]]?: boolean | undefined; })[K_3], true> extends true ? K_3 : never; }[string | keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]] & keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]) & string as Key]: { [K_4 in drizzle_orm.Equal<Exclude<(Record<string, unknown> & { [K_1 in keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]]?: boolean | undefined; })[keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"] | (string & keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"])], undefined>, false> extends true ? Exclude<keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"], drizzle_orm.NonUndefinedKeysOnly<Record<string, unknown> & { [K_1 in keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]]?: boolean | undefined; }>> : { [K_3 in keyof (Record<string, unknown> & { [K_1 in keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]]?: boolean | undefined; })]: drizzle_orm.Equal<(Record<string, unknown> & { [K_1 in keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]]?: boolean | undefined; })[K_3], true> extends true ? K_3 : never; }[string | keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]] & keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]]: drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"][K_4]; }[Key]["_"]["notNull"] extends true ? { [K_4 in drizzle_orm.Equal<Exclude<(Record<string, unknown> & { [K_1 in keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]]?: boolean | undefined; })[keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"] | (string & keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"])], undefined>, false> extends true ? Exclude<keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"], drizzle_orm.NonUndefinedKeysOnly<Record<string, unknown> & { [K_1 in keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]]?: boolean | undefined; }>> : { [K_3 in keyof (Record<string, unknown> & { [K_1 in keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]]?: boolean | undefined; })]: drizzle_orm.Equal<(Record<string, unknown> & { [K_1 in keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]]?: boolean | undefined; })[K_3], true> extends true ? K_3 : never; }[string | keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]] & keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]]: drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"][K_4]; }[Key]["_"]["data"] : { [K_4 in drizzle_orm.Equal<Exclude<(Record<string, unknown> & { [K_1 in keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]]?: boolean | undefined; })[keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"] | (string & keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"])], undefined>, false> extends true ? Exclude<keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"], drizzle_orm.NonUndefinedKeysOnly<Record<string, unknown> & { [K_1 in keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]]?: boolean | undefined; }>> : { [K_3 in keyof (Record<string, unknown> & { [K_1 in keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]]?: boolean | undefined; })]: drizzle_orm.Equal<(Record<string, unknown> & { [K_1 in keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]]?: boolean | undefined; })[K_3], true> extends true ? K_3 : never; }[string | keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]] & keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]]: drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"][K_4]; }[Key]["_"]["data"] | null; } extends infer T_6 ? { [K_2 in keyof T_6]: { [Key in (drizzle_orm.Equal<Exclude<(Record<string, unknown> & { [K_1 in keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]]?: boolean | undefined; })[keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"] | (string & keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"])], undefined>, false> extends true ? Exclude<keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"], drizzle_orm.NonUndefinedKeysOnly<Record<string, unknown> & { [K_1 in keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]]?: boolean | undefined; }>> : { [K_3 in keyof (Record<string, unknown> & { [K_1 in keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]]?: boolean | undefined; })]: drizzle_orm.Equal<(Record<string, unknown> & { [K_1 in keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]]?: boolean | undefined; })[K_3], true> extends true ? K_3 : never; }[string | keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]] & keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]) & string as Key]: { [K_4 in drizzle_orm.Equal<Exclude<(Record<string, unknown> & { [K_1 in keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]]?: boolean | undefined; })[keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"] | (string & keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"])], undefined>, false> extends true ? Exclude<keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"], drizzle_orm.NonUndefinedKeysOnly<Record<string, unknown> & { [K_1 in keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]]?: boolean | undefined; }>> : { [K_3 in keyof (Record<string, unknown> & { [K_1 in keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]]?: boolean | undefined; })]: drizzle_orm.Equal<(Record<string, unknown> & { [K_1 in keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]]?: boolean | undefined; })[K_3], true> extends true ? K_3 : never; }[string | keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]] & keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]]: drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"][K_4]; }[Key]["_"]["notNull"] extends true ? { [K_4 in drizzle_orm.Equal<Exclude<(Record<string, unknown> & { [K_1 in keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]]?: boolean | undefined; })[keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"] | (string & keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"])], undefined>, false> extends true ? Exclude<keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"], drizzle_orm.NonUndefinedKeysOnly<Record<string, unknown> & { [K_1 in keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]]?: boolean | undefined; }>> : { [K_3 in keyof (Record<string, unknown> & { [K_1 in keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]]?: boolean | undefined; })]: drizzle_orm.Equal<(Record<string, unknown> & { [K_1 in keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]]?: boolean | undefined; })[K_3], true> extends true ? K_3 : never; }[string | keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]] & keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]]: drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"][K_4]; }[Key]["_"]["data"] : { [K_4 in drizzle_orm.Equal<Exclude<(Record<string, unknown> & { [K_1 in keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]]?: boolean | undefined; })[keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"] | (string & keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"])], undefined>, false> extends true ? Exclude<keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"], drizzle_orm.NonUndefinedKeysOnly<Record<string, unknown> & { [K_1 in keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]]?: boolean | undefined; }>> : { [K_3 in keyof (Record<string, unknown> & { [K_1 in keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]]?: boolean | undefined; })]: drizzle_orm.Equal<(Record<string, unknown> & { [K_1 in keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]]?: boolean | undefined; })[K_3], true> extends true ? K_3 : never; }[string | keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]] & keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"]]: drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"][K_4]; }[Key]["_"]["data"] | null; }[K_2]; } : never : { [Key_1 in keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"] & string as Key_1]: drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"][Key_1]["_"]["notNull"] extends true ? drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"][Key_1]["_"]["data"] : drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"][Key_1]["_"]["data"] | null; } extends infer T_7 ? { [K_5 in keyof T_7]: { [Key_1 in keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"] & string as Key_1]: drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"][Key_1]["_"]["notNull"] extends true ? drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"][Key_1]["_"]["data"] : drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["columns"][Key_1]["_"]["data"] | null; }[K_5]; } : never) & {} & ({ [K_6 in keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["relations"]]?: true | drizzle_orm.DBQueryConfig<drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["relations"][K_6] extends drizzle_orm.One<string, boolean> ? "one" : "many", false, drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>, drizzle_orm.FindTableByDBName<drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>, drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["relations"][K_6]["referencedTableName"]>> | undefined; } | undefined extends Record<string, unknown> ? drizzle_orm.BuildRelationResult<drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>, Record<string, unknown> & { [K_6 in keyof drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["relations"]]?: true | drizzle_orm.DBQueryConfig<drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["relations"][K_6] extends drizzle_orm.One<string, boolean> ? "one" : "many", false, drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>, drizzle_orm.FindTableByDBName<drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>, drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["relations"][K_6]["referencedTableName"]>> | undefined; }, drizzle_orm.ExtractTablesWithRelations<DB["_"]["fullSchema"] & {}>[ExplicitTableName]["relations"]> : {}))[K]; } : never>;
286
+ }>, 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]>>>;
247
287
  /**
248
288
  * A function for creating where args to filter entities
249
289
  */
250
- arg: <ExplicitTableName extends keyof NonNullable<DB["_"]["schema"]>, RefName_1 extends string>({ tableName, name, nativeTableName, }: {
251
- tableName: ExplicitTableName;
252
- name?: RefName_1 | undefined;
253
- nativeTableName?: string;
254
- }) => {
255
- inputType: PothosSchemaTypes.InputObjectRef<PothosSchemaTypes.ExtendDefaultTypes<{
256
- Context: Awaited<UserContext & {
257
- abilities: keyof DB["query"] extends infer T_4 extends keyof DB["query"] ? { [key_5 in T_4]: {
258
- filter: (action: Action, options?: {
259
- inject?: Partial<{
260
- where: any;
261
- columns: any;
262
- limit: any;
263
- }> | undefined;
264
- } | undefined) => {
290
+ arg: <ExplicitTableName extends keyof NonNullable<DB["_"]["relations"]["schema"]>, RefName_1 extends string>({ table, refName, dbName, }: Partial<{
291
+ table: ExplicitTableName;
292
+ refName: RefName_1 | undefined;
293
+ dbName: string;
294
+ }> & ({
295
+ dbName: string;
296
+ } | {
297
+ table: ExplicitTableName;
298
+ })) => PothosSchemaTypes.InputObjectRef<PothosSchemaTypes.ExtendDefaultTypes<{
299
+ Context: Awaited<UserContext & {
300
+ abilities: keyof DB["query"] extends infer T_4 extends keyof DB["query"] ? { [key_5 in T_4]: {
301
+ filter: <Injection extends Parameters<DB["query"][key_5]["findMany"]>[0]>(action: Action, options?: {
302
+ inject?: Injection | undefined;
303
+ } | undefined) => {
304
+ query: {
265
305
  single: {
266
- where: drizzle_orm.SQL<unknown> | undefined;
267
- columns: Record<string, any> | undefined;
306
+ readonly where: any;
307
+ readonly columns: undefined;
268
308
  };
269
309
  many: {
270
- where: drizzle_orm.SQL<unknown> | undefined;
271
- columns: Record<string, any> | undefined;
272
- limit: number | undefined;
310
+ readonly where: any;
311
+ readonly columns: undefined;
312
+ readonly limit: any;
273
313
  };
274
314
  };
275
- explicitFilters: (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];
276
- }; } : never;
277
- }>;
278
- DrizzleSchema: DB["_"]["fullSchema"];
279
- Scalars: {
280
- JSON: {
281
- Input: unknown;
282
- Output: unknown;
283
- };
284
- Date: {
285
- Input: Date;
286
- Output: Date;
287
- };
288
- DateTime: {
289
- Input: Date;
290
- Output: Date;
315
+ sql: {
316
+ readonly where: drizzle_orm.SQL<unknown> | undefined;
317
+ readonly columns: undefined;
318
+ readonly limit: any;
319
+ };
291
320
  };
292
- };
293
- }>, {
294
- [x: string]: unknown;
321
+ explicitFilters: (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];
322
+ }; } : never;
295
323
  }>;
296
- transformArgumentToQueryCondition: <T_5 extends {
297
- [x: string]: unknown;
298
- }>(arg: T_5 | null | undefined) => drizzle_orm.SQL<unknown> | undefined;
299
- };
324
+ DrizzleRelations: DB["_"]["relations"];
325
+ Scalars: {
326
+ JSON: {
327
+ Input: unknown;
328
+ Output: unknown;
329
+ };
330
+ Date: {
331
+ Input: Date;
332
+ Output: Date;
333
+ };
334
+ DateTime: {
335
+ Input: Date;
336
+ Output: Date;
337
+ };
338
+ };
339
+ }>, {
340
+ [x: string]: unknown;
341
+ }>;
300
342
  /**
301
343
  * A function for creating default READ queries.
302
344
  * Make sure the objects for the table you are creating the queries for are implemented
303
345
  */
304
- query: <ExplicitTableName extends keyof NonNullable<DB["_"]["schema"]>>({ tableName, readAction, listAction, }: {
305
- tableName: ExplicitTableName;
346
+ query: <ExplicitTableName extends keyof NonNullable<DB["_"]["relations"]["schema"]>>({ table, readAction, listAction, }: {
347
+ table: ExplicitTableName;
306
348
  readAction?: Action | undefined;
307
349
  listAction?: Action | undefined;
308
350
  }) => void;
309
351
  /**
310
352
  * A function for creating a pubsub instance for a table. Use this to publish or subscribe events
311
353
  */
312
- pubsub: <ExplicitTableName extends keyof NonNullable<DB["_"]["schema"]>>({ tableName, }: {
313
- tableName: ExplicitTableName;
354
+ pubsub: <ExplicitTableName extends keyof NonNullable<DB["_"]["relations"]["schema"]>>({ table, }: {
355
+ table: ExplicitTableName;
314
356
  }) => {
315
357
  registerOnInstance({ instance, action, primaryKeyValue, }: {
316
358
  instance: {
@@ -320,46 +362,49 @@ declare const rumble: <UserContext extends Record<string, any>, DB extends Gener
320
362
  primaryKeyValue?: string;
321
363
  }): void;
322
364
  created(): void;
323
- removed(primaryKeyValue?: NonNullable<DB["_"]["schema"]>[ExplicitTableName]["primaryKey"][number]["_"]["data"] | NonNullable<DB["_"]["schema"]>[ExplicitTableName]["primaryKey"][number]["_"]["data"][] | undefined): void;
324
- updated(primaryKeyValue?: NonNullable<DB["_"]["schema"]>[ExplicitTableName]["primaryKey"][number]["_"]["data"] | NonNullable<DB["_"]["schema"]>[ExplicitTableName]["primaryKey"][number]["_"]["data"][] | undefined): void;
365
+ removed(primaryKeyValue?: any | any[]): void;
366
+ updated(primaryKeyValue?: any | any[]): void;
325
367
  };
326
368
  /**
327
369
  * A function to implement enums for graphql usage.
328
370
  * The other helpers use this helper internally so in most cases you do not have to
329
371
  * call this helper directly, unless you need the reference to an enum type
330
372
  */
331
- enum_: <ExplicitEnumVariableName extends keyof (NonNullable<DB["_"]["fullSchema"]> extends infer T_4 ? { [K in keyof T_4 as NonNullable<DB["_"]["fullSchema"]>[K] extends drizzle_orm_pg_core.PgEnum<any> | drizzle_orm_singlestore_core.SingleStoreEnumColumnBuilderInitial<any, any> | drizzle_orm_mysql_core.MySqlEnumColumnBuilderInitial<any, any> ? K : never]: NonNullable<DB["_"]["fullSchema"]>[K]; } : never), RefName_2 extends string, EnumName extends string>({ enumVariableName, name, enumName, }: Partial<{
332
- enumVariableName: ExplicitEnumVariableName;
333
- enumName: EnumName;
334
- name: RefName_2 | undefined;
335
- } & ({
336
- enumVariableName: ExplicitEnumVariableName;
373
+ 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_2 extends string>({ tsName, enumColumn, refName, }: Partial<{
374
+ tsName: ExplicitEnumVariableName;
375
+ enumColumn: EnumColumn;
376
+ refName?: RefName_2 | undefined;
377
+ }> & ({
378
+ tsName: ExplicitEnumVariableName;
337
379
  } | {
338
- enumName: EnumName;
339
- })>) => PothosSchemaTypes.EnumRef<PothosSchemaTypes.ExtendDefaultTypes<{
380
+ enumColumn: EnumColumn;
381
+ })) => PothosSchemaTypes.EnumRef<PothosSchemaTypes.ExtendDefaultTypes<{
340
382
  Context: Awaited<UserContext & {
341
383
  abilities: keyof DB["query"] extends infer T_5 extends keyof DB["query"] ? { [key_5 in T_5]: {
342
- filter: (action: Action, options?: {
343
- inject?: Partial<{
344
- where: any;
345
- columns: any;
346
- limit: any;
347
- }> | undefined;
384
+ filter: <Injection extends Parameters<DB["query"][key_5]["findMany"]>[0]>(action: Action, options?: {
385
+ inject?: Injection | undefined;
348
386
  } | undefined) => {
349
- single: {
350
- where: drizzle_orm.SQL<unknown> | undefined;
351
- columns: Record<string, any> | undefined;
387
+ query: {
388
+ single: {
389
+ readonly where: any;
390
+ readonly columns: undefined;
391
+ };
392
+ many: {
393
+ readonly where: any;
394
+ readonly columns: undefined;
395
+ readonly limit: any;
396
+ };
352
397
  };
353
- many: {
354
- where: drizzle_orm.SQL<unknown> | undefined;
355
- columns: Record<string, any> | undefined;
356
- limit: number | undefined;
398
+ sql: {
399
+ readonly where: drizzle_orm.SQL<unknown> | undefined;
400
+ readonly columns: undefined;
401
+ readonly limit: any;
357
402
  };
358
403
  };
359
404
  explicitFilters: (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];
360
405
  }; } : never;
361
406
  }>;
362
- DrizzleSchema: DB["_"]["fullSchema"];
407
+ DrizzleRelations: DB["_"]["relations"];
363
408
  Scalars: {
364
409
  JSON: {
365
410
  Input: unknown;
package/index.js CHANGED
@@ -1,9 +1,9 @@
1
- import {createYoga,createPubSub}from'graphql-yoga';import {One,or,and,eq}from'drizzle-orm';import {toCamelCase}from'drizzle-orm/casing';import Ce,{BasePlugin}from'@pothos/core';import Ee from'@pothos/plugin-drizzle';import Pe,{subscribeOptionsFromIterator}from'@pothos/plugin-smart-subscriptions';import {JSONResolver,DateResolver,DateTimeISOResolver}from'graphql-scalars';function k(e){return typeof e=="object"&&e!==null}function G(e,t){throw new Error("Unexpected invariant triggered.")}var ae=/\r\n|[\n\r]/g;function v(e,t){let p=0,m=1;for(let n of e.body.matchAll(ae)){if(typeof n.index=="number"||G(),n.index>=t)break;p=n.index+n[0].length,m+=1;}return {line:m,column:t+1-p}}function _(e){return q(e.source,v(e.source,e.start))}function q(e,t){let p=e.locationOffset.column-1,m="".padStart(p)+e.body,n=t.line-1,d=e.locationOffset.line-1,i=t.line+d,y=t.line===1?p:0,r=t.column+y,a=`${e.name}:${i}:${r}
2
- `,o=m.split(/\r\n|[\n\r]/g),h=o[n];if(h.length>120){let f=Math.floor(r/80),s=r%80,u=[];for(let b=0;b<h.length;b+=80)u.push(h.slice(b,b+80));return a+j([[`${i} |`,u[0]],...u.slice(1,f+1).map(b=>["|",b]),["|","^".padStart(s)],["|",u[f+1]]])}return a+j([[`${i-1} |`,o[n-1]],[`${i} |`,h],["|","^".padStart(r)],[`${i+1} |`,o[n+1]]])}function j(e){let t=e.filter(([m,n])=>n!==void 0),p=Math.max(...t.map(([m])=>m.length));return t.map(([m,n])=>m.padStart(p)+(n?" "+n:"")).join(`
3
- `)}function ue(e){let t=e[0];return t==null||"kind"in t||"length"in t?{nodes:t,source:e[1],positions:e[2],path:e[3],originalError:e[4],extensions:e[5]}:t}var B=class e extends Error{constructor(t,...p){var m,n,d;let{nodes:i,source:y,positions:r,path:a,originalError:o,extensions:h}=ue(p);super(t),this.name="GraphQLError",this.path=a??void 0,this.originalError=o??void 0,this.nodes=K(Array.isArray(i)?i:i?[i]:void 0);let f=K((m=this.nodes)===null||m===void 0?void 0:m.map(u=>u.loc).filter(u=>u!=null));this.source=y??(f==null||(n=f[0])===null||n===void 0?void 0:n.source),this.positions=r??f?.map(u=>u.start),this.locations=r&&y?r.map(u=>v(y,u)):f?.map(u=>v(u.source,u.start));let s=k(o?.extensions)?o?.extensions:void 0;this.extensions=(d=h??s)!==null&&d!==void 0?d:Object.create(null),Object.defineProperties(this,{message:{writable:true,enumerable:true},name:{enumerable:false},nodes:{enumerable:false},source:{enumerable:false},positions:{enumerable:false},originalError:{enumerable:false}}),o!=null&&o.stack?Object.defineProperty(this,"stack",{value:o.stack,writable:true,configurable:true}):Error.captureStackTrace?Error.captureStackTrace(this,e):Object.defineProperty(this,"stack",{value:Error().stack,writable:true,configurable:true});}get[Symbol.toStringTag](){return "GraphQLError"}toString(){let t=this.message;if(this.nodes)for(let p of this.nodes)p.loc&&(t+=`
1
+ import {createYoga,createPubSub}from'graphql-yoga';import {One,relationsFilterToSQL}from'drizzle-orm';import {toCamelCase}from'drizzle-orm/casing';import {PgEnumColumn}from'drizzle-orm/pg-core';import Ee,{BasePlugin}from'@pothos/core';import Ae from'@pothos/plugin-drizzle';import ve,{subscribeOptionsFromIterator}from'@pothos/plugin-smart-subscriptions';import {JSONResolver,DateResolver,DateTimeISOResolver}from'graphql-scalars';function N(e){let t,m=false;return ()=>(m||(t=e(),m=true),t)}function _(e){return typeof e=="object"&&e!==null}function V(e,t){throw new Error("Unexpected invariant triggered.")}var pe=/\r\n|[\n\r]/g;function z(e,t){let m=0,u=1;for(let n of e.body.matchAll(pe)){if(typeof n.index=="number"||V(),n.index>=t)break;m=n.index+n[0].length,u+=1;}return {line:u,column:t+1-m}}function $(e){return k(e.source,z(e.source,e.start))}function k(e,t){let m=e.locationOffset.column-1,u="".padStart(m)+e.body,n=t.line-1,a=e.locationOffset.line-1,i=t.line+a,l=t.line===1?m:0,o=t.column+l,p=`${e.name}:${i}:${o}
2
+ `,r=u.split(/\r\n|[\n\r]/g),f=r[n];if(f.length>120){let s=Math.floor(o/80),d=o%80,c=[];for(let b=0;b<f.length;b+=80)c.push(f.slice(b,b+80));return p+M([[`${i} |`,c[0]],...c.slice(1,s+1).map(b=>["|",b]),["|","^".padStart(d)],["|",c[s+1]]])}return p+M([[`${i-1} |`,r[n-1]],[`${i} |`,f],["|","^".padStart(o)],[`${i+1} |`,r[n+1]]])}function M(e){let t=e.filter(([u,n])=>n!==void 0),m=Math.max(...t.map(([u])=>u.length));return t.map(([u,n])=>u.padStart(m)+(n?" "+n:"")).join(`
3
+ `)}function me(e){let t=e[0];return t==null||"kind"in t||"length"in t?{nodes:t,source:e[1],positions:e[2],path:e[3],originalError:e[4],extensions:e[5]}:t}var v=class e extends Error{constructor(t,...m){var u,n,a;let{nodes:i,source:l,positions:o,path:p,originalError:r,extensions:f}=me(m);super(t),this.name="GraphQLError",this.path=p??void 0,this.originalError=r??void 0,this.nodes=H(Array.isArray(i)?i:i?[i]:void 0);let s=H((u=this.nodes)===null||u===void 0?void 0:u.map(c=>c.loc).filter(c=>c!=null));this.source=l??(s==null||(n=s[0])===null||n===void 0?void 0:n.source),this.positions=o??s?.map(c=>c.start),this.locations=o&&l?o.map(c=>z(l,c)):s?.map(c=>z(c.source,c.start));let d=_(r?.extensions)?r?.extensions:void 0;this.extensions=(a=f??d)!==null&&a!==void 0?a:Object.create(null),Object.defineProperties(this,{message:{writable:true,enumerable:true},name:{enumerable:false},nodes:{enumerable:false},source:{enumerable:false},positions:{enumerable:false},originalError:{enumerable:false}}),r!=null&&r.stack?Object.defineProperty(this,"stack",{value:r.stack,writable:true,configurable:true}):Error.captureStackTrace?Error.captureStackTrace(this,e):Object.defineProperty(this,"stack",{value:Error().stack,writable:true,configurable:true});}get[Symbol.toStringTag](){return "GraphQLError"}toString(){let t=this.message;if(this.nodes)for(let m of this.nodes)m.loc&&(t+=`
4
4
 
5
- `+_(p.loc));else if(this.source&&this.locations)for(let p of this.locations)t+=`
5
+ `+$(m.loc));else if(this.source&&this.locations)for(let m of this.locations)t+=`
6
6
 
7
- `+q(this.source,p);return t}toJSON(){let t={message:this.message};return this.locations!=null&&(t.locations=this.locations),this.path!=null&&(t.path=this.path),this.extensions!=null&&Object.keys(this.extensions).length>0&&(t.extensions=this.extensions),t}};function K(e){return e===void 0||e.length===0?void 0:e}var C=class extends Error{constructor(t){super(t),this.name="RumbleError";}},A=class extends B{};var U=(e,t)=>new C(`RumbleError: Unknown SQL type '${e}'. Please open an issue (https://github.com/m1212e/rumble/issues) so it can be added. (${t})`);function V(e){if(["serial","int","integer","tinyint","smallint","mediumint"].includes(e))return {value1:1,value2:2};if(["real","decimal","double","float"].includes(e))return {value1:1.1,value2:2.2};if(["string","text","varchar","char","text(256)"].includes(e))return {value1:"a",value2:"b"};if(["uuid"].includes(e))return {value1:"fba31870-5528-42d7-b27e-2e5ee657aea5",value2:"fc65db81-c2d1-483d-8a25-a30e2cf6e02d"};if(["boolean"].includes(e))return {value1:true,value2:false};if(["timestamp","datetime"].includes(e))return {value1:new Date(2022,1,1),value2:new Date(2022,1,2)};if(["date"].includes(e))return {value1:new Date(2022,1,1),value2:new Date(2022,1,2)};if(["json"].includes(e))return {value1:{a:1},value2:{b:2}};throw U(e,"Distinct")}function ce(e){return typeof e!="function"}function ye(e){return typeof e=="function"&&e.constructor.name!=="AsyncFunction"}var W=({db:e,actions:t,defaultLimit:p})=>{let m=e._.schema,n={},d={},i={},y=r=>{for(let a of t)i[r]||(i[r]={}),i[r][a]||(i[r][a]=[]);return {allow:a=>{let o=d[r];o||(o={},d[r]=o);let h=Array.isArray(a)?a:[a];for(let f of h){let s=o[f];s||(s="wildcard",o[f]=s);}return {when:f=>{for(let s of h)o[s]==="wildcard"&&(o[s]=[]),o[s].push(f);}}},filter:a=>{let o=Array.isArray(a)?a:[a];return {by:h=>{for(let f of o)i[r][f].push(h);}}}}};for(let r of Object.keys(e.query))n[r]=y(r);return {...n,registeredConditions:d,registeredFilters:i,buildWithUserContext:r=>{let a={},o=h=>({filter:(f,s)=>{let u=d[h];u||(u={});let b=u[f];if(b==="wildcard")return {single:{where:s?.inject?.where,columns:s?.inject?.columns},many:{where:s?.inject?.where,columns:s?.inject?.columns,limit:s?.inject?.limit??p??void 0}};let S=()=>{let g=m[h].primaryKey.at(0);if(!g)throw new C(`No primary key found for entity ${h.toString()}`);let L=V(g.getSQLType());return {where:and(eq(g,L.value1),eq(g,L.value2))}};(!u||!b)&&(b=[S()]);let R=b.filter(ce),l=b.filter(ye).map(g=>g(r)),c=l.some(g=>g==="allow"),x=[...R,...l];x.filter(g=>g!==void 0).length===0&&x.push(S());let T;for(let g of x)g!=="allow"&&g?.limit&&(T===void 0||g.limit>T)&&(T=g.limit);s?.inject?.limit&&T&&T<s.inject.limit&&(T=s.inject.limit);let D;for(let g of [...x,s?.inject??{}])g!=="allow"&&g?.columns&&(D===void 0?D=g.columns:D={...D,...g.columns});let F=c?[]:x.filter(g=>g!=="allow"&&g?.where).map(g=>g?.where),P=F.length>0?or(...F):void 0;return s?.inject?.where&&(P=P?and(P,s.inject.where):s.inject.where),{single:{where:P,columns:D},many:{where:P,columns:D,limit:T??p??void 0}}},explicitFilters:f=>i[h][f]});for(let h of Object.keys(e.query))a[h]=o(h);return a}}};var J=({context:e,abilityBuilder:t})=>async p=>{let m=e?await e(p):{};return {...m,abilities:t.buildWithUserContext(m)}};function E(e){return String(e).charAt(0).toUpperCase()+String(e).slice(1)}function N(e){let t=I(e);return t.enumValues!==void 0&&t.enumName!==void 0&&typeof t.enumName=="string"&&Array.isArray(t.enumValues)}function I(e){return e.enum??e}var Y=({db:e,schemaBuilder:t})=>{let p=new Map;return ({enumVariableName:n,name:d,enumName:i})=>{let y=e._.fullSchema,r;if(n?r=y[n]:i&&(r=Object.values(y).filter(N).map(I).find(f=>f.enumName===i)),!r)throw new C(`Could not determine enum structure! (${String(n)}, ${enumValuesParam}, ${i})`);let a=d??`${E(toCamelCase(r.enumName.toString()))}Enum`,o=p.get(a);return o||(o=t.enumType(a,{values:r.enumValues}),p.set(a,o),o)}};function w(e){let t;if(["serial","int","integer","tinyint","smallint","mediumint"].includes(e)&&(t="Int"),["real","decimal","double","float"].includes(e)&&(t="Float"),["string","text","varchar","char","text(256)"].includes(e)&&(t="String"),["uuid"].includes(e)&&(t="ID"),["boolean"].includes(e)&&(t="Boolean"),["timestamp","datetime"].includes(e)&&(t="DateTime"),["date"].includes(e)&&(t="Date"),["json"].includes(e)&&(t="JSON"),t!==void 0)return t;throw U(e,"SQL to GQL")}var fe="RUMBLE_SUBSCRIPTION_NOTIFICATION",he="REMOVED",ge="UPDATED",be="CREATED",X=({subscriptions:e,db:t})=>{let p=e?createPubSub(...e):createPubSub();return {pubsub:p,makePubSubInstance:({tableName:n})=>{function d({action:i,tableName:y,primaryKeyValue:r}){let a;switch(i){case "created":a=be;break;case "removed":a=he;break;case "updated":a=ge;break;default:throw new Error(`Unknown action: ${i}`)}return `${fe}/${y}${r?`/${r}`:""}/${a}`}return {registerOnInstance({instance:i,action:y,primaryKeyValue:r}){let a=d({tableName:n.toString(),action:y,primaryKeyValue:r});i.register(a);},created(){let i=d({tableName:n.toString(),action:"created"});return p.publish(i)},removed(i){let y=d({tableName:n.toString(),action:"removed"});return p.publish(y)},updated(i){let r=(Array.isArray(i)?i:[i]).map(o=>d({tableName:n.toString(),action:"updated",primaryKeyValue:o})),a=Array.from(new Set(r));for(let o of a)p.publish(o);}}}}};var Z=({db:e,schemaBuilder:t,makePubSubInstance:p,argImplementer:m,enumImplementer:n,abilityBuilder:d})=>({tableName:i,name:y,readAction:r="read",extend:a})=>{let o=e._.schema[i];if(!o)throw new C(`Could not find schema for ${i.toString()} (object)`);let h=o.primaryKey.at(0)?.name;h||console.warn(`Could not find primary key for ${i.toString()}. Cannot register subscriptions!`);let{registerOnInstance:f}=p({tableName:i});return t.drizzleObject(i,{name:y??E(i.toString()),subscribe:(s,u,b)=>{if(!h)return;let S=u[h];if(!S){console.warn(`Could not find primary key value for ${JSON.stringify(u)}. Cannot register subscription!`);return}f({instance:s,action:"updated",primaryKeyValue:S});},applyFilters:d?.registeredFilters?.[i]?.[r],fields:s=>{let u=(R,l,c)=>{let x=w(R);switch(x){case "Int":return s.exposeInt(l,{nullable:c});case "String":return s.exposeString(l,{nullable:c});case "Boolean":return s.exposeBoolean(l,{nullable:c});case "Date":return s.field({type:"Date",resolve:T=>T[l],nullable:c});case "DateTime":return s.field({type:"DateTime",resolve:T=>T[l],nullable:c});case "Float":return s.exposeFloat(l,{nullable:c});case "ID":return s.exposeID(l,{nullable:c});case "JSON":return s.field({type:"JSON",resolve:T=>T[l],nullable:c});default:throw new C(`Unsupported object type ${x} for column ${l}`)}},b=Object.entries(o.columns).reduce((R,[l,c])=>{if(N(c)){let x=I(c),T=n({enumName:x.enumName});R[l]=s.field({type:T,resolve:D=>D[l],nullable:!c.notNull});}else R[l]=u(c.getSQLType(),l,!c.notNull);return R},{}),S=Object.entries(o.relations).reduce((R,[l,c])=>{let {inputType:x,transformArgumentToQueryCondition:T}=m({tableName:c.referencedTableName,nativeTableName:c.referencedTableName}),D=false,P="many";return c instanceof One&&(D=!c.isNullable,P="single"),R[l]=s.relation(l,{args:{where:s.arg({type:x,required:false})},nullable:D,query:(g,L)=>{let Q=Object.entries(e._.schema).find(([Oe,se])=>se.dbName===c.referencedTableName)?.at(0);if(!Q)throw new C(`Could not find table ${c.referencedTableName} in schema object`);return L.abilities[Q].filter(r,{inject:{where:T(g.where)}})[P]}}),R},{});return a?{...b,...S,...a(s)??{}}:{...b,...S}}})};var O=e=>{if(!e)throw new A("Value not found but required (findFirst)");return e},Te=e=>{let t=e.at(0);if(!t)throw new A("Value not found but required (firstEntry)");return t},ee=async({filters:e,entities:t,context:p})=>(await Promise.all(e.map(m=>m({context:p,entities:t})))).reduce((m,n)=>(m.push(...n),m),[]);var te=({db:e,schemaBuilder:t,argImplementer:p,makePubSubInstance:m})=>({tableName:n,readAction:d="read",listAction:i="read"})=>{let y=e._.schema[n];if(!y)throw new C(`Could not find schema for ${n.toString()} (query)`);y.primaryKey.at(0)?.name||console.warn(`Could not find primary key for ${n.toString()}. Cannot register subscriptions!`);let{inputType:a,transformArgumentToQueryCondition:o}=p({tableName:n}),{registerOnInstance:h}=m({tableName:n});return t.queryFields(f=>({[`findMany${E(n.toString())}`]:f.drizzleField({type:[n],nullable:false,smartSubscription:true,subscribe:(s,u,b,S,R)=>{h({instance:s,action:"created"}),h({instance:s,action:"removed"});},args:{where:f.arg({type:a,required:false})},resolve:(s,u,b,S,R)=>{let l=S.abilities[n].filter(i,{inject:{where:o(b.where)}}).many,c=s(l);return l.columns&&(c.columns=l.columns),e.query[n].findMany(c)}}),[`findFirst${E(n.toString())}`]:f.drizzleField({type:n,nullable:false,smartSubscription:true,args:{where:f.arg({type:a,required:false})},resolve:(s,u,b,S,R)=>{let l=S.abilities[n].filter(d,{inject:{where:o(b.where)}}).single,c=s(l);return l.columns&&(c.columns=l.columns),e.query[n].findFirst(c).then(O)}})}))};var ne="ManualFiltersPlugin",re=ne,Re="applyFilters",z=class extends BasePlugin{wrapResolve(t,p){return async(m,n,d,i)=>{let y=(p?.type).type?.ref.currentConfig.pothosOptions[Re];if(!y||!Array.isArray(y)||y.length===0)return t(m,n,d,i);let r=await t(m,n,d,i),a=Array.isArray(r)?r:[r],o=Array.isArray(y)?y:[y],h=await ee({filters:o,entities:a,context:d});return Array.isArray(r)?h:h[0]??null}}};Ce.registerPlugin(ne,z);var oe=({db:e,disableDefaultObjects:t,pubsub:p,pothosConfig:m})=>{let n=new Ce({plugins:[re,Ee,Pe,...m?.plugins??[]],...m,drizzle:{client:e},smartSubscriptions:{...subscribeOptionsFromIterator((d,i)=>p.subscribe(d))}});return n.addScalarType("JSON",JSONResolver),n.addScalarType("Date",DateResolver),n.addScalarType("DateTime",DateTimeISOResolver),t?.query||n.queryType({}),t?.subscription||n.subscriptionType({}),t?.mutation||n.mutationType({}),{schemaBuilder:n}};var Ue=e=>`${E(toCamelCase(e.toString()))}WhereInputArgument`,ie=({db:e,schemaBuilder:t,enumImplementer:p})=>{let m=new Map,n=({tableName:d,name:i,nativeTableName:y})=>{let r=e._.schema[d];if(y){let f=Object.values(e._.schema).find(s=>s.dbName===y);f&&(r=f);}if(!r)throw new C(`Could not find schema for ${d.toString()} (whereArg)`);let a=i??Ue(r.dbName),o=m.get(a);return o||(o={inputType:t.inputType(a,{fields:u=>{let b=l=>{let c=w(l);switch(c){case "Int":return u.int({required:false});case "String":return u.string({required:false});case "Boolean":return u.boolean({required:false});case "Date":return u.field({type:"Date",required:false});case "DateTime":return u.field({type:"DateTime",required:false});case "Float":return u.float({required:false});case "ID":return u.id({required:false});case "JSON":return u.field({type:"JSON",required:false});default:throw new C(`Unsupported argument type ${c} for column ${l}`)}},S=Object.entries(r.columns).reduce((l,[c,x])=>{if(N(x)){let T=I(x),D=p({enumName:T.enumName});l[c]=u.field({type:D,required:false});}else l[c]=b(x.getSQLType());return l},{}),R=Object.entries(r.relations).reduce((l,[c,x])=>{let T=n({tableName:x.referencedTableName,nativeTableName:x.referencedTableName});return l[c]=u.field({type:T.inputType,required:false}),l},{});return {...S,...R}}}),transformArgumentToQueryCondition:u=>{if(!u)return;let b=l=>{let c=r.columns[l],x=u[l];if(x)return eq(c,x)},S=l=>{let c=r.relations[l],x=u[l];if(!x)return;let T=n({tableName:c.referencedTableName,nativeTableName:c.referencedTableName}).transformArgumentToQueryCondition;return T(x)},R=[...Object.keys(r.columns).map(b),...Object.keys(r.relations).map(S)];return and(...R)}},m.set(a,o),o)};return n};var qe=e=>{e.actions||(e.actions=["read","update","delete"]),e.defaultLimit===void 0&&(e.defaultLimit=100);let t=W(e),p=J({...e,abilityBuilder:t}),{makePubSubInstance:m,pubsub:n}=X({...e}),{schemaBuilder:d}=oe({...e,pubsub:n}),i=Y({...e,schemaBuilder:d}),y=ie({...e,schemaBuilder:d,enumImplementer:i}),r=Z({...e,schemaBuilder:d,makePubSubInstance:m,argImplementer:y,enumImplementer:i,abilityBuilder:t}),a=te({...e,schemaBuilder:d,argImplementer:y,makePubSubInstance:m});return {abilityBuilder:t,schemaBuilder:d,createYoga:h=>createYoga({...h,schema:d.toSchema(),context:p}),object:r,arg:y,query:a,pubsub:m,enum_:i}};
8
- export{C as RumbleError,A as RumbleErrorSafe,O as assertFindFirstExists,Te as assertFirstEntryExists,qe as rumble};//# sourceMappingURL=index.js.map
7
+ `+k(this.source,m);return t}toJSON(){let t={message:this.message};return this.locations!=null&&(t.locations=this.locations),this.path!=null&&(t.path=this.path),this.extensions!=null&&Object.keys(this.extensions).length>0&&(t.extensions=this.extensions),t}};function H(e){return e===void 0||e.length===0?void 0:e}var C=class extends Error{constructor(t){super(t),this.name="RumbleError";}},F=class extends v{};var O=(e,t)=>new C(`RumbleError: Unknown SQL type '${e}'. Please open an issue (https://github.com/m1212e/rumble/issues) so it can be added. (${t})`);function J(e){if(["serial","int","integer","tinyint","smallint","mediumint"].includes(e))return {value1:1,value2:2};if(["real","decimal","double","float"].includes(e))return {value1:1.1,value2:2.2};if(["string","text","varchar","char","text(256)"].includes(e))return {value1:"a",value2:"b"};if(["uuid"].includes(e))return {value1:"fba31870-5528-42d7-b27e-2e5ee657aea5",value2:"fc65db81-c2d1-483d-8a25-a30e2cf6e02d"};if(["boolean"].includes(e))return {value1:true,value2:false};if(["timestamp","datetime"].includes(e))return {value1:new Date(2022,1,1),value2:new Date(2022,1,2)};if(["date"].includes(e))return {value1:new Date(2022,1,1),value2:new Date(2022,1,2)};if(["json"].includes(e))return {value1:{a:1},value2:{b:2}};throw O(e,"Distinct")}var G=Symbol.for("drizzle:Name"),W=Symbol.for("drizzle:Columns");function E({dbName:e,tsName:t,table:m,db:u}){let n=m;if(t&&(n=u._.relations.schema[t]),e&&(n=Object.values(u._.relations.schema).find(a=>a[G]===e)),!n)throw new C(`Could not find schema for ${JSON.stringify({tsName:t,dbName:e,table:m?.[G]}).toString()}`);return {tableSchema:n,columns:n[W],get primaryColumns(){return Object.entries(n[W]).filter(([a,i])=>i.primary).reduce((a,[i,l])=>(a[i]=l,a),{})},relations:u._.relations.config[t],dbName:n[G],get tsName(){return Object.entries(u._.relations.schema).find(([a,i])=>i===n).at(0)}}}function fe(e){return typeof e!="function"}function Te(e){return typeof e=="function"&&e.constructor.name!=="AsyncFunction"}var Y=({db:e,actions:t,defaultLimit:m})=>{let u={},n={},a={},i=l=>{for(let o of t)a[l]||(a[l]={}),a[l][o]||(a[l][o]=[]);return {allow:o=>{let p=n[l];p||(p={},n[l]=p);let r=Array.isArray(o)?o:[o];for(let f of r){let s=p[f];s||(s="unspecified",p[f]=s);}return {when:f=>{for(let s of r)p[s]==="unspecified"&&(p[s]=[]),p[s].push(f);}}},filter:o=>{let p=Array.isArray(o)?o:[o];return {by:r=>{for(let f of p)a[l][f].push(r);}}}}};for(let l of Object.keys(e.query))u[l]=i(l);return {...u,registeredQueryFilters:n,registeredFilters:a,buildWithUserContext:l=>{let o={},p=r=>({filter:(f,s)=>{let d=y=>{let B=N(()=>{if(!(!y?.where&&!s?.inject?.where))return s?.inject?.where?{AND:[y?.where,s?.inject?.where]}:y?.where}),A=N(()=>{let P=B();if(!P)return;let ue=E({tsName:r,db:e});return relationsFilterToSQL(ue.tableSchema,P)}),q=N(()=>{let P=y?.limit??m;return s?.inject?.limit&&(!P||P>s.inject.limit)&&(P=s.inject.limit),y?.limit&&(!P||y.limit>P)&&(P=y.limit),P??void 0}),w=N(()=>{if(!(!y?.columns&&!s?.inject?.columns))return {...y?.columns,...s?.inject?.columns}});return {query:{single:{get where(){return B()},get columns(){return w()}},many:{get where(){return B()},get columns(){return w()},get limit(){return q()}}},sql:{get where(){return A()},get columns(){return w()},get limit(){return q()}}}},c=()=>{let y=E({db:e,tsName:r});if(Object.keys(y.primaryColumns).length===0)throw new C(`No primary key found for entity ${r.toString()}`);let B=Object.values(y.primaryColumns)[0],A=J(B.getSQLType());return {where:{AND:[{[B.name]:A.value1},{[B.name]:A.value2}]}}},b=n?.[r]?.[f];if(b==="unspecified")return d();b||(b=[c()]);let x=b.filter(fe),D=b.filter(Te).map(y=>y(l)),h=D.some(y=>y==="allow"),T=[...x,...D].filter(y=>y!==void 0).filter(y=>y!=="allow");!h&&T.length===0&&(T=[c()]);let g;for(let y of T)y?.limit&&(g===void 0||y.limit>g)&&(g=y.limit);let S;for(let y of [...T,s?.inject])y?.columns&&(S===void 0?S=y.columns:S={...S,...y.columns});let R=h?[]:T.filter(y=>y?.where).map(y=>y.where),L=R.length>0?{OR:R}:void 0;return d({where:L,columns:S,limit:g})},explicitFilters:f=>a[r][f]});for(let r of Object.keys(e.query))o[r]=p(r);return o}}};var X=({context:e,abilityBuilder:t})=>async m=>{let u=e?await e(m):{};return {...u,abilities:t.buildWithUserContext(u)}};function I(e){return String(e).charAt(0).toUpperCase()+String(e).slice(1)}function U(e){return e instanceof PgEnumColumn}var Z=({db:e,schemaBuilder:t})=>{let m=new Map;return ({tsName:n,enumColumn:a,refName:i})=>{let l,o;if(n){let s=E({db:e,tsName:n});l=n.toString();let d=Object.values(e._.relations.schema).filter(c=>typeof c=="object").map(c=>Object.values(c[Symbol.for("drizzle:Columns")])).flat(2).find(c=>c.config?.enum===s);if(!d)throw new C(`Could not find applied enum column for ${n.toString()}.
8
+ Please ensure that you use the enum at least once as a column of a table!`);o=d.enumValues;}else if(a){let s=Object.entries(e._.relations.schema).find(([d,c])=>c===a.config.enum);if(!s)throw new C(`Could not find enum in schema for ${a.name}!`);l=s[0],o=a.enumValues;}if(!l||!o)throw new C("Could not determine enum structure!");let p=i??`${I(toCamelCase(l))}Enum`,r=m.get(p);return r||(r=t.enumType(p,{values:o}),m.set(p,r),r)}};function Q(e){let t;if(["serial","int","integer","tinyint","smallint","mediumint"].includes(e)&&(t="Int"),["real","decimal","double","float"].includes(e)&&(t="Float"),["string","text","varchar","char","text(256)"].includes(e)&&(t="String"),["uuid"].includes(e)&&(t="ID"),["boolean"].includes(e)&&(t="Boolean"),["timestamp","datetime"].includes(e)&&(t="DateTime"),["date"].includes(e)&&(t="Date"),["json"].includes(e)&&(t="JSON"),t!==void 0)return t;throw O(e,"SQL to GQL")}var ee=({db:e,schemaBuilder:t,makePubSubInstance:m,argImplementer:u,enumImplementer:n,abilityBuilder:a})=>({table:i,refName:l,readAction:o="read",extend:p})=>{let r=E({db:e,tsName:i});Object.keys(r.primaryColumns).length===0&&console.warn(`Could not find primary key for ${i.toString()}. Cannot register subscriptions!`);let f=Object.values(r.primaryColumns)[0],{registerOnInstance:s}=m({table:i});return t.drizzleObject(i,{name:l??I(i.toString()),subscribe:(d,c,b)=>{if(!f)return;let x=c[f.name];if(!x){console.warn(`Could not find primary key value for ${JSON.stringify(c)}. Cannot register subscription!`);return}s({instance:d,action:"updated",primaryKeyValue:x});},applyFilters:a?.registeredFilters?.[i]?.[o],fields:d=>{let c=r.columns,b=(h,T,g)=>{let S=Q(h);switch(S){case "Int":return d.exposeInt(T,{nullable:g});case "String":return d.exposeString(T,{nullable:g});case "Boolean":return d.exposeBoolean(T,{nullable:g});case "Date":return d.field({type:"Date",resolve:R=>R[T],nullable:g});case "DateTime":return d.field({type:"DateTime",resolve:R=>R[T],nullable:g});case "Float":return d.exposeFloat(T,{nullable:g});case "ID":return d.exposeID(T,{nullable:g});case "JSON":return d.field({type:"JSON",resolve:R=>R[T],nullable:g});default:throw new C(`Unsupported object type ${S} for column ${T}`)}},x=Object.entries(c).reduce((h,[T,g])=>{if(U(g)){let S=n({enumColumn:g});h[T]=d.field({type:S,resolve:R=>R[T],nullable:!g.notNull});}else h[T]=b(g.getSQLType(),T,!g.notNull);return h},{}),D=Object.entries(r.relations).reduce((h,[T,g])=>{let S=E({db:e,table:g.targetTable}),R=u({dbName:S.dbName}),L=false,B="many";return g instanceof One&&(L=g.optional,B="single"),h[T]=d.relation(T,{args:{where:d.arg({type:R,required:false})},nullable:L,query:(A,q)=>q.abilities[S.tsName].filter(o,{inject:{where:A.where}}).query[B]}),h},{});return p?{...x,...D,...p(d)??{}}:{...x,...D}}})};var he="RUMBLE_SUBSCRIPTION_NOTIFICATION",Ce="REMOVED",De="UPDATED",Se="CREATED",ne=({subscriptions:e,db:t})=>{let m=e?createPubSub(...e):createPubSub();return {pubsub:m,makePubSubInstance:({table:n})=>{function a({action:i,tableName:l,primaryKeyValue:o}){let p;switch(i){case "created":p=Se;break;case "removed":p=Ce;break;case "updated":p=De;break;default:throw new Error(`Unknown action: ${i}`)}return `${he}/${l}${o?`/${o}`:""}/${p}`}return {registerOnInstance({instance:i,action:l,primaryKeyValue:o}){let p=a({tableName:n.toString(),action:l,primaryKeyValue:o});i.register(p);},created(){let i=a({tableName:n.toString(),action:"created"});return m.publish(i)},removed(i){let l=a({tableName:n.toString(),action:"removed"});return m.publish(l)},updated(i){let o=(Array.isArray(i)?i:[i]).map(r=>a({tableName:n.toString(),action:"updated",primaryKeyValue:r})),p=Array.from(new Set(o));for(let r of p)m.publish(r);}}}}};var j=e=>{if(!e)throw new F("Value not found but required (findFirst)");return e},Re=e=>{let t=e.at(0);if(!t)throw new F("Value not found but required (firstEntry)");return t},re=async({filters:e,entities:t,context:m})=>(await Promise.all(e.map(u=>u({context:m,entities:t})))).reduce((u,n)=>(u.push(...n),u),[]);var ie=({db:e,schemaBuilder:t,argImplementer:m,makePubSubInstance:u})=>({table:n,readAction:a="read",listAction:i="read"})=>{let l=m({table:n}),{registerOnInstance:o}=u({table:n});return t.queryFields(p=>({[`findMany${I(n.toString())}`]:p.drizzleField({type:[n],nullable:false,smartSubscription:true,subscribe:(r,f,s,d,c)=>{o({instance:r,action:"created"}),o({instance:r,action:"removed"});},args:{where:p.arg({type:l,required:false})},resolve:(r,f,s,d,c)=>{let b=d.abilities[n].filter(i,{inject:{where:s.where}}).query.many,x=r(b);return b.columns&&(x.columns=b.columns),e.query[n].findMany(x)}}),[`findFirst${I(n.toString())}`]:p.drizzleField({type:n,nullable:false,smartSubscription:true,args:{where:p.arg({type:l,required:false})},resolve:(r,f,s,d,c)=>{let b=d.abilities[n].filter(a,{inject:{where:s.where}}).query.single,x=r(b);return b.columns&&(x.columns=b.columns),e.query[n].findFirst(x).then(j)}})}))};var oe="ManualFiltersPlugin",se=oe,Pe="applyFilters",K=class extends BasePlugin{wrapResolve(t,m){return async(u,n,a,i)=>{let l=(m?.type).type?.ref.currentConfig.pothosOptions[Pe];if(!l||!Array.isArray(l)||l.length===0)return t(u,n,a,i);let o=await t(u,n,a,i),p=Array.isArray(o)?o:[o],r=Array.isArray(l)?l:[l],f=await re({filters:r,entities:p,context:a});return Array.isArray(o)?f:f[0]??null}}};Ee.registerPlugin(oe,K);var ae=({db:e,disableDefaultObjects:t,pubsub:m,pothosConfig:u})=>{let n=new Ee({plugins:[se,Ae,ve,...u?.plugins??[]],...u,drizzle:{client:e,relations:e._.relations,getTableConfig(a){return {columns:Object.values(a[Symbol.for("drizzle:Columns")]),primaryKeys:Object.values(a[Symbol.for("drizzle:Columns")]).filter(i=>i.primary)}}},smartSubscriptions:{...subscribeOptionsFromIterator((a,i)=>m.subscribe(a))}});return n.addScalarType("JSON",JSONResolver),n.addScalarType("Date",DateResolver),n.addScalarType("DateTime",DateTimeISOResolver),t?.query||n.queryType({}),t?.subscription||n.subscriptionType({}),t?.mutation||n.mutationType({}),{schemaBuilder:n}};var Oe=e=>`${I(toCamelCase(e.toString()))}WhereInputArgument`,le=({db:e,schemaBuilder:t,enumImplementer:m})=>{let u=new Map,n=({table:a,refName:i,dbName:l})=>{let o=E({db:e,dbName:l,tsName:a}),p=i??Oe(o.tsName),r=u.get(p);return r||(r=t.inputType(p,{fields:s=>{let d=x=>{let D=Q(x);switch(D){case "Int":return s.int({required:false});case "String":return s.string({required:false});case "Boolean":return s.boolean({required:false});case "Date":return s.field({type:"Date",required:false});case "DateTime":return s.field({type:"DateTime",required:false});case "Float":return s.float({required:false});case "ID":return s.id({required:false});case "JSON":return s.field({type:"JSON",required:false});default:throw new C(`Unsupported argument type ${D} for column ${x}`)}},c=Object.entries(o.columns).reduce((x,[D,h])=>{if(U(h)){let T=m({enumColumn:h});x[D]=s.field({type:T,required:false});}else x[D]=d(h.getSQLType());return x},{}),b=Object.entries(o.relations).reduce((x,[D,h])=>{let T=E({db:e,table:h.targetTable}),g=n({dbName:T.dbName});return x[D]=s.field({type:g,required:false}),x},{});return {...c,...b}}}),u.set(p,r),r)};return n};var Qe=e=>{e.actions||(e.actions=["read","update","delete"]),e.defaultLimit===void 0&&(e.defaultLimit=100);let t=Y(e),m=X({...e,abilityBuilder:t}),{makePubSubInstance:u,pubsub:n}=ne({...e}),{schemaBuilder:a}=ae({...e,pubsub:n}),i=Z({...e,schemaBuilder:a}),l=le({...e,schemaBuilder:a,enumImplementer:i}),o=ee({...e,schemaBuilder:a,makePubSubInstance:u,argImplementer:l,enumImplementer:i,abilityBuilder:t}),p=ie({...e,schemaBuilder:a,argImplementer:l,makePubSubInstance:u});return {abilityBuilder:t,schemaBuilder:a,createYoga:f=>createYoga({...f,schema:a.toSchema(),context:m}),object:o,arg:l,query:p,pubsub:u,enum_:i}};export{C as RumbleError,F as RumbleErrorSafe,j as assertFindFirstExists,Re as assertFirstEntryExists,Qe as rumble};//# sourceMappingURL=index.js.map
9
9
  //# sourceMappingURL=index.js.map