@vantreeseba/drizzle-graphql 9.1.1 → 10.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -6,7 +6,6 @@ import "drizzle-orm/pg-core/query-builders/query";
6
6
  import { SQLiteAsyncDatabase } from "drizzle-orm/sqlite-core";
7
7
  import "drizzle-orm/sqlite-core/query-builders/query";
8
8
  import { ASTNode, GraphQLEnumType, GraphQLError, GraphQLFieldResolver, GraphQLInputObjectType, GraphQLInputType, GraphQLList, GraphQLNonNull, GraphQLObjectType, GraphQLOutputType, GraphQLResolveInfo, GraphQLScalarType, GraphQLSchema } from "graphql";
9
- import { ResolveTree } from "graphql-parse-resolve-info";
10
9
  import { GraphQLDate, GraphQLDateTime, GraphQLJSON, GraphQLUUID } from "graphql-scalars";
11
10
  //#region src/util/extensions.d.ts
12
11
  /**
@@ -160,6 +159,8 @@ type DrizzleErrorCode =
160
159
  'DRIZZLE_INVALID_ON_CONFLICT' |
161
160
  /** A written value could not be converted to what its column stores. */
162
161
  'DRIZZLE_INVALID_INPUT_VALUE' |
162
+ /** An update's `set` gave a column that cannot hold null an explicit null. */
163
+ 'DRIZZLE_NOT_NULL' |
163
164
  /** A write's input named a key that is not a column of the table. */
164
165
  'DRIZZLE_UNKNOWN_COLUMN' |
165
166
  /** A stored value could not be represented by the scalar that transports it. */
@@ -612,6 +613,53 @@ type TablePolicies = {
612
613
  defaultOrderBy?: DefaultOrderByFor;
613
614
  };
614
615
  //#endregion
616
+ //#region src/util/parse-resolve-info.d.ts
617
+ /**
618
+ * The selections made against one concrete type, keyed by the *response key* — the field's
619
+ * alias when it has one, otherwise its name. A selection spanning an abstract type has one
620
+ * entry per type condition it was written against (the interface or union itself included,
621
+ * when fields were selected directly on it).
622
+ */
623
+ interface FieldsByTypeName {
624
+ [typeName: string]: {
625
+ [responseKey: string]: ResolveTree;
626
+ };
627
+ }
628
+ /** One selected field: what was asked for, under what alias, with which arguments. */
629
+ interface ResolveTree {
630
+ /** The field name as declared in the schema. */
631
+ name: string;
632
+ /** The response key — the alias when the selection carried one, otherwise `name`. */
633
+ alias: string;
634
+ /** The field's arguments, coerced by graphql's own `getArgumentValues`. */
635
+ args: {
636
+ [argName: string]: unknown;
637
+ };
638
+ /** The field's own sub-selections, keyed by the type they were written against. */
639
+ fieldsByTypeName: FieldsByTypeName;
640
+ }
641
+ /** Options accepted by {@link parseResolveInfo}. */
642
+ interface ParseResolveInfoOptions {
643
+ /**
644
+ * Whether to descend into sub-selections and fragments. Defaults to `true`; `false` reads
645
+ * only the root field's own name, alias and arguments.
646
+ */
647
+ deep?: boolean;
648
+ }
649
+ /**
650
+ * Reads the selection under a resolver's own field out of its `info`, as a tree of
651
+ * {@link ResolveTree} nodes.
652
+ *
653
+ * ```ts
654
+ * const parsed = parseResolveInfo(info, { deep: true })!;
655
+ * const selected = parsed.fieldsByTypeName['Users']; // keyed by response key
656
+ * ```
657
+ *
658
+ * Returns `undefined` when the resolver's field produced no node at all, which in practice
659
+ * means `info` carried no field nodes.
660
+ */
661
+ declare const parseResolveInfo: (info: GraphQLResolveInfo, options?: ParseResolveInfoOptions) => ResolveTree | undefined;
662
+ //#endregion
615
663
  //#region src/util/builders/common/order-by.d.ts
