@gqloom/core 0.9.4 → 0.9.6

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.
@@ -129,6 +129,14 @@ interface CallableInputParser<TSchema extends GraphQLSilk | Record<string, Graph
129
129
  * Parse the input and return the result
130
130
  */
131
131
  getResult(): Promise<InferInputO<TSchema>>;
132
+ /**
133
+ * Set the result's value of parsing
134
+ */
135
+ setResult(value: InferInputO<TSchema>): void;
136
+ /**
137
+ * Clear the result of parsing, the parser will run again to get the result.
138
+ */
139
+ clearResult(): void;
132
140
  }
133
141
  declare function createInputParser<TSchema extends GraphQLSilk | Record<string, GraphQLSilk> | void>(schema: TSchema, value: InferInputI<TSchema>): CallableInputParser<TSchema>;
134
142
  declare function parseInputValue<TSchema extends GraphQLSilk | Record<string, GraphQLSilk> | void>(inputSchema: TSchema, input: any): MayPromise<StandardSchemaV1.Result<InferInputO<TSchema>>>;
@@ -426,27 +434,30 @@ interface SubscriptionNeedResolve<TOutput extends GraphQLSilk, TInput extends Gr
426
434
  resolve(resolve: (value: TValue, input: InferInputO<TInput>, payload: ResolverPayload | undefined) => MayPromise<StandardSchemaV1.InferOutput<TOutput>>): Subscription<TOutput, TInput, TValue>;
427
435
  }
428
436
  declare class QueryFactoryWithResolve<TInputO, TOutput extends GraphQLSilk, TInput extends GraphQLSilk<TInputO>> extends BaseChainFactory<Query<TOutput, TInput>> implements Query<TOutput, TInput> {
429
- protected output: TOutput;
437
+ protected outputSilk: TOutput;
430
438
  protected readonly options: QueryOptions<TOutput, TInput>;
431
439
  get "~meta"(): Query<TOutput, TInput>["~meta"];
432
- constructor(output: TOutput, options: QueryOptions<TOutput, TInput>);
440
+ constructor(outputSilk: TOutput, options: QueryOptions<TOutput, TInput>);
433
441
  protected clone(options?: Partial<typeof this.options> | undefined): this;
434
442
  input<TInputNew extends GraphQLSilk<TInputO>>(input: TInputNew): QueryFactoryWithResolve<TInputO, TOutput, TInputNew>;
443
+ output<TOutputNew extends GraphQLSilk>(output: TOutputNew, transform: (output: StandardSchemaV1.InferOutput<TOutput>) => MayPromise<StandardSchemaV1.InferOutput<TOutputNew>>): QueryFactoryWithResolve<TInputO, TOutputNew, TInput>;
435
444
  }
436
445
  declare class MutationFactoryWithResolve<TInputO, TOutput extends GraphQLSilk, TInput extends GraphQLSilk<TInputO>> extends BaseChainFactory<Query<TOutput, TInput>> implements Mutation<TOutput, TInput> {
437
- protected output: TOutput;
446
+ protected outputSilk: TOutput;
438
447
  protected readonly options: MutationOptions<TOutput, TInput>;
439
448
  get "~meta"(): Mutation<TOutput, TInput>["~meta"];
440
- constructor(output: TOutput, options: MutationOptions<TOutput, TInput>);
449
+ constructor(outputSilk: TOutput, options: MutationOptions<TOutput, TInput>);
441
450
  protected clone(options?: Partial<typeof this.options> | undefined): this;
442
451
  input<TInputNew extends GraphQLSilk<TInputO>>(input: TInputNew): MutationFactoryWithResolve<TInputO, TOutput, TInputNew>;
452
+ output<TOutputNew extends GraphQLSilk>(output: TOutputNew, transform: (output: StandardSchemaV1.InferOutput<TOutput>) => MayPromise<StandardSchemaV1.InferOutput<TOutputNew>>): MutationFactoryWithResolve<TInputO, TOutputNew, TInput>;
443
453
  }
