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/test-cjs/index.js
CHANGED
|
@@ -3345,7 +3345,7 @@ var require_definition = __commonJS({
|
|
|
3345
3345
|
exports.assertObjectType = assertObjectType;
|
|
3346
3346
|
exports.isInterfaceType = isInterfaceType6;
|
|
3347
3347
|
exports.assertInterfaceType = assertInterfaceType;
|
|
3348
|
-
exports.isUnionType =
|
|
3348
|
+
exports.isUnionType = isUnionType7;
|
|
3349
3349
|
exports.assertUnionType = assertUnionType;
|
|
3350
3350
|
exports.isEnumType = isEnumType4;
|
|
3351
3351
|
exports.assertEnumType = assertEnumType;
|
|
@@ -3363,7 +3363,7 @@ var require_definition = __commonJS({
|
|
|
3363
3363
|
exports.assertLeafType = assertLeafType;
|
|
3364
3364
|
exports.isCompositeType = isCompositeType;
|
|
3365
3365
|
exports.assertCompositeType = assertCompositeType;
|
|
3366
|
-
exports.isAbstractType =
|
|
3366
|
+
exports.isAbstractType = isAbstractType2;
|
|
3367
3367
|
exports.assertAbstractType = assertAbstractType;
|
|
3368
3368
|
exports.GraphQLList = GraphQLList2;
|
|
3369
3369
|
exports.GraphQLNonNull = GraphQLNonNull2;
|
|
@@ -3418,7 +3418,7 @@ var require_definition = __commonJS({
|
|
|
3418
3418
|
return Constructor;
|
|
3419
3419
|
}
|
|
3420
3420
|
function isType(type) {
|
|
3421
|
-
return isScalarType6(type) || isObjectType2(type) || isInterfaceType6(type) ||
|
|
3421
|
+
return isScalarType6(type) || isObjectType2(type) || isInterfaceType6(type) || isUnionType7(type) || isEnumType4(type) || isInputObjectType(type) || isListType3(type) || isNonNullType6(type);
|
|
3422
3422
|
}
|
|
3423
3423
|
function assertType(type) {
|
|
3424
3424
|
if (!isType(type)) {
|
|
@@ -3453,11 +3453,11 @@ var require_definition = __commonJS({
|
|
|
3453
3453
|
}
|
|
3454
3454
|
return type;
|
|
3455
3455
|
}
|
|
3456
|
-
function
|
|
3456
|
+
function isUnionType7(type) {
|
|
3457
3457
|
return (0, _instanceOf.default)(type, GraphQLUnionType);
|
|
3458
3458
|
}
|
|
3459
3459
|
function assertUnionType(type) {
|
|
3460
|
-
if (!
|
|
3460
|
+
if (!isUnionType7(type)) {
|
|
3461
3461
|
throw new Error("Expected ".concat((0, _inspect.default)(type), " to be a GraphQL Union type."));
|
|
3462
3462
|
}
|
|
3463
3463
|
return type;
|
|
@@ -3508,7 +3508,7 @@ var require_definition = __commonJS({
|
|
|
3508
3508
|
return type;
|
|
3509
3509
|
}
|
|
3510
3510
|
function isOutputType(type) {
|
|
3511
|
-
return isScalarType6(type) || isObjectType2(type) || isInterfaceType6(type) ||
|
|
3511
|
+
return isScalarType6(type) || isObjectType2(type) || isInterfaceType6(type) || isUnionType7(type) || isEnumType4(type) || isWrappingType(type) && isOutputType(type.ofType);
|
|
3512
3512
|
}
|
|
3513
3513
|
function assertOutputType(type) {
|
|
3514
3514
|
if (!isOutputType(type)) {
|
|
@@ -3526,7 +3526,7 @@ var require_definition = __commonJS({
|
|
|
3526
3526
|
return type;
|
|
3527
3527
|
}
|
|
3528
3528
|
function isCompositeType(type) {
|
|
3529
|
-
return isObjectType2(type) || isInterfaceType6(type) ||
|
|
3529
|
+
return isObjectType2(type) || isInterfaceType6(type) || isUnionType7(type);
|
|
3530
3530
|
}
|
|
3531
3531
|
function assertCompositeType(type) {
|
|
3532
3532
|
if (!isCompositeType(type)) {
|
|
@@ -3534,11 +3534,11 @@ var require_definition = __commonJS({
|
|
|
3534
3534
|
}
|
|
3535
3535
|
return type;
|
|
3536
3536
|
}
|
|
3537
|
-
function
|
|
3538
|
-
return isInterfaceType6(type) ||
|
|
3537
|
+
function isAbstractType2(type) {
|
|
3538
|
+
return isInterfaceType6(type) || isUnionType7(type);
|
|
3539
3539
|
}
|
|
3540
3540
|
function assertAbstractType(type) {
|
|
3541
|
-
if (!
|
|
3541
|
+
if (!isAbstractType2(type)) {
|
|
3542
3542
|
throw new Error("Expected ".concat((0, _inspect.default)(type), " to be a GraphQL abstract type."));
|
|
3543
3543
|
}
|
|
3544
3544
|
return type;
|
|
@@ -3605,7 +3605,7 @@ var require_definition = __commonJS({
|
|
|
3605
3605
|
}
|
|
3606
3606
|
}
|
|
3607
3607
|
function isNamedType(type) {
|
|
3608
|
-
return isScalarType6(type) || isObjectType2(type) || isInterfaceType6(type) ||
|
|
3608
|
+
return isScalarType6(type) || isObjectType2(type) || isInterfaceType6(type) || isUnionType7(type) || isEnumType4(type) || isInputObjectType(type);
|
|
3609
3609
|
}
|
|
3610
3610
|
function assertNamedType(type) {
|
|
3611
3611
|
if (!isNamedType(type)) {
|
|
@@ -53467,6 +53467,20 @@ function deepEquals(objA, objB, map = /* @__PURE__ */ new WeakMap()) {
|
|
|
53467
53467
|
return true;
|
|
53468
53468
|
}
|
|
53469
53469
|
|
|
53470
|
+
// src/runtime/lib/selection.ts
|
|
53471
|
+
function getFieldsForType(selection2, __typename) {
|
|
53472
|
+
let targetSelection = selection2.fields || {};
|
|
53473
|
+
if (selection2.abstractFields && __typename) {
|
|
53474
|
+
const mappedType = selection2.abstractFields.typeMap[__typename];
|
|
53475
|
+
if (mappedType) {
|
|
53476
|
+
targetSelection = selection2.abstractFields.fields[mappedType];
|
|
53477
|
+
} else if (selection2.abstractFields.fields[__typename]) {
|
|
53478
|
+
targetSelection = selection2.abstractFields.fields[__typename];
|
|
53479
|
+
}
|
|
53480
|
+
}
|
|
53481
|
+
return targetSelection;
|
|
53482
|
+
}
|
|
53483
|
+
|
|
53470
53484
|
// src/runtime/cache/gc.ts
|
|
53471
53485
|
var GarbageCollector = class {
|
|
53472
53486
|
cache;
|
|
@@ -53689,23 +53703,32 @@ var List = class {
|
|
|
53689
53703
|
let insertData = data;
|
|
53690
53704
|
if (this.connection) {
|
|
53691
53705
|
insertSelection = {
|
|
53692
|
-
|
|
53693
|
-
|
|
53694
|
-
|
|
53695
|
-
|
|
53696
|
-
|
|
53697
|
-
keyRaw: "edges",
|
|
53698
|
-
type: "ConnectionEdge",
|
|
53699
|
-
update: where === "first" ? "prepend" : "append",
|
|
53706
|
+
fields: {
|
|
53707
|
+
newEntry: {
|
|
53708
|
+
keyRaw: this.key,
|
|
53709
|
+
type: "Connection",
|
|
53710
|
+
selection: {
|
|
53700
53711
|
fields: {
|
|
53701
|
-
|
|
53702
|
-
|
|
53703
|
-
|
|
53704
|
-
|
|
53705
|
-
|
|
53706
|
-
|
|
53707
|
-
|
|
53708
|
-
|
|
53712
|
+
edges: {
|
|
53713
|
+
keyRaw: "edges",
|
|
53714
|
+
type: "ConnectionEdge",
|
|
53715
|
+
update: where === "first" ? "prepend" : "append",
|
|
53716
|
+
selection: {
|
|
53717
|
+
fields: {
|
|
53718
|
+
node: {
|
|
53719
|
+
type: listType,
|
|
53720
|
+
keyRaw: "node",
|
|
53721
|
+
selection: {
|
|
53722
|
+
...selection2,
|
|
53723
|
+
fields: {
|
|
53724
|
+
...selection2.fields,
|
|
53725
|
+
__typename: {
|
|
53726
|
+
keyRaw: "__typename",
|
|
53727
|
+
type: "String"
|
|
53728
|
+
}
|
|
53729
|
+
}
|
|
53730
|
+
}
|
|
53731
|
+
}
|
|
53709
53732
|
}
|
|
53710
53733
|
}
|
|
53711
53734
|
}
|
|
@@ -53721,15 +53744,20 @@ var List = class {
|
|
|
53721
53744
|
};
|
|
53722
53745
|
} else {
|
|
53723
53746
|
insertSelection = {
|
|
53724
|
-
|
|
53725
|
-
|
|
53726
|
-
|
|
53727
|
-
|
|
53728
|
-
|
|
53729
|
-
|
|
53730
|
-
|
|
53731
|
-
|
|
53732
|
-
|
|
53747
|
+
fields: {
|
|
53748
|
+
newEntries: {
|
|
53749
|
+
keyRaw: this.key,
|
|
53750
|
+
type: listType,
|
|
53751
|
+
update: where === "first" ? "prepend" : "append",
|
|
53752
|
+
selection: {
|
|
53753
|
+
...selection2,
|
|
53754
|
+
fields: {
|
|
53755
|
+
...selection2.fields,
|
|
53756
|
+
__typename: {
|
|
53757
|
+
keyRaw: "__typename",
|
|
53758
|
+
type: "String"
|
|
53759
|
+
}
|
|
53760
|
+
}
|
|
53733
53761
|
}
|
|
53734
53762
|
}
|
|
53735
53763
|
}
|
|
@@ -53789,7 +53817,7 @@ var List = class {
|
|
|
53789
53817
|
const subscribers = this.cache._internal_unstable.subscriptions.get(this.recordID, this.key);
|
|
53790
53818
|
this.cache._internal_unstable.subscriptions.remove(
|
|
53791
53819
|
targetID,
|
|
53792
|
-
this.connection ? this.selection.edges.
|
|
53820
|
+
this.connection ? this.selection.fields.edges.selection : this.selection,
|
|
53793
53821
|
subscribers,
|
|
53794
53822
|
variables
|
|
53795
53823
|
);
|
|
@@ -54278,18 +54306,20 @@ var InMemorySubscriptions = class {
|
|
|
54278
54306
|
variables,
|
|
54279
54307
|
parentType
|
|
54280
54308
|
}) {
|
|
54281
|
-
|
|
54282
|
-
|
|
54309
|
+
const __typename = this.cache._internal_unstable.storage.get(parent, "__typename").value;
|
|
54310
|
+
let targetSelection = getFieldsForType(selection2, __typename);
|
|
54311
|
+
for (const fieldSelection of Object.values(targetSelection || {})) {
|
|
54312
|
+
const { keyRaw, selection: innerSelection, type } = fieldSelection;
|
|
54283
54313
|
const key = evaluateKey(keyRaw, variables);
|
|
54284
54314
|
this.addFieldSubscription({
|
|
54285
54315
|
id: parent,
|
|
54286
54316
|
key,
|
|
54287
|
-
|
|
54317
|
+
field: fieldSelection,
|
|
54288
54318
|
spec,
|
|
54289
54319
|
parentType: parentType || spec.rootType,
|
|
54290
54320
|
variables
|
|
54291
54321
|
});
|
|
54292
|
-
if (
|
|
54322
|
+
if (innerSelection) {
|
|
54293
54323
|
const { value: linkedRecord } = this.cache._internal_unstable.storage.get(
|
|
54294
54324
|
parent,
|
|
54295
54325
|
key
|
|
@@ -54302,7 +54332,7 @@ var InMemorySubscriptions = class {
|
|
|
54302
54332
|
this.add({
|
|
54303
54333
|
parent: child,
|
|
54304
54334
|
spec,
|
|
54305
|
-
selection:
|
|
54335
|
+
selection: innerSelection,
|
|
54306
54336
|
variables,
|
|
54307
54337
|
parentType: type
|
|
54308
54338
|
});
|
|
@@ -54313,7 +54343,7 @@ var InMemorySubscriptions = class {
|
|
|
54313
54343
|
addFieldSubscription({
|
|
54314
54344
|
id,
|
|
54315
54345
|
key,
|
|
54316
|
-
|
|
54346
|
+
field,
|
|
54317
54347
|
spec,
|
|
54318
54348
|
parentType,
|
|
54319
54349
|
variables
|
|
@@ -54340,8 +54370,8 @@ var InMemorySubscriptions = class {
|
|
|
54340
54370
|
const counts = this.referenceCounts[id][key];
|
|
54341
54371
|
counts.set(spec.set, (counts.get(spec.set) || 0) + 1);
|
|
54342
54372
|
this.cache._internal_unstable.lifetimes.resetLifetime(id, key);
|
|
54343
|
-
const {
|
|
54344
|
-
if (
|
|
54373
|
+
const { selection: selection2, list, filters } = field;
|
|
54374
|
+
if (selection2 && list) {
|
|
54345
54375
|
this.cache._internal_unstable.lists.add({
|
|
54346
54376
|
name: list.name,
|
|
54347
54377
|
connection: list.connection,
|
|
@@ -54349,7 +54379,7 @@ var InMemorySubscriptions = class {
|
|
|
54349
54379
|
recordType: this.cache._internal_unstable.storage.get(id, "__typename")?.value || parentType,
|
|
54350
54380
|
listType: list.type,
|
|
54351
54381
|
key,
|
|
54352
|
-
selection:
|
|
54382
|
+
selection: selection2,
|
|
54353
54383
|
filters: Object.entries(filters || {}).reduce((acc, [key2, { kind, value }]) => {
|
|
54354
54384
|
return {
|
|
54355
54385
|
...acc,
|
|
@@ -54366,20 +54396,21 @@ var InMemorySubscriptions = class {
|
|
|
54366
54396
|
subscribers,
|
|
54367
54397
|
parentType
|
|
54368
54398
|
}) {
|
|
54369
|
-
|
|
54370
|
-
|
|
54399
|
+
let targetSelection = getFieldsForType(selection2, parentType);
|
|
54400
|
+
for (const fieldSelection of Object.values(targetSelection)) {
|
|
54401
|
+
const { type: linkedType, keyRaw, selection: innerSelection } = fieldSelection;
|
|
54371
54402
|
const key = evaluateKey(keyRaw, variables);
|
|
54372
54403
|
for (const spec of subscribers) {
|
|
54373
54404
|
this.addFieldSubscription({
|
|
54374
54405
|
id: parent,
|
|
54375
54406
|
key,
|
|
54376
|
-
|
|
54407
|
+
field: fieldSelection,
|
|
54377
54408
|
spec,
|
|
54378
54409
|
parentType,
|
|
54379
54410
|
variables
|
|
54380
54411
|
});
|
|
54381
54412
|
}
|
|
54382
|
-
if (
|
|
54413
|
+
if (innerSelection) {
|
|
54383
54414
|
const { value: link } = this.cache._internal_unstable.storage.get(parent, key);
|
|
54384
54415
|
const children = !Array.isArray(link) ? [link] : flattenList(link);
|
|
54385
54416
|
for (const linkedRecord of children) {
|
|
@@ -54388,7 +54419,7 @@ var InMemorySubscriptions = class {
|
|
|
54388
54419
|
}
|
|
54389
54420
|
this.addMany({
|
|
54390
54421
|
parent: linkedRecord,
|
|
54391
|
-
selection:
|
|
54422
|
+
selection: innerSelection,
|
|
54392
54423
|
variables,
|
|
54393
54424
|
subscribers,
|
|
54394
54425
|
parentType: linkedType
|
|
@@ -54400,22 +54431,20 @@ var InMemorySubscriptions = class {
|
|
|
54400
54431
|
get(id, field) {
|
|
54401
54432
|
return this.subscribers[id]?.[field] || [];
|
|
54402
54433
|
}
|
|
54403
|
-
remove(id,
|
|
54434
|
+
remove(id, selection2, targets, variables, visited = []) {
|
|
54404
54435
|
visited.push(id);
|
|
54405
54436
|
const linkedIDs = [];
|
|
54406
|
-
for (const
|
|
54407
|
-
const key = evaluateKey(
|
|
54437
|
+
for (const fieldSelection of Object.values(selection2.fields || {})) {
|
|
54438
|
+
const key = evaluateKey(fieldSelection.keyRaw, variables);
|
|
54408
54439
|
this.removeSubscribers(id, key, targets);
|
|
54409
|
-
if (!
|
|
54440
|
+
if (!fieldSelection.selection?.fields) {
|
|
54410
54441
|
continue;
|
|
54411
54442
|
}
|
|
54412
|
-
if (selection2.list) {
|
|
54413
|
-
}
|
|
54414
54443
|
const { value: previousValue } = this.cache._internal_unstable.storage.get(id, key);
|
|
54415
54444
|
const links = !Array.isArray(previousValue) ? [previousValue] : flattenList(previousValue);
|
|
54416
54445
|
for (const link of links) {
|
|
54417
54446
|
if (link !== null) {
|
|
54418
|
-
linkedIDs.push([link,
|
|
54447
|
+
linkedIDs.push([link, fieldSelection.selection || {}]);
|
|
54419
54448
|
}
|
|
54420
54449
|
}
|
|
54421
54450
|
}
|
|
@@ -54570,10 +54599,12 @@ var CacheInternal = class {
|
|
|
54570
54599
|
this.lists = lists;
|
|
54571
54600
|
this.cache = cache;
|
|
54572
54601
|
this.lifetimes = lifetimes;
|
|
54602
|
+
this._disabled = typeof globalThis.window === "undefined";
|
|
54573
54603
|
try {
|
|
54574
|
-
|
|
54604
|
+
if (process.env.HOUDINI_TEST === "true") {
|
|
54605
|
+
this._disabled = false;
|
|
54606
|
+
}
|
|
54575
54607
|
} catch {
|
|
54576
|
-
this._disabled = typeof globalThis.window === "undefined";
|
|
54577
54608
|
}
|
|
54578
54609
|
}
|
|
54579
54610
|
setConfig(config2) {
|
|
@@ -54593,8 +54624,9 @@ var CacheInternal = class {
|
|
|
54593
54624
|
if (this._disabled) {
|
|
54594
54625
|
return [];
|
|
54595
54626
|
}
|
|
54627
|
+
let targetSelection = getFieldsForType(selection2, data["__typename"]);
|
|
54596
54628
|
for (const [field, value] of Object.entries(data)) {
|
|
54597
|
-
if (!selection2 || !
|
|
54629
|
+
if (!selection2 || !targetSelection[field]) {
|
|
54598
54630
|
throw new Error(
|
|
54599
54631
|
"Could not find field listing in selection for " + field + " @ " + JSON.stringify(selection2)
|
|
54600
54632
|
);
|
|
@@ -54602,11 +54634,11 @@ var CacheInternal = class {
|
|
|
54602
54634
|
let {
|
|
54603
54635
|
type: linkedType,
|
|
54604
54636
|
keyRaw,
|
|
54605
|
-
|
|
54637
|
+
selection: fieldSelection,
|
|
54606
54638
|
operations,
|
|
54607
54639
|
abstract: isAbstract,
|
|
54608
54640
|
update
|
|
54609
|
-
} =
|
|
54641
|
+
} = targetSelection[field];
|
|
54610
54642
|
const key = evaluateKey(keyRaw, variables);
|
|
54611
54643
|
const currentSubscribers = this.subscriptions.get(parent, key);
|
|
54612
54644
|
const { value: previousValue, displayLayers } = this.storage.get(parent, key);
|
|
@@ -54614,7 +54646,7 @@ var CacheInternal = class {
|
|
|
54614
54646
|
if (displayLayer) {
|
|
54615
54647
|
this.lifetimes.resetLifetime(parent, key);
|
|
54616
54648
|
}
|
|
54617
|
-
if (!
|
|
54649
|
+
if (!fieldSelection) {
|
|
54618
54650
|
let newValue = value;
|
|
54619
54651
|
if (Array.isArray(value) && applyUpdates && update) {
|
|
54620
54652
|
if (update === "append") {
|
|
@@ -54634,7 +54666,7 @@ var CacheInternal = class {
|
|
|
54634
54666
|
}
|
|
54635
54667
|
const previousLinks = flattenList([previousValue]);
|
|
54636
54668
|
for (const link of previousLinks) {
|
|
54637
|
-
this.subscriptions.remove(link,
|
|
54669
|
+
this.subscriptions.remove(link, fieldSelection, currentSubscribers, variables);
|
|
54638
54670
|
}
|
|
54639
54671
|
layer.writeLink(parent, key, null);
|
|
54640
54672
|
toNotify.push(...currentSubscribers);
|
|
@@ -54660,14 +54692,14 @@ var CacheInternal = class {
|
|
|
54660
54692
|
if (previousValue && typeof previousValue === "string") {
|
|
54661
54693
|
this.subscriptions.remove(
|
|
54662
54694
|
previousValue,
|
|
54663
|
-
|
|
54695
|
+
fieldSelection,
|
|
54664
54696
|
currentSubscribers,
|
|
54665
54697
|
variables
|
|
54666
54698
|
);
|
|
54667
54699
|
}
|
|
54668
54700
|
this.subscriptions.addMany({
|
|
54669
54701
|
parent: linkedID,
|
|
54670
|
-
selection:
|
|
54702
|
+
selection: fieldSelection,
|
|
54671
54703
|
subscribers: currentSubscribers,
|
|
54672
54704
|
variables,
|
|
54673
54705
|
parentType: linkedType
|
|
@@ -54677,14 +54709,14 @@ var CacheInternal = class {
|
|
|
54677
54709
|
if (linkedID) {
|
|
54678
54710
|
this.writeSelection({
|
|
54679
54711
|
root,
|
|
54680
|
-
selection:
|
|
54712
|
+
selection: fieldSelection,
|
|
54681
54713
|
parent: linkedID,
|
|
54682
54714
|
data: value,
|
|
54683
54715
|
variables,
|
|
54684
54716
|
toNotify,
|
|
54685
54717
|
applyUpdates,
|
|
54686
54718
|
layer,
|
|
54687
|
-
forceNotify
|
|
54719
|
+
forceNotify
|
|
54688
54720
|
});
|
|
54689
54721
|
}
|
|
54690
54722
|
} else if (Array.isArray(value) && (typeof previousValue === "undefined" || Array.isArray(previousValue))) {
|
|
@@ -54713,7 +54745,7 @@ var CacheInternal = class {
|
|
|
54713
54745
|
key,
|
|
54714
54746
|
linkedType,
|
|
54715
54747
|
variables,
|
|
54716
|
-
fields,
|
|
54748
|
+
fields: fieldSelection,
|
|
54717
54749
|
layer,
|
|
54718
54750
|
forceNotify
|
|
54719
54751
|
});
|
|
@@ -54763,7 +54795,7 @@ var CacheInternal = class {
|
|
|
54763
54795
|
if (linkedIDs.includes(lostID) || !lostID) {
|
|
54764
54796
|
continue;
|
|
54765
54797
|
}
|
|
54766
|
-
this.subscriptions.remove(lostID,
|
|
54798
|
+
this.subscriptions.remove(lostID, fieldSelection, currentSubscribers, variables);
|
|
54767
54799
|
}
|
|
54768
54800
|
if (contentChanged || oldIDs.length === 0 && newIDs.length === 0) {
|
|
54769
54801
|
layer.writeLink(parent, key, linkedIDs);
|
|
@@ -54774,7 +54806,7 @@ var CacheInternal = class {
|
|
|
54774
54806
|
}
|
|
54775
54807
|
this.subscriptions.addMany({
|
|
54776
54808
|
parent: id,
|
|
54777
|
-
selection:
|
|
54809
|
+
selection: fieldSelection,
|
|
54778
54810
|
subscribers: currentSubscribers,
|
|
54779
54811
|
variables,
|
|
54780
54812
|
parentType: linkedType
|
|
@@ -54799,9 +54831,14 @@ var CacheInternal = class {
|
|
|
54799
54831
|
}
|
|
54800
54832
|
const targets = Array.isArray(value) ? value : [value];
|
|
54801
54833
|
for (const target of targets) {
|
|
54802
|
-
if (operation.action === "insert" && target instanceof Object &&
|
|
54803
|
-
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).addToList(
|
|
54804
|
-
|
|
54834
|
+
if (operation.action === "insert" && target instanceof Object && fieldSelection && operation.list) {
|
|
54835
|
+
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).addToList(
|
|
54836
|
+
fieldSelection,
|
|
54837
|
+
target,
|
|
54838
|
+
variables,
|
|
54839
|
+
operation.position || "last"
|
|
54840
|
+
);
|
|
54841
|
+
} else if (operation.action === "remove" && target instanceof Object && fieldSelection && operation.list) {
|
|
54805
54842
|
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).remove(target, variables);
|
|
54806
54843
|
} else if (operation.action === "delete" && operation.type) {
|
|
54807
54844
|
if (typeof target !== "string") {
|
|
@@ -54812,8 +54849,13 @@ var CacheInternal = class {
|
|
|
54812
54849
|
continue;
|
|
54813
54850
|
}
|
|
54814
54851
|
this.cache.delete(targetID);
|
|
54815
|
-
} else if (operation.action === "toggle" && target instanceof Object &&
|
|
54816
|
-
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).toggleElement(
|
|
54852
|
+
} else if (operation.action === "toggle" && target instanceof Object && fieldSelection && operation.list) {
|
|
54853
|
+
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).toggleElement(
|
|
54854
|
+
fieldSelection,
|
|
54855
|
+
target,
|
|
54856
|
+
variables,
|
|
54857
|
+
operation.position || "last"
|
|
54858
|
+
);
|
|
54817
54859
|
}
|
|
54818
54860
|
}
|
|
54819
54861
|
}
|
|
@@ -54833,9 +54875,12 @@ var CacheInternal = class {
|
|
|
54833
54875
|
let hasData = false;
|
|
54834
54876
|
let partial = false;
|
|
54835
54877
|
let cascadeNull = false;
|
|
54836
|
-
|
|
54837
|
-
|
|
54838
|
-
|
|
54878
|
+
const typename = this.storage.get(parent, "__typename").value;
|
|
54879
|
+
let targetSelection = getFieldsForType(selection2, typename);
|
|
54880
|
+
for (const [
|
|
54881
|
+
attributeName,
|
|
54882
|
+
{ type, keyRaw, selection: fieldSelection, nullable, list }
|
|
54883
|
+
] of Object.entries(targetSelection)) {
|
|
54839
54884
|
const key = evaluateKey(keyRaw, variables);
|
|
54840
54885
|
const { value } = this.storage.get(parent, key);
|
|
54841
54886
|
let nextStep = stepsFromConnection;
|
|
@@ -54858,7 +54903,7 @@ var CacheInternal = class {
|
|
|
54858
54903
|
if (typeof value !== "undefined") {
|
|
54859
54904
|
hasData = true;
|
|
54860
54905
|
}
|
|
54861
|
-
} else if (!
|
|
54906
|
+
} else if (!fieldSelection) {
|
|
54862
54907
|
const fnUnmarshal = this.config?.scalars?.[type]?.unmarshal;
|
|
54863
54908
|
if (fnUnmarshal) {
|
|
54864
54909
|
target[attributeName] = fnUnmarshal(value);
|
|
@@ -54868,7 +54913,7 @@ var CacheInternal = class {
|
|
|
54868
54913
|
hasData = true;
|
|
54869
54914
|
} else if (Array.isArray(value)) {
|
|
54870
54915
|
const listValue = this.hydrateNestedList({
|
|
54871
|
-
fields,
|
|
54916
|
+
fields: fieldSelection,
|
|
54872
54917
|
variables,
|
|
54873
54918
|
linkedList: value,
|
|
54874
54919
|
stepsFromConnection: nextStep
|
|
@@ -54883,7 +54928,7 @@ var CacheInternal = class {
|
|
|
54883
54928
|
} else {
|
|
54884
54929
|
const objectFields = this.getSelection({
|
|
54885
54930
|
parent: value,
|
|
54886
|
-
selection:
|
|
54931
|
+
selection: fieldSelection,
|
|
54887
54932
|
variables,
|
|
54888
54933
|
stepsFromConnection: nextStep
|
|
54889
54934
|
});
|
|
@@ -55385,7 +55430,7 @@ var Config = class {
|
|
|
55385
55430
|
typeConfig;
|
|
55386
55431
|
configFile;
|
|
55387
55432
|
logLevel;
|
|
55388
|
-
|
|
55433
|
+
defaultFragmentMasking = "enable";
|
|
55389
55434
|
configIsRoute = null;
|
|
55390
55435
|
routesDir;
|
|
55391
55436
|
schemaPollInterval;
|
|
@@ -55398,6 +55443,11 @@ var Config = class {
|
|
|
55398
55443
|
...configFile
|
|
55399
55444
|
}) {
|
|
55400
55445
|
this.configFile = defaultConfigValues(configFile);
|
|
55446
|
+
if (configFile.disableMasking !== void 0) {
|
|
55447
|
+
throw new HoudiniError({
|
|
55448
|
+
message: `"disableMasking" was replaced by "defaultFragmentMasking". Please update your config file.`
|
|
55449
|
+
});
|
|
55450
|
+
}
|
|
55401
55451
|
let {
|
|
55402
55452
|
schema,
|
|
55403
55453
|
schemaPath = "./schema.graphql",
|
|
@@ -55414,7 +55464,7 @@ var Config = class {
|
|
|
55414
55464
|
defaultKeys,
|
|
55415
55465
|
types: types12 = {},
|
|
55416
55466
|
logLevel,
|
|
55417
|
-
|
|
55467
|
+
defaultFragmentMasking = "enable",
|
|
55418
55468
|
schemaPollInterval = 2e3,
|
|
55419
55469
|
schemaPollHeaders = {},
|
|
55420
55470
|
projectDir
|
|
@@ -55433,7 +55483,11 @@ var Config = class {
|
|
|
55433
55483
|
logLevel = LogLevel.Summary;
|
|
55434
55484
|
}
|
|
55435
55485
|
this.schemaPath = schemaPath;
|
|
55436
|
-
|
|
55486
|
+
if (apiUrl && apiUrl.startsWith("env:")) {
|
|
55487
|
+
this.apiUrl = process.env[apiUrl.slice("env:".length)];
|
|
55488
|
+
} else {
|
|
55489
|
+
this.apiUrl = apiUrl;
|
|
55490
|
+
}
|
|
55437
55491
|
this.filepath = filepath;
|
|
55438
55492
|
this.exclude = Array.isArray(exclude) ? exclude : [exclude];
|
|
55439
55493
|
this.module = module2;
|
|
@@ -55445,10 +55499,10 @@ var Config = class {
|
|
|
55445
55499
|
this.defaultCachePolicy = defaultCachePolicy;
|
|
55446
55500
|
this.defaultPartial = defaultPartial;
|
|
55447
55501
|
this.internalListPosition = defaultListPosition === "append" ? "last" : "first";
|
|
55448
|
-
this.defaultListTarget
|
|
55502
|
+
this.defaultListTarget = defaultListTarget;
|
|
55449
55503
|
this.definitionsFolder = definitionsPath;
|
|
55450
55504
|
this.logLevel = (logLevel || LogLevel.Summary).toLowerCase();
|
|
55451
|
-
this.
|
|
55505
|
+
this.defaultFragmentMasking = defaultFragmentMasking;
|
|
55452
55506
|
this.routesDir = join(this.projectRoot, "src", "routes");
|
|
55453
55507
|
this.schemaPollInterval = schemaPollInterval;
|
|
55454
55508
|
this.schemaPollHeaders = schemaPollHeaders;
|
|
@@ -55642,8 +55696,14 @@ var Config = class {
|
|
|
55642
55696
|
pluginDirectory(name2) {
|
|
55643
55697
|
return houdini_mode.is_testing ? resolve("../../../", name2) : join(this.rootDir, "plugins", name2);
|
|
55644
55698
|
}
|
|
55645
|
-
get
|
|
55646
|
-
return "
|
|
55699
|
+
get manualLoadDirective() {
|
|
55700
|
+
return "manual_load";
|
|
55701
|
+
}
|
|
55702
|
+
get maskEnableDirective() {
|
|
55703
|
+
return "mask_enable";
|
|
55704
|
+
}
|
|
55705
|
+
get maskDisableDirective() {
|
|
55706
|
+
return "mask_disable";
|
|
55647
55707
|
}
|
|
55648
55708
|
get listDirective() {
|
|
55649
55709
|
return "list";
|
|
@@ -55655,9 +55715,9 @@ var Config = class {
|
|
|
55655
55715
|
return "append";
|
|
55656
55716
|
}
|
|
55657
55717
|
get listParentDirective() {
|
|
55658
|
-
return
|
|
55718
|
+
return "parentID";
|
|
55659
55719
|
}
|
|
55660
|
-
get
|
|
55720
|
+
get deprecatedlistDirectiveParentIDArg() {
|
|
55661
55721
|
return "parentID";
|
|
55662
55722
|
}
|
|
55663
55723
|
get listAllListsDirective() {
|
|
@@ -55743,7 +55803,7 @@ var Config = class {
|
|
|
55743
55803
|
this.listDirective,
|
|
55744
55804
|
this.listPrependDirective,
|
|
55745
55805
|
this.listAppendDirective,
|
|
55746
|
-
this.
|
|
55806
|
+
this.listParentDirective,
|
|
55747
55807
|
this.listAllListsDirective,
|
|
55748
55808
|
this.whenDirective,
|
|
55749
55809
|
this.whenNotDirective,
|
|
@@ -55751,7 +55811,9 @@ var Config = class {
|
|
|
55751
55811
|
this.withDirective,
|
|
55752
55812
|
this.paginateDirective,
|
|
55753
55813
|
this.cacheDirective,
|
|
55754
|
-
this.
|
|
55814
|
+
this.manualLoadDirective,
|
|
55815
|
+
this.maskEnableDirective,
|
|
55816
|
+
this.maskDisableDirective
|
|
55755
55817
|
].includes(name2.value) || this.isDeleteDirective(name2.value);
|
|
55756
55818
|
}
|
|
55757
55819
|
isListFragment(name2) {
|
|
@@ -55988,13 +56050,17 @@ function flattenSelections({
|
|
|
55988
56050
|
config: config2,
|
|
55989
56051
|
filepath,
|
|
55990
56052
|
selections,
|
|
55991
|
-
fragmentDefinitions
|
|
56053
|
+
fragmentDefinitions,
|
|
56054
|
+
applyFragments,
|
|
56055
|
+
ignoreMaskDisable
|
|
55992
56056
|
}) {
|
|
55993
56057
|
const fields = new FieldCollection({
|
|
55994
56058
|
config: config2,
|
|
55995
56059
|
filepath,
|
|
55996
56060
|
selections,
|
|
55997
|
-
fragmentDefinitions
|
|
56061
|
+
fragmentDefinitions,
|
|
56062
|
+
applyFragments,
|
|
56063
|
+
ignoreMaskDisable: !!ignoreMaskDisable
|
|
55998
56064
|
});
|
|
55999
56065
|
return fields.toSelectionSet();
|
|
56000
56066
|
}
|
|
@@ -56005,9 +56071,13 @@ var FieldCollection = class {
|
|
|
56005
56071
|
fields;
|
|
56006
56072
|
inlineFragments;
|
|
56007
56073
|
fragmentSpreads;
|
|
56074
|
+
applyFragments;
|
|
56075
|
+
ignoreMaskDisable;
|
|
56008
56076
|
constructor(args) {
|
|
56009
56077
|
this.config = args.config;
|
|
56010
56078
|
this.fragmentDefinitions = args.fragmentDefinitions;
|
|
56079
|
+
this.applyFragments = args.applyFragments;
|
|
56080
|
+
this.ignoreMaskDisable = args.ignoreMaskDisable;
|
|
56011
56081
|
this.fields = {};
|
|
56012
56082
|
this.inlineFragments = {};
|
|
56013
56083
|
this.fragmentSpreads = {};
|
|
@@ -56036,31 +56106,28 @@ var FieldCollection = class {
|
|
|
56036
56106
|
}
|
|
56037
56107
|
}
|
|
56038
56108
|
if (selection2.kind === "InlineFragment" && selection2.typeCondition) {
|
|
56039
|
-
|
|
56040
|
-
if (!this.inlineFragments[key]) {
|
|
56041
|
-
this.inlineFragments[key] = {
|
|
56042
|
-
astNode: selection2,
|
|
56043
|
-
selection: this.empty()
|
|
56044
|
-
};
|
|
56045
|
-
}
|
|
56046
|
-
for (const subselect of selection2.selectionSet?.selections || []) {
|
|
56047
|
-
this.inlineFragments[key].selection.add(subselect);
|
|
56048
|
-
}
|
|
56109
|
+
this.walkInlineFragment(selection2);
|
|
56049
56110
|
return;
|
|
56050
56111
|
}
|
|
56051
56112
|
if (selection2.kind === "FragmentSpread") {
|
|
56052
56113
|
this.fragmentSpreads[selection2.name.value] = selection2;
|
|
56053
|
-
|
|
56054
|
-
|
|
56114
|
+
let includeFragments = this.config.defaultFragmentMasking === "disable";
|
|
56115
|
+
const maskEnableDirective = selection2.directives?.find(
|
|
56116
|
+
({ name: name2 }) => name2.value === this.config.maskEnableDirective
|
|
56055
56117
|
);
|
|
56056
|
-
|
|
56057
|
-
|
|
56118
|
+
if (maskEnableDirective) {
|
|
56119
|
+
includeFragments = false;
|
|
56120
|
+
}
|
|
56121
|
+
const maskDisableDirective = selection2.directives?.find(
|
|
56122
|
+
({ name: name2 }) => name2.value === this.config.maskDisableDirective
|
|
56058
56123
|
);
|
|
56059
|
-
|
|
56060
|
-
|
|
56061
|
-
|
|
56124
|
+
if (maskDisableDirective) {
|
|
56125
|
+
includeFragments = true;
|
|
56126
|
+
}
|
|
56127
|
+
if (this.ignoreMaskDisable) {
|
|
56128
|
+
includeFragments = true;
|
|
56062
56129
|
}
|
|
56063
|
-
if (!includeFragments) {
|
|
56130
|
+
if (!includeFragments || !this.applyFragments) {
|
|
56064
56131
|
return;
|
|
56065
56132
|
}
|
|
56066
56133
|
const definition = this.fragmentDefinitions[selection2.name.value];
|
|
@@ -56070,9 +56137,20 @@ var FieldCollection = class {
|
|
|
56070
56137
|
message: "Could not find referenced fragment definition: " + selection2.name.value
|
|
56071
56138
|
});
|
|
56072
56139
|
}
|
|
56073
|
-
|
|
56074
|
-
|
|
56075
|
-
|
|
56140
|
+
this.add({
|
|
56141
|
+
kind: "InlineFragment",
|
|
56142
|
+
typeCondition: {
|
|
56143
|
+
kind: "NamedType",
|
|
56144
|
+
name: {
|
|
56145
|
+
kind: "Name",
|
|
56146
|
+
value: definition.typeCondition.name.value
|
|
56147
|
+
}
|
|
56148
|
+
},
|
|
56149
|
+
selectionSet: {
|
|
56150
|
+
kind: "SelectionSet",
|
|
56151
|
+
selections: [...definition.selectionSet.selections]
|
|
56152
|
+
}
|
|
56153
|
+
});
|
|
56076
56154
|
}
|
|
56077
56155
|
}
|
|
56078
56156
|
toSelectionSet() {
|
|
@@ -56088,12 +56166,30 @@ var FieldCollection = class {
|
|
|
56088
56166
|
})
|
|
56089
56167
|
).concat(Object.values(this.fragmentSpreads));
|
|
56090
56168
|
}
|
|
56169
|
+
walkInlineFragment(selection2) {
|
|
56170
|
+
const key = selection2.typeCondition.name.value;
|
|
56171
|
+
if (!this.inlineFragments[key]) {
|
|
56172
|
+
this.inlineFragments[key] = {
|
|
56173
|
+
astNode: selection2,
|
|
56174
|
+
selection: this.empty()
|
|
56175
|
+
};
|
|
56176
|
+
}
|
|
56177
|
+
for (const subselect of selection2.selectionSet.selections || []) {
|
|
56178
|
+
if (subselect.kind !== "InlineFragment" || !subselect.typeCondition) {
|
|
56179
|
+
this.inlineFragments[key].selection.add(subselect);
|
|
56180
|
+
continue;
|
|
56181
|
+
}
|
|
56182
|
+
this.walkInlineFragment(subselect);
|
|
56183
|
+
}
|
|
56184
|
+
}
|
|
56091
56185
|
empty() {
|
|
56092
56186
|
return new FieldCollection({
|
|
56093
56187
|
config: this.config,
|
|
56094
56188
|
fragmentDefinitions: this.fragmentDefinitions,
|
|
56095
56189
|
selections: [],
|
|
56096
|
-
filepath: this.filepath
|
|
56190
|
+
filepath: this.filepath,
|
|
56191
|
+
applyFragments: this.applyFragments,
|
|
56192
|
+
ignoreMaskDisable: this.ignoreMaskDisable
|
|
56097
56193
|
});
|
|
56098
56194
|
}
|
|
56099
56195
|
};
|
|
@@ -56448,11 +56544,6 @@ function operationObject({
|
|
|
56448
56544
|
const when = internalDirectives.find(({ name: name2 }) => name2.value === "when");
|
|
56449
56545
|
const when_not = internalDirectives.find(({ name: name2 }) => name2.value === "when_not");
|
|
56450
56546
|
let parentIDArg = parent?.arguments?.find((argument) => argument.name.value === "value");
|
|
56451
|
-
if (!parentIDArg) {
|
|
56452
|
-
parentIDArg = (append || prepend)?.arguments?.find(
|
|
56453
|
-
({ name: name2 }) => name2.value === config2.listDirectiveParentIDArg
|
|
56454
|
-
);
|
|
56455
|
-
}
|
|
56456
56547
|
if (parentIDArg) {
|
|
56457
56548
|
if (parentIDArg.value.kind === "StringValue") {
|
|
56458
56549
|
parentID = parentIDArg.value.value;
|
|
@@ -57480,6 +57571,8 @@ function selection({
|
|
|
57480
57571
|
markEdges
|
|
57481
57572
|
}) {
|
|
57482
57573
|
let object = {};
|
|
57574
|
+
const typeMap = {};
|
|
57575
|
+
const abstractTypes = [];
|
|
57483
57576
|
for (const field of selections) {
|
|
57484
57577
|
if (field.kind === "FragmentSpread" && includeFragments) {
|
|
57485
57578
|
const fragmentDefinition = document.document.definitions.find(
|
|
@@ -57506,20 +57599,68 @@ function selection({
|
|
|
57506
57599
|
})
|
|
57507
57600
|
);
|
|
57508
57601
|
} else if (field.kind === "InlineFragment") {
|
|
57509
|
-
|
|
57510
|
-
|
|
57511
|
-
object,
|
|
57512
|
-
selection({
|
|
57513
|
-
config: config2,
|
|
57602
|
+
if (!field.typeCondition || field.typeCondition.name.value === rootType) {
|
|
57603
|
+
object.fields = deepMerge(
|
|
57514
57604
|
filepath,
|
|
57515
|
-
|
|
57516
|
-
|
|
57517
|
-
|
|
57518
|
-
|
|
57519
|
-
|
|
57520
|
-
|
|
57521
|
-
|
|
57522
|
-
|
|
57605
|
+
object.fields || {},
|
|
57606
|
+
selection({
|
|
57607
|
+
config: config2,
|
|
57608
|
+
filepath,
|
|
57609
|
+
rootType: field.typeCondition?.name.value || rootType,
|
|
57610
|
+
operations,
|
|
57611
|
+
selections: field.selectionSet.selections,
|
|
57612
|
+
path: path2,
|
|
57613
|
+
includeFragments,
|
|
57614
|
+
document
|
|
57615
|
+
}).fields || {}
|
|
57616
|
+
);
|
|
57617
|
+
} else {
|
|
57618
|
+
if (!object.abstractFields) {
|
|
57619
|
+
object.abstractFields = {
|
|
57620
|
+
fields: {},
|
|
57621
|
+
typeMap: {}
|
|
57622
|
+
};
|
|
57623
|
+
}
|
|
57624
|
+
const parentType = config2.schema.getType(rootType);
|
|
57625
|
+
const typeConditionName = field.typeCondition.name.value;
|
|
57626
|
+
const typeCondition = config2.schema.getType(typeConditionName);
|
|
57627
|
+
const possibleTypes = [];
|
|
57628
|
+
if (!graphql10.isAbstractType(typeCondition)) {
|
|
57629
|
+
} else if (graphql10.isAbstractType(parentType)) {
|
|
57630
|
+
const possibleParentTypes = config2.schema.getPossibleTypes(parentType).map((type) => type.name);
|
|
57631
|
+
for (const possible of config2.schema.getPossibleTypes(typeCondition)) {
|
|
57632
|
+
if (possibleParentTypes.includes(possible.name)) {
|
|
57633
|
+
possibleTypes.push(possible.name);
|
|
57634
|
+
}
|
|
57635
|
+
}
|
|
57636
|
+
} else {
|
|
57637
|
+
possibleTypes.push(rootType);
|
|
57638
|
+
}
|
|
57639
|
+
if (possibleTypes.length > 0) {
|
|
57640
|
+
for (const type of possibleTypes) {
|
|
57641
|
+
const existing = typeMap[type];
|
|
57642
|
+
if (!existing || !existing.includes(type)) {
|
|
57643
|
+
typeMap[type] = [typeConditionName].concat(existing || []);
|
|
57644
|
+
}
|
|
57645
|
+
if (!abstractTypes.includes(typeConditionName)) {
|
|
57646
|
+
abstractTypes.push(typeConditionName);
|
|
57647
|
+
}
|
|
57648
|
+
}
|
|
57649
|
+
}
|
|
57650
|
+
object.abstractFields.fields = {
|
|
57651
|
+
...object.abstractFields.fields,
|
|
57652
|
+
[field.typeCondition.name.value]: selection({
|
|
57653
|
+
config: config2,
|
|
57654
|
+
filepath,
|
|
57655
|
+
rootType: field.typeCondition?.name.value || rootType,
|
|
57656
|
+
operations,
|
|
57657
|
+
selections: field.selectionSet.selections,
|
|
57658
|
+
path: path2,
|
|
57659
|
+
includeFragments,
|
|
57660
|
+
document
|
|
57661
|
+
}).fields
|
|
57662
|
+
};
|
|
57663
|
+
}
|
|
57523
57664
|
} else if (field.kind === "Field") {
|
|
57524
57665
|
const type = config2.schema.getType(rootType);
|
|
57525
57666
|
if (!type) {
|
|
@@ -57577,7 +57718,7 @@ function selection({
|
|
|
57577
57718
|
}
|
|
57578
57719
|
if (field.selectionSet) {
|
|
57579
57720
|
const edgesMark = paginated && document.refetch?.method === "cursor" ? document.refetch.update : markEdges;
|
|
57580
|
-
fieldObj.
|
|
57721
|
+
fieldObj.selection = selection({
|
|
57581
57722
|
config: config2,
|
|
57582
57723
|
filepath,
|
|
57583
57724
|
rootType: typeName,
|
|
@@ -57601,11 +57742,49 @@ function selection({
|
|
|
57601
57742
|
if (graphql10.isInterfaceType(fieldType) || graphql10.isUnionType(fieldType)) {
|
|
57602
57743
|
fieldObj.abstract = true;
|
|
57603
57744
|
}
|
|
57604
|
-
object
|
|
57605
|
-
|
|
57606
|
-
fieldObj
|
|
57607
|
-
|
|
57608
|
-
|
|
57745
|
+
object.fields = {
|
|
57746
|
+
...object.fields,
|
|
57747
|
+
[attributeName]: fieldObj
|
|
57748
|
+
};
|
|
57749
|
+
}
|
|
57750
|
+
}
|
|
57751
|
+
if (Object.keys(object.fields || {}).length > 0 && object.abstractFields && Object.keys(object.abstractFields.fields).length > 0) {
|
|
57752
|
+
for (const [typeName, possibles] of Object.entries(typeMap)) {
|
|
57753
|
+
let overlap = false;
|
|
57754
|
+
for (const possible of possibles) {
|
|
57755
|
+
if (object.abstractFields.fields[typeName]) {
|
|
57756
|
+
object.abstractFields.fields[typeName] = deepMerge(
|
|
57757
|
+
filepath,
|
|
57758
|
+
object.abstractFields.fields[typeName] || {},
|
|
57759
|
+
object.abstractFields.fields[possible]
|
|
57760
|
+
);
|
|
57761
|
+
overlap = true;
|
|
57762
|
+
}
|
|
57763
|
+
}
|
|
57764
|
+
if (overlap) {
|
|
57765
|
+
delete typeMap[typeName];
|
|
57766
|
+
}
|
|
57767
|
+
}
|
|
57768
|
+
for (const [type, options] of Object.entries(typeMap)) {
|
|
57769
|
+
if (options.length > 1) {
|
|
57770
|
+
object.abstractFields.fields[type] = deepMerge(
|
|
57771
|
+
filepath,
|
|
57772
|
+
...options.map((opt) => object.abstractFields.fields[opt] || {})
|
|
57773
|
+
);
|
|
57774
|
+
delete typeMap[type];
|
|
57775
|
+
}
|
|
57776
|
+
}
|
|
57777
|
+
for (const [type, sel] of Object.entries(object.abstractFields?.fields || {})) {
|
|
57778
|
+
object.abstractFields.fields[type] = deepMerge(filepath, sel || {}, object.fields);
|
|
57779
|
+
}
|
|
57780
|
+
for (const [type, options] of Object.entries(typeMap)) {
|
|
57781
|
+
object.abstractFields.typeMap[type] = options[0];
|
|
57782
|
+
}
|
|
57783
|
+
const usedTypes = Object.values(object.abstractFields.typeMap);
|
|
57784
|
+
for (const type of abstractTypes) {
|
|
57785
|
+
if (!usedTypes.includes(type)) {
|
|
57786
|
+
delete object.abstractFields.fields[type];
|
|
57787
|
+
}
|
|
57609
57788
|
}
|
|
57610
57789
|
}
|
|
57611
57790
|
return object;
|
|
@@ -57740,6 +57919,22 @@ function artifactGenerator(stats) {
|
|
|
57740
57919
|
selectionSet = matchingFragment.selectionSet;
|
|
57741
57920
|
}
|
|
57742
57921
|
const inputs = operations[0]?.variableDefinitions;
|
|
57922
|
+
const mergedSelection = flattenSelections({
|
|
57923
|
+
config: config2,
|
|
57924
|
+
filepath: doc.filename,
|
|
57925
|
+
selections: selectionSet.selections,
|
|
57926
|
+
fragmentDefinitions: doc.document.definitions.filter(
|
|
57927
|
+
(definition) => definition.kind === "FragmentDefinition"
|
|
57928
|
+
).reduce(
|
|
57929
|
+
(prev, definition) => ({
|
|
57930
|
+
...prev,
|
|
57931
|
+
[definition.name.value]: definition
|
|
57932
|
+
}),
|
|
57933
|
+
{}
|
|
57934
|
+
),
|
|
57935
|
+
ignoreMaskDisable: docKind === "HoudiniQuery",
|
|
57936
|
+
applyFragments: docKind !== "HoudiniFragment"
|
|
57937
|
+
});
|
|
57743
57938
|
const artifact = {
|
|
57744
57939
|
name: name2,
|
|
57745
57940
|
kind: docKind,
|
|
@@ -57751,7 +57946,7 @@ function artifactGenerator(stats) {
|
|
|
57751
57946
|
config: config2,
|
|
57752
57947
|
filepath: doc.filename,
|
|
57753
57948
|
rootType,
|
|
57754
|
-
selections:
|
|
57949
|
+
selections: mergedSelection,
|
|
57755
57950
|
operations: operationsByPath(
|
|
57756
57951
|
config2,
|
|
57757
57952
|
doc.filename,
|
|
@@ -58047,6 +58242,17 @@ function inlineType({
|
|
|
58047
58242
|
continue;
|
|
58048
58243
|
}
|
|
58049
58244
|
const possibleParents = config2.schema.getPossibleTypes(type).map((t) => t.name);
|
|
58245
|
+
const freeSelections = [];
|
|
58246
|
+
const typeSpecificSelections = {};
|
|
58247
|
+
for (const node of selection2.selectionSet.selections) {
|
|
58248
|
+
if (node.kind !== "InlineFragment") {
|
|
58249
|
+
freeSelections.push(node);
|
|
58250
|
+
} else if (node.typeCondition) {
|
|
58251
|
+
typeSpecificSelections[node.typeCondition.name.value] = node.selectionSet.selections;
|
|
58252
|
+
} else {
|
|
58253
|
+
freeSelections.push(...node.selectionSet.selections);
|
|
58254
|
+
}
|
|
58255
|
+
}
|
|
58050
58256
|
for (const possibleType of config2.schema.getPossibleTypes(fragmentType)) {
|
|
58051
58257
|
if (!possibleParents.includes(possibleType.name)) {
|
|
58052
58258
|
continue;
|
|
@@ -58054,7 +58260,12 @@ function inlineType({
|
|
|
58054
58260
|
if (!inlineFragments[possibleType.name]) {
|
|
58055
58261
|
inlineFragments[possibleType.name] = [];
|
|
58056
58262
|
}
|
|
58057
|
-
inlineFragments[possibleType.name].push(...
|
|
58263
|
+
inlineFragments[possibleType.name].push(...freeSelections);
|
|
58264
|
+
if (typeSpecificSelections[possibleType.name]) {
|
|
58265
|
+
inlineFragments[possibleType.name].push(
|
|
58266
|
+
...typeSpecificSelections[possibleType.name]
|
|
58267
|
+
);
|
|
58268
|
+
}
|
|
58058
58269
|
}
|
|
58059
58270
|
} else if (selection2.kind === "InlineFragment" && !selection2.typeCondition) {
|
|
58060
58271
|
selectedFields.push(...selection2.selectionSet.selections);
|
|
@@ -58066,12 +58277,7 @@ function inlineType({
|
|
|
58066
58277
|
...(selectedFields || []).filter(
|
|
58067
58278
|
(field) => field.kind === "Field"
|
|
58068
58279
|
).map((selection2) => {
|
|
58069
|
-
const {
|
|
58070
|
-
config2.schema,
|
|
58071
|
-
filepath,
|
|
58072
|
-
rootObj,
|
|
58073
|
-
selection2
|
|
58074
|
-
);
|
|
58280
|
+
const { field } = selectionTypeInfo(config2.schema, filepath, rootObj, selection2);
|
|
58075
58281
|
const attributeName = selection2.alias?.value || selection2.name.value;
|
|
58076
58282
|
let attributeType = inlineType({
|
|
58077
58283
|
config: config2,
|
|
@@ -58270,7 +58476,8 @@ async function typescriptGenerator(config2, docs) {
|
|
|
58270
58476
|
config: config2,
|
|
58271
58477
|
filepath: filename,
|
|
58272
58478
|
selections: definition.selectionSet.selections,
|
|
58273
|
-
fragmentDefinitions
|
|
58479
|
+
fragmentDefinitions,
|
|
58480
|
+
applyFragments: definition.kind === "OperationDefinition"
|
|
58274
58481
|
});
|
|
58275
58482
|
if (definition?.kind === "OperationDefinition") {
|
|
58276
58483
|
await generateOperationTypeDefs(
|
|
@@ -58783,14 +58990,12 @@ directive @${config2.paginateDirective}(${config2.paginateNameArg}: String) on F
|
|
|
58783
58990
|
"""
|
|
58784
58991
|
@${config2.listPrependDirective} is used to tell the runtime to add the result to the end of the list
|
|
58785
58992
|
"""
|
|
58786
|
-
directive @${config2.listPrependDirective}
|
|
58787
|
-
${config2.listDirectiveParentIDArg}: ID
|
|
58788
|
-
) on FRAGMENT_SPREAD
|
|
58993
|
+
directive @${config2.listPrependDirective} on FRAGMENT_SPREAD
|
|
58789
58994
|
|
|
58790
58995
|
"""
|
|
58791
58996
|
@${config2.listAppendDirective} is used to tell the runtime to add the result to the start of the list
|
|
58792
58997
|
"""
|
|
58793
|
-
directive @${config2.listAppendDirective}
|
|
58998
|
+
directive @${config2.listAppendDirective} on FRAGMENT_SPREAD
|
|
58794
58999
|
|
|
58795
59000
|
"""
|
|
58796
59001
|
@${config2.listAllListsDirective} is used to tell the runtime to add the result to all list
|
|
@@ -58824,18 +59029,19 @@ directive @${config2.argumentsDirective} on FRAGMENT_DEFINITION
|
|
|
58824
59029
|
directive @${config2.cacheDirective}(${config2.cachePolicyArg}: CachePolicy, ${config2.cachePartialArg}: Boolean) on QUERY
|
|
58825
59030
|
|
|
58826
59031
|
"""
|
|
58827
|
-
@${config2.
|
|
59032
|
+
@${config2.manualLoadDirective} is used to disable automatic fetch (no load, no auto fetch in component), you will have to do it manually.
|
|
59033
|
+
"""
|
|
59034
|
+
directive @${config2.manualLoadDirective} on QUERY
|
|
59035
|
+
|
|
59036
|
+
"""
|
|
59037
|
+
@${config2.maskEnableDirective} to enable masking on fragment (overwriting the global conf)
|
|
58828
59038
|
"""
|
|
58829
|
-
directive @${config2.
|
|
58830
|
-
|
|
58831
|
-
|
|
58832
|
-
|
|
58833
|
-
|
|
58834
|
-
|
|
58835
|
-
Mask fragment fields (only valid when used at a fragment spread)
|
|
58836
|
-
"""
|
|
58837
|
-
mask: Boolean! = ${config2.disableMasking ? "false" : "true"}
|
|
58838
|
-
) on QUERY | FRAGMENT_SPREAD
|
|
59039
|
+
directive @${config2.maskEnableDirective} on FRAGMENT_SPREAD
|
|
59040
|
+
|
|
59041
|
+
"""
|
|
59042
|
+
@${config2.maskDisableDirective} to disable masking on fragment (overwriting the global conf)
|
|
59043
|
+
"""
|
|
59044
|
+
directive @${config2.maskDisableDirective} on FRAGMENT_SPREAD
|
|
58839
59045
|
`;
|
|
58840
59046
|
let currentSchema = graphql19.printSchema(config2.schema);
|
|
58841
59047
|
if (!currentSchema.includes(`directive @${config2.listDirective}`)) {
|
|
@@ -59328,26 +59534,42 @@ async function typeCheck(config2, docs) {
|
|
|
59328
59534
|
),
|
|
59329
59535
|
targetField.selectionSet
|
|
59330
59536
|
);
|
|
59331
|
-
|
|
59332
|
-
if (
|
|
59333
|
-
|
|
59334
|
-
|
|
59335
|
-
|
|
59336
|
-
|
|
59337
|
-
|
|
59338
|
-
|
|
59339
|
-
|
|
59340
|
-
|
|
59341
|
-
|
|
59342
|
-
|
|
59343
|
-
|
|
59344
|
-
|
|
59345
|
-
|
|
59346
|
-
|
|
59347
|
-
|
|
59348
|
-
)
|
|
59537
|
+
let targetTypes = [type];
|
|
59538
|
+
if (graphql23.isUnionType(type)) {
|
|
59539
|
+
targetTypes = config2.schema.getPossibleTypes(type);
|
|
59540
|
+
} else if (graphql23.isInterfaceType(type)) {
|
|
59541
|
+
try {
|
|
59542
|
+
for (const key of config2.keyFieldsForType(type.name)) {
|
|
59543
|
+
if (!type.getFields()[key]) {
|
|
59544
|
+
throw new Error("continue");
|
|
59545
|
+
}
|
|
59546
|
+
}
|
|
59547
|
+
} catch {
|
|
59548
|
+
targetTypes = config2.schema.getPossibleTypes(type);
|
|
59549
|
+
}
|
|
59550
|
+
}
|
|
59551
|
+
for (const targetType of targetTypes) {
|
|
59552
|
+
const missingIDFields = config2.keyFieldsForType(targetType.name).filter((fieldName) => !targetType.getFields()[fieldName]);
|
|
59553
|
+
if (missingIDFields.length > 0) {
|
|
59554
|
+
if (error) {
|
|
59555
|
+
errors.push(
|
|
59556
|
+
new HoudiniError({
|
|
59557
|
+
filepath: filename,
|
|
59558
|
+
message: error
|
|
59559
|
+
})
|
|
59560
|
+
);
|
|
59561
|
+
} else {
|
|
59562
|
+
errors.push(
|
|
59563
|
+
new HoudiniError({
|
|
59564
|
+
filepath: filename,
|
|
59565
|
+
message: `@${config2.listDirective} can only be applied to types with the necessary id fields: ${missingIDFields.join(
|
|
59566
|
+
", "
|
|
59567
|
+
)}.`
|
|
59568
|
+
})
|
|
59569
|
+
);
|
|
59570
|
+
}
|
|
59571
|
+
return;
|
|
59349
59572
|
}
|
|
59350
|
-
return;
|
|
59351
59573
|
}
|
|
59352
59574
|
lists.push(listName);
|
|
59353
59575
|
listTypes.push(type.name);
|
|
@@ -59377,6 +59599,7 @@ async function typeCheck(config2, docs) {
|
|
|
59377
59599
|
fragments
|
|
59378
59600
|
}),
|
|
59379
59601
|
checkMutationOperation(config2),
|
|
59602
|
+
checkMaskDirective(config2),
|
|
59380
59603
|
nodeDirectives(config2, [config2.paginateDirective]),
|
|
59381
59604
|
knownArguments(config2),
|
|
59382
59605
|
validateFragmentArguments(config2, filepath, fragments),
|
|
@@ -59441,10 +59664,14 @@ var validateLists = ({
|
|
|
59441
59664
|
]);
|
|
59442
59665
|
if (directive) {
|
|
59443
59666
|
let parentArg = directive.arguments?.find(
|
|
59444
|
-
(arg) => arg.name.value === config2.
|
|
59667
|
+
(arg) => arg.name.value === config2.deprecatedlistDirectiveParentIDArg
|
|
59445
59668
|
);
|
|
59446
59669
|
if (parentArg) {
|
|
59447
|
-
|
|
59670
|
+
ctx.reportError(
|
|
59671
|
+
new graphql23.GraphQLError(
|
|
59672
|
+
`@${config2.deprecatedlistDirectiveParentIDArg} should be defined only in it's own directive now`
|
|
59673
|
+
)
|
|
59674
|
+
);
|
|
59448
59675
|
}
|
|
59449
59676
|
}
|
|
59450
59677
|
if (parentIdFound) {
|
|
@@ -59840,6 +60067,28 @@ function checkMutationOperation(config2) {
|
|
|
59840
60067
|
};
|
|
59841
60068
|
};
|
|
59842
60069
|
}
|
|
60070
|
+
function checkMaskDirective(config2) {
|
|
60071
|
+
return function(ctx) {
|
|
60072
|
+
return {
|
|
60073
|
+
FragmentSpread(node, _, __, ___, ancestors) {
|
|
60074
|
+
const maskEnableDirective = node.directives?.find(
|
|
60075
|
+
(c) => c.name.value === config2.maskEnableDirective
|
|
60076
|
+
);
|
|
60077
|
+
const maskDisableDirective = node.directives?.find(
|
|
60078
|
+
(c) => c.name.value === config2.maskDisableDirective
|
|
60079
|
+
);
|
|
60080
|
+
if (maskEnableDirective && maskDisableDirective) {
|
|
60081
|
+
ctx.reportError(
|
|
60082
|
+
new graphql23.GraphQLError(
|
|
60083
|
+
`You can't apply both @${config2.maskEnableDirective} and @${config2.maskDisableDirective} at the same time`
|
|
60084
|
+
)
|
|
60085
|
+
);
|
|
60086
|
+
return;
|
|
60087
|
+
}
|
|
60088
|
+
}
|
|
60089
|
+
};
|
|
60090
|
+
};
|
|
60091
|
+
}
|
|
59843
60092
|
function getAndVerifyNodeInterface(config2) {
|
|
59844
60093
|
const { schema } = config2;
|
|
59845
60094
|
const nodeInterface = schema.getType("Node");
|
|
@@ -60118,8 +60367,9 @@ function testConfigFile(config2 = {}) {
|
|
|
60118
60367
|
scalar Cursor
|
|
60119
60368
|
|
|
60120
60369
|
|
|
60121
|
-
type User implements Node {
|
|
60370
|
+
type User implements Node & Friend & CatOwner {
|
|
60122
60371
|
id: ID!
|
|
60372
|
+
name: String!
|
|
60123
60373
|
firstName: String!
|
|
60124
60374
|
friends: [User!]!
|
|
60125
60375
|
friendsByCursor(first: Int, after: String, last: Int, before: String, filter: String): UserConnection!
|
|
@@ -60134,13 +60384,14 @@ function testConfigFile(config2 = {}) {
|
|
|
60134
60384
|
field(filter: String): String
|
|
60135
60385
|
}
|
|
60136
60386
|
|
|
60137
|
-
type Ghost implements Friend {
|
|
60387
|
+
type Ghost implements Friend & CatOwner & IsGhost {
|
|
60138
60388
|
name: String!
|
|
60139
60389
|
aka: String!
|
|
60140
60390
|
believers: [User!]!
|
|
60141
60391
|
friends: [Ghost!]!
|
|
60142
60392
|
friendsConnection(first: Int, after: String): GhostConnection!
|
|
60143
60393
|
legends: [Legend!]!
|
|
60394
|
+
cats: [Cat!]!
|
|
60144
60395
|
}
|
|
60145
60396
|
|
|
60146
60397
|
type Legend {
|
|
@@ -60166,6 +60417,9 @@ function testConfigFile(config2 = {}) {
|
|
|
60166
60417
|
usersByBackwardsCursor(last: Int, before: String): UserConnection!
|
|
60167
60418
|
usersByForwardsCursor(first: Int, after: String): UserConnection!
|
|
60168
60419
|
usersByOffset(offset: Int, limit: Int): [User!]!
|
|
60420
|
+
friendsByCursor(first: Int, after: String, last: Int, before: String): FriendConnection!
|
|
60421
|
+
ghostsByCursor(first: Int, after: String, last: Int, before: String): IsGhostConnection!
|
|
60422
|
+
entitiesByCursor(first: Int, after: String, last: Int, before: String): EntityConnection!
|
|
60169
60423
|
node(id: ID!): Node
|
|
60170
60424
|
}
|
|
60171
60425
|
|
|
@@ -60181,16 +60435,26 @@ function testConfigFile(config2 = {}) {
|
|
|
60181
60435
|
node: User
|
|
60182
60436
|
}
|
|
60183
60437
|
|
|
60184
|
-
type UserEdgeScalar {
|
|
60185
|
-
cursor: Cursor!
|
|
60186
|
-
node: User
|
|
60187
|
-
}
|
|
60188
|
-
|
|
60189
60438
|
type UserConnection {
|
|
60190
60439
|
pageInfo: PageInfo!
|
|
60191
60440
|
edges: [UserEdge!]!
|
|
60192
60441
|
}
|
|
60193
60442
|
|
|
60443
|
+
type FriendEdge {
|
|
60444
|
+
cursor: String!
|
|
60445
|
+
node: Friend
|
|
60446
|
+
}
|
|
60447
|
+
|
|
60448
|
+
type FriendConnection {
|
|
60449
|
+
pageInfo: PageInfo!
|
|
60450
|
+
edges: [FriendEdge!]!
|
|
60451
|
+
}
|
|
60452
|
+
|
|
60453
|
+
type UserEdgeScalar {
|
|
60454
|
+
cursor: Cursor!
|
|
60455
|
+
node: User
|
|
60456
|
+
}
|
|
60457
|
+
|
|
60194
60458
|
type UserConnectionScalar {
|
|
60195
60459
|
pageInfo: PageInfo!
|
|
60196
60460
|
edges: [UserEdgeScalar!]!
|
|
@@ -60206,10 +60470,38 @@ function testConfigFile(config2 = {}) {
|
|
|
60206
60470
|
edges: [GhostEdge!]!
|
|
60207
60471
|
}
|
|
60208
60472
|
|
|
60473
|
+
type EntityEdge {
|
|
60474
|
+
cursor: String!
|
|
60475
|
+
node: Entity
|
|
60476
|
+
}
|
|
60477
|
+
|
|
60478
|
+
type EntityConnection {
|
|
60479
|
+
pageInfo: PageInfo!
|
|
60480
|
+
edges: [EntityEdge!]!
|
|
60481
|
+
}
|
|
60482
|
+
|
|
60483
|
+
type IsGhostEdge {
|
|
60484
|
+
cursor: String!
|
|
60485
|
+
node: IsGhost
|
|
60486
|
+
}
|
|
60487
|
+
|
|
60488
|
+
type IsGhostConnection {
|
|
60489
|
+
pageInfo: PageInfo!
|
|
60490
|
+
edges: [IsGhostEdge!]!
|
|
60491
|
+
}
|
|
60492
|
+
|
|
60209
60493
|
interface Friend {
|
|
60210
60494
|
name: String!
|
|
60211
60495
|
}
|
|
60212
60496
|
|
|
60497
|
+
interface CatOwner {
|
|
60498
|
+
cats: [Cat!]!
|
|
60499
|
+
}
|
|
60500
|
+
|
|
60501
|
+
interface IsGhost {
|
|
60502
|
+
aka: String!
|
|
60503
|
+
}
|
|
60504
|
+
|
|
60213
60505
|
union Entity = User | Cat | Ghost
|
|
60214
60506
|
|
|
60215
60507
|
type Mutation {
|
|
@@ -60306,13 +60598,13 @@ function pipelineTest(config2, documents, shouldPass, testBody) {
|
|
|
60306
60598
|
await runPipeline2(config2, docs);
|
|
60307
60599
|
} catch (e) {
|
|
60308
60600
|
if (shouldPass) {
|
|
60309
|
-
|
|
60601
|
+
console.error(e);
|
|
60602
|
+
throw "pipeline failed when it should have passed";
|
|
60310
60603
|
}
|
|
60311
60604
|
error = e;
|
|
60312
60605
|
}
|
|
60313
60606
|
if (!shouldPass && error.length === 0) {
|
|
60314
|
-
throw "
|
|
60315
|
-
return;
|
|
60607
|
+
throw "pipeline shouldn't have passed!";
|
|
60316
60608
|
}
|
|
60317
60609
|
if (testBody) {
|
|
60318
60610
|
testBody(shouldPass ? docs : error);
|