houdini 1.0.0-next.8 → 1.0.0

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 (92) hide show
  1. package/README.md +4 -1
  2. package/build/cmd-cjs/index.js +2325 -121
  3. package/build/cmd-esm/index.js +2325 -121
  4. package/build/codegen/generators/runtime/runtimeConfig.d.ts +7 -0
  5. package/build/codegen/generators/typescript/typeReference.d.ts +4 -2
  6. package/build/codegen/generators/typescript/types.d.ts +0 -1
  7. package/build/codegen/utils/flattenSelections.d.ts +1 -1
  8. package/build/codegen-cjs/index.js +2919 -689
  9. package/build/codegen-esm/index.js +2919 -689
  10. package/build/lib/config.d.ts +4 -6
  11. package/build/lib/types.d.ts +18 -15
  12. package/build/lib-cjs/index.js +3159 -171
  13. package/build/lib-esm/index.js +3152 -171
  14. package/build/runtime/cache/storage.d.ts +18 -15
  15. package/build/runtime/client/documentStore.d.ts +15 -13
  16. package/build/runtime/client/index.d.ts +1 -1
  17. package/build/runtime/client/plugins/cache.d.ts +1 -1
  18. package/build/runtime/client/plugins/fetch.d.ts +1 -1
  19. package/build/runtime/client/plugins/fetchParams.d.ts +1 -1
  20. package/build/runtime/client/plugins/mutation.d.ts +1 -1
  21. package/build/runtime/client/plugins/query.d.ts +1 -1
  22. package/build/runtime/client/plugins/subscription.d.ts +1 -1
  23. package/build/runtime/client/plugins/throwOnError.d.ts +1 -1
  24. package/build/runtime/client/utils/documentPlugins.d.ts +2 -2
  25. package/build/runtime/imports/pluginConfig.d.ts +3 -0
  26. package/build/runtime/lib/config.d.ts +2 -2
  27. package/build/runtime/lib/scalars.d.ts +1 -1
  28. package/build/runtime/lib/types.d.ts +42 -42
  29. package/build/runtime-cjs/cache/storage.d.ts +18 -15
  30. package/build/runtime-cjs/cache/storage.js +9 -11
  31. package/build/runtime-cjs/client/documentStore.d.ts +15 -13
  32. package/build/runtime-cjs/client/documentStore.js +11 -8
  33. package/build/runtime-cjs/client/index.d.ts +1 -1
  34. package/build/runtime-cjs/client/index.js +16 -13
  35. package/build/runtime-cjs/client/plugins/cache.d.ts +1 -1
  36. package/build/runtime-cjs/client/plugins/cache.js +6 -6
  37. package/build/runtime-cjs/client/plugins/fetch.d.ts +1 -1
  38. package/build/runtime-cjs/client/plugins/fetch.js +9 -9
  39. package/build/runtime-cjs/client/plugins/fetchParams.d.ts +1 -1
  40. package/build/runtime-cjs/client/plugins/fetchParams.js +3 -3
  41. package/build/runtime-cjs/client/plugins/mutation.d.ts +1 -1
  42. package/build/runtime-cjs/client/plugins/mutation.js +3 -3
  43. package/build/runtime-cjs/client/plugins/query.d.ts +1 -1
  44. package/build/runtime-cjs/client/plugins/query.js +4 -4
  45. package/build/runtime-cjs/client/plugins/subscription.d.ts +1 -1
  46. package/build/runtime-cjs/client/plugins/subscription.js +5 -5
  47. package/build/runtime-cjs/client/plugins/throwOnError.d.ts +1 -1
  48. package/build/runtime-cjs/client/plugins/throwOnError.js +3 -3
  49. package/build/runtime-cjs/client/utils/documentPlugins.d.ts +2 -2
  50. package/build/runtime-cjs/imports/pluginConfig.d.ts +3 -0
  51. package/build/runtime-cjs/imports/pluginConfig.js +27 -0
  52. package/build/runtime-cjs/lib/config.d.ts +2 -2
  53. package/build/runtime-cjs/lib/config.js +11 -1
  54. package/build/runtime-cjs/lib/scalars.d.ts +1 -1
  55. package/build/runtime-cjs/lib/scalars.js +13 -2
  56. package/build/runtime-cjs/lib/types.d.ts +42 -42
  57. package/build/runtime-cjs/lib/types.js +26 -30
  58. package/build/runtime-esm/cache/storage.d.ts +18 -15
  59. package/build/runtime-esm/cache/storage.js +9 -11
  60. package/build/runtime-esm/client/documentStore.d.ts +15 -13
  61. package/build/runtime-esm/client/documentStore.js +12 -9
  62. package/build/runtime-esm/client/index.d.ts +1 -1
  63. package/build/runtime-esm/client/index.js +13 -10
  64. package/build/runtime-esm/client/plugins/cache.d.ts +1 -1
  65. package/build/runtime-esm/client/plugins/cache.js +5 -5
  66. package/build/runtime-esm/client/plugins/fetch.d.ts +1 -1
  67. package/build/runtime-esm/client/plugins/fetch.js +8 -8
  68. package/build/runtime-esm/client/plugins/fetchParams.d.ts +1 -1
  69. package/build/runtime-esm/client/plugins/fetchParams.js +2 -2
  70. package/build/runtime-esm/client/plugins/mutation.d.ts +1 -1
  71. package/build/runtime-esm/client/plugins/mutation.js +2 -2
  72. package/build/runtime-esm/client/plugins/query.d.ts +1 -1
  73. package/build/runtime-esm/client/plugins/query.js +3 -3
  74. package/build/runtime-esm/client/plugins/subscription.d.ts +1 -1
  75. package/build/runtime-esm/client/plugins/subscription.js +4 -4
  76. package/build/runtime-esm/client/plugins/throwOnError.d.ts +1 -1
  77. package/build/runtime-esm/client/plugins/throwOnError.js +2 -2
  78. package/build/runtime-esm/client/utils/documentPlugins.d.ts +2 -2
  79. package/build/runtime-esm/imports/pluginConfig.d.ts +3 -0
  80. package/build/runtime-esm/imports/pluginConfig.js +5 -0
  81. package/build/runtime-esm/lib/config.d.ts +2 -2
  82. package/build/runtime-esm/lib/config.js +11 -1
  83. package/build/runtime-esm/lib/scalars.d.ts +1 -1
  84. package/build/runtime-esm/lib/scalars.js +13 -2
  85. package/build/runtime-esm/lib/types.d.ts +42 -42
  86. package/build/runtime-esm/lib/types.js +26 -30
  87. package/build/test-cjs/index.js +2302 -98
  88. package/build/test-esm/index.js +2302 -98
  89. package/build/vite/houdini.d.ts +2 -0
  90. package/build/vite-cjs/index.js +2328 -122
  91. package/build/vite-esm/index.js +2328 -122
  92. package/package.json +2 -2