444
454
  declare class FieldFactoryWithResolve<TParent extends GraphQLSilk, TOutput extends GraphQLSilk> extends BaseChainFactory<Field<TParent, TOutput, undefined, string[] | undefined>> {
445
- protected output: TOutput;
455
+ protected outputSilk: TOutput;
446
456
  protected readonly options: FieldOptions<TParent, TOutput, undefined, string[] | undefined>;
447
457
  get "~meta"(): Field<TParent, TOutput, undefined, string[] | undefined>["~meta"];
448
- constructor(output: TOutput, options: FieldOptions<TParent, TOutput, undefined, string[] | undefined>);
458
+ constructor(outputSilk: TOutput, options: FieldOptions<TParent, TOutput, undefined, string[] | undefined>);
449
459
  protected clone(options?: Partial<typeof this.options> | undefined): this;
460
+ output<TOutputNew extends GraphQLSilk>(output: TOutputNew, transform: (output: StandardSchemaV1.InferOutput<TOutput>) => MayPromise<StandardSchemaV1.InferOutput<TOutputNew>>): FieldFactoryWithResolve<TParent, TOutputNew>;
450
461
  }
451
462
 
452
463
  interface FieldMeta extends GraphQLFieldOptions {
@@ -129,6 +129,14 @@ interface CallableInputParser<TSchema extends GraphQLSilk | Record<string, Graph
129
129
  * Parse the input and return the result
130
130
  */
131
131
  getResult(): Promise<InferInputO<TSchema>>;
132
+ /**
133
+ * Set the result's value of parsing
134
+ */
135
+ setResult(value: InferInputO<TSchema>): void;
136
+ /**
137
+ * Clear the result of parsing, the parser will run again to get the result.
138
+ */
139
+ clearResult(): void;
132
140
  }
133
141
  declare function createInputParser<TSchema extends GraphQLSilk | Record<string, GraphQLSilk> | void>(schema: TSchema, value: InferInputI<TSchema>): CallableInputParser<TSchema>;
134
142
  declare function parseInputValue<TSchema extends GraphQLSilk | Record<string, GraphQLSilk> | void>(inputSchema: TSchema, input: any): MayPromise<StandardSchemaV1.Result<InferInputO<TSchema>>>;
@@ -426,27 +434,30 @@ interface SubscriptionNeedResolve<TOutput extends GraphQLSilk, TInput extends Gr
426
434
  resolve(resolve: (value: TValue, input: InferInputO<TInput>, payload: ResolverPayload | undefined) => MayPromise<StandardSchemaV1.InferOutput<TOutput>>): Subscription<TOutput, TInput, TValue>;
427
435
  }
428
436
  declare class QueryFactoryWithResolve<TInputO, TOutput extends GraphQLSilk, TInput extends GraphQLSilk<TInputO>> extends BaseChainFactory<Query<TOutput, TInput>> implements Query<TOutput, TInput> {
429
- protected output: TOutput;
437
+ protected outputSilk: TOutput;
430
438
  protected readonly options: QueryOptions<TOutput, TInput>;
431
439
  get "~meta"(): Query<TOutput, TInput>["~meta"];
432
- constructor(output: TOutput, options: QueryOptions<TOutput, TInput>);
440
+ constructor(outputSilk: TOutput, options: QueryOptions<TOutput, TInput>);
433
441
  protected clone(options?: Partial<typeof this.options> | undefined): this;
434
442
  input<TInputNew extends GraphQLSilk<TInputO>>(input: TInputNew): QueryFactoryWithResolve<TInputO, TOutput, TInputNew>;
443
+ output<TOutputNew extends GraphQLSilk>(output: TOutputNew, transform: (output: StandardSchemaV1.InferOutput<TOutput>) => MayPromise<StandardSchemaV1.InferOutput<TOutputNew>>): QueryFactoryWithResolve<TInputO, TOutputNew, TInput>;
435
444
  }
