houdini 1.0.0-next.1 → 1.0.0-next.11
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.
- package/build/cmd/generate.d.ts +0 -1
- package/build/cmd-cjs/index.js +3487 -4695
- package/build/cmd-esm/index.js +3473 -4681
- package/build/codegen/generators/artifacts/fieldKey.d.ts +1 -1
- package/build/codegen/generators/artifacts/index.d.ts +2 -2
- package/build/codegen/generators/artifacts/indexFile.d.ts +2 -2
- package/build/codegen/generators/artifacts/inputs.d.ts +2 -2
- package/build/codegen/generators/artifacts/operations.d.ts +2 -2
- package/build/codegen/generators/artifacts/selection.d.ts +5 -5
- package/build/codegen/generators/artifacts/utils.d.ts +1 -2
- package/build/codegen/generators/definitions/enums.d.ts +1 -1
- package/build/codegen/generators/definitions/index.d.ts +1 -1
- package/build/codegen/generators/indexFile/index.d.ts +2 -2
- package/build/codegen/generators/persistedQueries/index.d.ts +2 -2
- package/build/codegen/generators/runtime/graphqlFunction.d.ts +2 -0
- package/build/codegen/generators/runtime/index.d.ts +2 -2
- package/build/codegen/generators/runtime/injectPlugins.d.ts +7 -0
- package/build/codegen/generators/runtime/pluginIndex.d.ts +5 -0
- package/build/codegen/generators/typescript/addReferencedInputTypes.d.ts +1 -1
- package/build/codegen/generators/typescript/documentTypes.d.ts +2 -0
- package/build/codegen/generators/typescript/imperativeTypeDef.d.ts +2 -0
- package/build/codegen/generators/typescript/index.d.ts +2 -2
- package/build/codegen/generators/typescript/inlineType.d.ts +1 -1
- package/build/codegen/generators/typescript/typeReference.d.ts +5 -3
- package/build/codegen/generators/typescript/types.d.ts +1 -2
- package/build/codegen/index.d.ts +2 -2
- package/build/codegen/transforms/addID.d.ts +2 -2
- package/build/codegen/transforms/composeQueries.d.ts +5 -5
- package/build/codegen/transforms/fragmentVariables.d.ts +4 -3
- package/build/codegen/transforms/list.d.ts +2 -2
- package/build/codegen/transforms/paginate.d.ts +2 -2
- package/build/codegen/transforms/schema.d.ts +2 -2
- package/build/codegen/transforms/typename.d.ts +2 -2
- package/build/codegen/utils/commonjs.d.ts +2 -0
- package/build/codegen/utils/flattenSelections.d.ts +2 -2
- package/build/codegen/utils/moduleExport.d.ts +1 -1
- package/build/codegen/utils/objectIdentificationSelection.d.ts +1 -1
- package/build/codegen/validators/noIDAlias.d.ts +2 -2
- package/build/codegen/validators/plugins.d.ts +2 -2
- package/build/codegen/validators/typeCheck.d.ts +2 -2
- package/build/codegen/validators/uniqueNames.d.ts +2 -2
- package/build/codegen-cjs/index.js +3020 -4312
- package/build/codegen-esm/index.js +3058 -4350
- package/build/lib/config.d.ts +17 -91
- package/build/lib/deepMerge.d.ts +1 -0
- package/build/lib/fs.d.ts +1 -1
- package/build/lib/graphql.d.ts +5 -2
- package/build/lib/imports.d.ts +1 -1
- package/build/lib/index.d.ts +2 -0
- package/build/lib/path.d.ts +1 -1
- package/build/lib/pipeline.d.ts +1 -1
- package/build/lib/plugin.d.ts +2 -0
- package/build/lib/types.d.ts +254 -6
- package/build/lib/walk.d.ts +8 -5
- package/build/lib-cjs/index.js +885 -2394
- package/build/lib-esm/index.js +859 -2370
- package/build/runtime/cache/cache.d.ts +36 -17
- package/build/runtime/cache/gc.d.ts +1 -1
- package/build/runtime/cache/lists.d.ts +3 -2
- package/build/runtime/cache/schema.d.ts +2 -2
- package/build/runtime/cache/staleManager.d.ts +30 -0
- package/build/runtime/cache/storage.d.ts +5 -5
- package/build/runtime/cache/stuff.d.ts +1 -3
- package/build/runtime/cache/subscription.d.ts +20 -11
- package/build/runtime/client/documentStore.d.ts +88 -0
- package/build/runtime/client/index.d.ts +27 -0
- package/build/runtime/client/plugins/cache.d.ts +8 -0
- package/build/runtime/client/plugins/fetch.d.ts +37 -0
- package/build/runtime/client/plugins/fetchParams.d.ts +9 -0
- package/build/runtime/client/plugins/index.d.ts +7 -0
- package/build/runtime/client/plugins/injectedPlugins.d.ts +4 -0
- package/build/runtime/client/plugins/mutation.d.ts +1 -0
- package/build/runtime/client/plugins/query.d.ts +2 -0
- package/build/runtime/client/plugins/subscription.d.ts +17 -0
- package/build/runtime/client/plugins/throwOnError.d.ts +7 -0
- package/build/runtime/client/utils/documentPlugins.d.ts +3 -0
- package/build/runtime/client/utils/index.d.ts +1 -0
- package/build/runtime/generated.d.ts +1 -0
- package/build/runtime/imports/config.d.ts +3 -0
- package/build/runtime/index.d.ts +3 -2
- package/build/runtime/lib/config.d.ts +30 -25
- package/build/runtime/lib/flatten.d.ts +2 -0
- package/build/runtime/lib/index.d.ts +2 -2
- package/build/runtime/lib/key.d.ts +6 -0
- package/build/runtime/lib/scalars.d.ts +6 -5
- package/build/runtime/lib/selection.d.ts +1 -1
- package/build/runtime/lib/store.d.ts +19 -0
- package/build/runtime/lib/types.d.ts +27 -13
- package/build/runtime/public/cache.d.ts +27 -7
- package/build/runtime/public/list.d.ts +2 -2
- package/build/runtime/public/record.d.ts +27 -18
- package/build/runtime/public/tests/test.d.ts +53 -11
- package/build/runtime/public/types.d.ts +8 -0
- package/build/runtime-cjs/cache/cache.d.ts +36 -17
- package/build/runtime-cjs/cache/cache.js +102 -33
- package/build/runtime-cjs/cache/gc.d.ts +1 -1
- package/build/runtime-cjs/cache/gc.js +9 -0
- package/build/runtime-cjs/cache/lists.d.ts +3 -2
- package/build/runtime-cjs/cache/lists.js +11 -8
- package/build/runtime-cjs/cache/schema.d.ts +2 -2
- package/build/runtime-cjs/cache/staleManager.d.ts +30 -0
- package/build/runtime-cjs/cache/staleManager.js +95 -0
- package/build/runtime-cjs/cache/storage.d.ts +5 -5
- package/build/runtime-cjs/cache/storage.js +2 -2
- package/build/runtime-cjs/cache/stuff.d.ts +1 -3
- package/build/runtime-cjs/cache/stuff.js +2 -19
- package/build/runtime-cjs/cache/subscription.d.ts +20 -11
- package/build/runtime-cjs/cache/subscription.js +102 -59
- package/build/runtime-cjs/client/documentStore.d.ts +88 -0
- package/build/runtime-cjs/client/documentStore.js +361 -0
- package/build/runtime-cjs/client/index.d.ts +27 -0
- package/build/runtime-cjs/client/index.js +113 -0
- package/build/runtime-cjs/client/plugins/cache.d.ts +8 -0
- package/build/runtime-cjs/client/plugins/cache.js +101 -0
- package/build/runtime-cjs/client/plugins/fetch.d.ts +37 -0
- package/build/runtime-cjs/{lib/networkUtils.js → client/plugins/fetch.js} +96 -3
- package/build/runtime-cjs/client/plugins/fetchParams.d.ts +9 -0
- package/build/runtime-cjs/client/plugins/fetchParams.js +45 -0
- package/build/runtime-cjs/client/plugins/index.d.ts +7 -0
- package/build/runtime-cjs/client/plugins/index.js +24 -0
- package/build/runtime-cjs/client/plugins/injectedPlugins.d.ts +4 -0
- package/build/runtime-cjs/{lib/errors.js → client/plugins/injectedPlugins.js} +7 -15
- package/build/runtime-cjs/client/plugins/mutation.d.ts +1 -0
- package/build/runtime-cjs/client/plugins/mutation.js +86 -0
- package/build/runtime-cjs/client/plugins/query.d.ts +2 -0
- package/build/runtime-cjs/client/plugins/query.js +83 -0
- package/build/runtime-cjs/client/plugins/subscription.d.ts +17 -0
- package/build/runtime-cjs/client/plugins/subscription.js +100 -0
- package/build/runtime-cjs/client/plugins/throwOnError.d.ts +7 -0
- package/build/runtime-cjs/client/plugins/throwOnError.js +47 -0
- package/build/runtime-cjs/client/utils/documentPlugins.d.ts +3 -0
- package/build/runtime-cjs/client/utils/documentPlugins.js +56 -0
- package/build/runtime-cjs/client/utils/index.d.ts +1 -0
- package/build/runtime-cjs/client/utils/index.js +18 -0
- package/build/runtime-cjs/generated.d.ts +1 -0
- package/build/runtime-cjs/imports/config.d.ts +3 -0
- package/build/runtime-cjs/imports/config.js +26 -0
- package/build/runtime-cjs/index.d.ts +3 -2
- package/build/runtime-cjs/index.js +1 -0
- package/build/runtime-cjs/lib/config.d.ts +30 -25
- package/build/runtime-cjs/lib/config.js +5 -4
- package/build/runtime-cjs/lib/flatten.d.ts +2 -0
- package/build/runtime-cjs/lib/flatten.js +41 -0
- package/build/runtime-cjs/lib/index.d.ts +2 -2
- package/build/runtime-cjs/lib/index.js +2 -2
- package/build/runtime-cjs/lib/key.d.ts +6 -0
- package/build/runtime-cjs/lib/key.js +41 -0
- package/build/runtime-cjs/lib/scalars.d.ts +6 -5
- package/build/runtime-cjs/lib/scalars.js +20 -24
- package/build/runtime-cjs/lib/selection.d.ts +1 -1
- package/build/runtime-cjs/lib/store.d.ts +19 -0
- package/build/runtime-cjs/lib/store.js +81 -0
- package/build/runtime-cjs/lib/types.d.ts +27 -13
- package/build/runtime-cjs/public/cache.d.ts +27 -7
- package/build/runtime-cjs/public/cache.js +32 -32
- package/build/runtime-cjs/public/list.d.ts +2 -2
- package/build/runtime-cjs/public/list.js +6 -28
- package/build/runtime-cjs/public/record.d.ts +27 -18
- package/build/runtime-cjs/public/record.js +28 -188
- package/build/runtime-cjs/public/tests/test.d.ts +53 -11
- package/build/runtime-cjs/public/tests/test.js +27 -2
- package/build/runtime-cjs/public/types.d.ts +8 -0
- package/build/runtime-esm/cache/cache.d.ts +36 -17
- package/build/runtime-esm/cache/cache.js +104 -35
- package/build/runtime-esm/cache/gc.d.ts +1 -1
- package/build/runtime-esm/cache/gc.js +9 -0
- package/build/runtime-esm/cache/lists.d.ts +3 -2
- package/build/runtime-esm/cache/lists.js +11 -8
- package/build/runtime-esm/cache/schema.d.ts +2 -2
- package/build/runtime-esm/cache/staleManager.d.ts +30 -0
- package/build/runtime-esm/cache/staleManager.js +71 -0
- package/build/runtime-esm/cache/storage.d.ts +5 -5
- package/build/runtime-esm/cache/storage.js +2 -2
- package/build/runtime-esm/cache/stuff.d.ts +1 -3
- package/build/runtime-esm/cache/stuff.js +1 -17
- package/build/runtime-esm/cache/subscription.d.ts +20 -11
- package/build/runtime-esm/cache/subscription.js +103 -60
- package/build/runtime-esm/client/documentStore.d.ts +88 -0
- package/build/runtime-esm/client/documentStore.js +337 -0
- package/build/runtime-esm/client/index.d.ts +27 -0
- package/build/runtime-esm/client/index.js +83 -0
- package/build/runtime-esm/client/plugins/cache.d.ts +8 -0
- package/build/runtime-esm/client/plugins/cache.js +71 -0
- package/build/runtime-esm/client/plugins/fetch.d.ts +37 -0
- package/build/runtime-esm/client/plugins/fetch.js +152 -0
- package/build/runtime-esm/client/plugins/fetchParams.d.ts +9 -0
- package/build/runtime-esm/client/plugins/fetchParams.js +21 -0
- package/build/runtime-esm/client/plugins/index.d.ts +7 -0
- package/build/runtime-esm/client/plugins/index.js +7 -0
- package/build/runtime-esm/client/plugins/injectedPlugins.d.ts +4 -0
- package/build/runtime-esm/client/plugins/injectedPlugins.js +5 -0
- package/build/runtime-esm/client/plugins/mutation.d.ts +1 -0
- package/build/runtime-esm/client/plugins/mutation.js +56 -0
- package/build/runtime-esm/client/plugins/query.d.ts +2 -0
- package/build/runtime-esm/client/plugins/query.js +53 -0
- package/build/runtime-esm/client/plugins/subscription.d.ts +17 -0
- package/build/runtime-esm/client/plugins/subscription.js +76 -0
- package/build/runtime-esm/client/plugins/throwOnError.d.ts +7 -0
- package/build/runtime-esm/client/plugins/throwOnError.js +23 -0
- package/build/runtime-esm/client/utils/documentPlugins.d.ts +3 -0
- package/build/runtime-esm/client/utils/documentPlugins.js +32 -0
- package/build/runtime-esm/client/utils/index.d.ts +1 -0
- package/build/runtime-esm/client/utils/index.js +1 -0
- package/build/runtime-esm/generated.d.ts +1 -0
- package/build/runtime-esm/imports/config.d.ts +3 -0
- package/build/runtime-esm/imports/config.js +4 -0
- package/build/runtime-esm/index.d.ts +3 -2
- package/build/runtime-esm/index.js +1 -0
- package/build/runtime-esm/lib/config.d.ts +30 -25
- package/build/runtime-esm/lib/config.js +5 -4
- package/build/runtime-esm/lib/flatten.d.ts +2 -0
- package/build/runtime-esm/lib/flatten.js +17 -0
- package/build/runtime-esm/lib/index.d.ts +2 -2
- package/build/runtime-esm/lib/index.js +2 -2
- package/build/runtime-esm/lib/key.d.ts +6 -0
- package/build/runtime-esm/lib/key.js +17 -0
- package/build/runtime-esm/lib/scalars.d.ts +6 -5
- package/build/runtime-esm/lib/scalars.js +20 -24
- package/build/runtime-esm/lib/selection.d.ts +1 -1
- package/build/runtime-esm/lib/store.d.ts +19 -0
- package/build/runtime-esm/lib/store.js +57 -0
- package/build/runtime-esm/lib/types.d.ts +27 -13
- package/build/runtime-esm/public/cache.d.ts +27 -7
- package/build/runtime-esm/public/cache.js +31 -30
- package/build/runtime-esm/public/list.d.ts +2 -2
- package/build/runtime-esm/public/list.js +6 -28
- package/build/runtime-esm/public/record.d.ts +27 -18
- package/build/runtime-esm/public/record.js +27 -184
- package/build/runtime-esm/public/tests/test.d.ts +53 -11
- package/build/runtime-esm/public/tests/test.js +26 -1
- package/build/runtime-esm/public/types.d.ts +8 -0
- package/build/test/index.d.ts +6 -5
- package/build/test-cjs/index.js +3051 -4304
- package/build/test-esm/index.js +3048 -4301
- package/build/vite/ast.d.ts +1 -1
- package/build/vite/houdini.d.ts +1 -1
- package/build/vite/imports.d.ts +3 -3
- package/build/vite/index.d.ts +1 -1
- package/build/vite/schema.d.ts +1 -1
- package/build/vite-cjs/index.js +3499 -4691
- package/build/vite-esm/index.js +3448 -4640
- package/package.json +6 -5
- package/build/codegen/generators/typescript/imperativeCache.d.ts +0 -2
- package/build/runtime/lib/errors.d.ts +0 -3
- package/build/runtime/lib/network.d.ts +0 -79
- package/build/runtime/lib/networkUtils.d.ts +0 -8
- package/build/runtime-cjs/lib/errors.d.ts +0 -3
- package/build/runtime-cjs/lib/network.d.ts +0 -79
- package/build/runtime-cjs/lib/network.js +0 -200
- package/build/runtime-cjs/lib/networkUtils.d.ts +0 -8
- package/build/runtime-esm/lib/errors.d.ts +0 -3
- package/build/runtime-esm/lib/errors.js +0 -11
- package/build/runtime-esm/lib/network.d.ts +0 -79
- package/build/runtime-esm/lib/network.js +0 -170
- package/build/runtime-esm/lib/networkUtils.d.ts +0 -8
- package/build/runtime-esm/lib/networkUtils.js +0 -60
|
@@ -0,0 +1,26 @@
|
|
|
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 config_exports = {};
|
|
20
|
+
__export(config_exports, {
|
|
21
|
+
default: () => config_default
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(config_exports);
|
|
24
|
+
var config_default = {};
|
|
25
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
26
|
+
0 && (module.exports = {});
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { Cache as InternalCache } from './cache/cache';
|
|
1
|
+
import type { Cache as InternalCache } from './cache/cache';
|
|
2
2
|
import type { CacheTypeDef } from './generated';
|
|
3
3
|
import { Cache } from './public';
|
|
4
|
+
export * from './client';
|
|
4
5
|
export * from './lib';
|
|
5
|
-
export declare function graphql(str:
|
|
6
|
+
export declare function graphql<_Payload>(str: TemplateStringsArray): _Payload;
|
|
6
7
|
export declare const cache: Cache<CacheTypeDef>;
|
|
7
8
|
export declare function getCache(): InternalCache;
|
|
@@ -32,6 +32,7 @@ __export(runtime_exports, {
|
|
|
32
32
|
module.exports = __toCommonJS(runtime_exports);
|
|
33
33
|
var import_cache = __toESM(require("./cache"), 1);
|
|
34
34
|
var import_public = require("./public");
|
|
35
|
+
__reExport(runtime_exports, require("./client"), module.exports);
|
|
35
36
|
__reExport(runtime_exports, require("./lib"), module.exports);
|
|
36
37
|
function graphql(str) {
|
|
37
38
|
if (globalThis?.process?.env?.HOUDINI_PLUGIN) {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { GraphQLSchema } from 'graphql';
|
|
2
|
-
import { CachePolicy } from './types';
|
|
1
|
+
import type { GraphQLSchema } from 'graphql';
|
|
2
|
+
import type { CachePolicy } 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;
|
|
6
6
|
export declare function keyFieldsForType(configFile: ConfigFile, type: string): string[];
|
|
7
7
|
export declare function computeID(configFile: ConfigFile, type: string, data: any): string;
|
|
8
|
-
export declare function getCurrentConfig():
|
|
8
|
+
export declare function getCurrentConfig(): ConfigFile;
|
|
9
9
|
export type ConfigFile = {
|
|
10
10
|
/**
|
|
11
11
|
* A glob pointing to all files that houdini should consider. Note, this must include .js files
|
|
@@ -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
|
*/
|
|
@@ -64,6 +55,10 @@ export type ConfigFile = {
|
|
|
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
|
-
*
|
|
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
|
-
|
|
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;
|
|
@@ -140,4 +143,6 @@ export type ScalarSpec = {
|
|
|
140
143
|
};
|
|
141
144
|
export interface HoudiniPluginConfig {
|
|
142
145
|
}
|
|
146
|
+
export interface HoudiniClientPluginConfig {
|
|
147
|
+
}
|
|
143
148
|
export {};
|
|
@@ -32,12 +32,13 @@ __export(config_exports, {
|
|
|
32
32
|
setMockConfig: () => setMockConfig
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(config_exports);
|
|
35
|
+
var import_config = __toESM(require("../imports/config"), 1);
|
|
35
36
|
let mockConfig = null;
|
|
36
37
|
function getMockConfig() {
|
|
37
38
|
return mockConfig;
|
|
38
39
|
}
|
|
39
|
-
function setMockConfig(
|
|
40
|
-
mockConfig =
|
|
40
|
+
function setMockConfig(config2) {
|
|
41
|
+
mockConfig = config2;
|
|
41
42
|
}
|
|
42
43
|
function defaultConfigValues(file) {
|
|
43
44
|
return {
|
|
@@ -66,12 +67,12 @@ function computeID(configFile, type, data) {
|
|
|
66
67
|
}
|
|
67
68
|
return id.slice(0, -2);
|
|
68
69
|
}
|
|
69
|
-
|
|
70
|
+
function getCurrentConfig() {
|
|
70
71
|
const mockConfig2 = getMockConfig();
|
|
71
72
|
if (mockConfig2) {
|
|
72
73
|
return mockConfig2;
|
|
73
74
|
}
|
|
74
|
-
return defaultConfigValues(
|
|
75
|
+
return defaultConfigValues(import_config.default);
|
|
75
76
|
}
|
|
76
77
|
// Annotate the CommonJS export names for ESM import in node:
|
|
77
78
|
0 && (module.exports = {
|
|
@@ -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
|
+
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export * from './config';
|
|
2
2
|
export * from './constants';
|
|
3
3
|
export * from './deepEquals';
|
|
4
|
-
export * from './errors';
|
|
5
4
|
export * from './log';
|
|
6
|
-
export * from './network';
|
|
7
5
|
export * from './scalars';
|
|
8
6
|
export * from './types';
|
|
7
|
+
export * from './store';
|
|
8
|
+
export * from './key';
|
|
@@ -18,8 +18,8 @@ module.exports = __toCommonJS(lib_exports);
|
|
|
18
18
|
__reExport(lib_exports, require("./config"), module.exports);
|
|
19
19
|
__reExport(lib_exports, require("./constants"), module.exports);
|
|
20
20
|
__reExport(lib_exports, require("./deepEquals"), module.exports);
|
|
21
|
-
__reExport(lib_exports, require("./errors"), module.exports);
|
|
22
21
|
__reExport(lib_exports, require("./log"), module.exports);
|
|
23
|
-
__reExport(lib_exports, require("./network"), module.exports);
|
|
24
22
|
__reExport(lib_exports, require("./scalars"), module.exports);
|
|
25
23
|
__reExport(lib_exports, require("./types"), module.exports);
|
|
24
|
+
__reExport(lib_exports, require("./store"), module.exports);
|
|
25
|
+
__reExport(lib_exports, require("./key"), module.exports);
|
|
@@ -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,14 +1,15 @@
|
|
|
1
|
-
import { ConfigFile } from './config';
|
|
2
|
-
import { MutationArtifact, QueryArtifact, SubscriptionArtifact, SubscriptionSelection } from './types';
|
|
1
|
+
import type { ConfigFile } from './config';
|
|
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
|
-
export declare function marshalInputs<T>({ artifact, input, rootType, }: {
|
|
8
|
-
artifact: QueryArtifact | MutationArtifact | SubscriptionArtifact;
|
|
7
|
+
export declare function marshalInputs<T>({ artifact, input, config, rootType, }: {
|
|
8
|
+
artifact: QueryArtifact | MutationArtifact | SubscriptionArtifact | FragmentArtifact;
|
|
9
9
|
input: unknown;
|
|
10
10
|
rootType?: string;
|
|
11
|
-
|
|
11
|
+
config: ConfigFile;
|
|
12
|
+
}): {} | null | undefined;
|
|
12
13
|
export declare function unmarshalSelection(config: ConfigFile, selection: SubscriptionSelection, data: any): {} | null | undefined;
|
|
13
14
|
export declare function isScalar(config: ConfigFile, type: string): boolean;
|
|
14
15
|
export declare function parseScalar(config: ConfigFile, type: string, value: string): string | number | boolean;
|
|
@@ -31,7 +31,7 @@ async function marshalSelection({
|
|
|
31
31
|
selection,
|
|
32
32
|
data
|
|
33
33
|
}) {
|
|
34
|
-
const config =
|
|
34
|
+
const config = (0, import_config.getCurrentConfig)();
|
|
35
35
|
if (data === null || typeof data === "undefined") {
|
|
36
36
|
return data;
|
|
37
37
|
}
|
|
@@ -66,12 +66,12 @@ async function marshalSelection({
|
|
|
66
66
|
)
|
|
67
67
|
);
|
|
68
68
|
}
|
|
69
|
-
|
|
69
|
+
function marshalInputs({
|
|
70
70
|
artifact,
|
|
71
71
|
input,
|
|
72
|
+
config,
|
|
72
73
|
rootType = "@root"
|
|
73
74
|
}) {
|
|
74
|
-
const config = await (0, import_config.getCurrentConfig)();
|
|
75
75
|
if (input === null || typeof input === "undefined") {
|
|
76
76
|
return input;
|
|
77
77
|
}
|
|
@@ -80,30 +80,26 @@ async function marshalInputs({
|
|
|
80
80
|
}
|
|
81
81
|
const fields = rootType === "@root" ? artifact.input.fields : artifact.input.types[rootType];
|
|
82
82
|
if (Array.isArray(input)) {
|
|
83
|
-
return
|
|
84
|
-
input.map(async (val) => await marshalInputs({ artifact, input: val, rootType }))
|
|
85
|
-
);
|
|
83
|
+
return input.map((val) => marshalInputs({ artifact, input: val, rootType, config }));
|
|
86
84
|
}
|
|
87
85
|
return Object.fromEntries(
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
if (
|
|
96
|
-
|
|
97
|
-
return [fieldName, value.map(marshalFn)];
|
|
98
|
-
}
|
|
99
|
-
return [fieldName, marshalFn(value)];
|
|
100
|
-
}
|
|
101
|
-
if (isScalar(config, type) || !artifact.input.types[type]) {
|
|
102
|
-
return [fieldName, value];
|
|
86
|
+
Object.entries(input).map(([fieldName, value]) => {
|
|
87
|
+
const type = fields?.[fieldName];
|
|
88
|
+
if (!type) {
|
|
89
|
+
return [fieldName, value];
|
|
90
|
+
}
|
|
91
|
+
const marshalFn = config.scalars?.[type]?.marshal;
|
|
92
|
+
if (marshalFn) {
|
|
93
|
+
if (Array.isArray(value)) {
|
|
94
|
+
return [fieldName, value.map(marshalFn)];
|
|
103
95
|
}
|
|
104
|
-
return [fieldName,
|
|
105
|
-
}
|
|
106
|
-
|
|
96
|
+
return [fieldName, marshalFn(value)];
|
|
97
|
+
}
|
|
98
|
+
if (isScalar(config, type) || !artifact.input.types[type]) {
|
|
99
|
+
return [fieldName, value];
|
|
100
|
+
}
|
|
101
|
+
return [fieldName, marshalInputs({ artifact, input: value, rootType: type, config })];
|
|
102
|
+
})
|
|
107
103
|
);
|
|
108
104
|
}
|
|
109
105
|
function unmarshalSelection(config, selection, data) {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { SubscriptionSelection } from './types';
|
|
1
|
+
import type { SubscriptionSelection } from './types';
|
|
2
2
|
export declare function getFieldsForType(selection: SubscriptionSelection, __typename: string | undefined | null): Required<SubscriptionSelection>['fields'];
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare class Writable<T> {
|
|
2
|
+
#private;
|
|
3
|
+
state: T;
|
|
4
|
+
constructor(value: T, start?: StartStopNotifier<T>);
|
|
5
|
+
set(new_value: T): void;
|
|
6
|
+
update(fn: Updater<T>): void;
|
|
7
|
+
subscribe(run: Subscriber<T>, invalidate?: Invalidator<T>): Unsubscriber;
|
|
8
|
+
}
|
|
9
|
+
/** Start and stop notification callbacks. */
|
|
10
|
+
type StartStopNotifier<T> = (set: Subscriber<T>) => Unsubscriber | void;
|
|
11
|
+
/** Callback to inform of a value updates. */
|
|
12
|
+
export type Subscriber<T> = (value: T) => void;
|
|
13
|
+
/** Unsubscribes from value updates. */
|
|
14
|
+
export type Unsubscriber = () => void;
|
|
15
|
+
/** Callback to update a value. */
|
|
16
|
+
type Updater<T> = (value: T) => T;
|
|
17
|
+
/** Cleanup logic callback. */
|
|
18
|
+
type Invalidator<T> = (value?: T) => void;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,81 @@
|
|
|
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 store_exports = {};
|
|
20
|
+
__export(store_exports, {
|
|
21
|
+
Writable: () => Writable
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(store_exports);
|
|
24
|
+
const subscriber_queue = [];
|
|
25
|
+
const noop = () => {
|
|
26
|
+
};
|
|
27
|
+
class Writable {
|
|
28
|
+
state;
|
|
29
|
+
#subscribers;
|
|
30
|
+
#stop;
|
|
31
|
+
#start;
|
|
32
|
+
constructor(value, start = noop) {
|
|
33
|
+
this.state = value;
|
|
34
|
+
this.#subscribers = /* @__PURE__ */ new Set();
|
|
35
|
+
this.#stop = null;
|
|
36
|
+
this.#start = start;
|
|
37
|
+
}
|
|
38
|
+
set(new_value) {
|
|
39
|
+
if (safe_not_equal(this.state, new_value)) {
|
|
40
|
+
this.state = new_value;
|
|
41
|
+
if (this.#stop) {
|
|
42
|
+
const run_queue = !subscriber_queue.length;
|
|
43
|
+
for (const subscriber of this.#subscribers) {
|
|
44
|
+
subscriber[1]();
|
|
45
|
+
subscriber_queue.push(subscriber, this.state);
|
|
46
|
+
}
|
|
47
|
+
if (run_queue) {
|
|
48
|
+
for (let i = 0; i < subscriber_queue.length; i += 2) {
|
|
49
|
+
subscriber_queue[i][0](subscriber_queue[i + 1]);
|
|
50
|
+
}
|
|
51
|
+
subscriber_queue.length = 0;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
update(fn) {
|
|
57
|
+
this.set(fn(this.state));
|
|
58
|
+
}
|
|
59
|
+
subscribe(run, invalidate = noop) {
|
|
60
|
+
const subscriber = [run, invalidate];
|
|
61
|
+
this.#subscribers.add(subscriber);
|
|
62
|
+
if (this.#subscribers.size === 1) {
|
|
63
|
+
this.#stop = this.#start(this.set) || noop;
|
|
64
|
+
}
|
|
65
|
+
run(this.state);
|
|
66
|
+
return () => {
|
|
67
|
+
this.#subscribers.delete(subscriber);
|
|
68
|
+
if (this.#subscribers.size === 0) {
|
|
69
|
+
this.#stop?.();
|
|
70
|
+
this.#stop = null;
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
function safe_not_equal(a, b) {
|
|
76
|
+
return a != a ? b == b : a !== b || a && typeof a === "object" || typeof a === "function";
|
|
77
|
+
}
|
|
78
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
79
|
+
0 && (module.exports = {
|
|
80
|
+
Writable
|
|
81
|
+
});
|
|
@@ -4,6 +4,22 @@ export declare enum CachePolicy {
|
|
|
4
4
|
NetworkOnly = "NetworkOnly",
|
|
5
5
|
CacheAndNetwork = "CacheAndNetwork"
|
|
6
6
|
}
|
|
7
|
+
declare global {
|
|
8
|
+
namespace App {
|
|
9
|
+
interface Session {
|
|
10
|
+
}
|
|
11
|
+
interface Metadata {
|
|
12
|
+
}
|
|
13
|
+
interface Stuff {
|
|
14
|
+
inputs: {
|
|
15
|
+
init: boolean;
|
|
16
|
+
marshaled: Record<string, any>;
|
|
17
|
+
changed: boolean;
|
|
18
|
+
};
|
|
19
|
+
optimisticResponse?: GraphQLObject;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
7
23
|
export type Fragment<_Result> = {
|
|
8
24
|
readonly shape?: _Result;
|
|
9
25
|
};
|
|
@@ -55,7 +71,6 @@ export type BaseCompiledDocument = {
|
|
|
55
71
|
rootType: string;
|
|
56
72
|
input?: InputObject;
|
|
57
73
|
refetch?: {
|
|
58
|
-
update: RefetchUpdateMode;
|
|
59
74
|
path: string[];
|
|
60
75
|
method: 'cursor' | 'offset';
|
|
61
76
|
pageSize: number;
|
|
@@ -63,8 +78,9 @@ export type BaseCompiledDocument = {
|
|
|
63
78
|
embedded: boolean;
|
|
64
79
|
targetType: string;
|
|
65
80
|
paginated: boolean;
|
|
66
|
-
direction
|
|
81
|
+
direction: 'forward' | 'backward' | 'both';
|
|
67
82
|
};
|
|
83
|
+
plugin_data?: Record<string, any>;
|
|
68
84
|
};
|
|
69
85
|
export type HoudiniFetchContext = {
|
|
70
86
|
variables: () => {};
|
|
@@ -118,7 +134,7 @@ export type SubscriptionSelection = {
|
|
|
118
134
|
connection: boolean;
|
|
119
135
|
type: string;
|
|
120
136
|
};
|
|
121
|
-
|
|
137
|
+
updates?: string[];
|
|
122
138
|
filters?: {
|
|
123
139
|
[key: string]: {
|
|
124
140
|
kind: 'Boolean' | 'String' | 'Float' | 'Int' | 'Variable';
|
|
@@ -148,26 +164,24 @@ export type SubscriptionSpec = {
|
|
|
148
164
|
export type FetchQueryResult<_Data> = {
|
|
149
165
|
result: RequestPayload<_Data | null>;
|
|
150
166
|
source: DataSource | null;
|
|
151
|
-
partial: boolean;
|
|
152
167
|
};
|
|
153
|
-
export type QueryResult<_Data, _Input
|
|
168
|
+
export type QueryResult<_Data = GraphQLObject, _Input = Record<string, any>> = {
|
|
154
169
|
data: _Data | null;
|
|
155
170
|
errors: {
|
|
156
171
|
message: string;
|
|
157
172
|
}[] | null;
|
|
158
173
|
fetching: boolean;
|
|
159
174
|
partial: boolean;
|
|
175
|
+
stale: boolean;
|
|
160
176
|
source: DataSource | null;
|
|
161
|
-
variables: _Input;
|
|
162
|
-
}
|
|
163
|
-
export type RequestPayload<
|
|
164
|
-
data:
|
|
177
|
+
variables: _Input | null;
|
|
178
|
+
};
|
|
179
|
+
export type RequestPayload<GraphQLObject = any> = {
|
|
180
|
+
data: GraphQLObject | null;
|
|
165
181
|
errors: {
|
|
166
182
|
message: string;
|
|
167
183
|
}[] | null;
|
|
168
184
|
};
|
|
169
|
-
export type
|
|
170
|
-
|
|
171
|
-
body: RequestPayload<_Data>;
|
|
172
|
-
};
|
|
185
|
+
export type NestedList<_Result = string> = (_Result | null | NestedList<_Result>)[];
|
|
186
|
+
export type ValueOf<Parent> = Parent[keyof Parent];
|
|
173
187
|
export {};
|
|
@@ -1,19 +1,39 @@
|
|
|
1
|
-
import { Cache as _Cache } from '../cache/cache';
|
|
2
|
-
import {
|
|
1
|
+
import type { Cache as _Cache } from '../cache/cache';
|
|
2
|
+
import { type QueryArtifact } from '../lib';
|
|
3
3
|
import { ListCollection } from './list';
|
|
4
4
|
import { Record } from './record';
|
|
5
|
-
import type { CacheTypeDef, IDFields, TypeNames, ValidLists } from './types';
|
|
5
|
+
import type { ArgType, CacheTypeDef, IDFields, QueryInput, QueryList, QueryValue, TypeFieldNames, TypeNames, ValidLists } from './types';
|
|
6
6
|
export declare class Cache<Def extends CacheTypeDef> {
|
|
7
7
|
_internal_unstable: _Cache;
|
|
8
8
|
constructor(cache: _Cache);
|
|
9
9
|
validateInstabilityWarning(): void;
|
|
10
|
-
setFieldType(...args: Parameters<SchemaManager['setFieldType']>): void;
|
|
11
|
-
get root(): Record<Def, '__ROOT__'>;
|
|
12
10
|
get<T extends TypeNames<Def>>(type: T, data: IDFields<Def, T>): Record<Def, T>;
|
|
13
|
-
get config(): import("
|
|
11
|
+
get config(): import("../lib").ConfigFile;
|
|
14
12
|
list<Name extends ValidLists<Def>>(name: Name, { parentID, allLists }?: {
|
|
15
13
|
parentID?: string;
|
|
16
14
|
allLists?: boolean;
|
|
17
15
|
}): ListCollection<Def, Name>;
|
|
16
|
+
read<_Query extends {
|
|
17
|
+
artifact: QueryArtifact;
|
|
18
|
+
}>({ query, variables, }: {
|
|
19
|
+
query: _Query;
|
|
20
|
+
variables?: QueryInput<QueryList<Def>, _Query>;
|
|
21
|
+
}): {
|
|
22
|
+
data: QueryValue<QueryList<Def>, _Query> | null;
|
|
23
|
+
partial: boolean;
|
|
24
|
+
};
|
|
25
|
+
write<_Query extends {
|
|
26
|
+
artifact: QueryArtifact;
|
|
27
|
+
}>({ query, variables, data, }: {
|
|
28
|
+
query: _Query;
|
|
29
|
+
data: QueryValue<QueryList<Def>, _Query>;
|
|
30
|
+
variables?: QueryInput<QueryList<Def>, _Query>;
|
|
31
|
+
}): void;
|
|
32
|
+
/**
|
|
33
|
+
* Mark some elements of the cache stale.
|
|
34
|
+
*/
|
|
35
|
+
markStale<_Type extends TypeNames<Def>, _Field extends TypeFieldNames<Def, _Type>>(type?: _Type, options?: {
|
|
36
|
+
field?: _Field;
|
|
37
|
+
when?: ArgType<Def, _Type, _Field>;
|
|
38
|
+
}): void;
|
|
18
39
|
}
|
|
19
|
-
export declare function _typeInfo<Def extends CacheTypeDef>(cache: Cache<Def>, type: string, field: string): TypeInfo;
|