houdini 1.0.0-next.18 → 1.0.0-next.19
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 +55 -39
- package/build/cmd-esm/index.js +55 -39
- package/build/codegen-cjs/index.js +52 -27
- package/build/codegen-esm/index.js +52 -27
- package/build/lib/config.d.ts +4 -6
- package/build/lib/types.d.ts +11 -10
- package/build/lib-cjs/index.js +35 -40
- package/build/lib-esm/index.js +35 -40
- package/build/runtime/cache/storage.d.ts +18 -15
- package/build/runtime/client/documentStore.d.ts +3 -3
- package/build/runtime/client/utils/documentPlugins.d.ts +2 -2
- package/build/runtime/lib/config.d.ts +2 -2
- package/build/runtime/lib/types.d.ts +40 -41
- 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 +3 -3
- package/build/runtime-cjs/client/utils/documentPlugins.d.ts +2 -2
- package/build/runtime-cjs/lib/config.d.ts +2 -2
- package/build/runtime-cjs/lib/types.d.ts +40 -41
- 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 +3 -3
- package/build/runtime-esm/client/utils/documentPlugins.d.ts +2 -2
- package/build/runtime-esm/lib/config.d.ts +2 -2
- package/build/runtime-esm/lib/types.d.ts +40 -41
- package/build/runtime-esm/lib/types.js +26 -30
- package/build/test-cjs/index.js +55 -33
- package/build/test-esm/index.js +55 -33
- package/build/vite-cjs/index.js +53 -37
- package/build/vite-esm/index.js +53 -37
- package/package.json +1 -1
|
@@ -28,36 +28,32 @@ __export(types_exports, {
|
|
|
28
28
|
RefetchUpdateMode: () => RefetchUpdateMode
|
|
29
29
|
});
|
|
30
30
|
module.exports = __toCommonJS(types_exports);
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
const
|
|
46
|
-
const
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
DataSource2["Network"] = "network";
|
|
58
|
-
DataSource2["Ssr"] = "ssr";
|
|
59
|
-
return DataSource2;
|
|
60
|
-
})(DataSource || {});
|
|
31
|
+
const CachePolicy = {
|
|
32
|
+
CacheOrNetwork: "CacheOrNetwork",
|
|
33
|
+
CacheOnly: "CacheOnly",
|
|
34
|
+
NetworkOnly: "NetworkOnly",
|
|
35
|
+
CacheAndNetwork: "CacheAndNetwork"
|
|
36
|
+
};
|
|
37
|
+
const ArtifactKind = {
|
|
38
|
+
Query: "HoudiniQuery",
|
|
39
|
+
Subscription: "HoudiniSubscription",
|
|
40
|
+
Mutation: "HoudiniMutation",
|
|
41
|
+
Fragment: "HoudiniFragment"
|
|
42
|
+
};
|
|
43
|
+
const CompiledFragmentKind = ArtifactKind.Fragment;
|
|
44
|
+
const CompiledMutationKind = ArtifactKind.Mutation;
|
|
45
|
+
const CompiledQueryKind = ArtifactKind.Query;
|
|
46
|
+
const CompiledSubscriptionKind = ArtifactKind.Subscription;
|
|
47
|
+
const RefetchUpdateMode = {
|
|
48
|
+
append: "append",
|
|
49
|
+
prepend: "prepend",
|
|
50
|
+
replace: "replace"
|
|
51
|
+
};
|
|
52
|
+
const DataSource = {
|
|
53
|
+
Cache: "cache",
|
|
54
|
+
Network: "network",
|
|
55
|
+
Ssr: "ssr"
|
|
56
|
+
};
|
|
61
57
|
// Annotate the CommonJS export names for ESM import in node:
|
|
62
58
|
0 && (module.exports = {
|
|
63
59
|
ArtifactKind,
|
|
@@ -7,7 +7,7 @@ export declare class InMemoryStorage {
|
|
|
7
7
|
get layerCount(): number;
|
|
8
8
|
get nextRank(): number;
|
|
9
9
|
createLayer(optimistic?: boolean): Layer;
|
|
10
|
-
insert(id: string, field: string, location:
|
|
10
|
+
insert(id: string, field: string, location: OperationLocations, target: string): void;
|
|
11
11
|
remove(id: string, field: string, target: string): void;
|
|
12
12
|
delete(id: string): void;
|
|
13
13
|
deleteField(id: string, field: string): void;
|
|
@@ -47,7 +47,7 @@ export declare class Layer {
|
|
|
47
47
|
removeUndefinedFields(): void;
|
|
48
48
|
delete(id: string): void;
|
|
49
49
|
deleteField(id: string, field: string): void;
|
|
50
|
-
insert(id: string, field: string, where:
|
|
50
|
+
insert(id: string, field: string, where: OperationLocations, target: string): void;
|
|
51
51
|
remove(id: string, field: string, target: string): void;
|
|
52
52
|
writeLayer(layer: Layer): void;
|
|
53
53
|
private addFieldOperation;
|
|
@@ -71,28 +71,31 @@ type OperationMap = {
|
|
|
71
71
|
};
|
|
72
72
|
type NestedList<_Result = string> = (_Result | null | NestedList<_Result>)[];
|
|
73
73
|
type InsertOperation = {
|
|
74
|
-
kind:
|
|
75
|
-
location:
|
|
74
|
+
kind: 'insert';
|
|
75
|
+
location: OperationLocations;
|
|
76
76
|
id: string;
|
|
77
77
|
};
|
|
78
78
|
type RemoveOperation = {
|
|
79
|
-
kind:
|
|
79
|
+
kind: 'remove';
|
|
80
80
|
id: string;
|
|
81
81
|
};
|
|
82
82
|
type DeleteOperation = {
|
|
83
|
-
kind:
|
|
83
|
+
kind: 'delete';
|
|
84
84
|
target: string;
|
|
85
85
|
};
|
|
86
86
|
type ListOperation = InsertOperation | RemoveOperation;
|
|
87
87
|
type Operation = ListOperation | DeleteOperation;
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
88
|
+
type ValuesOf<Target> = Target[keyof Target];
|
|
89
|
+
export declare const OperationLocation: {
|
|
90
|
+
readonly start: "start";
|
|
91
|
+
readonly end: "end";
|
|
92
|
+
};
|
|
93
|
+
export type OperationLocations = ValuesOf<typeof OperationLocation>;
|
|
94
|
+
export declare const OperationKind: {
|
|
95
|
+
readonly delete: "delete";
|
|
96
|
+
readonly insert: "insert";
|
|
97
|
+
readonly remove: "remove";
|
|
98
|
+
};
|
|
99
|
+
export type OperationKinds = ValuesOf<typeof OperationKind>;
|
|
97
100
|
export type LayerID = number;
|
|
98
101
|
export {};
|
|
@@ -350,17 +350,15 @@ function isInsertOperation(value) {
|
|
|
350
350
|
function isRemoveOperation(value) {
|
|
351
351
|
return !!value && value.kind === OperationKind.remove;
|
|
352
352
|
}
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
return OperationKind2;
|
|
363
|
-
})(OperationKind || {});
|
|
353
|
+
const OperationLocation = {
|
|
354
|
+
start: "start",
|
|
355
|
+
end: "end"
|
|
356
|
+
};
|
|
357
|
+
const OperationKind = {
|
|
358
|
+
delete: "delete",
|
|
359
|
+
insert: "insert",
|
|
360
|
+
remove: "remove"
|
|
361
|
+
};
|
|
364
362
|
export {
|
|
365
363
|
InMemoryStorage,
|
|
366
364
|
Layer,
|
|
@@ -2,7 +2,7 @@ import type { HoudiniClient } from '.';
|
|
|
2
2
|
import type { Layer } from '../cache/storage';
|
|
3
3
|
import type { ConfigFile } from '../lib/config';
|
|
4
4
|
import { Writable } from '../lib/store';
|
|
5
|
-
import type {
|
|
5
|
+
import type { DocumentArtifact, QueryResult, GraphQLObject, SubscriptionSpec, CachePolicies } from '../lib/types';
|
|
6
6
|
export declare class DocumentStore<_Data extends GraphQLObject, _Input extends Record<string, any>> extends Writable<QueryResult<_Data, _Input>> {
|
|
7
7
|
#private;
|
|
8
8
|
constructor({ artifact, plugins, pipeline, client, cache, initialValue, fetching, }: {
|
|
@@ -33,7 +33,7 @@ export type ClientPluginContext = {
|
|
|
33
33
|
text: string;
|
|
34
34
|
hash: string;
|
|
35
35
|
artifact: DocumentArtifact;
|
|
36
|
-
policy?:
|
|
36
|
+
policy?: CachePolicies;
|
|
37
37
|
fetch?: Fetch;
|
|
38
38
|
variables?: Record<string, any>;
|
|
39
39
|
metadata?: App.Metadata | null;
|
|
@@ -81,7 +81,7 @@ export type SendParams = {
|
|
|
81
81
|
variables?: Record<string, any> | null;
|
|
82
82
|
metadata?: App.Metadata | null;
|
|
83
83
|
session?: App.Session | null;
|
|
84
|
-
policy?:
|
|
84
|
+
policy?: CachePolicies;
|
|
85
85
|
stuff?: Partial<App.Stuff>;
|
|
86
86
|
cacheParams?: ClientPluginContext['cacheParams'];
|
|
87
87
|
setup?: boolean;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ArtifactKinds } from '../../lib/types';
|
|
2
2
|
import type { ClientPlugin, ClientHooks } from '../documentStore';
|
|
3
|
-
export declare const documentPlugin: (kind:
|
|
3
|
+
export declare const documentPlugin: (kind: ArtifactKinds, source: () => ClientHooks) => ClientPlugin;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { GraphQLSchema } from 'graphql';
|
|
2
|
-
import type {
|
|
2
|
+
import type { CachePolicies } 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;
|
|
@@ -50,7 +50,7 @@ export type ConfigFile = {
|
|
|
50
50
|
/**
|
|
51
51
|
* The default cache policy to use for queries. For more information: https://www.houdinigraphql.com/guides/caching-data
|
|
52
52
|
*/
|
|
53
|
-
defaultCachePolicy?:
|
|
53
|
+
defaultCachePolicy?: CachePolicies;
|
|
54
54
|
/**
|
|
55
55
|
* Specifies whether or not the cache should always use partial data. For more information: https://www.houdinigraphql.com/guides/caching-data#partial-data
|
|
56
56
|
*/
|
|
@@ -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;
|
|
@@ -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,
|
package/build/test-cjs/index.js
CHANGED
|
@@ -54089,6 +54089,29 @@ function computeID(configFile, type, data) {
|
|
|
54089
54089
|
return id.slice(0, -2);
|
|
54090
54090
|
}
|
|
54091
54091
|
|
|
54092
|
+
// src/runtime/lib/types.ts
|
|
54093
|
+
var CachePolicy = {
|
|
54094
|
+
CacheOrNetwork: "CacheOrNetwork",
|
|
54095
|
+
CacheOnly: "CacheOnly",
|
|
54096
|
+
NetworkOnly: "NetworkOnly",
|
|
54097
|
+
CacheAndNetwork: "CacheAndNetwork"
|
|
54098
|
+
};
|
|
54099
|
+
var ArtifactKind = {
|
|
54100
|
+
Query: "HoudiniQuery",
|
|
54101
|
+
Subscription: "HoudiniSubscription",
|
|
54102
|
+
Mutation: "HoudiniMutation",
|
|
54103
|
+
Fragment: "HoudiniFragment"
|
|
54104
|
+
};
|
|
54105
|
+
var CompiledFragmentKind = ArtifactKind.Fragment;
|
|
54106
|
+
var CompiledMutationKind = ArtifactKind.Mutation;
|
|
54107
|
+
var CompiledQueryKind = ArtifactKind.Query;
|
|
54108
|
+
var CompiledSubscriptionKind = ArtifactKind.Subscription;
|
|
54109
|
+
var RefetchUpdateMode = {
|
|
54110
|
+
append: "append",
|
|
54111
|
+
prepend: "prepend",
|
|
54112
|
+
replace: "replace"
|
|
54113
|
+
};
|
|
54114
|
+
|
|
54092
54115
|
// src/lib/constants.ts
|
|
54093
54116
|
var siteURL = "https://houdinigraphql.com";
|
|
54094
54117
|
var houdini_mode = {
|
|
@@ -54411,13 +54434,12 @@ async function glob(pattern) {
|
|
|
54411
54434
|
glob.hasMagic = import_glob.glob.hasMagic;
|
|
54412
54435
|
|
|
54413
54436
|
// src/lib/types.ts
|
|
54414
|
-
var LogLevel =
|
|
54415
|
-
|
|
54416
|
-
|
|
54417
|
-
|
|
54418
|
-
|
|
54419
|
-
|
|
54420
|
-
})(LogLevel || {});
|
|
54437
|
+
var LogLevel = {
|
|
54438
|
+
Full: "full",
|
|
54439
|
+
Summary: "summary",
|
|
54440
|
+
ShortSummary: "short-summary",
|
|
54441
|
+
Quiet: "quiet"
|
|
54442
|
+
};
|
|
54421
54443
|
|
|
54422
54444
|
// src/lib/config.ts
|
|
54423
54445
|
var import_meta = {};
|
|
@@ -54469,7 +54491,7 @@ var Config = class {
|
|
|
54469
54491
|
scalars,
|
|
54470
54492
|
cacheBufferSize,
|
|
54471
54493
|
definitionsPath,
|
|
54472
|
-
defaultCachePolicy =
|
|
54494
|
+
defaultCachePolicy = CachePolicy.CacheOrNetwork,
|
|
54473
54495
|
defaultPartial = false,
|
|
54474
54496
|
defaultListPosition = "append",
|
|
54475
54497
|
defaultListTarget = null,
|
|
@@ -54491,7 +54513,7 @@ var Config = class {
|
|
|
54491
54513
|
Object.values(LogLevel)
|
|
54492
54514
|
)}`
|
|
54493
54515
|
);
|
|
54494
|
-
logLevel =
|
|
54516
|
+
logLevel = LogLevel.Summary;
|
|
54495
54517
|
}
|
|
54496
54518
|
this.schemaPath = schemaPath;
|
|
54497
54519
|
this.filepath = filepath;
|
|
@@ -54507,7 +54529,7 @@ var Config = class {
|
|
|
54507
54529
|
this.internalListPosition = defaultListPosition === "append" ? "last" : "first";
|
|
54508
54530
|
this.defaultListTarget = defaultListTarget;
|
|
54509
54531
|
this.definitionsFolder = definitionsPath;
|
|
54510
|
-
this.logLevel = (logLevel ||
|
|
54532
|
+
this.logLevel = (logLevel || LogLevel.Summary).toLowerCase();
|
|
54511
54533
|
this.defaultFragmentMasking = defaultFragmentMasking;
|
|
54512
54534
|
this.routesDir = join(this.projectRoot, "src", "routes");
|
|
54513
54535
|
this.schemaPollInterval = watchSchema?.interval ?? 2e3;
|
|
@@ -55506,7 +55528,7 @@ async function fragmentVariables(config2, documents) {
|
|
|
55506
55528
|
};
|
|
55507
55529
|
documents.push({
|
|
55508
55530
|
name: "generated::fragmentVariables",
|
|
55509
|
-
kind:
|
|
55531
|
+
kind: ArtifactKind.Fragment,
|
|
55510
55532
|
document: doc,
|
|
55511
55533
|
originalParsed: doc,
|
|
55512
55534
|
generateStore: false,
|
|
@@ -56427,7 +56449,7 @@ async function paginate(config2, documents) {
|
|
|
56427
56449
|
]
|
|
56428
56450
|
};
|
|
56429
56451
|
newDocs.push({
|
|
56430
|
-
kind:
|
|
56452
|
+
kind: ArtifactKind.Query,
|
|
56431
56453
|
filename: doc.filename,
|
|
56432
56454
|
name: refetchQueryName,
|
|
56433
56455
|
document: queryDoc,
|
|
@@ -56847,7 +56869,7 @@ async function addListFragments(config2, documents) {
|
|
|
56847
56869
|
config2.newDocuments += "\n" + generatedDoc.definitions.filter((c) => c.kind === "FragmentDefinition").map(graphql9.print).join("\n\n");
|
|
56848
56870
|
documents.push({
|
|
56849
56871
|
name: "generated::lists",
|
|
56850
|
-
kind:
|
|
56872
|
+
kind: ArtifactKind.Fragment,
|
|
56851
56873
|
generateArtifact: false,
|
|
56852
56874
|
generateStore: false,
|
|
56853
56875
|
document: generatedDoc,
|
|
@@ -57114,7 +57136,7 @@ function selection({
|
|
|
57114
57136
|
(directive) => directive.name.value === config2.paginateDirective
|
|
57115
57137
|
);
|
|
57116
57138
|
if (paginated && document.refetch && document.refetch.method === "offset") {
|
|
57117
|
-
fieldObj.updates = [
|
|
57139
|
+
fieldObj.updates = [RefetchUpdateMode.append];
|
|
57118
57140
|
}
|
|
57119
57141
|
let continueConnection = inConnection;
|
|
57120
57142
|
if ([
|
|
@@ -57124,7 +57146,7 @@ function selection({
|
|
|
57124
57146
|
"hasNextPage",
|
|
57125
57147
|
"hasPreviousPage"
|
|
57126
57148
|
].includes(attributeName) && inConnection && document.refetch) {
|
|
57127
|
-
fieldObj.updates = [
|
|
57149
|
+
fieldObj.updates = [RefetchUpdateMode.append, RefetchUpdateMode.prepend];
|
|
57128
57150
|
}
|
|
57129
57151
|
if (attributeName === "node" && inConnection) {
|
|
57130
57152
|
continueConnection = false;
|
|
@@ -57303,7 +57325,7 @@ function artifactGenerator(stats) {
|
|
|
57303
57325
|
);
|
|
57304
57326
|
let rootType = "";
|
|
57305
57327
|
let selectionSet;
|
|
57306
|
-
if (docKind !==
|
|
57328
|
+
if (docKind !== ArtifactKind.Fragment) {
|
|
57307
57329
|
const operation = operations[0];
|
|
57308
57330
|
if (operation.operation === "query") {
|
|
57309
57331
|
rootType = config2.schema.getQueryType()?.name;
|
|
@@ -57336,7 +57358,7 @@ function artifactGenerator(stats) {
|
|
|
57336
57358
|
let directive = fragments[0]?.directives?.find(
|
|
57337
57359
|
(directive2) => directive2.name.value === config2.argumentsDirective
|
|
57338
57360
|
);
|
|
57339
|
-
if (docKind ===
|
|
57361
|
+
if (docKind === ArtifactKind.Fragment && directive) {
|
|
57340
57362
|
inputs = fragmentArgumentsDefinitions(config2, doc.filename, fragments[0]);
|
|
57341
57363
|
}
|
|
57342
57364
|
const mergedSelection = flattenSelections({
|
|
@@ -57384,7 +57406,7 @@ function artifactGenerator(stats) {
|
|
|
57384
57406
|
}
|
|
57385
57407
|
const result = { ...prev };
|
|
57386
57408
|
const dataToAdd = plugin2.artifactData({ config: config2, document: doc }) ?? {};
|
|
57387
|
-
if (Object.keys(dataToAdd)
|
|
57409
|
+
if (Object.keys(dataToAdd)) {
|
|
57388
57410
|
result[plugin2.name] = dataToAdd;
|
|
57389
57411
|
}
|
|
57390
57412
|
return result;
|
|
@@ -58633,7 +58655,7 @@ function listDefinitions(config2, body, docs) {
|
|
|
58633
58655
|
function queryDefinitions(config2, body, docs, returnType) {
|
|
58634
58656
|
return AST12.tsTupleType(
|
|
58635
58657
|
docs.reduce((prev, doc) => {
|
|
58636
|
-
if (doc.kind !==
|
|
58658
|
+
if (doc.kind !== ArtifactKind.Query || !doc.generateStore) {
|
|
58637
58659
|
return prev;
|
|
58638
58660
|
}
|
|
58639
58661
|
const definition = doc.document.definitions.find(
|
|
@@ -58664,7 +58686,7 @@ function queryDefinitions(config2, body, docs, returnType) {
|
|
|
58664
58686
|
}
|
|
58665
58687
|
function fragmentListMap(config2, concreteTypes, body, docs, return_type) {
|
|
58666
58688
|
return docs.reduce((prev, doc) => {
|
|
58667
|
-
if (doc.kind !==
|
|
58689
|
+
if (doc.kind !== ArtifactKind.Fragment) {
|
|
58668
58690
|
return prev;
|
|
58669
58691
|
}
|
|
58670
58692
|
const definition = doc.document.definitions.find(
|
|
@@ -58875,10 +58897,10 @@ var graphql20 = __toESM(require_graphql2(), 1);
|
|
|
58875
58897
|
async function graphqlExtensions(config2, documents) {
|
|
58876
58898
|
let internalSchema = `
|
|
58877
58899
|
enum CachePolicy {
|
|
58878
|
-
${
|
|
58879
|
-
${
|
|
58880
|
-
${
|
|
58881
|
-
${
|
|
58900
|
+
${CachePolicy.CacheAndNetwork}
|
|
58901
|
+
${CachePolicy.CacheOnly}
|
|
58902
|
+
${CachePolicy.CacheOrNetwork}
|
|
58903
|
+
${CachePolicy.NetworkOnly}
|
|
58882
58904
|
}
|
|
58883
58905
|
|
|
58884
58906
|
"""
|
|
@@ -59794,7 +59816,7 @@ function getAndVerifyNodeInterface(config2) {
|
|
|
59794
59816
|
var nbInvalidNodeFieldMessageDisplayed = 0;
|
|
59795
59817
|
function displayInvalidNodeFieldMessage(logLevel) {
|
|
59796
59818
|
if (nbInvalidNodeFieldMessageDisplayed === 0) {
|
|
59797
|
-
if (logLevel ===
|
|
59819
|
+
if (logLevel === LogLevel.Full) {
|
|
59798
59820
|
console.warn(invalidNodeFieldMessage);
|
|
59799
59821
|
} else {
|
|
59800
59822
|
console.warn(invalidNodeFieldMessageLight);
|
|
@@ -59958,7 +59980,7 @@ async function runPipeline2(config2, docs) {
|
|
|
59958
59980
|
}
|
|
59959
59981
|
const unchanged = artifactStats.total.length - artifactStats.changed.length - artifactStats.new.length - artifactStats.deleted.length;
|
|
59960
59982
|
const printMessage = !config2.pluginMode || unchanged !== artifactStats.total.length;
|
|
59961
|
-
if (!printMessage || config2.logLevel ===
|
|
59983
|
+
if (!printMessage || config2.logLevel === LogLevel.Quiet) {
|
|
59962
59984
|
if (error) {
|
|
59963
59985
|
throw error;
|
|
59964
59986
|
}
|
|
@@ -59972,14 +59994,14 @@ async function runPipeline2(config2, docs) {
|
|
|
59972
59994
|
}
|
|
59973
59995
|
if (artifactStats.total.length === 0) {
|
|
59974
59996
|
console.log(`\u{1F4A1} No operation found. If that's unexpected, please check your config.`);
|
|
59975
|
-
} else if (
|
|
59997
|
+
} else if (config2.logLevel == LogLevel.Summary || config2.logLevel == LogLevel.ShortSummary) {
|
|
59976
59998
|
if (unchanged > 0 && printMessage && !config2.pluginMode) {
|
|
59977
59999
|
console.log(`\u{1F4C3} Unchanged: ${unchanged}`);
|
|
59978
60000
|
}
|
|
59979
60001
|
logStyled("CREATED", artifactStats.new, config2.logLevel, config2.pluginMode);
|
|
59980
60002
|
logStyled("UPDATED", artifactStats.changed, config2.logLevel, config2.pluginMode);
|
|
59981
60003
|
logStyled("DELETED", artifactStats.deleted, config2.logLevel, config2.pluginMode);
|
|
59982
|
-
} else if (config2.logLevel ===
|
|
60004
|
+
} else if (config2.logLevel === LogLevel.Full) {
|
|
59983
60005
|
for (const artifact of artifactStats.total) {
|
|
59984
60006
|
let emoji = "\u{1F4C3}";
|
|
59985
60007
|
if (artifactStats.changed.includes(artifact)) {
|
|
@@ -60023,7 +60045,7 @@ function logStyled(kind, stat2, logLevel, plugin2) {
|
|
|
60023
60045
|
}
|
|
60024
60046
|
}
|
|
60025
60047
|
console.log(msg.join(""));
|
|
60026
|
-
if (!plugin2 && logLevel ===
|
|
60048
|
+
if (!plugin2 && logLevel === LogLevel.Summary) {
|
|
60027
60049
|
for (const artifact of stat2.slice(0, nbToDisplay)) {
|
|
60028
60050
|
console.log(` ${artifact}`);
|
|
60029
60051
|
}
|
|
@@ -60306,14 +60328,14 @@ function mockCollectedDoc(query) {
|
|
|
60306
60328
|
const parsed = graphql25.parse(query);
|
|
60307
60329
|
const name = parsed.definitions[0].name.value;
|
|
60308
60330
|
const operations = parsed.definitions;
|
|
60309
|
-
let kind =
|
|
60331
|
+
let kind = ArtifactKind.Fragment;
|
|
60310
60332
|
if (operations.length === 1) {
|
|
60311
60333
|
if (operations[0].kind === "OperationDefinition" && operations[0].operation === "query") {
|
|
60312
|
-
kind =
|
|
60334
|
+
kind = ArtifactKind.Query;
|
|
60313
60335
|
} else if (operations[0].kind === "OperationDefinition" && operations[0].operation === "mutation") {
|
|
60314
|
-
kind =
|
|
60336
|
+
kind = ArtifactKind.Mutation;
|
|
60315
60337
|
} else if (operations[0].kind === "OperationDefinition" && operations[0].operation === "subscription") {
|
|
60316
|
-
kind =
|
|
60338
|
+
kind = ArtifactKind.Subscription;
|
|
60317
60339
|
}
|
|
60318
60340
|
}
|
|
60319
60341
|
return {
|