436
445
  declare class MutationFactoryWithResolve<TInputO, TOutput extends GraphQLSilk, TInput extends GraphQLSilk<TInputO>> extends BaseChainFactory<Query<TOutput, TInput>> implements Mutation<TOutput, TInput> {
437
- protected output: TOutput;
446
+ protected outputSilk: TOutput;
438
447
  protected readonly options: MutationOptions<TOutput, TInput>;
439
448
  get "~meta"(): Mutation<TOutput, TInput>["~meta"];
440
- constructor(output: TOutput, options: MutationOptions<TOutput, TInput>);
449
+ constructor(outputSilk: TOutput, options: MutationOptions<TOutput, TInput>);
441
450
  protected clone(options?: Partial<typeof this.options> | undefined): this;
442
451
  input<TInputNew extends GraphQLSilk<TInputO>>(input: TInputNew): MutationFactoryWithResolve<TInputO, TOutput, TInputNew>;
452
+ output<TOutputNew extends GraphQLSilk>(output: TOutputNew, transform: (output: StandardSchemaV1.InferOutput<TOutput>) => MayPromise<StandardSchemaV1.InferOutput<TOutputNew>>): MutationFactoryWithResolve<TInputO, TOutputNew, TInput>;
443
453
  }
444
454
  declare class FieldFactoryWithResolve<TParent extends GraphQLSilk, TOutput extends GraphQLSilk> extends BaseChainFactory<Field<TParent, TOutput, undefined, string[] | undefined>> {
445
- protected output: TOutput;
455
+ protected outputSilk: TOutput;
446
456
  protected readonly options: FieldOptions<TParent, TOutput, undefined, string[] | undefined>;
447
457
  get "~meta"(): Field<TParent, TOutput, undefined, string[] | undefined>["~meta"];
448
- constructor(output: TOutput, options: FieldOptions<TParent, TOutput, undefined, string[] | undefined>);
458
+ constructor(outputSilk: TOutput, options: FieldOptions<TParent, TOutput, undefined, string[] | undefined>);
449
459
  protected clone(options?: Partial<typeof this.options> | undefined): this;
460
+ output<TOutputNew extends GraphQLSilk>(output: TOutputNew, transform: (output: StandardSchemaV1.InferOutput<TOutput>) => MayPromise<StandardSchemaV1.InferOutput<TOutputNew>>): FieldFactoryWithResolve<TParent, TOutputNew>;
450
461
  }
451
462
 
452
463
  interface FieldMeta extends GraphQLFieldOptions {
@@ -1,4 +1,4 @@
1
- import { P as OnlyMemoizationPayload, R as ResolverPayload, B as BaseField, v as Middleware, K as ResolvingFields } from './context-aKflesHT.cjs';
1
+ import { P as OnlyMemoizationPayload, R as ResolverPayload, B as BaseField, v as Middleware, K as ResolvingFields } from './context-D0Bwgtgg.cjs';
2
2
  import { AsyncLocalStorage } from 'node:async_hooks';
3
3
  import 'graphql';
4
4
 
package/dist/context.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { P as OnlyMemoizationPayload, R as ResolverPayload, B as BaseField, v as Middleware, K as ResolvingFields } from './context-aKflesHT.js';
1
+ import { P as OnlyMemoizationPayload, R as ResolverPayload, B as BaseField, v as Middleware, K as ResolvingFields } from './context-D0Bwgtgg.js';
2
2
  import { AsyncLocalStorage } from 'node:async_hooks';
3
3
  import 'graphql';
4
4
 
package/dist/index.cjs CHANGED
@@ -736,6 +736,12 @@ function createInputParser(schema, value) {
736
736
  Object.defineProperty(parse, "getResult", {
737
737
  value: async () => getStandardValue(await parse())
738
738
  });
739
+ Object.defineProperty(parse, "setResult", {
740
+ value: (value2) => result = { value: value2 }
741
+ });
742
+ Object.defineProperty(parse, "clearResult", {
743
+ value: () => result = void 0
744
+ });
739
745
  return parse;
740
746
  }
741
747
  function parseInputValue(inputSchema, input) {
@@ -1095,64 +1101,91 @@ var SubscriptionChainFactory = class _SubscriptionChainFactory extends BaseChain
1095
1101
  }
1096
1102
  };
