@m1212e/rumble 0.18.9 → 0.21.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/out/index.d.mts CHANGED
@@ -1,18 +1,12 @@
1
- import * as _$graphql from "graphql";
2
1
  import { GraphQLError } from "graphql";
3
2
  import { EnvelopArmorPlugin } from "@escape.tech/graphql-armor";
4
3
  import { Tracer } from "@opentelemetry/api";
5
4
  import { TracingWrapperOptions } from "@pothos/tracing-opentelemetry";
6
- import * as _$graphql_yoga0 from "graphql-yoga";
7
5
  import { YogaServerOptions, createPubSub } from "graphql-yoga";
8
- import * as _$drizzle_orm0 from "drizzle-orm";
9
- import * as _$drizzle_orm_pg_core0 from "drizzle-orm/pg-core";
10
6
  import { PgAsyncDatabase } from "drizzle-orm/pg-core";
11
7
  import { MySqlDatabase } from "drizzle-orm/mysql-core";
12
8
  import { BaseSQLiteDatabase } from "drizzle-orm/sqlite-core";
13
- import * as _$_pothos_core0 from "@pothos/core";
14
9
  import SchemaBuilder from "@pothos/core";
15
- import * as _$_pothos_plugin_drizzle0 from "@pothos/plugin-drizzle";
16
10
  import { IncomingMessage, RequestListener, ServerResponse } from "node:http";
17
11
  import { Http2ServerRequest, Http2ServerResponse } from "node:http2";
18
12
  import { Socket } from "node:net";
@@ -154,7 +148,7 @@ declare const assertFirstEntryExists: <T>(value: T[]) => T;
154
148
  declare function mapNullFieldsToUndefined<T extends object>(obj: T): { [K in keyof T]: T[K] extends null ? undefined : Exclude<T[K], null> };
155
149
  //#endregion
156
150
  //#region lib/types/drizzleInstanceType.d.ts
157
- type DrizzleInstance = PgAsyncDatabase<any, any, any, any> | BaseSQLiteDatabase<any, any, any, any> | MySqlDatabase<any, any, any, any>;
151
+ type DrizzleInstance = PgAsyncDatabase<any, any> | BaseSQLiteDatabase<any, any, any, any> | MySqlDatabase<any, any>;
158
152
  /**
159
153
  * Type representing the query function of a Drizzle instance.
160
154
  */
@@ -3515,7 +3509,7 @@ type FromSchema$1<SCHEMA extends JSONSchema$1, OPTIONS extends FromSchemaOptions
3515
3509
  type MaybePromise<T> = Promise<T> | T;
3516
3510
  type MaybePromiseLike<T> = PromiseLike<T> | T;
3517
3511
  //#endregion
