houdini 0.17.14 → 0.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cmd-cjs/index.js +442 -203
- package/build/cmd-esm/index.js +442 -203
- package/build/codegen/utils/flattenSelections.d.ts +3 -1
- package/build/codegen-cjs/index.js +409 -182
- package/build/codegen-esm/index.js +409 -182
- package/build/lib/config.d.ts +8 -3
- package/build/lib-cjs/index.js +145 -83
- package/build/lib-esm/index.js +145 -83
- package/build/runtime/cache/subscription.d.ts +3 -3
- package/build/runtime/lib/config.d.ts +2 -1
- package/build/runtime/lib/scalars.d.ts +2 -2
- package/build/runtime/lib/selection.d.ts +2 -0
- package/build/runtime/lib/types.d.ts +26 -16
- package/build/runtime-cjs/cache/cache.js +42 -25
- package/build/runtime-cjs/cache/lists.js +40 -26
- package/build/runtime-cjs/cache/subscription.d.ts +3 -3
- package/build/runtime-cjs/cache/subscription.js +23 -21
- package/build/runtime-cjs/lib/config.d.ts +2 -1
- package/build/runtime-cjs/lib/scalars.d.ts +2 -2
- package/build/runtime-cjs/lib/scalars.js +9 -6
- package/build/runtime-cjs/lib/selection.d.ts +2 -0
- package/build/runtime-cjs/lib/selection.js +39 -0
- package/build/runtime-cjs/lib/types.d.ts +26 -16
- package/build/runtime-esm/cache/cache.js +42 -25
- package/build/runtime-esm/cache/lists.js +40 -26
- package/build/runtime-esm/cache/subscription.d.ts +3 -3
- package/build/runtime-esm/cache/subscription.js +23 -21
- package/build/runtime-esm/lib/config.d.ts +2 -1
- package/build/runtime-esm/lib/scalars.d.ts +2 -2
- package/build/runtime-esm/lib/scalars.js +9 -6
- package/build/runtime-esm/lib/selection.d.ts +2 -0
- package/build/runtime-esm/lib/selection.js +15 -0
- package/build/runtime-esm/lib/types.d.ts +26 -16
- package/build/test/index.d.ts +1 -2
- package/build/test-cjs/index.js +489 -197
- package/build/test-esm/index.js +489 -197
- package/build/vite-cjs/index.js +442 -195
- package/build/vite-esm/index.js +442 -195
- package/package.json +3 -3
- package/build/runtime-cjs/cache/tests/availability.test.js +0 -357
- package/build/runtime-cjs/cache/tests/gc.test.js +0 -271
- package/build/runtime-cjs/cache/tests/keys.test.js +0 -34
- package/build/runtime-cjs/cache/tests/list.test.js +0 -3390
- package/build/runtime-cjs/cache/tests/readwrite.test.js +0 -1076
- package/build/runtime-cjs/cache/tests/scalars.test.js +0 -181
- package/build/runtime-cjs/cache/tests/storage.test.js +0 -280
- package/build/runtime-cjs/cache/tests/subscriptions.test.js +0 -1469
- package/build/runtime-cjs/lib/scalars.test.js +0 -736
- package/build/runtime-esm/cache/tests/availability.test.js +0 -356
- package/build/runtime-esm/cache/tests/gc.test.js +0 -270
- package/build/runtime-esm/cache/tests/keys.test.js +0 -33
- package/build/runtime-esm/cache/tests/list.test.js +0 -3389
- package/build/runtime-esm/cache/tests/readwrite.test.js +0 -1075
- package/build/runtime-esm/cache/tests/scalars.test.js +0 -180
- package/build/runtime-esm/cache/tests/storage.test.js +0 -279
- package/build/runtime-esm/cache/tests/subscriptions.test.js +0 -1468
- package/build/runtime-esm/lib/scalars.test.js +0 -735
package/build/lib/config.d.ts
CHANGED
|
@@ -26,7 +26,7 @@ export declare class Config {
|
|
|
26
26
|
typeConfig: ConfigFile['types'];
|
|
27
27
|
configFile: ConfigFile;
|
|
28
28
|
logLevel: LogLevel;
|
|
29
|
-
|
|
29
|
+
defaultFragmentMasking: 'enable' | 'disable';
|
|
30
30
|
configIsRoute: ((filepath: string) => boolean) | null;
|
|
31
31
|
routesDir: string;
|
|
32
32
|
schemaPollInterval: number | null;
|
|
@@ -76,12 +76,17 @@ export declare class Config {
|
|
|
76
76
|
}): boolean;
|
|
77
77
|
pluginRuntimeDirectory(name: string): string;
|
|
78
78
|
pluginDirectory(name: string): string;
|
|
79
|
-
get
|
|
79
|
+
get manualLoadDirective(): string;
|
|
80
|
+
get maskEnableDirective(): string;
|
|
81
|
+
get maskDisableDirective(): string;
|
|
80
82
|
get listDirective(): string;
|
|
81
83
|
get listPrependDirective(): string;
|
|
82
84
|
get listAppendDirective(): string;
|
|
83
85
|
get listParentDirective(): string;
|
|
84
|
-
|
|
86
|
+
/**
|
|
87
|
+
* @deprecated
|
|
88
|
+
*/
|
|
89
|
+
get deprecatedlistDirectiveParentIDArg(): string;
|
|
85
90
|
get listAllListsDirective(): string;
|
|
86
91
|
get listNameArg(): string;
|
|
87
92
|
get insertFragmentSuffix(): string;
|
package/build/lib-cjs/index.js
CHANGED
|
@@ -60985,6 +60985,20 @@ function deepEquals(objA, objB, map = /* @__PURE__ */ new WeakMap()) {
|
|
|
60985
60985
|
return true;
|
|
60986
60986
|
}
|
|
60987
60987
|
|
|
60988
|
+
// src/runtime/lib/selection.ts
|
|
60989
|
+
function getFieldsForType(selection, __typename) {
|
|
60990
|
+
let targetSelection = selection.fields || {};
|
|
60991
|
+
if (selection.abstractFields && __typename) {
|
|
60992
|
+
const mappedType = selection.abstractFields.typeMap[__typename];
|
|
60993
|
+
if (mappedType) {
|
|
60994
|
+
targetSelection = selection.abstractFields.fields[mappedType];
|
|
60995
|
+
} else if (selection.abstractFields.fields[__typename]) {
|
|
60996
|
+
targetSelection = selection.abstractFields.fields[__typename];
|
|
60997
|
+
}
|
|
60998
|
+
}
|
|
60999
|
+
return targetSelection;
|
|
61000
|
+
}
|
|
61001
|
+
|
|
60988
61002
|
// src/runtime/cache/gc.ts
|
|
60989
61003
|
var GarbageCollector = class {
|
|
60990
61004
|
cache;
|
|
@@ -61207,23 +61221,32 @@ var List = class {
|
|
|
61207
61221
|
let insertData = data;
|
|
61208
61222
|
if (this.connection) {
|
|
61209
61223
|
insertSelection = {
|
|
61210
|
-
|
|
61211
|
-
|
|
61212
|
-
|
|
61213
|
-
|
|
61214
|
-
|
|
61215
|
-
keyRaw: "edges",
|
|
61216
|
-
type: "ConnectionEdge",
|
|
61217
|
-
update: where === "first" ? "prepend" : "append",
|
|
61224
|
+
fields: {
|
|
61225
|
+
newEntry: {
|
|
61226
|
+
keyRaw: this.key,
|
|
61227
|
+
type: "Connection",
|
|
61228
|
+
selection: {
|
|
61218
61229
|
fields: {
|
|
61219
|
-
|
|
61220
|
-
|
|
61221
|
-
|
|
61222
|
-
|
|
61223
|
-
|
|
61224
|
-
|
|
61225
|
-
|
|
61226
|
-
|
|
61230
|
+
edges: {
|
|
61231
|
+
keyRaw: "edges",
|
|
61232
|
+
type: "ConnectionEdge",
|
|
61233
|
+
update: where === "first" ? "prepend" : "append",
|
|
61234
|
+
selection: {
|
|
61235
|
+
fields: {
|
|
61236
|
+
node: {
|
|
61237
|
+
type: listType,
|
|
61238
|
+
keyRaw: "node",
|
|
61239
|
+
selection: {
|
|
61240
|
+
...selection,
|
|
61241
|
+
fields: {
|
|
61242
|
+
...selection.fields,
|
|
61243
|
+
__typename: {
|
|
61244
|
+
keyRaw: "__typename",
|
|
61245
|
+
type: "String"
|
|
61246
|
+
}
|
|
61247
|
+
}
|
|
61248
|
+
}
|
|
61249
|
+
}
|
|
61227
61250
|
}
|
|
61228
61251
|
}
|
|
61229
61252
|
}
|
|
@@ -61239,15 +61262,20 @@ var List = class {
|
|
|
61239
61262
|
};
|
|
61240
61263
|
} else {
|
|
61241
61264
|
insertSelection = {
|
|
61242
|
-
|
|
61243
|
-
|
|
61244
|
-
|
|
61245
|
-
|
|
61246
|
-
|
|
61247
|
-
|
|
61248
|
-
|
|
61249
|
-
|
|
61250
|
-
|
|
61265
|
+
fields: {
|
|
61266
|
+
newEntries: {
|
|
61267
|
+
keyRaw: this.key,
|
|
61268
|
+
type: listType,
|
|
61269
|
+
update: where === "first" ? "prepend" : "append",
|
|
61270
|
+
selection: {
|
|
61271
|
+
...selection,
|
|
61272
|
+
fields: {
|
|
61273
|
+
...selection.fields,
|
|
61274
|
+
__typename: {
|
|
61275
|
+
keyRaw: "__typename",
|
|
61276
|
+
type: "String"
|
|
61277
|
+
}
|
|
61278
|
+
}
|
|
61251
61279
|
}
|
|
61252
61280
|
}
|
|
61253
61281
|
}
|
|
@@ -61307,7 +61335,7 @@ var List = class {
|
|
|
61307
61335
|
const subscribers = this.cache._internal_unstable.subscriptions.get(this.recordID, this.key);
|
|
61308
61336
|
this.cache._internal_unstable.subscriptions.remove(
|
|
61309
61337
|
targetID,
|
|
61310
|
-
this.connection ? this.selection.edges.
|
|
61338
|
+
this.connection ? this.selection.fields.edges.selection : this.selection,
|
|
61311
61339
|
subscribers,
|
|
61312
61340
|
variables
|
|
61313
61341
|
);
|
|
@@ -61796,18 +61824,20 @@ var InMemorySubscriptions = class {
|
|
|
61796
61824
|
variables,
|
|
61797
61825
|
parentType
|
|
61798
61826
|
}) {
|
|
61799
|
-
|
|
61800
|
-
|
|
61827
|
+
const __typename = this.cache._internal_unstable.storage.get(parent, "__typename").value;
|
|
61828
|
+
let targetSelection = getFieldsForType(selection, __typename);
|
|
61829
|
+
for (const fieldSelection of Object.values(targetSelection || {})) {
|
|
61830
|
+
const { keyRaw, selection: innerSelection, type } = fieldSelection;
|
|
61801
61831
|
const key = evaluateKey(keyRaw, variables);
|
|
61802
61832
|
this.addFieldSubscription({
|
|
61803
61833
|
id: parent,
|
|
61804
61834
|
key,
|
|
61805
|
-
|
|
61835
|
+
field: fieldSelection,
|
|
61806
61836
|
spec,
|
|
61807
61837
|
parentType: parentType || spec.rootType,
|
|
61808
61838
|
variables
|
|
61809
61839
|
});
|
|
61810
|
-
if (
|
|
61840
|
+
if (innerSelection) {
|
|
61811
61841
|
const { value: linkedRecord } = this.cache._internal_unstable.storage.get(
|
|
61812
61842
|
parent,
|
|
61813
61843
|
key
|
|
@@ -61820,7 +61850,7 @@ var InMemorySubscriptions = class {
|
|
|
61820
61850
|
this.add({
|
|
61821
61851
|
parent: child,
|
|
61822
61852
|
spec,
|
|
61823
|
-
selection:
|
|
61853
|
+
selection: innerSelection,
|
|
61824
61854
|
variables,
|
|
61825
61855
|
parentType: type
|
|
61826
61856
|
});
|
|
@@ -61831,7 +61861,7 @@ var InMemorySubscriptions = class {
|
|
|
61831
61861
|
addFieldSubscription({
|
|
61832
61862
|
id,
|
|
61833
61863
|
key,
|
|
61834
|
-
|
|
61864
|
+
field,
|
|
61835
61865
|
spec,
|
|
61836
61866
|
parentType,
|
|
61837
61867
|
variables
|
|
@@ -61858,8 +61888,8 @@ var InMemorySubscriptions = class {
|
|
|
61858
61888
|
const counts = this.referenceCounts[id][key];
|
|
61859
61889
|
counts.set(spec.set, (counts.get(spec.set) || 0) + 1);
|
|
61860
61890
|
this.cache._internal_unstable.lifetimes.resetLifetime(id, key);
|
|
61861
|
-
const {
|
|
61862
|
-
if (
|
|
61891
|
+
const { selection, list, filters } = field;
|
|
61892
|
+
if (selection && list) {
|
|
61863
61893
|
this.cache._internal_unstable.lists.add({
|
|
61864
61894
|
name: list.name,
|
|
61865
61895
|
connection: list.connection,
|
|
@@ -61867,7 +61897,7 @@ var InMemorySubscriptions = class {
|
|
|
61867
61897
|
recordType: this.cache._internal_unstable.storage.get(id, "__typename")?.value || parentType,
|
|
61868
61898
|
listType: list.type,
|
|
61869
61899
|
key,
|
|
61870
|
-
selection
|
|
61900
|
+
selection,
|
|
61871
61901
|
filters: Object.entries(filters || {}).reduce((acc, [key2, { kind, value }]) => {
|
|
61872
61902
|
return {
|
|
61873
61903
|
...acc,
|
|
@@ -61884,20 +61914,21 @@ var InMemorySubscriptions = class {
|
|
|
61884
61914
|
subscribers,
|
|
61885
61915
|
parentType
|
|
61886
61916
|
}) {
|
|
61887
|
-
|
|
61888
|
-
|
|
61917
|
+
let targetSelection = getFieldsForType(selection, parentType);
|
|
61918
|
+
for (const fieldSelection of Object.values(targetSelection)) {
|
|
61919
|
+
const { type: linkedType, keyRaw, selection: innerSelection } = fieldSelection;
|
|
61889
61920
|
const key = evaluateKey(keyRaw, variables);
|
|
61890
61921
|
for (const spec of subscribers) {
|
|
61891
61922
|
this.addFieldSubscription({
|
|
61892
61923
|
id: parent,
|
|
61893
61924
|
key,
|
|
61894
|
-
|
|
61925
|
+
field: fieldSelection,
|
|
61895
61926
|
spec,
|
|
61896
61927
|
parentType,
|
|
61897
61928
|
variables
|
|
61898
61929
|
});
|
|
61899
61930
|
}
|
|
61900
|
-
if (
|
|
61931
|
+
if (innerSelection) {
|
|
61901
61932
|
const { value: link } = this.cache._internal_unstable.storage.get(parent, key);
|
|
61902
61933
|
const children = !Array.isArray(link) ? [link] : flattenList(link);
|
|
61903
61934
|
for (const linkedRecord of children) {
|
|
@@ -61906,7 +61937,7 @@ var InMemorySubscriptions = class {
|
|
|
61906
61937
|
}
|
|
61907
61938
|
this.addMany({
|
|
61908
61939
|
parent: linkedRecord,
|
|
61909
|
-
selection:
|
|
61940
|
+
selection: innerSelection,
|
|
61910
61941
|
variables,
|
|
61911
61942
|
subscribers,
|
|
61912
61943
|
parentType: linkedType
|
|
@@ -61918,22 +61949,20 @@ var InMemorySubscriptions = class {
|
|
|
61918
61949
|
get(id, field) {
|
|
61919
61950
|
return this.subscribers[id]?.[field] || [];
|
|
61920
61951
|
}
|
|
61921
|
-
remove(id,
|
|
61952
|
+
remove(id, selection, targets, variables, visited = []) {
|
|
61922
61953
|
visited.push(id);
|
|
61923
61954
|
const linkedIDs = [];
|
|
61924
|
-
for (const
|
|
61925
|
-
const key = evaluateKey(
|
|
61955
|
+
for (const fieldSelection of Object.values(selection.fields || {})) {
|
|
61956
|
+
const key = evaluateKey(fieldSelection.keyRaw, variables);
|
|
61926
61957
|
this.removeSubscribers(id, key, targets);
|
|
61927
|
-
if (!selection
|
|
61958
|
+
if (!fieldSelection.selection?.fields) {
|
|
61928
61959
|
continue;
|
|
61929
61960
|
}
|
|
61930
|
-
if (selection.list) {
|
|
61931
|
-
}
|
|
61932
61961
|
const { value: previousValue } = this.cache._internal_unstable.storage.get(id, key);
|
|
61933
61962
|
const links = !Array.isArray(previousValue) ? [previousValue] : flattenList(previousValue);
|
|
61934
61963
|
for (const link of links) {
|
|
61935
61964
|
if (link !== null) {
|
|
61936
|
-
linkedIDs.push([link, selection
|
|
61965
|
+
linkedIDs.push([link, fieldSelection.selection || {}]);
|
|
61937
61966
|
}
|
|
61938
61967
|
}
|
|
61939
61968
|
}
|
|
@@ -62088,10 +62117,12 @@ var CacheInternal = class {
|
|
|
62088
62117
|
this.lists = lists;
|
|
62089
62118
|
this.cache = cache;
|
|
62090
62119
|
this.lifetimes = lifetimes;
|
|
62120
|
+
this._disabled = typeof globalThis.window === "undefined";
|
|
62091
62121
|
try {
|
|
62092
|
-
|
|
62122
|
+
if (process.env.HOUDINI_TEST === "true") {
|
|
62123
|
+
this._disabled = false;
|
|
62124
|
+
}
|
|
62093
62125
|
} catch {
|
|
62094
|
-
this._disabled = typeof globalThis.window === "undefined";
|
|
62095
62126
|
}
|
|
62096
62127
|
}
|
|
62097
62128
|
setConfig(config) {
|
|
@@ -62111,8 +62142,9 @@ var CacheInternal = class {
|
|
|
62111
62142
|
if (this._disabled) {
|
|
62112
62143
|
return [];
|
|
62113
62144
|
}
|
|
62145
|
+
let targetSelection = getFieldsForType(selection, data["__typename"]);
|
|
62114
62146
|
for (const [field, value] of Object.entries(data)) {
|
|
62115
|
-
if (!selection || !
|
|
62147
|
+
if (!selection || !targetSelection[field]) {
|
|
62116
62148
|
throw new Error(
|
|
62117
62149
|
"Could not find field listing in selection for " + field + " @ " + JSON.stringify(selection)
|
|
62118
62150
|
);
|
|
@@ -62120,11 +62152,11 @@ var CacheInternal = class {
|
|
|
62120
62152
|
let {
|
|
62121
62153
|
type: linkedType,
|
|
62122
62154
|
keyRaw,
|
|
62123
|
-
|
|
62155
|
+
selection: fieldSelection,
|
|
62124
62156
|
operations,
|
|
62125
62157
|
abstract: isAbstract,
|
|
62126
62158
|
update
|
|
62127
|
-
} =
|
|
62159
|
+
} = targetSelection[field];
|
|
62128
62160
|
const key = evaluateKey(keyRaw, variables);
|
|
62129
62161
|
const currentSubscribers = this.subscriptions.get(parent, key);
|
|
62130
62162
|
const { value: previousValue, displayLayers } = this.storage.get(parent, key);
|
|
@@ -62132,7 +62164,7 @@ var CacheInternal = class {
|
|
|
62132
62164
|
if (displayLayer) {
|
|
62133
62165
|
this.lifetimes.resetLifetime(parent, key);
|
|
62134
62166
|
}
|
|
62135
|
-
if (!
|
|
62167
|
+
if (!fieldSelection) {
|
|
62136
62168
|
let newValue = value;
|
|
62137
62169
|
if (Array.isArray(value) && applyUpdates && update) {
|
|
62138
62170
|
if (update === "append") {
|
|
@@ -62152,7 +62184,7 @@ var CacheInternal = class {
|
|
|
62152
62184
|
}
|
|
62153
62185
|
const previousLinks = flattenList([previousValue]);
|
|
62154
62186
|
for (const link of previousLinks) {
|
|
62155
|
-
this.subscriptions.remove(link,
|
|
62187
|
+
this.subscriptions.remove(link, fieldSelection, currentSubscribers, variables);
|
|
62156
62188
|
}
|
|
62157
62189
|
layer.writeLink(parent, key, null);
|
|
62158
62190
|
toNotify.push(...currentSubscribers);
|
|
@@ -62178,14 +62210,14 @@ var CacheInternal = class {
|
|
|
62178
62210
|
if (previousValue && typeof previousValue === "string") {
|
|
62179
62211
|
this.subscriptions.remove(
|
|
62180
62212
|
previousValue,
|
|
62181
|
-
|
|
62213
|
+
fieldSelection,
|
|
62182
62214
|
currentSubscribers,
|
|
62183
62215
|
variables
|
|
62184
62216
|
);
|
|
62185
62217
|
}
|
|
62186
62218
|
this.subscriptions.addMany({
|
|
62187
62219
|
parent: linkedID,
|
|
62188
|
-
selection:
|
|
62220
|
+
selection: fieldSelection,
|
|
62189
62221
|
subscribers: currentSubscribers,
|
|
62190
62222
|
variables,
|
|
62191
62223
|
parentType: linkedType
|
|
@@ -62195,14 +62227,14 @@ var CacheInternal = class {
|
|
|
62195
62227
|
if (linkedID) {
|
|
62196
62228
|
this.writeSelection({
|
|
62197
62229
|
root,
|
|
62198
|
-
selection:
|
|
62230
|
+
selection: fieldSelection,
|
|
62199
62231
|
parent: linkedID,
|
|
62200
62232
|
data: value,
|
|
62201
62233
|
variables,
|
|
62202
62234
|
toNotify,
|
|
62203
62235
|
applyUpdates,
|
|
62204
62236
|
layer,
|
|
62205
|
-
forceNotify
|
|
62237
|
+
forceNotify
|
|
62206
62238
|
});
|
|
62207
62239
|
}
|
|
62208
62240
|
} else if (Array.isArray(value) && (typeof previousValue === "undefined" || Array.isArray(previousValue))) {
|
|
@@ -62231,7 +62263,7 @@ var CacheInternal = class {
|
|
|
62231
62263
|
key,
|
|
62232
62264
|
linkedType,
|
|
62233
62265
|
variables,
|
|
62234
|
-
fields,
|
|
62266
|
+
fields: fieldSelection,
|
|
62235
62267
|
layer,
|
|
62236
62268
|
forceNotify
|
|
62237
62269
|
});
|
|
@@ -62281,7 +62313,7 @@ var CacheInternal = class {
|
|
|
62281
62313
|
if (linkedIDs.includes(lostID) || !lostID) {
|
|
62282
62314
|
continue;
|
|
62283
62315
|
}
|
|
62284
|
-
this.subscriptions.remove(lostID,
|
|
62316
|
+
this.subscriptions.remove(lostID, fieldSelection, currentSubscribers, variables);
|
|
62285
62317
|
}
|
|
62286
62318
|
if (contentChanged || oldIDs.length === 0 && newIDs.length === 0) {
|
|
62287
62319
|
layer.writeLink(parent, key, linkedIDs);
|
|
@@ -62292,7 +62324,7 @@ var CacheInternal = class {
|
|
|
62292
62324
|
}
|
|
62293
62325
|
this.subscriptions.addMany({
|
|
62294
62326
|
parent: id,
|
|
62295
|
-
selection:
|
|
62327
|
+
selection: fieldSelection,
|
|
62296
62328
|
subscribers: currentSubscribers,
|
|
62297
62329
|
variables,
|
|
62298
62330
|
parentType: linkedType
|
|
@@ -62317,9 +62349,14 @@ var CacheInternal = class {
|
|
|
62317
62349
|
}
|
|
62318
62350
|
const targets = Array.isArray(value) ? value : [value];
|
|
62319
62351
|
for (const target of targets) {
|
|
62320
|
-
if (operation.action === "insert" && target instanceof Object &&
|
|
62321
|
-
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).addToList(
|
|
62322
|
-
|
|
62352
|
+
if (operation.action === "insert" && target instanceof Object && fieldSelection && operation.list) {
|
|
62353
|
+
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).addToList(
|
|
62354
|
+
fieldSelection,
|
|
62355
|
+
target,
|
|
62356
|
+
variables,
|
|
62357
|
+
operation.position || "last"
|
|
62358
|
+
);
|
|
62359
|
+
} else if (operation.action === "remove" && target instanceof Object && fieldSelection && operation.list) {
|
|
62323
62360
|
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).remove(target, variables);
|
|
62324
62361
|
} else if (operation.action === "delete" && operation.type) {
|
|
62325
62362
|
if (typeof target !== "string") {
|
|
@@ -62330,8 +62367,13 @@ var CacheInternal = class {
|
|
|
62330
62367
|
continue;
|
|
62331
62368
|
}
|
|
62332
62369
|
this.cache.delete(targetID);
|
|
62333
|
-
} else if (operation.action === "toggle" && target instanceof Object &&
|
|
62334
|
-
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).toggleElement(
|
|
62370
|
+
} else if (operation.action === "toggle" && target instanceof Object && fieldSelection && operation.list) {
|
|
62371
|
+
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).toggleElement(
|
|
62372
|
+
fieldSelection,
|
|
62373
|
+
target,
|
|
62374
|
+
variables,
|
|
62375
|
+
operation.position || "last"
|
|
62376
|
+
);
|
|
62335
62377
|
}
|
|
62336
62378
|
}
|
|
62337
62379
|
}
|
|
@@ -62351,9 +62393,12 @@ var CacheInternal = class {
|
|
|
62351
62393
|
let hasData = false;
|
|
62352
62394
|
let partial = false;
|
|
62353
62395
|
let cascadeNull = false;
|
|
62354
|
-
|
|
62355
|
-
|
|
62356
|
-
|
|
62396
|
+
const typename = this.storage.get(parent, "__typename").value;
|
|
62397
|
+
let targetSelection = getFieldsForType(selection, typename);
|
|
62398
|
+
for (const [
|
|
62399
|
+
attributeName,
|
|
62400
|
+
{ type, keyRaw, selection: fieldSelection, nullable, list }
|
|
62401
|
+
] of Object.entries(targetSelection)) {
|
|
62357
62402
|
const key = evaluateKey(keyRaw, variables);
|
|
62358
62403
|
const { value } = this.storage.get(parent, key);
|
|
62359
62404
|
let nextStep = stepsFromConnection;
|
|
@@ -62376,7 +62421,7 @@ var CacheInternal = class {
|
|
|
62376
62421
|
if (typeof value !== "undefined") {
|
|
62377
62422
|
hasData = true;
|
|
62378
62423
|
}
|
|
62379
|
-
} else if (!
|
|
62424
|
+
} else if (!fieldSelection) {
|
|
62380
62425
|
const fnUnmarshal = this.config?.scalars?.[type]?.unmarshal;
|
|
62381
62426
|
if (fnUnmarshal) {
|
|
62382
62427
|
target[attributeName] = fnUnmarshal(value);
|
|
@@ -62386,7 +62431,7 @@ var CacheInternal = class {
|
|
|
62386
62431
|
hasData = true;
|
|
62387
62432
|
} else if (Array.isArray(value)) {
|
|
62388
62433
|
const listValue = this.hydrateNestedList({
|
|
62389
|
-
fields,
|
|
62434
|
+
fields: fieldSelection,
|
|
62390
62435
|
variables,
|
|
62391
62436
|
linkedList: value,
|
|
62392
62437
|
stepsFromConnection: nextStep
|
|
@@ -62401,7 +62446,7 @@ var CacheInternal = class {
|
|
|
62401
62446
|
} else {
|
|
62402
62447
|
const objectFields = this.getSelection({
|
|
62403
62448
|
parent: value,
|
|
62404
|
-
selection:
|
|
62449
|
+
selection: fieldSelection,
|
|
62405
62450
|
variables,
|
|
62406
62451
|
stepsFromConnection: nextStep
|
|
62407
62452
|
});
|
|
@@ -64161,7 +64206,7 @@ var Config = class {
|
|
|
64161
64206
|
typeConfig;
|
|
64162
64207
|
configFile;
|
|
64163
64208
|
logLevel;
|
|
64164
|
-
|
|
64209
|
+
defaultFragmentMasking = "enable";
|
|
64165
64210
|
configIsRoute = null;
|
|
64166
64211
|
routesDir;
|
|
64167
64212
|
schemaPollInterval;
|
|
@@ -64174,6 +64219,11 @@ var Config = class {
|
|
|
64174
64219
|
...configFile
|
|
64175
64220
|
}) {
|
|
64176
64221
|
this.configFile = defaultConfigValues(configFile);
|
|
64222
|
+
if (configFile.disableMasking !== void 0) {
|
|
64223
|
+
throw new HoudiniError({
|
|
64224
|
+
message: `"disableMasking" was replaced by "defaultFragmentMasking". Please update your config file.`
|
|
64225
|
+
});
|
|
64226
|
+
}
|
|
64177
64227
|
let {
|
|
64178
64228
|
schema,
|
|
64179
64229
|
schemaPath = "./schema.graphql",
|
|
@@ -64190,7 +64240,7 @@ var Config = class {
|
|
|
64190
64240
|
defaultKeys,
|
|
64191
64241
|
types: types4 = {},
|
|
64192
64242
|
logLevel,
|
|
64193
|
-
|
|
64243
|
+
defaultFragmentMasking = "enable",
|
|
64194
64244
|
schemaPollInterval = 2e3,
|
|
64195
64245
|
schemaPollHeaders = {},
|
|
64196
64246
|
projectDir
|
|
@@ -64209,7 +64259,11 @@ var Config = class {
|
|
|
64209
64259
|
logLevel = LogLevel.Summary;
|
|
64210
64260
|
}
|
|
64211
64261
|
this.schemaPath = schemaPath;
|
|
64212
|
-
|
|
64262
|
+
if (apiUrl && apiUrl.startsWith("env:")) {
|
|
64263
|
+
this.apiUrl = process.env[apiUrl.slice("env:".length)];
|
|
64264
|
+
} else {
|
|
64265
|
+
this.apiUrl = apiUrl;
|
|
64266
|
+
}
|
|
64213
64267
|
this.filepath = filepath;
|
|
64214
64268
|
this.exclude = Array.isArray(exclude) ? exclude : [exclude];
|
|
64215
64269
|
this.module = module2;
|
|
@@ -64221,10 +64275,10 @@ var Config = class {
|
|
|
64221
64275
|
this.defaultCachePolicy = defaultCachePolicy;
|
|
64222
64276
|
this.defaultPartial = defaultPartial;
|
|
64223
64277
|
this.internalListPosition = defaultListPosition === "append" ? "last" : "first";
|
|
64224
|
-
this.defaultListTarget
|
|
64278
|
+
this.defaultListTarget = defaultListTarget;
|
|
64225
64279
|
this.definitionsFolder = definitionsPath;
|
|
64226
64280
|
this.logLevel = (logLevel || LogLevel.Summary).toLowerCase();
|
|
64227
|
-
this.
|
|
64281
|
+
this.defaultFragmentMasking = defaultFragmentMasking;
|
|
64228
64282
|
this.routesDir = join2(this.projectRoot, "src", "routes");
|
|
64229
64283
|
this.schemaPollInterval = schemaPollInterval;
|
|
64230
64284
|
this.schemaPollHeaders = schemaPollHeaders;
|
|
@@ -64418,8 +64472,14 @@ var Config = class {
|
|
|
64418
64472
|
pluginDirectory(name) {
|
|
64419
64473
|
return houdini_mode.is_testing ? resolve("../../../", name) : join2(this.rootDir, "plugins", name);
|
|
64420
64474
|
}
|
|
64421
|
-
get
|
|
64422
|
-
return "
|
|
64475
|
+
get manualLoadDirective() {
|
|
64476
|
+
return "manual_load";
|
|
64477
|
+
}
|
|
64478
|
+
get maskEnableDirective() {
|
|
64479
|
+
return "mask_enable";
|
|
64480
|
+
}
|
|
64481
|
+
get maskDisableDirective() {
|
|
64482
|
+
return "mask_disable";
|
|
64423
64483
|
}
|
|
64424
64484
|
get listDirective() {
|
|
64425
64485
|
return "list";
|
|
@@ -64431,9 +64491,9 @@ var Config = class {
|
|
|
64431
64491
|
return "append";
|
|
64432
64492
|
}
|
|
64433
64493
|
get listParentDirective() {
|
|
64434
|
-
return
|
|
64494
|
+
return "parentID";
|
|
64435
64495
|
}
|
|
64436
|
-
get
|
|
64496
|
+
get deprecatedlistDirectiveParentIDArg() {
|
|
64437
64497
|
return "parentID";
|
|
64438
64498
|
}
|
|
64439
64499
|
get listAllListsDirective() {
|
|
@@ -64519,7 +64579,7 @@ var Config = class {
|
|
|
64519
64579
|
this.listDirective,
|
|
64520
64580
|
this.listPrependDirective,
|
|
64521
64581
|
this.listAppendDirective,
|
|
64522
|
-
this.
|
|
64582
|
+
this.listParentDirective,
|
|
64523
64583
|
this.listAllListsDirective,
|
|
64524
64584
|
this.whenDirective,
|
|
64525
64585
|
this.whenNotDirective,
|
|
@@ -64527,7 +64587,9 @@ var Config = class {
|
|
|
64527
64587
|
this.withDirective,
|
|
64528
64588
|
this.paginateDirective,
|
|
64529
64589
|
this.cacheDirective,
|
|
64530
|
-
this.
|
|
64590
|
+
this.manualLoadDirective,
|
|
64591
|
+
this.maskEnableDirective,
|
|
64592
|
+
this.maskDisableDirective
|
|
64531
64593
|
].includes(name.value) || this.isDeleteDirective(name.value);
|
|
64532
64594
|
}
|
|
64533
64595
|
isListFragment(name) {
|