1097
1103
  var QueryFactoryWithResolve = class _QueryFactoryWithResolve extends BaseChainFactory {
1098
- constructor(output, options) {
1104
+ constructor(outputSilk, options) {
1099
1105
  super(options);
1100
- this.output = output;
1106
+ this.outputSilk = outputSilk;
1101
1107
  this.options = options;
1102
1108
  }
1103
1109
  get "~meta"() {
1104
- return loom.query(this.output, this.options)["~meta"];
1110
+ return loom.query(this.outputSilk, this.options)["~meta"];
1105
1111
  }
1106
1112
  clone(options) {
1107
- return new _QueryFactoryWithResolve(this.output, {
1113
+ return new _QueryFactoryWithResolve(this.outputSilk, {
1108
1114
  ...this.options,
1109
1115
  ...options
1110
1116
  });
1111
1117
  }
1112
1118
  input(input) {
1113
- return new _QueryFactoryWithResolve(this.output, {
1119
+ return new _QueryFactoryWithResolve(this.outputSilk, {
1114
1120
  ...this.options,
1115
1121
  input
1116
1122
  });
1117
1123
  }
1124
+ output(output, transform) {
1125
+ return new _QueryFactoryWithResolve(output, {
1126
+ ...this.options,
1127
+ middlewares: [
1128
+ ...this.options.middlewares ?? [],
1129
+ async (next) => transform(await next())
1130
+ ]
1131
+ });
1132
+ }
1118
1133
  };
1119
1134
  var MutationFactoryWithResolve = class _MutationFactoryWithResolve extends BaseChainFactory {
1120
- constructor(output, options) {
1135
+ constructor(outputSilk, options) {
1121
1136
  super(options);
1122
- this.output = output;
1137
+ this.outputSilk = outputSilk;
1123
1138
  this.options = options;
1124
1139
  }
1125
1140
  get "~meta"() {
1126
- return loom.mutation(this.output, this.options)["~meta"];
1141
+ return loom.mutation(this.outputSilk, this.options)["~meta"];
1127
1142
  }
1128
1143
  clone(options) {
1129
- return new _MutationFactoryWithResolve(this.output, {
1144
+ return new _MutationFactoryWithResolve(this.outputSilk, {
1130
1145
  ...this.options,
1131
1146
  ...options
1132
1147
  });
1133
1148
  }
1134
1149
  input(input) {
1135
- return new _MutationFactoryWithResolve(this.output, {
1150
+ return new _MutationFactoryWithResolve(this.outputSilk, {
1136
1151
  ...this.options,
1137
1152
  input
1138
1153
  });
1139
1154
  }
1155
+ output(output, transform) {
1156
+ return new _MutationFactoryWithResolve(output, {
1157
+ ...this.options,
1158
+ middlewares: [
1159
+ ...this.options.middlewares ?? [],
1160
+ async (next) => transform(await next())
1161
+ ]
1162
+ });
1163
+ }
1140
1164
  };
1141
1165
  var FieldFactoryWithResolve = class _FieldFactoryWithResolve extends BaseChainFactory {
1142
- constructor(output, options) {
1166
+ constructor(outputSilk, options) {
1143
1167
  super(options);
1144
- this.output = output;
1168
+ this.outputSilk = outputSilk;
1145
1169
  this.options = options;
1146
1170
  }
1147
1171
  get "~meta"() {
1148
- return loom.field(this.output, this.options)["~meta"];
1172
+ return loom.field(this.outputSilk, this.options)["~meta"];
1149
1173
  }
1150
1174
  clone(options) {
1151
- return new _FieldFactoryWithResolve(this.output, {
1175
+ return new _FieldFactoryWithResolve(this.outputSilk, {
1152
1176
  ...this.options,
1153
1177
  ...options
1154
1178
  });
1155
1179
  }
1180
+ output(output, transform) {
1181
+ return new _FieldFactoryWithResolve(output, {
1182
+ ...this.options,
1183
+ middlewares: [
1184
+ ...this.options.middlewares ?? [],
1185
+ async (next) => transform(await next())
1186
+ ]
1187
+ });
1188
+ }
1156
1189
  };
1157
1190
 
1158
1191
  // src/resolver/resolver.ts
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { F as FieldOptions, Q as QueryOptions, M as MutationOptions, R as ResolverPayload, S as SubscriptionOptions, G as GraphQLFieldOptions, a as StandardSchemaV1, b as GraphQLSilk, c as MayPromise, d as Query, e as QueryChainFactory, f as QueryFactoryWithChain, g as Mutation, h as MutationChainFactory, i as MutationFactoryWithChain, j as Field, k as FieldChainFactory, l as FieldFactoryWithUtils, m as SubscriptionChainFactory, n as Subscription, o as SubscriptionFactoryWithChain, O as Operation, p as FIELD_HIDDEN, q as ResolverOptionsWithExtensions, r as OmitInUnion, V as ValueOf, s as ResolverOptions, t as FieldOrOperation, u as Resolver, I as IS_RESOLVER, v as Middleware, w as InferInputI, W as WEAVER_CONFIG, B as BaseField } from './context-aKflesHT.cjs';
2
- export { $ as BaseChainFactory, ai as CallableInputParser, D as CallableMiddlewareOptions, _ as ChainFactoryOptions, ae as FieldFactory, a4 as FieldFactoryWithResolve, ag as FieldMeta, a9 as FieldOrOperationType, Z as IChainFactory, aa as InferFieldInput, ab as InferFieldOutput, ah as InferInputO, y as IsAny, a5 as Loom, E as MiddlewareConfig, A as MiddlewareOperation, C as MiddlewareOptions, ad as MutationFactory, a3 as MutationFactoryWithResolve, P as OnlyMemoizationPayload, a8 as OperationType, ac as QueryFactory, a2 as QueryFactoryWithResolve, z as RequireKeys, a0 as ResolvableSubscription, a6 as ResolverOptionsWithParent, K as ResolvingFields, a7 as ResolvingOptions, x as SYMBOLS, af as SubscriptionFactory, a1 as SubscriptionNeedResolve, H as applyMiddlewares, Y as assignContextMap, aj as createInputParser, J as filterMiddlewares, X as getMemoizationMap, L as getResolvingFields, al as getStandardValue, U as isOnlyMemoryPayload, T as onlyMemoization, ak as parseInputValue, N as parseResolvingFields } from './context-aKflesHT.cjs';
1
+ import { F as FieldOptions, Q as QueryOptions, M as MutationOptions, R as ResolverPayload, S as SubscriptionOptions, G as GraphQLFieldOptions, a as StandardSchemaV1, b as GraphQLSilk, c as MayPromise, d as Query, e as QueryChainFactory, f as QueryFactoryWithChain, g as Mutation, h as MutationChainFactory, i as MutationFactoryWithChain, j as Field, k as FieldChainFactory, l as FieldFactoryWithUtils, m as SubscriptionChainFactory, n as Subscription, o as SubscriptionFactoryWithChain, O as Operation, p as FIELD_HIDDEN, q as ResolverOptionsWithExtensions, r as OmitInUnion, V as ValueOf, s as ResolverOptions, t as FieldOrOperation, u as Resolver, I as IS_RESOLVER, v as Middleware, w as InferInputI, W as WEAVER_CONFIG, B as BaseField } from './context-D0Bwgtgg.cjs';
2
+ export { $ as BaseChainFactory, ai as CallableInputParser, D as CallableMiddlewareOptions, _ as ChainFactoryOptions, ae as FieldFactory, a4 as FieldFactoryWithResolve, ag as FieldMeta, a9 as FieldOrOperationType, Z as IChainFactory, aa as InferFieldInput, ab as InferFieldOutput, ah as InferInputO, y as IsAny, a5 as Loom, E as MiddlewareConfig, A as MiddlewareOperation, C as MiddlewareOptions, ad as MutationFactory, a3 as MutationFactoryWithResolve, P as OnlyMemoizationPayload, a8 as OperationType, ac as QueryFactory, a2 as QueryFactoryWithResolve, z as RequireKeys, a0 as ResolvableSubscription, a6 as ResolverOptionsWithParent, K as ResolvingFields, a7 as ResolvingOptions, x as SYMBOLS, af as SubscriptionFactory, a1 as SubscriptionNeedResolve, H as applyMiddlewares, Y as assignContextMap, aj as createInputParser, J as filterMiddlewares, X as getMemoizationMap, L as getResolvingFields, al as getStandardValue, U as isOnlyMemoryPayload, T as onlyMemoization, ak as parseInputValue, N as parseResolvingFields } from './context-D0Bwgtgg.cjs';
3
3
  import { GraphQLFieldExtensions, GraphQLScalarType, GraphQLObjectType, GraphQLOutputType, GraphQLNullableType, GraphQLList, GraphQLNonNull, GraphQLObjectTypeConfig, GraphQLUnionType, GraphQLInterfaceType, GraphQLInputObjectType, GraphQLFieldMap, GraphQLFieldConfig, GraphQLSchemaConfig, GraphQLNamedType, GraphQLSchema, GraphQLFieldConfigArgumentMap, GraphQLType, GraphQLInputType, GraphQLInterfaceTypeConfig } from 'graphql';
4
4
 
5
5
  declare function getOperationOptions(resolveOrOptions: ((...args: any) => any) | FieldOptions<any, any, any, any> | QueryOptions<any, any> | MutationOptions<any, any>): any;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { F as FieldOptions, Q as QueryOptions, M as MutationOptions, R as ResolverPayload, S as SubscriptionOptions, G as GraphQLFieldOptions, a as StandardSchemaV1, b as GraphQLSilk, c as MayPromise, d as Query, e as QueryChainFactory, f as QueryFactoryWithChain, g as Mutation, h as MutationChainFactory, i as MutationFactoryWithChain, j as Field, k as FieldChainFactory, l as FieldFactoryWithUtils, m as SubscriptionChainFactory, n as Subscription, o as SubscriptionFactoryWithChain, O as Operation, p as FIELD_HIDDEN, q as ResolverOptionsWithExtensions, r as OmitInUnion, V as ValueOf, s as ResolverOptions, t as FieldOrOperation, u as Resolver, I as IS_RESOLVER, v as Middleware, w as InferInputI, W as WEAVER_CONFIG, B as BaseField } from './context-aKflesHT.js';
2
- export { $ as BaseChainFactory, ai as CallableInputParser, D as CallableMiddlewareOptions, _ as ChainFactoryOptions, ae as FieldFactory, a4 as FieldFactoryWithResolve, ag as FieldMeta, a9 as FieldOrOperationType, Z as IChainFactory, aa as InferFieldInput, ab as InferFieldOutput, ah as InferInputO, y as IsAny, a5 as Loom, E as MiddlewareConfig, A as MiddlewareOperation, C as MiddlewareOptions, ad as MutationFactory, a3 as MutationFactoryWithResolve, P as OnlyMemoizationPayload, a8 as OperationType, ac as QueryFactory, a2 as QueryFactoryWithResolve, z as RequireKeys, a0 as ResolvableSubscription, a6 as ResolverOptionsWithParent, K as ResolvingFields, a7 as ResolvingOptions, x as SYMBOLS, af as SubscriptionFactory, a1 as SubscriptionNeedResolve, H as applyMiddlewares, Y as assignContextMap, aj as createInputParser, J as filterMiddlewares, X as getMemoizationMap, L as getResolvingFields, al as getStandardValue, U as isOnlyMemoryPayload, T as onlyMemoization, ak as parseInputValue, N as parseResolvingFields } from './context-aKflesHT.js';
1
+ import { F as FieldOptions, Q as QueryOptions, M as MutationOptions, R as ResolverPayload, S as SubscriptionOptions, G as GraphQLFieldOptions, a as StandardSchemaV1, b as GraphQLSilk, c as MayPromise, d as Query, e as QueryChainFactory, f as QueryFactoryWithChain, g as Mutation, h as MutationChainFactory, i as MutationFactoryWithChain, j as Field, k as FieldChainFactory, l as FieldFactoryWithUtils, m as SubscriptionChainFactory, n as Subscription, o as SubscriptionFactoryWithChain, O as Operation, p as FIELD_HIDDEN, q as ResolverOptionsWithExtensions, r as OmitInUnion, V as ValueOf, s as ResolverOptions, t as FieldOrOperation, u as Resolver, I as IS_RESOLVER, v as Middleware, w as InferInputI, W as WEAVER_CONFIG, B as BaseField } from './context-D0Bwgtgg.js';
2
+ export { $ as BaseChainFactory, ai as CallableInputParser, D as CallableMiddlewareOptions, _ as ChainFactoryOptions, ae as FieldFactory, a4 as FieldFactoryWithResolve, ag as FieldMeta, a9 as FieldOrOperationType, Z as IChainFactory, aa as InferFieldInput, ab as InferFieldOutput, ah as InferInputO, y as IsAny, a5 as Loom, E as MiddlewareConfig, A as MiddlewareOperation, C as MiddlewareOptions, ad as MutationFactory, a3 as MutationFactoryWithResolve, P as OnlyMemoizationPayload, a8 as OperationType, ac as QueryFactory, a2 as QueryFactoryWithResolve, z as RequireKeys, a0 as ResolvableSubscription, a6 as ResolverOptionsWithParent, K as ResolvingFields, a7 as ResolvingOptions, x as SYMBOLS, af as SubscriptionFactory, a1 as SubscriptionNeedResolve, H as applyMiddlewares, Y as assignContextMap, aj as createInputParser, J as filterMiddlewares, X as getMemoizationMap, L as getResolvingFields, al as getStandardValue, U as isOnlyMemoryPayload, T as onlyMemoization, ak as parseInputValue, N as parseResolvingFields } from './context-D0Bwgtgg.js';
3
3
  import { GraphQLFieldExtensions, GraphQLScalarType, GraphQLObjectType, GraphQLOutputType, GraphQLNullableType, GraphQLList, GraphQLNonNull, GraphQLObjectTypeConfig, GraphQLUnionType, GraphQLInterfaceType, GraphQLInputObjectType, GraphQLFieldMap, GraphQLFieldConfig, GraphQLSchemaConfig, GraphQLNamedType, GraphQLSchema, GraphQLFieldConfigArgumentMap, GraphQLType, GraphQLInputType, GraphQLInterfaceTypeConfig } from 'graphql';
4
4
 
5
5
  declare function getOperationOptions(resolveOrOptions: ((...args: any) => any) | FieldOptions<any, any, any, any> | QueryOptions<any, any> | MutationOptions<any, any>): any;
package/dist/index.js CHANGED
@@ -467,6 +467,12 @@ function createInputParser(schema, value) {
467
467
  Object.defineProperty(parse, "getResult", {
468
468
  value: async () => getStandardValue(await parse())
469
469
  });
470
+ Object.defineProperty(parse, "setResult", {
471
+ value: (value2) => result = { value: value2 }
472
+ });
473
+ Object.defineProperty(parse, "clearResult", {
474
+ value: () => result = void 0
475
+ });
470
476
  return parse;
471
477
  }
472
478
  function parseInputValue(inputSchema, input) {
@@ -826,64 +832,91 @@ var SubscriptionChainFactory = class _SubscriptionChainFactory extends BaseChain
826
832
  }
827
833
  };
828
834
  var QueryFactoryWithResolve = class _QueryFactoryWithResolve extends BaseChainFactory {
829
- constructor(output, options) {
835
+ constructor(outputSilk, options) {
830
836
  super(options);
831
- this.output = output;
837
+ this.outputSilk = outputSilk;
832
838
  this.options = options;
833
839
  }
834
840
  get "~meta"() {
835
- return loom.query(this.output, this.options)["~meta"];
841
+ return loom.query(this.outputSilk, this.options)["~meta"];
836
842
  }
837
843
  clone(options) {
838
- return new _QueryFactoryWithResolve(this.output, {
844
+ return new _QueryFactoryWithResolve(this.outputSilk, {
839
845
  ...this.options,
840
846
  ...options
841
847
  });
842
848
  }
843
849
  input(input) {
844
- return new _QueryFactoryWithResolve(this.output, {
850
+ return new _QueryFactoryWithResolve(this.outputSilk, {
845
851
  ...this.options,
846
852
  input
847
853
  });
848
854
  }
855
+ output(output, transform) {
856
+ return new _QueryFactoryWithResolve(output, {
857
+ ...this.options,
858
+ middlewares: [
859
+ ...this.options.middlewares ?? [],
860
+ async (next) => transform(await next())
861
+ ]
862
+ });
863
+ }
849
864
  };
850
865
  var MutationFactoryWithResolve = class _MutationFactoryWithResolve extends BaseChainFactory {
851
- constructor(output, options) {
866
+ constructor(outputSilk, options) {
852
867
  super(options);
853
- this.output = output;
868
+ this.outputSilk = outputSilk;
854
869
  this.options = options;
855
870
  }
856
871
  get "~meta"() {
857
- return loom.mutation(this.output, this.options)["~meta"];
872
+ return loom.mutation(this.outputSilk, this.options)["~meta"];
858
873
  }
859
874
  clone(options) {
860
- return new _MutationFactoryWithResolve(this.output, {
875
+ return new _MutationFactoryWithResolve(this.outputSilk, {
861
876
  ...this.options,
862
877
  ...options
863
878
  });
864
879
  }
865
880
  input(input) {
866
- return new _MutationFactoryWithResolve(this.output, {
881
+ return new _MutationFactoryWithResolve(this.outputSilk, {
867
882
  ...this.options,
868
883
  input
869
884
  });
870
885
  }
886
+ output(output, transform) {
887
+ return new _MutationFactoryWithResolve(output, {
888
+ ...this.options,
889
+ middlewares: [
890
+ ...this.options.middlewares ?? [],
891
+ async (next) => transform(await next())
892
+ ]
893
+ });
894
+ }
871
895
  };
872
896
  var FieldFactoryWithResolve = class _FieldFactoryWithResolve extends BaseChainFactory {
873
- constructor(output, options) {
897
+ constructor(outputSilk, options) {
874
898
  super(options);
875
- this.output = output;
899
+ this.outputSilk = outputSilk;
876
900
  this.options = options;
877
901
  }
878
902
  get "~meta"() {
879
- return loom.field(this.output, this.options)["~meta"];
903
+ return loom.field(this.outputSilk, this.options)["~meta"];
880
904
  }
881
905
  clone(options) {
882
- return new _FieldFactoryWithResolve(this.output, {
906
+ return new _FieldFactoryWithResolve(this.outputSilk, {
883
907
  ...this.options,
884
908
  ...options
885
909
  });
886
910
  }
911
+ output(output, transform) {
912
+ return new _FieldFactoryWithResolve(output, {
913
+ ...this.options,
914
+ middlewares: [
915
+ ...this.options.middlewares ?? [],
916
+ async (next) => transform(await next())
917
+ ]
918
+ });
919
+ }
887
920
  };
888
921
 
889
922
  // src/resolver/resolver.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gqloom/core",
3
- "version": "0.9.4",
3
+ "version": "0.9.6",
4
4
  "description": "Create GraphQL schema and resolvers with TypeScript.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",