houdini 1.3.0 → 1.4.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/build/cmd-cjs/index.js +64 -25
- package/build/cmd-esm/index.js +64 -25
- package/build/codegen-cjs/index.js +37 -4
- package/build/codegen-esm/index.js +37 -4
- package/build/lib/config.d.ts +1 -0
- package/build/lib/router/types.d.ts +3 -1
- package/build/lib-cjs/index.js +52 -15
- package/build/lib-esm/index.js +51 -15
- package/build/runtime/lib/config.d.ts +10 -1
- package/build/runtime/lib/types.d.ts +14 -2
- package/build/runtime-cjs/client/documentStore.js +27 -7
- package/build/runtime-cjs/client/plugins/fetch.js +5 -0
- package/build/runtime-cjs/lib/config.d.ts +10 -1
- package/build/runtime-cjs/lib/types.d.ts +14 -2
- package/build/runtime-cjs/lib/types.js +7 -0
- package/build/runtime-esm/client/documentStore.js +28 -8
- package/build/runtime-esm/client/plugins/fetch.js +5 -0
- package/build/runtime-esm/lib/config.d.ts +10 -1
- package/build/runtime-esm/lib/types.d.ts +14 -2
- package/build/runtime-esm/lib/types.js +6 -0
- package/build/test-cjs/index.js +43 -9
- package/build/test-esm/index.js +43 -9
- package/build/vite-cjs/index.js +50 -12
- package/build/vite-esm/index.js +50 -12
- package/package.json +3 -3
|
@@ -7,6 +7,12 @@ export declare const CachePolicy: {
|
|
|
7
7
|
readonly NoCache: "NoCache";
|
|
8
8
|
};
|
|
9
9
|
export type CachePolicies = ValuesOf<typeof CachePolicy>;
|
|
10
|
+
export declare const DedupeMatchMode: {
|
|
11
|
+
readonly Variables: "Variables";
|
|
12
|
+
readonly Operation: "Operation";
|
|
13
|
+
readonly None: "None";
|
|
14
|
+
};
|
|
15
|
+
export type DedupeMatchModes = ValuesOf<typeof DedupeMatchMode>;
|
|
10
16
|
export declare const PaginateMode: {
|
|
11
17
|
readonly Infinite: "Infinite";
|
|
12
18
|
readonly SinglePage: "SinglePage";
|
|
@@ -60,11 +66,17 @@ export type QueryArtifact = BaseCompiledDocument<'HoudiniQuery'> & {
|
|
|
60
66
|
policy?: CachePolicies;
|
|
61
67
|
partial?: boolean;
|
|
62
68
|
enableLoadingState?: 'global' | 'local';
|
|
63
|
-
dedupe?:
|
|
69
|
+
dedupe?: {
|
|
70
|
+
cancel: 'first' | 'last';
|
|
71
|
+
match: DedupeMatchModes;
|
|
72
|
+
};
|
|
64
73
|
};
|
|
65
74
|
export type MutationArtifact = BaseCompiledDocument<'HoudiniMutation'> & {
|
|
66
75
|
optimisticKeys?: boolean;
|
|
67
|
-
dedupe?:
|
|
76
|
+
dedupe?: {
|
|
77
|
+
cancel: 'first' | 'last';
|
|
78
|
+
match: DedupeMatchModes;
|
|
79
|
+
};
|
|
68
80
|
};
|
|
69
81
|
export type FragmentArtifact = BaseCompiledDocument<'HoudiniFragment'> & {
|
|
70
82
|
enableLoadingState?: 'global' | 'local';
|
|
@@ -5,6 +5,11 @@ const CachePolicy = {
|
|
|
5
5
|
CacheAndNetwork: "CacheAndNetwork",
|
|
6
6
|
NoCache: "NoCache"
|
|
7
7
|
};
|
|
8
|
+
const DedupeMatchMode = {
|
|
9
|
+
Variables: "Variables",
|
|
10
|
+
Operation: "Operation",
|
|
11
|
+
None: "None"
|
|
12
|
+
};
|
|
8
13
|
const PaginateMode = {
|
|
9
14
|
Infinite: "Infinite",
|
|
10
15
|
SinglePage: "SinglePage"
|
|
@@ -43,6 +48,7 @@ export {
|
|
|
43
48
|
CompiledQueryKind,
|
|
44
49
|
CompiledSubscriptionKind,
|
|
45
50
|
DataSource,
|
|
51
|
+
DedupeMatchMode,
|
|
46
52
|
PaginateMode,
|
|
47
53
|
PendingValue,
|
|
48
54
|
RefetchUpdateMode,
|
package/build/test-cjs/index.js
CHANGED
|
@@ -53983,6 +53983,11 @@ var CachePolicy = {
|
|
|
53983
53983
|
CacheAndNetwork: "CacheAndNetwork",
|
|
53984
53984
|
NoCache: "NoCache"
|
|
53985
53985
|
};
|
|
53986
|
+
var DedupeMatchMode = {
|
|
53987
|
+
Variables: "Variables",
|
|
53988
|
+
Operation: "Operation",
|
|
53989
|
+
None: "None"
|
|
53990
|
+
};
|
|
53986
53991
|
var PaginateMode = {
|
|
53987
53992
|
Infinite: "Infinite",
|
|
53988
53993
|
SinglePage: "SinglePage"
|
|
@@ -56767,8 +56772,9 @@ var Config = class {
|
|
|
56767
56772
|
localSchema;
|
|
56768
56773
|
projectRoot;
|
|
56769
56774
|
schema;
|
|
56775
|
+
runtimeDir;
|
|
56770
56776
|
schemaPath;
|
|
56771
|
-
persistedQueriesPath
|
|
56777
|
+
persistedQueriesPath;
|
|
56772
56778
|
exclude;
|
|
56773
56779
|
scalars;
|
|
56774
56780
|
module = "esm";
|
|
@@ -56809,6 +56815,7 @@ var Config = class {
|
|
|
56809
56815
|
let {
|
|
56810
56816
|
schema,
|
|
56811
56817
|
schemaPath = "./schema.graphql",
|
|
56818
|
+
runtimeDir = "$houdini",
|
|
56812
56819
|
exclude = [],
|
|
56813
56820
|
module: module2 = "esm",
|
|
56814
56821
|
scalars,
|
|
@@ -56847,6 +56854,7 @@ var Config = class {
|
|
|
56847
56854
|
this.projectRoot = dirname(
|
|
56848
56855
|
projectDir ? join(process.cwd(), projectDir) : filepath
|
|
56849
56856
|
);
|
|
56857
|
+
this.runtimeDir = runtimeDir;
|
|
56850
56858
|
this.scalars = scalars;
|
|
56851
56859
|
this.cacheBufferSize = cacheBufferSize;
|
|
56852
56860
|
this.defaultCachePolicy = defaultCachePolicy;
|
|
@@ -56861,11 +56869,9 @@ var Config = class {
|
|
|
56861
56869
|
this.schemaPollInterval = watchSchema?.interval === void 0 ? 2e3 : watchSchema.interval;
|
|
56862
56870
|
this.schemaPollTimeout = watchSchema?.timeout ?? 3e4;
|
|
56863
56871
|
this.schemaPollHeaders = watchSchema?.headers ?? {};
|
|
56864
|
-
this.rootDir = join(this.projectRoot,
|
|
56872
|
+
this.rootDir = join(this.projectRoot, this.runtimeDir);
|
|
56873
|
+
this.persistedQueriesPath = persistedQueriesPath ?? join(this.rootDir, "persisted_queries.json");
|
|
56865
56874
|
this.#fragmentVariableMaps = {};
|
|
56866
|
-
if (persistedQueriesPath) {
|
|
56867
|
-
this.persistedQueriesPath = persistedQueriesPath;
|
|
56868
|
-
}
|
|
56869
56875
|
if (defaultKeys) {
|
|
56870
56876
|
this.defaultKeys = defaultKeys;
|
|
56871
56877
|
}
|
|
@@ -59225,14 +59231,27 @@ async function paginate(config, documents) {
|
|
|
59225
59231
|
return {
|
|
59226
59232
|
...node,
|
|
59227
59233
|
variableDefinitions: finalVariables,
|
|
59228
|
-
directives: [
|
|
59234
|
+
directives: config.configFile.supressPaginationDeduplication ? node.directives : [
|
|
59229
59235
|
...node.directives || [],
|
|
59230
59236
|
{
|
|
59231
59237
|
kind: graphql13.Kind.DIRECTIVE,
|
|
59232
59238
|
name: {
|
|
59233
59239
|
kind: graphql13.Kind.NAME,
|
|
59234
59240
|
value: config.dedupeDirective
|
|
59235
|
-
}
|
|
59241
|
+
},
|
|
59242
|
+
arguments: [
|
|
59243
|
+
{
|
|
59244
|
+
kind: "Argument",
|
|
59245
|
+
name: {
|
|
59246
|
+
kind: "Name",
|
|
59247
|
+
value: "match"
|
|
59248
|
+
},
|
|
59249
|
+
value: {
|
|
59250
|
+
kind: "EnumValue",
|
|
59251
|
+
value: DedupeMatchMode.Variables
|
|
59252
|
+
}
|
|
59253
|
+
}
|
|
59254
|
+
]
|
|
59236
59255
|
}
|
|
59237
59256
|
]
|
|
59238
59257
|
};
|
|
@@ -60589,7 +60608,13 @@ function artifactGenerator(stats) {
|
|
|
60589
60608
|
const cancelFirstArg = dedupeDirective.arguments?.find(
|
|
60590
60609
|
(arg) => arg.name.value === "cancelFirst"
|
|
60591
60610
|
);
|
|
60592
|
-
|
|
60611
|
+
const matchArg = dedupeDirective.arguments?.find(
|
|
60612
|
+
(arg) => arg.name.value === "match"
|
|
60613
|
+
);
|
|
60614
|
+
dedupe = {
|
|
60615
|
+
cancel: cancelFirstArg && cancelFirstArg.value.kind === "BooleanValue" && cancelFirstArg.value ? "first" : "last",
|
|
60616
|
+
match: matchArg && matchArg.value.kind === "EnumValue" ? matchArg.value.value : DedupeMatchMode.Operation
|
|
60617
|
+
};
|
|
60593
60618
|
}
|
|
60594
60619
|
selectionSet = operation.selectionSet;
|
|
60595
60620
|
if (originalParsed.definitions[0].kind === "OperationDefinition") {
|
|
@@ -64256,11 +64281,20 @@ directive @${config.paginateDirective}(${config.listOrPaginateNameArg}: String,
|
|
|
64256
64281
|
"""
|
|
64257
64282
|
directive @${config.listPrependDirective} on FRAGMENT_SPREAD
|
|
64258
64283
|
|
|
64284
|
+
enum DedupeMatchMode {
|
|
64285
|
+
${DedupeMatchMode.Variables}
|
|
64286
|
+
${DedupeMatchMode.Operation}
|
|
64287
|
+
${DedupeMatchMode.None}
|
|
64288
|
+
}
|
|
64289
|
+
|
|
64259
64290
|
"""
|
|
64260
64291
|
@${config.dedupeDirective} is used to prevent an operation from running more than once at the same time.
|
|
64261
64292
|
If the cancelFirst arg is set to true, the response already in flight will be canceled instead of the second one.
|
|
64293
|
+
If match is set to Operation, then a request will be deduplicated any time there is a request with the same operation.
|
|
64294
|
+
If it's set to Variables then the request will only be deduplicated if the variables match. If match is set to None,
|
|
64295
|
+
then the request will never be deduplicated.
|
|
64262
64296
|
"""
|
|
64263
|
-
directive @${config.dedupeDirective}(cancelFirst: Boolean) on QUERY | MUTATION
|
|
64297
|
+
directive @${config.dedupeDirective}(cancelFirst: Boolean, match: DedupeMatchMode) on QUERY | MUTATION
|
|
64264
64298
|
|
|
64265
64299
|
"""
|
|
64266
64300
|
@${config.optimisticKeyDirective} is used to identify a field as an optimistic key
|
package/build/test-esm/index.js
CHANGED
|
@@ -53980,6 +53980,11 @@ var CachePolicy = {
|
|
|
53980
53980
|
CacheAndNetwork: "CacheAndNetwork",
|
|
53981
53981
|
NoCache: "NoCache"
|
|
53982
53982
|
};
|
|
53983
|
+
var DedupeMatchMode = {
|
|
53984
|
+
Variables: "Variables",
|
|
53985
|
+
Operation: "Operation",
|
|
53986
|
+
None: "None"
|
|
53987
|
+
};
|
|
53983
53988
|
var PaginateMode = {
|
|
53984
53989
|
Infinite: "Infinite",
|
|
53985
53990
|
SinglePage: "SinglePage"
|
|
@@ -56763,8 +56768,9 @@ var Config = class {
|
|
|
56763
56768
|
localSchema;
|
|
56764
56769
|
projectRoot;
|
|
56765
56770
|
schema;
|
|
56771
|
+
runtimeDir;
|
|
56766
56772
|
schemaPath;
|
|
56767
|
-
persistedQueriesPath
|
|
56773
|
+
persistedQueriesPath;
|
|
56768
56774
|
exclude;
|
|
56769
56775
|
scalars;
|
|
56770
56776
|
module = "esm";
|
|
@@ -56805,6 +56811,7 @@ var Config = class {
|
|
|
56805
56811
|
let {
|
|
56806
56812
|
schema,
|
|
56807
56813
|
schemaPath = "./schema.graphql",
|
|
56814
|
+
runtimeDir = "$houdini",
|
|
56808
56815
|
exclude = [],
|
|
56809
56816
|
module = "esm",
|
|
56810
56817
|
scalars,
|
|
@@ -56843,6 +56850,7 @@ var Config = class {
|
|
|
56843
56850
|
this.projectRoot = dirname(
|
|
56844
56851
|
projectDir ? join(process.cwd(), projectDir) : filepath
|
|
56845
56852
|
);
|
|
56853
|
+
this.runtimeDir = runtimeDir;
|
|
56846
56854
|
this.scalars = scalars;
|
|
56847
56855
|
this.cacheBufferSize = cacheBufferSize;
|
|
56848
56856
|
this.defaultCachePolicy = defaultCachePolicy;
|
|
@@ -56857,11 +56865,9 @@ var Config = class {
|
|
|
56857
56865
|
this.schemaPollInterval = watchSchema?.interval === void 0 ? 2e3 : watchSchema.interval;
|
|
56858
56866
|
this.schemaPollTimeout = watchSchema?.timeout ?? 3e4;
|
|
56859
56867
|
this.schemaPollHeaders = watchSchema?.headers ?? {};
|
|
56860
|
-
this.rootDir = join(this.projectRoot,
|
|
56868
|
+
this.rootDir = join(this.projectRoot, this.runtimeDir);
|
|
56869
|
+
this.persistedQueriesPath = persistedQueriesPath ?? join(this.rootDir, "persisted_queries.json");
|
|
56861
56870
|
this.#fragmentVariableMaps = {};
|
|
56862
|
-
if (persistedQueriesPath) {
|
|
56863
|
-
this.persistedQueriesPath = persistedQueriesPath;
|
|
56864
|
-
}
|
|
56865
56871
|
if (defaultKeys) {
|
|
56866
56872
|
this.defaultKeys = defaultKeys;
|
|
56867
56873
|
}
|
|
@@ -59221,14 +59227,27 @@ async function paginate(config, documents) {
|
|
|
59221
59227
|
return {
|
|
59222
59228
|
...node,
|
|
59223
59229
|
variableDefinitions: finalVariables,
|
|
59224
|
-
directives: [
|
|
59230
|
+
directives: config.configFile.supressPaginationDeduplication ? node.directives : [
|
|
59225
59231
|
...node.directives || [],
|
|
59226
59232
|
{
|
|
59227
59233
|
kind: graphql13.Kind.DIRECTIVE,
|
|
59228
59234
|
name: {
|
|
59229
59235
|
kind: graphql13.Kind.NAME,
|
|
59230
59236
|
value: config.dedupeDirective
|
|
59231
|
-
}
|
|
59237
|
+
},
|
|
59238
|
+
arguments: [
|
|
59239
|
+
{
|
|
59240
|
+
kind: "Argument",
|
|
59241
|
+
name: {
|
|
59242
|
+
kind: "Name",
|
|
59243
|
+
value: "match"
|
|
59244
|
+
},
|
|
59245
|
+
value: {
|
|
59246
|
+
kind: "EnumValue",
|
|
59247
|
+
value: DedupeMatchMode.Variables
|
|
59248
|
+
}
|
|
59249
|
+
}
|
|
59250
|
+
]
|
|
59232
59251
|
}
|
|
59233
59252
|
]
|
|
59234
59253
|
};
|
|
@@ -60585,7 +60604,13 @@ function artifactGenerator(stats) {
|
|
|
60585
60604
|
const cancelFirstArg = dedupeDirective.arguments?.find(
|
|
60586
60605
|
(arg) => arg.name.value === "cancelFirst"
|
|
60587
60606
|
);
|
|
60588
|
-
|
|
60607
|
+
const matchArg = dedupeDirective.arguments?.find(
|
|
60608
|
+
(arg) => arg.name.value === "match"
|
|
60609
|
+
);
|
|
60610
|
+
dedupe = {
|
|
60611
|
+
cancel: cancelFirstArg && cancelFirstArg.value.kind === "BooleanValue" && cancelFirstArg.value ? "first" : "last",
|
|
60612
|
+
match: matchArg && matchArg.value.kind === "EnumValue" ? matchArg.value.value : DedupeMatchMode.Operation
|
|
60613
|
+
};
|
|
60589
60614
|
}
|
|
60590
60615
|
selectionSet = operation.selectionSet;
|
|
60591
60616
|
if (originalParsed.definitions[0].kind === "OperationDefinition") {
|
|
@@ -64252,11 +64277,20 @@ directive @${config.paginateDirective}(${config.listOrPaginateNameArg}: String,
|
|
|
64252
64277
|
"""
|
|
64253
64278
|
directive @${config.listPrependDirective} on FRAGMENT_SPREAD
|
|
64254
64279
|
|
|
64280
|
+
enum DedupeMatchMode {
|
|
64281
|
+
${DedupeMatchMode.Variables}
|
|
64282
|
+
${DedupeMatchMode.Operation}
|
|
64283
|
+
${DedupeMatchMode.None}
|
|
64284
|
+
}
|
|
64285
|
+
|
|
64255
64286
|
"""
|
|
64256
64287
|
@${config.dedupeDirective} is used to prevent an operation from running more than once at the same time.
|
|
64257
64288
|
If the cancelFirst arg is set to true, the response already in flight will be canceled instead of the second one.
|
|
64289
|
+
If match is set to Operation, then a request will be deduplicated any time there is a request with the same operation.
|
|
64290
|
+
If it's set to Variables then the request will only be deduplicated if the variables match. If match is set to None,
|
|
64291
|
+
then the request will never be deduplicated.
|
|
64258
64292
|
"""
|
|
64259
|
-
directive @${config.dedupeDirective}(cancelFirst: Boolean) on QUERY | MUTATION
|
|
64293
|
+
directive @${config.dedupeDirective}(cancelFirst: Boolean, match: DedupeMatchMode) on QUERY | MUTATION
|
|
64260
64294
|
|
|
64261
64295
|
"""
|
|
64262
64296
|
@${config.optimisticKeyDirective} is used to identify a field as an optimistic key
|
package/build/vite-cjs/index.js
CHANGED
|
@@ -64623,6 +64623,11 @@ var CachePolicy = {
|
|
|
64623
64623
|
CacheAndNetwork: "CacheAndNetwork",
|
|
64624
64624
|
NoCache: "NoCache"
|
|
64625
64625
|
};
|
|
64626
|
+
var DedupeMatchMode = {
|
|
64627
|
+
Variables: "Variables",
|
|
64628
|
+
Operation: "Operation",
|
|
64629
|
+
None: "None"
|
|
64630
|
+
};
|
|
64626
64631
|
var PaginateMode = {
|
|
64627
64632
|
Infinite: "Infinite",
|
|
64628
64633
|
SinglePage: "SinglePage"
|
|
@@ -66344,7 +66349,7 @@ async function pullSchema(url, fetchTimeout, schemaPath, headers, skipWriting) {
|
|
|
66344
66349
|
content = await resp.text();
|
|
66345
66350
|
const jsonSchema = JSON.parse(content).data;
|
|
66346
66351
|
let fileData = "";
|
|
66347
|
-
if (schemaPath.endsWith("gql") || schemaPath.endsWith("graphql")) {
|
|
66352
|
+
if (schemaPath.endsWith("gql") || schemaPath.endsWith("graphql") || schemaPath.endsWith("graphqls")) {
|
|
66348
66353
|
const schema = graphql.buildClientSchema(jsonSchema);
|
|
66349
66354
|
fileData = graphql.printSchema(graphql.lexicographicSortSchema(schema));
|
|
66350
66355
|
} else {
|
|
@@ -69138,8 +69143,9 @@ var Config = class {
|
|
|
69138
69143
|
localSchema;
|
|
69139
69144
|
projectRoot;
|
|
69140
69145
|
schema;
|
|
69146
|
+
runtimeDir;
|
|
69141
69147
|
schemaPath;
|
|
69142
|
-
persistedQueriesPath
|
|
69148
|
+
persistedQueriesPath;
|
|
69143
69149
|
exclude;
|
|
69144
69150
|
scalars;
|
|
69145
69151
|
module = "esm";
|
|
@@ -69180,6 +69186,7 @@ var Config = class {
|
|
|
69180
69186
|
let {
|
|
69181
69187
|
schema,
|
|
69182
69188
|
schemaPath = "./schema.graphql",
|
|
69189
|
+
runtimeDir = "$houdini",
|
|
69183
69190
|
exclude = [],
|
|
69184
69191
|
module: module2 = "esm",
|
|
69185
69192
|
scalars,
|
|
@@ -69218,6 +69225,7 @@ var Config = class {
|
|
|
69218
69225
|
this.projectRoot = dirname(
|
|
69219
69226
|
projectDir ? join2(process.cwd(), projectDir) : filepath
|
|
69220
69227
|
);
|
|
69228
|
+
this.runtimeDir = runtimeDir;
|
|
69221
69229
|
this.scalars = scalars;
|
|
69222
69230
|
this.cacheBufferSize = cacheBufferSize;
|
|
69223
69231
|
this.defaultCachePolicy = defaultCachePolicy;
|
|
@@ -69232,11 +69240,9 @@ var Config = class {
|
|
|
69232
69240
|
this.schemaPollInterval = watchSchema?.interval === void 0 ? 2e3 : watchSchema.interval;
|
|
69233
69241
|
this.schemaPollTimeout = watchSchema?.timeout ?? 3e4;
|
|
69234
69242
|
this.schemaPollHeaders = watchSchema?.headers ?? {};
|
|
69235
|
-
this.rootDir = join2(this.projectRoot,
|
|
69243
|
+
this.rootDir = join2(this.projectRoot, this.runtimeDir);
|
|
69244
|
+
this.persistedQueriesPath = persistedQueriesPath ?? join2(this.rootDir, "persisted_queries.json");
|
|
69236
69245
|
this.#fragmentVariableMaps = {};
|
|
69237
|
-
if (persistedQueriesPath) {
|
|
69238
|
-
this.persistedQueriesPath = persistedQueriesPath;
|
|
69239
|
-
}
|
|
69240
69246
|
if (defaultKeys) {
|
|
69241
69247
|
this.defaultKeys = defaultKeys;
|
|
69242
69248
|
}
|
|
@@ -69889,7 +69895,11 @@ async function getConfig({
|
|
|
69889
69895
|
}
|
|
69890
69896
|
}
|
|
69891
69897
|
if (schemaOk && !noSchema) {
|
|
69892
|
-
|
|
69898
|
+
try {
|
|
69899
|
+
_config.schema = await loadSchemaFile(_config.schemaPath);
|
|
69900
|
+
} catch (e2) {
|
|
69901
|
+
console.error(`\u26A0\uFE0F Your schema file could not be loaded: ${e2}`);
|
|
69902
|
+
}
|
|
69893
69903
|
}
|
|
69894
69904
|
}
|
|
69895
69905
|
_config.plugins = orderedPlugins(plugins);
|
|
@@ -70020,7 +70030,7 @@ async function loadSchemaFile(schemaPath) {
|
|
|
70020
70030
|
});
|
|
70021
70031
|
}
|
|
70022
70032
|
const contents = await readFile(schemaPath);
|
|
70023
|
-
if (schemaPath.endsWith("gql") || schemaPath.endsWith("graphql")) {
|
|
70033
|
+
if (schemaPath.endsWith("gql") || schemaPath.endsWith("graphql") || schemaPath.endsWith("graphqls")) {
|
|
70024
70034
|
return graphql3.buildSchema(contents);
|
|
70025
70035
|
}
|
|
70026
70036
|
const jsonContents = JSON.parse(contents);
|
|
@@ -72278,14 +72288,27 @@ async function paginate(config2, documents) {
|
|
|
72278
72288
|
return {
|
|
72279
72289
|
...node,
|
|
72280
72290
|
variableDefinitions: finalVariables,
|
|
72281
|
-
directives: [
|
|
72291
|
+
directives: config2.configFile.supressPaginationDeduplication ? node.directives : [
|
|
72282
72292
|
...node.directives || [],
|
|
72283
72293
|
{
|
|
72284
72294
|
kind: graphql13.Kind.DIRECTIVE,
|
|
72285
72295
|
name: {
|
|
72286
72296
|
kind: graphql13.Kind.NAME,
|
|
72287
72297
|
value: config2.dedupeDirective
|
|
72288
|
-
}
|
|
72298
|
+
},
|
|
72299
|
+
arguments: [
|
|
72300
|
+
{
|
|
72301
|
+
kind: "Argument",
|
|
72302
|
+
name: {
|
|
72303
|
+
kind: "Name",
|
|
72304
|
+
value: "match"
|
|
72305
|
+
},
|
|
72306
|
+
value: {
|
|
72307
|
+
kind: "EnumValue",
|
|
72308
|
+
value: DedupeMatchMode.Variables
|
|
72309
|
+
}
|
|
72310
|
+
}
|
|
72311
|
+
]
|
|
72289
72312
|
}
|
|
72290
72313
|
]
|
|
72291
72314
|
};
|
|
@@ -73642,7 +73665,13 @@ function artifactGenerator(stats) {
|
|
|
73642
73665
|
const cancelFirstArg = dedupeDirective.arguments?.find(
|
|
73643
73666
|
(arg) => arg.name.value === "cancelFirst"
|
|
73644
73667
|
);
|
|
73645
|
-
|
|
73668
|
+
const matchArg = dedupeDirective.arguments?.find(
|
|
73669
|
+
(arg) => arg.name.value === "match"
|
|
73670
|
+
);
|
|
73671
|
+
dedupe = {
|
|
73672
|
+
cancel: cancelFirstArg && cancelFirstArg.value.kind === "BooleanValue" && cancelFirstArg.value ? "first" : "last",
|
|
73673
|
+
match: matchArg && matchArg.value.kind === "EnumValue" ? matchArg.value.value : DedupeMatchMode.Operation
|
|
73674
|
+
};
|
|
73646
73675
|
}
|
|
73647
73676
|
selectionSet = operation.selectionSet;
|
|
73648
73677
|
if (originalParsed.definitions[0].kind === "OperationDefinition") {
|
|
@@ -77309,11 +77338,20 @@ directive @${config2.paginateDirective}(${config2.listOrPaginateNameArg}: String
|
|
|
77309
77338
|
"""
|
|
77310
77339
|
directive @${config2.listPrependDirective} on FRAGMENT_SPREAD
|
|
77311
77340
|
|
|
77341
|
+
enum DedupeMatchMode {
|
|
77342
|
+
${DedupeMatchMode.Variables}
|
|
77343
|
+
${DedupeMatchMode.Operation}
|
|
77344
|
+
${DedupeMatchMode.None}
|
|
77345
|
+
}
|
|
77346
|
+
|
|
77312
77347
|
"""
|
|
77313
77348
|
@${config2.dedupeDirective} is used to prevent an operation from running more than once at the same time.
|
|
77314
77349
|
If the cancelFirst arg is set to true, the response already in flight will be canceled instead of the second one.
|
|
77350
|
+
If match is set to Operation, then a request will be deduplicated any time there is a request with the same operation.
|
|
77351
|
+
If it's set to Variables then the request will only be deduplicated if the variables match. If match is set to None,
|
|
77352
|
+
then the request will never be deduplicated.
|
|
77315
77353
|
"""
|
|
77316
|
-
directive @${config2.dedupeDirective}(cancelFirst: Boolean) on QUERY | MUTATION
|
|
77354
|
+
directive @${config2.dedupeDirective}(cancelFirst: Boolean, match: DedupeMatchMode) on QUERY | MUTATION
|
|
77317
77355
|
|
|
77318
77356
|
"""
|
|
77319
77357
|
@${config2.optimisticKeyDirective} is used to identify a field as an optimistic key
|
package/build/vite-esm/index.js
CHANGED
|
@@ -64617,6 +64617,11 @@ var CachePolicy = {
|
|
|
64617
64617
|
CacheAndNetwork: "CacheAndNetwork",
|
|
64618
64618
|
NoCache: "NoCache"
|
|
64619
64619
|
};
|
|
64620
|
+
var DedupeMatchMode = {
|
|
64621
|
+
Variables: "Variables",
|
|
64622
|
+
Operation: "Operation",
|
|
64623
|
+
None: "None"
|
|
64624
|
+
};
|
|
64620
64625
|
var PaginateMode = {
|
|
64621
64626
|
Infinite: "Infinite",
|
|
64622
64627
|
SinglePage: "SinglePage"
|
|
@@ -66338,7 +66343,7 @@ async function pullSchema(url, fetchTimeout, schemaPath, headers, skipWriting) {
|
|
|
66338
66343
|
content = await resp.text();
|
|
66339
66344
|
const jsonSchema = JSON.parse(content).data;
|
|
66340
66345
|
let fileData = "";
|
|
66341
|
-
if (schemaPath.endsWith("gql") || schemaPath.endsWith("graphql")) {
|
|
66346
|
+
if (schemaPath.endsWith("gql") || schemaPath.endsWith("graphql") || schemaPath.endsWith("graphqls")) {
|
|
66342
66347
|
const schema = graphql.buildClientSchema(jsonSchema);
|
|
66343
66348
|
fileData = graphql.printSchema(graphql.lexicographicSortSchema(schema));
|
|
66344
66349
|
} else {
|
|
@@ -69131,8 +69136,9 @@ var Config = class {
|
|
|
69131
69136
|
localSchema;
|
|
69132
69137
|
projectRoot;
|
|
69133
69138
|
schema;
|
|
69139
|
+
runtimeDir;
|
|
69134
69140
|
schemaPath;
|
|
69135
|
-
persistedQueriesPath
|
|
69141
|
+
persistedQueriesPath;
|
|
69136
69142
|
exclude;
|
|
69137
69143
|
scalars;
|
|
69138
69144
|
module = "esm";
|
|
@@ -69173,6 +69179,7 @@ var Config = class {
|
|
|
69173
69179
|
let {
|
|
69174
69180
|
schema,
|
|
69175
69181
|
schemaPath = "./schema.graphql",
|
|
69182
|
+
runtimeDir = "$houdini",
|
|
69176
69183
|
exclude = [],
|
|
69177
69184
|
module = "esm",
|
|
69178
69185
|
scalars,
|
|
@@ -69211,6 +69218,7 @@ var Config = class {
|
|
|
69211
69218
|
this.projectRoot = dirname(
|
|
69212
69219
|
projectDir ? join2(process.cwd(), projectDir) : filepath
|
|
69213
69220
|
);
|
|
69221
|
+
this.runtimeDir = runtimeDir;
|
|
69214
69222
|
this.scalars = scalars;
|
|
69215
69223
|
this.cacheBufferSize = cacheBufferSize;
|
|
69216
69224
|
this.defaultCachePolicy = defaultCachePolicy;
|
|
@@ -69225,11 +69233,9 @@ var Config = class {
|
|
|
69225
69233
|
this.schemaPollInterval = watchSchema?.interval === void 0 ? 2e3 : watchSchema.interval;
|
|
69226
69234
|
this.schemaPollTimeout = watchSchema?.timeout ?? 3e4;
|
|
69227
69235
|
this.schemaPollHeaders = watchSchema?.headers ?? {};
|
|
69228
|
-
this.rootDir = join2(this.projectRoot,
|
|
69236
|
+
this.rootDir = join2(this.projectRoot, this.runtimeDir);
|
|
69237
|
+
this.persistedQueriesPath = persistedQueriesPath ?? join2(this.rootDir, "persisted_queries.json");
|
|
69229
69238
|
this.#fragmentVariableMaps = {};
|
|
69230
|
-
if (persistedQueriesPath) {
|
|
69231
|
-
this.persistedQueriesPath = persistedQueriesPath;
|
|
69232
|
-
}
|
|
69233
69239
|
if (defaultKeys) {
|
|
69234
69240
|
this.defaultKeys = defaultKeys;
|
|
69235
69241
|
}
|
|
@@ -69882,7 +69888,11 @@ async function getConfig({
|
|
|
69882
69888
|
}
|
|
69883
69889
|
}
|
|
69884
69890
|
if (schemaOk && !noSchema) {
|
|
69885
|
-
|
|
69891
|
+
try {
|
|
69892
|
+
_config.schema = await loadSchemaFile(_config.schemaPath);
|
|
69893
|
+
} catch (e2) {
|
|
69894
|
+
console.error(`\u26A0\uFE0F Your schema file could not be loaded: ${e2}`);
|
|
69895
|
+
}
|
|
69886
69896
|
}
|
|
69887
69897
|
}
|
|
69888
69898
|
_config.plugins = orderedPlugins(plugins);
|
|
@@ -70013,7 +70023,7 @@ async function loadSchemaFile(schemaPath) {
|
|
|
70013
70023
|
});
|
|
70014
70024
|
}
|
|
70015
70025
|
const contents = await readFile(schemaPath);
|
|
70016
|
-
if (schemaPath.endsWith("gql") || schemaPath.endsWith("graphql")) {
|
|
70026
|
+
if (schemaPath.endsWith("gql") || schemaPath.endsWith("graphql") || schemaPath.endsWith("graphqls")) {
|
|
70017
70027
|
return graphql3.buildSchema(contents);
|
|
70018
70028
|
}
|
|
70019
70029
|
const jsonContents = JSON.parse(contents);
|
|
@@ -72271,14 +72281,27 @@ async function paginate(config2, documents) {
|
|
|
72271
72281
|
return {
|
|
72272
72282
|
...node,
|
|
72273
72283
|
variableDefinitions: finalVariables,
|
|
72274
|
-
directives: [
|
|
72284
|
+
directives: config2.configFile.supressPaginationDeduplication ? node.directives : [
|
|
72275
72285
|
...node.directives || [],
|
|
72276
72286
|
{
|
|
72277
72287
|
kind: graphql13.Kind.DIRECTIVE,
|
|
72278
72288
|
name: {
|
|
72279
72289
|
kind: graphql13.Kind.NAME,
|
|
72280
72290
|
value: config2.dedupeDirective
|
|
72281
|
-
}
|
|
72291
|
+
},
|
|
72292
|
+
arguments: [
|
|
72293
|
+
{
|
|
72294
|
+
kind: "Argument",
|
|
72295
|
+
name: {
|
|
72296
|
+
kind: "Name",
|
|
72297
|
+
value: "match"
|
|
72298
|
+
},
|
|
72299
|
+
value: {
|
|
72300
|
+
kind: "EnumValue",
|
|
72301
|
+
value: DedupeMatchMode.Variables
|
|
72302
|
+
}
|
|
72303
|
+
}
|
|
72304
|
+
]
|
|
72282
72305
|
}
|
|
72283
72306
|
]
|
|
72284
72307
|
};
|
|
@@ -73635,7 +73658,13 @@ function artifactGenerator(stats) {
|
|
|
73635
73658
|
const cancelFirstArg = dedupeDirective.arguments?.find(
|
|
73636
73659
|
(arg) => arg.name.value === "cancelFirst"
|
|
73637
73660
|
);
|
|
73638
|
-
|
|
73661
|
+
const matchArg = dedupeDirective.arguments?.find(
|
|
73662
|
+
(arg) => arg.name.value === "match"
|
|
73663
|
+
);
|
|
73664
|
+
dedupe = {
|
|
73665
|
+
cancel: cancelFirstArg && cancelFirstArg.value.kind === "BooleanValue" && cancelFirstArg.value ? "first" : "last",
|
|
73666
|
+
match: matchArg && matchArg.value.kind === "EnumValue" ? matchArg.value.value : DedupeMatchMode.Operation
|
|
73667
|
+
};
|
|
73639
73668
|
}
|
|
73640
73669
|
selectionSet = operation.selectionSet;
|
|
73641
73670
|
if (originalParsed.definitions[0].kind === "OperationDefinition") {
|
|
@@ -77302,11 +77331,20 @@ directive @${config2.paginateDirective}(${config2.listOrPaginateNameArg}: String
|
|
|
77302
77331
|
"""
|
|
77303
77332
|
directive @${config2.listPrependDirective} on FRAGMENT_SPREAD
|
|
77304
77333
|
|
|
77334
|
+
enum DedupeMatchMode {
|
|
77335
|
+
${DedupeMatchMode.Variables}
|
|
77336
|
+
${DedupeMatchMode.Operation}
|
|
77337
|
+
${DedupeMatchMode.None}
|
|
77338
|
+
}
|
|
77339
|
+
|
|
77305
77340
|
"""
|
|
77306
77341
|
@${config2.dedupeDirective} is used to prevent an operation from running more than once at the same time.
|
|
77307
77342
|
If the cancelFirst arg is set to true, the response already in flight will be canceled instead of the second one.
|
|
77343
|
+
If match is set to Operation, then a request will be deduplicated any time there is a request with the same operation.
|
|
77344
|
+
If it's set to Variables then the request will only be deduplicated if the variables match. If match is set to None,
|
|
77345
|
+
then the request will never be deduplicated.
|
|
77308
77346
|
"""
|
|
77309
|
-
directive @${config2.dedupeDirective}(cancelFirst: Boolean) on QUERY | MUTATION
|
|
77347
|
+
directive @${config2.dedupeDirective}(cancelFirst: Boolean, match: DedupeMatchMode) on QUERY | MUTATION
|
|
77310
77348
|
|
|
77311
77349
|
"""
|
|
77312
77350
|
@${config2.optimisticKeyDirective} is used to identify a field as an optimistic key
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "houdini",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "The disappearing GraphQL clients",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
"@types/ungap__structured-clone": "^0.3.0",
|
|
25
25
|
"kleur": "^4.1.5",
|
|
26
26
|
"prettier": "^2.8.3",
|
|
27
|
-
"rollup": "^4.
|
|
28
|
-
"vite": "^
|
|
27
|
+
"rollup": "^4.28.1",
|
|
28
|
+
"vite": "^6.0.3",
|
|
29
29
|
"vitest": "^1.6.0",
|
|
30
30
|
"scripts": "^1.0.0"
|
|
31
31
|
},
|