houdini 1.0.0-next.1 → 1.0.0-next.3
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 +1400 -2836
- package/build/cmd-esm/index.js +1400 -2836
- package/build/codegen/generators/artifacts/fieldKey.d.ts +1 -1
- package/build/codegen/generators/artifacts/index.d.ts +1 -1
- package/build/codegen/generators/artifacts/indexFile.d.ts +1 -1
- 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 +1 -1
- package/build/codegen/generators/artifacts/utils.d.ts +1 -1
- 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 +1 -1
- package/build/codegen/generators/persistedQueries/index.d.ts +1 -1
- package/build/codegen/generators/runtime/graphqlFunction.d.ts +2 -0
- package/build/codegen/generators/runtime/index.d.ts +1 -1
- 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/{imperativeCache.d.ts → imperativeTypeDef.d.ts} +1 -1
- package/build/codegen/generators/typescript/index.d.ts +1 -1
- package/build/codegen/generators/typescript/inlineType.d.ts +1 -1
- package/build/codegen/generators/typescript/typeReference.d.ts +1 -1
- package/build/codegen/generators/typescript/types.d.ts +1 -1
- package/build/codegen/index.d.ts +1 -1
- package/build/codegen/transforms/addID.d.ts +1 -1
- package/build/codegen/transforms/composeQueries.d.ts +2 -2
- package/build/codegen/transforms/fragmentVariables.d.ts +3 -2
- package/build/codegen/transforms/list.d.ts +1 -1
- package/build/codegen/transforms/paginate.d.ts +1 -1
- package/build/codegen/transforms/schema.d.ts +1 -1
- package/build/codegen/transforms/typename.d.ts +1 -1
- 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 +1 -1
- package/build/codegen/validators/typeCheck.d.ts +1 -1
- package/build/codegen-cjs/index.js +1320 -2779
- package/build/codegen-esm/index.js +1320 -2779
- package/build/lib/config.d.ts +9 -4
- package/build/lib/fs.d.ts +1 -1
- package/build/lib/graphql.d.ts +1 -1
- package/build/lib/imports.d.ts +1 -1
- package/build/lib/types.d.ts +3 -3
- package/build/lib/walk.d.ts +8 -5
- package/build/lib-cjs/index.js +155 -1856
- package/build/lib-esm/index.js +155 -1856
- package/build/runtime/cache/cache.d.ts +10 -8
- 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/stuff.d.ts +2 -2
- package/build/runtime/cache/subscription.d.ts +19 -11
- package/build/runtime/client/documentStore.d.ts +87 -0
- package/build/runtime/client/index.d.ts +25 -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 +3 -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 +18 -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 +26 -25
- package/build/runtime/lib/index.d.ts +1 -2
- 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 +22 -9
- package/build/runtime/public/cache.d.ts +20 -7
- package/build/runtime/public/list.d.ts +2 -2
- package/build/runtime/public/record.d.ts +18 -18
- package/build/runtime/public/tests/test.d.ts +44 -1
- package/build/runtime/public/types.d.ts +8 -0
- package/build/runtime-cjs/cache/cache.d.ts +10 -8
- package/build/runtime-cjs/cache/cache.js +5 -11
- package/build/runtime-cjs/cache/gc.d.ts +1 -1
- package/build/runtime-cjs/cache/lists.d.ts +3 -2
- package/build/runtime-cjs/cache/lists.js +5 -2
- package/build/runtime-cjs/cache/schema.d.ts +2 -2
- package/build/runtime-cjs/cache/stuff.d.ts +2 -2
- package/build/runtime-cjs/cache/subscription.d.ts +19 -11
- package/build/runtime-cjs/cache/subscription.js +95 -56
- package/build/runtime-cjs/client/documentStore.d.ts +87 -0
- package/build/runtime-cjs/client/documentStore.js +360 -0
- package/build/runtime-cjs/client/index.d.ts +25 -0
- package/build/runtime-cjs/client/index.js +87 -0
- package/build/runtime-cjs/client/plugins/cache.d.ts +8 -0
- package/build/runtime-cjs/client/plugins/cache.js +99 -0
- package/build/runtime-cjs/client/plugins/fetch.d.ts +37 -0
- package/build/runtime-cjs/{lib/networkUtils.js → client/plugins/fetch.js} +95 -3
- package/build/runtime-cjs/client/plugins/fetchParams.d.ts +9 -0
- package/build/runtime-cjs/client/plugins/fetchParams.js +40 -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 +3 -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 +18 -0
- package/build/runtime-cjs/client/plugins/subscription.js +98 -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 +26 -25
- package/build/runtime-cjs/lib/config.js +5 -4
- package/build/runtime-cjs/lib/index.d.ts +1 -2
- package/build/runtime-cjs/lib/index.js +1 -2
- 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 +22 -9
- package/build/runtime-cjs/public/cache.d.ts +20 -7
- package/build/runtime-cjs/public/cache.js +29 -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 +18 -18
- package/build/runtime-cjs/public/record.js +23 -189
- package/build/runtime-cjs/public/tests/test.d.ts +44 -1
- 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 +10 -8
- package/build/runtime-esm/cache/cache.js +5 -11
- package/build/runtime-esm/cache/gc.d.ts +1 -1
- package/build/runtime-esm/cache/lists.d.ts +3 -2
- package/build/runtime-esm/cache/lists.js +5 -2
- package/build/runtime-esm/cache/schema.d.ts +2 -2
- package/build/runtime-esm/cache/stuff.d.ts +2 -2
- package/build/runtime-esm/cache/subscription.d.ts +19 -11
- package/build/runtime-esm/cache/subscription.js +95 -56
- package/build/runtime-esm/client/documentStore.d.ts +87 -0
- package/build/runtime-esm/client/documentStore.js +336 -0
- package/build/runtime-esm/client/index.d.ts +25 -0
- package/build/runtime-esm/client/index.js +58 -0
- package/build/runtime-esm/client/plugins/cache.d.ts +8 -0
- package/build/runtime-esm/client/plugins/cache.js +69 -0
- package/build/runtime-esm/client/plugins/fetch.d.ts +37 -0
- package/build/runtime-esm/client/plugins/fetch.js +151 -0
- package/build/runtime-esm/client/plugins/fetchParams.d.ts +9 -0
- package/build/runtime-esm/client/plugins/fetchParams.js +16 -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 +3 -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 +18 -0
- package/build/runtime-esm/client/plugins/subscription.js +74 -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 +26 -25
- package/build/runtime-esm/lib/config.js +5 -4
- package/build/runtime-esm/lib/index.d.ts +1 -2
- package/build/runtime-esm/lib/index.js +1 -2
- 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 +22 -9
- package/build/runtime-esm/public/cache.d.ts +20 -7
- package/build/runtime-esm/public/cache.js +28 -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 +18 -18
- package/build/runtime-esm/public/record.js +22 -185
- package/build/runtime-esm/public/tests/test.d.ts +44 -1
- 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 +4 -3
- package/build/test-cjs/index.js +1334 -2766
- package/build/test-esm/index.js +1334 -2766
- 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 +1395 -2821
- package/build/vite-esm/index.js +1395 -2821
- package/package.json +1 -1
- 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
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type {
|
|
1
|
+
import type { FragmentArtifact } from '../lib/types';
|
|
2
|
+
import type { Cache } from './cache';
|
|
3
|
+
import type { CacheTypeDef, FragmentList, FragmentValue, FragmentVariables, ValidTypes } from './types';
|
|
3
4
|
export declare class Record<Def extends CacheTypeDef, Type extends ValidTypes<Def>> {
|
|
4
5
|
#private;
|
|
5
6
|
type: string;
|
|
@@ -10,22 +11,21 @@ export declare class Record<Def extends CacheTypeDef, Type extends ValidTypes<De
|
|
|
10
11
|
idFields: {};
|
|
11
12
|
id: string;
|
|
12
13
|
});
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
read<_Fragment extends {
|
|
15
|
+
artifact: FragmentArtifact;
|
|
16
|
+
}>({ fragment, variables, }: {
|
|
17
|
+
fragment: _Fragment;
|
|
18
|
+
variables?: FragmentVariables<FragmentList<Def, Type>, _Fragment>;
|
|
19
|
+
}): {
|
|
20
|
+
data: FragmentValue<FragmentList<Def, Type>, _Fragment> | null;
|
|
21
|
+
partial: boolean;
|
|
22
|
+
};
|
|
23
|
+
write<_Fragment extends {
|
|
24
|
+
artifact: FragmentArtifact;
|
|
25
|
+
}, _Variable>(args: {
|
|
26
|
+
fragment: _Fragment;
|
|
27
|
+
data: FragmentValue<FragmentList<Def, Type>, _Fragment>;
|
|
28
|
+
variables?: FragmentVariables<FragmentList<Def, Type>, _Fragment>;
|
|
17
29
|
}): void;
|
|
18
|
-
get<Field extends TypeFieldNames<Def, Type>>({ field, args, }: {
|
|
19
|
-
field: Field;
|
|
20
|
-
args?: ArgType<Def, Type, Field>;
|
|
21
|
-
}): FieldType<Def, Type, Field>;
|
|
22
30
|
delete(): void;
|
|
23
31
|
}
|
|
24
|
-
export declare function computeKey({ field, args }: {
|
|
25
|
-
field: string;
|
|
26
|
-
args?: {
|
|
27
|
-
[key: string]: any;
|
|
28
|
-
};
|
|
29
|
-
}): string;
|
|
30
|
-
export declare const stringifyObjectWithNoQuotesOnKeys: (obj_from_json: {}) => string;
|
|
31
|
-
export declare function marshalNestedList(list: any[]): any[];
|
|
@@ -18,15 +18,12 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var record_exports = {};
|
|
20
20
|
__export(record_exports, {
|
|
21
|
-
Record: () => Record
|
|
22
|
-
computeKey: () => computeKey,
|
|
23
|
-
marshalNestedList: () => marshalNestedList,
|
|
24
|
-
stringifyObjectWithNoQuotesOnKeys: () => stringifyObjectWithNoQuotesOnKeys
|
|
21
|
+
Record: () => Record
|
|
25
22
|
});
|
|
26
23
|
module.exports = __toCommonJS(record_exports);
|
|
27
24
|
var import_cache = require("../cache/cache");
|
|
28
25
|
var import_lib = require("../lib");
|
|
29
|
-
var
|
|
26
|
+
var import_config = require("../lib/config");
|
|
30
27
|
class Record {
|
|
31
28
|
#id;
|
|
32
29
|
#cache;
|
|
@@ -43,207 +40,44 @@ class Record {
|
|
|
43
40
|
this.type = type;
|
|
44
41
|
this.idFields = idFields;
|
|
45
42
|
if (id !== import_cache.rootID) {
|
|
46
|
-
for (const key of (0,
|
|
43
|
+
for (const key of (0, import_config.keyFieldsForType)(this.#cache.config, type)) {
|
|
47
44
|
if (!(key in idFields)) {
|
|
48
45
|
throw new Error("Missing key in idFields: " + key);
|
|
49
46
|
}
|
|
50
47
|
}
|
|
51
48
|
}
|
|
52
49
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
value
|
|
50
|
+
read({
|
|
51
|
+
fragment,
|
|
52
|
+
variables
|
|
57
53
|
}) {
|
|
58
|
-
this.#cache.
|
|
59
|
-
|
|
60
|
-
const typeInfo = (0, import_cache2._typeInfo)(this.#cache, this.type, field);
|
|
61
|
-
let newValue;
|
|
62
|
-
if (typeInfo.link) {
|
|
63
|
-
const keys = (0, import_lib.keyFieldsForType)(this.#cache.config, typeInfo.type);
|
|
64
|
-
typeInfo.selection = {
|
|
65
|
-
fields: keys.reduce(
|
|
66
|
-
(acc, key2) => {
|
|
67
|
-
const keyInfo = (0, import_cache2._typeInfo)(this.#cache, typeInfo.type, key2);
|
|
68
|
-
return {
|
|
69
|
-
...acc,
|
|
70
|
-
[key2]: {
|
|
71
|
-
type: keyInfo.type,
|
|
72
|
-
keyRaw: key2
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
__typename: {
|
|
78
|
-
type: "String",
|
|
79
|
-
keyRaw: "__typename"
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
)
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
if (!typeInfo.link) {
|
|
86
|
-
const fnMarshal = this.#cache.config.scalars?.[typeInfo.type]?.marshal;
|
|
87
|
-
if (fnMarshal) {
|
|
88
|
-
newValue = fnMarshal(value);
|
|
89
|
-
} else {
|
|
90
|
-
newValue = value;
|
|
91
|
-
}
|
|
92
|
-
} else if (value instanceof Record) {
|
|
93
|
-
newValue = {
|
|
94
|
-
...value.idFields,
|
|
95
|
-
__typename: value.type
|
|
96
|
-
};
|
|
97
|
-
} else if (Array.isArray(value)) {
|
|
98
|
-
newValue = marshalNestedList(value);
|
|
99
|
-
} else if (value !== null) {
|
|
100
|
-
throw new Error("Value must be a RecordProxy if the field is a link to another record");
|
|
101
|
-
}
|
|
102
|
-
this.#cache._internal_unstable._internal_unstable.lifetimes.resetLifetime(this.#id, key);
|
|
103
|
-
this.#cache._internal_unstable.write({
|
|
54
|
+
return this.#cache._internal_unstable.read({
|
|
55
|
+
selection: fragment.artifact.selection,
|
|
104
56
|
parent: this.#id,
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
},
|
|
113
|
-
data: {
|
|
114
|
-
[field]: newValue
|
|
115
|
-
}
|
|
57
|
+
variables: (0, import_lib.marshalInputs)({
|
|
58
|
+
config: this.#cache.config,
|
|
59
|
+
artifact: fragment.artifact,
|
|
60
|
+
input: variables
|
|
61
|
+
}) ?? void 0
|
|
116
62
|
});
|
|
117
63
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
this.#cache.validateInstabilityWarning();
|
|
123
|
-
const key = computeKey({ field, args });
|
|
124
|
-
const typeInfo = (0, import_cache2._typeInfo)(this.#cache, this.type, field);
|
|
125
|
-
if (typeInfo.link) {
|
|
126
|
-
const keys = (0, import_lib.keyFieldsForType)(this.#cache.config, typeInfo.type);
|
|
127
|
-
typeInfo.selection = {
|
|
128
|
-
fields: keys.reduce(
|
|
129
|
-
(acc, key2) => {
|
|
130
|
-
const keyInfo = (0, import_cache2._typeInfo)(this.#cache, typeInfo.type, key2);
|
|
131
|
-
return {
|
|
132
|
-
...acc,
|
|
133
|
-
[key2]: {
|
|
134
|
-
type: keyInfo.type,
|
|
135
|
-
keyRaw: key2
|
|
136
|
-
}
|
|
137
|
-
};
|
|
138
|
-
},
|
|
139
|
-
{
|
|
140
|
-
__typename: {
|
|
141
|
-
type: "String",
|
|
142
|
-
keyRaw: "__typename"
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
)
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
const result = this.#cache._internal_unstable.read({
|
|
64
|
+
write(args) {
|
|
65
|
+
this.#cache._internal_unstable.write({
|
|
66
|
+
data: args.data,
|
|
67
|
+
selection: args.fragment.artifact.selection,
|
|
149
68
|
parent: this.#id,
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
}
|
|
69
|
+
variables: (0, import_lib.marshalInputs)({
|
|
70
|
+
config: this.#cache.config,
|
|
71
|
+
artifact: args.fragment.artifact,
|
|
72
|
+
input: args.variables
|
|
73
|
+
}) ?? void 0
|
|
158
74
|
});
|
|
159
|
-
if (!typeInfo.link) {
|
|
160
|
-
return result.data?.[field] ?? (typeInfo.nullable ? null : void 0);
|
|
161
|
-
}
|
|
162
|
-
const data = result.data?.[field] || {};
|
|
163
|
-
let finalResult = unmarshalNestedList(
|
|
164
|
-
this.#cache,
|
|
165
|
-
!Array.isArray(data) ? [data] : data
|
|
166
|
-
).map((val) => {
|
|
167
|
-
if (typeInfo.nullable && (val === null || Object.keys(val).length === 0)) {
|
|
168
|
-
return null;
|
|
169
|
-
}
|
|
170
|
-
return val;
|
|
171
|
-
});
|
|
172
|
-
return Array.isArray(data) ? finalResult : finalResult[0];
|
|
173
75
|
}
|
|
174
76
|
delete() {
|
|
175
77
|
this.#cache._internal_unstable.delete(this.#id);
|
|
176
78
|
}
|
|
177
79
|
}
|
|
178
|
-
function computeKey({ field, args }) {
|
|
179
|
-
const keys = Object.keys(args ?? {});
|
|
180
|
-
keys.sort();
|
|
181
|
-
return args && keys.length > 0 ? `${field}(${keys.map((key) => `${key}: ${stringifyObjectWithNoQuotesOnKeys(args[key])}`).join(", ")})` : field;
|
|
182
|
-
}
|
|
183
|
-
const stringifyObjectWithNoQuotesOnKeys = (obj_from_json) => {
|
|
184
|
-
if (Array.isArray(obj_from_json)) {
|
|
185
|
-
return `[${obj_from_json.map((obj) => `${stringifyObjectWithNoQuotesOnKeys(obj)}`).join(", ")}]`;
|
|
186
|
-
}
|
|
187
|
-
if (typeof obj_from_json !== "object" || obj_from_json instanceof Date || obj_from_json === null) {
|
|
188
|
-
return JSON.stringify(obj_from_json).replace(/"([^"]+)":/g, "$1: ");
|
|
189
|
-
}
|
|
190
|
-
return `{${Object.keys(obj_from_json).map((key) => `${key}: ${stringifyObjectWithNoQuotesOnKeys(obj_from_json[key])}`).join(", ")}}`;
|
|
191
|
-
};
|
|
192
|
-
function marshalNestedList(list) {
|
|
193
|
-
const newValue = [];
|
|
194
|
-
for (const inner of list) {
|
|
195
|
-
if (Array.isArray(inner)) {
|
|
196
|
-
newValue.push(marshalNestedList(inner));
|
|
197
|
-
} else if (inner instanceof Record) {
|
|
198
|
-
newValue.push({ ...inner.idFields, __typename: inner.type });
|
|
199
|
-
} else {
|
|
200
|
-
newValue.push(inner);
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
return newValue;
|
|
204
|
-
}
|
|
205
|
-
function unmarshalNestedList(cache, list) {
|
|
206
|
-
const newValue = [];
|
|
207
|
-
for (const inner of list) {
|
|
208
|
-
if (Array.isArray(inner)) {
|
|
209
|
-
newValue.push(unmarshalNestedList(cache, inner));
|
|
210
|
-
} else if (inner === null) {
|
|
211
|
-
newValue.push(null);
|
|
212
|
-
} else if (inner.__typename) {
|
|
213
|
-
const type = inner.__typename;
|
|
214
|
-
let recordID = cache._internal_unstable._internal_unstable.id(type, inner);
|
|
215
|
-
if (!recordID) {
|
|
216
|
-
throw new Error("todo");
|
|
217
|
-
}
|
|
218
|
-
const typename = cache._internal_unstable.read({
|
|
219
|
-
selection: {
|
|
220
|
-
fields: {
|
|
221
|
-
__typename: {
|
|
222
|
-
keyRaw: "__typename",
|
|
223
|
-
type: "String"
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
},
|
|
227
|
-
parent: recordID
|
|
228
|
-
}).data?.__typename;
|
|
229
|
-
newValue.push(
|
|
230
|
-
new Record({
|
|
231
|
-
cache,
|
|
232
|
-
type: type || typename,
|
|
233
|
-
idFields: inner,
|
|
234
|
-
id: recordID
|
|
235
|
-
})
|
|
236
|
-
);
|
|
237
|
-
} else {
|
|
238
|
-
newValue.push(inner);
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
return newValue;
|
|
242
|
-
}
|
|
243
80
|
// Annotate the CommonJS export names for ESM import in node:
|
|
244
81
|
0 && (module.exports = {
|
|
245
|
-
Record
|
|
246
|
-
computeKey,
|
|
247
|
-
marshalNestedList,
|
|
248
|
-
stringifyObjectWithNoQuotesOnKeys
|
|
82
|
+
Record
|
|
249
83
|
});
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { type SubscriptionSelection, type FragmentArtifact, type QueryArtifact } from '../../lib';
|
|
1
2
|
import { Cache } from '../cache';
|
|
2
|
-
import { Record } from '../record';
|
|
3
|
+
import type { Record } from '../record';
|
|
3
4
|
type CacheTypeDef = {
|
|
4
5
|
types: {
|
|
5
6
|
__ROOT__: {
|
|
6
7
|
idFields: {};
|
|
8
|
+
fragments: [];
|
|
7
9
|
fields: {
|
|
8
10
|
test: {
|
|
9
11
|
type: number | null;
|
|
@@ -39,6 +41,19 @@ type CacheTypeDef = {
|
|
|
39
41
|
idFields: {
|
|
40
42
|
id: string;
|
|
41
43
|
};
|
|
44
|
+
fragments: [
|
|
45
|
+
[
|
|
46
|
+
{
|
|
47
|
+
artifact: FragmentArtifact;
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
firstName: string;
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
pattern: string;
|
|
54
|
+
}
|
|
55
|
+
]
|
|
56
|
+
];
|
|
42
57
|
fields: {
|
|
43
58
|
firstName: {
|
|
44
59
|
type: string;
|
|
@@ -62,6 +77,7 @@ type CacheTypeDef = {
|
|
|
62
77
|
idFields: {
|
|
63
78
|
id: string;
|
|
64
79
|
};
|
|
80
|
+
fragments: [];
|
|
65
81
|
fields: {
|
|
66
82
|
name: {
|
|
67
83
|
type: string | null;
|
|
@@ -85,6 +101,7 @@ type CacheTypeDef = {
|
|
|
85
101
|
idFields: {
|
|
86
102
|
id: string;
|
|
87
103
|
};
|
|
104
|
+
fragments: [];
|
|
88
105
|
fields: {
|
|
89
106
|
name: {
|
|
90
107
|
type: string | null;
|
|
@@ -97,6 +114,26 @@ type CacheTypeDef = {
|
|
|
97
114
|
};
|
|
98
115
|
};
|
|
99
116
|
};
|
|
117
|
+
queries: [
|
|
118
|
+
[
|
|
119
|
+
{
|
|
120
|
+
artifact: QueryArtifact;
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
viewer: {
|
|
124
|
+
id: string;
|
|
125
|
+
firstName: string;
|
|
126
|
+
__typename: string;
|
|
127
|
+
parent: {
|
|
128
|
+
id: string;
|
|
129
|
+
firstName: string;
|
|
130
|
+
__typename: string;
|
|
131
|
+
};
|
|
132
|
+
};
|
|
133
|
+
},
|
|
134
|
+
any
|
|
135
|
+
]
|
|
136
|
+
];
|
|
100
137
|
lists: {
|
|
101
138
|
All_Pets: {
|
|
102
139
|
types: 'User' | 'Cat';
|
|
@@ -111,4 +148,10 @@ type CacheTypeDef = {
|
|
|
111
148
|
};
|
|
112
149
|
};
|
|
113
150
|
export declare const testCache: () => Cache<CacheTypeDef>;
|
|
151
|
+
export declare const testFragment: (selection: SubscriptionSelection) => {
|
|
152
|
+
artifact: FragmentArtifact;
|
|
153
|
+
};
|
|
154
|
+
export declare const testQuery: (selection: SubscriptionSelection) => {
|
|
155
|
+
artifact: QueryArtifact;
|
|
156
|
+
};
|
|
114
157
|
export {};
|
|
@@ -18,14 +18,39 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var test_exports = {};
|
|
20
20
|
__export(test_exports, {
|
|
21
|
-
testCache: () => testCache
|
|
21
|
+
testCache: () => testCache,
|
|
22
|
+
testFragment: () => testFragment,
|
|
23
|
+
testQuery: () => testQuery
|
|
22
24
|
});
|
|
23
25
|
module.exports = __toCommonJS(test_exports);
|
|
24
26
|
var import_test = require("../../../test");
|
|
25
27
|
var import_cache = require("../../cache/cache");
|
|
28
|
+
var import_lib = require("../../lib");
|
|
26
29
|
var import_cache2 = require("../cache");
|
|
27
30
|
const testCache = () => new import_cache2.Cache(new import_cache.Cache((0, import_test.testConfigFile)()));
|
|
31
|
+
const testFragment = (selection) => ({
|
|
32
|
+
artifact: {
|
|
33
|
+
kind: import_lib.ArtifactKind.Fragment,
|
|
34
|
+
hash: "",
|
|
35
|
+
raw: "",
|
|
36
|
+
name: "",
|
|
37
|
+
rootType: "User",
|
|
38
|
+
selection
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
const testQuery = (selection) => ({
|
|
42
|
+
artifact: {
|
|
43
|
+
kind: import_lib.ArtifactKind.Query,
|
|
44
|
+
hash: "",
|
|
45
|
+
raw: "",
|
|
46
|
+
name: "",
|
|
47
|
+
rootType: "Query",
|
|
48
|
+
selection
|
|
49
|
+
}
|
|
50
|
+
});
|
|
28
51
|
// Annotate the CommonJS export names for ESM import in node:
|
|
29
52
|
0 && (module.exports = {
|
|
30
|
-
testCache
|
|
53
|
+
testCache,
|
|
54
|
+
testFragment,
|
|
55
|
+
testQuery
|
|
31
56
|
});
|
|
@@ -11,6 +11,7 @@ export type CacheTypeDef = {
|
|
|
11
11
|
type: any;
|
|
12
12
|
};
|
|
13
13
|
};
|
|
14
|
+
fragments: [any, any, any][];
|
|
14
15
|
};
|
|
15
16
|
};
|
|
16
17
|
lists: {
|
|
@@ -19,11 +20,14 @@ export type CacheTypeDef = {
|
|
|
19
20
|
filters: any;
|
|
20
21
|
};
|
|
21
22
|
};
|
|
23
|
+
queries: [any, any, any][];
|
|
22
24
|
};
|
|
23
25
|
export type ValidTypes<Def extends CacheTypeDef> = keyof Def['types'];
|
|
24
26
|
export type TypeFields<Def extends CacheTypeDef, Type extends keyof Def['types']> = Def['types'][Type]['fields'];
|
|
25
27
|
export type TypeFieldNames<Def extends CacheTypeDef, Type extends keyof Def['types']> = Extract<keyof TypeFields<Def, Type>, string>;
|
|
26
28
|
export type TypeNames<Def extends CacheTypeDef> = Extract<Exclude<ValidTypes<Def>, '__ROOT__'>, string>;
|
|
29
|
+
export type FragmentList<Def extends CacheTypeDef, Type extends ValidTypes<Def>> = Def['types'][Type]['fragments'];
|
|
30
|
+
export type QueryList<Def extends CacheTypeDef> = Def['queries'];
|
|
27
31
|
export type IDFields<Def extends CacheTypeDef, Type extends keyof Def['types']> = Def['types'][Type]['idFields'];
|
|
28
32
|
export type ProxyUnion<Def extends CacheTypeDef, U> = U extends null ? null : U extends TypeNames<Def> ? Record<Def, U> : never;
|
|
29
33
|
export type FieldType<Def extends CacheTypeDef, Type extends keyof Def['types'], Field extends keyof TypeFields<Def, Type>> = TypeFields<Def, Type>[Field]['type'];
|
|
@@ -34,3 +38,7 @@ export type ListFilters<Def extends CacheTypeDef, ListName extends ValidLists<De
|
|
|
34
38
|
must_not?: Def['lists'][ListName]['filters'];
|
|
35
39
|
} : never;
|
|
36
40
|
export type ListType<Def extends CacheTypeDef, Name extends ValidLists<Def>> = ProxyUnion<Def, Def['lists'][Name]['types']>;
|
|
41
|
+
export type FragmentVariables<_List, _Target> = _List extends [infer Head, ...infer Rest] ? Head extends [infer _Key, infer _Value, infer _Input] ? _Key extends _Target ? _Input : FragmentValue<Rest, _Target> : 'Encountered unknown fragment. Please make sure your runtime is up to date (ie, `vite dev` or `vite build`).' : 'Encountered unknown fragment. Please make sure your runtime is up to date (ie, `vite dev` or `vite build`).';
|
|
42
|
+
export type FragmentValue<List, _Target> = List extends [infer Head, ...infer Rest] ? Head extends [infer _Key, infer _Value, infer _Input] ? _Key extends _Target ? _Value : FragmentValue<Rest, _Target> : 'Encountered unknown fragment. Please make sure your runtime is up to date (ie, `vite dev` or `vite build`).' : 'Encountered unknown fragment. Please make sure your runtime is up to date (ie, `vite dev` or `vite build`).';
|
|
43
|
+
export type QueryValue<List, _Target> = List extends [infer Head, ...infer Rest] ? Head extends [infer _Key, infer _Value, infer _Input] ? _Key extends _Target ? _Value : QueryValue<Rest, _Target> : 'Encountered unknown query.Please make sure your runtime is up to date (ie, `vite dev` or `vite build`).' : 'Encountered unknown query.Please make sure your runtime is up to date (ie, `vite dev` or `vite build`).';
|
|
44
|
+
export type QueryInput<List, _Target> = List extends [infer Head, ...infer Rest] ? Head extends [infer _Key, infer _Value, infer _Input] ? _Key extends _Target ? _Input : QueryValue<Rest, _Target> : 'Encountered unknown query.Please make sure your runtime is up to date (ie, `vite dev` or `vite build`).' : 'Encountered unknown query.Please make sure your runtime is up to date (ie, `vite dev` or `vite build`).';
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { ConfigFile } from '../lib/config';
|
|
2
|
-
import { GraphQLObject, GraphQLValue, SubscriptionSelection, SubscriptionSpec } from '../lib/types';
|
|
1
|
+
import type { ConfigFile } from '../lib/config';
|
|
2
|
+
import type { GraphQLObject, GraphQLValue, SubscriptionSelection, SubscriptionSpec } from '../lib/types';
|
|
3
3
|
import { GarbageCollector } from './gc';
|
|
4
|
-
import { ListCollection
|
|
4
|
+
import type { ListCollection } from './lists';
|
|
5
|
+
import { ListManager } from './lists';
|
|
5
6
|
import { SchemaManager } from './schema';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
7
|
+
import type { Layer, LayerID } from './storage';
|
|
8
|
+
import { InMemoryStorage } from './storage';
|
|
9
|
+
import { type FieldSelection, InMemorySubscriptions } from './subscription';
|
|
8
10
|
export declare class Cache {
|
|
9
11
|
_internal_unstable: CacheInternal;
|
|
10
12
|
constructor(config?: ConfigFile);
|
|
@@ -59,10 +61,10 @@ declare class CacheInternal {
|
|
|
59
61
|
parent?: string;
|
|
60
62
|
root?: string;
|
|
61
63
|
layer: Layer;
|
|
62
|
-
toNotify?:
|
|
64
|
+
toNotify?: FieldSelection[];
|
|
63
65
|
applyUpdates?: boolean;
|
|
64
66
|
forceNotify?: boolean;
|
|
65
|
-
}):
|
|
67
|
+
}): FieldSelection[];
|
|
66
68
|
getSelection({ selection, parent, variables, stepsFromConnection, }: {
|
|
67
69
|
selection: SubscriptionSelection;
|
|
68
70
|
parent?: string;
|
|
@@ -94,7 +96,7 @@ declare class CacheInternal {
|
|
|
94
96
|
linkedType: string;
|
|
95
97
|
abstract: boolean;
|
|
96
98
|
variables: {};
|
|
97
|
-
specs:
|
|
99
|
+
specs: FieldSelection[];
|
|
98
100
|
applyUpdates: boolean;
|
|
99
101
|
fields: SubscriptionSelection;
|
|
100
102
|
layer: Layer;
|
|
@@ -28,7 +28,7 @@ class Cache {
|
|
|
28
28
|
...args
|
|
29
29
|
}) {
|
|
30
30
|
const layer = layerID ? this._internal_unstable.storage.getLayer(layerID) : this._internal_unstable.storage.topLayer;
|
|
31
|
-
const subscribers = this._internal_unstable.writeSelection({ ...args, layer });
|
|
31
|
+
const subscribers = this._internal_unstable.writeSelection({ ...args, layer }).map((sub) => sub[0]);
|
|
32
32
|
const notified = [];
|
|
33
33
|
for (const spec of subscribers.concat(notifySubscribers)) {
|
|
34
34
|
if (!notified.includes(spec.set)) {
|
|
@@ -166,6 +166,7 @@ class CacheInternal {
|
|
|
166
166
|
link: !!fieldSelection
|
|
167
167
|
});
|
|
168
168
|
const currentSubscribers = this.subscriptions.get(parent, key);
|
|
169
|
+
const specs = currentSubscribers.map((sub) => sub[0]);
|
|
169
170
|
const { value: previousValue, displayLayers } = this.storage.get(parent, key);
|
|
170
171
|
const displayLayer = layer.isDisplayLayer(displayLayers);
|
|
171
172
|
if (displayLayer) {
|
|
@@ -191,7 +192,7 @@ class CacheInternal {
|
|
|
191
192
|
}
|
|
192
193
|
const previousLinks = flattenList([previousValue]);
|
|
193
194
|
for (const link of previousLinks) {
|
|
194
|
-
this.subscriptions.remove(link, fieldSelection,
|
|
195
|
+
this.subscriptions.remove(link, fieldSelection, specs, variables);
|
|
195
196
|
}
|
|
196
197
|
layer.writeLink(parent, key, null);
|
|
197
198
|
toNotify.push(...currentSubscribers);
|
|
@@ -215,16 +216,10 @@ class CacheInternal {
|
|
|
215
216
|
layer.writeLink(parent, key, linkedID);
|
|
216
217
|
if (linkedID && displayLayer && (linkChange || forceNotify)) {
|
|
217
218
|
if (previousValue && typeof previousValue === "string") {
|
|
218
|
-
this.subscriptions.remove(
|
|
219
|
-
previousValue,
|
|
220
|
-
fieldSelection,
|
|
221
|
-
currentSubscribers,
|
|
222
|
-
variables
|
|
223
|
-
);
|
|
219
|
+
this.subscriptions.remove(previousValue, fieldSelection, specs, variables);
|
|
224
220
|
}
|
|
225
221
|
this.subscriptions.addMany({
|
|
226
222
|
parent: linkedID,
|
|
227
|
-
selection: fieldSelection,
|
|
228
223
|
subscribers: currentSubscribers,
|
|
229
224
|
variables,
|
|
230
225
|
parentType: linkedType
|
|
@@ -319,7 +314,7 @@ class CacheInternal {
|
|
|
319
314
|
if (linkedIDs.includes(lostID) || !lostID) {
|
|
320
315
|
continue;
|
|
321
316
|
}
|
|
322
|
-
this.subscriptions.remove(lostID, fieldSelection,
|
|
317
|
+
this.subscriptions.remove(lostID, fieldSelection, specs, variables);
|
|
323
318
|
}
|
|
324
319
|
if (contentChanged || oldIDs.length === 0 && newIDs.length === 0) {
|
|
325
320
|
layer.writeLink(parent, key, linkedIDs);
|
|
@@ -330,7 +325,6 @@ class CacheInternal {
|
|
|
330
325
|
}
|
|
331
326
|
this.subscriptions.addMany({
|
|
332
327
|
parent: id,
|
|
333
|
-
selection: fieldSelection,
|
|
334
328
|
subscribers: currentSubscribers,
|
|
335
329
|
variables,
|
|
336
330
|
parentType: linkedType
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { SubscriptionSelection, ListWhen, SubscriptionSpec } from '../lib/types';
|
|
2
|
-
import { Cache } from './cache';
|
|
1
|
+
import type { SubscriptionSelection, ListWhen, SubscriptionSpec } from '../lib/types';
|
|
2
|
+
import type { Cache } from './cache';
|
|
3
3
|
export declare class ListManager {
|
|
4
4
|
rootID: string;
|
|
5
5
|
cache: Cache;
|
|
@@ -55,6 +55,7 @@ export declare class List {
|
|
|
55
55
|
export declare class ListCollection {
|
|
56
56
|
lists: List[];
|
|
57
57
|
constructor(lists: List[]);
|
|
58
|
+
get selection(): SubscriptionSelection;
|
|
58
59
|
append(...args: Parameters<List['append']>): void;
|
|
59
60
|
prepend(...args: Parameters<List['prepend']>): void;
|
|
60
61
|
addToList(...args: Parameters<List['addToList']>): void;
|
|
@@ -257,11 +257,11 @@ class List {
|
|
|
257
257
|
this.cache._internal_unstable.subscriptions.remove(
|
|
258
258
|
targetID,
|
|
259
259
|
this.connection ? this.selection.fields.edges.selection : this.selection,
|
|
260
|
-
subscribers,
|
|
260
|
+
subscribers.map((sub) => sub[0]),
|
|
261
261
|
variables
|
|
262
262
|
);
|
|
263
263
|
this.cache._internal_unstable.storage.remove(parentID, targetKey, targetID);
|
|
264
|
-
for (const spec of subscribers) {
|
|
264
|
+
for (const [spec] of subscribers) {
|
|
265
265
|
spec.set(
|
|
266
266
|
this.cache._internal_unstable.getSelection({
|
|
267
267
|
parent: spec.parentID || this.manager.rootID,
|
|
@@ -325,6 +325,9 @@ class ListCollection {
|
|
|
325
325
|
constructor(lists) {
|
|
326
326
|
this.lists = lists;
|
|
327
327
|
}
|
|
328
|
+
get selection() {
|
|
329
|
+
return this.lists[0].selection;
|
|
330
|
+
}
|
|
328
331
|
append(...args) {
|
|
329
332
|
this.lists.forEach((list) => list.append(...args));
|
|
330
333
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { GraphQLValue } from '../lib/types';
|
|
2
|
-
import { LinkedList } from './cache';
|
|
1
|
+
import type { GraphQLValue } from '../lib/types';
|
|
2
|
+
import type { LinkedList } from './cache';
|
|
3
3
|
export declare function flattenList<T>(source: LinkedList<T>): T[];
|
|
4
4
|
export declare function evaluateKey(key: string, variables?: {
|
|
5
5
|
[key: string]: GraphQLValue;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
|
|
1
|
+
import type { GraphQLValue, SubscriptionSelection, SubscriptionSpec } from '../lib/types';
|
|
2
|
+
import type { Cache } from './cache';
|
|
3
|
+
export type FieldSelection = [
|
|
4
|
+
SubscriptionSpec,
|
|
5
|
+
Required<SubscriptionSelection>['fields'] | undefined
|
|
6
|
+
];
|
|
4
7
|
export declare class InMemorySubscriptions {
|
|
5
8
|
private cache;
|
|
6
9
|
constructor(cache: Cache);
|
|
@@ -16,22 +19,27 @@ export declare class InMemorySubscriptions {
|
|
|
16
19
|
[key: string]: GraphQLValue;
|
|
17
20
|
};
|
|
18
21
|
}): void;
|
|
19
|
-
addFieldSubscription({ id, key,
|
|
22
|
+
addFieldSubscription({ id, key, selection, }: {
|
|
20
23
|
id: string;
|
|
21
24
|
key: string;
|
|
22
|
-
|
|
23
|
-
|
|
25
|
+
selection: FieldSelection;
|
|
26
|
+
}): void;
|
|
27
|
+
registerList({ list, id, key, parentType, selection, filters, variables, }: {
|
|
28
|
+
list: Required<Required<SubscriptionSelection>['fields'][string]>['list'];
|
|
29
|
+
selection: SubscriptionSelection;
|
|
30
|
+
id: string;
|
|
24
31
|
parentType: string;
|
|
25
|
-
|
|
32
|
+
key: string;
|
|
33
|
+
filters: Required<SubscriptionSelection>['fields'][string]['filters'];
|
|
34
|
+
variables: Record<string, any>;
|
|
26
35
|
}): void;
|
|
27
|
-
addMany({ parent,
|
|
36
|
+
addMany({ parent, variables, subscribers, parentType, }: {
|
|
28
37
|
parent: string;
|
|
29
|
-
selection: SubscriptionSelection;
|
|
30
38
|
variables: {};
|
|
31
|
-
subscribers:
|
|
39
|
+
subscribers: FieldSelection[];
|
|
32
40
|
parentType: string;
|
|
33
41
|
}): void;
|
|
34
|
-
get(id: string, field: string):
|
|
42
|
+
get(id: string, field: string): FieldSelection[];
|
|
35
43
|
remove(id: string, selection: SubscriptionSelection, targets: SubscriptionSpec[], variables: {}, visited?: string[]): void;
|
|
36
44
|
private removeSubscribers;
|
|
37
45
|
removeAllSubscribers(id: string, targets?: SubscriptionSpec[], visited?: string[]): void;
|