@m1212e/rumble 0.10.5 → 0.10.9

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.cts CHANGED
@@ -165,16 +165,18 @@ declare const assertFirstEntryExists: <T>(value: T[]) => T;
165
165
  */
166
166
  declare function mapNullFieldsToUndefined<T extends object>(obj: T): { [K in keyof T]: T[K] extends null ? undefined : Exclude<T[K], null>; };
167
167
 
168
- type QueryFilterObject = Partial<{
169
- where: any;
170
- columns: any;
171
- limit: any;
172
- }>;
173
168
  type GenericDrizzleDbTypeConstraints = {
174
169
  query: {
175
170
  [key: string]: {
176
- findMany: (P: QueryFilterObject) => any;
177
- findFirst: (P: QueryFilterObject) => any;
171
+ findMany: (P: Partial<{
172
+ where: any;
173
+ columns: any;
174
+ limit: any;
175
+ }>) => any;
176
+ findFirst: (P: Partial<{
177
+ where: any;
178
+ columns: any;
179
+ }>) => any;
178
180
  };
179
181
  };
180
182
  } & DrizzleClient;
@@ -314,22 +316,15 @@ declare const rumble: <UserContext extends Record<string, any>, DB extends Gener
314
316
  by: (explicitFilter: Filter<UserContext, NonNullable<Awaited<ReturnType<DB["query"][key]["findFirst"]>>>>) => void;
315
317
  };
