houdini-svelte 1.0.11 → 1.1.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/plugin-cjs/index.js +451 -227
- package/build/plugin-esm/index.js +451 -227
- package/build/preprocess-cjs/index.js +497 -216
- package/build/preprocess-esm/index.js +497 -216
- package/build/runtime/fragments.d.ts +4 -4
- package/build/runtime/stores/base.d.ts +1 -1
- package/build/runtime/stores/fragment.d.ts +7 -2
- package/build/runtime/stores/pagination/cursor.d.ts +4 -3
- package/build/runtime/stores/pagination/fragment.d.ts +3 -2
- package/build/runtime/stores/pagination/offset.d.ts +3 -3
- package/build/runtime/types.d.ts +2 -2
- package/build/runtime-cjs/fragments.d.ts +4 -4
- package/build/runtime-cjs/stores/base.d.ts +1 -1
- package/build/runtime-cjs/stores/base.js +2 -1
- package/build/runtime-cjs/stores/fragment.d.ts +7 -2
- package/build/runtime-cjs/stores/fragment.js +41 -5
- package/build/runtime-cjs/stores/pagination/cursor.d.ts +4 -3
- package/build/runtime-cjs/stores/pagination/cursor.js +14 -11
- package/build/runtime-cjs/stores/pagination/fragment.d.ts +3 -2
- package/build/runtime-cjs/stores/pagination/fragment.js +74 -32
- package/build/runtime-cjs/stores/pagination/offset.d.ts +3 -3
- package/build/runtime-cjs/stores/pagination/offset.js +5 -6
- package/build/runtime-cjs/stores/pagination/query.js +5 -2
- package/build/runtime-cjs/stores/query.js +2 -2
- package/build/runtime-cjs/types.d.ts +2 -2
- package/build/runtime-esm/fragments.d.ts +4 -4
- package/build/runtime-esm/stores/base.d.ts +1 -1
- package/build/runtime-esm/stores/base.js +2 -1
- package/build/runtime-esm/stores/fragment.d.ts +7 -2
- package/build/runtime-esm/stores/fragment.js +37 -7
- package/build/runtime-esm/stores/pagination/cursor.d.ts +4 -3
- package/build/runtime-esm/stores/pagination/cursor.js +15 -12
- package/build/runtime-esm/stores/pagination/fragment.d.ts +3 -2
- package/build/runtime-esm/stores/pagination/fragment.js +74 -32
- package/build/runtime-esm/stores/pagination/offset.d.ts +3 -3
- package/build/runtime-esm/stores/pagination/offset.js +5 -6
- package/build/runtime-esm/stores/pagination/query.js +6 -3
- package/build/runtime-esm/stores/query.js +2 -2
- package/build/runtime-esm/types.d.ts +2 -2
- package/build/test-cjs/index.js +1414 -765
- package/build/test-esm/index.js +1414 -765
- package/package.json +2 -2
|
@@ -6802,8 +6802,8 @@ var require_KnownFragmentNamesRule2 = __commonJS({
|
|
|
6802
6802
|
return {
|
|
6803
6803
|
FragmentSpread: function FragmentSpread(node2) {
|
|
6804
6804
|
var fragmentName = node2.name.value;
|
|
6805
|
-
var
|
|
6806
|
-
if (!
|
|
6805
|
+
var fragment4 = context.getFragment(fragmentName);
|
|
6806
|
+
if (!fragment4) {
|
|
6807
6807
|
context.reportError(new _GraphQLError.GraphQLError('Unknown fragment "'.concat(fragmentName, '".'), node2.name));
|
|
6808
6808
|
}
|
|
6809
6809
|
}
|
|
@@ -6839,8 +6839,8 @@ var require_NoUnusedFragmentsRule2 = __commonJS({
|
|
|
6839
6839
|
for (var _i2 = 0; _i2 < operationDefs.length; _i2++) {
|
|
6840
6840
|
var operation = operationDefs[_i2];
|
|
6841
6841
|
for (var _i4 = 0, _context$getRecursive2 = context.getRecursivelyReferencedFragments(operation); _i4 < _context$getRecursive2.length; _i4++) {
|
|
6842
|
-
var
|
|
6843
|
-
fragmentNameUsed[
|
|
6842
|
+
var fragment4 = _context$getRecursive2[_i4];
|
|
6843
|
+
fragmentNameUsed[fragment4.name.value] = true;
|
|
6844
6844
|
}
|
|
6845
6845
|
}
|
|
6846
6846
|
for (var _i6 = 0; _i6 < fragmentDefs.length; _i6++) {
|
|
@@ -6930,13 +6930,13 @@ var require_NoFragmentCyclesRule2 = __commonJS({
|
|
|
6930
6930
|
return false;
|
|
6931
6931
|
}
|
|
6932
6932
|
};
|
|
6933
|
-
function detectCycleRecursive(
|
|
6934
|
-
if (visitedFrags[
|
|
6933
|
+
function detectCycleRecursive(fragment4) {
|
|
6934
|
+
if (visitedFrags[fragment4.name.value]) {
|
|
6935
6935
|
return;
|
|
6936
6936
|
}
|
|
6937
|
-
var fragmentName =
|
|
6937
|
+
var fragmentName = fragment4.name.value;
|
|
6938
6938
|
visitedFrags[fragmentName] = true;
|
|
6939
|
-
var spreadNodes = context.getFragmentSpreads(
|
|
6939
|
+
var spreadNodes = context.getFragmentSpreads(fragment4.selectionSet);
|
|
6940
6940
|
if (spreadNodes.length === 0) {
|
|
6941
6941
|
return;
|
|
6942
6942
|
}
|
|
@@ -7757,11 +7757,11 @@ var require_OverlappingFieldsCanBeMergedRule2 = __commonJS({
|
|
|
7757
7757
|
return conflicts;
|
|
7758
7758
|
}
|
|
7759
7759
|
function collectConflictsBetweenFieldsAndFragment(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fieldMap, fragmentName) {
|
|
7760
|
-
var
|
|
7761
|
-
if (!
|
|
7760
|
+
var fragment4 = context.getFragment(fragmentName);
|
|
7761
|
+
if (!fragment4) {
|
|
7762
7762
|
return;
|
|
7763
7763
|
}
|
|
7764
|
-
var _getReferencedFieldsA = getReferencedFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames,
|
|
7764
|
+
var _getReferencedFieldsA = getReferencedFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames, fragment4), fieldMap2 = _getReferencedFieldsA[0], fragmentNames2 = _getReferencedFieldsA[1];
|
|
7765
7765
|
if (fieldMap === fieldMap2) {
|
|
7766
7766
|
return;
|
|
7767
7767
|
}
|
|
@@ -7779,12 +7779,12 @@ var require_OverlappingFieldsCanBeMergedRule2 = __commonJS({
|
|
|
7779
7779
|
}
|
|
7780
7780
|
comparedFragmentPairs.add(fragmentName1, fragmentName2, areMutuallyExclusive);
|
|
7781
7781
|
var fragment1 = context.getFragment(fragmentName1);
|
|
7782
|
-
var
|
|
7783
|
-
if (!fragment1 || !
|
|
7782
|
+
var fragment22 = context.getFragment(fragmentName2);
|
|
7783
|
+
if (!fragment1 || !fragment22) {
|
|
7784
7784
|
return;
|
|
7785
7785
|
}
|
|
7786
7786
|
var _getReferencedFieldsA2 = getReferencedFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames, fragment1), fieldMap1 = _getReferencedFieldsA2[0], fragmentNames1 = _getReferencedFieldsA2[1];
|
|
7787
|
-
var _getReferencedFieldsA3 = getReferencedFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames,
|
|
7787
|
+
var _getReferencedFieldsA3 = getReferencedFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames, fragment22), fieldMap2 = _getReferencedFieldsA3[0], fragmentNames2 = _getReferencedFieldsA3[1];
|
|
7788
7788
|
collectConflictsBetween(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fieldMap1, fieldMap2);
|
|
7789
7789
|
for (var j = 0; j < fragmentNames2.length; j++) {
|
|
7790
7790
|
collectConflictsBetweenFragments(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fragmentName1, fragmentNames2[j]);
|
|
@@ -7932,13 +7932,13 @@ var require_OverlappingFieldsCanBeMergedRule2 = __commonJS({
|
|
|
7932
7932
|
}
|
|
7933
7933
|
return cached;
|
|
7934
7934
|
}
|
|
7935
|
-
function getReferencedFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames,
|
|
7936
|
-
var cached = cachedFieldsAndFragmentNames.get(
|
|
7935
|
+
function getReferencedFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames, fragment4) {
|
|
7936
|
+
var cached = cachedFieldsAndFragmentNames.get(fragment4.selectionSet);
|
|
7937
7937
|
if (cached) {
|
|
7938
7938
|
return cached;
|
|
7939
7939
|
}
|
|
7940
|
-
var fragmentType = (0, _typeFromAST.typeFromAST)(context.getSchema(),
|
|
7941
|
-
return getFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames, fragmentType,
|
|
7940
|
+
var fragmentType = (0, _typeFromAST.typeFromAST)(context.getSchema(), fragment4.typeCondition);
|
|
7941
|
+
return getFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames, fragmentType, fragment4.selectionSet);
|
|
7942
7942
|
}
|
|
7943
7943
|
function _collectFieldsAndFragmentNames(context, parentType, selectionSet, nodeAndDefs, fragmentNames) {
|
|
7944
7944
|
for (var _i9 = 0, _selectionSet$selecti2 = selectionSet.selections; _i9 < _selectionSet$selecti2.length; _i9++) {
|
|
@@ -8524,10 +8524,10 @@ var require_ValidationContext2 = __commonJS({
|
|
|
8524
8524
|
var fragName = spread.name.value;
|
|
8525
8525
|
if (collectedNames[fragName] !== true) {
|
|
8526
8526
|
collectedNames[fragName] = true;
|
|
8527
|
-
var
|
|
8528
|
-
if (
|
|
8529
|
-
fragments.push(
|
|
8530
|
-
nodesToVisit.push(
|
|
8527
|
+
var fragment4 = this.getFragment(fragName);
|
|
8528
|
+
if (fragment4) {
|
|
8529
|
+
fragments.push(fragment4);
|
|
8530
|
+
nodesToVisit.push(fragment4.selectionSet);
|
|
8531
8531
|
}
|
|
8532
8532
|
}
|
|
8533
8533
|
}
|
|
@@ -9466,11 +9466,11 @@ var require_execute2 = __commonJS({
|
|
|
9466
9466
|
continue;
|
|
9467
9467
|
}
|
|
9468
9468
|
visitedFragmentNames[fragName] = true;
|
|
9469
|
-
var
|
|
9470
|
-
if (!
|
|
9469
|
+
var fragment4 = exeContext.fragments[fragName];
|
|
9470
|
+
if (!fragment4 || !doesFragmentConditionMatch(exeContext, fragment4, runtimeType)) {
|
|
9471
9471
|
continue;
|
|
9472
9472
|
}
|
|
9473
|
-
collectFields(exeContext, runtimeType,
|
|
9473
|
+
collectFields(exeContext, runtimeType, fragment4.selectionSet, fields, visitedFragmentNames);
|
|
9474
9474
|
break;
|
|
9475
9475
|
}
|
|
9476
9476
|
}
|
|
@@ -9488,8 +9488,8 @@ var require_execute2 = __commonJS({
|
|
|
9488
9488
|
}
|
|
9489
9489
|
return true;
|
|
9490
9490
|
}
|
|
9491
|
-
function doesFragmentConditionMatch(exeContext,
|
|
9492
|
-
var typeConditionNode =
|
|
9491
|
+
function doesFragmentConditionMatch(exeContext, fragment4, type) {
|
|
9492
|
+
var typeConditionNode = fragment4.typeCondition;
|
|
9493
9493
|
if (!typeConditionNode) {
|
|
9494
9494
|
return true;
|
|
9495
9495
|
}
|
|
@@ -37750,8 +37750,8 @@ var require_KnownFragmentNamesRule = __commonJS2({
|
|
|
37750
37750
|
return {
|
|
37751
37751
|
FragmentSpread: function FragmentSpread(node2) {
|
|
37752
37752
|
var fragmentName = node2.name.value;
|
|
37753
|
-
var
|
|
37754
|
-
if (!
|
|
37753
|
+
var fragment22 = context.getFragment(fragmentName);
|
|
37754
|
+
if (!fragment22) {
|
|
37755
37755
|
context.reportError(new _GraphQLError.GraphQLError('Unknown fragment "'.concat(fragmentName, '".'), node2.name));
|
|
37756
37756
|
}
|
|
37757
37757
|
}
|
|
@@ -37785,8 +37785,8 @@ var require_NoUnusedFragmentsRule = __commonJS2({
|
|
|
37785
37785
|
for (var _i2 = 0; _i2 < operationDefs.length; _i2++) {
|
|
37786
37786
|
var operation = operationDefs[_i2];
|
|
37787
37787
|
for (var _i4 = 0, _context$getRecursive2 = context.getRecursivelyReferencedFragments(operation); _i4 < _context$getRecursive2.length; _i4++) {
|
|
37788
|
-
var
|
|
37789
|
-
fragmentNameUsed[
|
|
37788
|
+
var fragment22 = _context$getRecursive2[_i4];
|
|
37789
|
+
fragmentNameUsed[fragment22.name.value] = true;
|
|
37790
37790
|
}
|
|
37791
37791
|
}
|
|
37792
37792
|
for (var _i6 = 0; _i6 < fragmentDefs.length; _i6++) {
|
|
@@ -37872,13 +37872,13 @@ var require_NoFragmentCyclesRule = __commonJS2({
|
|
|
37872
37872
|
return false;
|
|
37873
37873
|
}
|
|
37874
37874
|
};
|
|
37875
|
-
function detectCycleRecursive(
|
|
37876
|
-
if (visitedFrags[
|
|
37875
|
+
function detectCycleRecursive(fragment22) {
|
|
37876
|
+
if (visitedFrags[fragment22.name.value]) {
|
|
37877
37877
|
return;
|
|
37878
37878
|
}
|
|
37879
|
-
var fragmentName =
|
|
37879
|
+
var fragmentName = fragment22.name.value;
|
|
37880
37880
|
visitedFrags[fragmentName] = true;
|
|
37881
|
-
var spreadNodes = context.getFragmentSpreads(
|
|
37881
|
+
var spreadNodes = context.getFragmentSpreads(fragment22.selectionSet);
|
|
37882
37882
|
if (spreadNodes.length === 0) {
|
|
37883
37883
|
return;
|
|
37884
37884
|
}
|
|
@@ -38677,11 +38677,11 @@ var require_OverlappingFieldsCanBeMergedRule = __commonJS2({
|
|
|
38677
38677
|
return conflicts;
|
|
38678
38678
|
}
|
|
38679
38679
|
function collectConflictsBetweenFieldsAndFragment(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fieldMap, fragmentName) {
|
|
38680
|
-
var
|
|
38681
|
-
if (!
|
|
38680
|
+
var fragment22 = context.getFragment(fragmentName);
|
|
38681
|
+
if (!fragment22) {
|
|
38682
38682
|
return;
|
|
38683
38683
|
}
|
|
38684
|
-
var _getReferencedFieldsA = getReferencedFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames,
|
|
38684
|
+
var _getReferencedFieldsA = getReferencedFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames, fragment22), fieldMap2 = _getReferencedFieldsA[0], fragmentNames2 = _getReferencedFieldsA[1];
|
|
38685
38685
|
if (fieldMap === fieldMap2) {
|
|
38686
38686
|
return;
|
|
38687
38687
|
}
|
|
@@ -38699,12 +38699,12 @@ var require_OverlappingFieldsCanBeMergedRule = __commonJS2({
|
|
|
38699
38699
|
}
|
|
38700
38700
|
comparedFragmentPairs.add(fragmentName1, fragmentName2, areMutuallyExclusive);
|
|
38701
38701
|
var fragment1 = context.getFragment(fragmentName1);
|
|
38702
|
-
var
|
|
38703
|
-
if (!fragment1 || !
|
|
38702
|
+
var fragment22 = context.getFragment(fragmentName2);
|
|
38703
|
+
if (!fragment1 || !fragment22) {
|
|
38704
38704
|
return;
|
|
38705
38705
|
}
|
|
38706
38706
|
var _getReferencedFieldsA2 = getReferencedFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames, fragment1), fieldMap1 = _getReferencedFieldsA2[0], fragmentNames1 = _getReferencedFieldsA2[1];
|
|
38707
|
-
var _getReferencedFieldsA3 = getReferencedFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames,
|
|
38707
|
+
var _getReferencedFieldsA3 = getReferencedFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames, fragment22), fieldMap2 = _getReferencedFieldsA3[0], fragmentNames2 = _getReferencedFieldsA3[1];
|
|
38708
38708
|
collectConflictsBetween(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fieldMap1, fieldMap2);
|
|
38709
38709
|
for (var j = 0; j < fragmentNames2.length; j++) {
|
|
38710
38710
|
collectConflictsBetweenFragments(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fragmentName1, fragmentNames2[j]);
|
|
@@ -38852,13 +38852,13 @@ var require_OverlappingFieldsCanBeMergedRule = __commonJS2({
|
|
|
38852
38852
|
}
|
|
38853
38853
|
return cached;
|
|
38854
38854
|
}
|
|
38855
|
-
function getReferencedFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames,
|
|
38856
|
-
var cached = cachedFieldsAndFragmentNames.get(
|
|
38855
|
+
function getReferencedFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames, fragment22) {
|
|
38856
|
+
var cached = cachedFieldsAndFragmentNames.get(fragment22.selectionSet);
|
|
38857
38857
|
if (cached) {
|
|
38858
38858
|
return cached;
|
|
38859
38859
|
}
|
|
38860
|
-
var fragmentType = (0, _typeFromAST.typeFromAST)(context.getSchema(),
|
|
38861
|
-
return getFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames, fragmentType,
|
|
38860
|
+
var fragmentType = (0, _typeFromAST.typeFromAST)(context.getSchema(), fragment22.typeCondition);
|
|
38861
|
+
return getFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames, fragmentType, fragment22.selectionSet);
|
|
38862
38862
|
}
|
|
38863
38863
|
function _collectFieldsAndFragmentNames(context, parentType, selectionSet, nodeAndDefs, fragmentNames) {
|
|
38864
38864
|
for (var _i9 = 0, _selectionSet$selecti2 = selectionSet.selections; _i9 < _selectionSet$selecti2.length; _i9++) {
|
|
@@ -39424,10 +39424,10 @@ var require_ValidationContext = __commonJS2({
|
|
|
39424
39424
|
var fragName = spread.name.value;
|
|
39425
39425
|
if (collectedNames[fragName] !== true) {
|
|
39426
39426
|
collectedNames[fragName] = true;
|
|
39427
|
-
var
|
|
39428
|
-
if (
|
|
39429
|
-
fragments.push(
|
|
39430
|
-
nodesToVisit.push(
|
|
39427
|
+
var fragment22 = this.getFragment(fragName);
|
|
39428
|
+
if (fragment22) {
|
|
39429
|
+
fragments.push(fragment22);
|
|
39430
|
+
nodesToVisit.push(fragment22.selectionSet);
|
|
39431
39431
|
}
|
|
39432
39432
|
}
|
|
39433
39433
|
}
|
|
@@ -40344,11 +40344,11 @@ var require_execute = __commonJS2({
|
|
|
40344
40344
|
continue;
|
|
40345
40345
|
}
|
|
40346
40346
|
visitedFragmentNames[fragName] = true;
|
|
40347
|
-
var
|
|
40348
|
-
if (!
|
|
40347
|
+
var fragment22 = exeContext.fragments[fragName];
|
|
40348
|
+
if (!fragment22 || !doesFragmentConditionMatch(exeContext, fragment22, runtimeType)) {
|
|
40349
40349
|
continue;
|
|
40350
40350
|
}
|
|
40351
|
-
collectFields(exeContext, runtimeType,
|
|
40351
|
+
collectFields(exeContext, runtimeType, fragment22.selectionSet, fields, visitedFragmentNames);
|
|
40352
40352
|
break;
|
|
40353
40353
|
}
|
|
40354
40354
|
}
|
|
@@ -40366,8 +40366,8 @@ var require_execute = __commonJS2({
|
|
|
40366
40366
|
}
|
|
40367
40367
|
return true;
|
|
40368
40368
|
}
|
|
40369
|
-
function doesFragmentConditionMatch(exeContext,
|
|
40370
|
-
var typeConditionNode =
|
|
40369
|
+
function doesFragmentConditionMatch(exeContext, fragment22, type) {
|
|
40370
|
+
var typeConditionNode = fragment22.typeCondition;
|
|
40371
40371
|
if (!typeConditionNode) {
|
|
40372
40372
|
return true;
|
|
40373
40373
|
}
|
|
@@ -89475,6 +89475,7 @@ var DataSource = {
|
|
|
89475
89475
|
Network: "network",
|
|
89476
89476
|
Ssr: "ssr"
|
|
89477
89477
|
};
|
|
89478
|
+
var fragmentKey = " $fragments";
|
|
89478
89479
|
var computeKey = ({ field, args }) => {
|
|
89479
89480
|
const keys2 = Object.keys(args ?? {});
|
|
89480
89481
|
keys2.sort();
|
|
@@ -90743,7 +90744,8 @@ var List = class {
|
|
|
90743
90744
|
this.cache._internal_unstable.getSelection({
|
|
90744
90745
|
parent: spec.parentID || this.manager.rootID,
|
|
90745
90746
|
selection: spec.selection,
|
|
90746
|
-
variables: spec.variables?.() || {}
|
|
90747
|
+
variables: spec.variables?.() || {},
|
|
90748
|
+
ignoreMasking: false
|
|
90747
90749
|
}).data
|
|
90748
90750
|
);
|
|
90749
90751
|
}
|
|
@@ -91353,7 +91355,17 @@ var InMemorySubscriptions = class {
|
|
|
91353
91355
|
const __typename = this.cache._internal_unstable.storage.get(parent, "__typename").value;
|
|
91354
91356
|
let targetSelection = getFieldsForType(selection, __typename);
|
|
91355
91357
|
for (const fieldSelection of Object.values(targetSelection || {})) {
|
|
91356
|
-
const {
|
|
91358
|
+
const {
|
|
91359
|
+
keyRaw,
|
|
91360
|
+
selection: innerSelection,
|
|
91361
|
+
type,
|
|
91362
|
+
list,
|
|
91363
|
+
filters,
|
|
91364
|
+
visible
|
|
91365
|
+
} = fieldSelection;
|
|
91366
|
+
if (!visible) {
|
|
91367
|
+
continue;
|
|
91368
|
+
}
|
|
91357
91369
|
const key = evaluateKey(keyRaw, variables);
|
|
91358
91370
|
let targetSelection2;
|
|
91359
91371
|
if (innerSelection) {
|
|
@@ -91427,7 +91439,6 @@ var InMemorySubscriptions = class {
|
|
|
91427
91439
|
const counts = this.referenceCounts[id2][key];
|
|
91428
91440
|
counts.set(spec.set, (counts.get(spec.set) || 0) + 1);
|
|
91429
91441
|
this.cache._internal_unstable.lifetimes.resetLifetime(id2, key);
|
|
91430
|
-
const { selection: innerSelection } = selection[1]?.[key] ?? {};
|
|
91431
91442
|
}
|
|
91432
91443
|
registerList({
|
|
91433
91444
|
list,
|
|
@@ -91579,7 +91590,7 @@ var InMemorySubscriptions = class {
|
|
|
91579
91590
|
};
|
|
91580
91591
|
var Cache = class {
|
|
91581
91592
|
_internal_unstable;
|
|
91582
|
-
constructor(config4) {
|
|
91593
|
+
constructor({ disabled, ...config4 } = {}) {
|
|
91583
91594
|
this._internal_unstable = new CacheInternal({
|
|
91584
91595
|
cache: this,
|
|
91585
91596
|
storage: new InMemoryStorage(),
|
|
@@ -91587,9 +91598,10 @@ var Cache = class {
|
|
|
91587
91598
|
lists: new ListManager(this, rootID),
|
|
91588
91599
|
lifetimes: new GarbageCollector(this),
|
|
91589
91600
|
staleManager: new StaleManager(this),
|
|
91590
|
-
schema: new SchemaManager(this)
|
|
91601
|
+
schema: new SchemaManager(this),
|
|
91602
|
+
disabled: disabled ?? typeof globalThis.window === "undefined"
|
|
91591
91603
|
});
|
|
91592
|
-
if (config4) {
|
|
91604
|
+
if (Object.keys(config4).length > 0) {
|
|
91593
91605
|
this.setConfig(defaultConfigValues(config4));
|
|
91594
91606
|
}
|
|
91595
91607
|
}
|
|
@@ -91608,7 +91620,8 @@ var Cache = class {
|
|
|
91608
91620
|
this._internal_unstable.getSelection({
|
|
91609
91621
|
parent: spec.parentID || rootID,
|
|
91610
91622
|
selection: spec.selection,
|
|
91611
|
-
variables: spec.variables?.() || {}
|
|
91623
|
+
variables: spec.variables?.() || {},
|
|
91624
|
+
ignoreMasking: false
|
|
91612
91625
|
}).data
|
|
91613
91626
|
);
|
|
91614
91627
|
}
|
|
@@ -91683,16 +91696,13 @@ var Cache = class {
|
|
|
91683
91696
|
getFieldTime(id2, field) {
|
|
91684
91697
|
return this._internal_unstable.staleManager.getFieldTime(id2, field);
|
|
91685
91698
|
}
|
|
91699
|
+
config() {
|
|
91700
|
+
return this._internal_unstable.config;
|
|
91701
|
+
}
|
|
91686
91702
|
};
|
|
91687
91703
|
var CacheInternal = class {
|
|
91688
91704
|
_disabled = false;
|
|
91689
|
-
|
|
91690
|
-
plugins: {
|
|
91691
|
-
"houdini-svelte": {
|
|
91692
|
-
client: ""
|
|
91693
|
-
}
|
|
91694
|
-
}
|
|
91695
|
-
});
|
|
91705
|
+
_config;
|
|
91696
91706
|
storage;
|
|
91697
91707
|
subscriptions;
|
|
91698
91708
|
lists;
|
|
@@ -91707,7 +91717,9 @@ var CacheInternal = class {
|
|
|
91707
91717
|
cache,
|
|
91708
91718
|
lifetimes,
|
|
91709
91719
|
staleManager,
|
|
91710
|
-
schema
|
|
91720
|
+
schema,
|
|
91721
|
+
disabled,
|
|
91722
|
+
config: config4
|
|
91711
91723
|
}) {
|
|
91712
91724
|
this.storage = storage;
|
|
91713
91725
|
this.subscriptions = subscriptions;
|
|
@@ -91716,7 +91728,8 @@ var CacheInternal = class {
|
|
|
91716
91728
|
this.lifetimes = lifetimes;
|
|
91717
91729
|
this.staleManager = staleManager;
|
|
91718
91730
|
this.schema = schema;
|
|
91719
|
-
this.
|
|
91731
|
+
this._config = config4;
|
|
91732
|
+
this._disabled = disabled;
|
|
91720
91733
|
try {
|
|
91721
91734
|
if (process.env.HOUDINI_TEST === "true") {
|
|
91722
91735
|
this._disabled = false;
|
|
@@ -91724,8 +91737,11 @@ var CacheInternal = class {
|
|
|
91724
91737
|
} catch {
|
|
91725
91738
|
}
|
|
91726
91739
|
}
|
|
91740
|
+
get config() {
|
|
91741
|
+
return this._config ?? getCurrentConfig();
|
|
91742
|
+
}
|
|
91727
91743
|
setConfig(config4) {
|
|
91728
|
-
this.
|
|
91744
|
+
this._config = config4;
|
|
91729
91745
|
}
|
|
91730
91746
|
writeSelection({
|
|
91731
91747
|
data: data2,
|
|
@@ -92002,12 +92018,24 @@ var CacheInternal = class {
|
|
|
92002
92018
|
selection,
|
|
92003
92019
|
parent = rootID,
|
|
92004
92020
|
variables,
|
|
92005
|
-
stepsFromConnection = null
|
|
92021
|
+
stepsFromConnection = null,
|
|
92022
|
+
ignoreMasking
|
|
92006
92023
|
}) {
|
|
92007
92024
|
if (parent === null) {
|
|
92008
92025
|
return { data: null, partial: false, stale: false, hasData: true };
|
|
92009
92026
|
}
|
|
92010
92027
|
const target = {};
|
|
92028
|
+
if (selection.fragments) {
|
|
92029
|
+
target[fragmentKey] = Object.fromEntries(
|
|
92030
|
+
Object.entries(selection.fragments).map(([key, value2]) => [
|
|
92031
|
+
key,
|
|
92032
|
+
{
|
|
92033
|
+
parent,
|
|
92034
|
+
variables: evaluateFragmentVariables(value2, variables ?? {})
|
|
92035
|
+
}
|
|
92036
|
+
])
|
|
92037
|
+
);
|
|
92038
|
+
}
|
|
92011
92039
|
let hasData = false;
|
|
92012
92040
|
let partial = false;
|
|
92013
92041
|
let cascadeNull = false;
|
|
@@ -92016,8 +92044,11 @@ var CacheInternal = class {
|
|
|
92016
92044
|
let targetSelection = getFieldsForType(selection, typename);
|
|
92017
92045
|
for (const [
|
|
92018
92046
|
attributeName,
|
|
92019
|
-
{ type, keyRaw, selection: fieldSelection, nullable, list }
|
|
92047
|
+
{ type, keyRaw, selection: fieldSelection, nullable, list, visible }
|
|
92020
92048
|
] of Object.entries(targetSelection)) {
|
|
92049
|
+
if (!visible && !ignoreMasking) {
|
|
92050
|
+
continue;
|
|
92051
|
+
}
|
|
92021
92052
|
const key = evaluateKey(keyRaw, variables);
|
|
92022
92053
|
const { value: value2 } = this.storage.get(parent, key);
|
|
92023
92054
|
const dt_field = this.staleManager.getFieldTime(parent, key);
|
|
@@ -92057,7 +92088,8 @@ var CacheInternal = class {
|
|
|
92057
92088
|
fields: fieldSelection,
|
|
92058
92089
|
variables,
|
|
92059
92090
|
linkedList: value2,
|
|
92060
|
-
stepsFromConnection: nextStep
|
|
92091
|
+
stepsFromConnection: nextStep,
|
|
92092
|
+
ignoreMasking: !!ignoreMasking
|
|
92061
92093
|
});
|
|
92062
92094
|
target[attributeName] = listValue.data;
|
|
92063
92095
|
if (listValue.partial) {
|
|
@@ -92074,7 +92106,8 @@ var CacheInternal = class {
|
|
|
92074
92106
|
parent: value2,
|
|
92075
92107
|
selection: fieldSelection,
|
|
92076
92108
|
variables,
|
|
92077
|
-
stepsFromConnection: nextStep
|
|
92109
|
+
stepsFromConnection: nextStep,
|
|
92110
|
+
ignoreMasking
|
|
92078
92111
|
});
|
|
92079
92112
|
target[attributeName] = objectFields.data;
|
|
92080
92113
|
if (objectFields.partial) {
|
|
@@ -92118,7 +92151,8 @@ var CacheInternal = class {
|
|
|
92118
92151
|
fields,
|
|
92119
92152
|
variables,
|
|
92120
92153
|
linkedList,
|
|
92121
|
-
stepsFromConnection
|
|
92154
|
+
stepsFromConnection,
|
|
92155
|
+
ignoreMasking
|
|
92122
92156
|
}) {
|
|
92123
92157
|
const result = [];
|
|
92124
92158
|
let partialData = false;
|
|
@@ -92130,7 +92164,8 @@ var CacheInternal = class {
|
|
|
92130
92164
|
fields,
|
|
92131
92165
|
variables,
|
|
92132
92166
|
linkedList: entry,
|
|
92133
|
-
stepsFromConnection
|
|
92167
|
+
stepsFromConnection,
|
|
92168
|
+
ignoreMasking
|
|
92134
92169
|
});
|
|
92135
92170
|
result.push(nestedValue.data);
|
|
92136
92171
|
if (nestedValue.partial) {
|
|
@@ -92151,7 +92186,8 @@ var CacheInternal = class {
|
|
|
92151
92186
|
parent: entry,
|
|
92152
92187
|
selection: fields,
|
|
92153
92188
|
variables,
|
|
92154
|
-
stepsFromConnection
|
|
92189
|
+
stepsFromConnection,
|
|
92190
|
+
ignoreMasking
|
|
92155
92191
|
});
|
|
92156
92192
|
result.push(data2);
|
|
92157
92193
|
if (partial) {
|
|
@@ -92254,8 +92290,49 @@ var CacheInternal = class {
|
|
|
92254
92290
|
}
|
|
92255
92291
|
}
|
|
92256
92292
|
};
|
|
92293
|
+
function evaluateFragmentVariables(variables, args) {
|
|
92294
|
+
return Object.fromEntries(
|
|
92295
|
+
Object.entries(variables).map(([key, value2]) => [key, fragmentVariableValue(value2, args)])
|
|
92296
|
+
);
|
|
92297
|
+
}
|
|
92298
|
+
function fragmentVariableValue(value2, args) {
|
|
92299
|
+
if (value2.kind === "StringValue") {
|
|
92300
|
+
return value2.value;
|
|
92301
|
+
}
|
|
92302
|
+
if (value2.kind === "BooleanValue") {
|
|
92303
|
+
return value2.value;
|
|
92304
|
+
}
|
|
92305
|
+
if (value2.kind === "EnumValue") {
|
|
92306
|
+
return value2.value;
|
|
92307
|
+
}
|
|
92308
|
+
if (value2.kind === "FloatValue") {
|
|
92309
|
+
return parseFloat(value2.value);
|
|
92310
|
+
}
|
|
92311
|
+
if (value2.kind === "IntValue") {
|
|
92312
|
+
return parseInt(value2.value, 10);
|
|
92313
|
+
}
|
|
92314
|
+
if (value2.kind === "NullValue") {
|
|
92315
|
+
return null;
|
|
92316
|
+
}
|
|
92317
|
+
if (value2.kind === "Variable") {
|
|
92318
|
+
return args[value2.name.value];
|
|
92319
|
+
}
|
|
92320
|
+
if (value2.kind === "ListValue") {
|
|
92321
|
+
return value2.values.map((value22) => fragmentVariableValue(value22, args));
|
|
92322
|
+
}
|
|
92323
|
+
if (value2.kind === "ObjectValue") {
|
|
92324
|
+
return value2.fields.reduce(
|
|
92325
|
+
(obj, field) => ({
|
|
92326
|
+
...obj,
|
|
92327
|
+
[field.name.value]: fragmentVariableValue(field.value, args)
|
|
92328
|
+
}),
|
|
92329
|
+
{}
|
|
92330
|
+
);
|
|
92331
|
+
}
|
|
92332
|
+
}
|
|
92257
92333
|
var rootID = "_ROOT_";
|
|
92258
92334
|
var cache_default = new Cache();
|
|
92335
|
+
var serverSide = typeof globalThis.window === "undefined";
|
|
92259
92336
|
var documentPlugin = (kind, source) => {
|
|
92260
92337
|
return () => {
|
|
92261
92338
|
const sourceHandlers = source();
|
|
@@ -92288,7 +92365,6 @@ var documentPlugin = (kind, source) => {
|
|
|
92288
92365
|
var query = documentPlugin(ArtifactKind.Query, function() {
|
|
92289
92366
|
let subscriptionSpec = null;
|
|
92290
92367
|
let lastVariables = null;
|
|
92291
|
-
let artifactName = "";
|
|
92292
92368
|
return {
|
|
92293
92369
|
start(ctx, { next }) {
|
|
92294
92370
|
ctx.variables = {
|
|
@@ -92298,8 +92374,7 @@ var query = documentPlugin(ArtifactKind.Query, function() {
|
|
|
92298
92374
|
next(ctx);
|
|
92299
92375
|
},
|
|
92300
92376
|
end(ctx, { resolve: resolve22, marshalVariables: marshalVariables2, variablesChanged: variablesChanged2 }) {
|
|
92301
|
-
if (variablesChanged2(ctx)) {
|
|
92302
|
-
artifactName = ctx.artifact.name;
|
|
92377
|
+
if (variablesChanged2(ctx) && !ctx.cacheParams?.disableSubscriptions) {
|
|
92303
92378
|
if (subscriptionSpec) {
|
|
92304
92379
|
cache_default.unsubscribe(subscriptionSpec, subscriptionSpec.variables?.() || {});
|
|
92305
92380
|
}
|
|
@@ -92320,18 +92395,58 @@ var query = documentPlugin(ArtifactKind.Query, function() {
|
|
|
92320
92395
|
});
|
|
92321
92396
|
}
|
|
92322
92397
|
};
|
|
92323
|
-
cache_default.subscribe(subscriptionSpec, lastVariables
|
|
92398
|
+
cache_default.subscribe(subscriptionSpec, lastVariables);
|
|
92324
92399
|
}
|
|
92325
92400
|
resolve22(ctx);
|
|
92326
92401
|
},
|
|
92327
92402
|
cleanup() {
|
|
92328
92403
|
if (subscriptionSpec) {
|
|
92329
|
-
cache_default.unsubscribe(subscriptionSpec, subscriptionSpec.variables?.()
|
|
92404
|
+
cache_default.unsubscribe(subscriptionSpec, subscriptionSpec.variables?.());
|
|
92330
92405
|
lastVariables = null;
|
|
92331
92406
|
}
|
|
92332
92407
|
}
|
|
92333
92408
|
};
|
|
92334
92409
|
});
|
|
92410
|
+
var fragment = documentPlugin(ArtifactKind.Fragment, function() {
|
|
92411
|
+
let subscriptionSpec = null;
|
|
92412
|
+
return {
|
|
92413
|
+
start(ctx, { next, resolve: resolve22, variablesChanged: variablesChanged2, marshalVariables: marshalVariables2 }) {
|
|
92414
|
+
if (!ctx.stuff.parentID) {
|
|
92415
|
+
return next(ctx);
|
|
92416
|
+
}
|
|
92417
|
+
if (variablesChanged2(ctx) && !ctx.cacheParams?.disableSubscriptions) {
|
|
92418
|
+
if (subscriptionSpec) {
|
|
92419
|
+
cache_default.unsubscribe(subscriptionSpec, subscriptionSpec.variables?.() || {});
|
|
92420
|
+
}
|
|
92421
|
+
const variables = marshalVariables2(ctx);
|
|
92422
|
+
subscriptionSpec = {
|
|
92423
|
+
rootType: ctx.artifact.rootType,
|
|
92424
|
+
selection: ctx.artifact.selection,
|
|
92425
|
+
variables: () => variables,
|
|
92426
|
+
parentID: ctx.stuff.parentID,
|
|
92427
|
+
set: (newValue) => {
|
|
92428
|
+
resolve22(ctx, {
|
|
92429
|
+
data: newValue,
|
|
92430
|
+
errors: null,
|
|
92431
|
+
fetching: false,
|
|
92432
|
+
partial: false,
|
|
92433
|
+
stale: false,
|
|
92434
|
+
source: DataSource.Cache,
|
|
92435
|
+
variables
|
|
92436
|
+
});
|
|
92437
|
+
}
|
|
92438
|
+
};
|
|
92439
|
+
cache_default.subscribe(subscriptionSpec, variables);
|
|
92440
|
+
}
|
|
92441
|
+
next(ctx);
|
|
92442
|
+
},
|
|
92443
|
+
cleanup() {
|
|
92444
|
+
if (subscriptionSpec) {
|
|
92445
|
+
cache_default.unsubscribe(subscriptionSpec, subscriptionSpec.variables?.());
|
|
92446
|
+
}
|
|
92447
|
+
}
|
|
92448
|
+
};
|
|
92449
|
+
});
|
|
92335
92450
|
var mutation = documentPlugin(ArtifactKind.Mutation, () => {
|
|
92336
92451
|
return {
|
|
92337
92452
|
async start(ctx, { next, marshalVariables: marshalVariables2 }) {
|
|
@@ -100135,7 +100250,7 @@ var require_definition3 = __commonJS3({
|
|
|
100135
100250
|
exports.assertLeafType = assertLeafType;
|
|
100136
100251
|
exports.isCompositeType = isCompositeType;
|
|
100137
100252
|
exports.assertCompositeType = assertCompositeType;
|
|
100138
|
-
exports.isAbstractType =
|
|
100253
|
+
exports.isAbstractType = isAbstractType4;
|
|
100139
100254
|
exports.assertAbstractType = assertAbstractType;
|
|
100140
100255
|
exports.GraphQLList = GraphQLList6;
|
|
100141
100256
|
exports.GraphQLNonNull = GraphQLNonNull6;
|
|
@@ -100306,11 +100421,11 @@ var require_definition3 = __commonJS3({
|
|
|
100306
100421
|
}
|
|
100307
100422
|
return type;
|
|
100308
100423
|
}
|
|
100309
|
-
function
|
|
100424
|
+
function isAbstractType4(type) {
|
|
100310
100425
|
return isInterfaceType12(type) || isUnionType13(type);
|
|
100311
100426
|
}
|
|
100312
100427
|
function assertAbstractType(type) {
|
|
100313
|
-
if (!
|
|
100428
|
+
if (!isAbstractType4(type)) {
|
|
100314
100429
|
throw new Error("Expected ".concat((0, _inspect.default)(type), " to be a GraphQL abstract type."));
|
|
100315
100430
|
}
|
|
100316
100431
|
return type;
|
|
@@ -103524,8 +103639,8 @@ var require_KnownFragmentNamesRule3 = __commonJS3({
|
|
|
103524
103639
|
return {
|
|
103525
103640
|
FragmentSpread: function FragmentSpread(node2) {
|
|
103526
103641
|
var fragmentName = node2.name.value;
|
|
103527
|
-
var
|
|
103528
|
-
if (!
|
|
103642
|
+
var fragment22 = context.getFragment(fragmentName);
|
|
103643
|
+
if (!fragment22) {
|
|
103529
103644
|
context.reportError(new _GraphQLError.GraphQLError('Unknown fragment "'.concat(fragmentName, '".'), node2.name));
|
|
103530
103645
|
}
|
|
103531
103646
|
}
|
|
@@ -103559,8 +103674,8 @@ var require_NoUnusedFragmentsRule3 = __commonJS3({
|
|
|
103559
103674
|
for (var _i2 = 0; _i2 < operationDefs.length; _i2++) {
|
|
103560
103675
|
var operation = operationDefs[_i2];
|
|
103561
103676
|
for (var _i4 = 0, _context$getRecursive2 = context.getRecursivelyReferencedFragments(operation); _i4 < _context$getRecursive2.length; _i4++) {
|
|
103562
|
-
var
|
|
103563
|
-
fragmentNameUsed[
|
|
103677
|
+
var fragment22 = _context$getRecursive2[_i4];
|
|
103678
|
+
fragmentNameUsed[fragment22.name.value] = true;
|
|
103564
103679
|
}
|
|
103565
103680
|
}
|
|
103566
103681
|
for (var _i6 = 0; _i6 < fragmentDefs.length; _i6++) {
|
|
@@ -103646,13 +103761,13 @@ var require_NoFragmentCyclesRule3 = __commonJS3({
|
|
|
103646
103761
|
return false;
|
|
103647
103762
|
}
|
|
103648
103763
|
};
|
|
103649
|
-
function detectCycleRecursive(
|
|
103650
|
-
if (visitedFrags[
|
|
103764
|
+
function detectCycleRecursive(fragment22) {
|
|
103765
|
+
if (visitedFrags[fragment22.name.value]) {
|
|
103651
103766
|
return;
|
|
103652
103767
|
}
|
|
103653
|
-
var fragmentName =
|
|
103768
|
+
var fragmentName = fragment22.name.value;
|
|
103654
103769
|
visitedFrags[fragmentName] = true;
|
|
103655
|
-
var spreadNodes = context.getFragmentSpreads(
|
|
103770
|
+
var spreadNodes = context.getFragmentSpreads(fragment22.selectionSet);
|
|
103656
103771
|
if (spreadNodes.length === 0) {
|
|
103657
103772
|
return;
|
|
103658
103773
|
}
|
|
@@ -104451,11 +104566,11 @@ var require_OverlappingFieldsCanBeMergedRule3 = __commonJS3({
|
|
|
104451
104566
|
return conflicts;
|
|
104452
104567
|
}
|
|
104453
104568
|
function collectConflictsBetweenFieldsAndFragment(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fieldMap, fragmentName) {
|
|
104454
|
-
var
|
|
104455
|
-
if (!
|
|
104569
|
+
var fragment22 = context.getFragment(fragmentName);
|
|
104570
|
+
if (!fragment22) {
|
|
104456
104571
|
return;
|
|
104457
104572
|
}
|
|
104458
|
-
var _getReferencedFieldsA = getReferencedFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames,
|
|
104573
|
+
var _getReferencedFieldsA = getReferencedFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames, fragment22), fieldMap2 = _getReferencedFieldsA[0], fragmentNames2 = _getReferencedFieldsA[1];
|
|
104459
104574
|
if (fieldMap === fieldMap2) {
|
|
104460
104575
|
return;
|
|
104461
104576
|
}
|
|
@@ -104473,12 +104588,12 @@ var require_OverlappingFieldsCanBeMergedRule3 = __commonJS3({
|
|
|
104473
104588
|
}
|
|
104474
104589
|
comparedFragmentPairs.add(fragmentName1, fragmentName2, areMutuallyExclusive);
|
|
104475
104590
|
var fragment1 = context.getFragment(fragmentName1);
|
|
104476
|
-
var
|
|
104477
|
-
if (!fragment1 || !
|
|
104591
|
+
var fragment22 = context.getFragment(fragmentName2);
|
|
104592
|
+
if (!fragment1 || !fragment22) {
|
|
104478
104593
|
return;
|
|
104479
104594
|
}
|
|
104480
104595
|
var _getReferencedFieldsA2 = getReferencedFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames, fragment1), fieldMap1 = _getReferencedFieldsA2[0], fragmentNames1 = _getReferencedFieldsA2[1];
|
|
104481
|
-
var _getReferencedFieldsA3 = getReferencedFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames,
|
|
104596
|
+
var _getReferencedFieldsA3 = getReferencedFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames, fragment22), fieldMap2 = _getReferencedFieldsA3[0], fragmentNames2 = _getReferencedFieldsA3[1];
|
|
104482
104597
|
collectConflictsBetween(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fieldMap1, fieldMap2);
|
|
104483
104598
|
for (var j = 0; j < fragmentNames2.length; j++) {
|
|
104484
104599
|
collectConflictsBetweenFragments(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fragmentName1, fragmentNames2[j]);
|
|
@@ -104626,38 +104741,38 @@ var require_OverlappingFieldsCanBeMergedRule3 = __commonJS3({
|
|
|
104626
104741
|
}
|
|
104627
104742
|
return cached;
|
|
104628
104743
|
}
|
|
104629
|
-
function getReferencedFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames,
|
|
104630
|
-
var cached = cachedFieldsAndFragmentNames.get(
|
|
104744
|
+
function getReferencedFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames, fragment22) {
|
|
104745
|
+
var cached = cachedFieldsAndFragmentNames.get(fragment22.selectionSet);
|
|
104631
104746
|
if (cached) {
|
|
104632
104747
|
return cached;
|
|
104633
104748
|
}
|
|
104634
|
-
var fragmentType = (0, _typeFromAST.typeFromAST)(context.getSchema(),
|
|
104635
|
-
return getFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames, fragmentType,
|
|
104749
|
+
var fragmentType = (0, _typeFromAST.typeFromAST)(context.getSchema(), fragment22.typeCondition);
|
|
104750
|
+
return getFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames, fragmentType, fragment22.selectionSet);
|
|
104636
104751
|
}
|
|
104637
104752
|
function _collectFieldsAndFragmentNames(context, parentType, selectionSet, nodeAndDefs, fragmentNames) {
|
|
104638
104753
|
for (var _i9 = 0, _selectionSet$selecti2 = selectionSet.selections; _i9 < _selectionSet$selecti2.length; _i9++) {
|
|
104639
|
-
var
|
|
104640
|
-
switch (
|
|
104754
|
+
var selection = _selectionSet$selecti2[_i9];
|
|
104755
|
+
switch (selection.kind) {
|
|
104641
104756
|
case _kinds.Kind.FIELD: {
|
|
104642
|
-
var fieldName =
|
|
104757
|
+
var fieldName = selection.name.value;
|
|
104643
104758
|
var fieldDef = void 0;
|
|
104644
104759
|
if ((0, _definition.isObjectType)(parentType) || (0, _definition.isInterfaceType)(parentType)) {
|
|
104645
104760
|
fieldDef = parentType.getFields()[fieldName];
|
|
104646
104761
|
}
|
|
104647
|
-
var responseName =
|
|
104762
|
+
var responseName = selection.alias ? selection.alias.value : fieldName;
|
|
104648
104763
|
if (!nodeAndDefs[responseName]) {
|
|
104649
104764
|
nodeAndDefs[responseName] = [];
|
|
104650
104765
|
}
|
|
104651
|
-
nodeAndDefs[responseName].push([parentType,
|
|
104766
|
+
nodeAndDefs[responseName].push([parentType, selection, fieldDef]);
|
|
104652
104767
|
break;
|
|
104653
104768
|
}
|
|
104654
104769
|
case _kinds.Kind.FRAGMENT_SPREAD:
|
|
104655
|
-
fragmentNames[
|
|
104770
|
+
fragmentNames[selection.name.value] = true;
|
|
104656
104771
|
break;
|
|
104657
104772
|
case _kinds.Kind.INLINE_FRAGMENT: {
|
|
104658
|
-
var typeCondition =
|
|
104773
|
+
var typeCondition = selection.typeCondition;
|
|
104659
104774
|
var inlineFragmentType = typeCondition ? (0, _typeFromAST.typeFromAST)(context.getSchema(), typeCondition) : parentType;
|
|
104660
|
-
_collectFieldsAndFragmentNames(context, inlineFragmentType,
|
|
104775
|
+
_collectFieldsAndFragmentNames(context, inlineFragmentType, selection.selectionSet, nodeAndDefs, fragmentNames);
|
|
104661
104776
|
break;
|
|
104662
104777
|
}
|
|
104663
104778
|
}
|
|
@@ -105173,11 +105288,11 @@ var require_ValidationContext3 = __commonJS3({
|
|
|
105173
105288
|
while (setsToVisit.length !== 0) {
|
|
105174
105289
|
var set = setsToVisit.pop();
|
|
105175
105290
|
for (var _i2 = 0, _set$selections2 = set.selections; _i2 < _set$selections2.length; _i2++) {
|
|
105176
|
-
var
|
|
105177
|
-
if (
|
|
105178
|
-
spreads.push(
|
|
105179
|
-
} else if (
|
|
105180
|
-
setsToVisit.push(
|
|
105291
|
+
var selection = _set$selections2[_i2];
|
|
105292
|
+
if (selection.kind === _kinds.Kind.FRAGMENT_SPREAD) {
|
|
105293
|
+
spreads.push(selection);
|
|
105294
|
+
} else if (selection.selectionSet) {
|
|
105295
|
+
setsToVisit.push(selection.selectionSet);
|
|
105181
105296
|
}
|
|
105182
105297
|
}
|
|
105183
105298
|
}
|
|
@@ -105198,10 +105313,10 @@ var require_ValidationContext3 = __commonJS3({
|
|
|
105198
105313
|
var fragName = spread.name.value;
|
|
105199
105314
|
if (collectedNames[fragName] !== true) {
|
|
105200
105315
|
collectedNames[fragName] = true;
|
|
105201
|
-
var
|
|
105202
|
-
if (
|
|
105203
|
-
fragments.push(
|
|
105204
|
-
nodesToVisit.push(
|
|
105316
|
+
var fragment22 = this.getFragment(fragName);
|
|
105317
|
+
if (fragment22) {
|
|
105318
|
+
fragments.push(fragment22);
|
|
105319
|
+
nodesToVisit.push(fragment22.selectionSet);
|
|
105205
105320
|
}
|
|
105206
105321
|
}
|
|
105207
105322
|
}
|
|
@@ -106092,37 +106207,37 @@ var require_execute3 = __commonJS3({
|
|
|
106092
106207
|
}
|
|
106093
106208
|
function collectFields(exeContext, runtimeType, selectionSet, fields, visitedFragmentNames) {
|
|
106094
106209
|
for (var _i6 = 0, _selectionSet$selecti2 = selectionSet.selections; _i6 < _selectionSet$selecti2.length; _i6++) {
|
|
106095
|
-
var
|
|
106096
|
-
switch (
|
|
106210
|
+
var selection = _selectionSet$selecti2[_i6];
|
|
106211
|
+
switch (selection.kind) {
|
|
106097
106212
|
case _kinds.Kind.FIELD: {
|
|
106098
|
-
if (!shouldIncludeNode(exeContext,
|
|
106213
|
+
if (!shouldIncludeNode(exeContext, selection)) {
|
|
106099
106214
|
continue;
|
|
106100
106215
|
}
|
|
106101
|
-
var name = getFieldEntryKey(
|
|
106216
|
+
var name = getFieldEntryKey(selection);
|
|
106102
106217
|
if (!fields[name]) {
|
|
106103
106218
|
fields[name] = [];
|
|
106104
106219
|
}
|
|
106105
|
-
fields[name].push(
|
|
106220
|
+
fields[name].push(selection);
|
|
106106
106221
|
break;
|
|
106107
106222
|
}
|
|
106108
106223
|
case _kinds.Kind.INLINE_FRAGMENT: {
|
|
106109
|
-
if (!shouldIncludeNode(exeContext,
|
|
106224
|
+
if (!shouldIncludeNode(exeContext, selection) || !doesFragmentConditionMatch(exeContext, selection, runtimeType)) {
|
|
106110
106225
|
continue;
|
|
106111
106226
|
}
|
|
106112
|
-
collectFields(exeContext, runtimeType,
|
|
106227
|
+
collectFields(exeContext, runtimeType, selection.selectionSet, fields, visitedFragmentNames);
|
|
106113
106228
|
break;
|
|
106114
106229
|
}
|
|
106115
106230
|
case _kinds.Kind.FRAGMENT_SPREAD: {
|
|
106116
|
-
var fragName =
|
|
106117
|
-
if (visitedFragmentNames[fragName] || !shouldIncludeNode(exeContext,
|
|
106231
|
+
var fragName = selection.name.value;
|
|
106232
|
+
if (visitedFragmentNames[fragName] || !shouldIncludeNode(exeContext, selection)) {
|
|
106118
106233
|
continue;
|
|
106119
106234
|
}
|
|
106120
106235
|
visitedFragmentNames[fragName] = true;
|
|
106121
|
-
var
|
|
106122
|
-
if (!
|
|
106236
|
+
var fragment22 = exeContext.fragments[fragName];
|
|
106237
|
+
if (!fragment22 || !doesFragmentConditionMatch(exeContext, fragment22, runtimeType)) {
|
|
106123
106238
|
continue;
|
|
106124
106239
|
}
|
|
106125
|
-
collectFields(exeContext, runtimeType,
|
|
106240
|
+
collectFields(exeContext, runtimeType, fragment22.selectionSet, fields, visitedFragmentNames);
|
|
106126
106241
|
break;
|
|
106127
106242
|
}
|
|
106128
106243
|
}
|
|
@@ -106140,8 +106255,8 @@ var require_execute3 = __commonJS3({
|
|
|
106140
106255
|
}
|
|
106141
106256
|
return true;
|
|
106142
106257
|
}
|
|
106143
|
-
function doesFragmentConditionMatch(exeContext,
|
|
106144
|
-
var typeConditionNode =
|
|
106258
|
+
function doesFragmentConditionMatch(exeContext, fragment22, type) {
|
|
106259
|
+
var typeConditionNode = fragment22.typeCondition;
|
|
106145
106260
|
if (!typeConditionNode) {
|
|
106146
106261
|
return true;
|
|
106147
106262
|
}
|
|
@@ -154552,20 +154667,20 @@ function deepEquals2(objA, objB, map = /* @__PURE__ */ new WeakMap()) {
|
|
|
154552
154667
|
}
|
|
154553
154668
|
return true;
|
|
154554
154669
|
}
|
|
154555
|
-
function getFieldsForType2(
|
|
154556
|
-
let targetSelection =
|
|
154557
|
-
if (
|
|
154558
|
-
const mappedType =
|
|
154670
|
+
function getFieldsForType2(selection, __typename) {
|
|
154671
|
+
let targetSelection = selection.fields || {};
|
|
154672
|
+
if (selection.abstractFields && __typename) {
|
|
154673
|
+
const mappedType = selection.abstractFields.typeMap[__typename];
|
|
154559
154674
|
if (mappedType) {
|
|
154560
|
-
targetSelection =
|
|
154561
|
-
} else if (
|
|
154562
|
-
targetSelection =
|
|
154675
|
+
targetSelection = selection.abstractFields.fields[mappedType];
|
|
154676
|
+
} else if (selection.abstractFields.fields[__typename]) {
|
|
154677
|
+
targetSelection = selection.abstractFields.fields[__typename];
|
|
154563
154678
|
}
|
|
154564
154679
|
}
|
|
154565
154680
|
return targetSelection;
|
|
154566
154681
|
}
|
|
154567
154682
|
async function marshalSelection2({
|
|
154568
|
-
selection
|
|
154683
|
+
selection,
|
|
154569
154684
|
data: data2
|
|
154570
154685
|
}) {
|
|
154571
154686
|
const config4 = getCurrentConfig2();
|
|
@@ -154573,18 +154688,18 @@ async function marshalSelection2({
|
|
|
154573
154688
|
return data2;
|
|
154574
154689
|
}
|
|
154575
154690
|
if (Array.isArray(data2)) {
|
|
154576
|
-
return await Promise.all(data2.map((val) => marshalSelection2({ selection
|
|
154691
|
+
return await Promise.all(data2.map((val) => marshalSelection2({ selection, data: val })));
|
|
154577
154692
|
}
|
|
154578
|
-
const targetSelection = getFieldsForType2(
|
|
154693
|
+
const targetSelection = getFieldsForType2(selection, data2["__typename"]);
|
|
154579
154694
|
return Object.fromEntries(
|
|
154580
154695
|
await Promise.all(
|
|
154581
154696
|
Object.entries(data2).map(async ([fieldName, value2]) => {
|
|
154582
|
-
const { type, selection:
|
|
154697
|
+
const { type, selection: selection2 } = targetSelection[fieldName];
|
|
154583
154698
|
if (!type) {
|
|
154584
154699
|
return [fieldName, value2];
|
|
154585
154700
|
}
|
|
154586
|
-
if (
|
|
154587
|
-
return [fieldName, await marshalSelection2({ selection:
|
|
154701
|
+
if (selection2) {
|
|
154702
|
+
return [fieldName, await marshalSelection2({ selection: selection2, data: value2 })];
|
|
154588
154703
|
}
|
|
154589
154704
|
if (config4.scalars?.[type]) {
|
|
154590
154705
|
const marshalFn = config4.scalars[type].marshal;
|
|
@@ -154618,6 +154733,7 @@ var DataSource2 = {
|
|
|
154618
154733
|
Network: "network",
|
|
154619
154734
|
Ssr: "ssr"
|
|
154620
154735
|
};
|
|
154736
|
+
var fragmentKey2 = " $fragments";
|
|
154621
154737
|
var computeKey2 = ({ field, args }) => {
|
|
154622
154738
|
const keys2 = Object.keys(args ?? {});
|
|
154623
154739
|
keys2.sort();
|
|
@@ -155693,7 +155809,7 @@ var List2 = class {
|
|
|
155693
155809
|
recordType,
|
|
155694
155810
|
key,
|
|
155695
155811
|
listType,
|
|
155696
|
-
selection
|
|
155812
|
+
selection,
|
|
155697
155813
|
when,
|
|
155698
155814
|
filters,
|
|
155699
155815
|
connection,
|
|
@@ -155705,7 +155821,7 @@ var List2 = class {
|
|
|
155705
155821
|
this.key = key;
|
|
155706
155822
|
this.type = listType;
|
|
155707
155823
|
this.cache = manager.cache;
|
|
155708
|
-
this.selection =
|
|
155824
|
+
this.selection = selection;
|
|
155709
155825
|
this._when = when;
|
|
155710
155826
|
this.filters = filters;
|
|
155711
155827
|
this.name = name;
|
|
@@ -155716,19 +155832,19 @@ var List2 = class {
|
|
|
155716
155832
|
when(when) {
|
|
155717
155833
|
return this.manager.lists.get(this.name).get(this.recordID).when(when);
|
|
155718
155834
|
}
|
|
155719
|
-
append(
|
|
155720
|
-
return this.addToList(
|
|
155835
|
+
append(selection, data2, variables = {}) {
|
|
155836
|
+
return this.addToList(selection, data2, variables, "last");
|
|
155721
155837
|
}
|
|
155722
|
-
prepend(
|
|
155723
|
-
return this.addToList(
|
|
155838
|
+
prepend(selection, data2, variables = {}) {
|
|
155839
|
+
return this.addToList(selection, data2, variables, "first");
|
|
155724
155840
|
}
|
|
155725
|
-
addToList(
|
|
155841
|
+
addToList(selection, data2, variables = {}, where) {
|
|
155726
155842
|
const listType = this.listType(data2);
|
|
155727
155843
|
const dataID = this.cache._internal_unstable.id(listType, data2);
|
|
155728
155844
|
if (!this.validateWhen() || !dataID) {
|
|
155729
155845
|
return;
|
|
155730
155846
|
}
|
|
155731
|
-
let insertSelection =
|
|
155847
|
+
let insertSelection = selection;
|
|
155732
155848
|
let insertData = data2;
|
|
155733
155849
|
if (this.connection) {
|
|
155734
155850
|
insertSelection = {
|
|
@@ -155748,9 +155864,9 @@ var List2 = class {
|
|
|
155748
155864
|
type: listType,
|
|
155749
155865
|
keyRaw: "node",
|
|
155750
155866
|
selection: {
|
|
155751
|
-
...
|
|
155867
|
+
...selection,
|
|
155752
155868
|
fields: {
|
|
155753
|
-
...
|
|
155869
|
+
...selection.fields,
|
|
155754
155870
|
__typename: {
|
|
155755
155871
|
keyRaw: "__typename",
|
|
155756
155872
|
type: "String"
|
|
@@ -155779,9 +155895,9 @@ var List2 = class {
|
|
|
155779
155895
|
type: listType,
|
|
155780
155896
|
updates: ["append", "prepend"],
|
|
155781
155897
|
selection: {
|
|
155782
|
-
...
|
|
155898
|
+
...selection,
|
|
155783
155899
|
fields: {
|
|
155784
|
-
...
|
|
155900
|
+
...selection.fields,
|
|
155785
155901
|
__typename: {
|
|
155786
155902
|
keyRaw: "__typename",
|
|
155787
155903
|
type: "String"
|
|
@@ -155856,7 +155972,8 @@ var List2 = class {
|
|
|
155856
155972
|
this.cache._internal_unstable.getSelection({
|
|
155857
155973
|
parent: spec.parentID || this.manager.rootID,
|
|
155858
155974
|
selection: spec.selection,
|
|
155859
|
-
variables: spec.variables?.() || {}
|
|
155975
|
+
variables: spec.variables?.() || {},
|
|
155976
|
+
ignoreMasking: false
|
|
155860
155977
|
}).data
|
|
155861
155978
|
);
|
|
155862
155979
|
}
|
|
@@ -155892,9 +156009,9 @@ var List2 = class {
|
|
|
155892
156009
|
}
|
|
155893
156010
|
return ok;
|
|
155894
156011
|
}
|
|
155895
|
-
toggleElement(
|
|
156012
|
+
toggleElement(selection, data2, variables = {}, where) {
|
|
155896
156013
|
if (!this.remove(data2, variables)) {
|
|
155897
|
-
this.addToList(
|
|
156014
|
+
this.addToList(selection, data2, variables, where);
|
|
155898
156015
|
}
|
|
155899
156016
|
}
|
|
155900
156017
|
*[Symbol.iterator]() {
|
|
@@ -156459,14 +156576,24 @@ var InMemorySubscriptions2 = class {
|
|
|
156459
156576
|
add({
|
|
156460
156577
|
parent,
|
|
156461
156578
|
spec,
|
|
156462
|
-
selection
|
|
156579
|
+
selection,
|
|
156463
156580
|
variables,
|
|
156464
156581
|
parentType
|
|
156465
156582
|
}) {
|
|
156466
156583
|
const __typename = this.cache._internal_unstable.storage.get(parent, "__typename").value;
|
|
156467
|
-
let targetSelection = getFieldsForType2(
|
|
156584
|
+
let targetSelection = getFieldsForType2(selection, __typename);
|
|
156468
156585
|
for (const fieldSelection of Object.values(targetSelection || {})) {
|
|
156469
|
-
const {
|
|
156586
|
+
const {
|
|
156587
|
+
keyRaw,
|
|
156588
|
+
selection: innerSelection,
|
|
156589
|
+
type,
|
|
156590
|
+
list,
|
|
156591
|
+
filters,
|
|
156592
|
+
visible
|
|
156593
|
+
} = fieldSelection;
|
|
156594
|
+
if (!visible) {
|
|
156595
|
+
continue;
|
|
156596
|
+
}
|
|
156470
156597
|
const key = evaluateKey2(keyRaw, variables);
|
|
156471
156598
|
let targetSelection2;
|
|
156472
156599
|
if (innerSelection) {
|
|
@@ -156514,10 +156641,10 @@ var InMemorySubscriptions2 = class {
|
|
|
156514
156641
|
addFieldSubscription({
|
|
156515
156642
|
id: id2,
|
|
156516
156643
|
key,
|
|
156517
|
-
selection
|
|
156644
|
+
selection,
|
|
156518
156645
|
type
|
|
156519
156646
|
}) {
|
|
156520
|
-
const spec =
|
|
156647
|
+
const spec = selection[0];
|
|
156521
156648
|
if (!this.subscribers[id2]) {
|
|
156522
156649
|
this.subscribers[id2] = {};
|
|
156523
156650
|
}
|
|
@@ -156529,7 +156656,7 @@ var InMemorySubscriptions2 = class {
|
|
|
156529
156656
|
}
|
|
156530
156657
|
this.keyVersions[key].add(key);
|
|
156531
156658
|
if (!this.subscribers[id2][key].map(([{ set }]) => set).includes(spec.set)) {
|
|
156532
|
-
this.subscribers[id2][key].push([spec,
|
|
156659
|
+
this.subscribers[id2][key].push([spec, selection[1]]);
|
|
156533
156660
|
}
|
|
156534
156661
|
if (!this.referenceCounts[id2]) {
|
|
156535
156662
|
this.referenceCounts[id2] = {};
|
|
@@ -156540,14 +156667,13 @@ var InMemorySubscriptions2 = class {
|
|
|
156540
156667
|
const counts = this.referenceCounts[id2][key];
|
|
156541
156668
|
counts.set(spec.set, (counts.get(spec.set) || 0) + 1);
|
|
156542
156669
|
this.cache._internal_unstable.lifetimes.resetLifetime(id2, key);
|
|
156543
|
-
const { selection: innerSelection } = selection2[1]?.[key] ?? {};
|
|
156544
156670
|
}
|
|
156545
156671
|
registerList({
|
|
156546
156672
|
list,
|
|
156547
156673
|
id: id2,
|
|
156548
156674
|
key,
|
|
156549
156675
|
parentType,
|
|
156550
|
-
selection
|
|
156676
|
+
selection,
|
|
156551
156677
|
filters,
|
|
156552
156678
|
variables
|
|
156553
156679
|
}) {
|
|
@@ -156558,7 +156684,7 @@ var InMemorySubscriptions2 = class {
|
|
|
156558
156684
|
recordType: this.cache._internal_unstable.storage.get(id2, "__typename")?.value || parentType,
|
|
156559
156685
|
listType: list.type,
|
|
156560
156686
|
key,
|
|
156561
|
-
selection
|
|
156687
|
+
selection,
|
|
156562
156688
|
filters: Object.entries(filters || {}).reduce((acc, [key2, { kind, value: value2 }]) => {
|
|
156563
156689
|
return {
|
|
156564
156690
|
...acc,
|
|
@@ -156574,14 +156700,14 @@ var InMemorySubscriptions2 = class {
|
|
|
156574
156700
|
parentType
|
|
156575
156701
|
}) {
|
|
156576
156702
|
for (const [spec, targetSelection] of subscribers) {
|
|
156577
|
-
for (const
|
|
156703
|
+
for (const selection of Object.values(targetSelection ?? {})) {
|
|
156578
156704
|
const {
|
|
156579
156705
|
type: linkedType,
|
|
156580
156706
|
keyRaw,
|
|
156581
156707
|
selection: innerSelection,
|
|
156582
156708
|
list,
|
|
156583
156709
|
filters
|
|
156584
|
-
} =
|
|
156710
|
+
} = selection;
|
|
156585
156711
|
const key = evaluateKey2(keyRaw, variables);
|
|
156586
156712
|
const fieldSelection = innerSelection ? getFieldsForType2(innerSelection, parentType) : void 0;
|
|
156587
156713
|
this.addFieldSubscription({
|
|
@@ -156601,7 +156727,7 @@ var InMemorySubscriptions2 = class {
|
|
|
156601
156727
|
parentType: parentType || spec.rootType
|
|
156602
156728
|
});
|
|
156603
156729
|
}
|
|
156604
|
-
const childSelection =
|
|
156730
|
+
const childSelection = selection.selection;
|
|
156605
156731
|
if (childSelection) {
|
|
156606
156732
|
const { value: link } = this.cache._internal_unstable.storage.get(parent, key);
|
|
156607
156733
|
const children = !Array.isArray(link) ? [link] : flatten2(link);
|
|
@@ -156628,11 +156754,11 @@ var InMemorySubscriptions2 = class {
|
|
|
156628
156754
|
get(id2, field) {
|
|
156629
156755
|
return this.subscribers[id2]?.[field] || [];
|
|
156630
156756
|
}
|
|
156631
|
-
remove(id2,
|
|
156757
|
+
remove(id2, selection, targets, variables, visited = []) {
|
|
156632
156758
|
visited.push(id2);
|
|
156633
156759
|
const linkedIDs = [];
|
|
156634
156760
|
const __typename = this.cache._internal_unstable.storage.get(id2, "__typename").value;
|
|
156635
|
-
let targetSelection = getFieldsForType2(
|
|
156761
|
+
let targetSelection = getFieldsForType2(selection, __typename);
|
|
156636
156762
|
for (const fieldSelection of Object.values(targetSelection || {})) {
|
|
156637
156763
|
const key = evaluateKey2(fieldSelection.keyRaw, variables);
|
|
156638
156764
|
this.removeSubscribers(id2, key, targets);
|
|
@@ -156692,7 +156818,7 @@ var InMemorySubscriptions2 = class {
|
|
|
156692
156818
|
};
|
|
156693
156819
|
var Cache2 = class {
|
|
156694
156820
|
_internal_unstable;
|
|
156695
|
-
constructor(config4) {
|
|
156821
|
+
constructor({ disabled, ...config4 } = {}) {
|
|
156696
156822
|
this._internal_unstable = new CacheInternal2({
|
|
156697
156823
|
cache: this,
|
|
156698
156824
|
storage: new InMemoryStorage2(),
|
|
@@ -156700,9 +156826,10 @@ var Cache2 = class {
|
|
|
156700
156826
|
lists: new ListManager2(this, rootID2),
|
|
156701
156827
|
lifetimes: new GarbageCollector2(this),
|
|
156702
156828
|
staleManager: new StaleManager2(this),
|
|
156703
|
-
schema: new SchemaManager2(this)
|
|
156829
|
+
schema: new SchemaManager2(this),
|
|
156830
|
+
disabled: disabled ?? typeof globalThis.window === "undefined"
|
|
156704
156831
|
});
|
|
156705
|
-
if (config4) {
|
|
156832
|
+
if (Object.keys(config4).length > 0) {
|
|
156706
156833
|
this.setConfig(defaultConfigValues2(config4));
|
|
156707
156834
|
}
|
|
156708
156835
|
}
|
|
@@ -156721,7 +156848,8 @@ var Cache2 = class {
|
|
|
156721
156848
|
this._internal_unstable.getSelection({
|
|
156722
156849
|
parent: spec.parentID || rootID2,
|
|
156723
156850
|
selection: spec.selection,
|
|
156724
|
-
variables: spec.variables?.() || {}
|
|
156851
|
+
variables: spec.variables?.() || {},
|
|
156852
|
+
ignoreMasking: false
|
|
156725
156853
|
}).data
|
|
156726
156854
|
);
|
|
156727
156855
|
}
|
|
@@ -156796,16 +156924,13 @@ var Cache2 = class {
|
|
|
156796
156924
|
getFieldTime(id2, field) {
|
|
156797
156925
|
return this._internal_unstable.staleManager.getFieldTime(id2, field);
|
|
156798
156926
|
}
|
|
156927
|
+
config() {
|
|
156928
|
+
return this._internal_unstable.config;
|
|
156929
|
+
}
|
|
156799
156930
|
};
|
|
156800
156931
|
var CacheInternal2 = class {
|
|
156801
156932
|
_disabled = false;
|
|
156802
|
-
|
|
156803
|
-
plugins: {
|
|
156804
|
-
"houdini-svelte": {
|
|
156805
|
-
client: ""
|
|
156806
|
-
}
|
|
156807
|
-
}
|
|
156808
|
-
});
|
|
156933
|
+
_config;
|
|
156809
156934
|
storage;
|
|
156810
156935
|
subscriptions;
|
|
156811
156936
|
lists;
|
|
@@ -156820,7 +156945,9 @@ var CacheInternal2 = class {
|
|
|
156820
156945
|
cache,
|
|
156821
156946
|
lifetimes,
|
|
156822
156947
|
staleManager,
|
|
156823
|
-
schema
|
|
156948
|
+
schema,
|
|
156949
|
+
disabled,
|
|
156950
|
+
config: config4
|
|
156824
156951
|
}) {
|
|
156825
156952
|
this.storage = storage;
|
|
156826
156953
|
this.subscriptions = subscriptions;
|
|
@@ -156829,7 +156956,8 @@ var CacheInternal2 = class {
|
|
|
156829
156956
|
this.lifetimes = lifetimes;
|
|
156830
156957
|
this.staleManager = staleManager;
|
|
156831
156958
|
this.schema = schema;
|
|
156832
|
-
this.
|
|
156959
|
+
this._config = config4;
|
|
156960
|
+
this._disabled = disabled;
|
|
156833
156961
|
try {
|
|
156834
156962
|
if (process.env.HOUDINI_TEST === "true") {
|
|
156835
156963
|
this._disabled = false;
|
|
@@ -156837,12 +156965,15 @@ var CacheInternal2 = class {
|
|
|
156837
156965
|
} catch {
|
|
156838
156966
|
}
|
|
156839
156967
|
}
|
|
156968
|
+
get config() {
|
|
156969
|
+
return this._config ?? getCurrentConfig2();
|
|
156970
|
+
}
|
|
156840
156971
|
setConfig(config4) {
|
|
156841
|
-
this.
|
|
156972
|
+
this._config = config4;
|
|
156842
156973
|
}
|
|
156843
156974
|
writeSelection({
|
|
156844
156975
|
data: data2,
|
|
156845
|
-
selection
|
|
156976
|
+
selection,
|
|
156846
156977
|
variables = {},
|
|
156847
156978
|
parent = rootID2,
|
|
156848
156979
|
applyUpdates,
|
|
@@ -156854,9 +156985,9 @@ var CacheInternal2 = class {
|
|
|
156854
156985
|
if (this._disabled) {
|
|
156855
156986
|
return [];
|
|
156856
156987
|
}
|
|
156857
|
-
let targetSelection = getFieldsForType2(
|
|
156988
|
+
let targetSelection = getFieldsForType2(selection, data2["__typename"]);
|
|
156858
156989
|
for (const [field, value2] of Object.entries(data2)) {
|
|
156859
|
-
if (!
|
|
156990
|
+
if (!selection || !targetSelection[field]) {
|
|
156860
156991
|
continue;
|
|
156861
156992
|
}
|
|
156862
156993
|
let {
|
|
@@ -157112,25 +157243,40 @@ var CacheInternal2 = class {
|
|
|
157112
157243
|
return toNotify;
|
|
157113
157244
|
}
|
|
157114
157245
|
getSelection({
|
|
157115
|
-
selection
|
|
157246
|
+
selection,
|
|
157116
157247
|
parent = rootID2,
|
|
157117
157248
|
variables,
|
|
157118
|
-
stepsFromConnection = null
|
|
157249
|
+
stepsFromConnection = null,
|
|
157250
|
+
ignoreMasking
|
|
157119
157251
|
}) {
|
|
157120
157252
|
if (parent === null) {
|
|
157121
157253
|
return { data: null, partial: false, stale: false, hasData: true };
|
|
157122
157254
|
}
|
|
157123
157255
|
const target = {};
|
|
157256
|
+
if (selection.fragments) {
|
|
157257
|
+
target[fragmentKey2] = Object.fromEntries(
|
|
157258
|
+
Object.entries(selection.fragments).map(([key, value2]) => [
|
|
157259
|
+
key,
|
|
157260
|
+
{
|
|
157261
|
+
parent,
|
|
157262
|
+
variables: evaluateFragmentVariables2(value2, variables ?? {})
|
|
157263
|
+
}
|
|
157264
|
+
])
|
|
157265
|
+
);
|
|
157266
|
+
}
|
|
157124
157267
|
let hasData = false;
|
|
157125
157268
|
let partial = false;
|
|
157126
157269
|
let cascadeNull = false;
|
|
157127
157270
|
let stale = false;
|
|
157128
157271
|
const typename = this.storage.get(parent, "__typename").value;
|
|
157129
|
-
let targetSelection = getFieldsForType2(
|
|
157272
|
+
let targetSelection = getFieldsForType2(selection, typename);
|
|
157130
157273
|
for (const [
|
|
157131
157274
|
attributeName,
|
|
157132
|
-
{ type, keyRaw, selection: fieldSelection, nullable, list }
|
|
157275
|
+
{ type, keyRaw, selection: fieldSelection, nullable, list, visible }
|
|
157133
157276
|
] of Object.entries(targetSelection)) {
|
|
157277
|
+
if (!visible && !ignoreMasking) {
|
|
157278
|
+
continue;
|
|
157279
|
+
}
|
|
157134
157280
|
const key = evaluateKey2(keyRaw, variables);
|
|
157135
157281
|
const { value: value2 } = this.storage.get(parent, key);
|
|
157136
157282
|
const dt_field = this.staleManager.getFieldTime(parent, key);
|
|
@@ -157170,7 +157316,8 @@ var CacheInternal2 = class {
|
|
|
157170
157316
|
fields: fieldSelection,
|
|
157171
157317
|
variables,
|
|
157172
157318
|
linkedList: value2,
|
|
157173
|
-
stepsFromConnection: nextStep
|
|
157319
|
+
stepsFromConnection: nextStep,
|
|
157320
|
+
ignoreMasking: !!ignoreMasking
|
|
157174
157321
|
});
|
|
157175
157322
|
target[attributeName] = listValue.data;
|
|
157176
157323
|
if (listValue.partial) {
|
|
@@ -157187,7 +157334,8 @@ var CacheInternal2 = class {
|
|
|
157187
157334
|
parent: value2,
|
|
157188
157335
|
selection: fieldSelection,
|
|
157189
157336
|
variables,
|
|
157190
|
-
stepsFromConnection: nextStep
|
|
157337
|
+
stepsFromConnection: nextStep,
|
|
157338
|
+
ignoreMasking
|
|
157191
157339
|
});
|
|
157192
157340
|
target[attributeName] = objectFields.data;
|
|
157193
157341
|
if (objectFields.partial) {
|
|
@@ -157231,7 +157379,8 @@ var CacheInternal2 = class {
|
|
|
157231
157379
|
fields,
|
|
157232
157380
|
variables,
|
|
157233
157381
|
linkedList,
|
|
157234
|
-
stepsFromConnection
|
|
157382
|
+
stepsFromConnection,
|
|
157383
|
+
ignoreMasking
|
|
157235
157384
|
}) {
|
|
157236
157385
|
const result = [];
|
|
157237
157386
|
let partialData = false;
|
|
@@ -157243,7 +157392,8 @@ var CacheInternal2 = class {
|
|
|
157243
157392
|
fields,
|
|
157244
157393
|
variables,
|
|
157245
157394
|
linkedList: entry,
|
|
157246
|
-
stepsFromConnection
|
|
157395
|
+
stepsFromConnection,
|
|
157396
|
+
ignoreMasking
|
|
157247
157397
|
});
|
|
157248
157398
|
result.push(nestedValue.data);
|
|
157249
157399
|
if (nestedValue.partial) {
|
|
@@ -157264,7 +157414,8 @@ var CacheInternal2 = class {
|
|
|
157264
157414
|
parent: entry,
|
|
157265
157415
|
selection: fields,
|
|
157266
157416
|
variables,
|
|
157267
|
-
stepsFromConnection
|
|
157417
|
+
stepsFromConnection,
|
|
157418
|
+
ignoreMasking
|
|
157268
157419
|
});
|
|
157269
157420
|
result.push(data2);
|
|
157270
157421
|
if (partial) {
|
|
@@ -157367,8 +157518,49 @@ var CacheInternal2 = class {
|
|
|
157367
157518
|
}
|
|
157368
157519
|
}
|
|
157369
157520
|
};
|
|
157521
|
+
function evaluateFragmentVariables2(variables, args) {
|
|
157522
|
+
return Object.fromEntries(
|
|
157523
|
+
Object.entries(variables).map(([key, value2]) => [key, fragmentVariableValue2(value2, args)])
|
|
157524
|
+
);
|
|
157525
|
+
}
|
|
157526
|
+
function fragmentVariableValue2(value2, args) {
|
|
157527
|
+
if (value2.kind === "StringValue") {
|
|
157528
|
+
return value2.value;
|
|
157529
|
+
}
|
|
157530
|
+
if (value2.kind === "BooleanValue") {
|
|
157531
|
+
return value2.value;
|
|
157532
|
+
}
|
|
157533
|
+
if (value2.kind === "EnumValue") {
|
|
157534
|
+
return value2.value;
|
|
157535
|
+
}
|
|
157536
|
+
if (value2.kind === "FloatValue") {
|
|
157537
|
+
return parseFloat(value2.value);
|
|
157538
|
+
}
|
|
157539
|
+
if (value2.kind === "IntValue") {
|
|
157540
|
+
return parseInt(value2.value, 10);
|
|
157541
|
+
}
|
|
157542
|
+
if (value2.kind === "NullValue") {
|
|
157543
|
+
return null;
|
|
157544
|
+
}
|
|
157545
|
+
if (value2.kind === "Variable") {
|
|
157546
|
+
return args[value2.name.value];
|
|
157547
|
+
}
|
|
157548
|
+
if (value2.kind === "ListValue") {
|
|
157549
|
+
return value2.values.map((value22) => fragmentVariableValue2(value22, args));
|
|
157550
|
+
}
|
|
157551
|
+
if (value2.kind === "ObjectValue") {
|
|
157552
|
+
return value2.fields.reduce(
|
|
157553
|
+
(obj, field) => ({
|
|
157554
|
+
...obj,
|
|
157555
|
+
[field.name.value]: fragmentVariableValue2(field.value, args)
|
|
157556
|
+
}),
|
|
157557
|
+
{}
|
|
157558
|
+
);
|
|
157559
|
+
}
|
|
157560
|
+
}
|
|
157370
157561
|
var rootID2 = "_ROOT_";
|
|
157371
157562
|
var cache_default2 = new Cache2();
|
|
157563
|
+
var serverSide2 = typeof globalThis.window === "undefined";
|
|
157372
157564
|
var documentPlugin2 = (kind, source) => {
|
|
157373
157565
|
return () => {
|
|
157374
157566
|
const sourceHandlers = source();
|
|
@@ -157401,7 +157593,6 @@ var documentPlugin2 = (kind, source) => {
|
|
|
157401
157593
|
var query2 = documentPlugin2(ArtifactKind2.Query, function() {
|
|
157402
157594
|
let subscriptionSpec = null;
|
|
157403
157595
|
let lastVariables = null;
|
|
157404
|
-
let artifactName = "";
|
|
157405
157596
|
return {
|
|
157406
157597
|
start(ctx, { next }) {
|
|
157407
157598
|
ctx.variables = {
|
|
@@ -157411,8 +157602,7 @@ var query2 = documentPlugin2(ArtifactKind2.Query, function() {
|
|
|
157411
157602
|
next(ctx);
|
|
157412
157603
|
},
|
|
157413
157604
|
end(ctx, { resolve: resolve22, marshalVariables, variablesChanged }) {
|
|
157414
|
-
if (variablesChanged(ctx)) {
|
|
157415
|
-
artifactName = ctx.artifact.name;
|
|
157605
|
+
if (variablesChanged(ctx) && !ctx.cacheParams?.disableSubscriptions) {
|
|
157416
157606
|
if (subscriptionSpec) {
|
|
157417
157607
|
cache_default2.unsubscribe(subscriptionSpec, subscriptionSpec.variables?.() || {});
|
|
157418
157608
|
}
|
|
@@ -157433,18 +157623,58 @@ var query2 = documentPlugin2(ArtifactKind2.Query, function() {
|
|
|
157433
157623
|
});
|
|
157434
157624
|
}
|
|
157435
157625
|
};
|
|
157436
|
-
cache_default2.subscribe(subscriptionSpec, lastVariables
|
|
157626
|
+
cache_default2.subscribe(subscriptionSpec, lastVariables);
|
|
157437
157627
|
}
|
|
157438
157628
|
resolve22(ctx);
|
|
157439
157629
|
},
|
|
157440
157630
|
cleanup() {
|
|
157441
157631
|
if (subscriptionSpec) {
|
|
157442
|
-
cache_default2.unsubscribe(subscriptionSpec, subscriptionSpec.variables?.()
|
|
157632
|
+
cache_default2.unsubscribe(subscriptionSpec, subscriptionSpec.variables?.());
|
|
157443
157633
|
lastVariables = null;
|
|
157444
157634
|
}
|
|
157445
157635
|
}
|
|
157446
157636
|
};
|
|
157447
157637
|
});
|
|
157638
|
+
var fragment2 = documentPlugin2(ArtifactKind2.Fragment, function() {
|
|
157639
|
+
let subscriptionSpec = null;
|
|
157640
|
+
return {
|
|
157641
|
+
start(ctx, { next, resolve: resolve22, variablesChanged, marshalVariables }) {
|
|
157642
|
+
if (!ctx.stuff.parentID) {
|
|
157643
|
+
return next(ctx);
|
|
157644
|
+
}
|
|
157645
|
+
if (variablesChanged(ctx) && !ctx.cacheParams?.disableSubscriptions) {
|
|
157646
|
+
if (subscriptionSpec) {
|
|
157647
|
+
cache_default2.unsubscribe(subscriptionSpec, subscriptionSpec.variables?.() || {});
|
|
157648
|
+
}
|
|
157649
|
+
const variables = marshalVariables(ctx);
|
|
157650
|
+
subscriptionSpec = {
|
|
157651
|
+
rootType: ctx.artifact.rootType,
|
|
157652
|
+
selection: ctx.artifact.selection,
|
|
157653
|
+
variables: () => variables,
|
|
157654
|
+
parentID: ctx.stuff.parentID,
|
|
157655
|
+
set: (newValue) => {
|
|
157656
|
+
resolve22(ctx, {
|
|
157657
|
+
data: newValue,
|
|
157658
|
+
errors: null,
|
|
157659
|
+
fetching: false,
|
|
157660
|
+
partial: false,
|
|
157661
|
+
stale: false,
|
|
157662
|
+
source: DataSource2.Cache,
|
|
157663
|
+
variables
|
|
157664
|
+
});
|
|
157665
|
+
}
|
|
157666
|
+
};
|
|
157667
|
+
cache_default2.subscribe(subscriptionSpec, variables);
|
|
157668
|
+
}
|
|
157669
|
+
next(ctx);
|
|
157670
|
+
},
|
|
157671
|
+
cleanup() {
|
|
157672
|
+
if (subscriptionSpec) {
|
|
157673
|
+
cache_default2.unsubscribe(subscriptionSpec, subscriptionSpec.variables?.());
|
|
157674
|
+
}
|
|
157675
|
+
}
|
|
157676
|
+
};
|
|
157677
|
+
});
|
|
157448
157678
|
var mutation2 = documentPlugin2(ArtifactKind2.Mutation, () => {
|
|
157449
157679
|
return {
|
|
157450
157680
|
async start(ctx, { next, marshalVariables }) {
|
|
@@ -169987,8 +170217,8 @@ function read_tag_name(parser) {
|
|
|
169987
170217
|
let i3 = parser.stack.length;
|
|
169988
170218
|
let legal = false;
|
|
169989
170219
|
while (i3--) {
|
|
169990
|
-
const
|
|
169991
|
-
if (
|
|
170220
|
+
const fragment4 = parser.stack[i3];
|
|
170221
|
+
if (fragment4.type === "IfBlock" || fragment4.type === "EachBlock" || fragment4.type === "InlineComponent") {
|
|
169992
170222
|
legal = true;
|
|
169993
170223
|
break;
|
|
169994
170224
|
}
|
|
@@ -170692,7 +170922,7 @@ function text(parser) {
|
|
|
170692
170922
|
};
|
|
170693
170923
|
parser.current().children.push(node2);
|
|
170694
170924
|
}
|
|
170695
|
-
function
|
|
170925
|
+
function fragment3(parser) {
|
|
170696
170926
|
if (parser.match("<")) {
|
|
170697
170927
|
return tag;
|
|
170698
170928
|
}
|
|
@@ -170854,9 +171084,9 @@ var Parser$1 = class {
|
|
|
170854
171084
|
children: []
|
|
170855
171085
|
};
|
|
170856
171086
|
this.stack.push(this.html);
|
|
170857
|
-
let state =
|
|
171087
|
+
let state = fragment3;
|
|
170858
171088
|
while (this.index < this.template.length) {
|
|
170859
|
-
state = state(this) ||
|
|
171089
|
+
state = state(this) || fragment3;
|
|
170860
171090
|
}
|
|
170861
171091
|
if (this.stack.length > 1) {
|
|
170862
171092
|
const current2 = this.current();
|
|
@@ -170867,7 +171097,7 @@ var Parser$1 = class {
|
|
|
170867
171097
|
message: `${type} was left open`
|
|
170868
171098
|
}, current2.start);
|
|
170869
171099
|
}
|
|
170870
|
-
if (state !==
|
|
171100
|
+
if (state !== fragment3) {
|
|
170871
171101
|
this.error({
|
|
170872
171102
|
code: "unexpected-eof",
|
|
170873
171103
|
message: "Unexpected end of input"
|
|
@@ -186370,14 +186600,12 @@ async function fragmentTypedefs(input) {
|
|
|
186370
186600
|
const import_path = path_exports.join("..", stores_directory_name(), doc.name);
|
|
186371
186601
|
const fragment_map = AST15.tsTypeLiteral([
|
|
186372
186602
|
AST15.tsPropertySignature(
|
|
186373
|
-
AST15.
|
|
186603
|
+
AST15.stringLiteral(fragmentKey),
|
|
186374
186604
|
AST15.tsTypeAnnotation(
|
|
186375
186605
|
AST15.tsTypeLiteral([
|
|
186376
186606
|
AST15.tsPropertySignature(
|
|
186377
186607
|
AST15.identifier(doc.name),
|
|
186378
|
-
AST15.tsTypeAnnotation(
|
|
186379
|
-
AST15.tsLiteralType(AST15.booleanLiteral(true))
|
|
186380
|
-
)
|
|
186608
|
+
AST15.tsTypeAnnotation(AST15.tsAnyKeyword())
|
|
186381
186609
|
)
|
|
186382
186610
|
])
|
|
186383
186611
|
)
|
|
@@ -186387,7 +186615,7 @@ async function fragmentTypedefs(input) {
|
|
|
186387
186615
|
initial_value_input.typeAnnotation = AST15.tsTypeAnnotation(fragment_map);
|
|
186388
186616
|
const initial_value_or_null_input = AST15.identifier("initialValue");
|
|
186389
186617
|
initial_value_or_null_input.typeAnnotation = AST15.tsTypeAnnotation(
|
|
186390
|
-
AST15.tsUnionType([fragment_map, AST15.tsNullKeyword()])
|
|
186618
|
+
AST15.tsUnionType([fragment_map, AST15.tsNullKeyword(), AST15.tsUndefinedKeyword()])
|
|
186391
186619
|
);
|
|
186392
186620
|
const document_input = AST15.identifier("document");
|
|
186393
186621
|
document_input.typeAnnotation = AST15.tsTypeAnnotation(
|
|
@@ -186422,10 +186650,7 @@ async function fragmentTypedefs(input) {
|
|
|
186422
186650
|
sourceModule: "../../../artifacts/" + doc.name,
|
|
186423
186651
|
import: [inputID, shapeID]
|
|
186424
186652
|
});
|
|
186425
|
-
const typeParams = [];
|
|
186426
|
-
if (doc.refetch?.paginated) {
|
|
186427
|
-
typeParams.push(AST15.tsTypeReference(AST15.identifier(inputID)));
|
|
186428
|
-
}
|
|
186653
|
+
const typeParams = [AST15.tsTypeReference(AST15.identifier(inputID))];
|
|
186429
186654
|
const return_value = AST15.tsTypeReference(
|
|
186430
186655
|
AST15.identifier(store_type),
|
|
186431
186656
|
AST15.tsTypeParameterInstantiation([
|
|
@@ -186811,16 +187036,15 @@ export class ${storeName} extends ${store_class} {
|
|
|
186811
187036
|
}
|
|
186812
187037
|
`;
|
|
186813
187038
|
const _data = `${artifactName}$data`;
|
|
186814
|
-
const
|
|
187039
|
+
const _input = `${artifactName}$input`;
|
|
187040
|
+
const typeDefs = `import type { ${_data}, ${_input}, ${store_class}, QueryStoreFetchParams} from '$houdini'
|
|
186815
187041
|
|
|
186816
|
-
export declare class ${storeName} extends ${store_class}<${_data}, {}> {
|
|
187042
|
+
export declare class ${storeName} extends ${store_class}<${_data}, { ${doc.name}: any }, ${_input}> {
|
|
186817
187043
|
constructor() {
|
|
186818
187044
|
// @ts-ignore
|
|
186819
187045
|
super({})
|
|
186820
187046
|
}
|
|
186821
187047
|
}
|
|
186822
|
-
|
|
186823
|
-
export declare const load_${artifactName}: (params: QueryStoreFetchParams<${_data}, {}>) => Promise<${storeName}>
|
|
186824
187048
|
`;
|
|
186825
187049
|
await Promise.all([
|
|
186826
187050
|
fs_exports.writeFile(path_exports.join(stores_directory(pluginRoot), `${fileName}.d.ts`), typeDefs),
|