616
664
  /**
617
665
  * Compiles an `orderBy` argument into ORDER BY expressions, highest priority first.
@@ -2128,5 +2176,5 @@ declare const resolveSelection: (info: GraphQLResolveInfo | ResolveTree, options
2128
2176
  //#region src/index.d.ts
2129
2177
  declare const buildSchema: <TDbClient extends AnyDrizzleDB<any>>(db: TDbClient, config?: BuildSchemaConfig) => GeneratedData<TDbClient>;
2130
2178
  //#endregion
2131
- export { type AggregateResolver, type AnyDrizzleDB, type BuildSchemaConfig, type ColumnDeprecator, type ColumnDescriber, type ColumnDocInfo, type ColumnTypeMapper, type ColumnTypeMapperInfo, type ComplexityConfig, type ContextValuesConfig, type DefaultOrderByEntry, type DefaultsConfig, type DeleteResolver, type DeleteSingleResolver, type DerivedTypeNameMapper, type DrizzleErrorCode, type DrizzleErrorContext, type DrizzleExtension, type DrizzleFieldExtension, type DrizzleFieldKind, type DrizzleFieldOperation, type DrizzleTargetArg, type DrizzleTypeExtension, type EnumNameInfo, type EnumNameMapper, type ExtractRelations, type ExtractTableByName, type ExtractTableRelations, type ExtractTables, type FeatureSwitch, type GeneratedData, type GeneratedEntities, type GeneratedInputs, type GeneratedOutputs, type GeneratedTypeInfo, type GeneratedTypeKind, GraphQLBigIntString, GraphQLDate, GraphQLDateTime, GraphQLDecimalString, GraphQLJSON, GraphQLUUID, type IdentifiedRows, type InsertArrResolver, type InsertResolver, type LimitsConfig, type MutationReturnlessResult, type MutationsCore, type OnWriteConfig, type QueriesCore, type RelationDescriber, type RelationResolverFactory, type ResolveSelectionOptions, type RowScope, type RowScopeFilter, type ScalarOverride, type ScalarOverridesConfig, type SchemaDocs, type SchemaExclusions, type SchemaFeatures, type ScopeConfig, type SelectResolver, type SelectSingleResolver, type SelectionOptions, type SoftDeleteColumn, type SoftDeleteConfig, type TableDefaults, type TableDescriber, type TableLimitPolicy, type TableNamedRelations, type TypeNameMapper, type UpdateManyArgs, type UpdateManyEntry, type UpdateManyResolver, type UpdateResolver, type UpdateSingleResolver, type UpsertArgs, type UpsertArrResolver, type UpsertConflictArgs, type UpsertResolver, type WriteHook, type WriteHookPayload, type WriteHookPositions, type WriteHooks, type WriteOperation, buildSchema, createRelationResolverFactory, defaultErrorMapper, drizzleError, drizzleExecutorKey, drizzleExtension, extractFilters, extractOrderBy, extractRelationJoinColumns, identifyRows, isDrizzleFieldExtension, resolveSelection, selectionToWith, singularizeMapper };
2179
+ export { type AggregateResolver, type AnyDrizzleDB, type BuildSchemaConfig, type ColumnDeprecator, type ColumnDescriber, type ColumnDocInfo, type ColumnTypeMapper, type ColumnTypeMapperInfo, type ComplexityConfig, type ContextValuesConfig, type DefaultOrderByEntry, type DefaultsConfig, type DeleteResolver, type DeleteSingleResolver, type DerivedTypeNameMapper, type DrizzleErrorCode, type DrizzleErrorContext, type DrizzleExtension, type DrizzleFieldExtension, type DrizzleFieldKind, type DrizzleFieldOperation, type DrizzleTargetArg, type DrizzleTypeExtension, type EnumNameInfo, type EnumNameMapper, type ExtractRelations, type ExtractTableByName, type ExtractTableRelations, type ExtractTables, type FeatureSwitch, type FieldsByTypeName, type GeneratedData, type GeneratedEntities, type GeneratedInputs, type GeneratedOutputs, type GeneratedTypeInfo, type GeneratedTypeKind, GraphQLBigIntString, GraphQLDate, GraphQLDateTime, GraphQLDecimalString, GraphQLJSON, GraphQLUUID, type IdentifiedRows, type InsertArrResolver, type InsertResolver, type LimitsConfig, type MutationReturnlessResult, type MutationsCore, type OnWriteConfig, type ParseResolveInfoOptions, type QueriesCore, type RelationDescriber, type RelationResolverFactory, type ResolveSelectionOptions, type ResolveTree, type RowScope, type RowScopeFilter, type ScalarOverride, type ScalarOverridesConfig, type SchemaDocs, type SchemaExclusions, type SchemaFeatures, type ScopeConfig, type SelectResolver, type SelectSingleResolver, type SelectionOptions, type SoftDeleteColumn, type SoftDeleteConfig, type TableDefaults, type TableDescriber, type TableLimitPolicy, type TableNamedRelations, type TypeNameMapper, type UpdateManyArgs, type UpdateManyEntry, type UpdateManyResolver, type UpdateResolver, type UpdateSingleResolver, type UpsertArgs, type UpsertArrResolver, type UpsertConflictArgs, type UpsertResolver, type WriteHook, type WriteHookPayload, type WriteHookPositions, type WriteHooks, type WriteOperation, buildSchema, createRelationResolverFactory, defaultErrorMapper, drizzleError, drizzleExecutorKey, drizzleExtension, extractFilters, extractOrderBy, extractRelationJoinColumns, identifyRows, isDrizzleFieldExtension, parseResolveInfo, resolveSelection, selectionToWith, singularizeMapper };
2132
2180
  //# sourceMappingURL=index.d.cts.map
package/dist/index.d.ts CHANGED
@@ -4,7 +4,6 @@ import { PgAsyncDatabase } from "drizzle-orm/pg-core";
4
4
  import { SQLiteAsyncDatabase } from "drizzle-orm/sqlite-core";
5
5
  import { ASTNode, GraphQLEnumType, GraphQLError, GraphQLFieldResolver, GraphQLInputObjectType, GraphQLInputType, GraphQLList, GraphQLNonNull, GraphQLObjectType, GraphQLOutputType, GraphQLResolveInfo, GraphQLScalarType, GraphQLSchema } from "graphql";
6
6
  import { GraphQLDate, GraphQLDateTime, GraphQLJSON, GraphQLUUID } from "graphql-scalars";
7
- import { ResolveTree } from "graphql-parse-resolve-info";
8
7
  import "drizzle-orm/mysql-core/query-builders/query";
9
8
  import "drizzle-orm/pg-core/query-builders/query";
10
9
  import "drizzle-orm/sqlite-core/query-builders/query";
@@ -160,6 +159,8 @@ type DrizzleErrorCode =
160
159
  'DRIZZLE_INVALID_ON_CONFLICT' |
161
160
  /** A written value could not be converted to what its column stores. */
