houdini 0.17.13 → 0.18.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/cmd-cjs/index.js +438 -201
- package/build/cmd-esm/index.js +438 -201
- package/build/codegen/utils/flattenSelections.d.ts +3 -1
- package/build/codegen-cjs/index.js +405 -180
- package/build/codegen-esm/index.js +405 -180
- package/build/lib/config.d.ts +8 -3
- package/build/lib-cjs/index.js +141 -81
- package/build/lib-esm/index.js +141 -81
- 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 +38 -23
- 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 +38 -23
- 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 +485 -195
- package/build/test-esm/index.js +485 -195
- package/build/vite-cjs/index.js +438 -193
- package/build/vite-esm/index.js +438 -193
- package/package.json +2 -2
- 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-esm/index.js
CHANGED
|
@@ -60947,6 +60947,20 @@ function deepEquals(objA, objB, map = /* @__PURE__ */ new WeakMap()) {
|
|
|
60947
60947
|
return true;
|
|
60948
60948
|
}
|
|
60949
60949
|
|
|
60950
|
+
// src/runtime/lib/selection.ts
|
|
60951
|
+
function getFieldsForType(selection, __typename) {
|
|
60952
|
+
let targetSelection = selection.fields || {};
|
|
60953
|
+
if (selection.abstractFields && __typename) {
|
|
60954
|
+
const mappedType = selection.abstractFields.typeMap[__typename];
|
|
60955
|
+
if (mappedType) {
|
|
60956
|
+
targetSelection = selection.abstractFields.fields[mappedType];
|
|
60957
|
+
} else if (selection.abstractFields.fields[__typename]) {
|
|
60958
|
+
targetSelection = selection.abstractFields.fields[__typename];
|
|
60959
|
+
}
|
|
60960
|
+
}
|
|
60961
|
+
return targetSelection;
|
|
60962
|
+
}
|
|
60963
|
+
|
|
60950
60964
|
// src/runtime/cache/gc.ts
|
|
60951
60965
|
var GarbageCollector = class {
|
|
60952
60966
|
cache;
|
|
@@ -61169,23 +61183,32 @@ var List = class {
|
|
|
61169
61183
|
let insertData = data;
|
|
61170
61184
|
if (this.connection) {
|
|
61171
61185
|
insertSelection = {
|
|
61172
|
-
|
|
61173
|
-
|
|
61174
|
-
|
|
61175
|
-
|
|
61176
|
-
|
|
61177
|
-
keyRaw: "edges",
|
|
61178
|
-
type: "ConnectionEdge",
|
|
61179
|
-
update: where === "first" ? "prepend" : "append",
|
|
61186
|
+
fields: {
|
|
61187
|
+
newEntry: {
|
|
61188
|
+
keyRaw: this.key,
|
|
61189
|
+
type: "Connection",
|
|
61190
|
+
selection: {
|
|
61180
61191
|
fields: {
|
|
61181
|
-
|
|
61182
|
-
|
|
61183
|
-
|
|
61184
|
-
|
|
61185
|
-
|
|
61186
|
-
|
|
61187
|
-
|
|
61188
|
-
|
|
61192
|
+
edges: {
|
|
61193
|
+
keyRaw: "edges",
|
|
61194
|
+
type: "ConnectionEdge",
|
|
61195
|
+
update: where === "first" ? "prepend" : "append",
|
|
61196
|
+
selection: {
|
|
61197
|
+
fields: {
|
|
61198
|
+
node: {
|
|
61199
|
+
type: listType,
|
|
61200
|
+
keyRaw: "node",
|
|
61201
|
+
selection: {
|
|
61202
|
+
...selection,
|
|
61203
|
+
fields: {
|
|
61204
|
+
...selection.fields,
|
|
61205
|
+
__typename: {
|
|
61206
|
+
keyRaw: "__typename",
|
|
61207
|
+
type: "String"
|
|
61208
|
+
}
|
|
61209
|
+
}
|
|
61210
|
+
}
|
|
61211
|
+
}
|
|
61189
61212
|
}
|
|
61190
61213
|
}
|
|
61191
61214
|
}
|
|
@@ -61201,15 +61224,20 @@ var List = class {
|
|
|
61201
61224
|
};
|
|
61202
61225
|
} else {
|
|
61203
61226
|
insertSelection = {
|
|
61204
|
-
|
|
61205
|
-
|
|
61206
|
-
|
|
61207
|
-
|
|
61208
|
-
|
|
61209
|
-
|
|
61210
|
-
|
|
61211
|
-
|
|
61212
|
-
|
|
61227
|
+
fields: {
|
|
61228
|
+
newEntries: {
|
|
61229
|
+
keyRaw: this.key,
|
|
61230
|
+
type: listType,
|
|
61231
|
+
update: where === "first" ? "prepend" : "append",
|
|
61232
|
+
selection: {
|
|
61233
|
+
...selection,
|
|
61234
|
+
fields: {
|
|
61235
|
+
...selection.fields,
|
|
61236
|
+
__typename: {
|
|
61237
|
+
keyRaw: "__typename",
|
|
61238
|
+
type: "String"
|
|
61239
|
+
}
|
|
61240
|
+
}
|
|
61213
61241
|
}
|
|
61214
61242
|
}
|
|
61215
61243
|
}
|
|
@@ -61269,7 +61297,7 @@ var List = class {
|
|
|
61269
61297
|
const subscribers = this.cache._internal_unstable.subscriptions.get(this.recordID, this.key);
|
|
61270
61298
|
this.cache._internal_unstable.subscriptions.remove(
|
|
61271
61299
|
targetID,
|
|
61272
|
-
this.connection ? this.selection.edges.
|
|
61300
|
+
this.connection ? this.selection.fields.edges.selection : this.selection,
|
|
61273
61301
|
subscribers,
|
|
61274
61302
|
variables
|
|
61275
61303
|
);
|
|
@@ -61758,18 +61786,20 @@ var InMemorySubscriptions = class {
|
|
|
61758
61786
|
variables,
|
|
61759
61787
|
parentType
|
|
61760
61788
|
}) {
|
|
61761
|
-
|
|
61762
|
-
|
|
61789
|
+
const __typename = this.cache._internal_unstable.storage.get(parent, "__typename").value;
|
|
61790
|
+
let targetSelection = getFieldsForType(selection, __typename);
|
|
61791
|
+
for (const fieldSelection of Object.values(targetSelection || {})) {
|
|
61792
|
+
const { keyRaw, selection: innerSelection, type } = fieldSelection;
|
|
61763
61793
|
const key = evaluateKey(keyRaw, variables);
|
|
61764
61794
|
this.addFieldSubscription({
|
|
61765
61795
|
id: parent,
|
|
61766
61796
|
key,
|
|
61767
|
-
|
|
61797
|
+
field: fieldSelection,
|
|
61768
61798
|
spec,
|
|
61769
61799
|
parentType: parentType || spec.rootType,
|
|
61770
61800
|
variables
|
|
61771
61801
|
});
|
|
61772
|
-
if (
|
|
61802
|
+
if (innerSelection) {
|
|
61773
61803
|
const { value: linkedRecord } = this.cache._internal_unstable.storage.get(
|
|
61774
61804
|
parent,
|
|
61775
61805
|
key
|
|
@@ -61782,7 +61812,7 @@ var InMemorySubscriptions = class {
|
|
|
61782
61812
|
this.add({
|
|
61783
61813
|
parent: child,
|
|
61784
61814
|
spec,
|
|
61785
|
-
selection:
|
|
61815
|
+
selection: innerSelection,
|
|
61786
61816
|
variables,
|
|
61787
61817
|
parentType: type
|
|
61788
61818
|
});
|
|
@@ -61793,7 +61823,7 @@ var InMemorySubscriptions = class {
|
|
|
61793
61823
|
addFieldSubscription({
|
|
61794
61824
|
id,
|
|
61795
61825
|
key,
|
|
61796
|
-
|
|
61826
|
+
field,
|
|
61797
61827
|
spec,
|
|
61798
61828
|
parentType,
|
|
61799
61829
|
variables
|
|
@@ -61820,8 +61850,8 @@ var InMemorySubscriptions = class {
|
|
|
61820
61850
|
const counts = this.referenceCounts[id][key];
|
|
61821
61851
|
counts.set(spec.set, (counts.get(spec.set) || 0) + 1);
|
|
61822
61852
|
this.cache._internal_unstable.lifetimes.resetLifetime(id, key);
|
|
61823
|
-
const {
|
|
61824
|
-
if (
|
|
61853
|
+
const { selection, list, filters } = field;
|
|
61854
|
+
if (selection && list) {
|
|
61825
61855
|
this.cache._internal_unstable.lists.add({
|
|
61826
61856
|
name: list.name,
|
|
61827
61857
|
connection: list.connection,
|
|
@@ -61829,7 +61859,7 @@ var InMemorySubscriptions = class {
|
|
|
61829
61859
|
recordType: this.cache._internal_unstable.storage.get(id, "__typename")?.value || parentType,
|
|
61830
61860
|
listType: list.type,
|
|
61831
61861
|
key,
|
|
61832
|
-
selection
|
|
61862
|
+
selection,
|
|
61833
61863
|
filters: Object.entries(filters || {}).reduce((acc, [key2, { kind, value }]) => {
|
|
61834
61864
|
return {
|
|
61835
61865
|
...acc,
|
|
@@ -61846,20 +61876,21 @@ var InMemorySubscriptions = class {
|
|
|
61846
61876
|
subscribers,
|
|
61847
61877
|
parentType
|
|
61848
61878
|
}) {
|
|
61849
|
-
|
|
61850
|
-
|
|
61879
|
+
let targetSelection = getFieldsForType(selection, parentType);
|
|
61880
|
+
for (const fieldSelection of Object.values(targetSelection)) {
|
|
61881
|
+
const { type: linkedType, keyRaw, selection: innerSelection } = fieldSelection;
|
|
61851
61882
|
const key = evaluateKey(keyRaw, variables);
|
|
61852
61883
|
for (const spec of subscribers) {
|
|
61853
61884
|
this.addFieldSubscription({
|
|
61854
61885
|
id: parent,
|
|
61855
61886
|
key,
|
|
61856
|
-
|
|
61887
|
+
field: fieldSelection,
|
|
61857
61888
|
spec,
|
|
61858
61889
|
parentType,
|
|
61859
61890
|
variables
|
|
61860
61891
|
});
|
|
61861
61892
|
}
|
|
61862
|
-
if (
|
|
61893
|
+
if (innerSelection) {
|
|
61863
61894
|
const { value: link } = this.cache._internal_unstable.storage.get(parent, key);
|
|
61864
61895
|
const children = !Array.isArray(link) ? [link] : flattenList(link);
|
|
61865
61896
|
for (const linkedRecord of children) {
|
|
@@ -61868,7 +61899,7 @@ var InMemorySubscriptions = class {
|
|
|
61868
61899
|
}
|
|
61869
61900
|
this.addMany({
|
|
61870
61901
|
parent: linkedRecord,
|
|
61871
|
-
selection:
|
|
61902
|
+
selection: innerSelection,
|
|
61872
61903
|
variables,
|
|
61873
61904
|
subscribers,
|
|
61874
61905
|
parentType: linkedType
|
|
@@ -61880,22 +61911,20 @@ var InMemorySubscriptions = class {
|
|
|
61880
61911
|
get(id, field) {
|
|
61881
61912
|
return this.subscribers[id]?.[field] || [];
|
|
61882
61913
|
}
|
|
61883
|
-
remove(id,
|
|
61914
|
+
remove(id, selection, targets, variables, visited = []) {
|
|
61884
61915
|
visited.push(id);
|
|
61885
61916
|
const linkedIDs = [];
|
|
61886
|
-
for (const
|
|
61887
|
-
const key = evaluateKey(
|
|
61917
|
+
for (const fieldSelection of Object.values(selection.fields || {})) {
|
|
61918
|
+
const key = evaluateKey(fieldSelection.keyRaw, variables);
|
|
61888
61919
|
this.removeSubscribers(id, key, targets);
|
|
61889
|
-
if (!selection
|
|
61920
|
+
if (!fieldSelection.selection?.fields) {
|
|
61890
61921
|
continue;
|
|
61891
61922
|
}
|
|
61892
|
-
if (selection.list) {
|
|
61893
|
-
}
|
|
61894
61923
|
const { value: previousValue } = this.cache._internal_unstable.storage.get(id, key);
|
|
61895
61924
|
const links = !Array.isArray(previousValue) ? [previousValue] : flattenList(previousValue);
|
|
61896
61925
|
for (const link of links) {
|
|
61897
61926
|
if (link !== null) {
|
|
61898
|
-
linkedIDs.push([link, selection
|
|
61927
|
+
linkedIDs.push([link, fieldSelection.selection || {}]);
|
|
61899
61928
|
}
|
|
61900
61929
|
}
|
|
61901
61930
|
}
|
|
@@ -62073,8 +62102,9 @@ var CacheInternal = class {
|
|
|
62073
62102
|
if (this._disabled) {
|
|
62074
62103
|
return [];
|
|
62075
62104
|
}
|
|
62105
|
+
let targetSelection = getFieldsForType(selection, data["__typename"]);
|
|
62076
62106
|
for (const [field, value] of Object.entries(data)) {
|
|
62077
|
-
if (!selection || !
|
|
62107
|
+
if (!selection || !targetSelection[field]) {
|
|
62078
62108
|
throw new Error(
|
|
62079
62109
|
"Could not find field listing in selection for " + field + " @ " + JSON.stringify(selection)
|
|
62080
62110
|
);
|
|
@@ -62082,11 +62112,11 @@ var CacheInternal = class {
|
|
|
62082
62112
|
let {
|
|
62083
62113
|
type: linkedType,
|
|
62084
62114
|
keyRaw,
|
|
62085
|
-
|
|
62115
|
+
selection: fieldSelection,
|
|
62086
62116
|
operations,
|
|
62087
62117
|
abstract: isAbstract,
|
|
62088
62118
|
update
|
|
62089
|
-
} =
|
|
62119
|
+
} = targetSelection[field];
|
|
62090
62120
|
const key = evaluateKey(keyRaw, variables);
|
|
62091
62121
|
const currentSubscribers = this.subscriptions.get(parent, key);
|
|
62092
62122
|
const { value: previousValue, displayLayers } = this.storage.get(parent, key);
|
|
@@ -62094,7 +62124,7 @@ var CacheInternal = class {
|
|
|
62094
62124
|
if (displayLayer) {
|
|
62095
62125
|
this.lifetimes.resetLifetime(parent, key);
|
|
62096
62126
|
}
|
|
62097
|
-
if (!
|
|
62127
|
+
if (!fieldSelection) {
|
|
62098
62128
|
let newValue = value;
|
|
62099
62129
|
if (Array.isArray(value) && applyUpdates && update) {
|
|
62100
62130
|
if (update === "append") {
|
|
@@ -62114,7 +62144,7 @@ var CacheInternal = class {
|
|
|
62114
62144
|
}
|
|
62115
62145
|
const previousLinks = flattenList([previousValue]);
|
|
62116
62146
|
for (const link of previousLinks) {
|
|
62117
|
-
this.subscriptions.remove(link,
|
|
62147
|
+
this.subscriptions.remove(link, fieldSelection, currentSubscribers, variables);
|
|
62118
62148
|
}
|
|
62119
62149
|
layer.writeLink(parent, key, null);
|
|
62120
62150
|
toNotify.push(...currentSubscribers);
|
|
@@ -62140,14 +62170,14 @@ var CacheInternal = class {
|
|
|
62140
62170
|
if (previousValue && typeof previousValue === "string") {
|
|
62141
62171
|
this.subscriptions.remove(
|
|
62142
62172
|
previousValue,
|
|
62143
|
-
|
|
62173
|
+
fieldSelection,
|
|
62144
62174
|
currentSubscribers,
|
|
62145
62175
|
variables
|
|
62146
62176
|
);
|
|
62147
62177
|
}
|
|
62148
62178
|
this.subscriptions.addMany({
|
|
62149
62179
|
parent: linkedID,
|
|
62150
|
-
selection:
|
|
62180
|
+
selection: fieldSelection,
|
|
62151
62181
|
subscribers: currentSubscribers,
|
|
62152
62182
|
variables,
|
|
62153
62183
|
parentType: linkedType
|
|
@@ -62157,14 +62187,14 @@ var CacheInternal = class {
|
|
|
62157
62187
|
if (linkedID) {
|
|
62158
62188
|
this.writeSelection({
|
|
62159
62189
|
root,
|
|
62160
|
-
selection:
|
|
62190
|
+
selection: fieldSelection,
|
|
62161
62191
|
parent: linkedID,
|
|
62162
62192
|
data: value,
|
|
62163
62193
|
variables,
|
|
62164
62194
|
toNotify,
|
|
62165
62195
|
applyUpdates,
|
|
62166
62196
|
layer,
|
|
62167
|
-
forceNotify
|
|
62197
|
+
forceNotify
|
|
62168
62198
|
});
|
|
62169
62199
|
}
|
|
62170
62200
|
} else if (Array.isArray(value) && (typeof previousValue === "undefined" || Array.isArray(previousValue))) {
|
|
@@ -62193,7 +62223,7 @@ var CacheInternal = class {
|
|
|
62193
62223
|
key,
|
|
62194
62224
|
linkedType,
|
|
62195
62225
|
variables,
|
|
62196
|
-
fields,
|
|
62226
|
+
fields: fieldSelection,
|
|
62197
62227
|
layer,
|
|
62198
62228
|
forceNotify
|
|
62199
62229
|
});
|
|
@@ -62243,7 +62273,7 @@ var CacheInternal = class {
|
|
|
62243
62273
|
if (linkedIDs.includes(lostID) || !lostID) {
|
|
62244
62274
|
continue;
|
|
62245
62275
|
}
|
|
62246
|
-
this.subscriptions.remove(lostID,
|
|
62276
|
+
this.subscriptions.remove(lostID, fieldSelection, currentSubscribers, variables);
|
|
62247
62277
|
}
|
|
62248
62278
|
if (contentChanged || oldIDs.length === 0 && newIDs.length === 0) {
|
|
62249
62279
|
layer.writeLink(parent, key, linkedIDs);
|
|
@@ -62254,7 +62284,7 @@ var CacheInternal = class {
|
|
|
62254
62284
|
}
|
|
62255
62285
|
this.subscriptions.addMany({
|
|
62256
62286
|
parent: id,
|
|
62257
|
-
selection:
|
|
62287
|
+
selection: fieldSelection,
|
|
62258
62288
|
subscribers: currentSubscribers,
|
|
62259
62289
|
variables,
|
|
62260
62290
|
parentType: linkedType
|
|
@@ -62279,9 +62309,14 @@ var CacheInternal = class {
|
|
|
62279
62309
|
}
|
|
62280
62310
|
const targets = Array.isArray(value) ? value : [value];
|
|
62281
62311
|
for (const target of targets) {
|
|
62282
|
-
if (operation.action === "insert" && target instanceof Object &&
|
|
62283
|
-
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).addToList(
|
|
62284
|
-
|
|
62312
|
+
if (operation.action === "insert" && target instanceof Object && fieldSelection && operation.list) {
|
|
62313
|
+
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).addToList(
|
|
62314
|
+
fieldSelection,
|
|
62315
|
+
target,
|
|
62316
|
+
variables,
|
|
62317
|
+
operation.position || "last"
|
|
62318
|
+
);
|
|
62319
|
+
} else if (operation.action === "remove" && target instanceof Object && fieldSelection && operation.list) {
|
|
62285
62320
|
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).remove(target, variables);
|
|
62286
62321
|
} else if (operation.action === "delete" && operation.type) {
|
|
62287
62322
|
if (typeof target !== "string") {
|
|
@@ -62292,8 +62327,13 @@ var CacheInternal = class {
|
|
|
62292
62327
|
continue;
|
|
62293
62328
|
}
|
|
62294
62329
|
this.cache.delete(targetID);
|
|
62295
|
-
} else if (operation.action === "toggle" && target instanceof Object &&
|
|
62296
|
-
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).toggleElement(
|
|
62330
|
+
} else if (operation.action === "toggle" && target instanceof Object && fieldSelection && operation.list) {
|
|
62331
|
+
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).toggleElement(
|
|
62332
|
+
fieldSelection,
|
|
62333
|
+
target,
|
|
62334
|
+
variables,
|
|
62335
|
+
operation.position || "last"
|
|
62336
|
+
);
|
|
62297
62337
|
}
|
|
62298
62338
|
}
|
|
62299
62339
|
}
|
|
@@ -62313,9 +62353,12 @@ var CacheInternal = class {
|
|
|
62313
62353
|
let hasData = false;
|
|
62314
62354
|
let partial = false;
|
|
62315
62355
|
let cascadeNull = false;
|
|
62316
|
-
|
|
62317
|
-
|
|
62318
|
-
|
|
62356
|
+
const typename = this.storage.get(parent, "__typename").value;
|
|
62357
|
+
let targetSelection = getFieldsForType(selection, typename);
|
|
62358
|
+
for (const [
|
|
62359
|
+
attributeName,
|
|
62360
|
+
{ type, keyRaw, selection: fieldSelection, nullable, list }
|
|
62361
|
+
] of Object.entries(targetSelection)) {
|
|
62319
62362
|
const key = evaluateKey(keyRaw, variables);
|
|
62320
62363
|
const { value } = this.storage.get(parent, key);
|
|
62321
62364
|
let nextStep = stepsFromConnection;
|
|
@@ -62338,7 +62381,7 @@ var CacheInternal = class {
|
|
|
62338
62381
|
if (typeof value !== "undefined") {
|
|
62339
62382
|
hasData = true;
|
|
62340
62383
|
}
|
|
62341
|
-
} else if (!
|
|
62384
|
+
} else if (!fieldSelection) {
|
|
62342
62385
|
const fnUnmarshal = this.config?.scalars?.[type]?.unmarshal;
|
|
62343
62386
|
if (fnUnmarshal) {
|
|
62344
62387
|
target[attributeName] = fnUnmarshal(value);
|
|
@@ -62348,7 +62391,7 @@ var CacheInternal = class {
|
|
|
62348
62391
|
hasData = true;
|
|
62349
62392
|
} else if (Array.isArray(value)) {
|
|
62350
62393
|
const listValue = this.hydrateNestedList({
|
|
62351
|
-
fields,
|
|
62394
|
+
fields: fieldSelection,
|
|
62352
62395
|
variables,
|
|
62353
62396
|
linkedList: value,
|
|
62354
62397
|
stepsFromConnection: nextStep
|
|
@@ -62363,7 +62406,7 @@ var CacheInternal = class {
|
|
|
62363
62406
|
} else {
|
|
62364
62407
|
const objectFields = this.getSelection({
|
|
62365
62408
|
parent: value,
|
|
62366
|
-
selection:
|
|
62409
|
+
selection: fieldSelection,
|
|
62367
62410
|
variables,
|
|
62368
62411
|
stepsFromConnection: nextStep
|
|
62369
62412
|
});
|
|
@@ -64122,7 +64165,7 @@ var Config = class {
|
|
|
64122
64165
|
typeConfig;
|
|
64123
64166
|
configFile;
|
|
64124
64167
|
logLevel;
|
|
64125
|
-
|
|
64168
|
+
defaultFragmentMasking = "enable";
|
|
64126
64169
|
configIsRoute = null;
|
|
64127
64170
|
routesDir;
|
|
64128
64171
|
schemaPollInterval;
|
|
@@ -64135,6 +64178,11 @@ var Config = class {
|
|
|
64135
64178
|
...configFile
|
|
64136
64179
|
}) {
|
|
64137
64180
|
this.configFile = defaultConfigValues(configFile);
|
|
64181
|
+
if (configFile.disableMasking !== void 0) {
|
|
64182
|
+
throw new HoudiniError({
|
|
64183
|
+
message: `"disableMasking" was replaced by "defaultFragmentMasking". Please update your config file.`
|
|
64184
|
+
});
|
|
64185
|
+
}
|
|
64138
64186
|
let {
|
|
64139
64187
|
schema,
|
|
64140
64188
|
schemaPath = "./schema.graphql",
|
|
@@ -64151,7 +64199,7 @@ var Config = class {
|
|
|
64151
64199
|
defaultKeys,
|
|
64152
64200
|
types: types4 = {},
|
|
64153
64201
|
logLevel,
|
|
64154
|
-
|
|
64202
|
+
defaultFragmentMasking = "enable",
|
|
64155
64203
|
schemaPollInterval = 2e3,
|
|
64156
64204
|
schemaPollHeaders = {},
|
|
64157
64205
|
projectDir
|
|
@@ -64170,7 +64218,11 @@ var Config = class {
|
|
|
64170
64218
|
logLevel = LogLevel.Summary;
|
|
64171
64219
|
}
|
|
64172
64220
|
this.schemaPath = schemaPath;
|
|
64173
|
-
|
|
64221
|
+
if (apiUrl && apiUrl.startsWith("env:")) {
|
|
64222
|
+
this.apiUrl = process.env[apiUrl.slice("env:".length)];
|
|
64223
|
+
} else {
|
|
64224
|
+
this.apiUrl = apiUrl;
|
|
64225
|
+
}
|
|
64174
64226
|
this.filepath = filepath;
|
|
64175
64227
|
this.exclude = Array.isArray(exclude) ? exclude : [exclude];
|
|
64176
64228
|
this.module = module;
|
|
@@ -64182,10 +64234,10 @@ var Config = class {
|
|
|
64182
64234
|
this.defaultCachePolicy = defaultCachePolicy;
|
|
64183
64235
|
this.defaultPartial = defaultPartial;
|
|
64184
64236
|
this.internalListPosition = defaultListPosition === "append" ? "last" : "first";
|
|
64185
|
-
this.defaultListTarget
|
|
64237
|
+
this.defaultListTarget = defaultListTarget;
|
|
64186
64238
|
this.definitionsFolder = definitionsPath;
|
|
64187
64239
|
this.logLevel = (logLevel || LogLevel.Summary).toLowerCase();
|
|
64188
|
-
this.
|
|
64240
|
+
this.defaultFragmentMasking = defaultFragmentMasking;
|
|
64189
64241
|
this.routesDir = join2(this.projectRoot, "src", "routes");
|
|
64190
64242
|
this.schemaPollInterval = schemaPollInterval;
|
|
64191
64243
|
this.schemaPollHeaders = schemaPollHeaders;
|
|
@@ -64379,8 +64431,14 @@ var Config = class {
|
|
|
64379
64431
|
pluginDirectory(name) {
|
|
64380
64432
|
return houdini_mode.is_testing ? resolve("../../../", name) : join2(this.rootDir, "plugins", name);
|
|
64381
64433
|
}
|
|
64382
|
-
get
|
|
64383
|
-
return "
|
|
64434
|
+
get manualLoadDirective() {
|
|
64435
|
+
return "manual_load";
|
|
64436
|
+
}
|
|
64437
|
+
get maskEnableDirective() {
|
|
64438
|
+
return "mask_enable";
|
|
64439
|
+
}
|
|
64440
|
+
get maskDisableDirective() {
|
|
64441
|
+
return "mask_disable";
|
|
64384
64442
|
}
|
|
64385
64443
|
get listDirective() {
|
|
64386
64444
|
return "list";
|
|
@@ -64392,9 +64450,9 @@ var Config = class {
|
|
|
64392
64450
|
return "append";
|
|
64393
64451
|
}
|
|
64394
64452
|
get listParentDirective() {
|
|
64395
|
-
return
|
|
64453
|
+
return "parentID";
|
|
64396
64454
|
}
|
|
64397
|
-
get
|
|
64455
|
+
get deprecatedlistDirectiveParentIDArg() {
|
|
64398
64456
|
return "parentID";
|
|
64399
64457
|
}
|
|
64400
64458
|
get listAllListsDirective() {
|
|
@@ -64480,7 +64538,7 @@ var Config = class {
|
|
|
64480
64538
|
this.listDirective,
|
|
64481
64539
|
this.listPrependDirective,
|
|
64482
64540
|
this.listAppendDirective,
|
|
64483
|
-
this.
|
|
64541
|
+
this.listParentDirective,
|
|
64484
64542
|
this.listAllListsDirective,
|
|
64485
64543
|
this.whenDirective,
|
|
64486
64544
|
this.whenNotDirective,
|
|
@@ -64488,7 +64546,9 @@ var Config = class {
|
|
|
64488
64546
|
this.withDirective,
|
|
64489
64547
|
this.paginateDirective,
|
|
64490
64548
|
this.cacheDirective,
|
|
64491
|
-
this.
|
|
64549
|
+
this.manualLoadDirective,
|
|
64550
|
+
this.maskEnableDirective,
|
|
64551
|
+
this.maskDisableDirective
|
|
64492
64552
|
].includes(name.value) || this.isDeleteDirective(name.value);
|
|
64493
64553
|
}
|
|
64494
64554
|
isListFragment(name) {
|
|
@@ -16,10 +16,10 @@ export declare class InMemorySubscriptions {
|
|
|
16
16
|
[key: string]: GraphQLValue;
|
|
17
17
|
};
|
|
18
18
|
}): void;
|
|
19
|
-
addFieldSubscription({ id, key,
|
|
19
|
+
addFieldSubscription({ id, key, field, spec, parentType, variables, }: {
|
|
20
20
|
id: string;
|
|
21
21
|
key: string;
|
|
22
|
-
|
|
22
|
+
field: Required<SubscriptionSelection>['fields'][string];
|
|
23
23
|
spec: SubscriptionSpec;
|
|
24
24
|
parentType: string;
|
|
25
25
|
variables: GraphQLObject;
|
|
@@ -32,7 +32,7 @@ export declare class InMemorySubscriptions {
|
|
|
32
32
|
parentType: string;
|
|
33
33
|
}): void;
|
|
34
34
|
get(id: string, field: string): SubscriptionSpec[];
|
|
35
|
-
remove(id: string,
|
|
35
|
+
remove(id: string, selection: SubscriptionSelection, targets: SubscriptionSpec[], variables: {}, visited?: string[]): void;
|
|
36
36
|
private removeSubscribers;
|
|
37
37
|
removeAllSubscribers(id: string, targets?: SubscriptionSpec[], visited?: string[]): void;
|
|
38
38
|
}
|
|
@@ -87,8 +87,9 @@ export declare type ConfigFile = {
|
|
|
87
87
|
logLevel?: string;
|
|
88
88
|
/**
|
|
89
89
|
* A flag to specify the default fragment masking behavior.
|
|
90
|
+
* @default `enable`
|
|
90
91
|
*/
|
|
91
|
-
|
|
92
|
+
defaultFragmentMasking?: 'enable' | 'disable';
|
|
92
93
|
/**
|
|
93
94
|
* Configures the houdini plugin's schema polling behavior. By default, houdini will poll your APIs
|
|
94
95
|
* during development in order to keep it's definition of your schema up to date. The schemaPollingInterval
|
|
@@ -2,12 +2,12 @@ import { ConfigFile } from './config';
|
|
|
2
2
|
import { MutationArtifact, QueryArtifact, SubscriptionArtifact, SubscriptionSelection } from './types';
|
|
3
3
|
export declare function marshalSelection({ selection, data, }: {
|
|
4
4
|
selection: SubscriptionSelection;
|
|
5
|
-
data:
|
|
5
|
+
data: any;
|
|
6
6
|
}): Promise<{} | null | undefined>;
|
|
7
7
|
export declare function marshalInputs<T>({ artifact, input, rootType, }: {
|
|
8
8
|
artifact: QueryArtifact | MutationArtifact | SubscriptionArtifact;
|
|
9
9
|
input: unknown;
|
|
10
10
|
rootType?: string;
|
|
11
11
|
}): Promise<{} | null | undefined>;
|
|
12
|
-
export declare function unmarshalSelection(config: ConfigFile, selection: SubscriptionSelection, data:
|
|
12
|
+
export declare function unmarshalSelection(config: ConfigFile, selection: SubscriptionSelection, data: any): {} | null | undefined;
|
|
13
13
|
export declare function isScalar(config: ConfigFile, type: string): boolean;
|
|
@@ -107,25 +107,35 @@ export declare type GraphQLObject = {
|
|
|
107
107
|
};
|
|
108
108
|
export declare type GraphQLValue = number | string | boolean | null | GraphQLObject | GraphQLValue[] | undefined;
|
|
109
109
|
export declare type SubscriptionSelection = {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
nullable?: boolean;
|
|
113
|
-
keyRaw: string;
|
|
114
|
-
operations?: MutationOperation[];
|
|
115
|
-
list?: {
|
|
116
|
-
name: string;
|
|
117
|
-
connection: boolean;
|
|
110
|
+
fields?: {
|
|
111
|
+
[fieldName: string]: {
|
|
118
112
|
type: string;
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
113
|
+
nullable?: boolean;
|
|
114
|
+
keyRaw: string;
|
|
115
|
+
operations?: MutationOperation[];
|
|
116
|
+
list?: {
|
|
117
|
+
name: string;
|
|
118
|
+
connection: boolean;
|
|
119
|
+
type: string;
|
|
120
|
+
};
|
|
121
|
+
update?: RefetchUpdateMode;
|
|
122
|
+
filters?: {
|
|
123
|
+
[key: string]: {
|
|
124
|
+
kind: 'Boolean' | 'String' | 'Float' | 'Int' | 'Variable';
|
|
125
|
+
value: string | number | boolean;
|
|
126
|
+
};
|
|
125
127
|
};
|
|
128
|
+
selection?: SubscriptionSelection;
|
|
129
|
+
abstract?: boolean;
|
|
130
|
+
};
|
|
131
|
+
};
|
|
132
|
+
abstractFields?: {
|
|
133
|
+
fields: {
|
|
134
|
+
[typeName: string]: SubscriptionSelection['fields'];
|
|
135
|
+
};
|
|
136
|
+
typeMap: {
|
|
137
|
+
[typeName: string]: string;
|
|
126
138
|
};
|
|
127
|
-
fields?: SubscriptionSelection;
|
|
128
|
-
abstract?: boolean;
|
|
129
139
|
};
|
|
130
140
|
};
|
|
131
141
|
export declare type SubscriptionSpec = {
|