@@ -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,18 +24,18 @@ 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
36
36
  }) => () => {
37
37
  return {
38
- network(ctx, { next, resolve, marshalVariables }) {
38
+ network(ctx, { initialValue, next, resolve, marshalVariables }) {
39
39
  const { policy, artifact } = ctx;
40
40
  let useCache = false;
41
41
  if (enabled && artifact.kind === import_types.ArtifactKind.Query && !ctx.cacheParams?.disableRead) {
@@ -49,10 +49,10 @@ const cachePolicyPlugin = ({
49
49
  return resolve(ctx, {
50
50
  fetching: false,
51
51
  variables: ctx.variables ?? null,
52
- data: value.data,
52
+ data: allowed ? value.data : initialValue.data,
53
53
  errors: null,
54
54
  source: import_types.DataSource.Cache,
55
- partial: value.partial,
55
+ partial: allowed ? value.partial : false,
56
56
  stale: value.stale
57
57
  });
58
58
  }
@@ -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 || {},
@@ -53,7 +53,7 @@ const fetchPlugin = (target) => {
53
53
  });
54
54
  resolve(ctx, {
55
55
  fetching: false,
56
- variables: ctx.variables ?? null,
56
+ variables: ctx.variables ?? {},
57
57
  data: result.data,
58
58
  errors: !result.errors || result.errors.length === 0 ? null : result.errors,
59
59
  partial: false,
@@ -67,11 +67,11 @@ const fetchPlugin = (target) => {
67
67
  const defaultFetch = (url, params) => {
68
68
  if (!url) {
69
69
  throw new Error(
70
- "Could not find configured client url. Please specify one in your houdini.config.js file."
70
+ "Could not find configured client url. Please specify one in your HoudiniClient constructor."
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 = "";
@@ -61,7 +61,7 @@ const queryPlugin = (0, import_utils.documentPlugin)(import_types.ArtifactKind.Q
61
61
  partial: false,
62
62
  stale: false,
63
63
  source: import_types.DataSource.Cache,
64
- variables: ctx.variables ?? null
64
+ variables: ctx.variables ?? {}
65
65
  });
66
66
  }
67
67
  };
@@ -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;
@@ -68,7 +68,7 @@ function subscriptionPlugin(factory) {
68
68
  partial: true,
69
69
  stale: false,
70
70
  source: import_types.DataSource.Network,
71
- variables: ctx.variables ?? null
71
+ variables: ctx.variables ?? {}
72
72
  });
73
73
  },
74
74
  error(data) {
@@ -80,7 +80,7 @@ function subscriptionPlugin(factory) {
80
80
  data: null,
81
81
  errors: [data],
82
82
  fetching: false,
83
- variables: ctx.variables ?? null
83
+ variables: ctx.variables ?? {}
84
84
  });
85
85
  },
86
86
  complete() {
@@ -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
  });
@@ -1,3 +1,3 @@
1
- import type { ArtifactKind } from '../../lib/types';
1
+ import type { ArtifactKinds } from '../../lib/types';
2
2
  import type { ClientPlugin, ClientHooks } from '../documentStore';
3
- export declare const documentPlugin: (kind: ArtifactKind, source: () => ClientHooks) => ClientPlugin;
3
+ export declare const documentPlugin: (kind: ArtifactKinds, source: () => ClientHooks) => ClientPlugin;
@@ -0,0 +1,3 @@
1
+ import type { ConfigFile } from '../lib/config';
2
+ declare const configs: ((old: ConfigFile) => ConfigFile)[];
3
+ export default configs;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var pluginConfig_exports = {};
20
+ __export(pluginConfig_exports, {
21
+ default: () => pluginConfig_default
22
+ });
23
+ module.exports = __toCommonJS(pluginConfig_exports);
24
+ const configs = [];
25
+ var pluginConfig_default = configs;
26
+ // Annotate the CommonJS export names for ESM import in node:
27
+ 0 && (module.exports = {});
@@ -1,5 +1,5 @@
1
1
  import type { GraphQLSchema } from 'graphql';
2
- import type { CachePolicy } from './types';
2
+ import type { CachePolicies } from './types';
3
3
  export declare function getMockConfig(): ConfigFile | null;
4
4
  export declare function setMockConfig(config: ConfigFile | null): void;
5
5
  export declare function defaultConfigValues(file: ConfigFile): ConfigFile;
@@ -50,7 +50,7 @@ export type ConfigFile = {
50
50
  /**
51
51
  * The default cache policy to use for queries. For more information: https://www.houdinigraphql.com/guides/caching-data
52
52
  */
53
- defaultCachePolicy?: CachePolicy;
53
+ defaultCachePolicy?: CachePolicies;
54
54
  /**
55
55
  * Specifies whether or not the cache should always use partial data. For more information: https://www.houdinigraphql.com/guides/caching-data#partial-data
56
56
  */
@@ -33,6 +33,7 @@ __export(config_exports, {
33
33
  });
34
34
  module.exports = __toCommonJS(config_exports);
35
35
  var import_config = __toESM(require("../imports/config"), 1);
36
+ var import_pluginConfig = __toESM(require("../imports/pluginConfig"), 1);
36
37
  let mockConfig = null;
37
38
  function getMockConfig() {
38
39
  return mockConfig;
@@ -67,12 +68,21 @@ function computeID(configFile, type, data) {
67
68
  }
68
69
  return id.slice(0, -2);
69
70
  }
71
+ let _configFile = null;
70
72
  function getCurrentConfig() {
71
73
  const mockConfig2 = getMockConfig();
72
74
  if (mockConfig2) {
73
75
  return mockConfig2;
74
76
  }
75
- return defaultConfigValues(import_config.default);
77
+ if (_configFile) {
78
+ return _configFile;
79
+ }
80
+ let configFile = defaultConfigValues(import_config.default);
81
+ for (const pluginConfig of import_pluginConfig.default) {
82
+ configFile = pluginConfig(configFile);
83
+ }
84
+ _configFile = configFile;
85
+ return configFile;
76
86
  }
77
87
  // Annotate the CommonJS export names for ESM import in node:
78
88
  0 && (module.exports = {
@@ -12,4 +12,4 @@ export declare function marshalInputs<T>({ artifact, input, config, rootType, }:
12
12
  }): {} | null | undefined;
13
13
  export declare function unmarshalSelection(config: ConfigFile, selection: SubscriptionSelection, data: any): {} | null | undefined;
14
14
  export declare function isScalar(config: ConfigFile, type: string): boolean;
15
- export declare function parseScalar(config: ConfigFile, type: string, value: string): string | number | boolean;
15
+ export declare function parseScalar(config: ConfigFile, type: string, value?: string): string | number | boolean | undefined;
@@ -145,6 +145,9 @@ function isScalar(config, type) {
145
145
  return ["String", "Boolean", "Float", "ID", "Int"].concat(Object.keys(config.scalars || {})).includes(type);
146
146
  }
147
147
  function parseScalar(config, type, value) {
148
+ if (typeof value === "undefined") {
149
+ return void 0;
150
+ }
148
151
  if (type === "Boolean") {
149
152
  return value === "true";
150
153
  }
@@ -155,10 +158,18 @@ function parseScalar(config, type, value) {
155
158
  return value;
156
159
  }
157
160
  if (type === "Int") {
158
- return parseInt(value, 10);
161
+ const result = parseInt(value, 10);
162
+ if (Number.isNaN(result)) {
163
+ return void 0;
164
+ }
165
+ return result;
159
166
  }
160
167
  if (type === "Float") {
161
- return parseFloat(value);
168
+ const result = parseFloat(value);
169
+ if (Number.isNaN(result)) {
170
+ return void 0;
171
+ }
172
+ return result;
162
173
  }
163
174
  if (config.scalars?.[type]?.marshal) {
164
175
  return config.scalars[type]?.marshal(value);
@@ -1,9 +1,11 @@
1
- export declare enum CachePolicy {
2
- CacheOrNetwork = "CacheOrNetwork",
3
- CacheOnly = "CacheOnly",
4
- NetworkOnly = "NetworkOnly",
5
- CacheAndNetwork = "CacheAndNetwork"
6
- }
1
+ export declare const CachePolicy: {
2
+ readonly CacheOrNetwork: "CacheOrNetwork";
3
+ readonly CacheOnly: "CacheOnly";
4
+ readonly NetworkOnly: "NetworkOnly";
5
+ readonly CacheAndNetwork: "CacheAndNetwork";
6
+ };
7
+ type ValuesOf<Target> = Target[keyof Target];
8
+ export type CachePolicies = ValuesOf<typeof CachePolicy>;
7
9
  declare global {
8
10
  namespace App {
9
11
  interface Session {
@@ -29,42 +31,38 @@ export type Operation<_Result, _Input> = {
29
31
  };
30
32
  export type Maybe<T> = T | null | undefined;
31
33
  export type DocumentArtifact = FragmentArtifact | QueryArtifact | MutationArtifact | SubscriptionArtifact;
32
- export declare enum ArtifactKind {
33
- Query = "HoudiniQuery",
34
- Subscription = "HoudiniSubscription",
35
- Mutation = "HoudiniMutation",
36
- Fragment = "HoudiniFragment"
37
- }
38
- export declare const CompiledFragmentKind = ArtifactKind.Fragment;
39
- export declare const CompiledMutationKind = ArtifactKind.Mutation;
40
- export declare const CompiledQueryKind = ArtifactKind.Query;
41
- export declare const CompiledSubscriptionKind = ArtifactKind.Subscription;
42
- export type CompiledDocumentKind = ArtifactKind;
43
- export type QueryArtifact = BaseCompiledDocument & {
44
- kind: ArtifactKind.Query;
45
- policy?: CachePolicy;
34
+ export declare const ArtifactKind: {
35
+ readonly Query: "HoudiniQuery";
36
+ readonly Subscription: "HoudiniSubscription";
37
+ readonly Mutation: "HoudiniMutation";
38
+ readonly Fragment: "HoudiniFragment";
39
+ };
40
+ export type ArtifactKinds = ValuesOf<typeof ArtifactKind>;
41
+ export declare const CompiledFragmentKind: "HoudiniFragment";
42
+ export declare const CompiledMutationKind: "HoudiniMutation";
43
+ export declare const CompiledQueryKind: "HoudiniQuery";
44
+ export declare const CompiledSubscriptionKind: "HoudiniSubscription";
45
+ export type CompiledDocumentKind = ArtifactKinds;
46
+ export type QueryArtifact = BaseCompiledDocument<'HoudiniQuery'> & {
47
+ policy?: CachePolicies;
46
48
  partial?: boolean;
47
49
  };
48
- export type MutationArtifact = BaseCompiledDocument & {
49
- kind: ArtifactKind.Mutation;
50
- };
51
- export type FragmentArtifact = BaseCompiledDocument & {
52
- kind: ArtifactKind.Fragment;
53
- };
54
- export type SubscriptionArtifact = BaseCompiledDocument & {
55
- kind: ArtifactKind.Subscription;
50
+ export type MutationArtifact = BaseCompiledDocument<'HoudiniMutation'>;
51
+ export type FragmentArtifact = BaseCompiledDocument<'HoudiniFragment'>;
52
+ export type SubscriptionArtifact = BaseCompiledDocument<'HoudiniSubscription'>;
53
+ export declare const RefetchUpdateMode: {
54
+ readonly append: "append";
55
+ readonly prepend: "prepend";
56
+ readonly replace: "replace";
56
57
  };
57
- export declare enum RefetchUpdateMode {
58
- append = "append",
59
- prepend = "prepend",
60
- replace = "replace"
61
- }
58
+ export type RefetchUpdateModes = ValuesOf<typeof RefetchUpdateMode>;
62
59
  export type InputObject = {
63
60
  fields: Record<string, string>;
64
61
  types: Record<string, Record<string, string>>;
65
62
  };
66
- export type BaseCompiledDocument = {
63
+ export type BaseCompiledDocument<_Kind extends ArtifactKinds> = {
67
64
  name: string;
65
+ kind: _Kind;
68
66
  raw: string;
69
67
  hash: string;
70
68
  selection: SubscriptionSelection;
@@ -80,7 +78,7 @@ export type BaseCompiledDocument = {
80
78
  paginated: boolean;
81
79
  direction: 'forward' | 'backward' | 'both';
82
80
  };
83
- plugin_data?: Record<string, any>;
81
+ pluginData?: Record<string, any>;
84
82
  };
85
83
  export type HoudiniFetchContext = {
86
84
  variables: () => {};
@@ -92,20 +90,21 @@ export type ListWhen = {
92
90
  must?: Filter;
93
91
  must_not?: Filter;
94
92
  };
95
- export declare enum DataSource {
93
+ export declare const DataSource: {
96
94
  /**
97
95
  * from the browser cache
98
96
  */
99
- Cache = "cache",
97
+ readonly Cache: "cache";
100
98
  /**
101
99
  * from a browser side `fetch`
102
100
  */
103
- Network = "network",
101
+ readonly Network: "network";
104
102
  /**
105
103
  * from a server side `fetch`
106
104
  */
107
- Ssr = "ssr"
108
- }
105
+ readonly Ssr: "ssr";
106
+ };
107
+ export type DataSources = ValuesOf<typeof DataSource>;
109
108
  export type MutationOperation = {
110
109
  action: 'insert' | 'remove' | 'delete' | 'toggle';
111
110
  list?: string;
@@ -163,7 +162,7 @@ export type SubscriptionSpec = {
163
162
  };
164
163
  export type FetchQueryResult<_Data> = {
165
164
  result: RequestPayload<_Data | null>;
166
- source: DataSource | null;
165
+ source: DataSources | null;
167
166
  };
168
167
  export type QueryResult<_Data = GraphQLObject, _Input = Record<string, any>> = {
169
168
  data: _Data | null;
@@ -173,7 +172,7 @@ export type QueryResult<_Data = GraphQLObject, _Input = Record<string, any>> = {
173
172
  fetching: boolean;
174
173
  partial: boolean;
175
174
  stale: boolean;
176
- source: DataSource | null;
175
+ source: DataSources | null;
177
176
  variables: _Input | null;
178
177
  };
179
178
  export type RequestPayload<GraphQLObject = any> = {
@@ -183,4 +182,5 @@ export type RequestPayload<GraphQLObject = any> = {
183
182
  }[] | null;
184
183
  };
185
184
  export type NestedList<_Result = string> = (_Result | null | NestedList<_Result>)[];
185
+ export type ValueOf<Parent> = Parent[keyof Parent];
186
186
  export {};
@@ -28,36 +28,32 @@ __export(types_exports, {
28
28
  RefetchUpdateMode: () => RefetchUpdateMode
29
29
  });
30
30
  module.exports = __toCommonJS(types_exports);
31
- var CachePolicy = /* @__PURE__ */ ((CachePolicy2) => {
32
- CachePolicy2["CacheOrNetwork"] = "CacheOrNetwork";
33
- CachePolicy2["CacheOnly"] = "CacheOnly";
34
- CachePolicy2["NetworkOnly"] = "NetworkOnly";
35
- CachePolicy2["CacheAndNetwork"] = "CacheAndNetwork";
36
- return CachePolicy2;
37
- })(CachePolicy || {});
38
- var ArtifactKind = /* @__PURE__ */ ((ArtifactKind2) => {
39
- ArtifactKind2["Query"] = "HoudiniQuery";
40
- ArtifactKind2["Subscription"] = "HoudiniSubscription";
41
- ArtifactKind2["Mutation"] = "HoudiniMutation";
42
- ArtifactKind2["Fragment"] = "HoudiniFragment";
43
- return ArtifactKind2;
44
- })(ArtifactKind || {});
45
- const CompiledFragmentKind = "HoudiniFragment" /* Fragment */;
46
- const CompiledMutationKind = "HoudiniMutation" /* Mutation */;
47
- const CompiledQueryKind = "HoudiniQuery" /* Query */;
48
- const CompiledSubscriptionKind = "HoudiniSubscription" /* Subscription */;
49
- var RefetchUpdateMode = /* @__PURE__ */ ((RefetchUpdateMode2) => {
50
- RefetchUpdateMode2["append"] = "append";
51
- RefetchUpdateMode2["prepend"] = "prepend";
52
- RefetchUpdateMode2["replace"] = "replace";
53
- return RefetchUpdateMode2;
54
- })(RefetchUpdateMode || {});
55
- var DataSource = /* @__PURE__ */ ((DataSource2) => {
56
- DataSource2["Cache"] = "cache";
57
- DataSource2["Network"] = "network";
58
- DataSource2["Ssr"] = "ssr";
59
- return DataSource2;
60
- })(DataSource || {});
31
+ const CachePolicy = {
32
+ CacheOrNetwork: "CacheOrNetwork",
33
+ CacheOnly: "CacheOnly",
34
+ NetworkOnly: "NetworkOnly",
35
+ CacheAndNetwork: "CacheAndNetwork"
36
+ };
37
+ const ArtifactKind = {
38
+ Query: "HoudiniQuery",
39
+ Subscription: "HoudiniSubscription",
40
+ Mutation: "HoudiniMutation",
41
+ Fragment: "HoudiniFragment"
42
+ };
43
+ const CompiledFragmentKind = ArtifactKind.Fragment;
44
+ const CompiledMutationKind = ArtifactKind.Mutation;
45
+ const CompiledQueryKind = ArtifactKind.Query;
46
+ const CompiledSubscriptionKind = ArtifactKind.Subscription;
47
+ const RefetchUpdateMode = {
48
+ append: "append",
49
+ prepend: "prepend",
50
+ replace: "replace"
51
+ };
52
+ const DataSource = {
53
+ Cache: "cache",
54
+ Network: "network",
55
+ Ssr: "ssr"
56
+ };
61
57
  // Annotate the CommonJS export names for ESM import in node:
62
58
  0 && (module.exports = {
63
59
  ArtifactKind,