houdini 1.0.0-next.8 → 1.0.0-next.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.
Files changed (56) hide show
  1. package/build/cmd-cjs/index.js +50 -22
  2. package/build/cmd-esm/index.js +50 -22
  3. package/build/codegen/generators/typescript/typeReference.d.ts +4 -2
  4. package/build/codegen/generators/typescript/types.d.ts +0 -1
  5. package/build/codegen-cjs/index.js +48 -20
  6. package/build/codegen-esm/index.js +48 -20
  7. package/build/runtime/client/index.d.ts +1 -1
  8. package/build/runtime/client/plugins/cache.d.ts +1 -1
  9. package/build/runtime/client/plugins/fetch.d.ts +1 -1
  10. package/build/runtime/client/plugins/fetchParams.d.ts +1 -1
  11. package/build/runtime/client/plugins/mutation.d.ts +1 -1
  12. package/build/runtime/client/plugins/query.d.ts +1 -1
  13. package/build/runtime/client/plugins/subscription.d.ts +1 -1
  14. package/build/runtime/client/plugins/throwOnError.d.ts +1 -1
  15. package/build/runtime/lib/types.d.ts +1 -0
  16. package/build/runtime-cjs/client/documentStore.js +1 -1
  17. package/build/runtime-cjs/client/index.d.ts +1 -1
  18. package/build/runtime-cjs/client/index.js +13 -13
  19. package/build/runtime-cjs/client/plugins/cache.d.ts +1 -1
  20. package/build/runtime-cjs/client/plugins/cache.js +3 -3
  21. package/build/runtime-cjs/client/plugins/fetch.d.ts +1 -1
  22. package/build/runtime-cjs/client/plugins/fetch.js +7 -7
  23. package/build/runtime-cjs/client/plugins/fetchParams.d.ts +1 -1
  24. package/build/runtime-cjs/client/plugins/fetchParams.js +3 -3
  25. package/build/runtime-cjs/client/plugins/mutation.d.ts +1 -1
  26. package/build/runtime-cjs/client/plugins/mutation.js +3 -3
  27. package/build/runtime-cjs/client/plugins/query.d.ts +1 -1
  28. package/build/runtime-cjs/client/plugins/query.js +3 -3
  29. package/build/runtime-cjs/client/plugins/subscription.d.ts +1 -1
  30. package/build/runtime-cjs/client/plugins/subscription.js +3 -3
  31. package/build/runtime-cjs/client/plugins/throwOnError.d.ts +1 -1
  32. package/build/runtime-cjs/client/plugins/throwOnError.js +3 -3
  33. package/build/runtime-cjs/lib/types.d.ts +1 -0
  34. package/build/runtime-esm/client/documentStore.js +2 -2
  35. package/build/runtime-esm/client/index.d.ts +1 -1
  36. package/build/runtime-esm/client/index.js +10 -10
  37. package/build/runtime-esm/client/plugins/cache.d.ts +1 -1
  38. package/build/runtime-esm/client/plugins/cache.js +2 -2
  39. package/build/runtime-esm/client/plugins/fetch.d.ts +1 -1
  40. package/build/runtime-esm/client/plugins/fetch.js +6 -6
  41. package/build/runtime-esm/client/plugins/fetchParams.d.ts +1 -1
  42. package/build/runtime-esm/client/plugins/fetchParams.js +2 -2
  43. package/build/runtime-esm/client/plugins/mutation.d.ts +1 -1
  44. package/build/runtime-esm/client/plugins/mutation.js +2 -2
  45. package/build/runtime-esm/client/plugins/query.d.ts +1 -1
  46. package/build/runtime-esm/client/plugins/query.js +2 -2
  47. package/build/runtime-esm/client/plugins/subscription.d.ts +1 -1
  48. package/build/runtime-esm/client/plugins/subscription.js +2 -2
  49. package/build/runtime-esm/client/plugins/throwOnError.d.ts +1 -1
  50. package/build/runtime-esm/client/plugins/throwOnError.js +2 -2
  51. package/build/runtime-esm/lib/types.d.ts +1 -0
  52. package/build/test-cjs/index.js +48 -20
  53. package/build/test-esm/index.js +48 -20
  54. package/build/vite-cjs/index.js +48 -20
  55. package/build/vite-esm/index.js +48 -20
  56. package/package.json +1 -1