316
318
  }; } : never) & {
317
- registeredQueryFilters: keyof DB["query"] extends infer T_1 extends keyof DB["query"] ? { [key_1 in T_1]: { [key_2 in Action]: any[] | "unspecified"; }; } : never;
318
- 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;
319
- buildWithUserContext: (userContext: UserContext) => keyof DB["query"] extends infer T_3 extends keyof DB["query"] ? { [key_5 in T_3]: {
319
+ z_registeredQueryFilters: keyof DB["query"] extends infer T_1 extends keyof DB["query"] ? { [key_1 in T_1]: { [key_2 in Action]: any[] | "unspecified"; }; } : never;
320
+ z_registeredFilters: keyof DB["query"] extends infer T_2 extends keyof DB["query"] ? { [key_3 in T_2]: { [key_4 in Action]: Filter<UserContext, any>[]; }; } : never;
321
+ z_buildWithUserContext: (userContext: UserContext) => keyof DB["query"] extends infer T_3 extends keyof DB["query"] ? { [key_5 in T_3]: {
320
322
  filter: <Injection extends Parameters<DB["query"][key_5]["findMany"]>[0]>(action: Action, options?: {
321
323
  inject?: Injection | undefined;
322
324
  } | undefined) => {
323
325
  query: {
324
- single: {
325
- readonly where: any;
326
- columns: undefined;
327
- };
328
- many: {
329
- readonly where: any;
330
- columns: undefined;
331
- readonly limit: any;
332
- };
326
+ single: Pick<NonNullable<NonNullable<Parameters<DB["query"][key_5]["findFirst"]>[0]>>, "columns" | "where">;
327
+ many: Pick<NonNullable<NonNullable<Parameters<DB["query"][key_5]["findMany"]>[0]>>, "columns" | "where" | "limit">;
333
328
  };
334
329
  sql: {
335
330
  readonly where: drizzle_orm.SQL<unknown> | undefined;
@@ -350,15 +345,8 @@ declare const rumble: <UserContext extends Record<string, any>, DB extends Gener
350
345
  inject?: Injection | undefined;
351
346
  } | undefined) => {
352
347
  query: {
353
- single: {
354
- readonly where: any;
355
- columns: undefined;
356
- };
357
- many: {
358
- readonly where: any;
359
- columns: undefined;
360
- readonly limit: any;
361
- };
348
+ single: Pick<NonNullable<NonNullable<Parameters<DB["query"][key_5]["findFirst"]>[0]>>, "columns" | "where">;
349
+ many: Pick<NonNullable<NonNullable<Parameters<DB["query"][key_5]["findMany"]>[0]>>, "columns" | "where" | "limit">;
362
350
  };
363
351
  sql: {
364
352
  readonly where: drizzle_orm.SQL<unknown> | undefined;
@@ -407,6 +395,12 @@ declare const rumble: <UserContext extends Record<string, any>, DB extends Gener
407
395
  * https://the-guild.dev/graphql/yoga-server/docs#server
408
396
  */
409
397
  createYoga: (args?: (Omit<YogaServerOptions<RequestEvent, any>, "schema" | "context"> & {
398
+ /**
399
+ * Determines if the API should disclose various things about its structure.
400
+ * Defaults to `process.env.NODE_ENV === "development"`.
401
+ * If enabled, the api will allow introspection requests, provide the graphiql
402
+ * explorer and will not apply the additional envelop armor plugin.
403
+ */
410
404
  enableApiDocs?: boolean;
411
405
  }) | undefined) => graphql_yoga.YogaServerInstance<RequestEvent, {}>;
412
406
  /**
@@ -438,15 +432,8 @@ declare const rumble: <UserContext extends Record<string, any>, DB extends Gener
438
432
  inject?: Injection | undefined;
439
433
  } | undefined) => {
440
434
  query: {
441
- single: {
442
- readonly where: any;
443
- columns: undefined;
444
- };
445
- many: {
446
- readonly where: any;
447
- columns: undefined;
448
- readonly limit: any;
449
- };
435
+ single: Pick<NonNullable<NonNullable<Parameters<DB["query"][key_5]["findFirst"]>[0]>>, "columns" | "where">;
436
+ many: Pick<NonNullable<NonNullable<Parameters<DB["query"][key_5]["findMany"]>[0]>>, "columns" | "where" | "limit">;
450
437
  };
451
438
  sql: {
452
439
  readonly where: drizzle_orm.SQL<unknown> | undefined;
@@ -518,15 +505,8 @@ declare const rumble: <UserContext extends Record<string, any>, DB extends Gener
518
505
  inject?: Injection | undefined;
519
506
  } | undefined) => {
520
507
  query: {
521
- single: {
522
- readonly where: any;
523
- columns: undefined;
524
- };
525
- many: {
526
- readonly where: any;
527
- columns: undefined;
528
- readonly limit: any;
529
- };
508
+ single: Pick<NonNullable<NonNullable<Parameters<DB["query"][key_5]["findFirst"]>[0]>>, "columns" | "where">;
509
+ many: Pick<NonNullable<NonNullable<Parameters<DB["query"][key_5]["findMany"]>[0]>>, "columns" | "where" | "limit">;
530
510
  };
531
511
  sql: {
532
512
  readonly where: drizzle_orm.SQL<unknown> | undefined;
@@ -577,15 +557,8 @@ declare const rumble: <UserContext extends Record<string, any>, DB extends Gener
577
557
  inject?: Injection | undefined;
578
558
  } | undefined) => {
579
559
  query: {
580
- single: {
581
- readonly where: any;
582
- columns: undefined;
583
- };
584
- many: {
585
- readonly where: any;
586
- columns: undefined;
587
- readonly limit: any;
588
- };
560
+ single: Pick<NonNullable<NonNullable<Parameters<DB["query"][key_5]["findFirst"]>[0]>>, "columns" | "where">;
561
+ many: Pick<NonNullable<NonNullable<Parameters<DB["query"][key_5]["findMany"]>[0]>>, "columns" | "where" | "limit">;
589
562
  };
590
563
  sql: {
591
564
  readonly where: drizzle_orm.SQL<unknown> | undefined;
@@ -638,15 +611,8 @@ declare const rumble: <UserContext extends Record<string, any>, DB extends Gener
638
611
  inject?: Injection | undefined;
639
612
  } | undefined) => {
640
613
  query: {
641
- single: {
642
- readonly where: any;
643
- columns: undefined;
644
- };
645
- many: {
646
- readonly where: any;
647
- columns: undefined;
648
- readonly limit: any;
649
- };
614
+ single: Pick<NonNullable<NonNullable<Parameters<DB["query"][key_5]["findFirst"]>[0]>>, "columns" | "where">;
615
+ many: Pick<NonNullable<NonNullable<Parameters<DB["query"][key_5]["findMany"]>[0]>>, "columns" | "where" | "limit">;
650
616
  };
651
617
  sql: {
652
618
  readonly where: drizzle_orm.SQL<unknown> | undefined;
@@ -727,15 +693,8 @@ declare const rumble: <UserContext extends Record<string, any>, DB extends Gener
727
693
  inject?: Injection | undefined;
728
694
  } | undefined) => {
729
695
  query: {
730
- single: {
731
- readonly where: any;
732
- columns: undefined;
733
- };
734
- many: {
735
- readonly where: any;
736
- columns: undefined;
737
- readonly limit: any;
738
- };
696
+ single: Pick<NonNullable<NonNullable<Parameters<DB["query"][key_5]["findFirst"]>[0]>>, "columns" | "where">;
697
+ many: Pick<NonNullable<NonNullable<Parameters<DB["query"][key_5]["findMany"]>[0]>>, "columns" | "where" | "limit">;
739
698
  };
740
699
  sql: {
741
700
  readonly where: drizzle_orm.SQL<unknown> | undefined;
package/index.d.ts CHANGED
@@ -165,16 +165,18 @@ declare const assertFirstEntryExists: <T>(value: T[]) => T;
165
165
  */
166
166
  declare function mapNullFieldsToUndefined<T extends object>(obj: T): { [K in keyof T]: T[K] extends null ? undefined : Exclude<T[K], null>; };
167
167
 
168
- type QueryFilterObject = Partial<{
169
- where: any;
170
- columns: any;
171
- limit: any;
172
- }>;
173
168
  type GenericDrizzleDbTypeConstraints = {
174
169
  query: {
175
170
  [key: string]: {
176
- findMany: (P: QueryFilterObject) => any;
177
- findFirst: (P: QueryFilterObject) => any;
171
+ findMany: (P: Partial<{
172
+ where: any;
173
+ columns: any;
174
+ limit: any;
175
+ }>) => any;
176
+ findFirst: (P: Partial<{
177
+ where: any;
178
+ columns: any;
179
+ }>) => any;
178
180
  };
179
181
  };
180
182
  } & DrizzleClient;
@@ -314,22 +316,15 @@ declare const rumble: <UserContext extends Record<string, any>, DB extends Gener
314
316
  by: (explicitFilter: Filter<UserContext, NonNullable<Awaited<ReturnType<DB["query"][key]["findFirst"]>>>>) => void;
315
317
  };
316
318
  }; } : never) & {
317
- registeredQueryFilters: keyof DB["query"] extends infer T_1 extends keyof DB["query"] ? { [key_1 in T_1]: { [key_2 in Action]: any[] | "unspecified"; }; } : never;
318
- 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;
319
- buildWithUserContext: (userContext: UserContext) => keyof DB["query"] extends infer T_3 extends keyof DB["query"] ? { [key_5 in T_3]: {
319
+ z_registeredQueryFilters: keyof DB["query"] extends infer T_1 extends keyof DB["query"] ? { [key_1 in T_1]: { [key_2 in Action]: any[] | "unspecified"; }; } : never;
320
+ z_registeredFilters: keyof DB["query"] extends infer T_2 extends keyof DB["query"] ? { [key_3 in T_2]: { [key_4 in Action]: Filter<UserContext, any>[]; }; } : never;
321
+ z_buildWithUserContext: (userContext: UserContext) => keyof DB["query"] extends infer T_3 extends keyof DB["query"] ? { [key_5 in T_3]: {
320
322
  filter: <Injection extends Parameters<DB["query"][key_5]["findMany"]>[0]>(action: Action, options?: {
321
323
  inject?: Injection | undefined;
322
324
  } | undefined) => {
323
325
  query: {
324
- single: {
325
- readonly where: any;
326
- columns: undefined;
327
- };
328
- many: {
329
- readonly where: any;
330
- columns: undefined;
331
- readonly limit: any;
332
- };
326
+ single: Pick<NonNullable<NonNullable<Parameters<DB["query"][key_5]["findFirst"]>[0]>>, "columns" | "where">;
327
+ many: Pick<NonNullable<NonNullable<Parameters<DB["query"][key_5]["findMany"]>[0]>>, "columns" | "where" | "limit">;
333
328
  };
334
329
  sql: {
335
330
  readonly where: drizzle_orm.SQL<unknown> | undefined;
@@ -350,15 +345,8 @@ declare const rumble: <UserContext extends Record<string, any>, DB extends Gener
350
345
  inject?: Injection | undefined;
351
346
  } | undefined) => {
352
347
  query: {
353
- single: {
354
- readonly where: any;
355
- columns: undefined;
356
- };
357
- many: {
358
- readonly where: any;
359
- columns: undefined;
360
- readonly limit: any;
361
- };
348
+ single: Pick<NonNullable<NonNullable<Parameters<DB["query"][key_5]["findFirst"]>[0]>>, "columns" | "where">;
349
+ many: Pick<NonNullable<NonNullable<Parameters<DB["query"][key_5]["findMany"]>[0]>>, "columns" | "where" | "limit">;
362
350
  };
363
351
  sql: {
364
352
  readonly where: drizzle_orm.SQL<unknown> | undefined;
@@ -407,6 +395,12 @@ declare const rumble: <UserContext extends Record<string, any>, DB extends Gener
407
395
  * https://the-guild.dev/graphql/yoga-server/docs#server
408
396
  */
409
397
  createYoga: (args?: (Omit<YogaServerOptions<RequestEvent, any>, "schema" | "context"> & {
398
+ /**
399
+ * Determines if the API should disclose various things about its structure.
400
+ * Defaults to `process.env.NODE_ENV === "development"`.
401
+ * If enabled, the api will allow introspection requests, provide the graphiql
402
+ * explorer and will not apply the additional envelop armor plugin.
403
+ */
410
404
  enableApiDocs?: boolean;
411
405
  }) | undefined) => graphql_yoga.YogaServerInstance<RequestEvent, {}>;
412
406
  /**
@@ -438,15 +432,8 @@ declare const rumble: <UserContext extends Record<string, any>, DB extends Gener
438
432
  inject?: Injection | undefined;
439
433
  } | undefined) => {
440
434
  query: {
441
- single: {
442
- readonly where: any;
443
- columns: undefined;
444
- };
445
- many: {
446
- readonly where: any;
447
- columns: undefined;
448
- readonly limit: any;
449
- };
435
+ single: Pick<NonNullable<NonNullable<Parameters<DB["query"][key_5]["findFirst"]>[0]>>, "columns" | "where">;
436
+ many: Pick<NonNullable<NonNullable<Parameters<DB["query"][key_5]["findMany"]>[0]>>, "columns" | "where" | "limit">;
450
437
  };
451
438
  sql: {
452
439
  readonly where: drizzle_orm.SQL<unknown> | undefined;
@@ -518,15 +505,8 @@ declare const rumble: <UserContext extends Record<string, any>, DB extends Gener
518
505
  inject?: Injection | undefined;
519
506
  } | undefined) => {
520
507
  query: {
521
- single: {
522
- readonly where: any;
523
- columns: undefined;
524
- };
525
- many: {
526
- readonly where: any;
527
- columns: undefined;
528
- readonly limit: any;
529
- };
508
+ single: Pick<NonNullable<NonNullable<Parameters<DB["query"][key_5]["findFirst"]>[0]>>, "columns" | "where">;
509
+ many: Pick<NonNullable<NonNullable<Parameters<DB["query"][key_5]["findMany"]>[0]>>, "columns" | "where" | "limit">;
530
510
  };
531
511
  sql: {
532
512
  readonly where: drizzle_orm.SQL<unknown> | undefined;
@@ -577,15 +557,8 @@ declare const rumble: <UserContext extends Record<string, any>, DB extends Gener
577
557
  inject?: Injection | undefined;
578
558
  } | undefined) => {
579
559
  query: {
580
- single: {
581
- readonly where: any;
582
- columns: undefined;
583
- };
584
- many: {
585
- readonly where: any;
586
- columns: undefined;
587
- readonly limit: any;
588
- };
560
+ single: Pick<NonNullable<NonNullable<Parameters<DB["query"][key_5]["findFirst"]>[0]>>, "columns" | "where">;
561
+ many: Pick<NonNullable<NonNullable<Parameters<DB["query"][key_5]["findMany"]>[0]>>, "columns" | "where" | "limit">;
589
562
  };
590
563
  sql: {
591
564
  readonly where: drizzle_orm.SQL<unknown> | undefined;
@@ -638,15 +611,8 @@ declare const rumble: <UserContext extends Record<string, any>, DB extends Gener
638
611
  inject?: Injection | undefined;
639
612
  } | undefined) => {
640
613
  query: {
641
- single: {
642
- readonly where: any;
643
- columns: undefined;
644
- };
645
- many: {
646
- readonly where: any;
647
- columns: undefined;
648
- readonly limit: any;
649
- };
614
+ single: Pick<NonNullable<NonNullable<Parameters<DB["query"][key_5]["findFirst"]>[0]>>, "columns" | "where">;
615
+ many: Pick<NonNullable<NonNullable<Parameters<DB["query"][key_5]["findMany"]>[0]>>, "columns" | "where" | "limit">;
650
616
  };
651
617
  sql: {
652
618
  readonly where: drizzle_orm.SQL<unknown> | undefined;
@@ -727,15 +693,8 @@ declare const rumble: <UserContext extends Record<string, any>, DB extends Gener
727
693
  inject?: Injection | undefined;
728
694
  } | undefined) => {
729
695
  query: {
730
- single: {
731
- readonly where: any;
732
- columns: undefined;
733
- };
734
- many: {
735
- readonly where: any;
736
- columns: undefined;
737
- readonly limit: any;
738
- };
696
+ single: Pick<NonNullable<NonNullable<Parameters<DB["query"][key_5]["findFirst"]>[0]>>, "columns" | "where">;
697
+ many: Pick<NonNullable<NonNullable<Parameters<DB["query"][key_5]["findMany"]>[0]>>, "columns" | "where" | "limit">;
739
698
  };
740
699
  sql: {
741
700
  readonly where: drizzle_orm.SQL<unknown> | undefined;
package/index.js CHANGED
@@ -1,9 +1,9 @@
1
- import {EnvelopArmorPlugin}from'@escape.tech/graphql-armor';import {useDisableIntrospection}from'@graphql-yoga/plugin-disable-introspection';import {merge,capitalize}from'es-toolkit';import {createYoga,createPubSub}from'graphql-yoga';import {useSofa}from'sofa-api';import {One,relationsFilterToSQL}from'drizzle-orm';import {toCamelCase}from'drizzle-orm/casing';import {PgEnumColumn}from'drizzle-orm/pg-core';import {singular,plural}from'pluralize';import je,{BasePlugin}from'@pothos/core';import Me from'@pothos/plugin-drizzle';import $e,{subscribeOptionsFromIterator}from'@pothos/plugin-smart-subscriptions';import {JSONResolver,DateResolver,DateTimeISOResolver}from'graphql-scalars';function $(t){return typeof t=="object"&&t!==null}function J(t,n){throw new Error("Unexpected invariant triggered.")}var be=/\r\n|[\n\r]/g;function L(t,n){let r=0,p=1;for(let i of t.body.matchAll(be)){if(typeof i.index=="number"||J(),i.index>=n)break;r=i.index+i[0].length,p+=1;}return {line:p,column:n+1-r}}function Y(t){return K(t.source,L(t.source,t.start))}function K(t,n){let r=t.locationOffset.column-1,p="".padStart(r)+t.body,i=n.line-1,e=t.locationOffset.line-1,y=n.line+e,l=n.line===1?r:0,u=n.column+l,m=`${t.name}:${y}:${u}
2
- `,a=p.split(/\r\n|[\n\r]/g),f=a[i];if(f.length>120){let s=Math.floor(u/80),h=u%80,o=[];for(let b=0;b<f.length;b+=80)o.push(f.slice(b,b+80));return m+H([[`${y} |`,o[0]],...o.slice(1,s+1).map(b=>["|",b]),["|","^".padStart(h)],["|",o[s+1]]])}return m+H([[`${y-1} |`,a[i-1]],[`${y} |`,f],["|","^".padStart(u)],[`${y+1} |`,a[i+1]]])}function H(t){let n=t.filter(([p,i])=>i!==void 0),r=Math.max(...n.map(([p])=>p.length));return n.map(([p,i])=>p.padStart(r)+(i?" "+i:"")).join(`
3
- `)}function he(t){let n=t[0];return n==null||"kind"in n||"length"in n?{nodes:n,source:t[1],positions:t[2],path:t[3],originalError:t[4],extensions:t[5]}:n}var q=class t extends Error{constructor(n,...r){var p,i,e;let{nodes:y,source:l,positions:u,path:m,originalError:a,extensions:f}=he(r);super(n),this.name="GraphQLError",this.path=m??void 0,this.originalError=a??void 0,this.nodes=X(Array.isArray(y)?y:y?[y]:void 0);let s=X((p=this.nodes)===null||p===void 0?void 0:p.map(o=>o.loc).filter(o=>o!=null));this.source=l??(s==null||(i=s[0])===null||i===void 0?void 0:i.source),this.positions=u??s?.map(o=>o.start),this.locations=u&&l?u.map(o=>L(l,o)):s?.map(o=>L(o.source,o.start));let h=$(a?.extensions)?a?.extensions:void 0;this.extensions=(e=f??h)!==null&&e!==void 0?e: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}}),a!=null&&a.stack?Object.defineProperty(this,"stack",{value:a.stack,writable:true,configurable:true}):Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:Error().stack,writable:true,configurable:true});}get[Symbol.toStringTag](){return "GraphQLError"}toString(){let n=this.message;if(this.nodes)for(let r of this.nodes)r.loc&&(n+=`
1
+ import {EnvelopArmorPlugin}from'@escape.tech/graphql-armor';import {useDisableIntrospection}from'@graphql-yoga/plugin-disable-introspection';import {merge,capitalize}from'es-toolkit';import {createYoga,createPubSub}from'graphql-yoga';import {useSofa}from'sofa-api';import {One,relationsFilterToSQL}from'drizzle-orm';import {toCamelCase}from'drizzle-orm/casing';import {PgEnumColumn}from'drizzle-orm/pg-core';import {singular,plural}from'pluralize';import je,{BasePlugin}from'@pothos/core';import Me from'@pothos/plugin-drizzle';import $e,{subscribeOptionsFromIterator}from'@pothos/plugin-smart-subscriptions';import {JSONResolver,DateResolver,DateTimeISOResolver}from'graphql-scalars';function $(t){return typeof t=="object"&&t!==null}function J(t,n){throw new Error("Unexpected invariant triggered.")}var be=/\r\n|[\n\r]/g;function L(t,n){let r=0,p=1;for(let i of t.body.matchAll(be)){if(typeof i.index=="number"||J(),i.index>=n)break;r=i.index+i[0].length,p+=1;}return {line:p,column:n+1-r}}function Y(t){return _(t.source,L(t.source,t.start))}function _(t,n){let r=t.locationOffset.column-1,p="".padStart(r)+t.body,i=n.line-1,e=t.locationOffset.line-1,y=n.line+e,l=n.line===1?r:0,u=n.column+l,m=`${t.name}:${y}:${u}
2
+ `,a=p.split(/\r\n|[\n\r]/g),g=a[i];if(g.length>120){let s=Math.floor(u/80),h=u%80,o=[];for(let b=0;b<g.length;b+=80)o.push(g.slice(b,b+80));return m+H([[`${y} |`,o[0]],...o.slice(1,s+1).map(b=>["|",b]),["|","^".padStart(h)],["|",o[s+1]]])}return m+H([[`${y-1} |`,a[i-1]],[`${y} |`,g],["|","^".padStart(u)],[`${y+1} |`,a[i+1]]])}function H(t){let n=t.filter(([p,i])=>i!==void 0),r=Math.max(...n.map(([p])=>p.length));return n.map(([p,i])=>p.padStart(r)+(i?" "+i:"")).join(`
3
+ `)}function he(t){let n=t[0];return n==null||"kind"in n||"length"in n?{nodes:n,source:t[1],positions:t[2],path:t[3],originalError:t[4],extensions:t[5]}:n}var q=class t extends Error{constructor(n,...r){var p,i,e;let{nodes:y,source:l,positions:u,path:m,originalError:a,extensions:g}=he(r);super(n),this.name="GraphQLError",this.path=m??void 0,this.originalError=a??void 0,this.nodes=X(Array.isArray(y)?y:y?[y]:void 0);let s=X((p=this.nodes)===null||p===void 0?void 0:p.map(o=>o.loc).filter(o=>o!=null));this.source=l??(s==null||(i=s[0])===null||i===void 0?void 0:i.source),this.positions=u??s?.map(o=>o.start),this.locations=u&&l?u.map(o=>L(l,o)):s?.map(o=>L(o.source,o.start));let h=$(a?.extensions)?a?.extensions:void 0;this.extensions=(e=g??h)!==null&&e!==void 0?e: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}}),a!=null&&a.stack?Object.defineProperty(this,"stack",{value:a.stack,writable:true,configurable:true}):Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:Error().stack,writable:true,configurable:true});}get[Symbol.toStringTag](){return "GraphQLError"}toString(){let n=this.message;if(this.nodes)for(let r of this.nodes)r.loc&&(n+=`
4
4
 
5
5
  `+Y(r.loc));else if(this.source&&this.locations)for(let r of this.locations)n+=`
6
6
 
7
- `+K(this.source,r);return n}toJSON(){let n={message:this.message};return this.locations!=null&&(n.locations=this.locations),this.path!=null&&(n.path=this.path),this.extensions!=null&&Object.keys(this.extensions).length>0&&(n.extensions=this.extensions),n}};function X(t){return t===void 0||t.length===0?void 0:t}var A=class extends Error{constructor(n){super(n),this.name="RumbleError";}},k=class extends q{};var _=t=>{if(!t)throw new k("Value not found but required (findFirst)");return t},Ce=t=>{let n=t.at(0);if(!n)throw new k("Value not found but required (firstEntry)");return n},Z=async({filters:t,entities:n,context:r})=>(await Promise.all(t.map(p=>p({context:r,entities:n})))).reduce((p,i)=>(p.push(...i),p),[]);function De(t){return Object.fromEntries(Object.entries(t).map(([n,r])=>[n,r===null?void 0:r]))}function v(t){let n,r=false;return ()=>(r||(n=t(),r=true),n)}var j=(t,n)=>new A(`RumbleError: Unknown SQL type '${t}'. Please open an issue (https://github.com/m1212e/rumble/issues) so it can be added. (${n})`);function ee(t){if(["serial","int","integer","tinyint","smallint","mediumint"].includes(t))return {value1:1,value2:2};if(["real","decimal","double","float"].includes(t))return {value1:1.1,value2:2.2};if(["string","text","varchar","char","text(256)"].includes(t))return {value1:"a",value2:"b"};if(["uuid"].includes(t))return {value1:"fba31870-5528-42d7-b27e-2e5ee657aea5",value2:"fc65db81-c2d1-483d-8a25-a30e2cf6e02d"};if(["boolean"].includes(t))return {value1:true,value2:false};if(["timestamp","datetime"].includes(t))return {value1:new Date(2022,1,1),value2:new Date(2022,1,2)};if(["date"].includes(t))return {value1:new Date(2022,1,1),value2:new Date(2022,1,2)};if(["json"].includes(t))return {value1:{a:1},value2:{b:2}};throw j(t,"Distinct")}var V=Symbol.for("drizzle:Name"),te=Symbol.for("drizzle:Columns");function B({dbName:t,tsName:n,table:r,db:p}){let i=r;if(n&&(i=p._.relations.schema[n]),t&&(i=Object.values(p._.relations.schema).find(e=>e[V]===t)),!i)throw new A(`Could not find schema for ${JSON.stringify({tsName:n,dbName:t,table:r?.[V]}).toString()}`);return {tableSchema:i,columns:i[te],get primaryColumns(){return Object.entries(i[te]).filter(([e,y])=>y.primary).reduce((e,[y,l])=>(e[y]=l,e),{})},relations:p._.relations.config[n],dbName:i[V],get tsName(){return Object.entries(p._.relations.schema).find(([e,y])=>y===i).at(0)}}}function Se(t){return typeof t!="function"}function Ae(t){return typeof t=="function"&&t.constructor.name!=="AsyncFunction"}var ne=({db:t,actions:n,defaultLimit:r})=>{let p={},i={},e={},y=l=>{for(let u of n)e[l]||(e[l]={}),e[l][u]||(e[l][u]=[]);return {allow:u=>{let m=i[l];m||(m={},i[l]=m);let a=Array.isArray(u)?u:[u];for(let f of a){let s=m[f];s||(s="unspecified",m[f]=s);}return {when:f=>{for(let s of a)m[s]==="unspecified"&&(m[s]=[]),m[s].push(f);}}},filter:u=>{let m=Array.isArray(u)?u:[u];return {by:a=>{for(let f of m)e[l][f].push(a);}}}}};for(let l of Object.keys(t.query))p[l]=y(l);return {...p,registeredQueryFilters:i,registeredFilters:e,buildWithUserContext:l=>{let u={},m=a=>({filter:(f,s)=>{let h=c=>{let R=v(()=>{if(!(!c?.where&&!s?.inject?.where)){if(s?.inject?.where&&c?.where)return {AND:[c?.where,s?.inject?.where]};if(s?.inject?.where&&!c?.where)return s?.inject?.where;if(!s?.inject?.where&&c?.where)return c?.where;!s?.inject?.where&&c?.where;}}),P=v(()=>{let N=R();if(!N)return;let U=B({tsName:a,db:t});return relationsFilterToSQL(U.tableSchema,N)}),w=v(()=>{let N=c?.limit??r;return s?.inject?.limit&&(!N||N>s.inject.limit)&&(N=s.inject.limit),c?.limit&&(!N||c.limit>N)&&(N=c.limit),N??void 0}),F=v(()=>{if(!(!c?.columns&&!s?.inject?.columns))return {...c?.columns,...s?.inject?.columns}}),z={query:{single:{get where(){return R()},columns:F()},many:{get where(){return R()},columns:F(),get limit(){return w()}}},sql:{get where(){return P()},columns:F(),get limit(){return w()}}};return F()||(delete z.sql.columns,delete z.query.many.columns,delete z.query.single.columns),z},o=()=>{let c=B({db:t,tsName:a});if(Object.keys(c.primaryColumns).length===0)throw new A(`No primary key found for entity ${a.toString()}`);let R=Object.values(c.primaryColumns)[0],P=ee(R.getSQLType());return {where:{AND:[{[R.name]:P.value1},{[R.name]:P.value2}]}}},b=i?.[a]?.[f];if(b==="unspecified")return h();b||(b=[o()]);let d=b.filter(Se),T=b.filter(Ae).map(c=>c(l)),C=T.some(c=>c==="allow"),D=[...d,...T].filter(c=>c!==void 0).filter(c=>c!=="allow");!C&&D.length===0&&(D=[o()]);let I;for(let c of D)c?.limit&&(I===void 0||c.limit>I)&&(I=c.limit);let S;for(let c of [...D,s?.inject])c?.columns&&(S===void 0?S=c.columns:S={...S,...c.columns});let g=C?[]:D.filter(c=>c?.where).map(c=>c.where),x=g.length>0?{OR:g}:void 0;return h({where:x,columns:S,limit:I})},explicitFilters:f=>e[a][f]});for(let a of Object.keys(t.query))u[a]=m(a);return u}}};var re=({context:t,abilityBuilder:n})=>async r=>{let p=t?await t(r):{};return {...p,abilities:n.buildWithUserContext(p)}};function G(t){return t instanceof PgEnumColumn}var ie=({db:t,schemaBuilder:n})=>{let r=new Map;return ({tsName:i,enumColumn:e,refName:y})=>{let l,u;if(i){let s=t._.relations.schema[i];l=i.toString();let h=Object.values(t._.relations.schema).filter(o=>typeof o=="object").map(o=>Object.values(o[Symbol.for("drizzle:Columns")])).flat(2).find(o=>o.config?.enum===s);if(!h)throw new A(`Could not find applied enum column for ${i.toString()}.
8
- Please ensure that you use the enum at least once as a column of a table!`);u=h.enumValues;}else if(e){let s=Object.entries(t._.relations.schema).find(([h,o])=>o===e.config.enum);if(!s)throw new A(`Could not find enum in schema for ${e.name}!`);l=s[0],u=e.enumValues;}if(!l||!u)throw new A("Could not determine enum structure!");let m=y??`${capitalize(toCamelCase(l))}Enum`,a=r.get(m);return a||(a=n.enumType(m,{values:u}),r.set(m,a),a)}};var oe={paths:{"/webhook":{post:{operationId:"webhook_create",description:"Creates a webhook subscription.",tags:[],parameters:[],requestBody:{content:{"application/json":{schema:{$ref:"#/components/schemas/WebhookCreateBody"}}}},responses:{200:{content:{"application/json":{schema:{$ref:"#/components/schemas/WebhookDetailResponse"}}}}}}},"/webhook/{id}":{post:{operationId:"webhook_update",description:"Updates a webhook subscription.",parameters:[{name:"id",in:"path",description:"The ID of the webhook to update",required:true,schema:{type:"string"}}],requestBody:{content:{"application/json":{schema:{$ref:"#/components/schemas/WebhookCreateBody"}}}},responses:{200:{content:{"application/json":{schema:{$ref:"#/components/schemas/WebhookDetailResponse"}}}}}},delete:{operationId:"webhook_delete",description:"Removes a webhook subscription.",tags:[],parameters:[{name:"id",in:"path",description:"The ID of the webhook to delete",required:true,schema:{type:"string"}}],responses:{200:{content:{"application/json":{schema:{$ref:"#/components/schemas/WebhookDetailResponse"}}}}}}}},components:{schemas:{WebhookCreateBody:{type:"object",properties:{subscription:{description:"The subscription to subscribe to. In many cases, these match the available query IDs without the '_query' suffix. E.g., 'findFirstUser_query' -> 'findFirstUser'. See the graphql schema for more details on what subscriptions are available.",type:"string"},variables:{description:"The variables to pass to the subscription.",type:"object"},url:{description:"The URL to send the webhook to.",type:"string"}}},WebhookDetailResponse:{type:"object",properties:{id:{description:"The ID of the webhook. Can be used as reference in update or delete calls.",type:"string"}}}}}};function W({sqlType:t,fieldName:n}){let r;if(["serial","int","integer","tinyint","smallint","mediumint"].includes(t)&&(r="Int"),["real","decimal","double","float"].includes(t)&&(r="Float"),["string","text","varchar","char","text(256)"].includes(t)&&(n&&(n.toLowerCase().endsWith("_id")||n.toLowerCase().endsWith("id"))?r="ID":r="String"),["uuid"].includes(t)&&(r="ID"),["boolean"].includes(t)&&(r="Boolean"),["timestamp","datetime"].includes(t)&&(r="DateTime"),["date"].includes(t)&&(r="Date"),["json"].includes(t)&&(r="JSON"),r!==void 0)return r;throw j(t,"SQL to GQL")}var ve=t=>typeof t!="object"?false:!!Object.keys(t).some(n=>["args","nullable","query","subscribe","description","type","resolve"].find(r=>r===n)),se=({db:t,schemaBuilder:n,makePubSubInstance:r,whereArgImplementer:p,orderArgImplementer:i,enumImplementer:e,abilityBuilder:y})=>({table:l,refName:u,readAction:m="read",adjust:a})=>{let f=B({db:t,tsName:l});Object.keys(f.primaryColumns).length===0&&console.warn(`Could not find primary key for ${l.toString()}. Cannot register subscriptions!`);let s=Object.values(f.primaryColumns)[0],{registerOnInstance:h}=r({table:l});return n.drizzleObject(l,{name:u??capitalize(l.toString()),subscribe:(o,b,d)=>{if(!s)return;let T=b[s.name];if(!T){console.warn(`Could not find primary key value for ${JSON.stringify(b)}. Cannot register subscription!`);return}h({instance:o,action:"updated",primaryKeyValue:T});},applyFilters:y?.registeredFilters?.[l]?.[m],fields:o=>{let b=f.columns,d=(S,g,x)=>{let c=W({sqlType:S,fieldName:g});switch(c){case "Int":return o.exposeInt(g,{nullable:x});case "String":return o.exposeString(g,{nullable:x});case "Boolean":return o.exposeBoolean(g,{nullable:x});case "Date":return o.field({type:"Date",resolve:R=>R[g],nullable:x});case "DateTime":return o.field({type:"DateTime",resolve:R=>R[g],nullable:x});case "Float":return o.exposeFloat(g,{nullable:x});case "ID":return o.exposeID(g,{nullable:x});case "JSON":return o.field({type:"JSON",resolve:R=>R[g],nullable:x});default:throw new A(`Unsupported object type ${c} for column ${g}`)}},T=new Map,C=a?.(new Proxy(o,{get:(S,g)=>typeof S[g]=="function"?(...x)=>{let c=S[g](...x),R=x.find(ve);if(!R)throw new A("Expected config object to be passed to adjust field");return T.set(c,{params:x,creatorFunction:S[g],configObject:R}),c}:S[g]}))??{},D=Object.entries(b).reduce((S,[g,x])=>{if(C[g]){let{params:c,creatorFunction:R,configObject:P}=T.get(C[g]);return typeof P.nullable!="boolean"&&(P.nullable=!x.notNull),C[g]=R.bind(o)(...c),S}if(G(x)){let c=e({enumColumn:x});S[g]=o.field({type:c,resolve:R=>R[g],nullable:!x.notNull});}else S[g]=d(x.getSQLType(),g,!x.notNull);return S},{}),I=Object.entries(f.relations??{}).reduce((S,[g,x])=>{let c=B({db:t,table:x.targetTable}),R=p({dbName:c.dbName}),P=i({dbName:c.dbName}),w=r({table:c.tsName}),F=false,z=true,N="many";x instanceof One&&(z=false,F=x.optional,N="single");let U=(E,Q)=>{w.registerOnInstance({instance:E,action:"created"}),w.registerOnInstance({instance:E,action:"removed"});};if(C[g]){let{params:E,creatorFunction:Q,configObject:O}=T.get(C[g]);return typeof O.nullable!="boolean"&&(O.nullable=F),typeof O.subscribe!="function"&&(O.subscribe=U),C[g]=Q.bind(o)(...E),S}return S[g]=o.relation(g,{args:{where:o.arg({type:R,required:false}),orderBy:o.arg({type:P,required:false}),...z?{offset:o.arg.int({required:false}),limit:o.arg.int({required:false})}:{}},subscribe:U,nullable:F,query:(E,Q)=>{E=JSON.parse(JSON.stringify(E));let O=Q.abilities[c.tsName].filter(m,{inject:{where:E.where,limit:E.limit}}).query[N];return E.offset&&(O.offset=E.offset),E.orderBy&&(O.orderBy=E.orderBy),O}}),S},{});return {...D,...I,...C}}})};var ze=t=>`${capitalize(toCamelCase(t.toString()))}OrderInputArgument`,ae=({db:t,schemaBuilder:n})=>{let r=new Map,p=v(()=>n.enumType("SortingParameter",{values:["asc","desc"]})),i=({table:e,refName:y,dbName:l})=>{let u=B({db:t,dbName:l,tsName:e}),m=y??ze(u.tsName),a=r.get(m);return a||(a=n.inputType(m,{fields:s=>{let h=Object.entries(u.columns).reduce((b,[d,T])=>(b[d]=s.field({type:p(),required:false}),b),{}),o=Object.entries(u.relations??{}).reduce((b,[d,T])=>{let C=B({db:t,table:T.targetTable}),D=i({dbName:C.dbName});return b[d]=s.field({type:D,required:false}),b},{});return {...h,...o}}}),r.set(m,a),a)};return i};var qe="RUMBLE_SUBSCRIPTION_NOTIFICATION",ke="REMOVED",we="UPDATED",Le="CREATED",ue=({subscriptions:t,db:n})=>{let r=t?createPubSub(...t):createPubSub();return {pubsub:r,makePubSubInstance:({table:i})=>{function e({action:y,tableName:l,primaryKeyValue:u}){let m;switch(y){case "created":m=Le;break;case "removed":m=ke;break;case "updated":m=we;break;default:throw new Error(`Unknown action: ${y}`)}return `${qe}/${l}${u?`/${u}`:""}/${m}`}return {registerOnInstance({instance:y,action:l,primaryKeyValue:u}){let m=e({tableName:i.toString(),action:l,primaryKeyValue:u});y.register(m);},created(){let y=e({tableName:i.toString(),action:"created"});return r.publish(y)},removed(y){let l=e({tableName:i.toString(),action:"removed"});return r.publish(l)},updated(y){let u=(Array.isArray(y)?y:[y]).map(a=>e({tableName:i.toString(),action:"updated",primaryKeyValue:a})),m=Array.from(new Set(u));for(let a of m)r.publish(a);}}}}};var pe=({db:t,schemaBuilder:n,whereArgImplementer:r,orderArgImplementer:p,makePubSubInstance:i})=>({table:e,readAction:y="read",listAction:l="read"})=>{let u=r({table:e}),m=p({table:e}),a=B({db:t,tsName:e}),f=Object.values(a.primaryColumns)[0],{registerOnInstance:s}=i({table:e});return n.queryFields(h=>({[plural(e.toString())]:h.drizzleField({type:[e],nullable:false,smartSubscription:true,subscribe:(o,b,d,T,C)=>{s({instance:o,action:"created"}),s({instance:o,action:"removed"});},args:{where:h.arg({type:u,required:false}),orderBy:h.arg({type:m,required:false}),limit:h.arg.int({required:false}),offset:h.arg.int({required:false})},resolve:(o,b,d,T,C)=>{d=JSON.parse(JSON.stringify(d));let D=T.abilities[e].filter(l,d.where||d.limit||d.offset?{inject:{where:d.where,limit:d.limit}}:void 0).query.many;d.offset&&(D.offset=d.offset),d.orderBy&&(D.orderBy=d.orderBy);let I=o(D);return D.columns&&(I.columns=D.columns),t.query[e].findMany(I)}}),[singular(e.toString())]:h.drizzleField({type:e,nullable:false,smartSubscription:true,args:{id:h.arg.id({required:true})},resolve:(o,b,d,T,C)=>{d=JSON.parse(JSON.stringify(d));let D=T.abilities[e].filter(y,{inject:{where:{[f.name]:d.id}}}).query.single,I=o(D);return D.columns&&(I.columns=D.columns),t.query[e].findFirst(I).then(_)}})}))};var ce="ManualFiltersPlugin",ye=ce,me="applyFilters",M=class extends BasePlugin{wrapResolve(n,r){return async(p,i,e,y)=>{let l,u=r?.type;if(u.kind==="List"?l=u.type?.ref.currentConfig.pothosOptions[me]:u.kind==="Object"&&(l=u.ref.currentConfig.pothosOptions[me]),!l||!Array.isArray(l)||l.length===0)return n(p,i,e,y);let m=await n(p,i,e,y),a=Array.isArray(m)?m:[m],f=Array.isArray(l)?l:[l],s=await Z({filters:f,entities:a,context:e});return Array.isArray(m)?s:s[0]??null}}};je.registerPlugin(ce,M);var _e=t=>`${capitalize(toCamelCase(t.toString()))}WhereInputArgument`,de=({db:t,schemaBuilder:n,enumImplementer:r})=>{let p=new Map,i=({table:e,refName:y,dbName:l})=>{let u=B({db:t,dbName:l,tsName:e}),m=y??_e(u.tsName),a=p.get(m);return a||(a=n.inputType(m,{fields:s=>{let h=(d,T)=>{let C=W({sqlType:d,fieldName:T});switch(C){case "Int":return s.field({type:"IntWhereInputArgument"});case "String":return s.field({type:"StringWhereInputArgument"});case "Boolean":return s.boolean({required:false});case "Date":return s.field({type:"DateWhereInputArgument"});case "DateTime":return s.field({type:"DateWhereInputArgument"});case "Float":return s.field({type:"FloatWhereInputArgument"});case "ID":return s.id({required:false});case "JSON":return s.field({type:"JSON",required:false});default:throw new A(`Unsupported argument type ${C} for column ${d}`)}},o=Object.entries(u.columns).reduce((d,[T,C])=>{if(G(C)){let D=r({enumColumn:C});d[T]=s.field({type:D,required:false});}else d[T]=h(C.getSQLType(),T);return d},{}),b=Object.entries(u.relations??{}).reduce((d,[T,C])=>{let D=B({db:t,table:C.targetTable}),I=i({dbName:D.dbName});return d[T]=s.field({type:I,required:false}),d},{});return {...o,...b}}}),p.set(m,a),a)};return i};function fe(t){let n=t.inputRef("IntWhereInputArgument").implement({fields:e=>({eq:e.int(),ne:e.int(),gt:e.int(),gte:e.int(),lt:e.int(),lte:e.int(),in:e.intList(),notIn:e.intList(),like:e.string(),ilike:e.string(),notLike:e.string(),notIlike:e.string(),isNull:e.boolean(),isNotNull:e.boolean(),arrayOverlaps:e.intList(),arrayContained:e.intList(),arrayContains:e.intList(),AND:e.field({type:[n]}),OR:e.field({type:[n]}),NOT:e.field({type:n})})}),r=t.inputRef("FloatWhereInputArgument").implement({fields:e=>({eq:e.float(),ne:e.float(),gt:e.float(),gte:e.float(),lt:e.float(),lte:e.float(),in:e.floatList(),notIn:e.floatList(),like:e.string(),ilike:e.string(),notLike:e.string(),notIlike:e.string(),isNull:e.boolean(),isNotNull:e.boolean(),arrayOverlaps:e.floatList(),arrayContained:e.floatList(),arrayContains:e.floatList(),AND:e.field({type:[r]}),OR:e.field({type:[r]}),NOT:e.field({type:r})})}),p=t.inputRef("StringWhereInputArgument").implement({fields:e=>({eq:e.string(),ne:e.string(),gt:e.string(),gte:e.string(),lt:e.string(),lte:e.string(),in:e.stringList(),notIn:e.stringList(),like:e.string(),ilike:e.string(),notLike:e.string(),notIlike:e.string(),isNull:e.boolean(),isNotNull:e.boolean(),arrayOverlaps:e.stringList(),arrayContained:e.stringList(),arrayContains:e.stringList(),AND:e.field({type:[p]}),OR:e.field({type:[p]}),NOT:e.field({type:p})})}),i=t.inputRef("DateWhereInputArgument").implement({fields:e=>({eq:e.field({type:"Date"}),ne:e.field({type:"Date"}),gt:e.field({type:"Date"}),gte:e.field({type:"Date"}),lt:e.field({type:"Date"}),lte:e.field({type:"Date"}),in:e.field({type:["Date"]}),notIn:e.field({type:["Date"]}),like:e.string(),ilike:e.string(),notLike:e.string(),notIlike:e.string(),isNull:e.boolean(),isNotNull:e.boolean(),arrayOverlaps:e.field({type:["Date"]}),arrayContained:e.field({type:["Date"]}),arrayContains:e.field({type:["Date"]}),AND:e.field({type:[i]}),OR:e.field({type:[i]}),NOT:e.field({type:i})})});}var ge=({db:t,disableDefaultObjects:n,pubsub:r,pothosConfig:p})=>{let i=new je({...p,plugins:[ye,Me,$e,...p?.plugins??[]],drizzle:{client:t,relations:t._.relations,getTableConfig(e){return {columns:Object.values(e[Symbol.for("drizzle:Columns")]),primaryKeys:Object.values(e[Symbol.for("drizzle:Columns")]).filter(y=>y.primary)}}},smartSubscriptions:{...subscribeOptionsFromIterator((e,y)=>r.subscribe(e))}});return i.addScalarType("JSON",JSONResolver),i.addScalarType("Date",DateResolver),i.addScalarType("DateTime",DateTimeISOResolver),fe(i),n?.query||i.queryType({}),n?.subscription||i.subscriptionType({}),n?.mutation||i.mutationType({}),{schemaBuilder:i}};var it=t=>{t.actions||(t.actions=["read","update","delete"]),t.defaultLimit===void 0&&(t.defaultLimit=100);let n=ne(t),r=re({...t,abilityBuilder:n}),{makePubSubInstance:p,pubsub:i}=ue({...t}),{schemaBuilder:e}=ge({...t,pubsub:i}),y=ie({...t,schemaBuilder:e}),l=de({...t,schemaBuilder:e,enumImplementer:y}),u=ae({...t,schemaBuilder:e}),m=se({...t,schemaBuilder:e,makePubSubInstance:p,whereArgImplementer:l,orderArgImplementer:u,enumImplementer:y,abilityBuilder:n}),a=pe({...t,schemaBuilder:e,whereArgImplementer:l,orderArgImplementer:u,makePubSubInstance:p}),f=v(()=>e.toSchema());return {abilityBuilder:n,schemaBuilder:e,createYoga:o=>{let b=o?.enableApiDocs??process?.env?.NODE_ENV==="development"??false;return createYoga({...o,graphiql:b,plugins:[...o?.plugins??[],...b?[]:[useDisableIntrospection(),EnvelopArmorPlugin()]].filter(Boolean),schema:f(),context:r})},createSofa:o=>(o.openAPI&&merge(o.openAPI,oe),useSofa({...o,schema:f(),context:r})),object:m,whereArg:l,orderArg:u,query:a,pubsub:p,enum_:y}};export{A as RumbleError,k as RumbleErrorSafe,_ as assertFindFirstExists,Ce as assertFirstEntryExists,De as mapNullFieldsToUndefined,it as rumble};//# sourceMappingURL=index.js.map
7
+ `+_(this.source,r);return n}toJSON(){let n={message:this.message};return this.locations!=null&&(n.locations=this.locations),this.path!=null&&(n.path=this.path),this.extensions!=null&&Object.keys(this.extensions).length>0&&(n.extensions=this.extensions),n}};function X(t){return t===void 0||t.length===0?void 0:t}var A=class extends Error{constructor(n){super(n),this.name="RumbleError";}},k=class extends q{};var K=t=>{if(!t)throw new k("Value not found but required (findFirst)");return t},Ce=t=>{let n=t.at(0);if(!n)throw new k("Value not found but required (firstEntry)");return n},Z=async({filters:t,entities:n,context:r})=>(await Promise.all(t.map(p=>p({context:r,entities:n})))).reduce((p,i)=>(p.push(...i),p),[]);function De(t){return Object.fromEntries(Object.entries(t).map(([n,r])=>[n,r===null?void 0:r]))}function v(t){let n,r=false;return ()=>(r||(n=t(),r=true),n)}var j=(t,n)=>new A(`RumbleError: Unknown SQL type '${t}'. Please open an issue (https://github.com/m1212e/rumble/issues) so it can be added. (${n})`);function ee(t){if(["serial","int","integer","tinyint","smallint","mediumint"].includes(t))return {value1:1,value2:2};if(["real","decimal","double","float"].includes(t))return {value1:1.1,value2:2.2};if(["string","text","varchar","char","text(256)"].includes(t))return {value1:"a",value2:"b"};if(["uuid"].includes(t))return {value1:"fba31870-5528-42d7-b27e-2e5ee657aea5",value2:"fc65db81-c2d1-483d-8a25-a30e2cf6e02d"};if(["boolean"].includes(t))return {value1:true,value2:false};if(["timestamp","datetime"].includes(t))return {value1:new Date(2022,1,1),value2:new Date(2022,1,2)};if(["date"].includes(t))return {value1:new Date(2022,1,1),value2:new Date(2022,1,2)};if(["json"].includes(t))return {value1:{a:1},value2:{b:2}};throw j(t,"Distinct")}var V=Symbol.for("drizzle:Name"),te=Symbol.for("drizzle:Columns");function N({dbName:t,tsName:n,table:r,db:p}){let i=r;if(n&&(i=p._.relations.schema[n]),t&&(i=Object.values(p._.relations.schema).find(e=>e[V]===t)),!i)throw new A(`Could not find schema for ${JSON.stringify({tsName:n,dbName:t,table:r?.[V]}).toString()}`);return {tableSchema:i,columns:i[te],get primaryColumns(){return Object.entries(i[te]).filter(([e,y])=>y.primary).reduce((e,[y,l])=>(e[y]=l,e),{})},relations:p._.relations.config[n],dbName:i[V],get tsName(){return Object.entries(p._.relations.schema).find(([e,y])=>y===i).at(0)}}}function Se(t){return typeof t!="function"}function Ae(t){return typeof t=="function"&&t.constructor.name!=="AsyncFunction"}var ne=({db:t,actions:n,defaultLimit:r})=>{let p={},i={},e={},y=l=>{for(let u of n)e[l]||(e[l]={}),e[l][u]||(e[l][u]=[]);return {allow:u=>{let m=i[l];m||(m={},i[l]=m);let a=Array.isArray(u)?u:[u];for(let g of a){let s=m[g];s||(s="unspecified",m[g]=s);}return {when:g=>{for(let s of a)m[s]==="unspecified"&&(m[s]=[]),m[s].push(g);}}},filter:u=>{let m=Array.isArray(u)?u:[u];return {by:a=>{for(let g of m)e[l][g].push(a);}}}}};for(let l of Object.keys(t.query))p[l]=y(l);return {...p,z_registeredQueryFilters:i,z_registeredFilters:e,z_buildWithUserContext:l=>{let u={},m=a=>({filter:(g,s)=>{let h=c=>{let R=v(()=>{if(!(!c?.where&&!s?.inject?.where)){if(s?.inject?.where&&c?.where)return {AND:[c?.where,s?.inject?.where]};if(s?.inject?.where&&!c?.where)return s?.inject?.where;if(!s?.inject?.where&&c?.where)return c?.where;!s?.inject?.where&&c?.where;}}),P=v(()=>{let B=R();if(!B)return;let U=N({tsName:a,db:t});return relationsFilterToSQL(U.tableSchema,B)}),w=v(()=>{let B=c?.limit??r;return s?.inject?.limit&&(!B||B>s.inject.limit)&&(B=s.inject.limit),c?.limit&&(!B||c.limit>B)&&(B=c.limit),B??void 0}),F=v(()=>{if(!(!c?.columns&&!s?.inject?.columns))return {...c?.columns,...s?.inject?.columns}}),z={query:{single:{get where(){return R()},columns:F()},many:{get where(){return R()},columns:F(),get limit(){return w()}}},sql:{get where(){return P()},columns:F(),get limit(){return w()}}};return F()||(delete z.sql.columns,delete z.query.many.columns,delete z.query.single.columns),z},o=()=>{let c=N({db:t,tsName:a});if(Object.keys(c.primaryColumns).length===0)throw new A(`No primary key found for entity ${a.toString()}`);let R=Object.values(c.primaryColumns)[0],P=ee(R.getSQLType());return {where:{AND:[{[R.name]:P.value1},{[R.name]:P.value2}]}}},b=i?.[a]?.[g];if(b==="unspecified")return h();b||(b=[o()]);let f=b.filter(Se),T=b.filter(Ae).map(c=>c(l)),C=T.some(c=>c==="allow"),D=[...f,...T].filter(c=>c!==void 0).filter(c=>c!=="allow");!C&&D.length===0&&(D=[o()]);let I;for(let c of D)c?.limit&&(I===void 0||c.limit>I)&&(I=c.limit);let S;for(let c of [...D,s?.inject])c?.columns&&(S===void 0?S=c.columns:S={...S,...c.columns});let d=C?[]:D.filter(c=>c?.where).map(c=>c.where),x=d.length>0?{OR:d}:void 0;return h({where:x,columns:S,limit:I})},explicitFilters:g=>e[a][g]});for(let a of Object.keys(t.query))u[a]=m(a);return u}}};var re=({context:t,abilityBuilder:n})=>async r=>{let p=t?await t(r):{};return {...p,abilities:n.z_buildWithUserContext(p)}};function W(t){return t instanceof PgEnumColumn}var ie=({db:t,schemaBuilder:n})=>{let r=new Map;return ({tsName:i,enumColumn:e,refName:y})=>{let l,u;if(i){let s=t._.relations.schema[i];l=i.toString();let h=Object.values(t._.relations.schema).filter(o=>typeof o=="object").map(o=>Object.values(o[Symbol.for("drizzle:Columns")])).flat(2).find(o=>o.config?.enum===s);if(!h)throw new A(`Could not find applied enum column for ${i.toString()}.
8
+ Please ensure that you use the enum at least once as a column of a table!`);u=h.enumValues;}else if(e){let s=Object.entries(t._.relations.schema).find(([h,o])=>o===e.config.enum);if(!s)throw new A(`Could not find enum in schema for ${e.name}!`);l=s[0],u=e.enumValues;}if(!l||!u)throw new A("Could not determine enum structure!");let m=y??`${capitalize(toCamelCase(l))}Enum`,a=r.get(m);return a||(a=n.enumType(m,{values:u}),r.set(m,a),a)}};var oe={paths:{"/webhook":{post:{operationId:"webhook_create",description:"Creates a webhook subscription.",tags:[],parameters:[],requestBody:{content:{"application/json":{schema:{$ref:"#/components/schemas/WebhookCreateBody"}}}},responses:{200:{content:{"application/json":{schema:{$ref:"#/components/schemas/WebhookDetailResponse"}}}}}}},"/webhook/{id}":{post:{operationId:"webhook_update",description:"Updates a webhook subscription.",parameters:[{name:"id",in:"path",description:"The ID of the webhook to update",required:true,schema:{type:"string"}}],requestBody:{content:{"application/json":{schema:{$ref:"#/components/schemas/WebhookCreateBody"}}}},responses:{200:{content:{"application/json":{schema:{$ref:"#/components/schemas/WebhookDetailResponse"}}}}}},delete:{operationId:"webhook_delete",description:"Removes a webhook subscription.",tags:[],parameters:[{name:"id",in:"path",description:"The ID of the webhook to delete",required:true,schema:{type:"string"}}],responses:{200:{content:{"application/json":{schema:{$ref:"#/components/schemas/WebhookDetailResponse"}}}}}}}},components:{schemas:{WebhookCreateBody:{type:"object",properties:{subscription:{description:"The subscription to subscribe to. In many cases, these match the available query IDs without the '_query' suffix. E.g., 'findFirstUser_query' -> 'findFirstUser'. See the graphql schema for more details on what subscriptions are available.",type:"string"},variables:{description:"The variables to pass to the subscription.",type:"object"},url:{description:"The URL to send the webhook to.",type:"string"}}},WebhookDetailResponse:{type:"object",properties:{id:{description:"The ID of the webhook. Can be used as reference in update or delete calls.",type:"string"}}}}}};function G({sqlType:t,fieldName:n}){let r;if(["serial","int","integer","tinyint","smallint","mediumint"].includes(t)&&(r="Int"),["real","decimal","double","float"].includes(t)&&(r="Float"),["string","text","varchar","char","text(256)"].includes(t)&&(n&&(n.toLowerCase().endsWith("_id")||n.toLowerCase().endsWith("id"))?r="ID":r="String"),["uuid"].includes(t)&&(r="ID"),["boolean"].includes(t)&&(r="Boolean"),["timestamp","datetime"].includes(t)&&(r="DateTime"),["date"].includes(t)&&(r="Date"),["json"].includes(t)&&(r="JSON"),r!==void 0)return r;throw j(t,"SQL to GQL")}var ve=t=>typeof t!="object"?false:!!Object.keys(t).some(n=>["args","nullable","query","subscribe","description","type","resolve"].find(r=>r===n)),se=({db:t,schemaBuilder:n,makePubSubInstance:r,whereArgImplementer:p,orderArgImplementer:i,enumImplementer:e,abilityBuilder:y})=>({table:l,refName:u,readAction:m="read",adjust:a})=>{let g=N({db:t,tsName:l});Object.keys(g.primaryColumns).length===0&&console.warn(`Could not find primary key for ${l.toString()}. Cannot register subscriptions!`);let s=Object.values(g.primaryColumns)[0],{registerOnInstance:h}=r({table:l});return n.drizzleObject(l,{name:u??capitalize(l.toString()),subscribe:(o,b,f)=>{if(!s)return;let T=b[s.name];if(!T){console.warn(`Could not find primary key value for ${JSON.stringify(b)}. Cannot register subscription!`);return}h({instance:o,action:"updated",primaryKeyValue:T});},applyFilters:y?.z_registeredFilters?.[l]?.[m],fields:o=>{let b=g.columns,f=(S,d,x)=>{let c=G({sqlType:S,fieldName:d});switch(c){case "Int":return o.exposeInt(d,{nullable:x});case "String":return o.exposeString(d,{nullable:x});case "Boolean":return o.exposeBoolean(d,{nullable:x});case "Date":return o.field({type:"Date",resolve:R=>R[d],nullable:x});case "DateTime":return o.field({type:"DateTime",resolve:R=>R[d],nullable:x});case "Float":return o.exposeFloat(d,{nullable:x});case "ID":return o.exposeID(d,{nullable:x});case "JSON":return o.field({type:"JSON",resolve:R=>R[d],nullable:x});default:throw new A(`Unsupported object type ${c} for column ${d}`)}},T=new Map,C=a?.(new Proxy(o,{get:(S,d)=>typeof S[d]!="function"||d==="arg"||d==="builder"||d==="graphqlKind"||d==="kind"||d==="listRef"||d==="table"||d==="typename"||d==="variant"||d.toString().startsWith("boolean")||d.toString().startsWith("float")||d.toString().startsWith("id")||d.toString().startsWith("int")||d.toString().startsWith("string")||d.toString().startsWith("expose")?S[d]:(...x)=>{let c=S[d](...x),R=x.find(ve);if(!R)throw new A("Expected config object to be passed to adjust field");return T.set(c,{params:x,creatorFunction:S[d],configObject:R}),c}}))??{},D=Object.entries(b).reduce((S,[d,x])=>{if(C[d]){let{params:c,creatorFunction:R,configObject:P}=T.get(C[d]);return typeof P.nullable!="boolean"&&(P.nullable=!x.notNull),C[d]=R.bind(o)(...c),S}if(W(x)){let c=e({enumColumn:x});S[d]=o.field({type:c,resolve:R=>R[d],nullable:!x.notNull});}else S[d]=f(x.getSQLType(),d,!x.notNull);return S},{}),I=Object.entries(g.relations??{}).reduce((S,[d,x])=>{let c=N({db:t,table:x.targetTable}),R=p({dbName:c.dbName}),P=i({dbName:c.dbName}),w=r({table:c.tsName}),F=false,z=true,B="many";x instanceof One&&(z=false,F=x.optional,B="single");let U=(E,Q)=>{w.registerOnInstance({instance:E,action:"created"}),w.registerOnInstance({instance:E,action:"removed"});};if(C[d]){let{params:E,creatorFunction:Q,configObject:O}=T.get(C[d]);return typeof O.nullable!="boolean"&&(O.nullable=F),typeof O.subscribe!="function"&&(O.subscribe=U),C[d]=Q.bind(o)(...E),S}return S[d]=o.relation(d,{args:{where:o.arg({type:R,required:false}),orderBy:o.arg({type:P,required:false}),...z?{offset:o.arg.int({required:false}),limit:o.arg.int({required:false})}:{}},subscribe:U,nullable:F,query:(E,Q)=>{E=JSON.parse(JSON.stringify(E));let O=Q.abilities[c.tsName].filter(m,{inject:{where:E.where,limit:E.limit}}).query[B];return E.offset&&(O.offset=E.offset),E.orderBy&&(O.orderBy=E.orderBy),O}}),S},{});return {...D,...I,...C}}})};var ze=t=>`${capitalize(toCamelCase(t.toString()))}OrderInputArgument`,ae=({db:t,schemaBuilder:n})=>{let r=new Map,p=v(()=>n.enumType("SortingParameter",{values:["asc","desc"]})),i=({table:e,refName:y,dbName:l})=>{let u=N({db:t,dbName:l,tsName:e}),m=y??ze(u.tsName),a=r.get(m);return a||(a=n.inputType(m,{fields:s=>{let h=Object.entries(u.columns).reduce((b,[f,T])=>(b[f]=s.field({type:p(),required:false}),b),{}),o=Object.entries(u.relations??{}).reduce((b,[f,T])=>{let C=N({db:t,table:T.targetTable}),D=i({dbName:C.dbName});return b[f]=s.field({type:D,required:false}),b},{});return {...h,...o}}}),r.set(m,a),a)};return i};var qe="RUMBLE_SUBSCRIPTION_NOTIFICATION",ke="REMOVED",we="UPDATED",Le="CREATED",ue=({subscriptions:t,db:n})=>{let r=t?createPubSub(...t):createPubSub();return {pubsub:r,makePubSubInstance:({table:i})=>{function e({action:y,tableName:l,primaryKeyValue:u}){let m;switch(y){case "created":m=Le;break;case "removed":m=ke;break;case "updated":m=we;break;default:throw new Error(`Unknown action: ${y}`)}return `${qe}/${l}${u?`/${u}`:""}/${m}`}return {registerOnInstance({instance:y,action:l,primaryKeyValue:u}){let m=e({tableName:i.toString(),action:l,primaryKeyValue:u});y.register(m);},created(){let y=e({tableName:i.toString(),action:"created"});return r.publish(y)},removed(y){let l=e({tableName:i.toString(),action:"removed"});return r.publish(l)},updated(y){let u=(Array.isArray(y)?y:[y]).map(a=>e({tableName:i.toString(),action:"updated",primaryKeyValue:a})),m=Array.from(new Set(u));for(let a of m)r.publish(a);}}}}};var pe=({db:t,schemaBuilder:n,whereArgImplementer:r,orderArgImplementer:p,makePubSubInstance:i})=>({table:e,readAction:y="read",listAction:l="read"})=>{let u=r({table:e}),m=p({table:e}),a=N({db:t,tsName:e}),g=Object.values(a.primaryColumns)[0],{registerOnInstance:s}=i({table:e});return n.queryFields(h=>({[plural(e.toString())]:h.drizzleField({type:[e],nullable:false,smartSubscription:true,subscribe:(o,b,f,T,C)=>{s({instance:o,action:"created"}),s({instance:o,action:"removed"});},args:{where:h.arg({type:u,required:false}),orderBy:h.arg({type:m,required:false}),limit:h.arg.int({required:false}),offset:h.arg.int({required:false})},resolve:(o,b,f,T,C)=>{f=JSON.parse(JSON.stringify(f));let D=T.abilities[e].filter(l,f.where||f.limit||f.offset?{inject:{where:f.where,limit:f.limit}}:void 0).query.many;f.offset&&(D.offset=f.offset),f.orderBy&&(D.orderBy=f.orderBy);let I=o(D);return D.columns&&(I.columns=D.columns),t.query[e].findMany(I)}}),[singular(e.toString())]:h.drizzleField({type:e,nullable:false,smartSubscription:true,args:{id:h.arg.id({required:true})},resolve:(o,b,f,T,C)=>{f=JSON.parse(JSON.stringify(f));let D=T.abilities[e].filter(y,{inject:{where:{[g.name]:f.id}}}).query.single,I=o(D);return D.columns&&(I.columns=D.columns),t.query[e].findFirst(I).then(K)}})}))};var ce="ManualFiltersPlugin",ye=ce,me="applyFilters",M=class extends BasePlugin{wrapResolve(n,r){return async(p,i,e,y)=>{let l,u=r?.type;if(u.kind==="List"?l=u.type?.ref.currentConfig.pothosOptions[me]:u.kind==="Object"&&(l=u.ref.currentConfig.pothosOptions[me]),!l||!Array.isArray(l)||l.length===0)return n(p,i,e,y);let m=await n(p,i,e,y),a=Array.isArray(m)?m:[m],g=Array.isArray(l)?l:[l],s=await Z({filters:g,entities:a,context:e});return Array.isArray(m)?s:s[0]??null}}};je.registerPlugin(ce,M);var Ke=t=>`${capitalize(toCamelCase(t.toString()))}WhereInputArgument`,de=({db:t,schemaBuilder:n,enumImplementer:r})=>{let p=new Map,i=({table:e,refName:y,dbName:l})=>{let u=N({db:t,dbName:l,tsName:e}),m=y??Ke(u.tsName),a=p.get(m);return a||(a=n.inputType(m,{fields:s=>{let h=(f,T)=>{let C=G({sqlType:f,fieldName:T});switch(C){case "Int":return s.field({type:"IntWhereInputArgument"});case "String":return s.field({type:"StringWhereInputArgument"});case "Boolean":return s.boolean({required:false});case "Date":return s.field({type:"DateWhereInputArgument"});case "DateTime":return s.field({type:"DateWhereInputArgument"});case "Float":return s.field({type:"FloatWhereInputArgument"});case "ID":return s.id({required:false});case "JSON":return s.field({type:"JSON",required:false});default:throw new A(`Unsupported argument type ${C} for column ${f}`)}},o=Object.entries(u.columns).reduce((f,[T,C])=>{if(W(C)){let D=r({enumColumn:C});f[T]=s.field({type:D,required:false});}else f[T]=h(C.getSQLType(),T);return f},{}),b=Object.entries(u.relations??{}).reduce((f,[T,C])=>{let D=N({db:t,table:C.targetTable}),I=i({dbName:D.dbName});return f[T]=s.field({type:I,required:false}),f},{});return {...o,...b}}}),p.set(m,a),a)};return i};function fe(t){let n=t.inputRef("IntWhereInputArgument").implement({fields:e=>({eq:e.int(),ne:e.int(),gt:e.int(),gte:e.int(),lt:e.int(),lte:e.int(),in:e.intList(),notIn:e.intList(),like:e.string(),ilike:e.string(),notLike:e.string(),notIlike:e.string(),isNull:e.boolean(),isNotNull:e.boolean(),arrayOverlaps:e.intList(),arrayContained:e.intList(),arrayContains:e.intList(),AND:e.field({type:[n]}),OR:e.field({type:[n]}),NOT:e.field({type:n})})}),r=t.inputRef("FloatWhereInputArgument").implement({fields:e=>({eq:e.float(),ne:e.float(),gt:e.float(),gte:e.float(),lt:e.float(),lte:e.float(),in:e.floatList(),notIn:e.floatList(),like:e.string(),ilike:e.string(),notLike:e.string(),notIlike:e.string(),isNull:e.boolean(),isNotNull:e.boolean(),arrayOverlaps:e.floatList(),arrayContained:e.floatList(),arrayContains:e.floatList(),AND:e.field({type:[r]}),OR:e.field({type:[r]}),NOT:e.field({type:r})})}),p=t.inputRef("StringWhereInputArgument").implement({fields:e=>({eq:e.string(),ne:e.string(),gt:e.string(),gte:e.string(),lt:e.string(),lte:e.string(),in:e.stringList(),notIn:e.stringList(),like:e.string(),ilike:e.string(),notLike:e.string(),notIlike:e.string(),isNull:e.boolean(),isNotNull:e.boolean(),arrayOverlaps:e.stringList(),arrayContained:e.stringList(),arrayContains:e.stringList(),AND:e.field({type:[p]}),OR:e.field({type:[p]}),NOT:e.field({type:p})})}),i=t.inputRef("DateWhereInputArgument").implement({fields:e=>({eq:e.field({type:"Date"}),ne:e.field({type:"Date"}),gt:e.field({type:"Date"}),gte:e.field({type:"Date"}),lt:e.field({type:"Date"}),lte:e.field({type:"Date"}),in:e.field({type:["Date"]}),notIn:e.field({type:["Date"]}),like:e.string(),ilike:e.string(),notLike:e.string(),notIlike:e.string(),isNull:e.boolean(),isNotNull:e.boolean(),arrayOverlaps:e.field({type:["Date"]}),arrayContained:e.field({type:["Date"]}),arrayContains:e.field({type:["Date"]}),AND:e.field({type:[i]}),OR:e.field({type:[i]}),NOT:e.field({type:i})})});}var ge=({db:t,disableDefaultObjects:n,pubsub:r,pothosConfig:p})=>{let i=new je({...p,plugins:[ye,Me,$e,...p?.plugins??[]],drizzle:{client:t,relations:t._.relations,getTableConfig(e){return {columns:Object.values(e[Symbol.for("drizzle:Columns")]),primaryKeys:Object.values(e[Symbol.for("drizzle:Columns")]).filter(y=>y.primary)}}},smartSubscriptions:{...subscribeOptionsFromIterator((e,y)=>r.subscribe(e))}});return i.addScalarType("JSON",JSONResolver),i.addScalarType("Date",DateResolver),i.addScalarType("DateTime",DateTimeISOResolver),fe(i),n?.query||i.queryType({}),n?.subscription||i.subscriptionType({}),n?.mutation||i.mutationType({}),{schemaBuilder:i}};var it=t=>{t.actions||(t.actions=["read","update","delete"]),t.defaultLimit===void 0&&(t.defaultLimit=100);let n=ne(t),r=re({...t,abilityBuilder:n}),{makePubSubInstance:p,pubsub:i}=ue({...t}),{schemaBuilder:e}=ge({...t,pubsub:i}),y=ie({...t,schemaBuilder:e}),l=de({...t,schemaBuilder:e,enumImplementer:y}),u=ae({...t,schemaBuilder:e}),m=se({...t,schemaBuilder:e,makePubSubInstance:p,whereArgImplementer:l,orderArgImplementer:u,enumImplementer:y,abilityBuilder:n}),a=pe({...t,schemaBuilder:e,whereArgImplementer:l,orderArgImplementer:u,makePubSubInstance:p}),g=v(()=>e.toSchema());return {abilityBuilder:n,schemaBuilder:e,createYoga:o=>{let b=o?.enableApiDocs??process?.env?.NODE_ENV==="development"??false;return createYoga({...o,graphiql:b,plugins:[...o?.plugins??[],...b?[]:[useDisableIntrospection(),EnvelopArmorPlugin()]].filter(Boolean),schema:g(),context:r})},createSofa:o=>(o.openAPI&&merge(o.openAPI,oe),useSofa({...o,schema:g(),context:r})),object:m,whereArg:l,orderArg:u,query:a,pubsub:p,enum_:y}};export{A as RumbleError,k as RumbleErrorSafe,K as assertFindFirstExists,Ce as assertFirstEntryExists,De as mapNullFieldsToUndefined,it as rumble};//# sourceMappingURL=index.js.map
9
9
  //# sourceMappingURL=index.js.map