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,8 +1,6 @@
1
1
  import * as graphql from 'graphql';
2
- import type { ConfigFile } from '../runtime/lib';
3
- import { CachePolicy } from '../runtime/lib';
4
- import type { PluginConfig, PluginHooks } from './types';
5
- import { LogLevel } from './types';
2
+ import type { CachePolicies, ConfigFile } from '../runtime/lib';
3
+ import type { LogLevels, PluginConfig, PluginHooks } from './types';
6
4
  export type PluginMeta = PluginHooks & {
7
5
  name: string;
8
6
  filepath: string;
@@ -19,7 +17,7 @@ export declare class Config {
19
17
  scalars?: ConfigFile['scalars'];
20
18
  module: 'commonjs' | 'esm';
21
19
  cacheBufferSize?: number;
22
- defaultCachePolicy: CachePolicy;
20
+ defaultCachePolicy: CachePolicies;
23
21
  defaultPartial: boolean;
24
22
  internalListPosition: 'first' | 'last';
25
23
  defaultListTarget: 'all' | null;
@@ -28,7 +26,7 @@ export declare class Config {
28
26
  defaultKeys: string[];
29
27
  typeConfig: ConfigFile['types'];
30
28
  configFile: ConfigFile;
31
- logLevel: LogLevel;
29
+ logLevel: LogLevels;
32
30
  defaultFragmentMasking: 'enable' | 'disable';
33
31
  configIsRoute: ((filepath: string) => boolean) | null;
34
32
  routesDir: string;
@@ -1,8 +1,8 @@
1
1
  import type graphql from 'graphql';
2
2
  import type * as recast from 'recast';
3
- import type { CustomPluginOptions, LoadResult, ObjectHook, PluginContext, ResolveIdResult } from 'rollup';
3
+ import type { CustomPluginOptions, LoadResult, ObjectHook, PluginContext, ResolveIdResult, SourceMapInput } from 'rollup';
4
4
  import type { ConfigFile } from '../runtime/lib/config';
5
- import type { ArtifactKind, BaseCompiledDocument, DocumentArtifact } from '../runtime/lib/types';
5
+ import type { ArtifactKinds, BaseCompiledDocument, DocumentArtifact, ValueOf } from '../runtime/lib/types';
6
6
  import type { TransformPage } from '../vite/houdini';
7
7
  import type { Config } from './config';
8
8
  type Program = recast.types.namedTypes.Program;
@@ -25,7 +25,7 @@ export type Document = {
25
25
  /**
26
26
  * A field you can use to distinguish documents by type (query, mutation, subscription, fragment)
27
27
  */
28
- kind: ArtifactKind;
28
+ kind: ArtifactKinds;
29
29
  /**
30
30
  * The artifact generated for the document. This will only have a value in the last phase
31
31
  * of the Generation Pipeline.
@@ -60,14 +60,15 @@ export type Document = {
60
60
  /**
61
61
  * Refetch logic that has been built up throughout the pipeline
62
62
  */
63
- refetch?: BaseCompiledDocument['refetch'];
63
+ refetch?: BaseCompiledDocument<'HoudiniQuery'>['refetch'];
64
64
  };
65
- export declare enum LogLevel {
66
- Full = "full",
67
- Summary = "summary",
68
- ShortSummary = "short-summary",
69
- Quiet = "quiet"
70
- }
65
+ export declare const LogLevel: {
66
+ readonly Full: "full";
67
+ readonly Summary: "summary";
68
+ readonly ShortSummary: "short-summary";
69
+ readonly Quiet: "quiet";
70
+ };
71
+ export type LogLevels = ValueOf<typeof LogLevel>;
71
72
  export type Plugin = (args?: PluginConfig) => Promise<(PluginHooks | PluginInit) | (PluginHooks | PluginInit)[] | null | false>;
72
73
  export type PluginInit = {
73
74
  __plugin_init__: boolean;
@@ -104,10 +105,9 @@ export type PluginHooks = {
104
105
  content: string;
105
106
  }) => string>;
106
107
  /**
107
- * Used to modify any values that the user passed to their config files. Configuration values
108
- * that you return will be deeply merged with the previous value.
108
+ * An module with an default export that sets configuration values.
109
109
  */
110
- config?: (old: ConfigFile) => ConfigFile | Promise<ConfigFile>;
110
+ config?: string;
111
111
  /**
112
112
  *
113
113
  * Add environment variables to houdini's pipeline (ie, for schema polling headers, url, etc.)
@@ -186,7 +186,7 @@ export type PluginHooks = {
186
186
  artifactData?: (args: {
187
187
  config: Config;
188
188
  document: Document;
189
- }) => Record<string, any>;
189
+ }) => Record<string, any> | void;
190
190
  /**
191
191
  * A hook to customize the hash generated for your document.
192
192
  */
@@ -196,7 +196,7 @@ export type PluginHooks = {
196
196
  }) => string;
197
197
  /**
198
198
  * A hook to customize the return type of the graphql function. If you need to add an import to the file
199
- * in order to resolve the import, you can use the `ensure_import` utility.
199
+ * in order to resolve the import, you can use the `ensureImport` utility.
200
200
  */
201
201
  graphqlTagReturn?: (args: {
202
202
  config: Config;
@@ -231,8 +231,10 @@ export type PluginHooks = {
231
231
  */
232
232
  transformFile?: (page: TransformPage) => Promise<{
233
233
  code: string;
234
+ map?: SourceMapInput | string;
234
235
  }> | {
235
236
  code: string;
237
+ map?: SourceMapInput | string;
236
238
  };
237
239
  vite?: {
238
240
  resolveId?: ObjectHook<(this: PluginContext, source: string, importer: string | undefined, options: {
@@ -272,3 +274,4 @@ export type PluginConfig = {
272
274
  } & Partial<ConfigFile>;
273
275
  export * from '../runtime/lib/types';
274
276
  export * from '../runtime/lib/config';
277
+ export * from '../runtime/client';