3518
- //#region node_modules/@whatwg-node/server/typings/utils.d.cts
3512
+ //#region node_modules/fets/node_modules/@whatwg-node/server/typings/utils.d.cts
3519
3513
  interface NodeRequest {
3520
3514
  protocol?: string | undefined;
3521
3515
  hostname?: string | undefined;
@@ -3533,7 +3527,7 @@ interface NodeRequest {
3533
3527
  }
3534
3528
  type NodeResponse = ServerResponse | Http2ServerResponse;
3535
3529
  //#endregion
3536
- //#region node_modules/@whatwg-node/server/typings/uwebsockets.d.cts
3530
+ //#region node_modules/fets/node_modules/@whatwg-node/server/typings/uwebsockets.d.cts
3537
3531
  interface UWSRequest {
3538
3532
  getMethod(): string;
3539
3533
  forEach(callback: (key: string, value: string) => void): void;
@@ -3554,7 +3548,7 @@ interface UWSResponse {
3554
3548
  }
3555
3549
  type UWSHandler = (res: UWSResponse, req: UWSRequest) => void | Promise<void>;
3556
3550
  //#endregion
3557
- //#region node_modules/@whatwg-node/server/typings/types.d.cts
3551
+ //#region node_modules/fets/node_modules/@whatwg-node/server/typings/types.d.cts
3558
3552
  interface FetchEvent extends Event {
3559
3553
  waitUntil(f: MaybePromise<void>): void;
3560
3554
  request: Request;
@@ -4168,11 +4162,15 @@ type ExtractPathParamsWithPattern<TPath extends string> = Pipe<TPath, [Strings.S
4168
4162
  //#endregion
4169
4163
  //#region lib/types/rumbleInput.d.ts
4170
4164
  type CustomRumblePothosConfig = Omit<ConstructorParameters<typeof SchemaBuilder>[0], "smartSubscriptions" | "drizzle">;
4171
- type RumbleInput<UserContext extends Record<string, any>, DB extends DrizzleInstance, RequestEvent extends Record<string, any>, Action extends string, PothosConfig extends CustomRumblePothosConfig> = {
4165
+ type RumbleInput<UserContext extends Record<string, any>, DB extends DrizzleInstance, RequestEvent extends Record<string, any>, Action extends string, PothosConfig extends CustomRumblePothosConfig, Schema extends Record<string, any> = Record<string, any>> = {
4172
4166
  /**
4173
4167
  * Your drizzle database instance
4174
4168
  */
4175
4169
  db: DB;
4170
+ /**
4171
+ * The drizzle schema object (the same one passed to `defineRelations`).
4172
+ */
4173
+ schema: Schema;
4176
4174
  /**
4177
4175
  * A function for providing context for each request based on the incoming HTTP Request.
4178
4176
  * The type of the parameter equals the HTTPRequest type of your chosen server.
@@ -4249,7 +4247,9 @@ type RumbleInput<UserContext extends Record<string, any>, DB extends DrizzleInst
4249
4247
  };
4250
4248
  //#endregion
4251
4249
  //#region lib/rumble.d.ts
4252
- declare const rumble: <UserContext extends Record<string, any>, DB extends DrizzleInstance, RequestEvent extends Record<string, any>, PothosConfig extends CustomRumblePothosConfig, Action extends string = "read" | "update" | "delete">(rumbleInput: RumbleInput<UserContext, DB, RequestEvent, Action, PothosConfig>) => {
4250
+ declare const rumble: <UserContext extends Record<string, any>, DB extends DrizzleInstance, RequestEvent extends Record<string, any>, PothosConfig extends CustomRumblePothosConfig, Schema extends Record<string, any>, Action extends string = "read" | "update" | "delete">(rumbleInput: RumbleInput<UserContext, DB, RequestEvent, Action, PothosConfig> & {
4251
+ schema: Schema;
4252
+ }) => {
4253
4253
  /**
4254
4254
  * The ability builder. Use it to declare whats allowed for each entity in your DB.
4255
4255
  *
@@ -4295,7 +4295,7 @@ declare const rumble: <UserContext extends Record<string, any>, DB extends Drizz
4295
4295
  many: Pick<NonNullable<NonNullable<Parameters<DB["query"][key_1]["findMany"]>[0]>>, "where" | "limit">;
4296
4296
  };
4297
4297
  sql: {
4298
- readonly where: _$drizzle_orm0.SQL<unknown> | undefined;
4298
+ readonly where: import("drizzle-orm").SQL<unknown> | undefined;
4299
4299
  };
4300
4300
  } & {
4301
4301
  merge: (p: NonNullable<DrizzleQueryFunctionInput<DB, key_1>>) => {
@@ -4304,7 +4304,7 @@ declare const rumble: <UserContext extends Record<string, any>, DB extends Drizz
4304
4304
  many: Pick<NonNullable<NonNullable<Parameters<DB["query"][key_1]["findMany"]>[0]>>, "where" | "limit">;
4305
4305
  };
4306
4306
  sql: {
4307
- readonly where: _$drizzle_orm0.SQL<unknown> | undefined;
4307
+ readonly where: import("drizzle-orm").SQL<unknown> | undefined;
4308
4308
  };
4309
4309
  };
4310
4310
  };
@@ -4323,7 +4323,7 @@ declare const rumble: <UserContext extends Record<string, any>, DB extends Drizz
4323
4323
  many: Pick<NonNullable<NonNullable<Parameters<DB["query"][key_1]["findMany"]>[0]>>, "where" | "limit">;
4324
4324
  };
4325
4325
  sql: {
4326
- readonly where: _$drizzle_orm0.SQL<unknown> | undefined;
4326
+ readonly where: import("drizzle-orm").SQL<unknown> | undefined;
4327
4327
  };
4328
4328
  } & {
4329
4329
  merge: (p: NonNullable<DrizzleQueryFunctionInput<DB, key_1>>) => {
@@ -4332,7 +4332,7 @@ declare const rumble: <UserContext extends Record<string, any>, DB extends Drizz
4332
4332
  many: Pick<NonNullable<NonNullable<Parameters<DB["query"][key_1]["findMany"]>[0]>>, "where" | "limit">;
4333
4333
  };
4334
4334
  sql: {
4335
- readonly where: _$drizzle_orm0.SQL<unknown> | undefined;
4335
+ readonly where: import("drizzle-orm").SQL<unknown> | undefined;
4336
4336
  };
4337
4337
  };
4338
4338
  };
@@ -4394,7 +4394,7 @@ declare const rumble: <UserContext extends Record<string, any>, DB extends Drizz
4394
4394
  * createYoga({ armorConfig: { maxDepth: { n: 20 } } })
4395
4395
  */
4396
4396
  armorConfig?: Parameters<typeof EnvelopArmorPlugin>[0];
4397
- }) | undefined) => _$graphql_yoga0.YogaServerInstance<RequestEvent, {}>;
4397
+ }) | undefined) => import("graphql-yoga").YogaServerInstance<RequestEvent, {}>;
4398
4398
  /**
4399
4399
  * Creates a sofa instance to offer a REST API.
4400
4400
  *
@@ -4443,7 +4443,7 @@ declare const rumble: <UserContext extends Record<string, any>, DB extends Drizz
4443
4443
  table: TableName;
4444
4444
  refName?: RefName | undefined;
4445
4445
  readAction?: Action | undefined;
4446
- adjust?: ((t: _$_pothos_plugin_drizzle0.DrizzleObjectFieldBuilder<PothosSchemaTypes.ExtendDefaultTypes<{
4446
+ adjust?: ((t: import("@pothos/plugin-drizzle").DrizzleObjectFieldBuilder<PothosSchemaTypes.ExtendDefaultTypes<{
4447
4447
  Context: Awaited<UserContext & {
4448
4448
  abilities: keyof DrizzleQueryFunction<DB> extends infer T_2 extends keyof DrizzleQueryFunction<DB> ? { [key_1 in T_2]: {
4449
4449
  filter: (action: Action) => {
@@ -4452,7 +4452,7 @@ declare const rumble: <UserContext extends Record<string, any>, DB extends Drizz
4452
4452
  many: Pick<NonNullable<NonNullable<Parameters<DB["query"][key_1]["findMany"]>[0]>>, "where" | "limit">;
4453
4453
  };
4454
4454
  sql: {
4455
- readonly where: _$drizzle_orm0.SQL<unknown> | undefined;
4455
+ readonly where: import("drizzle-orm").SQL<unknown> | undefined;
4456
4456
  };
4457
4457
  } & {
4458
4458
  merge: (p: NonNullable<DrizzleQueryFunctionInput<DB, key_1>>) => {
@@ -4461,7 +4461,7 @@ declare const rumble: <UserContext extends Record<string, any>, DB extends Drizz
4461
4461
  many: Pick<NonNullable<NonNullable<Parameters<DB["query"][key_1]["findMany"]>[0]>>, "where" | "limit">;
4462
4462
  };
4463
4463
  sql: {
4464
- readonly where: _$drizzle_orm0.SQL<unknown> | undefined;
4464
+ readonly where: import("drizzle-orm").SQL<unknown> | undefined;
4465
4465
  };
4466
4466
  };
4467
4467
  };
@@ -4505,8 +4505,8 @@ declare const rumble: <UserContext extends Record<string, any>, DB extends Drizz
4505
4505
  _: {
4506
4506
  brand: "Table";
4507
4507
  };
4508
- }>["_"]["columns"][Key]["_"]["data"] | null } extends infer T_3 ? { [K in keyof T_3]: T_3[K] } : never>) => _$_pothos_core0.FieldMap) | undefined;
4509
- }) => _$_pothos_plugin_drizzle0.DrizzleObjectRef<PothosSchemaTypes.ExtendDefaultTypes<{
4508
+ }>["_"]["columns"][Key]["_"]["data"] | null } extends infer T_3 ? { [K in keyof T_3]: T_3[K] } : never>) => import("@pothos/core").FieldMap) | undefined;
4509
+ }) => import("@pothos/plugin-drizzle").DrizzleObjectRef<PothosSchemaTypes.ExtendDefaultTypes<{
4510
4510
  Context: Awaited<UserContext & {
4511
4511
  abilities: keyof DrizzleQueryFunction<DB> extends infer T_2 extends keyof DrizzleQueryFunction<DB> ? { [key_1 in T_2]: {
4512
4512
  filter: (action: Action) => {
@@ -4515,7 +4515,7 @@ declare const rumble: <UserContext extends Record<string, any>, DB extends Drizz
4515
4515
  many: Pick<NonNullable<NonNullable<Parameters<DB["query"][key_1]["findMany"]>[0]>>, "where" | "limit">;
4516
4516
  };
4517
4517
  sql: {
4518
- readonly where: _$drizzle_orm0.SQL<unknown> | undefined;
4518
+ readonly where: import("drizzle-orm").SQL<unknown> | undefined;
4519
4519
  };
4520
4520
  } & {
4521
4521
  merge: (p: NonNullable<DrizzleQueryFunctionInput<DB, key_1>>) => {
@@ -4524,7 +4524,7 @@ declare const rumble: <UserContext extends Record<string, any>, DB extends Drizz
4524
4524
  many: Pick<NonNullable<NonNullable<Parameters<DB["query"][key_1]["findMany"]>[0]>>, "where" | "limit">;
4525
4525
  };
4526
4526
  sql: {
4527
- readonly where: _$drizzle_orm0.SQL<unknown> | undefined;
4527
+ readonly where: import("drizzle-orm").SQL<unknown> | undefined;
4528
4528
  };
4529
4529
  };
4530
4530
  };
@@ -4552,9 +4552,9 @@ declare const rumble: <UserContext extends Record<string, any>, DB extends Drizz
4552
4552
  DateWhereInputArgument: DateWhereInputArgument;
4553
4553
  };
4554
4554
  DefaultFieldNullability: false;
4555
- }>, TableName, _$drizzle_orm0.BuildQueryResult<DB["_"]["relations"] & {}, (DB["_"]["relations"] & {})[TableName], true extends true | _$drizzle_orm0.DBQueryConfig<"one", DB["_"]["relations"] & {}, (DB["_"]["relations"] & {})[TableName]> ? true : (true | _$drizzle_orm0.DBQueryConfig<"one", DB["_"]["relations"] & {}, (DB["_"]["relations"] & {})[TableName]>) & {
4555
+ }>, TableName, import("drizzle-orm").BuildQueryResult<DB["_"]["relations"] & {}, (DB["_"]["relations"] & {})[TableName], true extends true | import("drizzle-orm").DBQueryConfig<"one", DB["_"]["relations"] & {}, (DB["_"]["relations"] & {})[TableName]> ? true : (true | import("drizzle-orm").DBQueryConfig<"one", DB["_"]["relations"] & {}, (DB["_"]["relations"] & {})[TableName]>) & {
4556
4556
  columns: {};
4557
- }, _$drizzle_orm0.Assume<(DB["_"]["relations"] & {})[TableName]["table"], {
4557
+ }, import("drizzle-orm").Assume<(DB["_"]["relations"] & {})[TableName]["table"], {
4558
4558
  $inferSelect: Record<string, unknown>;
4559
4559
  }>["$inferSelect"]>>;
4560
4560
  /**
@@ -4581,7 +4581,7 @@ declare const rumble: <UserContext extends Record<string, any>, DB extends Drizz
4581
4581
  many: Pick<NonNullable<NonNullable<Parameters<DB["query"][key_1]["findMany"]>[0]>>, "where" | "limit">;
4582
4582
  };
4583
4583
  sql: {
4584
- readonly where: _$drizzle_orm0.SQL<unknown> | undefined;
4584
+ readonly where: import("drizzle-orm").SQL<unknown> | undefined;
4585
4585
  };
4586
4586
  } & {
4587
4587
  merge: (p: NonNullable<DrizzleQueryFunctionInput<DB, key_1>>) => {
@@ -4590,7 +4590,7 @@ declare const rumble: <UserContext extends Record<string, any>, DB extends Drizz
4590
4590
  many: Pick<NonNullable<NonNullable<Parameters<DB["query"][key_1]["findMany"]>[0]>>, "where" | "limit">;
4591
4591
  };
4592
4592
  sql: {
4593
- readonly where: _$drizzle_orm0.SQL<unknown> | undefined;
4593
+ readonly where: import("drizzle-orm").SQL<unknown> | undefined;
4594
4594
  };
4595
4595
  };
4596
4596
  };
@@ -4645,7 +4645,7 @@ declare const rumble: <UserContext extends Record<string, any>, DB extends Drizz
4645
4645
  many: Pick<NonNullable<NonNullable<Parameters<DB["query"][key_1]["findMany"]>[0]>>, "where" | "limit">;
4646
4646
  };
4647
4647
  sql: {
4648
- readonly where: _$drizzle_orm0.SQL<unknown> | undefined;
4648
+ readonly where: import("drizzle-orm").SQL<unknown> | undefined;
4649
4649
  };
4650
4650
  } & {
4651
4651
  merge: (p: NonNullable<DrizzleQueryFunctionInput<DB, key_1>>) => {
@@ -4654,7 +4654,7 @@ declare const rumble: <UserContext extends Record<string, any>, DB extends Drizz
4654
4654
  many: Pick<NonNullable<NonNullable<Parameters<DB["query"][key_1]["findMany"]>[0]>>, "where" | "limit">;
4655
4655
  };
4656
4656
  sql: {
4657
- readonly where: _$drizzle_orm0.SQL<unknown> | undefined;
4657
+ readonly where: import("drizzle-orm").SQL<unknown> | undefined;
4658
4658
  };
4659
4659
  };
4660
4660
  };
@@ -4726,28 +4726,30 @@ declare const rumble: <UserContext extends Record<string, any>, DB extends Drizz
4726
4726
  * The other helpers use this helper internally so in most cases you do not have to
4727
4727
  * call this helper directly, unless you need the reference to an enum type
4728
4728
  */