@@ -3352,7 +3352,7 @@ var require_definition = __commonJS({
3352
3352
  exports.assertInterfaceType = assertInterfaceType;
3353
3353
  exports.isUnionType = isUnionType7;
3354
3354
  exports.assertUnionType = assertUnionType;
3355
- exports.isEnumType = isEnumType5;
3355
+ exports.isEnumType = isEnumType6;
3356
3356
  exports.assertEnumType = assertEnumType;
3357
3357
  exports.isInputObjectType = isInputObjectType2;
3358
3358
  exports.assertInputObjectType = assertInputObjectType;
@@ -3423,7 +3423,7 @@ var require_definition = __commonJS({
3423
3423
  return Constructor;
3424
3424
  }
3425
3425
  function isType(type) {
3426
- return isScalarType7(type) || isObjectType3(type) || isInterfaceType6(type) || isUnionType7(type) || isEnumType5(type) || isInputObjectType2(type) || isListType3(type) || isNonNullType6(type);
3426
+ return isScalarType7(type) || isObjectType3(type) || isInterfaceType6(type) || isUnionType7(type) || isEnumType6(type) || isInputObjectType2(type) || isListType3(type) || isNonNullType6(type);
3427
3427
  }
3428
3428
  function assertType(type) {
3429
3429
  if (!isType(type)) {
@@ -3467,11 +3467,11 @@ var require_definition = __commonJS({
3467
3467
  }
3468
3468
  return type;
3469
3469
  }
3470
- function isEnumType5(type) {
3470
+ function isEnumType6(type) {
3471
3471
  return (0, _instanceOf.default)(type, GraphQLEnumType);
3472
3472
  }
3473
3473
  function assertEnumType(type) {
3474
- if (!isEnumType5(type)) {
3474
+ if (!isEnumType6(type)) {
3475
3475
  throw new Error("Expected ".concat((0, _inspect.default)(type), " to be a GraphQL Enum type."));
3476
3476
  }
3477
3477
  return type;
@@ -3504,7 +3504,7 @@ var require_definition = __commonJS({
3504
3504
  return type;
3505
3505
  }
3506
3506
  function isInputType(type) {
3507
- return isScalarType7(type) || isEnumType5(type) || isInputObjectType2(type) || isWrappingType(type) && isInputType(type.ofType);
3507
+ return isScalarType7(type) || isEnumType6(type) || isInputObjectType2(type) || isWrappingType(type) && isInputType(type.ofType);
3508
3508
  }
3509
3509
  function assertInputType(type) {
3510
3510
  if (!isInputType(type)) {
@@ -3513,7 +3513,7 @@ var require_definition = __commonJS({
3513
3513
  return type;
3514
3514
  }
3515
3515
  function isOutputType(type) {
3516
- return isScalarType7(type) || isObjectType3(type) || isInterfaceType6(type) || isUnionType7(type) || isEnumType5(type) || isWrappingType(type) && isOutputType(type.ofType);
3516
+ return isScalarType7(type) || isObjectType3(type) || isInterfaceType6(type) || isUnionType7(type) || isEnumType6(type) || isWrappingType(type) && isOutputType(type.ofType);
3517
3517
  }
3518
3518
  function assertOutputType(type) {
3519
3519
  if (!isOutputType(type)) {
@@ -3522,7 +3522,7 @@ var require_definition = __commonJS({
3522
3522
  return type;
3523
3523
  }
3524
3524
  function isLeafType(type) {
3525
- return isScalarType7(type) || isEnumType5(type);
3525
+ return isScalarType7(type) || isEnumType6(type);
3526
3526
  }
3527
3527
  function assertLeafType(type) {
3528
3528
  if (!isLeafType(type)) {
@@ -3610,7 +3610,7 @@ var require_definition = __commonJS({
3610
3610
  }
3611
3611
  }
3612
3612
  function isNamedType(type) {
3613
- return isScalarType7(type) || isObjectType3(type) || isInterfaceType6(type) || isUnionType7(type) || isEnumType5(type) || isInputObjectType2(type);
3613
+ return isScalarType7(type) || isObjectType3(type) || isInterfaceType6(type) || isUnionType7(type) || isEnumType6(type) || isInputObjectType2(type);
3614
3614
  }
3615
3615
  function assertNamedType(type) {
3616
3616
  if (!isNamedType(type)) {
@@ -57329,11 +57329,13 @@ function scalarPropertyValue(config2, missingScalars, target) {
57329
57329
 
57330
57330
  // src/codegen/generators/typescript/typeReference.ts
57331
57331
  var AST8 = recast8.types.builders;
57332
- function tsTypeReference(config2, missingScalars, definition) {
57332
+ function tsTypeReference(config2, missingScalars, definition, body) {
57333
57333
  const { type, wrappers } = unwrapType(config2, definition.type);
57334
57334
  let result;
57335
57335
  if (graphql14.isScalarType(type)) {
57336
57336
  result = scalarPropertyValue(config2, missingScalars, type);
57337
+ } else if (graphql14.isEnumType(type)) {
57338
+ result = enumReference(config2, body, type.name);
57337
57339
  } else {
57338
57340
  result = AST8.tsTypeReference(AST8.identifier(type.name));
57339
57341
  }
@@ -57348,6 +57350,19 @@ function tsTypeReference(config2, missingScalars, definition) {
57348
57350
  }
57349
57351
  return result;
57350
57352
  }
57353
+ function enumReference(config2, body, name) {
57354
+ ensureImports({
57355
+ config: config2,
57356
+ body,
57357
+ import: ["ValueOf"],
57358
+ importKind: "type",
57359
+ sourceModule: "$houdini/runtime/lib/types"
57360
+ });
57361
+ return AST8.tsTypeReference(
57362
+ AST8.identifier("ValueOf"),
57363
+ AST8.tsTypeParameterInstantiation([AST8.tsTypeQuery(AST8.identifier(name))])
57364
+ );
57365
+ }
57351
57366
 
57352
57367
  // src/codegen/generators/typescript/addReferencedInputTypes.ts
57353
57368
  var AST9 = recast9.types.builders;
@@ -57379,7 +57394,7 @@ function addReferencedInputTypes(config2, filepath, body, visitedTypes, missingS
57379
57394
  members.push(
57380
57395
  AST9.tsPropertySignature(
57381
57396
  AST9.identifier(field.name),
57382
- AST9.tsTypeAnnotation(tsTypeReference(config2, missingScalars, field)),
57397
+ AST9.tsTypeAnnotation(tsTypeReference(config2, missingScalars, field, body)),
57383
57398
  graphql15.isNullableType(field.type)
57384
57399
  )
57385
57400
  );
@@ -57410,6 +57425,13 @@ function inlineType({
57410
57425
  if (graphql16.isScalarType(type)) {
57411
57426
  result = scalarPropertyValue(config2, missingScalars, type);
57412
57427
  } else if (graphql16.isEnumType(type)) {
57428
+ ensureImports({
57429
+ config: config2,
57430
+ body,
57431
+ importKind: "type",
57432
+ import: ["ValueOf"],
57433
+ sourceModule: "$houdini/runtime/lib/types"
57434
+ });
57413
57435
  if (!visitedTypes.has(type.name)) {
57414
57436
  ensureImports({
57415
57437
  config: config2,
@@ -57419,7 +57441,7 @@ function inlineType({
57419
57441
  });
57420
57442
  visitedTypes.add(type.name);
57421
57443
  }
57422
- result = AST10.tsTypeReference(AST10.identifier(type.name));
57444
+ result = enumReference(config2, body, type.name);
57423
57445
  } else if (selections) {
57424
57446
  const rootObj = type;
57425
57447
  const inlineFragments = {};
@@ -57852,7 +57874,7 @@ async function generateOperationTypeDefs(config2, filepath, body, definition, se
57852
57874
  return AST11.tsPropertySignature(
57853
57875
  AST11.identifier(definition2.variable.name.value),
57854
57876
  AST11.tsTypeAnnotation(
57855
- tsTypeReference(config2, missingScalars, definition2)
57877
+ tsTypeReference(config2, missingScalars, definition2, body)
57856
57878
  ),
57857
57879
  definition2.type.kind !== "NonNullType"
57858
57880
  );
@@ -57919,7 +57941,12 @@ async function generateFragmentTypeDefs(config2, filepath, body, selections, def
57919
57941
  return AST11.tsPropertySignature(
57920
57942
  AST11.identifier(definition2.variable.name.value),
57921
57943
  AST11.tsTypeAnnotation(
57922
- tsTypeReference(config2, missingScalars, definition2)
57944
+ tsTypeReference(
57945
+ config2,
57946
+ missingScalars,
57947
+ definition2,
57948
+ body
57949
+ )
57923
57950
  ),
57924
57951
  definition2.type.kind !== "NonNullType"
57925
57952
  );
@@ -58012,7 +58039,7 @@ async function imperativeCacheTypef(config2, docs) {
58012
58039
  ),
58013
58040
  AST12.tsPropertySignature(
58014
58041
  AST12.identifier("lists"),
58015
- AST12.tsTypeAnnotation(listDefinitions(config2, docs))
58042
+ AST12.tsTypeAnnotation(listDefinitions(config2, body, docs))
58016
58043
  ),
58017
58044
  AST12.tsPropertySignature(
58018
58045
  AST12.identifier("queries"),
@@ -58121,7 +58148,7 @@ function typeDefinitions(config2, body, docs, returnType) {
58121
58148
  const prop = AST12.tsPropertySignature(
58122
58149
  AST12.identifier(arg.name),
58123
58150
  AST12.tsTypeAnnotation(
58124
- tsTypeReference(config2, /* @__PURE__ */ new Set(), arg)
58151
+ tsTypeReference(config2, /* @__PURE__ */ new Set(), arg, body)
58125
58152
  )
58126
58153
  );
58127
58154
  const unwrapped2 = unwrapType(config2, arg.type);
@@ -58171,7 +58198,7 @@ function typeDefinitions(config2, body, docs, returnType) {
58171
58198
  })
58172
58199
  );
58173
58200
  }
58174
- function listDefinitions(config2, docs) {
58201
+ function listDefinitions(config2, body, docs) {
58175
58202
  const lists = [];
58176
58203
  const visitedLists = /* @__PURE__ */ new Set();
58177
58204
  for (const doc of docs) {
@@ -58228,7 +58255,8 @@ function listDefinitions(config2, docs) {
58228
58255
  tsTypeReference(
58229
58256
  config2,
58230
58257
  /* @__PURE__ */ new Set(),
58231
- arg
58258
+ arg,
58259
+ body
58232
58260
  )
58233
58261
  )
58234
58262
  );
@@ -58422,9 +58450,9 @@ async function definitionsGenerator(config2) {
58422
58450
  ).code;
58423
58451
  const typeDefinitions2 = enums.sort((a, b) => a.name.value.localeCompare(b.name.value)).map(
58424
58452
  (definition) => `
58425
- export declare enum ${definition.name.value} {
58426
- ${definition.values?.map((value) => ` ${value.name.value} = "${value.name.value}"`).join(",\n")}
58427
- }
58453
+ export const ${definition.name.value} = {
58454
+ ${definition.values?.map((value) => ` ${value.name.value}: "${value.name.value}"`).join(",\n")}
58455
+ } as const
58428
58456
  `
58429
58457
  ).join("");
58430
58458
  const definitionsIndex = `
@@ -4,7 +4,7 @@ import type { ClientPlugin, ClientHooks } from './documentStore';
4
4
  import { DocumentStore } from './documentStore';
5
5
  import { type FetchParamFn, type ThrowOnErrorParams } from './plugins';
6
6
  export { DocumentStore, type ClientPlugin } from './documentStore';
7
- export { fetchPlugin, mutationPlugin, queryPlugin, subscriptionPlugin } from './plugins';
7
+ export { fetch, mutation, query, subscription } from './plugins';
8
8
  type ConstructorArgs = {
9
9
  url: string;
10
10
  fetchParams?: FetchParamFn;
@@ -1,7 +1,7 @@
1
1
  import cache from '../../cache';
2
2
  import type { Cache } from '../../cache/cache';
3
3
  import type { ClientPlugin } from '../documentStore';
4
- export declare const cachePolicyPlugin: ({ enabled, setFetching, cache: localCache, }: {
4
+ export declare const cachePolicy: ({ enabled, setFetching, cache: localCache, }: {
5
5
  enabled: boolean;
6
6
  setFetching: (val: boolean) => void;
7
7
  cache?: Cache | undefined;
@@ -1,6 +1,6 @@
1
1
  import type { RequestPayload } from '../../lib/types';
2
2
  import type { ClientPlugin } from '../documentStore';
3
- export declare const fetchPlugin: (target?: RequestHandler | string) => ClientPlugin;
3
+ export declare const fetch: (target?: RequestHandler | string) => ClientPlugin;
4
4
  export type FetchContext = {
5
5
  fetch: typeof globalThis.fetch;
6
6
  metadata?: App.Metadata | null;
@@ -1,7 +1,7 @@
1
1
  import type { DocumentArtifact } from '../../lib/types';
2
2
  import type { ClientPlugin, ClientPluginContext } from '../documentStore';
3
3
  export type FetchParamFn = (ctx: FetchParamsInput) => Required<ClientPluginContext>['fetchParams'];
4
- export declare const fetchParamsPlugin: (fn?: FetchParamFn) => ClientPlugin;
4
+ export declare const fetchParams: (fn?: FetchParamFn) => ClientPlugin;
5
5
  export type FetchParamsInput = Pick<ClientPluginContext, 'config' | 'policy' | 'variables' | 'metadata' | 'session' | 'stuff'> & {
6
6
  text: string;
7
7
  hash: string;
@@ -1 +1 @@
1
- export declare const mutationPlugin: import("..").ClientPlugin;
1
+ export declare const mutation: import("..").ClientPlugin;
@@ -1,2 +1,2 @@
1
1
  import type { ClientPlugin } from '../documentStore';
2
- export declare const queryPlugin: ClientPlugin;
2
+ export declare const query: ClientPlugin;
@@ -1,5 +1,5 @@
1
1
  import type { ClientPluginContext } from '../documentStore';
2
- export declare function subscriptionPlugin(factory: SubscriptionHandler): import("../documentStore").ClientPlugin;
2
+ export declare function subscription(factory: SubscriptionHandler): import("../documentStore").ClientPlugin;
3
3
  export type SubscriptionHandler = (ctx: ClientPluginContext) => {
4
4
  subscribe: (payload: {
5
5
  query: string;
@@ -4,4 +4,4 @@ export type ThrowOnErrorParams = {
4
4
  operations: ('all' | 'query' | 'mutation' | 'subscription')[];
5
5
  error?: (errors: NonNullable<QueryResult<any, any>['errors']>) => unknown;
6
6
  };
7
- export declare const throwOnErrorPlugin: ({ operations, error }: ThrowOnErrorParams) => ClientPlugin;
7
+ export declare const throwOnError: ({ operations, error }: ThrowOnErrorParams) => ClientPlugin;
@@ -183,4 +183,5 @@ export type RequestPayload<GraphQLObject = any> = {
183
183
  }[] | null;
184
184
  };
185
185
  export type NestedList<_Result = string> = (_Result | null | NestedList<_Result>)[];
186
+ export type ValueOf<Parent> = Parent[keyof Parent];
186
187
  export {};
@@ -72,7 +72,7 @@ class DocumentStore extends import_store.Writable {
72
72
  this.#lastVariables = null;
73
73
  this.#configFile = (0, import_config.getCurrentConfig)();
74
74
  this.#plugins = pipeline ?? [
75
- (0, import_plugins.cachePolicyPlugin)({
75
+ (0, import_plugins.cachePolicy)({
76
76
  enabled: cache,
77
77
  setFetching: (fetching2) => this.update((state) => ({ ...state, fetching: fetching2 }))
78
78
  })(),
@@ -4,7 +4,7 @@ import type { ClientPlugin, ClientHooks } from './documentStore';
4
4
  import { DocumentStore } from './documentStore';
5
5
  import { type FetchParamFn, type ThrowOnErrorParams } from './plugins';
6
6
  export { DocumentStore, type ClientPlugin } from './documentStore';
7
- export { fetchPlugin, mutationPlugin, queryPlugin, subscriptionPlugin } from './plugins';
7
+ export { fetch, mutation, query, subscription } from './plugins';
8
8
  type ConstructorArgs = {
9
9
  url: string;
10
10
  fetchParams?: FetchParamFn;
@@ -27,10 +27,10 @@ __export(client_exports, {
27
27
  DocumentStore: () => import_documentStore2.DocumentStore,
28
28
  HoudiniClient: () => HoudiniClient,
29
29
  createPluginHooks: () => createPluginHooks,
30
- fetchPlugin: () => import_plugins2.fetchPlugin,
31
- mutationPlugin: () => import_plugins2.mutationPlugin,
32
- queryPlugin: () => import_plugins2.queryPlugin,
33
- subscriptionPlugin: () => import_plugins2.subscriptionPlugin
30
+ fetch: () => import_plugins2.fetch,
31
+ mutation: () => import_plugins2.mutation,
32
+ query: () => import_plugins2.query,
33
+ subscription: () => import_plugins2.subscription
34
34
  });
35
35
  module.exports = __toCommonJS(client_exports);
36
36
  var import_flatten = require("../lib/flatten");
@@ -50,15 +50,15 @@ class HoudiniClient {
50
50
  }
51
51
  this.#plugins = (0, import_flatten.flatten)(
52
52
  [].concat(
53
- throwOnError ? [(0, import_plugins.throwOnErrorPlugin)(throwOnError)] : [],
54
- (0, import_plugins.fetchParamsPlugin)(fetchParams),
53
+ throwOnError ? [(0, import_plugins.throwOnError)(throwOnError)] : [],
54
+ (0, import_plugins.fetchParams)(fetchParams),
55
55
  pipeline ?? [
56
- import_plugins.queryPlugin,
57
- import_plugins.mutationPlugin
56
+ import_plugins.query,
57
+ import_plugins.mutation
58
58
  ].concat(
59
59
  plugins ?? [],
60
60
  import_injectedPlugins.default,
61
- (0, import_plugins.fetchPlugin)()
61
+ (0, import_plugins.fetch)()
62
62
  )
63
63
  )
64
64
  );
@@ -106,8 +106,8 @@ function createPluginHooks(plugins) {
106
106
  DocumentStore,
107
107
  HoudiniClient,
108
108
  createPluginHooks,
109
- fetchPlugin,
110
- mutationPlugin,
111
- queryPlugin,
112
- subscriptionPlugin
109
+ fetch,
110
+ mutation,
111
+ query,
112
+ subscription
113
113
  });
@@ -1,7 +1,7 @@
1
1
  import cache from '../../cache';
2
2
  import type { Cache } from '../../cache/cache';
3
3
  import type { ClientPlugin } from '../documentStore';
4
- export declare const cachePolicyPlugin: ({ enabled, setFetching, cache: localCache, }: {
4
+ export declare const cachePolicy: ({ enabled, setFetching, cache: localCache, }: {
5
5
  enabled: boolean;
6
6
  setFetching: (val: boolean) => void;
7
7
  cache?: Cache | undefined;
@@ -24,12 +24,12 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
24
24
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
25
25
  var cache_exports = {};
26
26
  __export(cache_exports, {
27
- cachePolicyPlugin: () => cachePolicyPlugin
27
+ cachePolicy: () => cachePolicy
28
28
  });
29
29
  module.exports = __toCommonJS(cache_exports);
30
30
  var import_cache = __toESM(require("../../cache"), 1);
31
31
  var import_types = require("../../lib/types");
32
- const cachePolicyPlugin = ({
32
+ const cachePolicy = ({
33
33
  enabled,
34
34
  setFetching,
35
35
  cache: localCache = import_cache.default
@@ -97,5 +97,5 @@ const cachePolicyPlugin = ({
97
97
  };
98
98
  // Annotate the CommonJS export names for ESM import in node:
99
99
  0 && (module.exports = {
100
- cachePolicyPlugin
100
+ cachePolicy
101
101
  });
@@ -1,6 +1,6 @@
1
1
  import type { RequestPayload } from '../../lib/types';
2
2
  import type { ClientPlugin } from '../documentStore';
3
- export declare const fetchPlugin: (target?: RequestHandler | string) => ClientPlugin;
3
+ export declare const fetch: (target?: RequestHandler | string) => ClientPlugin;
4
4
  export type FetchContext = {
5
5
  fetch: typeof globalThis.fetch;
6
6
  metadata?: App.Metadata | null;
@@ -19,16 +19,16 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
19
19
  var fetch_exports = {};
20
20
  __export(fetch_exports, {
21
21
  extractFiles: () => extractFiles,
22
- fetchPlugin: () => fetchPlugin,
22
+ fetch: () => fetch,
23
23
  isExtractableFile: () => isExtractableFile
24
24
  });
25
25
  module.exports = __toCommonJS(fetch_exports);
26
26
  var import_types = require("../../lib/types");
27
- const fetchPlugin = (target) => {
27
+ const fetch = (target) => {
28
28
  return () => {
29
29
  return {
30
30
  async network(ctx, { client, resolve, marshalVariables }) {
31
- const fetch = ctx.fetch ?? globalThis.fetch;
31
+ const fetch2 = ctx.fetch ?? globalThis.fetch;
32
32
  const fetchParams = {
33
33
  text: ctx.text,
34
34
  hash: ctx.hash,
@@ -45,7 +45,7 @@ const fetchPlugin = (target) => {
45
45
  const result = await fetchFn({
46
46
  fetch: (url, args) => {
47
47
  const newArgs = handleMultipart(fetchParams, args) ?? args;
48
- return fetch(url, newArgs);
48
+ return fetch2(url, newArgs);
49
49
  },
50
50
  metadata: ctx.metadata,
51
51
  session: ctx.session || {},
@@ -70,8 +70,8 @@ const defaultFetch = (url, params) => {
70
70
  "Could not find configured client url. Please specify one in your houdini.config.js file."
71
71
  );
72
72
  }
73
- return async ({ fetch, text, variables }) => {
74
- const result = await fetch(url, {
73
+ return async ({ fetch: fetch2, text, variables }) => {
74
+ const result = await fetch2(url, {
75
75
  method: "POST",
76
76
  body: JSON.stringify({ query: text, variables }),
77
77
  ...params,
@@ -173,6 +173,6 @@ function isPlainObject(value) {
173
173
  // Annotate the CommonJS export names for ESM import in node:
174
174
  0 && (module.exports = {
175
175
  extractFiles,
176
- fetchPlugin,
176
+ fetch,
177
177
  isExtractableFile
178
178
  });
@@ -1,7 +1,7 @@
1
1
  import type { DocumentArtifact } from '../../lib/types';
2
2
  import type { ClientPlugin, ClientPluginContext } from '../documentStore';
3
3
  export type FetchParamFn = (ctx: FetchParamsInput) => Required<ClientPluginContext>['fetchParams'];
4
- export declare const fetchParamsPlugin: (fn?: FetchParamFn) => ClientPlugin;
4
+ export declare const fetchParams: (fn?: FetchParamFn) => ClientPlugin;
5
5
  export type FetchParamsInput = Pick<ClientPluginContext, 'config' | 'policy' | 'variables' | 'metadata' | 'session' | 'stuff'> & {
6
6
  text: string;
7
7
  hash: string;
@@ -18,10 +18,10 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var fetchParams_exports = {};
20
20
  __export(fetchParams_exports, {
21
- fetchParamsPlugin: () => fetchParamsPlugin
21
+ fetchParams: () => fetchParams
22
22
  });
23
23
  module.exports = __toCommonJS(fetchParams_exports);
24
- const fetchParamsPlugin = (fn = () => ({})) => () => ({
24
+ const fetchParams = (fn = () => ({})) => () => ({
25
25
  beforeNetwork(ctx, { next, marshalVariables }) {
26
26
  next({
27
27
  ...ctx,
@@ -41,5 +41,5 @@ const fetchParamsPlugin = (fn = () => ({})) => () => ({
41
41
  });
42
42
  // Annotate the CommonJS export names for ESM import in node:
43
43
  0 && (module.exports = {
44
- fetchParamsPlugin
44
+ fetchParams
45
45
  });
@@ -1 +1 @@
1
- export declare const mutationPlugin: import("..").ClientPlugin;
1
+ export declare const mutation: import("..").ClientPlugin;
@@ -24,14 +24,14 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
24
24
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
25
25
  var mutation_exports = {};
26
26
  __export(mutation_exports, {
27
- mutationPlugin: () => mutationPlugin
27
+ mutation: () => mutation
28
28
  });
29
29
  module.exports = __toCommonJS(mutation_exports);
30
30
  var import_cache = __toESM(require("../../cache"), 1);
31
31
  var import_scalars = require("../../lib/scalars");
32
32
  var import_types = require("../../lib/types");
33
33
  var import_utils = require("../utils");
34
- const mutationPlugin = (0, import_utils.documentPlugin)(import_types.ArtifactKind.Mutation, () => {
34
+ const mutation = (0, import_utils.documentPlugin)(import_types.ArtifactKind.Mutation, () => {
35
35
  return {
36
36
  async start(ctx, { next, marshalVariables }) {
37
37
  const layer = import_cache.default._internal_unstable.storage.createLayer(true);
@@ -82,5 +82,5 @@ const mutationPlugin = (0, import_utils.documentPlugin)(import_types.ArtifactKin
82
82
  });
83
83
  // Annotate the CommonJS export names for ESM import in node:
84
84
  0 && (module.exports = {
85
- mutationPlugin
85
+ mutation
86
86
  });
@@ -1,2 +1,2 @@
1
1
  import type { ClientPlugin } from '../documentStore';
2
- export declare const queryPlugin: ClientPlugin;
2
+ export declare const query: ClientPlugin;
@@ -24,13 +24,13 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
24
24
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
25
25
  var query_exports = {};
26
26
  __export(query_exports, {
27
- queryPlugin: () => queryPlugin
27
+ query: () => query
28
28
  });
29
29
  module.exports = __toCommonJS(query_exports);
30
30
  var import_cache = __toESM(require("../../cache"), 1);
31
31
  var import_types = require("../../lib/types");
32
32
  var import_utils = require("../utils");
33
- const queryPlugin = (0, import_utils.documentPlugin)(import_types.ArtifactKind.Query, function() {
33
+ const query = (0, import_utils.documentPlugin)(import_types.ArtifactKind.Query, function() {
34
34
  let subscriptionSpec = null;
35
35
  let lastVariables = null;
36
36
  let artifactName = "";
@@ -79,5 +79,5 @@ const queryPlugin = (0, import_utils.documentPlugin)(import_types.ArtifactKind.Q
79
79
  });
80
80
  // Annotate the CommonJS export names for ESM import in node:
81
81
  0 && (module.exports = {
82
- queryPlugin
82
+ query
83
83
  });
@@ -1,5 +1,5 @@
1
1
  import type { ClientPluginContext } from '../documentStore';
2
- export declare function subscriptionPlugin(factory: SubscriptionHandler): import("../documentStore").ClientPlugin;
2
+ export declare function subscription(factory: SubscriptionHandler): import("../documentStore").ClientPlugin;
3
3
  export type SubscriptionHandler = (ctx: ClientPluginContext) => {
4
4
  subscribe: (payload: {
5
5
  query: string;
@@ -18,13 +18,13 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var subscription_exports = {};
20
20
  __export(subscription_exports, {
21
- subscriptionPlugin: () => subscriptionPlugin
21
+ subscription: () => subscription
22
22
  });
23
23
  module.exports = __toCommonJS(subscription_exports);
24
24
  var import_deepEquals = require("../../lib/deepEquals");
25
25
  var import_types = require("../../lib/types");
26
26
  var import_utils = require("../utils");
27
- function subscriptionPlugin(factory) {
27
+ function subscription(factory) {
28
28
  return (0, import_utils.documentPlugin)(import_types.ArtifactKind.Subscription, () => {
29
29
  let clearSubscription = null;
30
30
  let socketClient = null;
@@ -96,5 +96,5 @@ function subscriptionPlugin(factory) {
96
96
  }
97
97
  // Annotate the CommonJS export names for ESM import in node:
98
98
  0 && (module.exports = {
99
- subscriptionPlugin
99
+ subscription
100
100
  });
@@ -4,4 +4,4 @@ export type ThrowOnErrorParams = {
4
4
  operations: ('all' | 'query' | 'mutation' | 'subscription')[];
5
5
  error?: (errors: NonNullable<QueryResult<any, any>['errors']>) => unknown;
6
6
  };
7
- export declare const throwOnErrorPlugin: ({ operations, error }: ThrowOnErrorParams) => ClientPlugin;
7
+ export declare const throwOnError: ({ operations, error }: ThrowOnErrorParams) => ClientPlugin;
@@ -18,11 +18,11 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var throwOnError_exports = {};
20
20
  __export(throwOnError_exports, {
21
- throwOnErrorPlugin: () => throwOnErrorPlugin
21
+ throwOnError: () => throwOnError
22
22
  });
23
23
  module.exports = __toCommonJS(throwOnError_exports);
24
24
  var import_lib = require("../../lib");
25
- const throwOnErrorPlugin = ({ operations, error }) => () => {
25
+ const throwOnError = ({ operations, error }) => () => {
26
26
  const all = operations.includes("all");
27
27
  const throwOnKind = (kind) => all || {
28
28
  [import_lib.ArtifactKind.Query]: operations.includes("query"),
@@ -43,5 +43,5 @@ const throwOnErrorPlugin = ({ operations, error }) => () => {
43
43
  const defaultErrorFn = async (errors) => new Error(errors.map((error) => error.message).join(". ") + ".");
44
44
  // Annotate the CommonJS export names for ESM import in node:
45
45
  0 && (module.exports = {
46
- throwOnErrorPlugin
46
+ throwOnError
47
47
  });
@@ -183,4 +183,5 @@ export type RequestPayload<GraphQLObject = any> = {
183
183
  }[] | null;
184
184
  };
185
185
  export type NestedList<_Result = string> = (_Result | null | NestedList<_Result>)[];
186
+ export type ValueOf<Parent> = Parent[keyof Parent];
186
187
  export {};
@@ -3,7 +3,7 @@ import { deepEquals } from "../lib/deepEquals";
3
3
  import { marshalInputs, unmarshalSelection } from "../lib/scalars";
4
4
  import { Writable } from "../lib/store";
5
5
  import { ArtifactKind } from "../lib/types";
6
- import { cachePolicyPlugin } from "./plugins";
6
+ import { cachePolicy } from "./plugins";
7
7
  const steps = {
8
8
  forward: ["start", "beforeNetwork", "network"],
9
9
  backwards: ["end", "afterNetwork"]
@@ -49,7 +49,7 @@ class DocumentStore extends Writable {
49
49
  this.#lastVariables = null;
50
50
  this.#configFile = getCurrentConfig();
51
51
  this.#plugins = pipeline ?? [
52
- cachePolicyPlugin({
52
+ cachePolicy({
53
53
  enabled: cache,
54
54
  setFetching: (fetching2) => this.update((state) => ({ ...state, fetching: fetching2 }))
55
55
  })(),
@@ -4,7 +4,7 @@ import type { ClientPlugin, ClientHooks } from './documentStore';
4
4
  import { DocumentStore } from './documentStore';
5
5
  import { type FetchParamFn, type ThrowOnErrorParams } from './plugins';
6
6
  export { DocumentStore, type ClientPlugin } from './documentStore';
7
- export { fetchPlugin, mutationPlugin, queryPlugin, subscriptionPlugin } from './plugins';
7
+ export { fetch, mutation, query, subscription } from './plugins';
8
8
  type ConstructorArgs = {
9
9
  url: string;
10
10
  fetchParams?: FetchParamFn;