162
161
  'DRIZZLE_INVALID_INPUT_VALUE' |
162
+ /** An update's `set` gave a column that cannot hold null an explicit null. */
163
+ 'DRIZZLE_NOT_NULL' |
163
164
  /** A write's input named a key that is not a column of the table. */
164
165
  'DRIZZLE_UNKNOWN_COLUMN' |
165
166
  /** A stored value could not be represented by the scalar that transports it. */
@@ -612,6 +613,53 @@ type TablePolicies = {
612
613
  defaultOrderBy?: DefaultOrderByFor;
613
614
  };
614
615
  //#endregion
616
+ //#region src/util/parse-resolve-info.d.ts
617
+ /**
618
+ * The selections made against one concrete type, keyed by the *response key* — the field's
619
+ * alias when it has one, otherwise its name. A selection spanning an abstract type has one
620
+ * entry per type condition it was written against (the interface or union itself included,
621
+ * when fields were selected directly on it).
622
+ */
623
+ interface FieldsByTypeName {
624
+ [typeName: string]: {
625
+ [responseKey: string]: ResolveTree;
626
+ };
627
+ }
628
+ /** One selected field: what was asked for, under what alias, with which arguments. */
629
+ interface ResolveTree {
630
+ /** The field name as declared in the schema. */
631
+ name: string;
632
+ /** The response key — the alias when the selection carried one, otherwise `name`. */
633
+ alias: string;
634
+ /** The field's arguments, coerced by graphql's own `getArgumentValues`. */
635
+ args: {
636
+ [argName: string]: unknown;
637
+ };
638
+ /** The field's own sub-selections, keyed by the type they were written against. */
639
+ fieldsByTypeName: FieldsByTypeName;
640
+ }
641
+ /** Options accepted by {@link parseResolveInfo}. */
642
+ interface ParseResolveInfoOptions {
643
+ /**
644
+ * Whether to descend into sub-selections and fragments. Defaults to `true`; `false` reads
645
+ * only the root field's own name, alias and arguments.
646
+ */
647
+ deep?: boolean;
648
+ }
649
+ /**
650
+ * Reads the selection under a resolver's own field out of its `info`, as a tree of
651
+ * {@link ResolveTree} nodes.
652
+ *
653
+ * ```ts
654
+ * const parsed = parseResolveInfo(info, { deep: true })!;
655
+ * const selected = parsed.fieldsByTypeName['Users']; // keyed by response key
656
+ * ```
657
+ *
658
+ * Returns `undefined` when the resolver's field produced no node at all, which in practice
659
+ * means `info` carried no field nodes.
660
+ */
661
+ declare const parseResolveInfo: (info: GraphQLResolveInfo, options?: ParseResolveInfoOptions) => ResolveTree | undefined;
662
+ //#endregion
615
663
  //#region src/util/builders/common/order-by.d.ts
