@m1212e/rumble 0.4.2 → 0.5.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
@@ -6,8 +6,31 @@ import { DrizzleClient } from '@pothos/plugin-drizzle';
6
6
  import * as graphql_yoga from 'graphql-yoga';
7
7
  import { createPubSub, YogaServerOptions } from 'graphql-yoga';
8
8
  import * as drizzle_orm from 'drizzle-orm';
9
- import SchemaBuilder from '@pothos/core';
10
- import { GraphQLError } from 'graphql';
9
+ import SchemaBuilder, { SchemaTypes, BasePlugin, PothosOutputFieldConfig } from '@pothos/core';
10
+ import { GraphQLFieldResolver, GraphQLError } from 'graphql';
11
+
12
+ declare const pluginName = "ManualFiltersPlugin";
13
+
14
+ declare const applyFiltersKey = "applyFilters";
15
+ declare class ManualFiltersPlugin<Types extends SchemaTypes> extends BasePlugin<Types> {
16
+ wrapResolve(resolver: GraphQLFieldResolver<unknown, Types["Context"], object>, fieldConfig: PothosOutputFieldConfig<Types>): GraphQLFieldResolver<unknown, Types["Context"], object>;
17
+ }
18
+
19
+ type Filter<Context, T> = (p: {
20
+ context: Context;
21
+ entities: T[];
22
+ }) => T[] | Promise<T[]>;
23
+ type ApplyFiltersField<Context, T> = Filter<Context, T> | Filter<Context, T>[] | undefined;
24
+ declare global {
25
+ export namespace PothosSchemaTypes {
26
+ interface Plugins<Types extends SchemaTypes> {
27
+ [pluginName]: ManualFiltersPlugin<Types>;
28
+ }
29
+ interface ObjectTypeOptions<Types extends SchemaTypes, Shape> {
30
+ [applyFiltersKey]?: ApplyFiltersField<Types["Context"], any>;
31
+ }
32
+ }
33
+ }
11
34
 
12
35
  type QueryConditionObject = Partial<{
13
36
  where: any;
@@ -54,6 +77,11 @@ type RumbleInput<UserContext extends Record<string, any>, DB extends GenericDriz
54
77
  * Options passed along to the pothos schema builder.
55
78
  */
56
79
  pothosConfig?: PothosConfig;
80
+ /**
81
+ * Limits the returned amount when querying lists. Set to null to disable.
82
+ * @default 100
83
+ */
84
+ defaultLimit?: number | undefined | null;
57
85
  };
58
86
 
