houdini 1.0.0-next.2 → 1.0.0-next.20

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 (195) hide show
  1. package/README.md +4 -1
  2. package/build/cmd-cjs/index.js +5366 -2772
  3. package/build/cmd-esm/index.js +5340 -2746
  4. package/build/codegen/generators/artifacts/index.d.ts +2 -2
  5. package/build/codegen/generators/artifacts/indexFile.d.ts +2 -2
  6. package/build/codegen/generators/artifacts/selection.d.ts +5 -5
  7. package/build/codegen/generators/artifacts/utils.d.ts +0 -1
  8. package/build/codegen/generators/indexFile/index.d.ts +2 -2
  9. package/build/codegen/generators/persistedQueries/index.d.ts +2 -2
  10. package/build/codegen/generators/runtime/graphqlFunction.d.ts +2 -2
  11. package/build/codegen/generators/runtime/index.d.ts +2 -2
  12. package/build/codegen/generators/runtime/runtimeConfig.d.ts +7 -0
  13. package/build/codegen/generators/typescript/documentTypes.d.ts +2 -0
  14. package/build/codegen/generators/typescript/imperativeTypeDef.d.ts +2 -0
  15. package/build/codegen/generators/typescript/index.d.ts +2 -2
  16. package/build/codegen/generators/typescript/typeReference.d.ts +4 -2
  17. package/build/codegen/generators/typescript/types.d.ts +0 -1
  18. package/build/codegen/index.d.ts +2 -2
  19. package/build/codegen/transforms/addID.d.ts +2 -2
  20. package/build/codegen/transforms/composeQueries.d.ts +4 -4
  21. package/build/codegen/transforms/fragmentVariables.d.ts +3 -2
  22. package/build/codegen/transforms/list.d.ts +2 -2
  23. package/build/codegen/transforms/paginate.d.ts +2 -2
  24. package/build/codegen/transforms/schema.d.ts +2 -2
  25. package/build/codegen/transforms/typename.d.ts +2 -2
  26. package/build/codegen/utils/flattenSelections.d.ts +1 -1
  27. package/build/codegen/validators/noIDAlias.d.ts +2 -2
  28. package/build/codegen/validators/plugins.d.ts +2 -2
  29. package/build/codegen/validators/typeCheck.d.ts +2 -2
  30. package/build/codegen/validators/uniqueNames.d.ts +2 -2
  31. package/build/codegen-cjs/index.js +4694 -2137
  32. package/build/codegen-esm/index.js +4682 -2125
  33. package/build/lib/config.d.ts +15 -96
  34. package/build/lib/deepMerge.d.ts +1 -0
  35. package/build/lib/graphql.d.ts +5 -2
  36. package/build/lib/index.d.ts +2 -0
  37. package/build/lib/path.d.ts +1 -1
  38. package/build/lib/pipeline.d.ts +1 -1
  39. package/build/lib/plugin.d.ts +2 -0
  40. package/build/lib/types.d.ts +257 -6
  41. package/build/lib/walk.d.ts +4 -1
  42. package/build/lib-cjs/index.js +4108 -928
  43. package/build/lib-esm/index.js +4078 -907
  44. package/build/runtime/cache/cache.d.ts +28 -11
  45. package/build/runtime/cache/lists.d.ts +1 -0
  46. package/build/runtime/cache/staleManager.d.ts +30 -0
  47. package/build/runtime/cache/storage.d.ts +23 -20
  48. package/build/runtime/cache/stuff.d.ts +0 -2
  49. package/build/runtime/cache/subscription.d.ts +2 -1
  50. package/build/runtime/client/documentStore.d.ts +20 -17
  51. package/build/runtime/client/index.d.ts +13 -11
  52. package/build/runtime/client/plugins/cache.d.ts +1 -1
  53. package/build/runtime/client/plugins/fetch.d.ts +1 -1
  54. package/build/runtime/client/plugins/fetchParams.d.ts +2 -2
  55. package/build/runtime/client/plugins/injectedPlugins.d.ts +2 -1
  56. package/build/runtime/client/plugins/mutation.d.ts +1 -1
  57. package/build/runtime/client/plugins/query.d.ts +1 -1
  58. package/build/runtime/client/plugins/subscription.d.ts +2 -3
  59. package/build/runtime/client/plugins/throwOnError.d.ts +1 -1
  60. package/build/runtime/client/utils/documentPlugins.d.ts +3 -3
  61. package/build/runtime/generated.d.ts +1 -0
  62. package/build/runtime/imports/pluginConfig.d.ts +3 -0
  63. package/build/runtime/index.d.ts +1 -1
  64. package/build/runtime/lib/config.d.ts +27 -24
  65. package/build/runtime/lib/flatten.d.ts +2 -0
  66. package/build/runtime/lib/index.d.ts +1 -0
  67. package/build/runtime/lib/key.d.ts +6 -0
  68. package/build/runtime/lib/scalars.d.ts +3 -3
  69. package/build/runtime/lib/types.d.ts +46 -46
  70. package/build/runtime/public/cache.d.ts +26 -6
  71. package/build/runtime/public/record.d.ts +26 -17
  72. package/build/runtime/public/tests/test.d.ts +52 -10
  73. package/build/runtime/public/types.d.ts +8 -0
  74. package/build/runtime-cjs/cache/cache.d.ts +28 -11
  75. package/build/runtime-cjs/cache/cache.js +97 -22
  76. package/build/runtime-cjs/cache/gc.js +9 -0
  77. package/build/runtime-cjs/cache/lists.d.ts +1 -0
  78. package/build/runtime-cjs/cache/lists.js +9 -6
  79. package/build/runtime-cjs/cache/staleManager.d.ts +30 -0
  80. package/build/runtime-cjs/cache/staleManager.js +95 -0
  81. package/build/runtime-cjs/cache/storage.d.ts +23 -20
  82. package/build/runtime-cjs/cache/storage.js +11 -13
  83. package/build/runtime-cjs/cache/stuff.d.ts +0 -2
  84. package/build/runtime-cjs/cache/stuff.js +2 -19
  85. package/build/runtime-cjs/cache/subscription.d.ts +2 -1
  86. package/build/runtime-cjs/cache/subscription.js +11 -7
  87. package/build/runtime-cjs/client/documentStore.d.ts +20 -17
  88. package/build/runtime-cjs/client/documentStore.js +12 -8
  89. package/build/runtime-cjs/client/index.d.ts +13 -11
  90. package/build/runtime-cjs/client/index.js +48 -19
  91. package/build/runtime-cjs/client/plugins/cache.d.ts +1 -1
  92. package/build/runtime-cjs/client/plugins/cache.js +10 -8
  93. package/build/runtime-cjs/client/plugins/fetch.d.ts +1 -1
  94. package/build/runtime-cjs/client/plugins/fetch.js +9 -8
  95. package/build/runtime-cjs/client/plugins/fetchParams.d.ts +2 -2
  96. package/build/runtime-cjs/client/plugins/fetchParams.js +9 -4
  97. package/build/runtime-cjs/client/plugins/injectedPlugins.d.ts +2 -1
  98. package/build/runtime-cjs/client/plugins/mutation.d.ts +1 -1
  99. package/build/runtime-cjs/client/plugins/mutation.js +3 -3
  100. package/build/runtime-cjs/client/plugins/query.d.ts +1 -1
  101. package/build/runtime-cjs/client/plugins/query.js +4 -4
  102. package/build/runtime-cjs/client/plugins/subscription.d.ts +2 -3
  103. package/build/runtime-cjs/client/plugins/subscription.js +5 -3
  104. package/build/runtime-cjs/client/plugins/throwOnError.d.ts +1 -1
  105. package/build/runtime-cjs/client/plugins/throwOnError.js +3 -3
  106. package/build/runtime-cjs/client/utils/documentPlugins.d.ts +3 -3
  107. package/build/runtime-cjs/generated.d.ts +1 -0
  108. package/build/runtime-cjs/imports/pluginConfig.d.ts +3 -0
  109. package/build/runtime-cjs/imports/pluginConfig.js +27 -0
  110. package/build/runtime-cjs/index.d.ts +1 -1
  111. package/build/runtime-cjs/lib/config.d.ts +27 -24
  112. package/build/runtime-cjs/lib/config.js +11 -1
  113. package/build/runtime-cjs/lib/flatten.d.ts +2 -0
  114. package/build/runtime-cjs/lib/flatten.js +41 -0
  115. package/build/runtime-cjs/lib/index.d.ts +1 -0
  116. package/build/runtime-cjs/lib/index.js +1 -0
  117. package/build/runtime-cjs/lib/key.d.ts +6 -0
  118. package/build/runtime-cjs/lib/key.js +41 -0
  119. package/build/runtime-cjs/lib/scalars.d.ts +3 -3
  120. package/build/runtime-cjs/lib/scalars.js +13 -2
  121. package/build/runtime-cjs/lib/types.d.ts +46 -46
  122. package/build/runtime-cjs/lib/types.js +26 -30
  123. package/build/runtime-cjs/public/cache.d.ts +26 -6
  124. package/build/runtime-cjs/public/cache.js +32 -32
  125. package/build/runtime-cjs/public/list.js +6 -28
  126. package/build/runtime-cjs/public/record.d.ts +26 -17
  127. package/build/runtime-cjs/public/record.js +27 -187
  128. package/build/runtime-cjs/public/tests/test.d.ts +52 -10
  129. package/build/runtime-cjs/public/tests/test.js +27 -2
  130. package/build/runtime-cjs/public/types.d.ts +8 -0
  131. package/build/runtime-esm/cache/cache.d.ts +28 -11
  132. package/build/runtime-esm/cache/cache.js +99 -24
  133. package/build/runtime-esm/cache/gc.js +9 -0
  134. package/build/runtime-esm/cache/lists.d.ts +1 -0
  135. package/build/runtime-esm/cache/lists.js +9 -6
  136. package/build/runtime-esm/cache/staleManager.d.ts +30 -0
  137. package/build/runtime-esm/cache/staleManager.js +71 -0
  138. package/build/runtime-esm/cache/storage.d.ts +23 -20
  139. package/build/runtime-esm/cache/storage.js +11 -13
  140. package/build/runtime-esm/cache/stuff.d.ts +0 -2
  141. package/build/runtime-esm/cache/stuff.js +1 -17
  142. package/build/runtime-esm/cache/subscription.d.ts +2 -1
  143. package/build/runtime-esm/cache/subscription.js +12 -8
  144. package/build/runtime-esm/client/documentStore.d.ts +20 -17
  145. package/build/runtime-esm/client/documentStore.js +13 -9
  146. package/build/runtime-esm/client/index.d.ts +13 -11
  147. package/build/runtime-esm/client/index.js +49 -21
  148. package/build/runtime-esm/client/plugins/cache.d.ts +1 -1
  149. package/build/runtime-esm/client/plugins/cache.js +9 -7
  150. package/build/runtime-esm/client/plugins/fetch.d.ts +1 -1
  151. package/build/runtime-esm/client/plugins/fetch.js +8 -7
  152. package/build/runtime-esm/client/plugins/fetchParams.d.ts +2 -2
  153. package/build/runtime-esm/client/plugins/fetchParams.js +8 -3
  154. package/build/runtime-esm/client/plugins/injectedPlugins.d.ts +2 -1
  155. package/build/runtime-esm/client/plugins/mutation.d.ts +1 -1
  156. package/build/runtime-esm/client/plugins/mutation.js +2 -2
  157. package/build/runtime-esm/client/plugins/query.d.ts +1 -1
  158. package/build/runtime-esm/client/plugins/query.js +3 -3
  159. package/build/runtime-esm/client/plugins/subscription.d.ts +2 -3
  160. package/build/runtime-esm/client/plugins/subscription.js +4 -2
  161. package/build/runtime-esm/client/plugins/throwOnError.d.ts +1 -1
  162. package/build/runtime-esm/client/plugins/throwOnError.js +2 -2
  163. package/build/runtime-esm/client/utils/documentPlugins.d.ts +3 -3
  164. package/build/runtime-esm/generated.d.ts +1 -0
  165. package/build/runtime-esm/imports/pluginConfig.d.ts +3 -0
  166. package/build/runtime-esm/imports/pluginConfig.js +5 -0
  167. package/build/runtime-esm/index.d.ts +1 -1
  168. package/build/runtime-esm/lib/config.d.ts +27 -24
  169. package/build/runtime-esm/lib/config.js +11 -1
  170. package/build/runtime-esm/lib/flatten.d.ts +2 -0
  171. package/build/runtime-esm/lib/flatten.js +17 -0
  172. package/build/runtime-esm/lib/index.d.ts +1 -0
  173. package/build/runtime-esm/lib/index.js +1 -0
  174. package/build/runtime-esm/lib/key.d.ts +6 -0
  175. package/build/runtime-esm/lib/key.js +17 -0
  176. package/build/runtime-esm/lib/scalars.d.ts +3 -3
  177. package/build/runtime-esm/lib/scalars.js +13 -2
  178. package/build/runtime-esm/lib/types.d.ts +46 -46
  179. package/build/runtime-esm/lib/types.js +26 -30
  180. package/build/runtime-esm/public/cache.d.ts +26 -6
  181. package/build/runtime-esm/public/cache.js +31 -30
  182. package/build/runtime-esm/public/list.js +6 -28
  183. package/build/runtime-esm/public/record.d.ts +26 -17
  184. package/build/runtime-esm/public/record.js +26 -183
  185. package/build/runtime-esm/public/tests/test.d.ts +52 -10
  186. package/build/runtime-esm/public/tests/test.js +26 -1
  187. package/build/runtime-esm/public/types.d.ts +8 -0
  188. package/build/test/index.d.ts +3 -3
  189. package/build/test-cjs/index.js +5007 -2465
  190. package/build/test-esm/index.js +4995 -2453
  191. package/build/vite/houdini.d.ts +2 -0
  192. package/build/vite-cjs/index.js +5344 -2744
  193. package/build/vite-esm/index.js +5319 -2719
  194. package/package.json +6 -5
  195. package/build/codegen/generators/typescript/imperativeCache.d.ts +0 -2
