houdini 1.1.3 → 1.1.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 +451 -216
- package/build/cmd-esm/index.js +451 -216
- package/build/codegen/transforms/fragmentVariables.d.ts +0 -11
- package/build/codegen-cjs/index.js +421 -186
- package/build/codegen-esm/index.js +421 -186
- package/build/lib/config.d.ts +1 -0
- package/build/lib-cjs/index.js +43 -19
- package/build/lib-esm/index.js +43 -19
- package/build/runtime/cache/cache.d.ts +4 -2
- package/build/runtime/lib/types.d.ts +4 -0
- package/build/runtime-cjs/cache/cache.d.ts +4 -2
- package/build/runtime-cjs/cache/cache.js +37 -14
- package/build/runtime-cjs/client/plugins/cache.js +2 -1
- package/build/runtime-cjs/lib/types.d.ts +4 -0
- package/build/runtime-esm/cache/cache.d.ts +4 -2
- package/build/runtime-esm/cache/cache.js +37 -14
- package/build/runtime-esm/client/plugins/cache.js +2 -1
- package/build/runtime-esm/lib/types.d.ts +4 -0
- package/build/test-cjs/index.js +443 -204
- package/build/test-esm/index.js +443 -204
- package/build/vite-cjs/index.js +461 -226
- package/build/vite-esm/index.js +461 -226
- package/package.json +3 -1
|
@@ -446,7 +446,8 @@ class CacheInternal {
|
|
|
446
446
|
parent = rootID,
|
|
447
447
|
variables,
|
|
448
448
|
stepsFromConnection = null,
|
|
449
|
-
ignoreMasking
|
|
449
|
+
ignoreMasking,
|
|
450
|
+
fullCheck = false
|
|
450
451
|
}) {
|
|
451
452
|
if (parent === null) {
|
|
452
453
|
return { data: null, partial: false, stale: false, hasData: true };
|
|
@@ -471,11 +472,28 @@ class CacheInternal {
|
|
|
471
472
|
let targetSelection = getFieldsForType(selection, typename);
|
|
472
473
|
for (const [
|
|
473
474
|
attributeName,
|
|
474
|
-
{ type, keyRaw, selection: fieldSelection, nullable, list, visible }
|
|
475
|
+
{ type, keyRaw, selection: fieldSelection, nullable, list, visible, directives }
|
|
475
476
|
] of Object.entries(targetSelection)) {
|
|
476
|
-
if (!visible && !ignoreMasking) {
|
|
477
|
+
if (!visible && !ignoreMasking && !fullCheck) {
|
|
477
478
|
continue;
|
|
478
479
|
}
|
|
480
|
+
const includeDirective = directives?.find((d) => {
|
|
481
|
+
return d.name === "include";
|
|
482
|
+
});
|
|
483
|
+
if (includeDirective) {
|
|
484
|
+
if (!evaluateFragmentVariables(includeDirective.arguments, variables ?? {})["if"]) {
|
|
485
|
+
continue;
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
const skipDirective = directives?.find((d) => {
|
|
489
|
+
return d.name === "skip";
|
|
490
|
+
});
|
|
491
|
+
if (skipDirective) {
|
|
492
|
+
if (evaluateFragmentVariables(skipDirective.arguments, variables ?? {})["if"]) {
|
|
493
|
+
continue;
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
const fieldTarget = visible || ignoreMasking ? target : {};
|
|
479
497
|
const key = evaluateKey(keyRaw, variables);
|
|
480
498
|
const { value } = this.storage.get(parent, key);
|
|
481
499
|
const dt_field = this.staleManager.getFieldTime(parent, key);
|
|
@@ -498,16 +516,16 @@ class CacheInternal {
|
|
|
498
516
|
partial = true;
|
|
499
517
|
}
|
|
500
518
|
if (typeof value === "undefined" || value === null) {
|
|
501
|
-
|
|
519
|
+
fieldTarget[attributeName] = null;
|
|
502
520
|
if (typeof value !== "undefined") {
|
|
503
521
|
hasData = true;
|
|
504
522
|
}
|
|
505
523
|
} else if (!fieldSelection) {
|
|
506
524
|
const fnUnmarshal = this.config?.scalars?.[type]?.unmarshal;
|
|
507
525
|
if (fnUnmarshal) {
|
|
508
|
-
|
|
526
|
+
fieldTarget[attributeName] = fnUnmarshal(value);
|
|
509
527
|
} else {
|
|
510
|
-
|
|
528
|
+
fieldTarget[attributeName] = value;
|
|
511
529
|
}
|
|
512
530
|
hasData = true;
|
|
513
531
|
} else if (Array.isArray(value)) {
|
|
@@ -516,9 +534,10 @@ class CacheInternal {
|
|
|
516
534
|
variables,
|
|
517
535
|
linkedList: value,
|
|
518
536
|
stepsFromConnection: nextStep,
|
|
519
|
-
ignoreMasking: !!ignoreMasking
|
|
537
|
+
ignoreMasking: !!ignoreMasking,
|
|
538
|
+
fullCheck
|
|
520
539
|
});
|
|
521
|
-
|
|
540
|
+
fieldTarget[attributeName] = listValue.data;
|
|
522
541
|
if (listValue.partial) {
|
|
523
542
|
partial = true;
|
|
524
543
|
}
|
|
@@ -534,9 +553,10 @@ class CacheInternal {
|
|
|
534
553
|
selection: fieldSelection,
|
|
535
554
|
variables,
|
|
536
555
|
stepsFromConnection: nextStep,
|
|
537
|
-
ignoreMasking
|
|
556
|
+
ignoreMasking,
|
|
557
|
+
fullCheck
|
|
538
558
|
});
|
|
539
|
-
|
|
559
|
+
fieldTarget[attributeName] = objectFields.data;
|
|
540
560
|
if (objectFields.partial) {
|
|
541
561
|
partial = true;
|
|
542
562
|
}
|
|
@@ -547,7 +567,7 @@ class CacheInternal {
|
|
|
547
567
|
hasData = true;
|
|
548
568
|
}
|
|
549
569
|
}
|
|
550
|
-
if (
|
|
570
|
+
if (fieldTarget[attributeName] === null && !nullable && !embeddedCursor) {
|
|
551
571
|
cascadeNull = true;
|
|
552
572
|
}
|
|
553
573
|
}
|
|
@@ -579,7 +599,8 @@ class CacheInternal {
|
|
|
579
599
|
variables,
|
|
580
600
|
linkedList,
|
|
581
601
|
stepsFromConnection,
|
|
582
|
-
ignoreMasking
|
|
602
|
+
ignoreMasking,
|
|
603
|
+
fullCheck
|
|
583
604
|
}) {
|
|
584
605
|
const result = [];
|
|
585
606
|
let partialData = false;
|
|
@@ -592,7 +613,8 @@ class CacheInternal {
|
|
|
592
613
|
variables,
|
|
593
614
|
linkedList: entry,
|
|
594
615
|
stepsFromConnection,
|
|
595
|
-
ignoreMasking
|
|
616
|
+
ignoreMasking,
|
|
617
|
+
fullCheck
|
|
596
618
|
});
|
|
597
619
|
result.push(nestedValue.data);
|
|
598
620
|
if (nestedValue.partial) {
|
|
@@ -614,7 +636,8 @@ class CacheInternal {
|
|
|
614
636
|
selection: fields,
|
|
615
637
|
variables,
|
|
616
638
|
stepsFromConnection,
|
|
617
|
-
ignoreMasking
|
|
639
|
+
ignoreMasking,
|
|
640
|
+
fullCheck
|
|
618
641
|
});
|
|
619
642
|
result.push(data);
|
|
620
643
|
if (partial) {
|
|
@@ -16,7 +16,8 @@ const cachePolicy = ({
|
|
|
16
16
|
if (policy !== CachePolicy.NetworkOnly) {
|
|
17
17
|
const value = localCache.read({
|
|
18
18
|
selection: artifact.selection,
|
|
19
|
-
variables: marshalVariables(ctx)
|
|
19
|
+
variables: marshalVariables(ctx),
|
|
20
|
+
fullCheck: true
|
|
20
21
|
});
|
|
21
22
|
const allowed = !value.partial || artifact.kind === ArtifactKind.Query && artifact.partial;
|
|
22
23
|
if (policy === CachePolicy.CacheOnly) {
|