59
87
  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>) => {
@@ -77,8 +105,11 @@ declare const rumble: <UserContext extends Record<string, any>, DB extends Gener
77
105
  allow: (action: Action | Action[]) => {
78
106
  when: (condition: Parameters<DB["query"][keyof DB["query"]]["findMany"]>[0] | ((context: UserContext) => Parameters<DB["query"][keyof DB["query"]]["findMany"]>[0] | undefined)) => void;
79
107
  };
108
+ filter: (action: Action | Action[]) => {
109
+ by: (explicitFilter: Filter<UserContext, NonNullable<Awaited<ReturnType<DB["query"][key]["findFirst"]>>>>) => void;
110
+ };
80
111
  }; } : never) & {
81
- registeredConditions: keyof DB["query"] extends infer T_1 extends keyof DB["query"] ? { [key_1 in T_1]: { [key_2 in Action[number]]: "wildcard" | (Partial<{
112
+ registeredConditions: keyof DB["query"] extends infer T_1 extends keyof DB["query"] ? { [key_1 in T_1]: { [key_2 in Action]: "wildcard" | (Partial<{
82
113
  where: any;
83
114
  columns: any;
84
115
  limit: any;
@@ -87,7 +118,8 @@ declare const rumble: <UserContext extends Record<string, any>, DB extends Gener
87
118
  columns: any;
88
119
  limit: any;
89
120
  }> | undefined))[]; }; } : never;
90
- buildWithUserContext: (userContext: UserContext) => keyof DB["query"] extends infer T_2 extends keyof DB["query"] ? { [key_3 in T_2]: {
121
+ 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;
122
+ buildWithUserContext: (userContext: UserContext) => keyof DB["query"] extends infer T_3 extends keyof DB["query"] ? { [key_5 in T_3]: {
91
123
  filter: (action: Action, options?: {
92
124
  inject?: Partial<{
93
125
  where: any;
@@ -102,9 +134,10 @@ declare const rumble: <UserContext extends Record<string, any>, DB extends Gener
102
134
  many: {
103
135
  where: drizzle_orm.SQL<unknown> | undefined;
104
136
  columns: Record<string, any> | undefined;
105
- limit: any;
137
+ limit: number | undefined;
106
138
  };
107
139
  };
140
+ 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];
108
141
  }; } : never;
109
142
  };
110
143
  /**
@@ -112,7 +145,7 @@ declare const rumble: <UserContext extends Record<string, any>, DB extends Gener
112
145
  */
113
146
  schemaBuilder: PothosSchemaTypes.SchemaBuilder<PothosSchemaTypes.ExtendDefaultTypes<{
114
147
  Context: Awaited<UserContext & {
115
- abilities: keyof DB["query"] extends infer T_2 extends keyof DB["query"] ? { [key_3 in T_2]: {
148
+ abilities: keyof DB["query"] extends infer T_3 extends keyof DB["query"] ? { [key_5 in T_3]: {
116
149
  filter: (action: Action, options?: {
117
150
  inject?: Partial<{
118
151
  where: any;
@@ -127,9 +160,10 @@ declare const rumble: <UserContext extends Record<string, any>, DB extends Gener
127
160
  many: {
128
161
  where: drizzle_orm.SQL<unknown> | undefined;
129
162
  columns: Record<string, any> | undefined;
130
- limit: any;
163
+ limit: number | undefined;
131
164
  };
132
165
  };
166
+ 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];
133
167
  }; } : never;
134
168
  }>;
135
169
  DrizzleSchema: DB["_"]["fullSchema"];
@@ -171,7 +205,7 @@ declare const rumble: <UserContext extends Record<string, any>, DB extends Gener
171
205
  readAction?: Action | undefined;
172
206
  }) => _pothos_plugin_drizzle.DrizzleObjectRef<PothosSchemaTypes.ExtendDefaultTypes<{
173
207
  Context: Awaited<UserContext & {
174
- abilities: keyof DB["query"] extends infer T_3 extends keyof DB["query"] ? { [key_3 in T_3]: {
208
+ abilities: keyof DB["query"] extends infer T_4 extends keyof DB["query"] ? { [key_5 in T_4]: {
175
209
  filter: (action: Action, options?: {
176
210
  inject?: Partial<{
177
211
  where: any;
@@ -186,9 +220,10 @@ declare const rumble: <UserContext extends Record<string, any>, DB extends Gener
186
220
  many: {
187
221
  where: drizzle_orm.SQL<unknown> | undefined;
188
222
  columns: Record<string, any> | undefined;
189
- limit: any;
223
+ limit: number | undefined;
190
224
  };
191
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];
192
227
  }; } : never;
193
228
  }>;
194
229
  DrizzleSchema: DB["_"]["fullSchema"];
@@ -206,7 +241,7 @@ declare const rumble: <UserContext extends Record<string, any>, DB extends Gener
206
241
  Output: Date;
207
242
  };
208
243
  };
209
- }>, 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_7 ? { [K_2 in keyof T_7]: { [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_8 ? { [K_5 in keyof T_8]: { [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_4 ? { [K in keyof T_4]: (({ [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_5 ? { [K_2 in keyof T_5]: { [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_6 ? { [K_5 in keyof T_6]: { [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>;
244
+ }>, 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>;
210
245
  /**
211
246
  * A function for creating where args to filter entities
212
247
  */
@@ -217,7 +252,7 @@ declare const rumble: <UserContext extends Record<string, any>, DB extends Gener
217
252
  }) => {
218
253
  inputType: PothosSchemaTypes.InputObjectRef<PothosSchemaTypes.ExtendDefaultTypes<{
219
254
  Context: Awaited<UserContext & {
220
- abilities: keyof DB["query"] extends infer T_3 extends keyof DB["query"] ? { [key_3 in T_3]: {
255
+ abilities: keyof DB["query"] extends infer T_4 extends keyof DB["query"] ? { [key_5 in T_4]: {
221
256
  filter: (action: Action, options?: {
222
257
  inject?: Partial<{
223
258
  where: any;
@@ -232,9 +267,10 @@ declare const rumble: <UserContext extends Record<string, any>, DB extends Gener
232
267
  many: {
233
268
  where: drizzle_orm.SQL<unknown> | undefined;
234
269
  columns: Record<string, any> | undefined;
235
- limit: any;
270
+ limit: number | undefined;
236
271
  };
237
272
  };
273
+ 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];
238
274
  }; } : never;
239
275
  }>;
240
276
  DrizzleSchema: DB["_"]["fullSchema"];
@@ -255,9 +291,9 @@ declare const rumble: <UserContext extends Record<string, any>, DB extends Gener
255
291
  }>, {
256
292
  [x: string]: unknown;
257
293
  }>;
258
- transformArgumentToQueryCondition: <T_4 extends {
294
+ transformArgumentToQueryCondition: <T_5 extends {
259
295
  [x: string]: unknown;
260
- }>(arg: T_4 | null | undefined) => drizzle_orm.SQL<unknown> | undefined;
296
+ }>(arg: T_5 | null | undefined) => drizzle_orm.SQL<unknown> | undefined;
261
297
  };
262
298
  /**
263
299
  * A function for creating default READ queries.
@@ -290,7 +326,7 @@ declare const rumble: <UserContext extends Record<string, any>, DB extends Gener
290
326
  * The other helpers use this helper internally so in most cases you do not have to
291
327
  * call this helper directly, unless you need the reference to an enum type
292
328
  */
293
- enum_: <ExplicitEnumVariableName extends keyof (NonNullable<DB["_"]["fullSchema"]> extends infer T_3 ? { [K in keyof T_3 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<{
329
+ 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<{
294
330
  enumVariableName: ExplicitEnumVariableName;
295
331
  enumName: EnumName;
296
332
  name: RefName_2 | undefined;
@@ -300,7 +336,7 @@ declare const rumble: <UserContext extends Record<string, any>, DB extends Gener
300
336
  enumName: EnumName;
301
337
  })>) => PothosSchemaTypes.EnumRef<PothosSchemaTypes.ExtendDefaultTypes<{
302
338
  Context: Awaited<UserContext & {
303
- abilities: keyof DB["query"] extends infer T_4 extends keyof DB["query"] ? { [key_3 in T_4]: {
339
+ abilities: keyof DB["query"] extends infer T_5 extends keyof DB["query"] ? { [key_5 in T_5]: {
304
340
  filter: (action: Action, options?: {
305
341
  inject?: Partial<{
306
342
  where: any;
@@ -315,9 +351,10 @@ declare const rumble: <UserContext extends Record<string, any>, DB extends Gener
315
351
  many: {
316
352
  where: drizzle_orm.SQL<unknown> | undefined;
317
353
  columns: Record<string, any> | undefined;
318
- limit: any;
354
+ limit: number | undefined;
319
355
  };
320
356
  };
357
+ 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];
321
358
  }; } : never;
322
359
  }>;
323
360
  DrizzleSchema: DB["_"]["fullSchema"];
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 de from'@pothos/core';import ye from'@pothos/plugin-drizzle';import fe,{subscribeOptionsFromIterator}from'@pothos/plugin-smart-subscriptions';import {JSONResolver,DateResolver,DateTimeISOResolver}from'graphql-scalars';function q(e){return typeof e=="object"&&e!==null}function z(e,t){throw new Error("Unexpected invariant triggered.")}var Z=/\r\n|[\n\r]/g;function I(e,t){let l=0,c=1;for(let r of e.body.matchAll(Z)){if(typeof r.index=="number"||z(),r.index>=t)break;l=r.index+r[0].length,c+=1;}return {line:c,column:t+1-l}}function w(e){return U(e.source,I(e.source,e.start))}function U(e,t){let l=e.locationOffset.column-1,c="".padStart(l)+e.body,r=t.line-1,s=e.locationOffset.line-1,i=t.line+s,a=t.line===1?l:0,o=t.column+a,m=`${e.name}:${i}:${o}
2
- `,n=c.split(/\r\n|[\n\r]/g),d=n[r];if(d.length>120){let y=Math.floor(o/80),C=o%80,u=[];for(let x=0;x<d.length;x+=80)u.push(d.slice(x,x+80));return m+O([[`${i} |`,u[0]],...u.slice(1,y+1).map(x=>["|",x]),["|","^".padStart(C)],["|",u[y+1]]])}return m+O([[`${i-1} |`,n[r-1]],[`${i} |`,d],["|","^".padStart(o)],[`${i+1} |`,n[r+1]]])}function O(e){let t=e.filter(([c,r])=>r!==void 0),l=Math.max(...t.map(([c])=>c.length));return t.map(([c,r])=>c.padStart(l)+(r?" "+r:"")).join(`
3
- `)}function ee(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 E=class e extends Error{constructor(t,...l){var c,r,s;let{nodes:i,source:a,positions:o,path:m,originalError:n,extensions:d}=ee(l);super(t),this.name="GraphQLError",this.path=m??void 0,this.originalError=n??void 0,this.nodes=Q(Array.isArray(i)?i:i?[i]:void 0);let y=Q((c=this.nodes)===null||c===void 0?void 0:c.map(u=>u.loc).filter(u=>u!=null));this.source=a??(y==null||(r=y[0])===null||r===void 0?void 0:r.source),this.positions=o??y?.map(u=>u.start),this.locations=o&&a?o.map(u=>I(a,u)):y?.map(u=>I(u.source,u.start));let C=q(n?.extensions)?n?.extensions:void 0;this.extensions=(s=d??C)!==null&&s!==void 0?s: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}}),n!=null&&n.stack?Object.defineProperty(this,"stack",{value:n.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 l of this.nodes)l.loc&&(t+=`
1
+ import {createYoga,createPubSub}from'graphql-yoga';import {One,or,and,eq}from'drizzle-orm';import {toCamelCase}from'drizzle-orm/casing';import be,{BasePlugin}from'@pothos/core';import Se from'@pothos/plugin-drizzle';import Re,{subscribeOptionsFromIterator}from'@pothos/plugin-smart-subscriptions';import {JSONResolver,DateResolver,DateTimeISOResolver}from'graphql-scalars';function w(e){return typeof e=="object"&&e!==null}function Q(e,t){throw new Error("Unexpected invariant triggered.")}var oe=/\r\n|[\n\r]/g;function I(e,t){let l=0,p=1;for(let n of e.body.matchAll(oe)){if(typeof n.index=="number"||Q(),n.index>=t)break;l=n.index+n[0].length,p+=1;}return {line:p,column:t+1-l}}function G(e){return q(e.source,I(e.source,e.start))}function q(e,t){let l=e.locationOffset.column-1,p="".padStart(l)+e.body,n=t.line-1,d=e.locationOffset.line-1,i=t.line+d,y=t.line===1?l:0,r=t.column+y,s=`${e.name}:${i}:${r}
2
+ `,o=p.split(/\r\n|[\n\r]/g),f=o[n];if(f.length>120){let a=Math.floor(r/80),c=r%80,m=[];for(let b=0;b<f.length;b+=80)m.push(f.slice(b,b+80));return s+k([[`${i} |`,m[0]],...m.slice(1,a+1).map(b=>["|",b]),["|","^".padStart(c)],["|",m[a+1]]])}return s+k([[`${i-1} |`,o[n-1]],[`${i} |`,f],["|","^".padStart(r)],[`${i+1} |`,o[n+1]]])}function k(e){let t=e.filter(([p,n])=>n!==void 0),l=Math.max(...t.map(([p])=>p.length));return t.map(([p,n])=>p.padStart(l)+(n?" "+n:"")).join(`
3
+ `)}function ie(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,...l){var p,n,d;let{nodes:i,source:y,positions:r,path:s,originalError:o,extensions:f}=ie(l);super(t),this.name="GraphQLError",this.path=s??void 0,this.originalError=o??void 0,this.nodes=j(Array.isArray(i)?i:i?[i]:void 0);let a=j((p=this.nodes)===null||p===void 0?void 0:p.map(m=>m.loc).filter(m=>m!=null));this.source=y??(a==null||(n=a[0])===null||n===void 0?void 0:n.source),this.positions=r??a?.map(m=>m.start),this.locations=r&&y?r.map(m=>I(y,m)):a?.map(m=>I(m.source,m.start));let c=w(o?.extensions)?o?.extensions:void 0;this.extensions=(d=f??c)!==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 l of this.nodes)l.loc&&(t+=`
4
4
 
5
- `+w(l.loc));else if(this.source&&this.locations)for(let l of this.locations)t+=`
5
+ `+G(l.loc));else if(this.source&&this.locations)for(let l of this.locations)t+=`
6
6
 
7
- `+U(this.source,l);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 Q(e){return e===void 0||e.length===0?void 0:e}var S=class extends Error{constructor(t){super(t),this.name="RumbleError";}},P=class extends E{};var v=(e,t)=>new S(`RumbleError: Unknown SQL type '${e}'. Please open an issue (https://github.com/m1212e/rumble/issues) so it can be added. (${t})`);function k(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 v(e,"Distinct")}function oe(e){return typeof e!="function"}function ie(e){return typeof e=="function"&&e.constructor.name!=="AsyncFunction"}var j=({db:e})=>{let t=e._.schema,l={},c={},r=s=>({allow:i=>{let a=c[s];a||(a={},c[s]=a);let o=Array.isArray(i)?i:[i];for(let m of o){let n=a[m];n||(n="wildcard",a[m]=n);}return {when:m=>{for(let n of o)a[n]==="wildcard"&&(a[n]=[]),a[n].push(m);}}}});for(let s of Object.keys(e.query))l[s]=r(s);return {...l,registeredConditions:c,buildWithUserContext:s=>{let i={},a=o=>({filter:(m,n)=>{let d=c[o];d||(d={});let y=d[m];if(y==="wildcard")return {single:{where:n?.inject?.where,columns:n?.inject?.columns},many:{where:n?.inject?.where,columns:n?.inject?.columns,limit:n?.inject?.limit}};let C=()=>{let b=t[o].primaryKey.at(0);if(!b)throw new S(`No primary key found for entity ${o.toString()}`);let D=k(b.getSQLType());return {where:and(eq(b,D.value1),eq(b,D.value2))}};(!d||!y)&&(y=[C()]);let u=y.filter(oe),x=y.filter(ie).map(b=>b(s)),h=[...u,...x];h.filter(b=>b!==void 0).length===0&&h.push(C());let f;for(let b of h)b?.limit&&(f===void 0||b.limit>f)&&(f=b.limit);n?.inject?.limit&&f<n.inject.limit&&(f=n.inject.limit);let p;for(let b of [...h,n?.inject??{}])b?.columns&&(p===void 0?p=b.columns:p={...p,...b.columns});let g=h.filter(b=>b?.where).map(b=>b?.where),T=g.length>0?or(...g):void 0;return n?.inject?.where&&(T=T?and(T,n.inject.where):n.inject.where),{single:{where:T,columns:p},many:{where:T,columns:p,limit:f}}}});for(let o of Object.keys(e.query))i[o]=a(o);return i}}};var _=({context:e,abilityBuilder:t})=>async l=>{let c=e?await e(l):{};return {...c,abilities:t.buildWithUserContext(c)}};function R(e){return String(e).charAt(0).toUpperCase()+String(e).slice(1)}function A(e){let t=B(e);return t.enumValues!==void 0&&t.enumName!==void 0&&typeof t.enumName=="string"&&Array.isArray(t.enumValues)}function B(e){return e.enum??e}var K=({db:e,schemaBuilder:t})=>{let l=new Map;return ({enumVariableName:r,name:s,enumName:i})=>{let a=e._.fullSchema,o;if(r?o=a[r]:i&&(o=Object.values(a).filter(A).map(B).find(y=>y.enumName===i)),!o)throw new S(`Could not determine enum structure! (${String(r)}, ${enumValuesParam}, ${i})`);let m=s??`${R(toCamelCase(o.enumName.toString()))}Enum`,n=l.get(m);return n||(n=t.enumType(m,{values:o.enumValues}),l.set(m,n),n)}};function N(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 v(e,"SQL to GQL")}var ae="RUMBLE_SUBSCRIPTION_NOTIFICATION",ue="REMOVED",me="UPDATED",le="CREATED",$=({subscriptions:e,db:t})=>{let l=e?createPubSub(...e):createPubSub();return {pubsub:l,makePubSubInstance:({tableName:r})=>{function s({action:i,tableName:a,primaryKeyValue:o}){let m;switch(i){case "created":m=le;break;case "removed":m=ue;break;case "updated":m=me;break;default:throw new Error(`Unknown action: ${i}`)}return `${ae}/${a}${o?`/${o}`:""}/${m}`}return {registerOnInstance({instance:i,action:a,primaryKeyValue:o}){let m=s({tableName:r.toString(),action:a,primaryKeyValue:o});i.register(m);},created(){let i=s({tableName:r.toString(),action:"created"});return l.publish(i)},removed(i){let a=s({tableName:r.toString(),action:"removed"});return l.publish(a)},updated(i){let o=(Array.isArray(i)?i:[i]).map(n=>s({tableName:r.toString(),action:"updated",primaryKeyValue:n})),m=Array.from(new Set(o));for(let n of m)l.publish(n);}}}}};var M=({db:e,schemaBuilder:t,makePubSubInstance:l,argImplementer:c,enumImplementer:r})=>({tableName:s,name:i,readAction:a="read"})=>{let o=e._.schema[s];if(!o)throw new S(`Could not find schema for ${s.toString()} (object)`);let m=o.primaryKey.at(0)?.name;m||console.warn(`Could not find primary key for ${s.toString()}. Cannot register subscriptions!`);let{registerOnInstance:n}=l({tableName:s});return t.drizzleObject(s,{name:i??R(s.toString()),subscribe:(d,y,C)=>{if(!m)return;let u=y[m];if(!u){console.warn(`Could not find primary key value for ${JSON.stringify(y)}. Cannot register subscription!`);return}n({instance:d,action:"updated",primaryKeyValue:u});},fields:d=>{let y=(x,h,f)=>{let p=N(x);switch(p){case "Int":return d.exposeInt(h,{nullable:f});case "String":return d.exposeString(h,{nullable:f});case "Boolean":return d.exposeBoolean(h,{nullable:f});case "Date":return d.field({type:"Date",resolve:g=>g[h],nullable:f});case "DateTime":return d.field({type:"DateTime",resolve:g=>g[h],nullable:f});case "Float":return d.exposeFloat(h,{nullable:f});case "ID":return d.exposeID(h,{nullable:f});case "JSON":return d.field({type:"JSON",resolve:g=>g[h],nullable:f});default:throw new S(`Unsupported object type ${p} for column ${h}`)}},C=Object.entries(o.columns).reduce((x,[h,f])=>{if(A(f)){let p=B(f),g=r({enumName:p.enumName});x[h]=d.field({type:g,resolve:T=>T[h],nullable:!f.notNull});}else x[h]=y(f.getSQLType(),h,!f.notNull);return x},{}),u=Object.entries(o.relations).reduce((x,[h,f])=>{let {inputType:p,transformArgumentToQueryCondition:g}=c({tableName:f.referencedTableName,nativeTableName:f.referencedTableName}),T=false,D="many";return f instanceof One&&(T=!f.isNullable,D="single"),x[h]=d.relation(h,{args:{where:d.arg({type:p,required:false})},nullable:T,query:(H,X)=>X.abilities[f.referencedTableName].filter(a,{inject:{where:g(H.where)}})[D]}),x},{});return {...C,...u}}})};var L=e=>{if(!e)throw new P("Value not found but required (findFirst)");return e},pe=e=>{let t=e.at(0);if(!t)throw new P("Value not found but required (firstEntry)");return t};var W=({db:e,schemaBuilder:t,argImplementer:l,makePubSubInstance:c})=>({tableName:r,readAction:s="read",listAction:i="read"})=>{let a=e._.schema[r];if(!a)throw new S(`Could not find schema for ${r.toString()} (query)`);a.primaryKey.at(0)?.name||console.warn(`Could not find primary key for ${r.toString()}. Cannot register subscriptions!`);let{inputType:m,transformArgumentToQueryCondition:n}=l({tableName:r}),{registerOnInstance:d}=c({tableName:r});return t.queryFields(y=>({[`findMany${R(r.toString())}`]:y.drizzleField({type:[r],nullable:false,smartSubscription:true,subscribe:(C,u,x,h,f)=>{d({instance:C,action:"created"}),d({instance:C,action:"removed"});},args:{where:y.arg({type:m,required:false})},resolve:(C,u,x,h,f)=>{let p=h.abilities[r].filter(i,{inject:{where:n(x.where)}}).many,g=C(p);return p.columns&&(g.columns=p.columns),e.query[r].findMany(g)}}),[`findFirst${R(r.toString())}`]:y.drizzleField({type:r,nullable:false,smartSubscription:true,args:{where:y.arg({type:m,required:false})},resolve:(C,u,x,h,f)=>{let p=h.abilities[r].filter(s,{inject:{where:n(x.where)}}).single,g=C(p);return p.columns&&(g.columns=p.columns),e.query[r].findFirst(g).then(L)}})}))};var J=({db:e,disableDefaultObjects:t,pubsub:l,pothosConfig:c})=>{let r=new de({plugins:[ye,fe,...c?.plugins??[]],...c,drizzle:{client:e},smartSubscriptions:{...subscribeOptionsFromIterator((s,i)=>l.subscribe(s))}});return r.addScalarType("JSON",JSONResolver),r.addScalarType("Date",DateResolver),r.addScalarType("DateTime",DateTimeISOResolver),t?.query||r.queryType({}),t?.subscription||r.subscriptionType({}),t?.mutation||r.mutationType({}),{schemaBuilder:r}};var Re=e=>`${R(toCamelCase(e.toString()))}WhereInputArgument`,Y=({db:e,schemaBuilder:t,enumImplementer:l})=>{let c=new Map,r=({tableName:s,name:i,nativeTableName:a})=>{let o=e._.schema[s];if(a){let y=Object.values(e._.schema).find(C=>C.dbName===a);y&&(o=y);}if(!o)throw new S(`Could not find schema for ${s.toString()} (whereArg)`);let m=i??Re(o.dbName),n=c.get(m);return n||(n={inputType:t.inputType(m,{fields:u=>{let x=p=>{let g=N(p);switch(g){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 S(`Unsupported argument type ${g} for column ${p}`)}},h=Object.entries(o.columns).reduce((p,[g,T])=>{if(A(T)){let b=B(T),D=l({enumName:b.enumName});p[g]=u.field({type:D,required:false});}else p[g]=x(T.getSQLType());return p},{}),f=Object.entries(o.relations).reduce((p,[g,T])=>{let b=r({tableName:T.referencedTableName,nativeTableName:T.referencedTableName});return p[g]=u.field({type:b.inputType,required:false}),p},{});return {...h,...f}}}),transformArgumentToQueryCondition:u=>{if(!u)return;let x=p=>{let g=o.columns[p],T=u[p];if(T)return eq(g,T)},h=p=>{let g=o.relations[p],T=u[p];if(!T)return;let b=r({tableName:g.referencedTableName,nativeTableName:g.referencedTableName}).transformArgumentToQueryCondition;return b(T)},f=[...Object.keys(o.columns).map(x),...Object.keys(o.relations).map(h)];return and(...f)}},c.set(m,n),n)};return r};var Ee=e=>{let t=j(e),l=_({...e,abilityBuilder:t}),{makePubSubInstance:c,pubsub:r}=$({...e}),{schemaBuilder:s}=J({...e,pubsub:r}),i=K({...e,schemaBuilder:s}),a=Y({...e,schemaBuilder:s,enumImplementer:i}),o=M({...e,schemaBuilder:s,makePubSubInstance:c,argImplementer:a,enumImplementer:i}),m=W({...e,schemaBuilder:s,argImplementer:a,makePubSubInstance:c});return {abilityBuilder:t,schemaBuilder:s,createYoga:d=>createYoga({...d,schema:s.toSchema(),context:l}),object:o,arg:a,query:m,pubsub:c,enum_:i}};
8
- export{S as RumbleError,P as RumbleErrorSafe,L as assertFindFirstExists,pe as assertFirstEntryExists,Ee as rumble};//# sourceMappingURL=index.js.map
7
+ `+q(this.source,l);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 j(e){return e===void 0||e.length===0?void 0:e}var R=class extends Error{constructor(t){super(t),this.name="RumbleError";}},A=class extends B{};var U=(e,t)=>new R(`RumbleError: Unknown SQL type '${e}'. Please open an issue (https://github.com/m1212e/rumble/issues) so it can be added. (${t})`);function _(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 le(e){return typeof e!="function"}function pe(e){return typeof e=="function"&&e.constructor.name!=="AsyncFunction"}var $=({db:e,actions:t,defaultLimit:l})=>{let p=e._.schema,n={},d={},i={},y=r=>{for(let s of t)i[r]||(i[r]={}),i[r][s]||(i[r][s]=[]);return {allow:s=>{let o=d[r];o||(o={},d[r]=o);let f=Array.isArray(s)?s:[s];for(let a of f){let c=o[a];c||(c="wildcard",o[a]=c);}return {when:a=>{for(let c of f)o[c]==="wildcard"&&(o[c]=[]),o[c].push(a);}}},filter:s=>{let o=Array.isArray(s)?s:[s];return {by:f=>{for(let a of o)i[r][a].push(f);}}}}};for(let r of Object.keys(e.query))n[r]=y(r);return {...n,registeredConditions:d,registeredFilters:i,buildWithUserContext:r=>{let s={},o=f=>({filter:(a,c)=>{let m=d[f];m||(m={});let b=m[a];if(b==="wildcard")return {single:{where:c?.inject?.where,columns:c?.inject?.columns},many:{where:c?.inject?.where,columns:c?.inject?.columns,limit:c?.inject?.limit??l??void 0}};let C=()=>{let T=p[f].primaryKey.at(0);if(!T)throw new R(`No primary key found for entity ${f.toString()}`);let L=_(T.getSQLType());return {where:and(eq(T,L.value1),eq(T,L.value2))}};(!m||!b)&&(b=[C()]);let x=b.filter(le),u=b.filter(pe).map(T=>T(r)),h=[...x,...u];h.filter(T=>T!==void 0).length===0&&h.push(C());let g;for(let T of h)T?.limit&&(g===void 0||T.limit>g)&&(g=T.limit);c?.inject?.limit&&g&&g<c.inject.limit&&(g=c.inject.limit);let S;for(let T of [...h,c?.inject??{}])T?.columns&&(S===void 0?S=T.columns:S={...S,...T.columns});let P=h.filter(T=>T?.where).map(T=>T?.where),E=P.length>0?or(...P):void 0;return c?.inject?.where&&(E=E?and(E,c.inject.where):c.inject.where),{single:{where:E,columns:S},many:{where:E,columns:S,limit:g??l??void 0}}},explicitFilters:a=>i[f][a]});for(let f of Object.keys(e.query))s[f]=o(f);return s}}};var M=({context:e,abilityBuilder:t})=>async l=>{let p=e?await e(l):{};return {...p,abilities:t.buildWithUserContext(p)}};function D(e){return String(e).charAt(0).toUpperCase()+String(e).slice(1)}function N(e){let t=v(e);return t.enumValues!==void 0&&t.enumName!==void 0&&typeof t.enumName=="string"&&Array.isArray(t.enumValues)}function v(e){return e.enum??e}var W=({db:e,schemaBuilder:t})=>{let l=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(v).find(a=>a.enumName===i)),!r)throw new R(`Could not determine enum structure! (${String(n)}, ${enumValuesParam}, ${i})`);let s=d??`${D(toCamelCase(r.enumName.toString()))}Enum`,o=l.get(s);return o||(o=t.enumType(s,{values:r.enumValues}),l.set(s,o),o)}};function F(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 ce="RUMBLE_SUBSCRIPTION_NOTIFICATION",ye="REMOVED",de="UPDATED",fe="CREATED",Y=({subscriptions:e,db:t})=>{let l=e?createPubSub(...e):createPubSub();return {pubsub:l,makePubSubInstance:({tableName:n})=>{function d({action:i,tableName:y,primaryKeyValue:r}){let s;switch(i){case "created":s=fe;break;case "removed":s=ye;break;case "updated":s=de;break;default:throw new Error(`Unknown action: ${i}`)}return `${ce}/${y}${r?`/${r}`:""}/${s}`}return {registerOnInstance({instance:i,action:y,primaryKeyValue:r}){let s=d({tableName:n.toString(),action:y,primaryKeyValue:r});i.register(s);},created(){let i=d({tableName:n.toString(),action:"created"});return l.publish(i)},removed(i){let y=d({tableName:n.toString(),action:"removed"});return l.publish(y)},updated(i){let r=(Array.isArray(i)?i:[i]).map(o=>d({tableName:n.toString(),action:"updated",primaryKeyValue:o})),s=Array.from(new Set(r));for(let o of s)l.publish(o);}}}}};var H=({db:e,schemaBuilder:t,makePubSubInstance:l,argImplementer:p,enumImplementer:n,abilityBuilder:d})=>({tableName:i,name:y,readAction:r="read"})=>{let s=e._.schema[i];if(!s)throw new R(`Could not find schema for ${i.toString()} (object)`);let o=s.primaryKey.at(0)?.name;o||console.warn(`Could not find primary key for ${i.toString()}. Cannot register subscriptions!`);let{registerOnInstance:f}=l({tableName:i});return t.drizzleObject(i,{name:y??D(i.toString()),subscribe:(a,c,m)=>{if(!o)return;let b=c[o];if(!b){console.warn(`Could not find primary key value for ${JSON.stringify(c)}. Cannot register subscription!`);return}f({instance:a,action:"updated",primaryKeyValue:b});},applyFilters:d?.registeredFilters?.[i]?.[r],fields:a=>{let c=(C,x,u)=>{let h=F(C);switch(h){case "Int":return a.exposeInt(x,{nullable:u});case "String":return a.exposeString(x,{nullable:u});case "Boolean":return a.exposeBoolean(x,{nullable:u});case "Date":return a.field({type:"Date",resolve:g=>g[x],nullable:u});case "DateTime":return a.field({type:"DateTime",resolve:g=>g[x],nullable:u});case "Float":return a.exposeFloat(x,{nullable:u});case "ID":return a.exposeID(x,{nullable:u});case "JSON":return a.field({type:"JSON",resolve:g=>g[x],nullable:u});default:throw new R(`Unsupported object type ${h} for column ${x}`)}},m=Object.entries(s.columns).reduce((C,[x,u])=>{if(N(u)){let h=v(u),g=n({enumName:h.enumName});C[x]=a.field({type:g,resolve:S=>S[x],nullable:!u.notNull});}else C[x]=c(u.getSQLType(),x,!u.notNull);return C},{}),b=Object.entries(s.relations).reduce((C,[x,u])=>{let {inputType:h,transformArgumentToQueryCondition:g}=p({tableName:u.referencedTableName,nativeTableName:u.referencedTableName}),S=false,E="many";return u instanceof One&&(S=!u.isNullable,E="single"),C[x]=a.relation(x,{args:{where:a.arg({type:h,required:false})},nullable:S,query:(T,L)=>L.abilities[u.referencedTableName].filter(r,{inject:{where:g(T.where)}})[E]}),C},{});return {...m,...b}}})};var z=e=>{if(!e)throw new A("Value not found but required (findFirst)");return e},ge=e=>{let t=e.at(0);if(!t)throw new A("Value not found but required (firstEntry)");return t},X=async({filters:e,entities:t,context:l})=>(await Promise.all(e.map(p=>p({context:l,entities:t})))).reduce((p,n)=>(p.push(...n),p),[]);var Z=({db:e,schemaBuilder:t,argImplementer:l,makePubSubInstance:p})=>({tableName:n,readAction:d="read",listAction:i="read"})=>{let y=e._.schema[n];if(!y)throw new R(`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:s,transformArgumentToQueryCondition:o}=l({tableName:n}),{registerOnInstance:f}=p({tableName:n});return t.queryFields(a=>({[`findMany${D(n.toString())}`]:a.drizzleField({type:[n],nullable:false,smartSubscription:true,subscribe:(c,m,b,C,x)=>{f({instance:c,action:"created"}),f({instance:c,action:"removed"});},args:{where:a.arg({type:s,required:false})},resolve:(c,m,b,C,x)=>{let u=C.abilities[n].filter(i,{inject:{where:o(b.where)}}).many,h=c(u);return u.columns&&(h.columns=u.columns),e.query[n].findMany(h)}}),[`findFirst${D(n.toString())}`]:a.drizzleField({type:n,nullable:false,smartSubscription:true,args:{where:a.arg({type:s,required:false})},resolve:(c,m,b,C,x)=>{let u=C.abilities[n].filter(d,{inject:{where:o(b.where)}}).single,h=c(u);return u.columns&&(h.columns=u.columns),e.query[n].findFirst(h).then(z)}})}))};var ee="ManualFiltersPlugin",te=ee,Te="applyFilters",O=class extends BasePlugin{wrapResolve(t,l){return async(p,n,d,i)=>{let y=(l?.type).type?.ref.currentConfig.pothosOptions[Te];if(!y||!Array.isArray(y)||y.length===0)return t(p,n,d,i);let r=await t(p,n,d,i),s=Array.isArray(r)?r:[r],o=Array.isArray(y)?y:[y],f=await X({filters:o,entities:s,context:d});return Array.isArray(r)?f:f[0]??null}}};be.registerPlugin(ee,O);var ne=({db:e,disableDefaultObjects:t,pubsub:l,pothosConfig:p})=>{let n=new be({plugins:[te,Se,Re,...p?.plugins??[]],...p,drizzle:{client:e},smartSubscriptions:{...subscribeOptionsFromIterator((d,i)=>l.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 Ne=e=>`${D(toCamelCase(e.toString()))}WhereInputArgument`,re=({db:e,schemaBuilder:t,enumImplementer:l})=>{let p=new Map,n=({tableName:d,name:i,nativeTableName:y})=>{let r=e._.schema[d];if(y){let a=Object.values(e._.schema).find(c=>c.dbName===y);a&&(r=a);}if(!r)throw new R(`Could not find schema for ${d.toString()} (whereArg)`);let s=i??Ne(r.dbName),o=p.get(s);return o||(o={inputType:t.inputType(s,{fields:m=>{let b=u=>{let h=F(u);switch(h){case "Int":return m.int({required:false});case "String":return m.string({required:false});case "Boolean":return m.boolean({required:false});case "Date":return m.field({type:"Date",required:false});case "DateTime":return m.field({type:"DateTime",required:false});case "Float":return m.float({required:false});case "ID":return m.id({required:false});case "JSON":return m.field({type:"JSON",required:false});default:throw new R(`Unsupported argument type ${h} for column ${u}`)}},C=Object.entries(r.columns).reduce((u,[h,g])=>{if(N(g)){let S=v(g),P=l({enumName:S.enumName});u[h]=m.field({type:P,required:false});}else u[h]=b(g.getSQLType());return u},{}),x=Object.entries(r.relations).reduce((u,[h,g])=>{let S=n({tableName:g.referencedTableName,nativeTableName:g.referencedTableName});return u[h]=m.field({type:S.inputType,required:false}),u},{});return {...C,...x}}}),transformArgumentToQueryCondition:m=>{if(!m)return;let b=u=>{let h=r.columns[u],g=m[u];if(g)return eq(h,g)},C=u=>{let h=r.relations[u],g=m[u];if(!g)return;let S=n({tableName:h.referencedTableName,nativeTableName:h.referencedTableName}).transformArgumentToQueryCondition;return S(g)},x=[...Object.keys(r.columns).map(b),...Object.keys(r.relations).map(C)];return and(...x)}},p.set(s,o),o)};return n};var Ue=e=>{e.actions||(e.actions=["read","update","delete"]),e.defaultLimit===void 0&&(e.defaultLimit=100);let t=$(e),l=M({...e,abilityBuilder:t}),{makePubSubInstance:p,pubsub:n}=Y({...e}),{schemaBuilder:d}=ne({...e,pubsub:n}),i=W({...e,schemaBuilder:d}),y=re({...e,schemaBuilder:d,enumImplementer:i}),r=H({...e,schemaBuilder:d,makePubSubInstance:p,argImplementer:y,enumImplementer:i,abilityBuilder:t}),s=Z({...e,schemaBuilder:d,argImplementer:y,makePubSubInstance:p});return {abilityBuilder:t,schemaBuilder:d,createYoga:f=>createYoga({...f,schema:d.toSchema(),context:l}),object:r,arg:y,query:s,pubsub:p,enum_:i}};
8
+ export{R as RumbleError,A as RumbleErrorSafe,z as assertFindFirstExists,ge as assertFirstEntryExists,Ue as rumble};//# sourceMappingURL=index.js.map
9
9
  //# sourceMappingURL=index.js.map