@@ -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;
@@ -66,6 +66,7 @@ function subscriptionPlugin(factory) {
66
66
  errors: [...errors ?? []],
67
67
  fetching: false,
68
68
  partial: true,
69
+ stale: false,
69
70
  source: import_types.DataSource.Network,
70
71
  variables: ctx.variables ?? null
71
72
  });
@@ -74,6 +75,7 @@ function subscriptionPlugin(factory) {
74
75
  clearSubscription?.();
75
76
  resolve(ctx, {
76
77
  partial: true,
78
+ stale: false,
77
79
  source: import_types.DataSource.Network,
78
80
  data: null,
79
81
  errors: [data],
@@ -94,5 +96,5 @@ function subscriptionPlugin(factory) {
94
96
  }
95
97
  // Annotate the CommonJS export names for ESM import in node:
96
98
  0 && (module.exports = {
97
- subscriptionPlugin
99
+ subscription
98
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';
2
- import type { ClientPlugin } from '../documentStore';
3
- export declare const documentPlugin: (kind: ArtifactKind, source: ClientPlugin) => ClientPlugin;
1
+ import type { ArtifactKinds } from '../../lib/types';
2
+ import type { ClientPlugin, ClientHooks } from '../documentStore';
3
+ export declare const documentPlugin: (kind: ArtifactKinds, source: () => ClientHooks) => ClientPlugin;
@@ -1,4 +1,5 @@
1
1
  export type CacheTypeDef = {
2
2
  types: {};
3
3
  lists: {};
4
+ queries: [];
4
5
  };
@@ -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 = {});
@@ -3,6 +3,6 @@ import type { CacheTypeDef } from './generated';
3
3
  import { Cache } from './public';
4
4
  export * from './client';
5
5
  export * from './lib';
6
- export declare function graphql(str: string | TemplateStringsArray): any;
6
+ export declare function graphql<_Payload>(str: TemplateStringsArray): _Payload;
7
7
  export declare const cache: Cache<CacheTypeDef>;
8
8
  export declare function getCache(): InternalCache;
@@ -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;
@@ -31,10 +31,6 @@ export type ConfigFile = {
31
31
  * FYI: `schemaPath` or `schema` should be defined
32
32
  */
33
33
  schema?: string | GraphQLSchema;
34
- /**
35
- * A url to use to pull the schema. For more information: https://www.houdinigraphql.com/api/cli#generate
36
- */
37
- apiUrl?: string | ((env: Record<string, string | undefined>) => string);
38
34
  /**
39
35
  * An object describing custom scalars for your project. For more information: https://www.houdinigraphql.com/api/config#custom-scalars
40
36
  */
@@ -43,11 +39,6 @@ export type ConfigFile = {
43
39
  * A path that the generator will use to write schema.graphql and documents.gql files containing all of the internal fragment and directive definitions used in the project.
44
40
  */
45
41
  definitionsPath?: string;
46
- /**
47
- * One of "kit" or "svelte". Used to tell the preprocessor what kind of loading paradigm to generate for you. (default: `kit`)
48
- * @deprecated please follow the steps here: http://www.houdinigraphql.com/guides/release-notes#0170
49
- */
50
- framework?: 'kit' | 'svelte';
51
42
  /**
52
43
  * One of "esm" or "commonjs". Tells the artifact generator what kind of modules to create. (default: `esm`)
53
44
  */
@@ -59,11 +50,15 @@ export type ConfigFile = {
59
50
  /**
60
51
  * The default cache policy to use for queries. For more information: https://www.houdinigraphql.com/guides/caching-data
61
52
  */
62
- defaultCachePolicy?: CachePolicy;
53
+ defaultCachePolicy?: CachePolicies;
63
54
  /**
64
55
  * Specifies whether or not the cache should always use partial data. For more information: https://www.houdinigraphql.com/guides/caching-data#partial-data
65
56
  */
66
57
  defaultPartial?: boolean;
58
+ /**
59
+ * Specifies after how long a data goes stale in miliseconds. (default: `undefined`)
60
+ */
61
+ defaultLifetime?: number;
67
62
  /**
68
63
  * Specifies whether mutations should append or prepend list. For more information: https://www.houdinigraphql.com/api/graphql (default: `append`)
69
64
  */
@@ -90,20 +85,9 @@ export type ConfigFile = {
90
85
  */
91
86
  defaultFragmentMasking?: 'enable' | 'disable';
92
87
  /**
93
- * Configures the houdini plugin's schema polling behavior. By default, houdini will poll your APIs
94
- * during development in order to keep it's definition of your schema up to date. The schemaPollingInterval
95
- * config value sets the amount of time between each request in milliseconds (default 2 seconds).
96
- * To limit the schema introspection to just on the start of the server, set schemaPollingInterval to 0.
97
- * To disable the schema introspection, set schemaPollingInterval to null.
98
- */
99
- schemaPollInterval?: number | null;
100
- /**
101
- * An object containing the environment variables you want passed onto the api when polling for a new schema.
102
- * The keys dictate the header names. If the value is a string, the corresponding environment variable will be used
103
- * directly. If the value is a function, the current environment will be passed to your function so you can perform any
104
- * logic you need
88
+ * Configure the dev environment to watch a remote schema for changes
105
89
  */
106
- schemaPollHeaders?: Record<string, string | ((env: Record<string, string | undefined>) => string)> | ((env: Record<string, string | undefined>) => Record<string, string>);
90
+ watchSchema?: WatchSchemaConfig;
107
91
  /**
108
92
  * An object describing the plugins enabled for the project
109
93
  */
@@ -133,6 +117,25 @@ export type TypeConfig = {
133
117
  };
134
118
  };
135
119
  };
120
+ export type WatchSchemaConfig = {
121
+ /**
122
+ * A url to use to pull the schema. For more information: https://www.houdinigraphql.com/api/cli#generate
123
+ */
124
+ url: string | ((env: Record<string, string | undefined>) => string);
125
+ /**
126
+ * sets the amount of time between each request in milliseconds (default 2 seconds).
127
+ * To limit the schema introspection to just on the start of the server, set interval to 0.
128
+ * To disable the schema introspection, set interval to null.
129
+ */
130
+ interval?: number | null;
131
+ /**
132
+ * An object containing the environment variables you want passed onto the api when polling for a new schema.
133
+ * The keys dictate the header names. If the value is a string, the corresponding environment variable will be used
134
+ * directly. If the value is a function, the current environment will be passed to your function so you can perform any
135
+ * logic you need
136
+ */
137
+ headers?: Record<string, string | ((env: Record<string, string | undefined>) => string)> | ((env: Record<string, string | undefined>) => Record<string, string>);
138
+ };
136
139
  export type ScalarSpec = {
137
140
  type: string;
138
141
  marshal?: (val: any) => any;
@@ -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 = {
@@ -0,0 +1,2 @@
1
+ import type { NestedList } from './types';
2
+ export declare function flatten<T>(source?: NestedList<T>): T[];
@@ -0,0 +1,41 @@
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 flatten_exports = {};
20
+ __export(flatten_exports, {
21
+ flatten: () => flatten
22
+ });
23
+ module.exports = __toCommonJS(flatten_exports);
24
+ function flatten(source) {
25
+ if (!source) {
26
+ return [];
27
+ }
28
+ return source.reduce((acc, element) => {
29
+ if (!element) {
30
+ return acc;
31
+ }
32
+ if (Array.isArray(element)) {
33
+ return acc.concat(flatten(element));
34
+ }
35
+ return acc.concat(element);
36
+ }, []);
37
+ }
38
+ // Annotate the CommonJS export names for ESM import in node:
39
+ 0 && (module.exports = {
40
+ flatten
41
+ });
@@ -5,3 +5,4 @@ export * from './log';
5
5
  export * from './scalars';
6
6
  export * from './types';
7
7
  export * from './store';
8
+ export * from './key';
@@ -22,3 +22,4 @@ __reExport(lib_exports, require("./log"), module.exports);
22
22
  __reExport(lib_exports, require("./scalars"), module.exports);
23
23
  __reExport(lib_exports, require("./types"), module.exports);
24
24
  __reExport(lib_exports, require("./store"), module.exports);
25
+ __reExport(lib_exports, require("./key"), module.exports);
@@ -0,0 +1,6 @@
1
+ export declare const computeKey: ({ field, args }: {
2
+ field: string;
3
+ args?: {
4
+ [key: string]: any;
5
+ } | undefined;
6
+ }) => string;
@@ -0,0 +1,41 @@
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 key_exports = {};
20
+ __export(key_exports, {
21
+ computeKey: () => computeKey
22
+ });
23
+ module.exports = __toCommonJS(key_exports);
24
+ const computeKey = ({ field, args }) => {
25
+ const keys = Object.keys(args ?? {});
26
+ keys.sort();
27
+ return args && keys.length > 0 ? `${field}(${keys.map((key) => `${key}: ${stringifyObjectWithNoQuotesOnKeys(args[key])}`).join(", ")})` : field;
28
+ };
29
+ const stringifyObjectWithNoQuotesOnKeys = (obj_from_json) => {
30
+ if (Array.isArray(obj_from_json)) {
31
+ return `[${obj_from_json.map((obj) => `${stringifyObjectWithNoQuotesOnKeys(obj)}`).join(", ")}]`;
32
+ }
33
+ if (typeof obj_from_json !== "object" || obj_from_json instanceof Date || obj_from_json === null) {
34
+ return JSON.stringify(obj_from_json).replace(/"([^"]+)":/g, "$1: ");
35
+ }
36
+ return `{${Object.keys(obj_from_json).map((key) => `${key}: ${stringifyObjectWithNoQuotesOnKeys(obj_from_json[key])}`).join(", ")}}`;
37
+ };
38
+ // Annotate the CommonJS export names for ESM import in node:
39
+ 0 && (module.exports = {
40
+ computeKey
41
+ });
@@ -1,15 +1,15 @@
1
1
  import type { ConfigFile } from './config';
2
- import type { MutationArtifact, QueryArtifact, SubscriptionArtifact, SubscriptionSelection } from './types';
2
+ import type { FragmentArtifact, MutationArtifact, QueryArtifact, SubscriptionArtifact, SubscriptionSelection } from './types';
3
3
  export declare function marshalSelection({ selection, data, }: {
4
4
  selection: SubscriptionSelection;
5
5
  data: any;
6
6
  }): Promise<{} | null | undefined>;
7
7
  export declare function marshalInputs<T>({ artifact, input, config, rootType, }: {
8
- artifact: QueryArtifact | MutationArtifact | SubscriptionArtifact;
8
+ artifact: QueryArtifact | MutationArtifact | SubscriptionArtifact | FragmentArtifact;
9
9
  input: unknown;
10
10
  rootType?: string;
11
11
  config: ConfigFile;
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,49 +31,44 @@ 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;
71
69
  rootType: string;
72
70
  input?: InputObject;
73
71
  refetch?: {
74
- update: RefetchUpdateMode;
75
72
  path: string[];
76
73
  method: 'cursor' | 'offset';
77
74
  pageSize: number;
@@ -79,9 +76,9 @@ export type BaseCompiledDocument = {
79
76
  embedded: boolean;
80
77
  targetType: string;
81
78
  paginated: boolean;
82
- direction?: 'forward' | 'backwards';
79
+ direction: 'forward' | 'backward' | 'both';
83
80
  };
84
- pluginsData?: Record<string, any>;
81
+ pluginData?: Record<string, any>;
85
82
  };
86
83
  export type HoudiniFetchContext = {
87
84
  variables: () => {};
@@ -93,20 +90,21 @@ export type ListWhen = {
93
90
  must?: Filter;
94
91
  must_not?: Filter;
95
92
  };
96
- export declare enum DataSource {
93
+ export declare const DataSource: {
97
94
  /**
98
95
  * from the browser cache
99
96
  */
100
- Cache = "cache",
97
+ readonly Cache: "cache";
101
98
  /**
102
99
  * from a browser side `fetch`
103
100
  */
104
- Network = "network",
101
+ readonly Network: "network";
105
102
  /**
106
103
  * from a server side `fetch`
107
104
  */
108
- Ssr = "ssr"
109
- }
105
+ readonly Ssr: "ssr";
106
+ };
107
+ export type DataSources = ValuesOf<typeof DataSource>;
110
108
  export type MutationOperation = {
111
109
  action: 'insert' | 'remove' | 'delete' | 'toggle';
112
110
  list?: string;
@@ -135,7 +133,7 @@ export type SubscriptionSelection = {
135
133
  connection: boolean;
136
134
  type: string;
137
135
  };
138
- update?: RefetchUpdateMode;
136
+ updates?: string[];
139
137
  filters?: {
140
138
  [key: string]: {
141
139
  kind: 'Boolean' | 'String' | 'Float' | 'Int' | 'Variable';
@@ -164,8 +162,7 @@ export type SubscriptionSpec = {
164
162
  };
165
163
  export type FetchQueryResult<_Data> = {
166
164
  result: RequestPayload<_Data | null>;
167
- source: DataSource | null;
168
- partial: boolean;
165
+ source: DataSources | null;
169
166
  };
170
167
  export type QueryResult<_Data = GraphQLObject, _Input = Record<string, any>> = {
171
168
  data: _Data | null;
@@ -174,7 +171,8 @@ export type QueryResult<_Data = GraphQLObject, _Input = Record<string, any>> = {
174
171
  }[] | null;
175
172
  fetching: boolean;
176
173
  partial: boolean;
177
- source: DataSource | null;
174
+ stale: boolean;
175
+ source: DataSources | null;
178
176
  variables: _Input | null;
179
177
  };
180
178
  export type RequestPayload<GraphQLObject = any> = {
@@ -183,4 +181,6 @@ export type RequestPayload<GraphQLObject = any> = {
183
181
  message: string;
184
182
  }[] | null;
185
183
  };
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,