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
package/build/lib/config.d.ts
CHANGED
|
@@ -127,6 +127,7 @@ export declare class Config {
|
|
|
127
127
|
args: ValueMap | null;
|
|
128
128
|
fragment: string;
|
|
129
129
|
};
|
|
130
|
+
serializeValueMap(map: ValueMap | null): ValueMap | null;
|
|
130
131
|
isListFragment(name: string): boolean;
|
|
131
132
|
isListOperationDirective(name: string): boolean;
|
|
132
133
|
isFragmentForList(listName: string, fragmentName: string): boolean;
|
package/build/lib-cjs/index.js
CHANGED
|
@@ -65276,7 +65276,8 @@ var CacheInternal = class {
|
|
|
65276
65276
|
parent = rootID,
|
|
65277
65277
|
variables,
|
|
65278
65278
|
stepsFromConnection = null,
|
|
65279
|
-
ignoreMasking
|
|
65279
|
+
ignoreMasking,
|
|
65280
|
+
fullCheck = false
|
|
65280
65281
|
}) {
|
|
65281
65282
|
if (parent === null) {
|
|
65282
65283
|
return { data: null, partial: false, stale: false, hasData: true };
|
|
@@ -65301,11 +65302,28 @@ var CacheInternal = class {
|
|
|
65301
65302
|
let targetSelection = getFieldsForType(selection, typename);
|
|
65302
65303
|
for (const [
|
|
65303
65304
|
attributeName,
|
|
65304
|
-
{ type, keyRaw, selection: fieldSelection, nullable, list, visible }
|
|
65305
|
+
{ type, keyRaw, selection: fieldSelection, nullable, list, visible, directives }
|
|
65305
65306
|
] of Object.entries(targetSelection)) {
|
|
65306
|
-
if (!visible && !ignoreMasking) {
|
|
65307
|
+
if (!visible && !ignoreMasking && !fullCheck) {
|
|
65307
65308
|
continue;
|
|
65308
65309
|
}
|
|
65310
|
+
const includeDirective = directives?.find((d) => {
|
|
65311
|
+
return d.name === "include";
|
|
65312
|
+
});
|
|
65313
|
+
if (includeDirective) {
|
|
65314
|
+
if (!evaluateFragmentVariables(includeDirective.arguments, variables ?? {})["if"]) {
|
|
65315
|
+
continue;
|
|
65316
|
+
}
|
|
65317
|
+
}
|
|
65318
|
+
const skipDirective = directives?.find((d) => {
|
|
65319
|
+
return d.name === "skip";
|
|
65320
|
+
});
|
|
65321
|
+
if (skipDirective) {
|
|
65322
|
+
if (evaluateFragmentVariables(skipDirective.arguments, variables ?? {})["if"]) {
|
|
65323
|
+
continue;
|
|
65324
|
+
}
|
|
65325
|
+
}
|
|
65326
|
+
const fieldTarget = visible || ignoreMasking ? target : {};
|
|
65309
65327
|
const key = evaluateKey(keyRaw, variables);
|
|
65310
65328
|
const { value } = this.storage.get(parent, key);
|
|
65311
65329
|
const dt_field = this.staleManager.getFieldTime(parent, key);
|
|
@@ -65328,16 +65346,16 @@ var CacheInternal = class {
|
|
|
65328
65346
|
partial = true;
|
|
65329
65347
|
}
|
|
65330
65348
|
if (typeof value === "undefined" || value === null) {
|
|
65331
|
-
|
|
65349
|
+
fieldTarget[attributeName] = null;
|
|
65332
65350
|
if (typeof value !== "undefined") {
|
|
65333
65351
|
hasData = true;
|
|
65334
65352
|
}
|
|
65335
65353
|
} else if (!fieldSelection) {
|
|
65336
65354
|
const fnUnmarshal = this.config?.scalars?.[type]?.unmarshal;
|
|
65337
65355
|
if (fnUnmarshal) {
|
|
65338
|
-
|
|
65356
|
+
fieldTarget[attributeName] = fnUnmarshal(value);
|
|
65339
65357
|
} else {
|
|
65340
|
-
|
|
65358
|
+
fieldTarget[attributeName] = value;
|
|
65341
65359
|
}
|
|
65342
65360
|
hasData = true;
|
|
65343
65361
|
} else if (Array.isArray(value)) {
|
|
@@ -65346,9 +65364,10 @@ var CacheInternal = class {
|
|
|
65346
65364
|
variables,
|
|
65347
65365
|
linkedList: value,
|
|
65348
65366
|
stepsFromConnection: nextStep,
|
|
65349
|
-
ignoreMasking: !!ignoreMasking
|
|
65367
|
+
ignoreMasking: !!ignoreMasking,
|
|
65368
|
+
fullCheck
|
|
65350
65369
|
});
|
|
65351
|
-
|
|
65370
|
+
fieldTarget[attributeName] = listValue.data;
|
|
65352
65371
|
if (listValue.partial) {
|
|
65353
65372
|
partial = true;
|
|
65354
65373
|
}
|
|
@@ -65364,9 +65383,10 @@ var CacheInternal = class {
|
|
|
65364
65383
|
selection: fieldSelection,
|
|
65365
65384
|
variables,
|
|
65366
65385
|
stepsFromConnection: nextStep,
|
|
65367
|
-
ignoreMasking
|
|
65386
|
+
ignoreMasking,
|
|
65387
|
+
fullCheck
|
|
65368
65388
|
});
|
|
65369
|
-
|
|
65389
|
+
fieldTarget[attributeName] = objectFields.data;
|
|
65370
65390
|
if (objectFields.partial) {
|
|
65371
65391
|
partial = true;
|
|
65372
65392
|
}
|
|
@@ -65377,7 +65397,7 @@ var CacheInternal = class {
|
|
|
65377
65397
|
hasData = true;
|
|
65378
65398
|
}
|
|
65379
65399
|
}
|
|
65380
|
-
if (
|
|
65400
|
+
if (fieldTarget[attributeName] === null && !nullable && !embeddedCursor) {
|
|
65381
65401
|
cascadeNull = true;
|
|
65382
65402
|
}
|
|
65383
65403
|
}
|
|
@@ -65409,7 +65429,8 @@ var CacheInternal = class {
|
|
|
65409
65429
|
variables,
|
|
65410
65430
|
linkedList,
|
|
65411
65431
|
stepsFromConnection,
|
|
65412
|
-
ignoreMasking
|
|
65432
|
+
ignoreMasking,
|
|
65433
|
+
fullCheck
|
|
65413
65434
|
}) {
|
|
65414
65435
|
const result = [];
|
|
65415
65436
|
let partialData = false;
|
|
@@ -65422,7 +65443,8 @@ var CacheInternal = class {
|
|
|
65422
65443
|
variables,
|
|
65423
65444
|
linkedList: entry,
|
|
65424
65445
|
stepsFromConnection,
|
|
65425
|
-
ignoreMasking
|
|
65446
|
+
ignoreMasking,
|
|
65447
|
+
fullCheck
|
|
65426
65448
|
});
|
|
65427
65449
|
result.push(nestedValue.data);
|
|
65428
65450
|
if (nestedValue.partial) {
|
|
@@ -65444,7 +65466,8 @@ var CacheInternal = class {
|
|
|
65444
65466
|
selection: fields,
|
|
65445
65467
|
variables,
|
|
65446
65468
|
stepsFromConnection,
|
|
65447
|
-
ignoreMasking
|
|
65469
|
+
ignoreMasking,
|
|
65470
|
+
fullCheck
|
|
65448
65471
|
});
|
|
65449
65472
|
result.push(data);
|
|
65450
65473
|
if (partial) {
|
|
@@ -65607,7 +65630,8 @@ var cachePolicy = ({
|
|
|
65607
65630
|
if (policy !== CachePolicy.NetworkOnly) {
|
|
65608
65631
|
const value = localCache.read({
|
|
65609
65632
|
selection: artifact.selection,
|
|
65610
|
-
variables: marshalVariables2(ctx)
|
|
65633
|
+
variables: marshalVariables2(ctx),
|
|
65634
|
+
fullCheck: true
|
|
65611
65635
|
});
|
|
65612
65636
|
const allowed = !value.partial || artifact.kind === ArtifactKind.Query && artifact.partial;
|
|
65613
65637
|
if (policy === CachePolicy.CacheOnly) {
|
|
@@ -66823,7 +66847,7 @@ var Config = class {
|
|
|
66823
66847
|
fragment: fragment2
|
|
66824
66848
|
}) {
|
|
66825
66849
|
this.#fragmentVariableMaps[hash] = {
|
|
66826
|
-
args: this
|
|
66850
|
+
args: this.serializeValueMap(args),
|
|
66827
66851
|
fragment: fragment2
|
|
66828
66852
|
};
|
|
66829
66853
|
}
|
|
@@ -66834,7 +66858,7 @@ var Config = class {
|
|
|
66834
66858
|
hash
|
|
66835
66859
|
};
|
|
66836
66860
|
}
|
|
66837
|
-
|
|
66861
|
+
serializeValueMap(map) {
|
|
66838
66862
|
if (!map) {
|
|
66839
66863
|
return null;
|
|
66840
66864
|
}
|
|
@@ -66849,7 +66873,7 @@ var Config = class {
|
|
|
66849
66873
|
}
|
|
66850
66874
|
if ("values" in input) {
|
|
66851
66875
|
result.values = input.values.map(
|
|
66852
|
-
(value) => this
|
|
66876
|
+
(value) => this.serializeValueMap({ foo: value }).foo
|
|
66853
66877
|
);
|
|
66854
66878
|
}
|
|
66855
66879
|
if ("name" in input) {
|
|
@@ -66858,7 +66882,7 @@ var Config = class {
|
|
|
66858
66882
|
if ("fields" in input) {
|
|
66859
66883
|
result.fields = input.fields.map((field) => ({
|
|
66860
66884
|
name: field.name,
|
|
66861
|
-
value: this
|
|
66885
|
+
value: this.serializeValueMap({ foo: field.value }).foo
|
|
66862
66886
|
}));
|
|
66863
66887
|
}
|
|
66864
66888
|
}
|
package/build/lib-esm/index.js
CHANGED
|
@@ -65221,7 +65221,8 @@ var CacheInternal = class {
|
|
|
65221
65221
|
parent = rootID,
|
|
65222
65222
|
variables,
|
|
65223
65223
|
stepsFromConnection = null,
|
|
65224
|
-
ignoreMasking
|
|
65224
|
+
ignoreMasking,
|
|
65225
|
+
fullCheck = false
|
|
65225
65226
|
}) {
|
|
65226
65227
|
if (parent === null) {
|
|
65227
65228
|
return { data: null, partial: false, stale: false, hasData: true };
|
|
@@ -65246,11 +65247,28 @@ var CacheInternal = class {
|
|
|
65246
65247
|
let targetSelection = getFieldsForType(selection, typename);
|
|
65247
65248
|
for (const [
|
|
65248
65249
|
attributeName,
|
|
65249
|
-
{ type, keyRaw, selection: fieldSelection, nullable, list, visible }
|
|
65250
|
+
{ type, keyRaw, selection: fieldSelection, nullable, list, visible, directives }
|
|
65250
65251
|
] of Object.entries(targetSelection)) {
|
|
65251
|
-
if (!visible && !ignoreMasking) {
|
|
65252
|
+
if (!visible && !ignoreMasking && !fullCheck) {
|
|
65252
65253
|
continue;
|
|
65253
65254
|
}
|
|
65255
|
+
const includeDirective = directives?.find((d) => {
|
|
65256
|
+
return d.name === "include";
|
|
65257
|
+
});
|
|
65258
|
+
if (includeDirective) {
|
|
65259
|
+
if (!evaluateFragmentVariables(includeDirective.arguments, variables ?? {})["if"]) {
|
|
65260
|
+
continue;
|
|
65261
|
+
}
|
|
65262
|
+
}
|
|
65263
|
+
const skipDirective = directives?.find((d) => {
|
|
65264
|
+
return d.name === "skip";
|
|
65265
|
+
});
|
|
65266
|
+
if (skipDirective) {
|
|
65267
|
+
if (evaluateFragmentVariables(skipDirective.arguments, variables ?? {})["if"]) {
|
|
65268
|
+
continue;
|
|
65269
|
+
}
|
|
65270
|
+
}
|
|
65271
|
+
const fieldTarget = visible || ignoreMasking ? target : {};
|
|
65254
65272
|
const key = evaluateKey(keyRaw, variables);
|
|
65255
65273
|
const { value } = this.storage.get(parent, key);
|
|
65256
65274
|
const dt_field = this.staleManager.getFieldTime(parent, key);
|
|
@@ -65273,16 +65291,16 @@ var CacheInternal = class {
|
|
|
65273
65291
|
partial = true;
|
|
65274
65292
|
}
|
|
65275
65293
|
if (typeof value === "undefined" || value === null) {
|
|
65276
|
-
|
|
65294
|
+
fieldTarget[attributeName] = null;
|
|
65277
65295
|
if (typeof value !== "undefined") {
|
|
65278
65296
|
hasData = true;
|
|
65279
65297
|
}
|
|
65280
65298
|
} else if (!fieldSelection) {
|
|
65281
65299
|
const fnUnmarshal = this.config?.scalars?.[type]?.unmarshal;
|
|
65282
65300
|
if (fnUnmarshal) {
|
|
65283
|
-
|
|
65301
|
+
fieldTarget[attributeName] = fnUnmarshal(value);
|
|
65284
65302
|
} else {
|
|
65285
|
-
|
|
65303
|
+
fieldTarget[attributeName] = value;
|
|
65286
65304
|
}
|
|
65287
65305
|
hasData = true;
|
|
65288
65306
|
} else if (Array.isArray(value)) {
|
|
@@ -65291,9 +65309,10 @@ var CacheInternal = class {
|
|
|
65291
65309
|
variables,
|
|
65292
65310
|
linkedList: value,
|
|
65293
65311
|
stepsFromConnection: nextStep,
|
|
65294
|
-
ignoreMasking: !!ignoreMasking
|
|
65312
|
+
ignoreMasking: !!ignoreMasking,
|
|
65313
|
+
fullCheck
|
|
65295
65314
|
});
|
|
65296
|
-
|
|
65315
|
+
fieldTarget[attributeName] = listValue.data;
|
|
65297
65316
|
if (listValue.partial) {
|
|
65298
65317
|
partial = true;
|
|
65299
65318
|
}
|
|
@@ -65309,9 +65328,10 @@ var CacheInternal = class {
|
|
|
65309
65328
|
selection: fieldSelection,
|
|
65310
65329
|
variables,
|
|
65311
65330
|
stepsFromConnection: nextStep,
|
|
65312
|
-
ignoreMasking
|
|
65331
|
+
ignoreMasking,
|
|
65332
|
+
fullCheck
|
|
65313
65333
|
});
|
|
65314
|
-
|
|
65334
|
+
fieldTarget[attributeName] = objectFields.data;
|
|
65315
65335
|
if (objectFields.partial) {
|
|
65316
65336
|
partial = true;
|
|
65317
65337
|
}
|
|
@@ -65322,7 +65342,7 @@ var CacheInternal = class {
|
|
|
65322
65342
|
hasData = true;
|
|
65323
65343
|
}
|
|
65324
65344
|
}
|
|
65325
|
-
if (
|
|
65345
|
+
if (fieldTarget[attributeName] === null && !nullable && !embeddedCursor) {
|
|
65326
65346
|
cascadeNull = true;
|
|
65327
65347
|
}
|
|
65328
65348
|
}
|
|
@@ -65354,7 +65374,8 @@ var CacheInternal = class {
|
|
|
65354
65374
|
variables,
|
|
65355
65375
|
linkedList,
|
|
65356
65376
|
stepsFromConnection,
|
|
65357
|
-
ignoreMasking
|
|
65377
|
+
ignoreMasking,
|
|
65378
|
+
fullCheck
|
|
65358
65379
|
}) {
|
|
65359
65380
|
const result = [];
|
|
65360
65381
|
let partialData = false;
|
|
@@ -65367,7 +65388,8 @@ var CacheInternal = class {
|
|
|
65367
65388
|
variables,
|
|
65368
65389
|
linkedList: entry,
|
|
65369
65390
|
stepsFromConnection,
|
|
65370
|
-
ignoreMasking
|
|
65391
|
+
ignoreMasking,
|
|
65392
|
+
fullCheck
|
|
65371
65393
|
});
|
|
65372
65394
|
result.push(nestedValue.data);
|
|
65373
65395
|
if (nestedValue.partial) {
|
|
@@ -65389,7 +65411,8 @@ var CacheInternal = class {
|
|
|
65389
65411
|
selection: fields,
|
|
65390
65412
|
variables,
|
|
65391
65413
|
stepsFromConnection,
|
|
65392
|
-
ignoreMasking
|
|
65414
|
+
ignoreMasking,
|
|
65415
|
+
fullCheck
|
|
65393
65416
|
});
|
|
65394
65417
|
result.push(data);
|
|
65395
65418
|
if (partial) {
|
|
@@ -65552,7 +65575,8 @@ var cachePolicy = ({
|
|
|
65552
65575
|
if (policy !== CachePolicy.NetworkOnly) {
|
|
65553
65576
|
const value = localCache.read({
|
|
65554
65577
|
selection: artifact.selection,
|
|
65555
|
-
variables: marshalVariables2(ctx)
|
|
65578
|
+
variables: marshalVariables2(ctx),
|
|
65579
|
+
fullCheck: true
|
|
65556
65580
|
});
|
|
65557
65581
|
const allowed = !value.partial || artifact.kind === ArtifactKind.Query && artifact.partial;
|
|
65558
65582
|
if (policy === CachePolicy.CacheOnly) {
|
|
@@ -66767,7 +66791,7 @@ var Config = class {
|
|
|
66767
66791
|
fragment: fragment2
|
|
66768
66792
|
}) {
|
|
66769
66793
|
this.#fragmentVariableMaps[hash] = {
|
|
66770
|
-
args: this
|
|
66794
|
+
args: this.serializeValueMap(args),
|
|
66771
66795
|
fragment: fragment2
|
|
66772
66796
|
};
|
|
66773
66797
|
}
|
|
@@ -66778,7 +66802,7 @@ var Config = class {
|
|
|
66778
66802
|
hash
|
|
66779
66803
|
};
|
|
66780
66804
|
}
|
|
66781
|
-
|
|
66805
|
+
serializeValueMap(map) {
|
|
66782
66806
|
if (!map) {
|
|
66783
66807
|
return null;
|
|
66784
66808
|
}
|
|
@@ -66793,7 +66817,7 @@ var Config = class {
|
|
|
66793
66817
|
}
|
|
66794
66818
|
if ("values" in input) {
|
|
66795
66819
|
result.values = input.values.map(
|
|
66796
|
-
(value) => this
|
|
66820
|
+
(value) => this.serializeValueMap({ foo: value }).foo
|
|
66797
66821
|
);
|
|
66798
66822
|
}
|
|
66799
66823
|
if ("name" in input) {
|
|
@@ -66802,7 +66826,7 @@ var Config = class {
|
|
|
66802
66826
|
if ("fields" in input) {
|
|
66803
66827
|
result.fields = input.fields.map((field) => ({
|
|
66804
66828
|
name: field.name,
|
|
66805
|
-
value: this
|
|
66829
|
+
value: this.serializeValueMap({ foo: field.value }).foo
|
|
66806
66830
|
}));
|
|
66807
66831
|
}
|
|
66808
66832
|
}
|
|
@@ -87,12 +87,13 @@ declare class CacheInternal {
|
|
|
87
87
|
forceNotify?: boolean;
|
|
88
88
|
forceStale?: boolean;
|
|
89
89
|
}): FieldSelection[];
|
|
90
|
-
getSelection({ selection, parent, variables, stepsFromConnection, ignoreMasking, }: {
|
|
90
|
+
getSelection({ selection, parent, variables, stepsFromConnection, ignoreMasking, fullCheck, }: {
|
|
91
91
|
selection: SubscriptionSelection;
|
|
92
92
|
parent?: string;
|
|
93
93
|
variables?: {};
|
|
94
94
|
stepsFromConnection?: number | null;
|
|
95
95
|
ignoreMasking?: boolean;
|
|
96
|
+
fullCheck?: boolean;
|
|
96
97
|
}): {
|
|
97
98
|
data: GraphQLObject | null;
|
|
98
99
|
partial: boolean;
|
|
@@ -103,12 +104,13 @@ declare class CacheInternal {
|
|
|
103
104
|
id(type: string, id: string): string | null;
|
|
104
105
|
idFields(type: string): string[];
|
|
105
106
|
computeID(type: string, data: any): string;
|
|
106
|
-
hydrateNestedList({ fields, variables, linkedList, stepsFromConnection, ignoreMasking, }: {
|
|
107
|
+
hydrateNestedList({ fields, variables, linkedList, stepsFromConnection, ignoreMasking, fullCheck, }: {
|
|
107
108
|
fields: SubscriptionSelection;
|
|
108
109
|
variables?: {};
|
|
109
110
|
linkedList: NestedList;
|
|
110
111
|
stepsFromConnection: number | null;
|
|
111
112
|
ignoreMasking: boolean;
|
|
113
|
+
fullCheck?: boolean;
|
|
112
114
|
}): {
|
|
113
115
|
data: NestedList<GraphQLValue>;
|
|
114
116
|
partial: boolean;
|
|
@@ -87,12 +87,13 @@ declare class CacheInternal {
|
|
|
87
87
|
forceNotify?: boolean;
|
|
88
88
|
forceStale?: boolean;
|
|
89
89
|
}): FieldSelection[];
|
|
90
|
-
getSelection({ selection, parent, variables, stepsFromConnection, ignoreMasking, }: {
|
|
90
|
+
getSelection({ selection, parent, variables, stepsFromConnection, ignoreMasking, fullCheck, }: {
|
|
91
91
|
selection: SubscriptionSelection;
|
|
92
92
|
parent?: string;
|
|
93
93
|
variables?: {};
|
|
94
94
|
stepsFromConnection?: number | null;
|
|
95
95
|
ignoreMasking?: boolean;
|
|
96
|
+
fullCheck?: boolean;
|
|
96
97
|
}): {
|
|
97
98
|
data: GraphQLObject | null;
|
|
98
99
|
partial: boolean;
|
|
@@ -103,12 +104,13 @@ declare class CacheInternal {
|
|
|
103
104
|
id(type: string, id: string): string | null;
|
|
104
105
|
idFields(type: string): string[];
|
|
105
106
|
computeID(type: string, data: any): string;
|
|
106
|
-
hydrateNestedList({ fields, variables, linkedList, stepsFromConnection, ignoreMasking, }: {
|
|
107
|
+
hydrateNestedList({ fields, variables, linkedList, stepsFromConnection, ignoreMasking, fullCheck, }: {
|
|
107
108
|
fields: SubscriptionSelection;
|
|
108
109
|
variables?: {};
|
|
109
110
|
linkedList: NestedList;
|
|
110
111
|
stepsFromConnection: number | null;
|
|
111
112
|
ignoreMasking: boolean;
|
|
113
|
+
fullCheck?: boolean;
|
|
112
114
|
}): {
|
|
113
115
|
data: NestedList<GraphQLValue>;
|
|
114
116
|
partial: boolean;
|
|
@@ -471,7 +471,8 @@ class CacheInternal {
|
|
|
471
471
|
parent = rootID,
|
|
472
472
|
variables,
|
|
473
473
|
stepsFromConnection = null,
|
|
474
|
-
ignoreMasking
|
|
474
|
+
ignoreMasking,
|
|
475
|
+
fullCheck = false
|
|
475
476
|
}) {
|
|
476
477
|
if (parent === null) {
|
|
477
478
|
return { data: null, partial: false, stale: false, hasData: true };
|
|
@@ -496,11 +497,28 @@ class CacheInternal {
|
|
|
496
497
|
let targetSelection = (0, import_selection.getFieldsForType)(selection, typename);
|
|
497
498
|
for (const [
|
|
498
499
|
attributeName,
|
|
499
|
-
{ type, keyRaw, selection: fieldSelection, nullable, list, visible }
|
|
500
|
+
{ type, keyRaw, selection: fieldSelection, nullable, list, visible, directives }
|
|
500
501
|
] of Object.entries(targetSelection)) {
|
|
501
|
-
if (!visible && !ignoreMasking) {
|
|
502
|
+
if (!visible && !ignoreMasking && !fullCheck) {
|
|
502
503
|
continue;
|
|
503
504
|
}
|
|
505
|
+
const includeDirective = directives?.find((d) => {
|
|
506
|
+
return d.name === "include";
|
|
507
|
+
});
|
|
508
|
+
if (includeDirective) {
|
|
509
|
+
if (!evaluateFragmentVariables(includeDirective.arguments, variables ?? {})["if"]) {
|
|
510
|
+
continue;
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
const skipDirective = directives?.find((d) => {
|
|
514
|
+
return d.name === "skip";
|
|
515
|
+
});
|
|
516
|
+
if (skipDirective) {
|
|
517
|
+
if (evaluateFragmentVariables(skipDirective.arguments, variables ?? {})["if"]) {
|
|
518
|
+
continue;
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
const fieldTarget = visible || ignoreMasking ? target : {};
|
|
504
522
|
const key = (0, import_stuff.evaluateKey)(keyRaw, variables);
|
|
505
523
|
const { value } = this.storage.get(parent, key);
|
|
506
524
|
const dt_field = this.staleManager.getFieldTime(parent, key);
|
|
@@ -523,16 +541,16 @@ class CacheInternal {
|
|
|
523
541
|
partial = true;
|
|
524
542
|
}
|
|
525
543
|
if (typeof value === "undefined" || value === null) {
|
|
526
|
-
|
|
544
|
+
fieldTarget[attributeName] = null;
|
|
527
545
|
if (typeof value !== "undefined") {
|
|
528
546
|
hasData = true;
|
|
529
547
|
}
|
|
530
548
|
} else if (!fieldSelection) {
|
|
531
549
|
const fnUnmarshal = this.config?.scalars?.[type]?.unmarshal;
|
|
532
550
|
if (fnUnmarshal) {
|
|
533
|
-
|
|
551
|
+
fieldTarget[attributeName] = fnUnmarshal(value);
|
|
534
552
|
} else {
|
|
535
|
-
|
|
553
|
+
fieldTarget[attributeName] = value;
|
|
536
554
|
}
|
|
537
555
|
hasData = true;
|
|
538
556
|
} else if (Array.isArray(value)) {
|
|
@@ -541,9 +559,10 @@ class CacheInternal {
|
|
|
541
559
|
variables,
|
|
542
560
|
linkedList: value,
|
|
543
561
|
stepsFromConnection: nextStep,
|
|
544
|
-
ignoreMasking: !!ignoreMasking
|
|
562
|
+
ignoreMasking: !!ignoreMasking,
|
|
563
|
+
fullCheck
|
|
545
564
|
});
|
|
546
|
-
|
|
565
|
+
fieldTarget[attributeName] = listValue.data;
|
|
547
566
|
if (listValue.partial) {
|
|
548
567
|
partial = true;
|
|
549
568
|
}
|
|
@@ -559,9 +578,10 @@ class CacheInternal {
|
|
|
559
578
|
selection: fieldSelection,
|
|
560
579
|
variables,
|
|
561
580
|
stepsFromConnection: nextStep,
|
|
562
|
-
ignoreMasking
|
|
581
|
+
ignoreMasking,
|
|
582
|
+
fullCheck
|
|
563
583
|
});
|
|
564
|
-
|
|
584
|
+
fieldTarget[attributeName] = objectFields.data;
|
|
565
585
|
if (objectFields.partial) {
|
|
566
586
|
partial = true;
|
|
567
587
|
}
|
|
@@ -572,7 +592,7 @@ class CacheInternal {
|
|
|
572
592
|
hasData = true;
|
|
573
593
|
}
|
|
574
594
|
}
|
|
575
|
-
if (
|
|
595
|
+
if (fieldTarget[attributeName] === null && !nullable && !embeddedCursor) {
|
|
576
596
|
cascadeNull = true;
|
|
577
597
|
}
|
|
578
598
|
}
|
|
@@ -604,7 +624,8 @@ class CacheInternal {
|
|
|
604
624
|
variables,
|
|
605
625
|
linkedList,
|
|
606
626
|
stepsFromConnection,
|
|
607
|
-
ignoreMasking
|
|
627
|
+
ignoreMasking,
|
|
628
|
+
fullCheck
|
|
608
629
|
}) {
|
|
609
630
|
const result = [];
|
|
610
631
|
let partialData = false;
|
|
@@ -617,7 +638,8 @@ class CacheInternal {
|
|
|
617
638
|
variables,
|
|
618
639
|
linkedList: entry,
|
|
619
640
|
stepsFromConnection,
|
|
620
|
-
ignoreMasking
|
|
641
|
+
ignoreMasking,
|
|
642
|
+
fullCheck
|
|
621
643
|
});
|
|
622
644
|
result.push(nestedValue.data);
|
|
623
645
|
if (nestedValue.partial) {
|
|
@@ -639,7 +661,8 @@ class CacheInternal {
|
|
|
639
661
|
selection: fields,
|
|
640
662
|
variables,
|
|
641
663
|
stepsFromConnection,
|
|
642
|
-
ignoreMasking
|
|
664
|
+
ignoreMasking,
|
|
665
|
+
fullCheck
|
|
643
666
|
});
|
|
644
667
|
result.push(data);
|
|
645
668
|
if (partial) {
|
|
@@ -45,7 +45,8 @@ const cachePolicy = ({
|
|
|
45
45
|
if (policy !== import_types.CachePolicy.NetworkOnly) {
|
|
46
46
|
const value = localCache.read({
|
|
47
47
|
selection: artifact.selection,
|
|
48
|
-
variables: marshalVariables(ctx)
|
|
48
|
+
variables: marshalVariables(ctx),
|
|
49
|
+
fullCheck: true
|
|
49
50
|
});
|
|
50
51
|
const allowed = !value.partial || artifact.kind === import_types.ArtifactKind.Query && artifact.partial;
|
|
51
52
|
if (policy === import_types.CachePolicy.CacheOnly) {
|
|
@@ -87,12 +87,13 @@ declare class CacheInternal {
|
|
|
87
87
|
forceNotify?: boolean;
|
|
88
88
|
forceStale?: boolean;
|
|
89
89
|
}): FieldSelection[];
|
|
90
|
-
getSelection({ selection, parent, variables, stepsFromConnection, ignoreMasking, }: {
|
|
90
|
+
getSelection({ selection, parent, variables, stepsFromConnection, ignoreMasking, fullCheck, }: {
|
|
91
91
|
selection: SubscriptionSelection;
|
|
92
92
|
parent?: string;
|
|
93
93
|
variables?: {};
|
|
94
94
|
stepsFromConnection?: number | null;
|
|
95
95
|
ignoreMasking?: boolean;
|
|
96
|
+
fullCheck?: boolean;
|
|
96
97
|
}): {
|
|
97
98
|
data: GraphQLObject | null;
|
|
98
99
|
partial: boolean;
|
|
@@ -103,12 +104,13 @@ declare class CacheInternal {
|
|
|
103
104
|
id(type: string, id: string): string | null;
|
|
104
105
|
idFields(type: string): string[];
|
|
105
106
|
computeID(type: string, data: any): string;
|
|
106
|
-
hydrateNestedList({ fields, variables, linkedList, stepsFromConnection, ignoreMasking, }: {
|
|
107
|
+
hydrateNestedList({ fields, variables, linkedList, stepsFromConnection, ignoreMasking, fullCheck, }: {
|
|
107
108
|
fields: SubscriptionSelection;
|
|
108
109
|
variables?: {};
|
|
109
110
|
linkedList: NestedList;
|
|
110
111
|
stepsFromConnection: number | null;
|
|
111
112
|
ignoreMasking: boolean;
|
|
113
|
+
fullCheck?: boolean;
|
|
112
114
|
}): {
|
|
113
115
|
data: NestedList<GraphQLValue>;
|
|
114
116
|
partial: boolean;
|