616
664
  /**
617
665
  * Compiles an `orderBy` argument into ORDER BY expressions, highest priority first.
@@ -2128,5 +2176,5 @@ declare const resolveSelection: (info: GraphQLResolveInfo | ResolveTree, options
2128
2176
  //#region src/index.d.ts
2129
2177
  declare const buildSchema: <TDbClient extends AnyDrizzleDB<any>>(db: TDbClient, config?: BuildSchemaConfig) => GeneratedData<TDbClient>;
2130
2178
  //#endregion
2131
- export { type AggregateResolver, type AnyDrizzleDB, type BuildSchemaConfig, type ColumnDeprecator, type ColumnDescriber, type ColumnDocInfo, type ColumnTypeMapper, type ColumnTypeMapperInfo, type ComplexityConfig, type ContextValuesConfig, type DefaultOrderByEntry, type DefaultsConfig, type DeleteResolver, type DeleteSingleResolver, type DerivedTypeNameMapper, type DrizzleErrorCode, type DrizzleErrorContext, type DrizzleExtension, type DrizzleFieldExtension, type DrizzleFieldKind, type DrizzleFieldOperation, type DrizzleTargetArg, type DrizzleTypeExtension, type EnumNameInfo, type EnumNameMapper, type ExtractRelations, type ExtractTableByName, type ExtractTableRelations, type ExtractTables, type FeatureSwitch, type GeneratedData, type GeneratedEntities, type GeneratedInputs, type GeneratedOutputs, type GeneratedTypeInfo, type GeneratedTypeKind, GraphQLBigIntString, GraphQLDate, GraphQLDateTime, GraphQLDecimalString, GraphQLJSON, GraphQLUUID, type IdentifiedRows, type InsertArrResolver, type InsertResolver, type LimitsConfig, type MutationReturnlessResult, type MutationsCore, type OnWriteConfig, type QueriesCore, type RelationDescriber, type RelationResolverFactory, type ResolveSelectionOptions, type RowScope, type RowScopeFilter, type ScalarOverride, type ScalarOverridesConfig, type SchemaDocs, type SchemaExclusions, type SchemaFeatures, type ScopeConfig, type SelectResolver, type SelectSingleResolver, type SelectionOptions, type SoftDeleteColumn, type SoftDeleteConfig, type TableDefaults, type TableDescriber, type TableLimitPolicy, type TableNamedRelations, type TypeNameMapper, type UpdateManyArgs, type UpdateManyEntry, type UpdateManyResolver, type UpdateResolver, type UpdateSingleResolver, type UpsertArgs, type UpsertArrResolver, type UpsertConflictArgs, type UpsertResolver, type WriteHook, type WriteHookPayload, type WriteHookPositions, type WriteHooks, type WriteOperation, buildSchema, createRelationResolverFactory, defaultErrorMapper, drizzleError, drizzleExecutorKey, drizzleExtension, extractFilters, extractOrderBy, extractRelationJoinColumns, identifyRows, isDrizzleFieldExtension, resolveSelection, selectionToWith, singularizeMapper };
2179
+ export { type AggregateResolver, type AnyDrizzleDB, type BuildSchemaConfig, type ColumnDeprecator, type ColumnDescriber, type ColumnDocInfo, type ColumnTypeMapper, type ColumnTypeMapperInfo, type ComplexityConfig, type ContextValuesConfig, type DefaultOrderByEntry, type DefaultsConfig, type DeleteResolver, type DeleteSingleResolver, type DerivedTypeNameMapper, type DrizzleErrorCode, type DrizzleErrorContext, type DrizzleExtension, type DrizzleFieldExtension, type DrizzleFieldKind, type DrizzleFieldOperation, type DrizzleTargetArg, type DrizzleTypeExtension, type EnumNameInfo, type EnumNameMapper, type ExtractRelations, type ExtractTableByName, type ExtractTableRelations, type ExtractTables, type FeatureSwitch, type FieldsByTypeName, type GeneratedData, type GeneratedEntities, type GeneratedInputs, type GeneratedOutputs, type GeneratedTypeInfo, type GeneratedTypeKind, GraphQLBigIntString, GraphQLDate, GraphQLDateTime, GraphQLDecimalString, GraphQLJSON, GraphQLUUID, type IdentifiedRows, type InsertArrResolver, type InsertResolver, type LimitsConfig, type MutationReturnlessResult, type MutationsCore, type OnWriteConfig, type ParseResolveInfoOptions, type QueriesCore, type RelationDescriber, type RelationResolverFactory, type ResolveSelectionOptions, type ResolveTree, type RowScope, type RowScopeFilter, type ScalarOverride, type ScalarOverridesConfig, type SchemaDocs, type SchemaExclusions, type SchemaFeatures, type ScopeConfig, type SelectResolver, type SelectSingleResolver, type SelectionOptions, type SoftDeleteColumn, type SoftDeleteConfig, type TableDefaults, type TableDescriber, type TableLimitPolicy, type TableNamedRelations, type TypeNameMapper, type UpdateManyArgs, type UpdateManyEntry, type UpdateManyResolver, type UpdateResolver, type UpdateSingleResolver, type UpsertArgs, type UpsertArrResolver, type UpsertConflictArgs, type UpsertResolver, type WriteHook, type WriteHookPayload, type WriteHookPositions, type WriteHooks, type WriteOperation, buildSchema, createRelationResolverFactory, defaultErrorMapper, drizzleError, drizzleExecutorKey, drizzleExtension, extractFilters, extractOrderBy, extractRelationJoinColumns, identifyRows, isDrizzleFieldExtension, parseResolveInfo, resolveSelection, selectionToWith, singularizeMapper };
2132
2180
  //# sourceMappingURL=index.d.ts.map