houdini 1.3.1 → 1.4.1
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 +143 -28
- package/build/cmd-esm/index.js +143 -28
- package/build/codegen-cjs/index.js +123 -10
- package/build/codegen-esm/index.js +123 -10
- package/build/lib/config.d.ts +1 -0
- package/build/lib/router/types.d.ts +3 -1
- package/build/lib-cjs/index.js +92 -19
- package/build/lib-esm/index.js +91 -19
- package/build/runtime/cache/cache.d.ts +1 -1
- package/build/runtime/cache/lists.d.ts +3 -1
- package/build/runtime/lib/config.d.ts +10 -1
- package/build/runtime/lib/types.d.ts +14 -2
- package/build/runtime-cjs/cache/cache.d.ts +1 -1
- package/build/runtime-cjs/cache/cache.js +31 -5
- package/build/runtime-cjs/cache/lists.d.ts +3 -1
- package/build/runtime-cjs/cache/lists.js +15 -1
- 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-cjs/router/match.js +1 -1
- package/build/runtime-esm/cache/cache.d.ts +1 -1
- package/build/runtime-esm/cache/cache.js +31 -5
- package/build/runtime-esm/cache/lists.d.ts +3 -1
- package/build/runtime-esm/cache/lists.js +15 -1
- 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/runtime-esm/router/match.js +1 -1
- package/build/test-cjs/index.js +129 -15
- package/build/test-esm/index.js +129 -15
- package/build/vite/ast.d.ts +8 -2
- package/build/vite-cjs/index.js +374 -255
- package/build/vite-esm/index.js +374 -255
- package/package.json +3 -3
package/build/cmd-esm/index.js
CHANGED
|
@@ -63319,6 +63319,11 @@ var CachePolicy = {
|
|
|
63319
63319
|
CacheAndNetwork: "CacheAndNetwork",
|
|
63320
63320
|
NoCache: "NoCache"
|
|
63321
63321
|
};
|
|
63322
|
+
var DedupeMatchMode = {
|
|
63323
|
+
Variables: "Variables",
|
|
63324
|
+
Operation: "Operation",
|
|
63325
|
+
None: "None"
|
|
63326
|
+
};
|
|
63322
63327
|
var PaginateMode = {
|
|
63323
63328
|
Infinite: "Infinite",
|
|
63324
63329
|
SinglePage: "SinglePage"
|
|
@@ -65337,7 +65342,18 @@ var ListManager = class {
|
|
|
65337
65342
|
}
|
|
65338
65343
|
lists = /* @__PURE__ */ new Map();
|
|
65339
65344
|
listsByField = /* @__PURE__ */ new Map();
|
|
65340
|
-
get(listName, id, allLists) {
|
|
65345
|
+
get(listName, id, allLists, skipMatches) {
|
|
65346
|
+
const lists = this.getLists(listName, id, allLists);
|
|
65347
|
+
if (!lists) {
|
|
65348
|
+
return null;
|
|
65349
|
+
}
|
|
65350
|
+
if (skipMatches) {
|
|
65351
|
+
return new ListCollection(lists.lists.filter((list) => !skipMatches.has(list.fieldRef)));
|
|
65352
|
+
} else {
|
|
65353
|
+
return lists;
|
|
65354
|
+
}
|
|
65355
|
+
}
|
|
65356
|
+
getLists(listName, id, allLists) {
|
|
65341
65357
|
const matches = this.lists.get(listName);
|
|
65342
65358
|
if (!matches || matches.size === 0) {
|
|
65343
65359
|
return null;
|
|
@@ -65459,6 +65475,9 @@ var List = class {
|
|
|
65459
65475
|
this.manager = manager;
|
|
65460
65476
|
this.abstract = abstract;
|
|
65461
65477
|
}
|
|
65478
|
+
get fieldRef() {
|
|
65479
|
+
return `${this.recordID}.${this.key}`;
|
|
65480
|
+
}
|
|
65462
65481
|
when(when) {
|
|
65463
65482
|
return this.manager.lists.get(this.name).get(this.recordID).when(when);
|
|
65464
65483
|
}
|
|
@@ -66611,8 +66630,8 @@ var Cache = class {
|
|
|
66611
66630
|
variables
|
|
66612
66631
|
);
|
|
66613
66632
|
}
|
|
66614
|
-
list(name, parentID, allLists) {
|
|
66615
|
-
const handler = this._internal_unstable.lists.get(name, parentID, allLists);
|
|
66633
|
+
list(name, parentID, allLists, skipMatches) {
|
|
66634
|
+
const handler = this._internal_unstable.lists.get(name, parentID, allLists, skipMatches);
|
|
66616
66635
|
if (!handler) {
|
|
66617
66636
|
throw new Error(
|
|
66618
66637
|
`Cannot find list with name: ${name}${parentID ? " under parent " + parentID : ""}. Is it possible that the query is not mounted?`
|
|
@@ -67027,6 +67046,7 @@ var CacheInternal = class {
|
|
|
67027
67046
|
});
|
|
67028
67047
|
}
|
|
67029
67048
|
}
|
|
67049
|
+
const processedOperations = /* @__PURE__ */ new Set();
|
|
67030
67050
|
for (const operation of operations || []) {
|
|
67031
67051
|
let parentID;
|
|
67032
67052
|
if (operation.parentID) {
|
|
@@ -67046,7 +67066,12 @@ var CacheInternal = class {
|
|
|
67046
67066
|
const targets = Array.isArray(value) ? value : [value];
|
|
67047
67067
|
for (const target of targets) {
|
|
67048
67068
|
if (operation.action === "insert" && target instanceof Object && fieldSelection && operation.list) {
|
|
67049
|
-
this.cache.list(
|
|
67069
|
+
this.cache.list(
|
|
67070
|
+
operation.list,
|
|
67071
|
+
parentID,
|
|
67072
|
+
operation.target === "all",
|
|
67073
|
+
processedOperations
|
|
67074
|
+
).when(operation.when).addToList(
|
|
67050
67075
|
fieldSelection,
|
|
67051
67076
|
target,
|
|
67052
67077
|
variables,
|
|
@@ -67054,7 +67079,12 @@ var CacheInternal = class {
|
|
|
67054
67079
|
layer
|
|
67055
67080
|
);
|
|
67056
67081
|
} else if (operation.action === "toggle" && target instanceof Object && fieldSelection && operation.list) {
|
|
67057
|
-
this.cache.list(
|
|
67082
|
+
this.cache.list(
|
|
67083
|
+
operation.list,
|
|
67084
|
+
parentID,
|
|
67085
|
+
operation.target === "all",
|
|
67086
|
+
processedOperations
|
|
67087
|
+
).when(operation.when).toggleElement({
|
|
67058
67088
|
selection: fieldSelection,
|
|
67059
67089
|
data: target,
|
|
67060
67090
|
variables,
|
|
@@ -67062,7 +67092,12 @@ var CacheInternal = class {
|
|
|
67062
67092
|
layer
|
|
67063
67093
|
});
|
|
67064
67094
|
} else if (operation.action === "remove" && target instanceof Object && fieldSelection && operation.list) {
|
|
67065
|
-
this.cache.list(
|
|
67095
|
+
this.cache.list(
|
|
67096
|
+
operation.list,
|
|
67097
|
+
parentID,
|
|
67098
|
+
operation.target === "all",
|
|
67099
|
+
processedOperations
|
|
67100
|
+
).when(operation.when).remove(target, variables, layer);
|
|
67066
67101
|
} else if (operation.action === "delete" && operation.type && target) {
|
|
67067
67102
|
const targetID = this.id(operation.type, target);
|
|
67068
67103
|
if (!targetID) {
|
|
@@ -67074,6 +67109,16 @@ var CacheInternal = class {
|
|
|
67074
67109
|
this.cache.delete(targetID, layer);
|
|
67075
67110
|
}
|
|
67076
67111
|
}
|
|
67112
|
+
if (operation.list) {
|
|
67113
|
+
const matchingLists = this.cache.list(
|
|
67114
|
+
operation.list,
|
|
67115
|
+
parentID,
|
|
67116
|
+
operation.target === "all"
|
|
67117
|
+
);
|
|
67118
|
+
for (const list of matchingLists.lists) {
|
|
67119
|
+
processedOperations.add(list.fieldRef);
|
|
67120
|
+
}
|
|
67121
|
+
}
|
|
67077
67122
|
}
|
|
67078
67123
|
}
|
|
67079
67124
|
return toNotify;
|
|
@@ -67592,8 +67637,9 @@ var Config = class {
|
|
|
67592
67637
|
localSchema;
|
|
67593
67638
|
projectRoot;
|
|
67594
67639
|
schema;
|
|
67640
|
+
runtimeDir;
|
|
67595
67641
|
schemaPath;
|
|
67596
|
-
persistedQueriesPath
|
|
67642
|
+
persistedQueriesPath;
|
|
67597
67643
|
exclude;
|
|
67598
67644
|
scalars;
|
|
67599
67645
|
module = "esm";
|
|
@@ -67634,6 +67680,7 @@ var Config = class {
|
|
|
67634
67680
|
let {
|
|
67635
67681
|
schema,
|
|
67636
67682
|
schemaPath = "./schema.graphql",
|
|
67683
|
+
runtimeDir = "$houdini",
|
|
67637
67684
|
exclude = [],
|
|
67638
67685
|
module = "esm",
|
|
67639
67686
|
scalars,
|
|
@@ -67672,6 +67719,7 @@ var Config = class {
|
|
|
67672
67719
|
this.projectRoot = dirname(
|
|
67673
67720
|
projectDir ? join2(process.cwd(), projectDir) : filepath
|
|
67674
67721
|
);
|
|
67722
|
+
this.runtimeDir = runtimeDir;
|
|
67675
67723
|
this.scalars = scalars;
|
|
67676
67724
|
this.cacheBufferSize = cacheBufferSize;
|
|
67677
67725
|
this.defaultCachePolicy = defaultCachePolicy;
|
|
@@ -67686,11 +67734,9 @@ var Config = class {
|
|
|
67686
67734
|
this.schemaPollInterval = watchSchema?.interval === void 0 ? 2e3 : watchSchema.interval;
|
|
67687
67735
|
this.schemaPollTimeout = watchSchema?.timeout ?? 3e4;
|
|
67688
67736
|
this.schemaPollHeaders = watchSchema?.headers ?? {};
|
|
67689
|
-
this.rootDir = join2(this.projectRoot,
|
|
67737
|
+
this.rootDir = join2(this.projectRoot, this.runtimeDir);
|
|
67738
|
+
this.persistedQueriesPath = persistedQueriesPath ?? join2(this.rootDir, "persisted_queries.json");
|
|
67690
67739
|
this.#fragmentVariableMaps = {};
|
|
67691
|
-
if (persistedQueriesPath) {
|
|
67692
|
-
this.persistedQueriesPath = persistedQueriesPath;
|
|
67693
|
-
}
|
|
67694
67740
|
if (defaultKeys) {
|
|
67695
67741
|
this.defaultKeys = defaultKeys;
|
|
67696
67742
|
}
|
|
@@ -70667,14 +70713,27 @@ async function paginate(config, documents) {
|
|
|
70667
70713
|
return {
|
|
70668
70714
|
...node,
|
|
70669
70715
|
variableDefinitions: finalVariables,
|
|
70670
|
-
directives: [
|
|
70716
|
+
directives: config.configFile.supressPaginationDeduplication ? node.directives : [
|
|
70671
70717
|
...node.directives || [],
|
|
70672
70718
|
{
|
|
70673
70719
|
kind: graphql13.Kind.DIRECTIVE,
|
|
70674
70720
|
name: {
|
|
70675
70721
|
kind: graphql13.Kind.NAME,
|
|
70676
70722
|
value: config.dedupeDirective
|
|
70677
|
-
}
|
|
70723
|
+
},
|
|
70724
|
+
arguments: [
|
|
70725
|
+
{
|
|
70726
|
+
kind: "Argument",
|
|
70727
|
+
name: {
|
|
70728
|
+
kind: "Name",
|
|
70729
|
+
value: "match"
|
|
70730
|
+
},
|
|
70731
|
+
value: {
|
|
70732
|
+
kind: "EnumValue",
|
|
70733
|
+
value: DedupeMatchMode.Variables
|
|
70734
|
+
}
|
|
70735
|
+
}
|
|
70736
|
+
]
|
|
70678
70737
|
}
|
|
70679
70738
|
]
|
|
70680
70739
|
};
|
|
@@ -71042,6 +71101,46 @@ function objectNode([type, defaultValue]) {
|
|
|
71042
71101
|
return node;
|
|
71043
71102
|
}
|
|
71044
71103
|
var pageInfoSelection = [
|
|
71104
|
+
{
|
|
71105
|
+
kind: graphql13.Kind.FIELD,
|
|
71106
|
+
name: {
|
|
71107
|
+
kind: graphql13.Kind.NAME,
|
|
71108
|
+
value: "pageInfo"
|
|
71109
|
+
},
|
|
71110
|
+
selectionSet: {
|
|
71111
|
+
kind: graphql13.Kind.SELECTION_SET,
|
|
71112
|
+
selections: [
|
|
71113
|
+
{
|
|
71114
|
+
kind: graphql13.Kind.FIELD,
|
|
71115
|
+
name: {
|
|
71116
|
+
kind: graphql13.Kind.NAME,
|
|
71117
|
+
value: "hasPreviousPage"
|
|
71118
|
+
}
|
|
71119
|
+
},
|
|
71120
|
+
{
|
|
71121
|
+
kind: graphql13.Kind.FIELD,
|
|
71122
|
+
name: {
|
|
71123
|
+
kind: graphql13.Kind.NAME,
|
|
71124
|
+
value: "hasNextPage"
|
|
71125
|
+
}
|
|
71126
|
+
},
|
|
71127
|
+
{
|
|
71128
|
+
kind: graphql13.Kind.FIELD,
|
|
71129
|
+
name: {
|
|
71130
|
+
kind: graphql13.Kind.NAME,
|
|
71131
|
+
value: "startCursor"
|
|
71132
|
+
}
|
|
71133
|
+
},
|
|
71134
|
+
{
|
|
71135
|
+
kind: graphql13.Kind.FIELD,
|
|
71136
|
+
name: {
|
|
71137
|
+
kind: graphql13.Kind.NAME,
|
|
71138
|
+
value: "endCursor"
|
|
71139
|
+
}
|
|
71140
|
+
}
|
|
71141
|
+
]
|
|
71142
|
+
}
|
|
71143
|
+
},
|
|
71045
71144
|
{
|
|
71046
71145
|
kind: graphql13.Kind.FIELD,
|
|
71047
71146
|
name: {
|
|
@@ -72031,7 +72130,13 @@ function artifactGenerator(stats) {
|
|
|
72031
72130
|
const cancelFirstArg = dedupeDirective.arguments?.find(
|
|
72032
72131
|
(arg) => arg.name.value === "cancelFirst"
|
|
72033
72132
|
);
|
|
72034
|
-
|
|
72133
|
+
const matchArg = dedupeDirective.arguments?.find(
|
|
72134
|
+
(arg) => arg.name.value === "match"
|
|
72135
|
+
);
|
|
72136
|
+
dedupe = {
|
|
72137
|
+
cancel: cancelFirstArg && cancelFirstArg.value.kind === "BooleanValue" && cancelFirstArg.value ? "first" : "last",
|
|
72138
|
+
match: matchArg && matchArg.value.kind === "EnumValue" ? matchArg.value.value : DedupeMatchMode.Operation
|
|
72139
|
+
};
|
|
72035
72140
|
}
|
|
72036
72141
|
selectionSet = operation.selectionSet;
|
|
72037
72142
|
if (originalParsed.definitions[0].kind === "OperationDefinition") {
|
|
@@ -75698,11 +75803,20 @@ directive @${config.paginateDirective}(${config.listOrPaginateNameArg}: String,
|
|
|
75698
75803
|
"""
|
|
75699
75804
|
directive @${config.listPrependDirective} on FRAGMENT_SPREAD
|
|
75700
75805
|
|
|
75806
|
+
enum DedupeMatchMode {
|
|
75807
|
+
${DedupeMatchMode.Variables}
|
|
75808
|
+
${DedupeMatchMode.Operation}
|
|
75809
|
+
${DedupeMatchMode.None}
|
|
75810
|
+
}
|
|
75811
|
+
|
|
75701
75812
|
"""
|
|
75702
75813
|
@${config.dedupeDirective} is used to prevent an operation from running more than once at the same time.
|
|
75703
75814
|
If the cancelFirst arg is set to true, the response already in flight will be canceled instead of the second one.
|
|
75815
|
+
If match is set to Operation, then a request will be deduplicated any time there is a request with the same operation.
|
|
75816
|
+
If it's set to Variables then the request will only be deduplicated if the variables match. If match is set to None,
|
|
75817
|
+
then the request will never be deduplicated.
|
|
75704
75818
|
"""
|
|
75705
|
-
directive @${config.dedupeDirective}(cancelFirst: Boolean) on QUERY | MUTATION
|
|
75819
|
+
directive @${config.dedupeDirective}(cancelFirst: Boolean, match: DedupeMatchMode) on QUERY | MUTATION
|
|
75706
75820
|
|
|
75707
75821
|
"""
|
|
75708
75822
|
@${config.optimisticKeyDirective} is used to identify a field as an optimistic key
|
|
@@ -78252,6 +78366,7 @@ async function houdiniConfig(configPath, schemaPath, module, frameworkInfo, url)
|
|
|
78252
78366
|
url
|
|
78253
78367
|
};
|
|
78254
78368
|
}
|
|
78369
|
+
config.runtimeDir = ".houdini";
|
|
78255
78370
|
if (schemaPath !== "./schema.graphql") {
|
|
78256
78371
|
config.schemaPath = schemaPath;
|
|
78257
78372
|
}
|
|
@@ -78333,7 +78448,7 @@ const config = {
|
|
|
78333
78448
|
kit: {
|
|
78334
78449
|
adapter: adapter(),
|
|
78335
78450
|
alias: {
|
|
78336
|
-
$houdini: '
|
|
78451
|
+
$houdini: '.houdini/'
|
|
78337
78452
|
}
|
|
78338
78453
|
}
|
|
78339
78454
|
};
|
|
@@ -78347,7 +78462,7 @@ const config = {
|
|
|
78347
78462
|
kit: {
|
|
78348
78463
|
adapter: adapter(),
|
|
78349
78464
|
alias: {
|
|
78350
|
-
$houdini: '
|
|
78465
|
+
$houdini: '.houdini/'
|
|
78351
78466
|
}
|
|
78352
78467
|
}
|
|
78353
78468
|
};
|
|
@@ -78359,8 +78474,8 @@ export default config;
|
|
|
78359
78474
|
async function gitIgnore(targetPath) {
|
|
78360
78475
|
const filepath = path_exports.join(targetPath, ".gitignore");
|
|
78361
78476
|
const existing = await fs_exports.readFile(filepath) || "";
|
|
78362
|
-
if (!existing.includes("\n
|
|
78363
|
-
await fs_exports.writeFile(filepath, existing + "\n
|
|
78477
|
+
if (!existing.includes("\n.houdini\n")) {
|
|
78478
|
+
await fs_exports.writeFile(filepath, existing + "\n.houdini\n");
|
|
78364
78479
|
}
|
|
78365
78480
|
}
|
|
78366
78481
|
async function graphqlRC(targetPath) {
|
|
@@ -78369,11 +78484,11 @@ async function graphqlRC(targetPath) {
|
|
|
78369
78484
|
default:
|
|
78370
78485
|
schema:
|
|
78371
78486
|
- ./schema.graphql
|
|
78372
|
-
-
|
|
78487
|
+
- ./.houdini/graphql/schema.graphql
|
|
78373
78488
|
documents:
|
|
78374
78489
|
- '**/*.gql'
|
|
78375
78490
|
- '**/*.svelte'
|
|
78376
|
-
-
|
|
78491
|
+
- ./.houdini/graphql/documents.gql
|
|
78377
78492
|
`;
|
|
78378
78493
|
await fs_exports.writeFile(target, content);
|
|
78379
78494
|
}
|
|
@@ -78391,7 +78506,7 @@ export default defineConfig({
|
|
|
78391
78506
|
|
|
78392
78507
|
resolve: {
|
|
78393
78508
|
alias: {
|
|
78394
|
-
$houdini:
|
|
78509
|
+
$houdini: '.houdini/',
|
|
78395
78510
|
},
|
|
78396
78511
|
},
|
|
78397
78512
|
})
|
|
@@ -78428,15 +78543,15 @@ async function tjsConfig(targetPath, frameworkInfo) {
|
|
|
78428
78543
|
var tjsConfig2 = parseJSON(tjsConfigFile);
|
|
78429
78544
|
}
|
|
78430
78545
|
if (frameworkInfo.framework === "svelte") {
|
|
78431
|
-
tjsConfig2.compilerOptions.rootDirs = [".", "
|
|
78546
|
+
tjsConfig2.compilerOptions.rootDirs = [".", "./.houdini/types"];
|
|
78432
78547
|
} else if (frameworkInfo.framework === "kit") {
|
|
78433
|
-
tjsConfig2.compilerOptions.rootDirs = [".", "./.svelte-kit/types", "
|
|
78548
|
+
tjsConfig2.compilerOptions.rootDirs = [".", "./.svelte-kit/types", "./.houdini/types"];
|
|
78434
78549
|
}
|
|
78435
78550
|
if (frameworkInfo.framework === "svelte") {
|
|
78436
78551
|
tjsConfig2.compilerOptions.paths = {
|
|
78437
78552
|
...tjsConfig2.compilerOptions.paths,
|
|
78438
|
-
$houdini: ["
|
|
78439
|
-
"$houdini/*": ["
|
|
78553
|
+
$houdini: ["./.houdini/"],
|
|
78554
|
+
"$houdini/*": ["./.houdini/*"]
|
|
78440
78555
|
};
|
|
78441
78556
|
}
|
|
78442
78557
|
await fs_exports.writeFile(configFile, JSON.stringify(tjsConfig2, null, 4));
|
|
@@ -78453,12 +78568,12 @@ async function packageJSON(targetPath, frameworkInfo) {
|
|
|
78453
78568
|
}
|
|
78454
78569
|
packageJSON2.devDependencies = {
|
|
78455
78570
|
...packageJSON2.devDependencies,
|
|
78456
|
-
houdini: "^1.
|
|
78571
|
+
houdini: "^1.4.1"
|
|
78457
78572
|
};
|
|
78458
78573
|
if (frameworkInfo.framework === "svelte" || frameworkInfo.framework === "kit") {
|
|
78459
78574
|
packageJSON2.devDependencies = {
|
|
78460
78575
|
...packageJSON2.devDependencies,
|
|
78461
|
-
"houdini-svelte": "^2.
|
|
78576
|
+
"houdini-svelte": "^2.1.1"
|
|
78462
78577
|
};
|
|
78463
78578
|
} else {
|
|
78464
78579
|
throw new Error(`Unmanaged framework: "${JSON.stringify(frameworkInfo)}"`);
|
|
@@ -53973,6 +53973,11 @@ var CachePolicy = {
|
|
|
53973
53973
|
CacheAndNetwork: "CacheAndNetwork",
|
|
53974
53974
|
NoCache: "NoCache"
|
|
53975
53975
|
};
|
|
53976
|
+
var DedupeMatchMode = {
|
|
53977
|
+
Variables: "Variables",
|
|
53978
|
+
Operation: "Operation",
|
|
53979
|
+
None: "None"
|
|
53980
|
+
};
|
|
53976
53981
|
var PaginateMode = {
|
|
53977
53982
|
Infinite: "Infinite",
|
|
53978
53983
|
SinglePage: "SinglePage"
|
|
@@ -54552,7 +54557,18 @@ var ListManager = class {
|
|
|
54552
54557
|
}
|
|
54553
54558
|
lists = /* @__PURE__ */ new Map();
|
|
54554
54559
|
listsByField = /* @__PURE__ */ new Map();
|
|
54555
|
-
get(listName, id, allLists) {
|
|
54560
|
+
get(listName, id, allLists, skipMatches) {
|
|
54561
|
+
const lists = this.getLists(listName, id, allLists);
|
|
54562
|
+
if (!lists) {
|
|
54563
|
+
return null;
|
|
54564
|
+
}
|
|
54565
|
+
if (skipMatches) {
|
|
54566
|
+
return new ListCollection(lists.lists.filter((list) => !skipMatches.has(list.fieldRef)));
|
|
54567
|
+
} else {
|
|
54568
|
+
return lists;
|
|
54569
|
+
}
|
|
54570
|
+
}
|
|
54571
|
+
getLists(listName, id, allLists) {
|
|
54556
54572
|
const matches = this.lists.get(listName);
|
|
54557
54573
|
if (!matches || matches.size === 0) {
|
|
54558
54574
|
return null;
|
|
@@ -54674,6 +54690,9 @@ var List = class {
|
|
|
54674
54690
|
this.manager = manager;
|
|
54675
54691
|
this.abstract = abstract;
|
|
54676
54692
|
}
|
|
54693
|
+
get fieldRef() {
|
|
54694
|
+
return `${this.recordID}.${this.key}`;
|
|
54695
|
+
}
|
|
54677
54696
|
when(when) {
|
|
54678
54697
|
return this.manager.lists.get(this.name).get(this.recordID).when(when);
|
|
54679
54698
|
}
|
|
@@ -55826,8 +55845,8 @@ var Cache = class {
|
|
|
55826
55845
|
variables
|
|
55827
55846
|
);
|
|
55828
55847
|
}
|
|
55829
|
-
list(name, parentID, allLists) {
|
|
55830
|
-
const handler = this._internal_unstable.lists.get(name, parentID, allLists);
|
|
55848
|
+
list(name, parentID, allLists, skipMatches) {
|
|
55849
|
+
const handler = this._internal_unstable.lists.get(name, parentID, allLists, skipMatches);
|
|
55831
55850
|
if (!handler) {
|
|
55832
55851
|
throw new Error(
|
|
55833
55852
|
`Cannot find list with name: ${name}${parentID ? " under parent " + parentID : ""}. Is it possible that the query is not mounted?`
|
|
@@ -56242,6 +56261,7 @@ var CacheInternal = class {
|
|
|
56242
56261
|
});
|
|
56243
56262
|
}
|
|
56244
56263
|
}
|
|
56264
|
+
const processedOperations = /* @__PURE__ */ new Set();
|
|
56245
56265
|
for (const operation of operations || []) {
|
|
56246
56266
|
let parentID;
|
|
56247
56267
|
if (operation.parentID) {
|
|
@@ -56261,7 +56281,12 @@ var CacheInternal = class {
|
|
|
56261
56281
|
const targets = Array.isArray(value) ? value : [value];
|
|
56262
56282
|
for (const target of targets) {
|
|
56263
56283
|
if (operation.action === "insert" && target instanceof Object && fieldSelection && operation.list) {
|
|
56264
|
-
this.cache.list(
|
|
56284
|
+
this.cache.list(
|
|
56285
|
+
operation.list,
|
|
56286
|
+
parentID,
|
|
56287
|
+
operation.target === "all",
|
|
56288
|
+
processedOperations
|
|
56289
|
+
).when(operation.when).addToList(
|
|
56265
56290
|
fieldSelection,
|
|
56266
56291
|
target,
|
|
56267
56292
|
variables,
|
|
@@ -56269,7 +56294,12 @@ var CacheInternal = class {
|
|
|
56269
56294
|
layer
|
|
56270
56295
|
);
|
|
56271
56296
|
} else if (operation.action === "toggle" && target instanceof Object && fieldSelection && operation.list) {
|
|
56272
|
-
this.cache.list(
|
|
56297
|
+
this.cache.list(
|
|
56298
|
+
operation.list,
|
|
56299
|
+
parentID,
|
|
56300
|
+
operation.target === "all",
|
|
56301
|
+
processedOperations
|
|
56302
|
+
).when(operation.when).toggleElement({
|
|
56273
56303
|
selection: fieldSelection,
|
|
56274
56304
|
data: target,
|
|
56275
56305
|
variables,
|
|
@@ -56277,7 +56307,12 @@ var CacheInternal = class {
|
|
|
56277
56307
|
layer
|
|
56278
56308
|
});
|
|
56279
56309
|
} else if (operation.action === "remove" && target instanceof Object && fieldSelection && operation.list) {
|
|
56280
|
-
this.cache.list(
|
|
56310
|
+
this.cache.list(
|
|
56311
|
+
operation.list,
|
|
56312
|
+
parentID,
|
|
56313
|
+
operation.target === "all",
|
|
56314
|
+
processedOperations
|
|
56315
|
+
).when(operation.when).remove(target, variables, layer);
|
|
56281
56316
|
} else if (operation.action === "delete" && operation.type && target) {
|
|
56282
56317
|
const targetID = this.id(operation.type, target);
|
|
56283
56318
|
if (!targetID) {
|
|
@@ -56289,6 +56324,16 @@ var CacheInternal = class {
|
|
|
56289
56324
|
this.cache.delete(targetID, layer);
|
|
56290
56325
|
}
|
|
56291
56326
|
}
|
|
56327
|
+
if (operation.list) {
|
|
56328
|
+
const matchingLists = this.cache.list(
|
|
56329
|
+
operation.list,
|
|
56330
|
+
parentID,
|
|
56331
|
+
operation.target === "all"
|
|
56332
|
+
);
|
|
56333
|
+
for (const list of matchingLists.lists) {
|
|
56334
|
+
processedOperations.add(list.fieldRef);
|
|
56335
|
+
}
|
|
56336
|
+
}
|
|
56292
56337
|
}
|
|
56293
56338
|
}
|
|
56294
56339
|
return toNotify;
|
|
@@ -58856,14 +58901,27 @@ async function paginate(config, documents) {
|
|
|
58856
58901
|
return {
|
|
58857
58902
|
...node,
|
|
58858
58903
|
variableDefinitions: finalVariables,
|
|
58859
|
-
directives: [
|
|
58904
|
+
directives: config.configFile.supressPaginationDeduplication ? node.directives : [
|
|
58860
58905
|
...node.directives || [],
|
|
58861
58906
|
{
|
|
58862
58907
|
kind: graphql13.Kind.DIRECTIVE,
|
|
58863
58908
|
name: {
|
|
58864
58909
|
kind: graphql13.Kind.NAME,
|
|
58865
58910
|
value: config.dedupeDirective
|
|
58866
|
-
}
|
|
58911
|
+
},
|
|
58912
|
+
arguments: [
|
|
58913
|
+
{
|
|
58914
|
+
kind: "Argument",
|
|
58915
|
+
name: {
|
|
58916
|
+
kind: "Name",
|
|
58917
|
+
value: "match"
|
|
58918
|
+
},
|
|
58919
|
+
value: {
|
|
58920
|
+
kind: "EnumValue",
|
|
58921
|
+
value: DedupeMatchMode.Variables
|
|
58922
|
+
}
|
|
58923
|
+
}
|
|
58924
|
+
]
|
|
58867
58925
|
}
|
|
58868
58926
|
]
|
|
58869
58927
|
};
|
|
@@ -59231,6 +59289,46 @@ function objectNode([type, defaultValue]) {
|
|
|
59231
59289
|
return node;
|
|
59232
59290
|
}
|
|
59233
59291
|
var pageInfoSelection = [
|
|
59292
|
+
{
|
|
59293
|
+
kind: graphql13.Kind.FIELD,
|
|
59294
|
+
name: {
|
|
59295
|
+
kind: graphql13.Kind.NAME,
|
|
59296
|
+
value: "pageInfo"
|
|
59297
|
+
},
|
|
59298
|
+
selectionSet: {
|
|
59299
|
+
kind: graphql13.Kind.SELECTION_SET,
|
|
59300
|
+
selections: [
|
|
59301
|
+
{
|
|
59302
|
+
kind: graphql13.Kind.FIELD,
|
|
59303
|
+
name: {
|
|
59304
|
+
kind: graphql13.Kind.NAME,
|
|
59305
|
+
value: "hasPreviousPage"
|
|
59306
|
+
}
|
|
59307
|
+
},
|
|
59308
|
+
{
|
|
59309
|
+
kind: graphql13.Kind.FIELD,
|
|
59310
|
+
name: {
|
|
59311
|
+
kind: graphql13.Kind.NAME,
|
|
59312
|
+
value: "hasNextPage"
|
|
59313
|
+
}
|
|
59314
|
+
},
|
|
59315
|
+
{
|
|
59316
|
+
kind: graphql13.Kind.FIELD,
|
|
59317
|
+
name: {
|
|
59318
|
+
kind: graphql13.Kind.NAME,
|
|
59319
|
+
value: "startCursor"
|
|
59320
|
+
}
|
|
59321
|
+
},
|
|
59322
|
+
{
|
|
59323
|
+
kind: graphql13.Kind.FIELD,
|
|
59324
|
+
name: {
|
|
59325
|
+
kind: graphql13.Kind.NAME,
|
|
59326
|
+
value: "endCursor"
|
|
59327
|
+
}
|
|
59328
|
+
}
|
|
59329
|
+
]
|
|
59330
|
+
}
|
|
59331
|
+
},
|
|
59234
59332
|
{
|
|
59235
59333
|
kind: graphql13.Kind.FIELD,
|
|
59236
59334
|
name: {
|
|
@@ -60220,7 +60318,13 @@ function artifactGenerator(stats) {
|
|
|
60220
60318
|
const cancelFirstArg = dedupeDirective.arguments?.find(
|
|
60221
60319
|
(arg) => arg.name.value === "cancelFirst"
|
|
60222
60320
|
);
|
|
60223
|
-
|
|
60321
|
+
const matchArg = dedupeDirective.arguments?.find(
|
|
60322
|
+
(arg) => arg.name.value === "match"
|
|
60323
|
+
);
|
|
60324
|
+
dedupe = {
|
|
60325
|
+
cancel: cancelFirstArg && cancelFirstArg.value.kind === "BooleanValue" && cancelFirstArg.value ? "first" : "last",
|
|
60326
|
+
match: matchArg && matchArg.value.kind === "EnumValue" ? matchArg.value.value : DedupeMatchMode.Operation
|
|
60327
|
+
};
|
|
60224
60328
|
}
|
|
60225
60329
|
selectionSet = operation.selectionSet;
|
|
60226
60330
|
if (originalParsed.definitions[0].kind === "OperationDefinition") {
|
|
@@ -63887,11 +63991,20 @@ directive @${config.paginateDirective}(${config.listOrPaginateNameArg}: String,
|
|
|
63887
63991
|
"""
|
|
63888
63992
|
directive @${config.listPrependDirective} on FRAGMENT_SPREAD
|
|
63889
63993
|
|
|
63994
|
+
enum DedupeMatchMode {
|
|
63995
|
+
${DedupeMatchMode.Variables}
|
|
63996
|
+
${DedupeMatchMode.Operation}
|
|
63997
|
+
${DedupeMatchMode.None}
|
|
63998
|
+
}
|
|
63999
|
+
|
|
63890
64000
|
"""
|
|
63891
64001
|
@${config.dedupeDirective} is used to prevent an operation from running more than once at the same time.
|
|
63892
64002
|
If the cancelFirst arg is set to true, the response already in flight will be canceled instead of the second one.
|
|
64003
|
+
If match is set to Operation, then a request will be deduplicated any time there is a request with the same operation.
|
|
64004
|
+
If it's set to Variables then the request will only be deduplicated if the variables match. If match is set to None,
|
|
64005
|
+
then the request will never be deduplicated.
|
|
63893
64006
|
"""
|
|
63894
|
-
directive @${config.dedupeDirective}(cancelFirst: Boolean) on QUERY | MUTATION
|
|
64007
|
+
directive @${config.dedupeDirective}(cancelFirst: Boolean, match: DedupeMatchMode) on QUERY | MUTATION
|
|
63895
64008
|
|
|
63896
64009
|
"""
|
|
63897
64010
|
@${config.optimisticKeyDirective} is used to identify a field as an optimistic key
|