4729
- enum_: <ExplicitEnumVariableName extends keyof (NonNullable<DB["_"]["fullSchema"]> extends infer T_2 ? { [K in keyof T_2 as NonNullable<DB["_"]["fullSchema"]>[K] extends _$drizzle_orm_pg_core0.PgEnum<any> ? K : never]: T_2[K] } : never), EnumColumn extends _$drizzle_orm_pg_core0.PgEnum<any>, RefName_2 extends string>({
4730
- tsName,
4731
- enumColumn,
4732
- refName
4733
- }: Partial<{
4734
- tsName: ExplicitEnumVariableName;
4735
- enumColumn: EnumColumn;
4729
+ enum_: <TsName extends keyof { [K in keyof Schema as Schema[K] extends import("drizzle-orm/pg-core").PgEnum<any> | import("drizzle-orm/pg-core").PgEnumObject<any> ? K : never]: Schema[K] }, EnumColumn extends import("drizzle-orm").Column, RefName_2 extends string>(args: {
4736
4730
  refName?: RefName_2 | undefined;
4737
- }> & ({
4738
- tsName: ExplicitEnumVariableName;
4731
+ } & ({
4732
+ enum: import("drizzle-orm/pg-core").PgEnum<any> | import("drizzle-orm/pg-core").PgEnumObject<any>;
4733
+ tsName?: never;
4734
+ enumColumn?: never;
4735
+ } | {
4736
+ tsName: TsName;
4737
+ enum?: never;
4738
+ enumColumn?: never;
4739
4739
  } | {
4740
4740
  enumColumn: EnumColumn;
4741
+ tsName?: never;
4742
+ enum?: never;
4741
4743
  })) => PothosSchemaTypes.EnumRef<PothosSchemaTypes.ExtendDefaultTypes<{
4742
4744
  Context: Awaited<UserContext & {
4743
- abilities: keyof DrizzleQueryFunction<DB> extends infer T_3 extends keyof DrizzleQueryFunction<DB> ? { [key_1 in T_3]: {
4745
+ abilities: keyof DrizzleQueryFunction<DB> extends infer T_2 extends keyof DrizzleQueryFunction<DB> ? { [key_1 in T_2]: {
4744
4746
  filter: (action: Action) => {
4745
4747
  query: {
4746
4748
  single: Pick<NonNullable<NonNullable<Parameters<DB["query"][key_1]["findFirst"]>[0]>>, "where">;
4747
4749
  many: Pick<NonNullable<NonNullable<Parameters<DB["query"][key_1]["findMany"]>[0]>>, "where" | "limit">;
4748
4750
  };
4749
4751
  sql: {
4750
- readonly where: _$drizzle_orm0.SQL<unknown> | undefined;
4752
+ readonly where: import("drizzle-orm").SQL<unknown> | undefined;
4751
4753
  };
4752
4754
  } & {
4753
4755
  merge: (p: NonNullable<DrizzleQueryFunctionInput<DB, key_1>>) => {
@@ -4756,7 +4758,7 @@ declare const rumble: <UserContext extends Record<string, any>, DB extends Drizz
4756
4758
  many: Pick<NonNullable<NonNullable<Parameters<DB["query"][key_1]["findMany"]>[0]>>, "where" | "limit">;
4757
4759
  };
4758
4760
  sql: {
4759
- readonly where: _$drizzle_orm0.SQL<unknown> | undefined;
4761
+ readonly where: import("drizzle-orm").SQL<unknown> | undefined;
4760
4762
  };
4761
4763
  };
4762
4764
  };
@@ -4823,7 +4825,7 @@ declare const rumble: <UserContext extends Record<string, any>, DB extends Drizz
4823
4825
  * When calling this function, the schema will be built for the first time and cached for later usage. So you can call this function multiple times without performance issues.
4824
4826
  * After calling, you cannot adjust the schema via the schema builder
4825
4827
  */
4826
- buildSchema: () => _$graphql.GraphQLSchema;
4828
+ buildSchema: () => import("graphql").GraphQLSchema;
4827
4829
  };
4828
4830
  //#endregion
4829
4831
  //#region lib/types/rumbleError.d.ts