houdini 1.0.0-next.3 → 1.0.0-next.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cmd-cjs/index.js +39 -43
- package/build/cmd-esm/index.js +39 -43
- package/build/codegen/generators/artifacts/selection.d.ts +3 -3
- package/build/codegen-cjs/index.js +37 -41
- package/build/codegen-esm/index.js +37 -41
- package/build/runtime/cache/cache.d.ts +3 -3
- package/build/runtime/client/documentStore.d.ts +1 -1
- package/build/runtime/client/plugins/fetchParams.d.ts +1 -1
- package/build/runtime/lib/types.d.ts +2 -3
- package/build/runtime-cjs/cache/cache.d.ts +3 -3
- package/build/runtime-cjs/cache/cache.js +30 -15
- package/build/runtime-cjs/cache/lists.js +3 -3
- package/build/runtime-cjs/client/documentStore.d.ts +1 -1
- package/build/runtime-cjs/client/plugins/fetchParams.d.ts +1 -1
- package/build/runtime-cjs/client/plugins/fetchParams.js +6 -1
- package/build/runtime-cjs/client/plugins/query.js +0 -1
- package/build/runtime-cjs/lib/types.d.ts +2 -3
- package/build/runtime-esm/cache/cache.d.ts +3 -3
- package/build/runtime-esm/cache/cache.js +30 -15
- package/build/runtime-esm/cache/lists.js +3 -3
- package/build/runtime-esm/client/documentStore.d.ts +1 -1
- package/build/runtime-esm/client/plugins/fetchParams.d.ts +1 -1
- package/build/runtime-esm/client/plugins/fetchParams.js +6 -1
- package/build/runtime-esm/client/plugins/query.js +0 -1
- package/build/runtime-esm/lib/types.d.ts +2 -3
- package/build/test-cjs/index.js +37 -41
- package/build/test-esm/index.js +37 -41
- package/build/vite-cjs/index.js +37 -41
- package/build/vite-esm/index.js +37 -41
- package/package.json +1 -1
package/build/cmd-cjs/index.js
CHANGED
|
@@ -71899,19 +71899,18 @@ async function paginate(config2, documents) {
|
|
|
71899
71899
|
paginated = true;
|
|
71900
71900
|
const fieldTypeFields = parentTypeFromAncestors(config2.schema, doc.filename, ancestors).getFields()[node.name.value];
|
|
71901
71901
|
const args = new Set(fieldTypeFields.args.map((arg) => arg.name));
|
|
71902
|
-
const passedArgs = new Set(node.arguments?.map((arg) => arg.name.value));
|
|
71903
|
-
const specifiedForwards = passedArgs.has("first");
|
|
71904
|
-
const specifiedBackwards = passedArgs.has("last");
|
|
71905
71902
|
cursorType = fieldTypeFields.args?.find((arg) => ["before", "after"].includes(arg.name))?.type?.name || "String";
|
|
71906
71903
|
flags.after.type = cursorType;
|
|
71907
71904
|
flags.before.type = cursorType;
|
|
71908
|
-
const
|
|
71909
|
-
const
|
|
71910
|
-
const
|
|
71911
|
-
|
|
71912
|
-
|
|
71913
|
-
flags.
|
|
71914
|
-
flags.
|
|
71905
|
+
const passedArgs = new Set(node.arguments?.map((arg) => arg.name.value));
|
|
71906
|
+
const forwards = args.has("first") && args.has("after");
|
|
71907
|
+
const backwards = args.has("last") && args.has("after");
|
|
71908
|
+
const cursorPagination = passedArgs.has("last") || passedArgs.has("first");
|
|
71909
|
+
const offsetPagination = !cursorPagination && args.has("offset") && args.has("limit");
|
|
71910
|
+
flags.first.enabled = forwards;
|
|
71911
|
+
flags.after.enabled = forwards;
|
|
71912
|
+
flags.last.enabled = backwards;
|
|
71913
|
+
flags.before.enabled = backwards;
|
|
71915
71914
|
flags.offset.enabled = offsetPagination;
|
|
71916
71915
|
flags.limit.enabled = offsetPagination;
|
|
71917
71916
|
paginationPath = ancestors.filter(
|
|
@@ -71931,10 +71930,6 @@ async function paginate(config2, documents) {
|
|
|
71931
71930
|
let fragmentName = "";
|
|
71932
71931
|
let refetchQueryName = "";
|
|
71933
71932
|
let nodeQuery = false;
|
|
71934
|
-
let refetchUpdate = "append" /* append */;
|
|
71935
|
-
if (flags.last.enabled) {
|
|
71936
|
-
refetchUpdate = "prepend" /* prepend */;
|
|
71937
|
-
}
|
|
71938
71933
|
let fragment = "";
|
|
71939
71934
|
doc.document = graphql10.visit(doc.document, {
|
|
71940
71935
|
OperationDefinition(node) {
|
|
@@ -72029,26 +72024,24 @@ async function paginate(config2, documents) {
|
|
|
72029
72024
|
targetType = fragment;
|
|
72030
72025
|
}
|
|
72031
72026
|
}
|
|
72027
|
+
const pageSize = flags.first.defaultValue ?? flags.last.defaultValue ?? flags.limit.defaultValue;
|
|
72028
|
+
const start = flags.after.defaultValue ?? flags.before.defaultValue ?? flags.offset.defaultValue;
|
|
72029
|
+
let direction = "forward";
|
|
72030
|
+
if (flags.before.enabled && flags.after.enabled) {
|
|
72031
|
+
direction = "both";
|
|
72032
|
+
} else if (flags.before.enabled) {
|
|
72033
|
+
direction = "backward";
|
|
72034
|
+
}
|
|
72032
72035
|
doc.refetch = {
|
|
72033
|
-
update: refetchUpdate,
|
|
72034
72036
|
path: paginationPath,
|
|
72035
72037
|
method: flags.first.enabled || flags.last.enabled ? "cursor" : "offset",
|
|
72036
|
-
pageSize
|
|
72038
|
+
pageSize,
|
|
72037
72039
|
embedded: nodeQuery,
|
|
72038
72040
|
targetType,
|
|
72039
72041
|
paginated: true,
|
|
72040
|
-
direction
|
|
72041
|
-
|
|
72042
|
-
|
|
72043
|
-
doc.refetch.pageSize = flags.first.defaultValue;
|
|
72044
|
-
doc.refetch.start = flags.after.defaultValue;
|
|
72045
|
-
} else if (flags.last.enabled) {
|
|
72046
|
-
doc.refetch.pageSize = flags.last.defaultValue;
|
|
72047
|
-
doc.refetch.start = flags.before.defaultValue;
|
|
72048
|
-
} else if (flags.limit.enabled) {
|
|
72049
|
-
doc.refetch.pageSize = flags.limit.defaultValue;
|
|
72050
|
-
doc.refetch.start = flags.offset.defaultValue;
|
|
72051
|
-
}
|
|
72042
|
+
direction,
|
|
72043
|
+
start
|
|
72044
|
+
};
|
|
72052
72045
|
if (!fragment) {
|
|
72053
72046
|
continue;
|
|
72054
72047
|
}
|
|
@@ -72224,12 +72217,6 @@ function replaceArgumentsWithVariables(args, flags) {
|
|
|
72224
72217
|
if (flags[name2].defaultValue || !spec.enabled || seenArgs[name2]) {
|
|
72225
72218
|
continue;
|
|
72226
72219
|
}
|
|
72227
|
-
if (["first", "after"].includes(name2) && flags["before"].enabled) {
|
|
72228
|
-
continue;
|
|
72229
|
-
}
|
|
72230
|
-
if (["last", "before"].includes(name2) && flags["first"].enabled) {
|
|
72231
|
-
continue;
|
|
72232
|
-
}
|
|
72233
72220
|
newArgs.push(variableAsArgument(name2));
|
|
72234
72221
|
}
|
|
72235
72222
|
return newArgs;
|
|
@@ -72737,7 +72724,7 @@ function selection({
|
|
|
72737
72724
|
path: path2 = [],
|
|
72738
72725
|
includeFragments,
|
|
72739
72726
|
document,
|
|
72740
|
-
|
|
72727
|
+
inConnection
|
|
72741
72728
|
}) {
|
|
72742
72729
|
let object = {};
|
|
72743
72730
|
const typeMap = {};
|
|
@@ -72879,14 +72866,23 @@ function selection({
|
|
|
72879
72866
|
(directive) => directive.name.value === config2.paginateDirective
|
|
72880
72867
|
);
|
|
72881
72868
|
if (paginated && document.refetch && document.refetch.method === "offset") {
|
|
72882
|
-
fieldObj.
|
|
72869
|
+
fieldObj.updates = ["append" /* append */];
|
|
72870
|
+
}
|
|
72871
|
+
let continueConnection = inConnection;
|
|
72872
|
+
if ([
|
|
72873
|
+
"edges",
|
|
72874
|
+
"endCursor",
|
|
72875
|
+
"startCursor",
|
|
72876
|
+
"hasNextPage",
|
|
72877
|
+
"hasPreviousPage"
|
|
72878
|
+
].includes(attributeName) && inConnection && document.refetch) {
|
|
72879
|
+
fieldObj.updates = ["append" /* append */, "prepend" /* prepend */];
|
|
72883
72880
|
}
|
|
72884
|
-
if (attributeName === "
|
|
72885
|
-
|
|
72886
|
-
markEdges = "";
|
|
72881
|
+
if (attributeName === "node" && inConnection) {
|
|
72882
|
+
continueConnection = false;
|
|
72887
72883
|
}
|
|
72888
72884
|
if (field.selectionSet) {
|
|
72889
|
-
const
|
|
72885
|
+
const connectionState = paginated && document.refetch?.method === "cursor" || continueConnection;
|
|
72890
72886
|
fieldObj.selection = selection({
|
|
72891
72887
|
config: config2,
|
|
72892
72888
|
filepath,
|
|
@@ -72896,7 +72892,7 @@ function selection({
|
|
|
72896
72892
|
path: pathSoFar,
|
|
72897
72893
|
includeFragments,
|
|
72898
72894
|
document,
|
|
72899
|
-
|
|
72895
|
+
inConnection: connectionState
|
|
72900
72896
|
});
|
|
72901
72897
|
}
|
|
72902
72898
|
if (field.arguments?.length && fieldObj.list) {
|
|
@@ -76278,8 +76274,8 @@ async function updatePackageJSON(targetPath) {
|
|
|
76278
76274
|
}
|
|
76279
76275
|
packageJSON.devDependencies = {
|
|
76280
76276
|
...packageJSON.devDependencies,
|
|
76281
|
-
houdini: "^1.0.0-next.
|
|
76282
|
-
"houdini-svelte": "^1.0.0-next.
|
|
76277
|
+
houdini: "^1.0.0-next.4",
|
|
76278
|
+
"houdini-svelte": "^1.0.0-next.4",
|
|
76283
76279
|
graphql: "^15.8.0"
|
|
76284
76280
|
};
|
|
76285
76281
|
await fs_exports.writeFile(packagePath, JSON.stringify(packageJSON, null, 4));
|
package/build/cmd-esm/index.js
CHANGED
|
@@ -71904,19 +71904,18 @@ async function paginate(config2, documents) {
|
|
|
71904
71904
|
paginated = true;
|
|
71905
71905
|
const fieldTypeFields = parentTypeFromAncestors(config2.schema, doc.filename, ancestors).getFields()[node.name.value];
|
|
71906
71906
|
const args = new Set(fieldTypeFields.args.map((arg) => arg.name));
|
|
71907
|
-
const passedArgs = new Set(node.arguments?.map((arg) => arg.name.value));
|
|
71908
|
-
const specifiedForwards = passedArgs.has("first");
|
|
71909
|
-
const specifiedBackwards = passedArgs.has("last");
|
|
71910
71907
|
cursorType = fieldTypeFields.args?.find((arg) => ["before", "after"].includes(arg.name))?.type?.name || "String";
|
|
71911
71908
|
flags.after.type = cursorType;
|
|
71912
71909
|
flags.before.type = cursorType;
|
|
71913
|
-
const
|
|
71914
|
-
const
|
|
71915
|
-
const
|
|
71916
|
-
|
|
71917
|
-
|
|
71918
|
-
flags.
|
|
71919
|
-
flags.
|
|
71910
|
+
const passedArgs = new Set(node.arguments?.map((arg) => arg.name.value));
|
|
71911
|
+
const forwards = args.has("first") && args.has("after");
|
|
71912
|
+
const backwards = args.has("last") && args.has("after");
|
|
71913
|
+
const cursorPagination = passedArgs.has("last") || passedArgs.has("first");
|
|
71914
|
+
const offsetPagination = !cursorPagination && args.has("offset") && args.has("limit");
|
|
71915
|
+
flags.first.enabled = forwards;
|
|
71916
|
+
flags.after.enabled = forwards;
|
|
71917
|
+
flags.last.enabled = backwards;
|
|
71918
|
+
flags.before.enabled = backwards;
|
|
71920
71919
|
flags.offset.enabled = offsetPagination;
|
|
71921
71920
|
flags.limit.enabled = offsetPagination;
|
|
71922
71921
|
paginationPath = ancestors.filter(
|
|
@@ -71936,10 +71935,6 @@ async function paginate(config2, documents) {
|
|
|
71936
71935
|
let fragmentName = "";
|
|
71937
71936
|
let refetchQueryName = "";
|
|
71938
71937
|
let nodeQuery = false;
|
|
71939
|
-
let refetchUpdate = "append" /* append */;
|
|
71940
|
-
if (flags.last.enabled) {
|
|
71941
|
-
refetchUpdate = "prepend" /* prepend */;
|
|
71942
|
-
}
|
|
71943
71938
|
let fragment = "";
|
|
71944
71939
|
doc.document = graphql10.visit(doc.document, {
|
|
71945
71940
|
OperationDefinition(node) {
|
|
@@ -72034,26 +72029,24 @@ async function paginate(config2, documents) {
|
|
|
72034
72029
|
targetType = fragment;
|
|
72035
72030
|
}
|
|
72036
72031
|
}
|
|
72032
|
+
const pageSize = flags.first.defaultValue ?? flags.last.defaultValue ?? flags.limit.defaultValue;
|
|
72033
|
+
const start = flags.after.defaultValue ?? flags.before.defaultValue ?? flags.offset.defaultValue;
|
|
72034
|
+
let direction = "forward";
|
|
72035
|
+
if (flags.before.enabled && flags.after.enabled) {
|
|
72036
|
+
direction = "both";
|
|
72037
|
+
} else if (flags.before.enabled) {
|
|
72038
|
+
direction = "backward";
|
|
72039
|
+
}
|
|
72037
72040
|
doc.refetch = {
|
|
72038
|
-
update: refetchUpdate,
|
|
72039
72041
|
path: paginationPath,
|
|
72040
72042
|
method: flags.first.enabled || flags.last.enabled ? "cursor" : "offset",
|
|
72041
|
-
pageSize
|
|
72043
|
+
pageSize,
|
|
72042
72044
|
embedded: nodeQuery,
|
|
72043
72045
|
targetType,
|
|
72044
72046
|
paginated: true,
|
|
72045
|
-
direction
|
|
72046
|
-
|
|
72047
|
-
|
|
72048
|
-
doc.refetch.pageSize = flags.first.defaultValue;
|
|
72049
|
-
doc.refetch.start = flags.after.defaultValue;
|
|
72050
|
-
} else if (flags.last.enabled) {
|
|
72051
|
-
doc.refetch.pageSize = flags.last.defaultValue;
|
|
72052
|
-
doc.refetch.start = flags.before.defaultValue;
|
|
72053
|
-
} else if (flags.limit.enabled) {
|
|
72054
|
-
doc.refetch.pageSize = flags.limit.defaultValue;
|
|
72055
|
-
doc.refetch.start = flags.offset.defaultValue;
|
|
72056
|
-
}
|
|
72047
|
+
direction,
|
|
72048
|
+
start
|
|
72049
|
+
};
|
|
72057
72050
|
if (!fragment) {
|
|
72058
72051
|
continue;
|
|
72059
72052
|
}
|
|
@@ -72229,12 +72222,6 @@ function replaceArgumentsWithVariables(args, flags) {
|
|
|
72229
72222
|
if (flags[name2].defaultValue || !spec.enabled || seenArgs[name2]) {
|
|
72230
72223
|
continue;
|
|
72231
72224
|
}
|
|
72232
|
-
if (["first", "after"].includes(name2) && flags["before"].enabled) {
|
|
72233
|
-
continue;
|
|
72234
|
-
}
|
|
72235
|
-
if (["last", "before"].includes(name2) && flags["first"].enabled) {
|
|
72236
|
-
continue;
|
|
72237
|
-
}
|
|
72238
72225
|
newArgs.push(variableAsArgument(name2));
|
|
72239
72226
|
}
|
|
72240
72227
|
return newArgs;
|
|
@@ -72742,7 +72729,7 @@ function selection({
|
|
|
72742
72729
|
path: path2 = [],
|
|
72743
72730
|
includeFragments,
|
|
72744
72731
|
document,
|
|
72745
|
-
|
|
72732
|
+
inConnection
|
|
72746
72733
|
}) {
|
|
72747
72734
|
let object = {};
|
|
72748
72735
|
const typeMap = {};
|
|
@@ -72884,14 +72871,23 @@ function selection({
|
|
|
72884
72871
|
(directive) => directive.name.value === config2.paginateDirective
|
|
72885
72872
|
);
|
|
72886
72873
|
if (paginated && document.refetch && document.refetch.method === "offset") {
|
|
72887
|
-
fieldObj.
|
|
72874
|
+
fieldObj.updates = ["append" /* append */];
|
|
72875
|
+
}
|
|
72876
|
+
let continueConnection = inConnection;
|
|
72877
|
+
if ([
|
|
72878
|
+
"edges",
|
|
72879
|
+
"endCursor",
|
|
72880
|
+
"startCursor",
|
|
72881
|
+
"hasNextPage",
|
|
72882
|
+
"hasPreviousPage"
|
|
72883
|
+
].includes(attributeName) && inConnection && document.refetch) {
|
|
72884
|
+
fieldObj.updates = ["append" /* append */, "prepend" /* prepend */];
|
|
72888
72885
|
}
|
|
72889
|
-
if (attributeName === "
|
|
72890
|
-
|
|
72891
|
-
markEdges = "";
|
|
72886
|
+
if (attributeName === "node" && inConnection) {
|
|
72887
|
+
continueConnection = false;
|
|
72892
72888
|
}
|
|
72893
72889
|
if (field.selectionSet) {
|
|
72894
|
-
const
|
|
72890
|
+
const connectionState = paginated && document.refetch?.method === "cursor" || continueConnection;
|
|
72895
72891
|
fieldObj.selection = selection({
|
|
72896
72892
|
config: config2,
|
|
72897
72893
|
filepath,
|
|
@@ -72901,7 +72897,7 @@ function selection({
|
|
|
72901
72897
|
path: pathSoFar,
|
|
72902
72898
|
includeFragments,
|
|
72903
72899
|
document,
|
|
72904
|
-
|
|
72900
|
+
inConnection: connectionState
|
|
72905
72901
|
});
|
|
72906
72902
|
}
|
|
72907
72903
|
if (field.arguments?.length && fieldObj.list) {
|
|
@@ -76283,8 +76279,8 @@ async function updatePackageJSON(targetPath) {
|
|
|
76283
76279
|
}
|
|
76284
76280
|
packageJSON.devDependencies = {
|
|
76285
76281
|
...packageJSON.devDependencies,
|
|
76286
|
-
houdini: "^1.0.0-next.
|
|
76287
|
-
"houdini-svelte": "^1.0.0-next.
|
|
76282
|
+
houdini: "^1.0.0-next.4",
|
|
76283
|
+
"houdini-svelte": "^1.0.0-next.4",
|
|
76288
76284
|
graphql: "^15.8.0"
|
|
76289
76285
|
};
|
|
76290
76286
|
await fs_exports.writeFile(packagePath, JSON.stringify(packageJSON, null, 4));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as graphql from 'graphql';
|
|
2
2
|
import type { Config, CollectedGraphQLDocument } from '../../../lib';
|
|
3
|
-
import type
|
|
4
|
-
export default function selection({ config, filepath, rootType, selections, operations, path, includeFragments, document,
|
|
3
|
+
import { type MutationOperation, type SubscriptionSelection } from '../../../runtime/lib/types';
|
|
4
|
+
export default function selection({ config, filepath, rootType, selections, operations, path, includeFragments, document, inConnection, }: {
|
|
5
5
|
config: Config;
|
|
6
6
|
filepath: string;
|
|
7
7
|
rootType: string;
|
|
@@ -12,5 +12,5 @@ export default function selection({ config, filepath, rootType, selections, oper
|
|
|
12
12
|
path?: string[];
|
|
13
13
|
includeFragments: boolean;
|
|
14
14
|
document: CollectedGraphQLDocument;
|
|
15
|
-
|
|
15
|
+
inConnection?: boolean;
|
|
16
16
|
}): SubscriptionSelection;
|
|
@@ -55693,19 +55693,18 @@ async function paginate(config2, documents) {
|
|
|
55693
55693
|
paginated = true;
|
|
55694
55694
|
const fieldTypeFields = parentTypeFromAncestors(config2.schema, doc.filename, ancestors).getFields()[node.name.value];
|
|
55695
55695
|
const args = new Set(fieldTypeFields.args.map((arg) => arg.name));
|
|
55696
|
-
const passedArgs = new Set(node.arguments?.map((arg) => arg.name.value));
|
|
55697
|
-
const specifiedForwards = passedArgs.has("first");
|
|
55698
|
-
const specifiedBackwards = passedArgs.has("last");
|
|
55699
55696
|
cursorType = fieldTypeFields.args?.find((arg) => ["before", "after"].includes(arg.name))?.type?.name || "String";
|
|
55700
55697
|
flags.after.type = cursorType;
|
|
55701
55698
|
flags.before.type = cursorType;
|
|
55702
|
-
const
|
|
55703
|
-
const
|
|
55704
|
-
const
|
|
55705
|
-
|
|
55706
|
-
|
|
55707
|
-
flags.
|
|
55708
|
-
flags.
|
|
55699
|
+
const passedArgs = new Set(node.arguments?.map((arg) => arg.name.value));
|
|
55700
|
+
const forwards = args.has("first") && args.has("after");
|
|
55701
|
+
const backwards = args.has("last") && args.has("after");
|
|
55702
|
+
const cursorPagination = passedArgs.has("last") || passedArgs.has("first");
|
|
55703
|
+
const offsetPagination = !cursorPagination && args.has("offset") && args.has("limit");
|
|
55704
|
+
flags.first.enabled = forwards;
|
|
55705
|
+
flags.after.enabled = forwards;
|
|
55706
|
+
flags.last.enabled = backwards;
|
|
55707
|
+
flags.before.enabled = backwards;
|
|
55709
55708
|
flags.offset.enabled = offsetPagination;
|
|
55710
55709
|
flags.limit.enabled = offsetPagination;
|
|
55711
55710
|
paginationPath = ancestors.filter(
|
|
@@ -55725,10 +55724,6 @@ async function paginate(config2, documents) {
|
|
|
55725
55724
|
let fragmentName = "";
|
|
55726
55725
|
let refetchQueryName = "";
|
|
55727
55726
|
let nodeQuery = false;
|
|
55728
|
-
let refetchUpdate = "append" /* append */;
|
|
55729
|
-
if (flags.last.enabled) {
|
|
55730
|
-
refetchUpdate = "prepend" /* prepend */;
|
|
55731
|
-
}
|
|
55732
55727
|
let fragment = "";
|
|
55733
55728
|
doc.document = graphql8.visit(doc.document, {
|
|
55734
55729
|
OperationDefinition(node) {
|
|
@@ -55823,26 +55818,24 @@ async function paginate(config2, documents) {
|
|
|
55823
55818
|
targetType = fragment;
|
|
55824
55819
|
}
|
|
55825
55820
|
}
|
|
55821
|
+
const pageSize = flags.first.defaultValue ?? flags.last.defaultValue ?? flags.limit.defaultValue;
|
|
55822
|
+
const start = flags.after.defaultValue ?? flags.before.defaultValue ?? flags.offset.defaultValue;
|
|
55823
|
+
let direction = "forward";
|
|
55824
|
+
if (flags.before.enabled && flags.after.enabled) {
|
|
55825
|
+
direction = "both";
|
|
55826
|
+
} else if (flags.before.enabled) {
|
|
55827
|
+
direction = "backward";
|
|
55828
|
+
}
|
|
55826
55829
|
doc.refetch = {
|
|
55827
|
-
update: refetchUpdate,
|
|
55828
55830
|
path: paginationPath,
|
|
55829
55831
|
method: flags.first.enabled || flags.last.enabled ? "cursor" : "offset",
|
|
55830
|
-
pageSize
|
|
55832
|
+
pageSize,
|
|
55831
55833
|
embedded: nodeQuery,
|
|
55832
55834
|
targetType,
|
|
55833
55835
|
paginated: true,
|
|
55834
|
-
direction
|
|
55835
|
-
|
|
55836
|
-
|
|
55837
|
-
doc.refetch.pageSize = flags.first.defaultValue;
|
|
55838
|
-
doc.refetch.start = flags.after.defaultValue;
|
|
55839
|
-
} else if (flags.last.enabled) {
|
|
55840
|
-
doc.refetch.pageSize = flags.last.defaultValue;
|
|
55841
|
-
doc.refetch.start = flags.before.defaultValue;
|
|
55842
|
-
} else if (flags.limit.enabled) {
|
|
55843
|
-
doc.refetch.pageSize = flags.limit.defaultValue;
|
|
55844
|
-
doc.refetch.start = flags.offset.defaultValue;
|
|
55845
|
-
}
|
|
55836
|
+
direction,
|
|
55837
|
+
start
|
|
55838
|
+
};
|
|
55846
55839
|
if (!fragment) {
|
|
55847
55840
|
continue;
|
|
55848
55841
|
}
|
|
@@ -56018,12 +56011,6 @@ function replaceArgumentsWithVariables(args, flags) {
|
|
|
56018
56011
|
if (flags[name2].defaultValue || !spec.enabled || seenArgs[name2]) {
|
|
56019
56012
|
continue;
|
|
56020
56013
|
}
|
|
56021
|
-
if (["first", "after"].includes(name2) && flags["before"].enabled) {
|
|
56022
|
-
continue;
|
|
56023
|
-
}
|
|
56024
|
-
if (["last", "before"].includes(name2) && flags["first"].enabled) {
|
|
56025
|
-
continue;
|
|
56026
|
-
}
|
|
56027
56014
|
newArgs.push(variableAsArgument(name2));
|
|
56028
56015
|
}
|
|
56029
56016
|
return newArgs;
|
|
@@ -56531,7 +56518,7 @@ function selection({
|
|
|
56531
56518
|
path: path2 = [],
|
|
56532
56519
|
includeFragments,
|
|
56533
56520
|
document,
|
|
56534
|
-
|
|
56521
|
+
inConnection
|
|
56535
56522
|
}) {
|
|
56536
56523
|
let object = {};
|
|
56537
56524
|
const typeMap = {};
|
|
@@ -56673,14 +56660,23 @@ function selection({
|
|
|
56673
56660
|
(directive) => directive.name.value === config2.paginateDirective
|
|
56674
56661
|
);
|
|
56675
56662
|
if (paginated && document.refetch && document.refetch.method === "offset") {
|
|
56676
|
-
fieldObj.
|
|
56663
|
+
fieldObj.updates = ["append" /* append */];
|
|
56664
|
+
}
|
|
56665
|
+
let continueConnection = inConnection;
|
|
56666
|
+
if ([
|
|
56667
|
+
"edges",
|
|
56668
|
+
"endCursor",
|
|
56669
|
+
"startCursor",
|
|
56670
|
+
"hasNextPage",
|
|
56671
|
+
"hasPreviousPage"
|
|
56672
|
+
].includes(attributeName) && inConnection && document.refetch) {
|
|
56673
|
+
fieldObj.updates = ["append" /* append */, "prepend" /* prepend */];
|
|
56677
56674
|
}
|
|
56678
|
-
if (attributeName === "
|
|
56679
|
-
|
|
56680
|
-
markEdges = "";
|
|
56675
|
+
if (attributeName === "node" && inConnection) {
|
|
56676
|
+
continueConnection = false;
|
|
56681
56677
|
}
|
|
56682
56678
|
if (field.selectionSet) {
|
|
56683
|
-
const
|
|
56679
|
+
const connectionState = paginated && document.refetch?.method === "cursor" || continueConnection;
|
|
56684
56680
|
fieldObj.selection = selection({
|
|
56685
56681
|
config: config2,
|
|
56686
56682
|
filepath,
|
|
@@ -56690,7 +56686,7 @@ function selection({
|
|
|
56690
56686
|
path: pathSoFar,
|
|
56691
56687
|
includeFragments,
|
|
56692
56688
|
document,
|
|
56693
|
-
|
|
56689
|
+
inConnection: connectionState
|
|
56694
56690
|
});
|
|
56695
56691
|
}
|
|
56696
56692
|
if (field.arguments?.length && fieldObj.list) {
|
|
@@ -55691,19 +55691,18 @@ async function paginate(config2, documents) {
|
|
|
55691
55691
|
paginated = true;
|
|
55692
55692
|
const fieldTypeFields = parentTypeFromAncestors(config2.schema, doc.filename, ancestors).getFields()[node.name.value];
|
|
55693
55693
|
const args = new Set(fieldTypeFields.args.map((arg) => arg.name));
|
|
55694
|
-
const passedArgs = new Set(node.arguments?.map((arg) => arg.name.value));
|
|
55695
|
-
const specifiedForwards = passedArgs.has("first");
|
|
55696
|
-
const specifiedBackwards = passedArgs.has("last");
|
|
55697
55694
|
cursorType = fieldTypeFields.args?.find((arg) => ["before", "after"].includes(arg.name))?.type?.name || "String";
|
|
55698
55695
|
flags.after.type = cursorType;
|
|
55699
55696
|
flags.before.type = cursorType;
|
|
55700
|
-
const
|
|
55701
|
-
const
|
|
55702
|
-
const
|
|
55703
|
-
|
|
55704
|
-
|
|
55705
|
-
flags.
|
|
55706
|
-
flags.
|
|
55697
|
+
const passedArgs = new Set(node.arguments?.map((arg) => arg.name.value));
|
|
55698
|
+
const forwards = args.has("first") && args.has("after");
|
|
55699
|
+
const backwards = args.has("last") && args.has("after");
|
|
55700
|
+
const cursorPagination = passedArgs.has("last") || passedArgs.has("first");
|
|
55701
|
+
const offsetPagination = !cursorPagination && args.has("offset") && args.has("limit");
|
|
55702
|
+
flags.first.enabled = forwards;
|
|
55703
|
+
flags.after.enabled = forwards;
|
|
55704
|
+
flags.last.enabled = backwards;
|
|
55705
|
+
flags.before.enabled = backwards;
|
|
55707
55706
|
flags.offset.enabled = offsetPagination;
|
|
55708
55707
|
flags.limit.enabled = offsetPagination;
|
|
55709
55708
|
paginationPath = ancestors.filter(
|
|
@@ -55723,10 +55722,6 @@ async function paginate(config2, documents) {
|
|
|
55723
55722
|
let fragmentName = "";
|
|
55724
55723
|
let refetchQueryName = "";
|
|
55725
55724
|
let nodeQuery = false;
|
|
55726
|
-
let refetchUpdate = "append" /* append */;
|
|
55727
|
-
if (flags.last.enabled) {
|
|
55728
|
-
refetchUpdate = "prepend" /* prepend */;
|
|
55729
|
-
}
|
|
55730
55725
|
let fragment = "";
|
|
55731
55726
|
doc.document = graphql8.visit(doc.document, {
|
|
55732
55727
|
OperationDefinition(node) {
|
|
@@ -55821,26 +55816,24 @@ async function paginate(config2, documents) {
|
|
|
55821
55816
|
targetType = fragment;
|
|
55822
55817
|
}
|
|
55823
55818
|
}
|
|
55819
|
+
const pageSize = flags.first.defaultValue ?? flags.last.defaultValue ?? flags.limit.defaultValue;
|
|
55820
|
+
const start = flags.after.defaultValue ?? flags.before.defaultValue ?? flags.offset.defaultValue;
|
|
55821
|
+
let direction = "forward";
|
|
55822
|
+
if (flags.before.enabled && flags.after.enabled) {
|
|
55823
|
+
direction = "both";
|
|
55824
|
+
} else if (flags.before.enabled) {
|
|
55825
|
+
direction = "backward";
|
|
55826
|
+
}
|
|
55824
55827
|
doc.refetch = {
|
|
55825
|
-
update: refetchUpdate,
|
|
55826
55828
|
path: paginationPath,
|
|
55827
55829
|
method: flags.first.enabled || flags.last.enabled ? "cursor" : "offset",
|
|
55828
|
-
pageSize
|
|
55830
|
+
pageSize,
|
|
55829
55831
|
embedded: nodeQuery,
|
|
55830
55832
|
targetType,
|
|
55831
55833
|
paginated: true,
|
|
55832
|
-
direction
|
|
55833
|
-
|
|
55834
|
-
|
|
55835
|
-
doc.refetch.pageSize = flags.first.defaultValue;
|
|
55836
|
-
doc.refetch.start = flags.after.defaultValue;
|
|
55837
|
-
} else if (flags.last.enabled) {
|
|
55838
|
-
doc.refetch.pageSize = flags.last.defaultValue;
|
|
55839
|
-
doc.refetch.start = flags.before.defaultValue;
|
|
55840
|
-
} else if (flags.limit.enabled) {
|
|
55841
|
-
doc.refetch.pageSize = flags.limit.defaultValue;
|
|
55842
|
-
doc.refetch.start = flags.offset.defaultValue;
|
|
55843
|
-
}
|
|
55834
|
+
direction,
|
|
55835
|
+
start
|
|
55836
|
+
};
|
|
55844
55837
|
if (!fragment) {
|
|
55845
55838
|
continue;
|
|
55846
55839
|
}
|
|
@@ -56016,12 +56009,6 @@ function replaceArgumentsWithVariables(args, flags) {
|
|
|
56016
56009
|
if (flags[name2].defaultValue || !spec.enabled || seenArgs[name2]) {
|
|
56017
56010
|
continue;
|
|
56018
56011
|
}
|
|
56019
|
-
if (["first", "after"].includes(name2) && flags["before"].enabled) {
|
|
56020
|
-
continue;
|
|
56021
|
-
}
|
|
56022
|
-
if (["last", "before"].includes(name2) && flags["first"].enabled) {
|
|
56023
|
-
continue;
|
|
56024
|
-
}
|
|
56025
56012
|
newArgs.push(variableAsArgument(name2));
|
|
56026
56013
|
}
|
|
56027
56014
|
return newArgs;
|
|
@@ -56529,7 +56516,7 @@ function selection({
|
|
|
56529
56516
|
path: path2 = [],
|
|
56530
56517
|
includeFragments,
|
|
56531
56518
|
document,
|
|
56532
|
-
|
|
56519
|
+
inConnection
|
|
56533
56520
|
}) {
|
|
56534
56521
|
let object = {};
|
|
56535
56522
|
const typeMap = {};
|
|
@@ -56671,14 +56658,23 @@ function selection({
|
|
|
56671
56658
|
(directive) => directive.name.value === config2.paginateDirective
|
|
56672
56659
|
);
|
|
56673
56660
|
if (paginated && document.refetch && document.refetch.method === "offset") {
|
|
56674
|
-
fieldObj.
|
|
56661
|
+
fieldObj.updates = ["append" /* append */];
|
|
56662
|
+
}
|
|
56663
|
+
let continueConnection = inConnection;
|
|
56664
|
+
if ([
|
|
56665
|
+
"edges",
|
|
56666
|
+
"endCursor",
|
|
56667
|
+
"startCursor",
|
|
56668
|
+
"hasNextPage",
|
|
56669
|
+
"hasPreviousPage"
|
|
56670
|
+
].includes(attributeName) && inConnection && document.refetch) {
|
|
56671
|
+
fieldObj.updates = ["append" /* append */, "prepend" /* prepend */];
|
|
56675
56672
|
}
|
|
56676
|
-
if (attributeName === "
|
|
56677
|
-
|
|
56678
|
-
markEdges = "";
|
|
56673
|
+
if (attributeName === "node" && inConnection) {
|
|
56674
|
+
continueConnection = false;
|
|
56679
56675
|
}
|
|
56680
56676
|
if (field.selectionSet) {
|
|
56681
|
-
const
|
|
56677
|
+
const connectionState = paginated && document.refetch?.method === "cursor" || continueConnection;
|
|
56682
56678
|
fieldObj.selection = selection({
|
|
56683
56679
|
config: config2,
|
|
56684
56680
|
filepath,
|
|
@@ -56688,7 +56684,7 @@ function selection({
|
|
|
56688
56684
|
path: pathSoFar,
|
|
56689
56685
|
includeFragments,
|
|
56690
56686
|
document,
|
|
56691
|
-
|
|
56687
|
+
inConnection: connectionState
|
|
56692
56688
|
});
|
|
56693
56689
|
}
|
|
56694
56690
|
if (field.arguments?.length && fieldObj.list) {
|
|
@@ -18,7 +18,7 @@ export declare class Cache {
|
|
|
18
18
|
variables?: {};
|
|
19
19
|
parent?: string;
|
|
20
20
|
layer?: LayerID | null;
|
|
21
|
-
applyUpdates?:
|
|
21
|
+
applyUpdates?: string[];
|
|
22
22
|
notifySubscribers?: SubscriptionSpec[];
|
|
23
23
|
forceNotify?: boolean;
|
|
24
24
|
}): SubscriptionSpec[];
|
|
@@ -62,7 +62,7 @@ declare class CacheInternal {
|
|
|
62
62
|
root?: string;
|
|
63
63
|
layer: Layer;
|
|
64
64
|
toNotify?: FieldSelection[];
|
|
65
|
-
applyUpdates?:
|
|
65
|
+
applyUpdates?: string[];
|
|
66
66
|
forceNotify?: boolean;
|
|
67
67
|
}): FieldSelection[];
|
|
68
68
|
getSelection({ selection, parent, variables, stepsFromConnection, }: {
|
|
@@ -97,7 +97,7 @@ declare class CacheInternal {
|
|
|
97
97
|
abstract: boolean;
|
|
98
98
|
variables: {};
|
|
99
99
|
specs: FieldSelection[];
|
|
100
|
-
applyUpdates
|
|
100
|
+
applyUpdates?: string[];
|
|
101
101
|
fields: SubscriptionSelection;
|
|
102
102
|
layer: Layer;
|
|
103
103
|
forceNotify?: boolean;
|
|
@@ -5,5 +5,5 @@ export declare const fetchParamsPlugin: (fn?: FetchParamFn) => ClientPlugin;
|
|
|
5
5
|
export type FetchParamsInput = Pick<ClientPluginContext, 'config' | 'policy' | 'variables' | 'metadata' | 'session' | 'stuff'> & {
|
|
6
6
|
text: string;
|
|
7
7
|
hash: string;
|
|
8
|
-
|
|
8
|
+
document: DocumentArtifact;
|
|
9
9
|
};
|
|
@@ -71,7 +71,6 @@ export type BaseCompiledDocument = {
|
|
|
71
71
|
rootType: string;
|
|
72
72
|
input?: InputObject;
|
|
73
73
|
refetch?: {
|
|
74
|
-
update: RefetchUpdateMode;
|
|
75
74
|
path: string[];
|
|
76
75
|
method: 'cursor' | 'offset';
|
|
77
76
|
pageSize: number;
|
|
@@ -79,7 +78,7 @@ export type BaseCompiledDocument = {
|
|
|
79
78
|
embedded: boolean;
|
|
80
79
|
targetType: string;
|
|
81
80
|
paginated: boolean;
|
|
82
|
-
direction
|
|
81
|
+
direction: 'forward' | 'backward' | 'both';
|
|
83
82
|
};
|
|
84
83
|
pluginsData?: Record<string, any>;
|
|
85
84
|
};
|
|
@@ -135,7 +134,7 @@ export type SubscriptionSelection = {
|
|
|
135
134
|
connection: boolean;
|
|
136
135
|
type: string;
|
|
137
136
|
};
|
|
138
|
-
|
|
137
|
+
updates?: string[];
|
|
139
138
|
filters?: {
|
|
140
139
|
[key: string]: {
|
|
141
140
|
kind: 'Boolean' | 'String' | 'Float' | 'Int' | 'Variable';
|