houdini 1.0.0-next.9 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -1
- package/build/cmd-cjs/index.js +2281 -105
- package/build/cmd-esm/index.js +2281 -105
- package/build/codegen/generators/runtime/runtimeConfig.d.ts +7 -0
- package/build/codegen/utils/flattenSelections.d.ts +1 -1
- package/build/codegen-cjs/index.js +2876 -674
- package/build/codegen-esm/index.js +2876 -674
- package/build/lib/config.d.ts +4 -6
- package/build/lib/types.d.ts +18 -15
- package/build/lib-cjs/index.js +3159 -171
- package/build/lib-esm/index.js +3152 -171
- package/build/runtime/cache/storage.d.ts +18 -15
- package/build/runtime/client/documentStore.d.ts +15 -13
- package/build/runtime/client/utils/documentPlugins.d.ts +2 -2
- package/build/runtime/imports/pluginConfig.d.ts +3 -0
- package/build/runtime/lib/config.d.ts +2 -2
- package/build/runtime/lib/scalars.d.ts +1 -1
- package/build/runtime/lib/types.d.ts +41 -42
- package/build/runtime-cjs/cache/storage.d.ts +18 -15
- package/build/runtime-cjs/cache/storage.js +9 -11
- package/build/runtime-cjs/client/documentStore.d.ts +15 -13
- package/build/runtime-cjs/client/documentStore.js +10 -7
- package/build/runtime-cjs/client/index.js +3 -0
- package/build/runtime-cjs/client/plugins/cache.js +3 -3
- package/build/runtime-cjs/client/plugins/fetch.js +2 -2
- package/build/runtime-cjs/client/plugins/query.js +1 -1
- package/build/runtime-cjs/client/plugins/subscription.js +2 -2
- package/build/runtime-cjs/client/utils/documentPlugins.d.ts +2 -2
- package/build/runtime-cjs/imports/pluginConfig.d.ts +3 -0
- package/build/runtime-cjs/imports/pluginConfig.js +27 -0
- package/build/runtime-cjs/lib/config.d.ts +2 -2
- package/build/runtime-cjs/lib/config.js +11 -1
- package/build/runtime-cjs/lib/scalars.d.ts +1 -1
- package/build/runtime-cjs/lib/scalars.js +13 -2
- package/build/runtime-cjs/lib/types.d.ts +41 -42
- package/build/runtime-cjs/lib/types.js +26 -30
- package/build/runtime-esm/cache/storage.d.ts +18 -15
- package/build/runtime-esm/cache/storage.js +9 -11
- package/build/runtime-esm/client/documentStore.d.ts +15 -13
- package/build/runtime-esm/client/documentStore.js +10 -7
- package/build/runtime-esm/client/index.js +5 -2
- package/build/runtime-esm/client/plugins/cache.js +3 -3
- package/build/runtime-esm/client/plugins/fetch.js +2 -2
- package/build/runtime-esm/client/plugins/query.js +1 -1
- package/build/runtime-esm/client/plugins/subscription.js +2 -2
- package/build/runtime-esm/client/utils/documentPlugins.d.ts +2 -2
- package/build/runtime-esm/imports/pluginConfig.d.ts +3 -0
- package/build/runtime-esm/imports/pluginConfig.js +5 -0
- package/build/runtime-esm/lib/config.d.ts +2 -2
- package/build/runtime-esm/lib/config.js +11 -1
- package/build/runtime-esm/lib/scalars.d.ts +1 -1
- package/build/runtime-esm/lib/scalars.js +13 -2
- package/build/runtime-esm/lib/types.d.ts +41 -42
- package/build/runtime-esm/lib/types.js +26 -30
- package/build/test-cjs/index.js +2258 -82
- package/build/test-esm/index.js +2258 -82
- package/build/vite/houdini.d.ts +2 -0
- package/build/vite-cjs/index.js +2284 -106
- package/build/vite-esm/index.js +2284 -106
- package/package.json +2 -2
|
@@ -118,6 +118,9 @@ function isScalar(config, type) {
|
|
|
118
118
|
return ["String", "Boolean", "Float", "ID", "Int"].concat(Object.keys(config.scalars || {})).includes(type);
|
|
119
119
|
}
|
|
120
120
|
function parseScalar(config, type, value) {
|
|
121
|
+
if (typeof value === "undefined") {
|
|
122
|
+
return void 0;
|
|
123
|
+
}
|
|
121
124
|
if (type === "Boolean") {
|
|
122
125
|
return value === "true";
|
|
123
126
|
}
|
|
@@ -128,10 +131,18 @@ function parseScalar(config, type, value) {
|
|
|
128
131
|
return value;
|
|
129
132
|
}
|
|
130
133
|
if (type === "Int") {
|
|
131
|
-
|
|
134
|
+
const result = parseInt(value, 10);
|
|
135
|
+
if (Number.isNaN(result)) {
|
|
136
|
+
return void 0;
|
|
137
|
+
}
|
|
138
|
+
return result;
|
|
132
139
|
}
|
|
133
140
|
if (type === "Float") {
|
|
134
|
-
|
|
141
|
+
const result = parseFloat(value);
|
|
142
|
+
if (Number.isNaN(result)) {
|
|
143
|
+
return void 0;
|
|
144
|
+
}
|
|
145
|
+
return result;
|
|
135
146
|
}
|
|
136
147
|
if (config.scalars?.[type]?.marshal) {
|
|
137
148
|
return config.scalars[type]?.marshal(value);
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
export declare
|
|
2
|
-
CacheOrNetwork
|
|
3
|
-
CacheOnly
|
|
4
|
-
NetworkOnly
|
|
5
|
-
CacheAndNetwork
|
|
6
|
-
}
|
|
1
|
+
export declare const CachePolicy: {
|
|
2
|
+
readonly CacheOrNetwork: "CacheOrNetwork";
|
|
3
|
+
readonly CacheOnly: "CacheOnly";
|
|
4
|
+
readonly NetworkOnly: "NetworkOnly";
|
|
5
|
+
readonly CacheAndNetwork: "CacheAndNetwork";
|
|
6
|
+
};
|
|
7
|
+
type ValuesOf<Target> = Target[keyof Target];
|
|
8
|
+
export type CachePolicies = ValuesOf<typeof CachePolicy>;
|
|
7
9
|
declare global {
|
|
8
10
|
namespace App {
|
|
9
11
|
interface Session {
|
|
@@ -29,42 +31,38 @@ export type Operation<_Result, _Input> = {
|
|
|
29
31
|
};
|
|
30
32
|
export type Maybe<T> = T | null | undefined;
|
|
31
33
|
export type DocumentArtifact = FragmentArtifact | QueryArtifact | MutationArtifact | SubscriptionArtifact;
|
|
32
|
-
export declare
|
|
33
|
-
Query
|
|
34
|
-
Subscription
|
|
35
|
-
Mutation
|
|
36
|
-
Fragment
|
|
37
|
-
}
|
|
38
|
-
export
|
|
39
|
-
export declare const
|
|
40
|
-
export declare const
|
|
41
|
-
export declare const
|
|
42
|
-
export
|
|
43
|
-
export type
|
|
44
|
-
|
|
45
|
-
policy?:
|
|
34
|
+
export declare const ArtifactKind: {
|
|
35
|
+
readonly Query: "HoudiniQuery";
|
|
36
|
+
readonly Subscription: "HoudiniSubscription";
|
|
37
|
+
readonly Mutation: "HoudiniMutation";
|
|
38
|
+
readonly Fragment: "HoudiniFragment";
|
|
39
|
+
};
|
|
40
|
+
export type ArtifactKinds = ValuesOf<typeof ArtifactKind>;
|
|
41
|
+
export declare const CompiledFragmentKind: "HoudiniFragment";
|
|
42
|
+
export declare const CompiledMutationKind: "HoudiniMutation";
|
|
43
|
+
export declare const CompiledQueryKind: "HoudiniQuery";
|
|
44
|
+
export declare const CompiledSubscriptionKind: "HoudiniSubscription";
|
|
45
|
+
export type CompiledDocumentKind = ArtifactKinds;
|
|
46
|
+
export type QueryArtifact = BaseCompiledDocument<'HoudiniQuery'> & {
|
|
47
|
+
policy?: CachePolicies;
|
|
46
48
|
partial?: boolean;
|
|
47
49
|
};
|
|
48
|
-
export type MutationArtifact = BaseCompiledDocument
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
export
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
kind: ArtifactKind.Subscription;
|
|
50
|
+
export type MutationArtifact = BaseCompiledDocument<'HoudiniMutation'>;
|
|
51
|
+
export type FragmentArtifact = BaseCompiledDocument<'HoudiniFragment'>;
|
|
52
|
+
export type SubscriptionArtifact = BaseCompiledDocument<'HoudiniSubscription'>;
|
|
53
|
+
export declare const RefetchUpdateMode: {
|
|
54
|
+
readonly append: "append";
|
|
55
|
+
readonly prepend: "prepend";
|
|
56
|
+
readonly replace: "replace";
|
|
56
57
|
};
|
|
57
|
-
export
|
|
58
|
-
append = "append",
|
|
59
|
-
prepend = "prepend",
|
|
60
|
-
replace = "replace"
|
|
61
|
-
}
|
|
58
|
+
export type RefetchUpdateModes = ValuesOf<typeof RefetchUpdateMode>;
|
|
62
59
|
export type InputObject = {
|
|
63
60
|
fields: Record<string, string>;
|
|
64
61
|
types: Record<string, Record<string, string>>;
|
|
65
62
|
};
|
|
66
|
-
export type BaseCompiledDocument = {
|
|
63
|
+
export type BaseCompiledDocument<_Kind extends ArtifactKinds> = {
|
|
67
64
|
name: string;
|
|
65
|
+
kind: _Kind;
|
|
68
66
|
raw: string;
|
|
69
67
|
hash: string;
|
|
70
68
|
selection: SubscriptionSelection;
|
|
@@ -80,7 +78,7 @@ export type BaseCompiledDocument = {
|
|
|
80
78
|
paginated: boolean;
|
|
81
79
|
direction: 'forward' | 'backward' | 'both';
|
|
82
80
|
};
|
|
83
|
-
|
|
81
|
+
pluginData?: Record<string, any>;
|
|
84
82
|
};
|
|
85
83
|
export type HoudiniFetchContext = {
|
|
86
84
|
variables: () => {};
|
|
@@ -92,20 +90,21 @@ export type ListWhen = {
|
|
|
92
90
|
must?: Filter;
|
|
93
91
|
must_not?: Filter;
|
|
94
92
|
};
|
|
95
|
-
export declare
|
|
93
|
+
export declare const DataSource: {
|
|
96
94
|
/**
|
|
97
95
|
* from the browser cache
|
|
98
96
|
*/
|
|
99
|
-
Cache
|
|
97
|
+
readonly Cache: "cache";
|
|
100
98
|
/**
|
|
101
99
|
* from a browser side `fetch`
|
|
102
100
|
*/
|
|
103
|
-
Network
|
|
101
|
+
readonly Network: "network";
|
|
104
102
|
/**
|
|
105
103
|
* from a server side `fetch`
|
|
106
104
|
*/
|
|
107
|
-
Ssr
|
|
108
|
-
}
|
|
105
|
+
readonly Ssr: "ssr";
|
|
106
|
+
};
|
|
107
|
+
export type DataSources = ValuesOf<typeof DataSource>;
|
|
109
108
|
export type MutationOperation = {
|
|
110
109
|
action: 'insert' | 'remove' | 'delete' | 'toggle';
|
|
111
110
|
list?: string;
|
|
@@ -163,7 +162,7 @@ export type SubscriptionSpec = {
|
|
|
163
162
|
};
|
|
164
163
|
export type FetchQueryResult<_Data> = {
|
|
165
164
|
result: RequestPayload<_Data | null>;
|
|
166
|
-
source:
|
|
165
|
+
source: DataSources | null;
|
|
167
166
|
};
|
|
168
167
|
export type QueryResult<_Data = GraphQLObject, _Input = Record<string, any>> = {
|
|
169
168
|
data: _Data | null;
|
|
@@ -173,7 +172,7 @@ export type QueryResult<_Data = GraphQLObject, _Input = Record<string, any>> = {
|
|
|
173
172
|
fetching: boolean;
|
|
174
173
|
partial: boolean;
|
|
175
174
|
stale: boolean;
|
|
176
|
-
source:
|
|
175
|
+
source: DataSources | null;
|
|
177
176
|
variables: _Input | null;
|
|
178
177
|
};
|
|
179
178
|
export type RequestPayload<GraphQLObject = any> = {
|
|
@@ -1,33 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
DataSource2["Network"] = "network";
|
|
28
|
-
DataSource2["Ssr"] = "ssr";
|
|
29
|
-
return DataSource2;
|
|
30
|
-
})(DataSource || {});
|
|
1
|
+
const CachePolicy = {
|
|
2
|
+
CacheOrNetwork: "CacheOrNetwork",
|
|
3
|
+
CacheOnly: "CacheOnly",
|
|
4
|
+
NetworkOnly: "NetworkOnly",
|
|
5
|
+
CacheAndNetwork: "CacheAndNetwork"
|
|
6
|
+
};
|
|
7
|
+
const ArtifactKind = {
|
|
8
|
+
Query: "HoudiniQuery",
|
|
9
|
+
Subscription: "HoudiniSubscription",
|
|
10
|
+
Mutation: "HoudiniMutation",
|
|
11
|
+
Fragment: "HoudiniFragment"
|
|
12
|
+
};
|
|
13
|
+
const CompiledFragmentKind = ArtifactKind.Fragment;
|
|
14
|
+
const CompiledMutationKind = ArtifactKind.Mutation;
|
|
15
|
+
const CompiledQueryKind = ArtifactKind.Query;
|
|
16
|
+
const CompiledSubscriptionKind = ArtifactKind.Subscription;
|
|
17
|
+
const RefetchUpdateMode = {
|
|
18
|
+
append: "append",
|
|
19
|
+
prepend: "prepend",
|
|
20
|
+
replace: "replace"
|
|
21
|
+
};
|
|
22
|
+
const DataSource = {
|
|
23
|
+
Cache: "cache",
|
|
24
|
+
Network: "network",
|
|
25
|
+
Ssr: "ssr"
|
|
26
|
+
};
|
|
31
27
|
export {
|
|
32
28
|
ArtifactKind,
|
|
33
29
|
CachePolicy,
|