houdini 1.0.0-next.2 → 1.0.0-next.4
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-cjs/index.js +1417 -1231
- package/build/cmd-esm/index.js +1417 -1231
- package/build/codegen/generators/artifacts/selection.d.ts +3 -3
- 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/transforms/fragmentVariables.d.ts +1 -0
- package/build/codegen-cjs/index.js +1262 -1078
- package/build/codegen-esm/index.js +1262 -1078
- package/build/lib/config.d.ts +1 -1
- package/build/lib/walk.d.ts +4 -1
- package/build/lib-cjs/index.js +10 -10
- package/build/lib-esm/index.js +10 -10
- package/build/runtime/cache/cache.d.ts +3 -3
- package/build/runtime/cache/lists.d.ts +1 -0
- package/build/runtime/client/documentStore.d.ts +1 -1
- package/build/runtime/client/plugins/fetchParams.d.ts +1 -1
- package/build/runtime/generated.d.ts +1 -0
- package/build/runtime/index.d.ts +1 -1
- package/build/runtime/lib/config.d.ts +21 -22
- package/build/runtime/lib/scalars.d.ts +2 -2
- package/build/runtime/lib/types.d.ts +2 -3
- package/build/runtime/public/cache.d.ts +19 -6
- package/build/runtime/public/record.d.ts +17 -17
- package/build/runtime/public/tests/test.d.ts +43 -0
- package/build/runtime/public/types.d.ts +8 -0
- package/build/runtime-cjs/cache/cache.d.ts +3 -3
- package/build/runtime-cjs/cache/cache.js +30 -15
- package/build/runtime-cjs/cache/lists.d.ts +1 -0
- package/build/runtime-cjs/cache/lists.js +6 -3
- package/build/runtime-cjs/client/documentStore.d.ts +1 -1
- package/build/runtime-cjs/client/plugins/fetchParams.d.ts +1 -1
- package/build/runtime-cjs/client/plugins/fetchParams.js +6 -1
- package/build/runtime-cjs/client/plugins/query.js +0 -1
- package/build/runtime-cjs/generated.d.ts +1 -0
- package/build/runtime-cjs/index.d.ts +1 -1
- package/build/runtime-cjs/lib/config.d.ts +21 -22
- package/build/runtime-cjs/lib/scalars.d.ts +2 -2
- package/build/runtime-cjs/lib/types.d.ts +2 -3
- package/build/runtime-cjs/public/cache.d.ts +19 -6
- package/build/runtime-cjs/public/cache.js +29 -32
- package/build/runtime-cjs/public/list.js +6 -28
- package/build/runtime-cjs/public/record.d.ts +17 -17
- package/build/runtime-cjs/public/record.js +22 -188
- package/build/runtime-cjs/public/tests/test.d.ts +43 -0
- 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 +3 -3
- package/build/runtime-esm/cache/cache.js +30 -15
- package/build/runtime-esm/cache/lists.d.ts +1 -0
- package/build/runtime-esm/cache/lists.js +6 -3
- package/build/runtime-esm/client/documentStore.d.ts +1 -1
- package/build/runtime-esm/client/plugins/fetchParams.d.ts +1 -1
- package/build/runtime-esm/client/plugins/fetchParams.js +6 -1
- package/build/runtime-esm/client/plugins/query.js +0 -1
- package/build/runtime-esm/generated.d.ts +1 -0
- package/build/runtime-esm/index.d.ts +1 -1
- package/build/runtime-esm/lib/config.d.ts +21 -22
- package/build/runtime-esm/lib/scalars.d.ts +2 -2
- package/build/runtime-esm/lib/types.d.ts +2 -3
- package/build/runtime-esm/public/cache.d.ts +19 -6
- package/build/runtime-esm/public/cache.js +28 -30
- package/build/runtime-esm/public/list.js +6 -28
- package/build/runtime-esm/public/record.d.ts +17 -17
- package/build/runtime-esm/public/record.js +21 -184
- package/build/runtime-esm/public/tests/test.d.ts +43 -0
- package/build/runtime-esm/public/tests/test.js +26 -1
- package/build/runtime-esm/public/types.d.ts +8 -0
- package/build/test-cjs/index.js +1270 -1087
- package/build/test-esm/index.js +1270 -1087
- package/build/vite-cjs/index.js +1271 -1087
- package/build/vite-esm/index.js +1271 -1087
- package/package.json +1 -1
|
@@ -176,7 +176,7 @@ class List {
|
|
|
176
176
|
edges: {
|
|
177
177
|
keyRaw: "edges",
|
|
178
178
|
type: "ConnectionEdge",
|
|
179
|
-
|
|
179
|
+
updates: ["append", "prepend"],
|
|
180
180
|
selection: {
|
|
181
181
|
fields: {
|
|
182
182
|
node: {
|
|
@@ -212,7 +212,7 @@ class List {
|
|
|
212
212
|
newEntries: {
|
|
213
213
|
keyRaw: this.key,
|
|
214
214
|
type: listType,
|
|
215
|
-
|
|
215
|
+
updates: ["append", "prepend"],
|
|
216
216
|
selection: {
|
|
217
217
|
...selection,
|
|
218
218
|
fields: {
|
|
@@ -235,7 +235,7 @@ class List {
|
|
|
235
235
|
data: insertData,
|
|
236
236
|
variables,
|
|
237
237
|
parent: this.recordID,
|
|
238
|
-
applyUpdates:
|
|
238
|
+
applyUpdates: [where === "first" ? "prepend" : "append"]
|
|
239
239
|
});
|
|
240
240
|
}
|
|
241
241
|
removeID(id, variables = {}) {
|
|
@@ -350,6 +350,9 @@ class ListCollection {
|
|
|
350
350
|
constructor(lists) {
|
|
351
351
|
this.lists = lists;
|
|
352
352
|
}
|
|
353
|
+
get selection() {
|
|
354
|
+
return this.lists[0].selection;
|
|
355
|
+
}
|
|
353
356
|
append(...args) {
|
|
354
357
|
this.lists.forEach((list) => list.append(...args));
|
|
355
358
|
}
|
|
@@ -5,5 +5,5 @@ export declare const fetchParamsPlugin: (fn?: FetchParamFn) => ClientPlugin;
|
|
|
5
5
|
export type FetchParamsInput = Pick<ClientPluginContext, 'config' | 'policy' | 'variables' | 'metadata' | 'session' | 'stuff'> & {
|
|
6
6
|
text: string;
|
|
7
7
|
hash: string;
|
|
8
|
-
|
|
8
|
+
document: DocumentArtifact;
|
|
9
9
|
};
|
|
@@ -26,7 +26,12 @@ const fetchParamsPlugin = (fn = () => ({})) => () => ({
|
|
|
26
26
|
next({
|
|
27
27
|
...ctx,
|
|
28
28
|
fetchParams: fn({
|
|
29
|
-
|
|
29
|
+
config: ctx.config,
|
|
30
|
+
policy: ctx.policy,
|
|
31
|
+
metadata: ctx.metadata,
|
|
32
|
+
session: ctx.session,
|
|
33
|
+
stuff: ctx.stuff,
|
|
34
|
+
document: ctx.artifact,
|
|
30
35
|
variables: marshalVariables(ctx),
|
|
31
36
|
text: ctx.artifact.raw,
|
|
32
37
|
hash: ctx.artifact.hash
|
|
@@ -54,7 +54,6 @@ const queryPlugin = (0, import_utils.documentPlugin)(import_types.ArtifactKind.Q
|
|
|
54
54
|
selection: ctx.artifact.selection,
|
|
55
55
|
variables: () => lastVariables,
|
|
56
56
|
set: (newValue) => {
|
|
57
|
-
console.log("setting from cache update");
|
|
58
57
|
resolve(ctx, {
|
|
59
58
|
data: newValue,
|
|
60
59
|
errors: null,
|
|
@@ -3,6 +3,6 @@ import type { CacheTypeDef } from './generated';
|
|
|
3
3
|
import { Cache } from './public';
|
|
4
4
|
export * from './client';
|
|
5
5
|
export * from './lib';
|
|
6
|
-
export declare function graphql(str:
|
|
6
|
+
export declare function graphql<_Payload>(str: TemplateStringsArray): _Payload;
|
|
7
7
|
export declare const cache: Cache<CacheTypeDef>;
|
|
8
8
|
export declare function getCache(): InternalCache;
|
|
@@ -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
|
*/
|
|
@@ -90,20 +81,9 @@ export type ConfigFile = {
|
|
|
90
81
|
*/
|
|
91
82
|
defaultFragmentMasking?: 'enable' | 'disable';
|
|
92
83
|
/**
|
|
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
|
|
84
|
+
* Configure the dev environment to watch a remote schema for changes
|
|
105
85
|
*/
|
|
106
|
-
|
|
86
|
+
watchSchema?: WatchSchemaConfig;
|
|
107
87
|
/**
|
|
108
88
|
* An object describing the plugins enabled for the project
|
|
109
89
|
*/
|
|
@@ -133,6 +113,25 @@ export type TypeConfig = {
|
|
|
133
113
|
};
|
|
134
114
|
};
|
|
135
115
|
};
|
|
116
|
+
export type WatchSchemaConfig = {
|
|
117
|
+
/**
|
|
118
|
+
* A url to use to pull the schema. For more information: https://www.houdinigraphql.com/api/cli#generate
|
|
119
|
+
*/
|
|
120
|
+
url: string | ((env: Record<string, string | undefined>) => string);
|
|
121
|
+
/**
|
|
122
|
+
* sets the amount of time between each request in milliseconds (default 2 seconds).
|
|
123
|
+
* To limit the schema introspection to just on the start of the server, set interval to 0.
|
|
124
|
+
* To disable the schema introspection, set interval to null.
|
|
125
|
+
*/
|
|
126
|
+
interval?: number | null;
|
|
127
|
+
/**
|
|
128
|
+
* An object containing the environment variables you want passed onto the api when polling for a new schema.
|
|
129
|
+
* The keys dictate the header names. If the value is a string, the corresponding environment variable will be used
|
|
130
|
+
* directly. If the value is a function, the current environment will be passed to your function so you can perform any
|
|
131
|
+
* logic you need
|
|
132
|
+
*/
|
|
133
|
+
headers?: Record<string, string | ((env: Record<string, string | undefined>) => string)> | ((env: Record<string, string | undefined>) => Record<string, string>);
|
|
134
|
+
};
|
|
136
135
|
export type ScalarSpec = {
|
|
137
136
|
type: string;
|
|
138
137
|
marshal?: (val: any) => any;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { ConfigFile } from './config';
|
|
2
|
-
import type { MutationArtifact, QueryArtifact, SubscriptionArtifact, SubscriptionSelection } from './types';
|
|
2
|
+
import type { FragmentArtifact, MutationArtifact, QueryArtifact, SubscriptionArtifact, SubscriptionSelection } from './types';
|
|
3
3
|
export declare function marshalSelection({ selection, data, }: {
|
|
4
4
|
selection: SubscriptionSelection;
|
|
5
5
|
data: any;
|
|
6
6
|
}): Promise<{} | null | undefined>;
|
|
7
7
|
export declare function marshalInputs<T>({ artifact, input, config, rootType, }: {
|
|
8
|
-
artifact: QueryArtifact | MutationArtifact | SubscriptionArtifact;
|
|
8
|
+
artifact: QueryArtifact | MutationArtifact | SubscriptionArtifact | FragmentArtifact;
|
|
9
9
|
input: unknown;
|
|
10
10
|
rootType?: string;
|
|
11
11
|
config: ConfigFile;
|
|
@@ -71,7 +71,6 @@ export type BaseCompiledDocument = {
|
|
|
71
71
|
rootType: string;
|
|
72
72
|
input?: InputObject;
|
|
73
73
|
refetch?: {
|
|
74
|
-
update: RefetchUpdateMode;
|
|
75
74
|
path: string[];
|
|
76
75
|
method: 'cursor' | 'offset';
|
|
77
76
|
pageSize: number;
|
|
@@ -79,7 +78,7 @@ export type BaseCompiledDocument = {
|
|
|
79
78
|
embedded: boolean;
|
|
80
79
|
targetType: string;
|
|
81
80
|
paginated: boolean;
|
|
82
|
-
direction
|
|
81
|
+
direction: 'forward' | 'backward' | 'both';
|
|
83
82
|
};
|
|
84
83
|
pluginsData?: Record<string, any>;
|
|
85
84
|
};
|
|
@@ -135,7 +134,7 @@ export type SubscriptionSelection = {
|
|
|
135
134
|
connection: boolean;
|
|
136
135
|
type: string;
|
|
137
136
|
};
|
|
138
|
-
|
|
137
|
+
updates?: string[];
|
|
139
138
|
filters?: {
|
|
140
139
|
[key: string]: {
|
|
141
140
|
kind: 'Boolean' | 'String' | 'Float' | 'Int' | 'Variable';
|
|
@@ -1,19 +1,32 @@
|
|
|
1
1
|
import type { Cache as _Cache } from '../cache/cache';
|
|
2
|
-
import
|
|
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 { CacheTypeDef, IDFields, QueryInput, QueryList, QueryValue, 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;
|
|
18
32
|
}
|
|
19
|
-
export declare function _typeInfo<Def extends CacheTypeDef>(cache: Cache<Def>, type: string, field: string): TypeInfo;
|
|
@@ -18,11 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var cache_exports = {};
|
|
20
20
|
__export(cache_exports, {
|
|
21
|
-
Cache: () => Cache
|
|
22
|
-
_typeInfo: () => _typeInfo
|
|
21
|
+
Cache: () => Cache
|
|
23
22
|
});
|
|
24
23
|
module.exports = __toCommonJS(cache_exports);
|
|
25
|
-
var
|
|
24
|
+
var import_lib = require("../lib");
|
|
26
25
|
var import_list = require("./list");
|
|
27
26
|
var import_record = require("./record");
|
|
28
27
|
class Cache {
|
|
@@ -36,19 +35,6 @@ class Cache {
|
|
|
36
35
|
Please acknowledge this by setting acceptImperativeInstability to true in your config file.`);
|
|
37
36
|
}
|
|
38
37
|
}
|
|
39
|
-
setFieldType(...args) {
|
|
40
|
-
this.validateInstabilityWarning();
|
|
41
|
-
this._internal_unstable._internal_unstable.schema.setFieldType(...args);
|
|
42
|
-
}
|
|
43
|
-
get root() {
|
|
44
|
-
this.validateInstabilityWarning();
|
|
45
|
-
return new import_record.Record({
|
|
46
|
-
cache: this,
|
|
47
|
-
type: "Query",
|
|
48
|
-
id: import_cache.rootID,
|
|
49
|
-
idFields: {}
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
38
|
get(type, data) {
|
|
53
39
|
this.validateInstabilityWarning();
|
|
54
40
|
let recordID = this._internal_unstable._internal_unstable.id(type, data);
|
|
@@ -66,6 +52,7 @@ Please acknowledge this by setting acceptImperativeInstability to true in your c
|
|
|
66
52
|
return this._internal_unstable._internal_unstable.config;
|
|
67
53
|
}
|
|
68
54
|
list(name, { parentID, allLists } = {}) {
|
|
55
|
+
this.validateInstabilityWarning();
|
|
69
56
|
return new import_list.ListCollection({
|
|
70
57
|
cache: this,
|
|
71
58
|
name,
|
|
@@ -73,25 +60,35 @@ Please acknowledge this by setting acceptImperativeInstability to true in your c
|
|
|
73
60
|
allLists
|
|
74
61
|
});
|
|
75
62
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
63
|
+
read({
|
|
64
|
+
query,
|
|
65
|
+
variables
|
|
66
|
+
}) {
|
|
67
|
+
this.validateInstabilityWarning();
|
|
68
|
+
return this._internal_unstable.read({
|
|
69
|
+
selection: query.artifact.selection,
|
|
70
|
+
variables
|
|
71
|
+
});
|
|
84
72
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
73
|
+
write({
|
|
74
|
+
query,
|
|
75
|
+
variables,
|
|
76
|
+
data
|
|
77
|
+
}) {
|
|
78
|
+
this.validateInstabilityWarning();
|
|
79
|
+
this._internal_unstable.write({
|
|
80
|
+
selection: query.artifact.selection,
|
|
81
|
+
data,
|
|
82
|
+
variables: (0, import_lib.marshalInputs)({
|
|
83
|
+
config: this.config,
|
|
84
|
+
artifact: query.artifact,
|
|
85
|
+
input: variables
|
|
86
|
+
}) ?? {}
|
|
87
|
+
});
|
|
88
|
+
return;
|
|
90
89
|
}
|
|
91
|
-
return info;
|
|
92
90
|
}
|
|
93
91
|
// Annotate the CommonJS export names for ESM import in node:
|
|
94
92
|
0 && (module.exports = {
|
|
95
|
-
Cache
|
|
96
|
-
_typeInfo
|
|
93
|
+
Cache
|
|
97
94
|
});
|
|
@@ -21,8 +21,6 @@ __export(list_exports, {
|
|
|
21
21
|
ListCollection: () => ListCollection
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(list_exports);
|
|
24
|
-
var import_config = require("../lib/config");
|
|
25
|
-
var import_cache = require("./cache");
|
|
26
24
|
var import_record = require("./record");
|
|
27
25
|
class ListCollection {
|
|
28
26
|
#parentID;
|
|
@@ -83,7 +81,7 @@ class ListCollection {
|
|
|
83
81
|
return new ListCollection({
|
|
84
82
|
parentID: this.#parentID,
|
|
85
83
|
allLists: this.#allLists,
|
|
86
|
-
when:
|
|
84
|
+
when: filter,
|
|
87
85
|
cache: this.#cache,
|
|
88
86
|
name: this.#name
|
|
89
87
|
});
|
|
@@ -119,36 +117,16 @@ class ListCollection {
|
|
|
119
117
|
}
|
|
120
118
|
}
|
|
121
119
|
#listOperationPayload(records) {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
};
|
|
120
|
+
let selection = this.#collection.selection;
|
|
121
|
+
const connectionSelection = selection.fields?.["edges"]?.selection?.fields?.node.selection;
|
|
122
|
+
if (connectionSelection) {
|
|
123
|
+
selection = connectionSelection;
|
|
124
|
+
}
|
|
128
125
|
const data = [];
|
|
129
126
|
for (const record of records) {
|
|
130
127
|
if (!(record instanceof import_record.Record)) {
|
|
131
128
|
throw new Error("You must provide a Record to a list operation");
|
|
132
129
|
}
|
|
133
|
-
const keys = (0, import_config.keyFieldsForType)(this.#cache.config, record.type);
|
|
134
|
-
selection.abstractFields.fields[record.type] = keys.reduce(
|
|
135
|
-
(acc, key) => {
|
|
136
|
-
const keyInfo = (0, import_cache._typeInfo)(this.#cache, record.type, key);
|
|
137
|
-
return {
|
|
138
|
-
...acc,
|
|
139
|
-
[key]: {
|
|
140
|
-
type: keyInfo.type,
|
|
141
|
-
keyRaw: key
|
|
142
|
-
}
|
|
143
|
-
};
|
|
144
|
-
},
|
|
145
|
-
{
|
|
146
|
-
__typename: {
|
|
147
|
-
type: "String",
|
|
148
|
-
keyRaw: "__typename"
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
);
|
|
152
130
|
data.push({ __typename: record.type, ...record.idFields });
|
|
153
131
|
}
|
|
154
132
|
return {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import type { FragmentArtifact } from '../lib/types';
|
|
1
2
|
import type { Cache } from './cache';
|
|
2
|
-
import type {
|
|
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[];
|