houdini 1.2.44 → 1.2.45
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 +651 -844
- package/build/cmd-esm/index.js +501 -694
- package/build/codegen/generators/comments/jsdoc.d.ts +2 -0
- package/build/codegen-cjs/index.js +649 -842
- package/build/codegen-esm/index.js +499 -692
- package/build/lib/graphql.d.ts +1 -1
- package/build/lib/index.d.ts +1 -0
- package/build/lib/typescript.d.ts +19 -0
- package/build/lib-cjs/index.js +667 -464
- package/build/lib-esm/index.js +661 -464
- package/build/runtime/client/index.d.ts +7 -1
- package/build/runtime/client/plugins/fragment.d.ts +2 -2
- package/build/runtime/client/plugins/mutation.d.ts +2 -1
- package/build/runtime/client/plugins/query.d.ts +2 -2
- package/build/runtime/lib/scalars.d.ts +1 -1
- package/build/runtime/lib/types.d.ts +13 -2
- package/build/runtime/router/types.d.ts +3 -1
- package/build/runtime-cjs/client/index.d.ts +7 -1
- package/build/runtime-cjs/client/index.js +26 -11
- package/build/runtime-cjs/client/plugins/fragment.d.ts +2 -2
- package/build/runtime-cjs/client/plugins/fragment.js +4 -11
- package/build/runtime-cjs/client/plugins/mutation.d.ts +2 -1
- package/build/runtime-cjs/client/plugins/mutation.js +8 -15
- package/build/runtime-cjs/client/plugins/query.d.ts +2 -2
- package/build/runtime-cjs/client/plugins/query.js +4 -11
- package/build/runtime-cjs/lib/scalars.d.ts +1 -1
- package/build/runtime-cjs/lib/scalars.js +4 -0
- package/build/runtime-cjs/lib/types.d.ts +13 -2
- package/build/runtime-cjs/router/types.d.ts +3 -1
- package/build/runtime-esm/client/index.d.ts +7 -1
- package/build/runtime-esm/client/index.js +26 -11
- package/build/runtime-esm/client/plugins/fragment.d.ts +2 -2
- package/build/runtime-esm/client/plugins/fragment.js +1 -2
- package/build/runtime-esm/client/plugins/mutation.d.ts +2 -1
- package/build/runtime-esm/client/plugins/mutation.js +1 -2
- package/build/runtime-esm/client/plugins/query.d.ts +2 -2
- package/build/runtime-esm/client/plugins/query.js +1 -2
- package/build/runtime-esm/lib/scalars.d.ts +1 -1
- package/build/runtime-esm/lib/scalars.js +6 -0
- package/build/runtime-esm/lib/types.d.ts +13 -2
- package/build/runtime-esm/router/types.d.ts +3 -1
- package/build/test-cjs/index.js +664 -840
- package/build/test-esm/index.js +514 -690
- package/build/vite-cjs/index.js +761 -852
- package/build/vite-esm/index.js +611 -702
- package/package.json +1 -1
- package/build/codegen/generators/typescript/typeReference.d.ts +0 -8
- package/build/codegen/generators/typescript/types.d.ts +0 -10
package/build/test-esm/index.js
CHANGED
|
@@ -53825,10 +53825,10 @@ var require_lib6 = __commonJS({
|
|
|
53825
53825
|
|
|
53826
53826
|
// src/test/index.ts
|
|
53827
53827
|
var import_memfs2 = __toESM(require_lib(), 1);
|
|
53828
|
-
import * as
|
|
53828
|
+
import * as graphql33 from "graphql";
|
|
53829
53829
|
|
|
53830
53830
|
// src/codegen/index.ts
|
|
53831
|
-
import * as
|
|
53831
|
+
import * as graphql32 from "graphql";
|
|
53832
53832
|
|
|
53833
53833
|
// src/lib/pipeline.ts
|
|
53834
53834
|
async function runPipeline(config, pipeline, target) {
|
|
@@ -53972,47 +53972,6 @@ function deepMerge(...objects) {
|
|
|
53972
53972
|
return mergedObj;
|
|
53973
53973
|
}
|
|
53974
53974
|
|
|
53975
|
-
// src/runtime/lib/scalars.ts
|
|
53976
|
-
async function marshalSelection({
|
|
53977
|
-
selection,
|
|
53978
|
-
data
|
|
53979
|
-
}) {
|
|
53980
|
-
const config = getCurrentConfig();
|
|
53981
|
-
if (data === null || typeof data === "undefined") {
|
|
53982
|
-
return data;
|
|
53983
|
-
}
|
|
53984
|
-
if (Array.isArray(data)) {
|
|
53985
|
-
return await Promise.all(data.map((val) => marshalSelection({ selection, data: val })));
|
|
53986
|
-
}
|
|
53987
|
-
const targetSelection = getFieldsForType(selection, data["__typename"], false);
|
|
53988
|
-
return Object.fromEntries(
|
|
53989
|
-
await Promise.all(
|
|
53990
|
-
Object.entries(data).map(async ([fieldName, value]) => {
|
|
53991
|
-
const { type, selection: selection2 } = targetSelection[fieldName];
|
|
53992
|
-
if (!type) {
|
|
53993
|
-
return [fieldName, value];
|
|
53994
|
-
}
|
|
53995
|
-
if (selection2) {
|
|
53996
|
-
return [fieldName, await marshalSelection({ selection: selection2, data: value })];
|
|
53997
|
-
}
|
|
53998
|
-
if (config.scalars?.[type]) {
|
|
53999
|
-
const marshalFn = config.scalars[type].marshal;
|
|
54000
|
-
if (!marshalFn) {
|
|
54001
|
-
throw new Error(
|
|
54002
|
-
`scalar type ${type} is missing a \`marshal\` function. see https://github.com/AlecAivazis/houdini#%EF%B8%8Fcustom-scalars`
|
|
54003
|
-
);
|
|
54004
|
-
}
|
|
54005
|
-
if (Array.isArray(value)) {
|
|
54006
|
-
return [fieldName, value.map(marshalFn)];
|
|
54007
|
-
}
|
|
54008
|
-
return [fieldName, marshalFn(value)];
|
|
54009
|
-
}
|
|
54010
|
-
return [fieldName, value];
|
|
54011
|
-
})
|
|
54012
|
-
)
|
|
54013
|
-
);
|
|
54014
|
-
}
|
|
54015
|
-
|
|
54016
53975
|
// src/runtime/lib/types.ts
|
|
54017
53976
|
var CachePolicy = {
|
|
54018
53977
|
CacheOrNetwork: "CacheOrNetwork",
|
|
@@ -54040,11 +53999,6 @@ var RefetchUpdateMode = {
|
|
|
54040
53999
|
prepend: "prepend",
|
|
54041
54000
|
replace: "replace"
|
|
54042
54001
|
};
|
|
54043
|
-
var DataSource = {
|
|
54044
|
-
Cache: "cache",
|
|
54045
|
-
Network: "network",
|
|
54046
|
-
Ssr: "ssr"
|
|
54047
|
-
};
|
|
54048
54002
|
var fragmentKey = " $fragments";
|
|
54049
54003
|
var PendingValue = Symbol("houdini_loading");
|
|
54050
54004
|
|
|
@@ -56666,202 +56620,6 @@ var cache_default = new Cache();
|
|
|
56666
56620
|
// src/runtime/client/plugins/cache.ts
|
|
56667
56621
|
var serverSide = typeof globalThis.window === "undefined";
|
|
56668
56622
|
|
|
56669
|
-
// src/runtime/client/utils/documentPlugins.ts
|
|
56670
|
-
var documentPlugin = (kind, source) => {
|
|
56671
|
-
return () => {
|
|
56672
|
-
const sourceHandlers = source();
|
|
56673
|
-
const enterWrapper = (handler) => {
|
|
56674
|
-
return !handler ? void 0 : (ctx, handlers) => {
|
|
56675
|
-
if (ctx.artifact.kind !== kind) {
|
|
56676
|
-
return handlers.next(ctx);
|
|
56677
|
-
}
|
|
56678
|
-
return handler(ctx, handlers);
|
|
56679
|
-
};
|
|
56680
|
-
};
|
|
56681
|
-
const exitWrapper = (handler) => {
|
|
56682
|
-
return !handler ? void 0 : (ctx, handlers) => {
|
|
56683
|
-
if (ctx.artifact.kind !== kind) {
|
|
56684
|
-
return handlers.resolve(ctx);
|
|
56685
|
-
}
|
|
56686
|
-
return handler(ctx, handlers);
|
|
56687
|
-
};
|
|
56688
|
-
};
|
|
56689
|
-
return {
|
|
56690
|
-
start: enterWrapper(sourceHandlers.start),
|
|
56691
|
-
network: enterWrapper(sourceHandlers.network),
|
|
56692
|
-
afterNetwork: exitWrapper(sourceHandlers.afterNetwork),
|
|
56693
|
-
end: exitWrapper(sourceHandlers.end),
|
|
56694
|
-
catch: sourceHandlers.catch ? (ctx, handlers) => sourceHandlers.catch(ctx, handlers) : void 0,
|
|
56695
|
-
cleanup: (...args) => sourceHandlers.cleanup?.(...args)
|
|
56696
|
-
};
|
|
56697
|
-
};
|
|
56698
|
-
};
|
|
56699
|
-
|
|
56700
|
-
// src/runtime/client/plugins/query.ts
|
|
56701
|
-
var query = documentPlugin(ArtifactKind.Query, function() {
|
|
56702
|
-
let subscriptionSpec = null;
|
|
56703
|
-
let lastVariables = null;
|
|
56704
|
-
return {
|
|
56705
|
-
start(ctx, { next }) {
|
|
56706
|
-
const runtimeScalarPayload = {
|
|
56707
|
-
session: ctx.session
|
|
56708
|
-
};
|
|
56709
|
-
ctx.variables = {
|
|
56710
|
-
...lastVariables,
|
|
56711
|
-
...Object.fromEntries(
|
|
56712
|
-
Object.entries(ctx.artifact.input?.runtimeScalars ?? {}).map(
|
|
56713
|
-
([field, type]) => {
|
|
56714
|
-
const runtimeScalar = ctx.config.features?.runtimeScalars?.[type];
|
|
56715
|
-
if (!runtimeScalar) {
|
|
56716
|
-
return [field, type];
|
|
56717
|
-
}
|
|
56718
|
-
return [field, runtimeScalar.resolve(runtimeScalarPayload)];
|
|
56719
|
-
}
|
|
56720
|
-
)
|
|
56721
|
-
),
|
|
56722
|
-
...ctx.variables
|
|
56723
|
-
};
|
|
56724
|
-
next(ctx);
|
|
56725
|
-
},
|
|
56726
|
-
end(ctx, { resolve: resolve2, marshalVariables, variablesChanged }) {
|
|
56727
|
-
if (variablesChanged(ctx) && !ctx.cacheParams?.disableSubscriptions) {
|
|
56728
|
-
if (subscriptionSpec) {
|
|
56729
|
-
cache_default.unsubscribe(subscriptionSpec, subscriptionSpec.variables?.() || {});
|
|
56730
|
-
}
|
|
56731
|
-
lastVariables = { ...marshalVariables(ctx) };
|
|
56732
|
-
const variables = lastVariables;
|
|
56733
|
-
subscriptionSpec = {
|
|
56734
|
-
rootType: ctx.artifact.rootType,
|
|
56735
|
-
selection: ctx.artifact.selection,
|
|
56736
|
-
variables: () => variables,
|
|
56737
|
-
set: (newValue) => {
|
|
56738
|
-
resolve2(ctx, {
|
|
56739
|
-
data: newValue,
|
|
56740
|
-
errors: null,
|
|
56741
|
-
fetching: false,
|
|
56742
|
-
partial: false,
|
|
56743
|
-
stale: false,
|
|
56744
|
-
source: DataSource.Cache,
|
|
56745
|
-
variables: ctx.variables ?? {}
|
|
56746
|
-
});
|
|
56747
|
-
}
|
|
56748
|
-
};
|
|
56749
|
-
cache_default.subscribe(subscriptionSpec, lastVariables);
|
|
56750
|
-
}
|
|
56751
|
-
resolve2(ctx);
|
|
56752
|
-
},
|
|
56753
|
-
cleanup() {
|
|
56754
|
-
if (subscriptionSpec) {
|
|
56755
|
-
cache_default.unsubscribe(subscriptionSpec, subscriptionSpec.variables?.());
|
|
56756
|
-
lastVariables = null;
|
|
56757
|
-
}
|
|
56758
|
-
}
|
|
56759
|
-
};
|
|
56760
|
-
});
|
|
56761
|
-
|
|
56762
|
-
// src/runtime/client/plugins/fragment.ts
|
|
56763
|
-
var fragment = documentPlugin(ArtifactKind.Fragment, function() {
|
|
56764
|
-
let subscriptionSpec = null;
|
|
56765
|
-
let lastReference = null;
|
|
56766
|
-
return {
|
|
56767
|
-
start(ctx, { next, resolve: resolve2, variablesChanged, marshalVariables }) {
|
|
56768
|
-
if (!ctx.stuff.parentID) {
|
|
56769
|
-
return next(ctx);
|
|
56770
|
-
}
|
|
56771
|
-
const currentReference = {
|
|
56772
|
-
parent: ctx.stuff.parentID,
|
|
56773
|
-
variables: marshalVariables(ctx)
|
|
56774
|
-
};
|
|
56775
|
-
if (!ctx.cacheParams?.disableSubscriptions && (!deepEquals(lastReference, currentReference) || variablesChanged(ctx))) {
|
|
56776
|
-
if (subscriptionSpec) {
|
|
56777
|
-
cache_default.unsubscribe(subscriptionSpec, subscriptionSpec.variables?.() || {});
|
|
56778
|
-
}
|
|
56779
|
-
const variables = marshalVariables(ctx);
|
|
56780
|
-
subscriptionSpec = {
|
|
56781
|
-
rootType: ctx.artifact.rootType,
|
|
56782
|
-
selection: ctx.artifact.selection,
|
|
56783
|
-
variables: () => variables,
|
|
56784
|
-
parentID: ctx.stuff.parentID,
|
|
56785
|
-
set: (newValue) => {
|
|
56786
|
-
resolve2(ctx, {
|
|
56787
|
-
data: newValue,
|
|
56788
|
-
errors: null,
|
|
56789
|
-
fetching: false,
|
|
56790
|
-
partial: false,
|
|
56791
|
-
stale: false,
|
|
56792
|
-
source: DataSource.Cache,
|
|
56793
|
-
variables
|
|
56794
|
-
});
|
|
56795
|
-
}
|
|
56796
|
-
};
|
|
56797
|
-
cache_default.subscribe(subscriptionSpec, variables);
|
|
56798
|
-
lastReference = currentReference;
|
|
56799
|
-
}
|
|
56800
|
-
next(ctx);
|
|
56801
|
-
},
|
|
56802
|
-
cleanup() {
|
|
56803
|
-
if (subscriptionSpec) {
|
|
56804
|
-
cache_default.unsubscribe(subscriptionSpec, subscriptionSpec.variables?.());
|
|
56805
|
-
}
|
|
56806
|
-
}
|
|
56807
|
-
};
|
|
56808
|
-
});
|
|
56809
|
-
|
|
56810
|
-
// src/runtime/client/plugins/mutation.ts
|
|
56811
|
-
var mutation = documentPlugin(ArtifactKind.Mutation, () => {
|
|
56812
|
-
return {
|
|
56813
|
-
async start(ctx, { next, marshalVariables }) {
|
|
56814
|
-
const layerOptimistic = cache_default._internal_unstable.storage.createLayer(true);
|
|
56815
|
-
const optimisticResponse = ctx.stuff.optimisticResponse;
|
|
56816
|
-
let toNotify = [];
|
|
56817
|
-
if (optimisticResponse) {
|
|
56818
|
-
toNotify = cache_default.write({
|
|
56819
|
-
selection: ctx.artifact.selection,
|
|
56820
|
-
data: await marshalSelection({
|
|
56821
|
-
selection: ctx.artifact.selection,
|
|
56822
|
-
data: optimisticResponse
|
|
56823
|
-
}),
|
|
56824
|
-
variables: marshalVariables(ctx),
|
|
56825
|
-
layer: layerOptimistic.id
|
|
56826
|
-
});
|
|
56827
|
-
}
|
|
56828
|
-
ctx.cacheParams = {
|
|
56829
|
-
...ctx.cacheParams,
|
|
56830
|
-
layer: layerOptimistic,
|
|
56831
|
-
notifySubscribers: toNotify,
|
|
56832
|
-
forceNotify: true
|
|
56833
|
-
};
|
|
56834
|
-
next(ctx);
|
|
56835
|
-
},
|
|
56836
|
-
afterNetwork(ctx, { resolve: resolve2 }) {
|
|
56837
|
-
if (ctx.cacheParams?.layer) {
|
|
56838
|
-
cache_default.clearLayer(ctx.cacheParams.layer.id);
|
|
56839
|
-
}
|
|
56840
|
-
resolve2(ctx);
|
|
56841
|
-
},
|
|
56842
|
-
end(ctx, { resolve: resolve2, value }) {
|
|
56843
|
-
const hasErrors = value.errors && value.errors.length > 0;
|
|
56844
|
-
if (hasErrors) {
|
|
56845
|
-
if (ctx.cacheParams?.layer) {
|
|
56846
|
-
cache_default.clearLayer(ctx.cacheParams.layer.id);
|
|
56847
|
-
}
|
|
56848
|
-
}
|
|
56849
|
-
if (ctx.cacheParams?.layer) {
|
|
56850
|
-
cache_default._internal_unstable.storage.resolveLayer(ctx.cacheParams.layer.id);
|
|
56851
|
-
}
|
|
56852
|
-
resolve2(ctx);
|
|
56853
|
-
},
|
|
56854
|
-
catch(ctx, { error }) {
|
|
56855
|
-
if (ctx.cacheParams?.layer) {
|
|
56856
|
-
const { layer } = ctx.cacheParams;
|
|
56857
|
-
cache_default.clearLayer(layer.id);
|
|
56858
|
-
cache_default._internal_unstable.storage.resolveLayer(layer.id);
|
|
56859
|
-
}
|
|
56860
|
-
throw error;
|
|
56861
|
-
}
|
|
56862
|
-
};
|
|
56863
|
-
});
|
|
56864
|
-
|
|
56865
56623
|
// src/lib/types.ts
|
|
56866
56624
|
var LogLevel = {
|
|
56867
56625
|
Full: "full",
|
|
@@ -57636,7 +57394,7 @@ function definitionFromAncestors(ancestors) {
|
|
|
57636
57394
|
}
|
|
57637
57395
|
return { parents, definition };
|
|
57638
57396
|
}
|
|
57639
|
-
function unwrapType(config, type, wrappers = []) {
|
|
57397
|
+
function unwrapType(config, type, wrappers = [], convertRuntimeScalars) {
|
|
57640
57398
|
if (type.kind === "NonNullType") {
|
|
57641
57399
|
return unwrapType(config, type.type, [TypeWrapper.NonNull, ...wrappers]);
|
|
57642
57400
|
}
|
|
@@ -57652,6 +57410,11 @@ function unwrapType(config, type, wrappers = []) {
|
|
|
57652
57410
|
if (type instanceof graphql3.GraphQLList) {
|
|
57653
57411
|
return unwrapType(config, type.ofType, [TypeWrapper.List, ...wrappers]);
|
|
57654
57412
|
}
|
|
57413
|
+
if (convertRuntimeScalars && config.configFile.features?.runtimeScalars?.[type.name.value]) {
|
|
57414
|
+
type = config.schema.getType(
|
|
57415
|
+
config.configFile.features?.runtimeScalars?.[type.name.value].type
|
|
57416
|
+
);
|
|
57417
|
+
}
|
|
57655
57418
|
const namedType = config.schema.getType(type.name.value || type.name);
|
|
57656
57419
|
if (!namedType) {
|
|
57657
57420
|
throw new Error("Unknown type: " + type.name.value || type.name);
|
|
@@ -57791,16 +57554,162 @@ async function cleanupFiles(pathFolder, listOfObj) {
|
|
|
57791
57554
|
return allFilesNotInList;
|
|
57792
57555
|
}
|
|
57793
57556
|
|
|
57794
|
-
// src/lib/
|
|
57557
|
+
// src/lib/typescript.ts
|
|
57558
|
+
var recast2 = __toESM(require_main2(), 1);
|
|
57795
57559
|
import * as graphql4 from "graphql";
|
|
57560
|
+
var AST2 = recast2.types.builders;
|
|
57561
|
+
function unwrappedTsTypeReference(config, filepath, missingScalars, {
|
|
57562
|
+
type,
|
|
57563
|
+
wrappers
|
|
57564
|
+
}, body) {
|
|
57565
|
+
let result;
|
|
57566
|
+
if (graphql4.isScalarType(type)) {
|
|
57567
|
+
result = scalarPropertyValue(config, filepath, missingScalars, type, body, null);
|
|
57568
|
+
} else if (graphql4.isEnumType(type)) {
|
|
57569
|
+
result = enumReference(config, body, type.name);
|
|
57570
|
+
} else {
|
|
57571
|
+
result = AST2.tsTypeReference(AST2.identifier(type.name));
|
|
57572
|
+
}
|
|
57573
|
+
for (const toWrap of wrappers) {
|
|
57574
|
+
if (toWrap === "NonNull" /* NonNull */) {
|
|
57575
|
+
continue;
|
|
57576
|
+
} else if (toWrap === "Nullable" /* Nullable */) {
|
|
57577
|
+
result = nullableField(result, true);
|
|
57578
|
+
} else if (toWrap === "List" /* List */) {
|
|
57579
|
+
result = AST2.tsArrayType(AST2.tsParenthesizedType(result));
|
|
57580
|
+
}
|
|
57581
|
+
}
|
|
57582
|
+
return result;
|
|
57583
|
+
}
|
|
57584
|
+
function tsTypeReference(config, filepath, missingScalars, definition, body) {
|
|
57585
|
+
const { type, wrappers } = unwrapType(config, definition.type);
|
|
57586
|
+
return unwrappedTsTypeReference(
|
|
57587
|
+
config,
|
|
57588
|
+
filepath,
|
|
57589
|
+
missingScalars,
|
|
57590
|
+
{ type, wrappers },
|
|
57591
|
+
body
|
|
57592
|
+
);
|
|
57593
|
+
}
|
|
57594
|
+
function enumReference(config, body, name) {
|
|
57595
|
+
ensureImports({
|
|
57596
|
+
config,
|
|
57597
|
+
body,
|
|
57598
|
+
import: ["ValueOf"],
|
|
57599
|
+
importKind: "type",
|
|
57600
|
+
sourceModule: "$houdini/runtime/lib/types"
|
|
57601
|
+
});
|
|
57602
|
+
return AST2.tsTypeReference(
|
|
57603
|
+
AST2.identifier("ValueOf"),
|
|
57604
|
+
AST2.tsTypeParameterInstantiation([AST2.tsTypeQuery(AST2.identifier(name))])
|
|
57605
|
+
);
|
|
57606
|
+
}
|
|
57607
|
+
function readonlyProperty(prop, enable = true) {
|
|
57608
|
+
if (enable) {
|
|
57609
|
+
prop.readonly = true;
|
|
57610
|
+
}
|
|
57611
|
+
return prop;
|
|
57612
|
+
}
|
|
57613
|
+
function nullableField(inner, input = false) {
|
|
57614
|
+
const members = [inner, AST2.tsNullKeyword()];
|
|
57615
|
+
if (input) {
|
|
57616
|
+
members.push(AST2.tsUndefinedKeyword());
|
|
57617
|
+
}
|
|
57618
|
+
return AST2.tsUnionType(members);
|
|
57619
|
+
}
|
|
57620
|
+
function scalarPropertyValue(config, filepath, missingScalars, target, body, field) {
|
|
57621
|
+
if (config.configFile.features?.componentFields && target.name === config.componentScalar) {
|
|
57622
|
+
if (!field) {
|
|
57623
|
+
return AST2.tsNeverKeyword();
|
|
57624
|
+
}
|
|
57625
|
+
const component = config.componentFields[field.parent][field.field];
|
|
57626
|
+
const sourcePathRelative = path_exports.relative(
|
|
57627
|
+
path_exports.join(config.projectRoot, "src"),
|
|
57628
|
+
component.filepath
|
|
57629
|
+
);
|
|
57630
|
+
let sourcePathParsed = path_exports.parse(sourcePathRelative);
|
|
57631
|
+
let sourcePath = path_exports.join(sourcePathParsed.dir, sourcePathParsed.name);
|
|
57632
|
+
const localImport = ensureImports({
|
|
57633
|
+
config,
|
|
57634
|
+
body,
|
|
57635
|
+
import: "__component__" + component.fragment,
|
|
57636
|
+
sourceModule: path_exports.join(
|
|
57637
|
+
path_exports.relative(path_exports.dirname(filepath), config.projectRoot),
|
|
57638
|
+
"src",
|
|
57639
|
+
sourcePath
|
|
57640
|
+
)
|
|
57641
|
+
}) ?? "__component__" + component.fragment;
|
|
57642
|
+
const parameters = AST2.tsTypeReference(AST2.identifier("Parameters"));
|
|
57643
|
+
parameters.typeParameters = AST2.tsTypeParameterInstantiation([
|
|
57644
|
+
AST2.tsTypeQuery(AST2.identifier(localImport))
|
|
57645
|
+
]);
|
|
57646
|
+
const indexed = AST2.tsIndexedAccessType(
|
|
57647
|
+
parameters,
|
|
57648
|
+
AST2.tsLiteralType(AST2.numericLiteral(0))
|
|
57649
|
+
);
|
|
57650
|
+
const omit = AST2.tsTypeReference(AST2.identifier("Omit"));
|
|
57651
|
+
omit.typeParameters = AST2.tsTypeParameterInstantiation([
|
|
57652
|
+
indexed,
|
|
57653
|
+
AST2.tsLiteralType(AST2.stringLiteral(component.prop))
|
|
57654
|
+
]);
|
|
57655
|
+
const arg = AST2.identifier("props");
|
|
57656
|
+
arg.typeAnnotation = AST2.tsTypeAnnotation(omit);
|
|
57657
|
+
const returnType = AST2.tsTypeReference(AST2.identifier("ReturnType"));
|
|
57658
|
+
returnType.typeParameters = AST2.tsTypeParameterInstantiation([
|
|
57659
|
+
AST2.tsTypeQuery(AST2.identifier(localImport))
|
|
57660
|
+
]);
|
|
57661
|
+
const fnType = AST2.tsFunctionType([arg]);
|
|
57662
|
+
fnType.typeAnnotation = AST2.tsTypeAnnotation(returnType);
|
|
57663
|
+
return fnType;
|
|
57664
|
+
}
|
|
57665
|
+
switch (target.name) {
|
|
57666
|
+
case "String": {
|
|
57667
|
+
return AST2.tsStringKeyword();
|
|
57668
|
+
}
|
|
57669
|
+
case "Int": {
|
|
57670
|
+
return AST2.tsNumberKeyword();
|
|
57671
|
+
}
|
|
57672
|
+
case "Float": {
|
|
57673
|
+
return AST2.tsNumberKeyword();
|
|
57674
|
+
}
|
|
57675
|
+
case "Boolean": {
|
|
57676
|
+
return AST2.tsBooleanKeyword();
|
|
57677
|
+
}
|
|
57678
|
+
case "ID": {
|
|
57679
|
+
return AST2.tsStringKeyword();
|
|
57680
|
+
}
|
|
57681
|
+
default: {
|
|
57682
|
+
if (graphql4.isNonNullType(target) && "ofType" in target) {
|
|
57683
|
+
return scalarPropertyValue(
|
|
57684
|
+
config,
|
|
57685
|
+
filepath,
|
|
57686
|
+
missingScalars,
|
|
57687
|
+
target.ofType,
|
|
57688
|
+
body,
|
|
57689
|
+
field
|
|
57690
|
+
);
|
|
57691
|
+
}
|
|
57692
|
+
if (config.scalars?.[target.name]) {
|
|
57693
|
+
return AST2.tsTypeReference(AST2.identifier(config.scalars?.[target.name].type));
|
|
57694
|
+
}
|
|
57695
|
+
if (target.name !== config.componentScalar) {
|
|
57696
|
+
missingScalars.add(target.name);
|
|
57697
|
+
}
|
|
57698
|
+
return AST2.tsAnyKeyword();
|
|
57699
|
+
}
|
|
57700
|
+
}
|
|
57701
|
+
}
|
|
57702
|
+
|
|
57703
|
+
// src/lib/walk.ts
|
|
57704
|
+
import * as graphql5 from "graphql";
|
|
57796
57705
|
|
|
57797
57706
|
// src/lib/router/manifest.ts
|
|
57798
57707
|
var t = __toESM(require_lib6(), 1);
|
|
57799
|
-
import * as
|
|
57708
|
+
import * as graphql6 from "graphql";
|
|
57800
57709
|
|
|
57801
57710
|
// src/codegen/generators/artifacts/index.ts
|
|
57802
|
-
var
|
|
57803
|
-
import * as
|
|
57711
|
+
var recast5 = __toESM(require_main2(), 1);
|
|
57712
|
+
import * as graphql17 from "graphql";
|
|
57804
57713
|
|
|
57805
57714
|
// src/codegen/utils/commonjs.ts
|
|
57806
57715
|
var cjsIndexFilePreamble = `"use strict";
|
|
@@ -58042,19 +57951,19 @@ var FieldCollection = class {
|
|
|
58042
57951
|
};
|
|
58043
57952
|
|
|
58044
57953
|
// src/codegen/utils/moduleExport.ts
|
|
58045
|
-
var
|
|
58046
|
-
var
|
|
57954
|
+
var recast3 = __toESM(require_main2(), 1);
|
|
57955
|
+
var AST3 = recast3.types.builders;
|
|
58047
57956
|
function moduleExport(config, key, value) {
|
|
58048
57957
|
if (config.module === "commonjs") {
|
|
58049
|
-
let target =
|
|
57958
|
+
let target = AST3.memberExpression(AST3.identifier("module"), AST3.identifier("exports"));
|
|
58050
57959
|
if (key !== "default") {
|
|
58051
|
-
target =
|
|
57960
|
+
target = AST3.memberExpression(target, AST3.identifier(key));
|
|
58052
57961
|
}
|
|
58053
|
-
return
|
|
57962
|
+
return AST3.expressionStatement(AST3.assignmentExpression("=", target, value));
|
|
58054
57963
|
}
|
|
58055
|
-
return key === "default" ?
|
|
58056
|
-
|
|
58057
|
-
|
|
57964
|
+
return key === "default" ? AST3.exportDefaultDeclaration(value) : AST3.exportNamedDeclaration(
|
|
57965
|
+
AST3.variableDeclaration("const", [
|
|
57966
|
+
AST3.variableDeclarator(AST3.identifier(key), value)
|
|
58058
57967
|
])
|
|
58059
57968
|
);
|
|
58060
57969
|
}
|
|
@@ -58311,7 +58220,7 @@ var serialize = (value, { json, lossy } = {}) => {
|
|
|
58311
58220
|
var esm_default = typeof structuredClone === "function" ? (any, options) => options && ("json" in options || "lossy" in options) ? deserialize(serialize(any, options)) : structuredClone(any) : (any, options) => deserialize(serialize(any, options));
|
|
58312
58221
|
|
|
58313
58222
|
// src/codegen/transforms/fragmentVariables.ts
|
|
58314
|
-
import * as
|
|
58223
|
+
import * as graphql8 from "graphql";
|
|
58315
58224
|
|
|
58316
58225
|
// src/codegen/utils/stripLoc.ts
|
|
58317
58226
|
function stripLoc(value) {
|
|
@@ -58332,7 +58241,7 @@ function stripLoc(value) {
|
|
|
58332
58241
|
}
|
|
58333
58242
|
|
|
58334
58243
|
// src/codegen/transforms/collectDefinitions.ts
|
|
58335
|
-
import * as
|
|
58244
|
+
import * as graphql7 from "graphql";
|
|
58336
58245
|
import { Kind as GraphqlKinds } from "graphql";
|
|
58337
58246
|
async function includeFragmentDefinitions(config, documents) {
|
|
58338
58247
|
const fragments = collectDefinitions(config, documents);
|
|
@@ -58382,10 +58291,10 @@ function collectDefinitions(config, docs) {
|
|
|
58382
58291
|
}
|
|
58383
58292
|
function findRequiredFragments(config, definition) {
|
|
58384
58293
|
const referencedFragments = [];
|
|
58385
|
-
const typeInfo = new
|
|
58386
|
-
definition.selectionSet =
|
|
58294
|
+
const typeInfo = new graphql7.TypeInfo(config.schema);
|
|
58295
|
+
definition.selectionSet = graphql7.visit(
|
|
58387
58296
|
definition,
|
|
58388
|
-
|
|
58297
|
+
graphql7.visitWithTypeInfo(typeInfo, {
|
|
58389
58298
|
FragmentSpread(node) {
|
|
58390
58299
|
referencedFragments.push(node.name.value);
|
|
58391
58300
|
}
|
|
@@ -58419,7 +58328,7 @@ function flattenFragments(filepath, operation, fragments) {
|
|
|
58419
58328
|
}
|
|
58420
58329
|
|
|
58421
58330
|
// src/codegen/transforms/fragmentVariables.ts
|
|
58422
|
-
var GraphqlKinds2 =
|
|
58331
|
+
var GraphqlKinds2 = graphql8.Kind;
|
|
58423
58332
|
async function fragmentVariables(config, documents) {
|
|
58424
58333
|
const fragments = collectDefinitions(config, documents);
|
|
58425
58334
|
const generatedFragments = {};
|
|
@@ -58442,7 +58351,7 @@ async function fragmentVariables(config, documents) {
|
|
|
58442
58351
|
});
|
|
58443
58352
|
}
|
|
58444
58353
|
const doc = {
|
|
58445
|
-
kind:
|
|
58354
|
+
kind: graphql8.Kind.DOCUMENT,
|
|
58446
58355
|
definitions: Object.values(generatedFragments)
|
|
58447
58356
|
};
|
|
58448
58357
|
documents.push({
|
|
@@ -58513,7 +58422,7 @@ function inlineFragmentArgs({
|
|
|
58513
58422
|
return null;
|
|
58514
58423
|
};
|
|
58515
58424
|
const result = esm_default(
|
|
58516
|
-
|
|
58425
|
+
graphql8.visit(document, {
|
|
58517
58426
|
FragmentSpread(node) {
|
|
58518
58427
|
if (!fragmentDefinitions[node.name.value]) {
|
|
58519
58428
|
throw new Error("Could not find definition for fragment" + node.name.value);
|
|
@@ -58599,7 +58508,7 @@ function inlineFragmentArgs({
|
|
|
58599
58508
|
);
|
|
58600
58509
|
if (newName) {
|
|
58601
58510
|
result.name = {
|
|
58602
|
-
kind:
|
|
58511
|
+
kind: graphql8.Kind.NAME,
|
|
58603
58512
|
value: newName
|
|
58604
58513
|
};
|
|
58605
58514
|
}
|
|
@@ -58766,7 +58675,7 @@ ${exportDefaultFrom(`./${doc.name}`, doc.name)}`,
|
|
|
58766
58675
|
}
|
|
58767
58676
|
|
|
58768
58677
|
// src/codegen/generators/artifacts/inputs.ts
|
|
58769
|
-
import * as
|
|
58678
|
+
import * as graphql9 from "graphql";
|
|
58770
58679
|
function inputObject(config, inputs, runtimeScalars) {
|
|
58771
58680
|
const visitedTypes = /* @__PURE__ */ new Set();
|
|
58772
58681
|
const inputObj = {
|
|
@@ -58796,10 +58705,10 @@ function walkInputs(config, visitedTypes, inputObj, rootType) {
|
|
|
58796
58705
|
if (visitedTypes.has(type.name)) {
|
|
58797
58706
|
return;
|
|
58798
58707
|
}
|
|
58799
|
-
if (
|
|
58708
|
+
if (graphql9.isEnumType(type) || graphql9.isScalarType(type)) {
|
|
58800
58709
|
return;
|
|
58801
58710
|
}
|
|
58802
|
-
if (
|
|
58711
|
+
if (graphql9.isUnionType(type)) {
|
|
58803
58712
|
return;
|
|
58804
58713
|
}
|
|
58805
58714
|
visitedTypes.add(type.name);
|
|
@@ -58817,50 +58726,50 @@ function walkInputs(config, visitedTypes, inputObj, rootType) {
|
|
|
58817
58726
|
}
|
|
58818
58727
|
|
|
58819
58728
|
// src/codegen/generators/artifacts/operations.ts
|
|
58820
|
-
import * as
|
|
58729
|
+
import * as graphql11 from "graphql";
|
|
58821
58730
|
|
|
58822
58731
|
// src/codegen/generators/artifacts/utils.ts
|
|
58823
|
-
var
|
|
58824
|
-
import * as
|
|
58825
|
-
var
|
|
58732
|
+
var recast4 = __toESM(require_main2(), 1);
|
|
58733
|
+
import * as graphql10 from "graphql";
|
|
58734
|
+
var AST4 = recast4.types.builders;
|
|
58826
58735
|
function serializeValue(value) {
|
|
58827
58736
|
if (Array.isArray(value)) {
|
|
58828
|
-
return
|
|
58737
|
+
return AST4.arrayExpression(value.map(serializeValue));
|
|
58829
58738
|
}
|
|
58830
58739
|
if (typeof value === "object" && value !== null) {
|
|
58831
|
-
return
|
|
58740
|
+
return AST4.objectExpression(
|
|
58832
58741
|
Object.entries(value).filter(([key, value2]) => typeof value2 !== "undefined").map(([key, val]) => {
|
|
58833
|
-
return
|
|
58742
|
+
return AST4.objectProperty(AST4.stringLiteral(key), serializeValue(val));
|
|
58834
58743
|
})
|
|
58835
58744
|
);
|
|
58836
58745
|
}
|
|
58837
58746
|
if (typeof value === "string") {
|
|
58838
58747
|
if (value.indexOf("\n") !== -1) {
|
|
58839
|
-
return
|
|
58840
|
-
[
|
|
58748
|
+
return AST4.templateLiteral(
|
|
58749
|
+
[AST4.templateElement({ raw: value, cooked: value }, true)],
|
|
58841
58750
|
[]
|
|
58842
58751
|
);
|
|
58843
58752
|
}
|
|
58844
|
-
return
|
|
58753
|
+
return AST4.stringLiteral(value);
|
|
58845
58754
|
}
|
|
58846
|
-
return
|
|
58755
|
+
return AST4.literal(value);
|
|
58847
58756
|
}
|
|
58848
58757
|
function convertValue(config, val) {
|
|
58849
58758
|
let value;
|
|
58850
58759
|
let kind;
|
|
58851
|
-
if (val.kind ===
|
|
58760
|
+
if (val.kind === graphql10.Kind.INT) {
|
|
58852
58761
|
value = parseInt(val.value, 10);
|
|
58853
58762
|
kind = "Int";
|
|
58854
|
-
} else if (val.kind ===
|
|
58763
|
+
} else if (val.kind === graphql10.Kind.FLOAT) {
|
|
58855
58764
|
value = parseFloat(val.value);
|
|
58856
58765
|
kind = "Float";
|
|
58857
|
-
} else if (val.kind ===
|
|
58766
|
+
} else if (val.kind === graphql10.Kind.BOOLEAN) {
|
|
58858
58767
|
value = val.value;
|
|
58859
58768
|
kind = "Boolean";
|
|
58860
|
-
} else if (val.kind ===
|
|
58769
|
+
} else if (val.kind === graphql10.Kind.VARIABLE) {
|
|
58861
58770
|
value = val.name.value;
|
|
58862
58771
|
kind = "Variable";
|
|
58863
|
-
} else if (val.kind ===
|
|
58772
|
+
} else if (val.kind === graphql10.Kind.STRING) {
|
|
58864
58773
|
value = val.value;
|
|
58865
58774
|
kind = "String";
|
|
58866
58775
|
}
|
|
@@ -58873,7 +58782,7 @@ function operationsByPath(config, filepath, definition, filterTypes) {
|
|
|
58873
58782
|
return {};
|
|
58874
58783
|
}
|
|
58875
58784
|
const pathOperations = {};
|
|
58876
|
-
|
|
58785
|
+
graphql11.visit(definition, {
|
|
58877
58786
|
FragmentSpread(node, _, __, ___, ancestors) {
|
|
58878
58787
|
if (!config.isListFragment(node.name.value)) {
|
|
58879
58788
|
return;
|
|
@@ -59032,19 +58941,19 @@ function ancestorKey(ancestors) {
|
|
|
59032
58941
|
}
|
|
59033
58942
|
|
|
59034
58943
|
// src/codegen/generators/artifacts/selection.ts
|
|
59035
|
-
import * as
|
|
58944
|
+
import * as graphql16 from "graphql";
|
|
59036
58945
|
|
|
59037
58946
|
// src/codegen/transforms/list.ts
|
|
59038
|
-
import * as
|
|
58947
|
+
import * as graphql14 from "graphql";
|
|
59039
58948
|
|
|
59040
58949
|
// src/codegen/utils/objectIdentificationSelection.ts
|
|
59041
|
-
import * as
|
|
58950
|
+
import * as graphql12 from "graphql";
|
|
59042
58951
|
var objectIdentificationSelection = (config, type) => {
|
|
59043
58952
|
return config.keyFieldsForType(type.name).map((key) => {
|
|
59044
58953
|
return {
|
|
59045
|
-
kind:
|
|
58954
|
+
kind: graphql12.Kind.FIELD,
|
|
59046
58955
|
name: {
|
|
59047
|
-
kind:
|
|
58956
|
+
kind: graphql12.Kind.NAME,
|
|
59048
58957
|
value: key
|
|
59049
58958
|
}
|
|
59050
58959
|
};
|
|
@@ -59052,7 +58961,7 @@ var objectIdentificationSelection = (config, type) => {
|
|
|
59052
58961
|
};
|
|
59053
58962
|
|
|
59054
58963
|
// src/codegen/transforms/paginate.ts
|
|
59055
|
-
import * as
|
|
58964
|
+
import * as graphql13 from "graphql";
|
|
59056
58965
|
async function paginate(config, documents) {
|
|
59057
58966
|
const newDocs = [];
|
|
59058
58967
|
for (const doc of documents) {
|
|
@@ -59085,7 +58994,7 @@ async function paginate(config, documents) {
|
|
|
59085
58994
|
};
|
|
59086
58995
|
let cursorType = "String";
|
|
59087
58996
|
let paginationPath = [];
|
|
59088
|
-
doc.document =
|
|
58997
|
+
doc.document = graphql13.visit(doc.document, {
|
|
59089
58998
|
Field(node, _, __, ___, ancestors) {
|
|
59090
58999
|
const paginateDirective = node.directives?.find(
|
|
59091
59000
|
(directive) => directive.name.value === config.paginateDirective
|
|
@@ -59111,7 +59020,7 @@ async function paginate(config, documents) {
|
|
|
59111
59020
|
flags.offset.enabled = offsetPagination;
|
|
59112
59021
|
flags.limit.enabled = offsetPagination;
|
|
59113
59022
|
paginationPath = ancestors.filter(
|
|
59114
|
-
(ancestor) => !Array.isArray(ancestor) && ancestor.kind ===
|
|
59023
|
+
(ancestor) => !Array.isArray(ancestor) && ancestor.kind === graphql13.Kind.FIELD
|
|
59115
59024
|
).concat(node).map((field) => field.alias?.value || field.name.value);
|
|
59116
59025
|
return {
|
|
59117
59026
|
...node,
|
|
@@ -59130,7 +59039,7 @@ async function paginate(config, documents) {
|
|
|
59130
59039
|
let fragment2 = "";
|
|
59131
59040
|
let paginateMode = config.defaultPaginateMode;
|
|
59132
59041
|
const requiredArgs = [];
|
|
59133
|
-
doc.document =
|
|
59042
|
+
doc.document = graphql13.visit(doc.document, {
|
|
59134
59043
|
OperationDefinition(node) {
|
|
59135
59044
|
if (node.operation !== "query") {
|
|
59136
59045
|
throw new HoudiniError({
|
|
@@ -59189,9 +59098,9 @@ async function paginate(config, documents) {
|
|
|
59189
59098
|
directives: [
|
|
59190
59099
|
...node.directives || [],
|
|
59191
59100
|
{
|
|
59192
|
-
kind:
|
|
59101
|
+
kind: graphql13.Kind.DIRECTIVE,
|
|
59193
59102
|
name: {
|
|
59194
|
-
kind:
|
|
59103
|
+
kind: graphql13.Kind.NAME,
|
|
59195
59104
|
value: config.argumentsDirective
|
|
59196
59105
|
}
|
|
59197
59106
|
}
|
|
@@ -59261,22 +59170,22 @@ async function paginate(config, documents) {
|
|
|
59261
59170
|
const paginationArgs = Object.entries(flags).filter(([_, { enabled }]) => enabled).map(([key, value]) => ({ name: key, ...value }));
|
|
59262
59171
|
const fragmentSpreadSelection = [
|
|
59263
59172
|
{
|
|
59264
|
-
kind:
|
|
59173
|
+
kind: graphql13.Kind.FRAGMENT_SPREAD,
|
|
59265
59174
|
name: {
|
|
59266
|
-
kind:
|
|
59175
|
+
kind: graphql13.Kind.NAME,
|
|
59267
59176
|
value: fragmentName
|
|
59268
59177
|
},
|
|
59269
59178
|
directives: [
|
|
59270
59179
|
{
|
|
59271
|
-
kind:
|
|
59180
|
+
kind: graphql13.Kind.DIRECTIVE,
|
|
59272
59181
|
name: {
|
|
59273
|
-
kind:
|
|
59182
|
+
kind: graphql13.Kind.NAME,
|
|
59274
59183
|
value: config.withDirective
|
|
59275
59184
|
},
|
|
59276
59185
|
["arguments"]: requiredArgs.map((arg) => variableAsArgument(arg.name)).concat(paginationArgs.map(({ name }) => variableAsArgument(name)))
|
|
59277
59186
|
},
|
|
59278
59187
|
{
|
|
59279
|
-
kind:
|
|
59188
|
+
kind: graphql13.Kind.DIRECTIVE,
|
|
59280
59189
|
name: {
|
|
59281
59190
|
kind: "Name",
|
|
59282
59191
|
value: config.maskDisableDirective
|
|
@@ -59303,23 +59212,23 @@ async function paginate(config, documents) {
|
|
|
59303
59212
|
});
|
|
59304
59213
|
const typeConfig = config.typeConfig?.[fragment2];
|
|
59305
59214
|
const queryDoc = {
|
|
59306
|
-
kind:
|
|
59215
|
+
kind: graphql13.Kind.DOCUMENT,
|
|
59307
59216
|
definitions: [
|
|
59308
59217
|
{
|
|
59309
|
-
kind:
|
|
59218
|
+
kind: graphql13.Kind.OPERATION_DEFINITION,
|
|
59310
59219
|
name: {
|
|
59311
|
-
kind:
|
|
59220
|
+
kind: graphql13.Kind.NAME,
|
|
59312
59221
|
value: refetchQueryName
|
|
59313
59222
|
},
|
|
59314
59223
|
operation: "query",
|
|
59315
59224
|
variableDefinitions: requiredArgs.map(
|
|
59316
59225
|
(arg) => ({
|
|
59317
|
-
kind:
|
|
59226
|
+
kind: graphql13.Kind.VARIABLE_DEFINITION,
|
|
59318
59227
|
type: arg.type,
|
|
59319
59228
|
variable: {
|
|
59320
|
-
kind:
|
|
59229
|
+
kind: graphql13.Kind.VARIABLE,
|
|
59321
59230
|
name: {
|
|
59322
|
-
kind:
|
|
59231
|
+
kind: graphql13.Kind.NAME,
|
|
59323
59232
|
value: arg.name
|
|
59324
59233
|
}
|
|
59325
59234
|
}
|
|
@@ -59327,18 +59236,18 @@ async function paginate(config, documents) {
|
|
|
59327
59236
|
).concat(
|
|
59328
59237
|
paginationArgs.map(
|
|
59329
59238
|
(arg) => ({
|
|
59330
|
-
kind:
|
|
59239
|
+
kind: graphql13.Kind.VARIABLE_DEFINITION,
|
|
59331
59240
|
type: {
|
|
59332
|
-
kind:
|
|
59241
|
+
kind: graphql13.Kind.NAMED_TYPE,
|
|
59333
59242
|
name: {
|
|
59334
|
-
kind:
|
|
59243
|
+
kind: graphql13.Kind.NAME,
|
|
59335
59244
|
value: arg.type
|
|
59336
59245
|
}
|
|
59337
59246
|
},
|
|
59338
59247
|
variable: {
|
|
59339
|
-
kind:
|
|
59248
|
+
kind: graphql13.Kind.VARIABLE,
|
|
59340
59249
|
name: {
|
|
59341
|
-
kind:
|
|
59250
|
+
kind: graphql13.Kind.NAME,
|
|
59342
59251
|
value: arg.name
|
|
59343
59252
|
}
|
|
59344
59253
|
},
|
|
@@ -59350,12 +59259,12 @@ async function paginate(config, documents) {
|
|
|
59350
59259
|
).concat(
|
|
59351
59260
|
!nodeQuery ? [] : keys2.map(
|
|
59352
59261
|
(key) => ({
|
|
59353
|
-
kind:
|
|
59262
|
+
kind: graphql13.Kind.VARIABLE_DEFINITION,
|
|
59354
59263
|
type: key.type,
|
|
59355
59264
|
variable: {
|
|
59356
|
-
kind:
|
|
59265
|
+
kind: graphql13.Kind.VARIABLE,
|
|
59357
59266
|
name: {
|
|
59358
|
-
kind:
|
|
59267
|
+
kind: graphql13.Kind.NAME,
|
|
59359
59268
|
value: key.name
|
|
59360
59269
|
}
|
|
59361
59270
|
}
|
|
@@ -59364,42 +59273,42 @@ async function paginate(config, documents) {
|
|
|
59364
59273
|
)
|
|
59365
59274
|
),
|
|
59366
59275
|
selectionSet: {
|
|
59367
|
-
kind:
|
|
59276
|
+
kind: graphql13.Kind.SELECTION_SET,
|
|
59368
59277
|
selections: !nodeQuery ? fragmentSpreadSelection : [
|
|
59369
59278
|
{
|
|
59370
|
-
kind:
|
|
59279
|
+
kind: graphql13.Kind.FIELD,
|
|
59371
59280
|
name: {
|
|
59372
|
-
kind:
|
|
59281
|
+
kind: graphql13.Kind.NAME,
|
|
59373
59282
|
value: typeConfig?.resolve?.queryField || "node"
|
|
59374
59283
|
},
|
|
59375
59284
|
["arguments"]: keys2.map((key) => ({
|
|
59376
|
-
kind:
|
|
59285
|
+
kind: graphql13.Kind.ARGUMENT,
|
|
59377
59286
|
name: {
|
|
59378
|
-
kind:
|
|
59287
|
+
kind: graphql13.Kind.NAME,
|
|
59379
59288
|
value: key.name
|
|
59380
59289
|
},
|
|
59381
59290
|
value: {
|
|
59382
|
-
kind:
|
|
59291
|
+
kind: graphql13.Kind.VARIABLE,
|
|
59383
59292
|
name: {
|
|
59384
|
-
kind:
|
|
59293
|
+
kind: graphql13.Kind.NAME,
|
|
59385
59294
|
value: key.name
|
|
59386
59295
|
}
|
|
59387
59296
|
}
|
|
59388
59297
|
})),
|
|
59389
59298
|
selectionSet: {
|
|
59390
|
-
kind:
|
|
59299
|
+
kind: graphql13.Kind.SELECTION_SET,
|
|
59391
59300
|
selections: [
|
|
59392
59301
|
{
|
|
59393
|
-
kind:
|
|
59302
|
+
kind: graphql13.Kind.FIELD,
|
|
59394
59303
|
name: {
|
|
59395
|
-
kind:
|
|
59304
|
+
kind: graphql13.Kind.NAME,
|
|
59396
59305
|
value: "__typename"
|
|
59397
59306
|
}
|
|
59398
59307
|
},
|
|
59399
59308
|
...(typeConfig?.keys || [config.defaultKeys[0]]).map((key) => ({
|
|
59400
|
-
kind:
|
|
59309
|
+
kind: graphql13.Kind.FIELD,
|
|
59401
59310
|
name: {
|
|
59402
|
-
kind:
|
|
59311
|
+
kind: graphql13.Kind.NAME,
|
|
59403
59312
|
value: key
|
|
59404
59313
|
}
|
|
59405
59314
|
})),
|
|
@@ -59456,15 +59365,15 @@ function replaceArgumentsWithVariables(args, flags) {
|
|
|
59456
59365
|
}
|
|
59457
59366
|
function variableAsArgument(name, variable) {
|
|
59458
59367
|
return {
|
|
59459
|
-
kind:
|
|
59368
|
+
kind: graphql13.Kind.ARGUMENT,
|
|
59460
59369
|
name: {
|
|
59461
|
-
kind:
|
|
59370
|
+
kind: graphql13.Kind.NAME,
|
|
59462
59371
|
value: name
|
|
59463
59372
|
},
|
|
59464
59373
|
value: {
|
|
59465
|
-
kind:
|
|
59374
|
+
kind: graphql13.Kind.VARIABLE,
|
|
59466
59375
|
name: {
|
|
59467
|
-
kind:
|
|
59376
|
+
kind: graphql13.Kind.NAME,
|
|
59468
59377
|
value: variable ?? name
|
|
59469
59378
|
}
|
|
59470
59379
|
}
|
|
@@ -59472,18 +59381,18 @@ function variableAsArgument(name, variable) {
|
|
|
59472
59381
|
}
|
|
59473
59382
|
function staticVariableDefinition(name, type, defaultValue, variableName) {
|
|
59474
59383
|
return {
|
|
59475
|
-
kind:
|
|
59384
|
+
kind: graphql13.Kind.VARIABLE_DEFINITION,
|
|
59476
59385
|
type: {
|
|
59477
|
-
kind:
|
|
59386
|
+
kind: graphql13.Kind.NAMED_TYPE,
|
|
59478
59387
|
name: {
|
|
59479
|
-
kind:
|
|
59388
|
+
kind: graphql13.Kind.NAME,
|
|
59480
59389
|
value: type
|
|
59481
59390
|
}
|
|
59482
59391
|
},
|
|
59483
59392
|
variable: {
|
|
59484
|
-
kind:
|
|
59393
|
+
kind: graphql13.Kind.VARIABLE,
|
|
59485
59394
|
name: {
|
|
59486
|
-
kind:
|
|
59395
|
+
kind: graphql13.Kind.NAME,
|
|
59487
59396
|
value: variableName ?? name
|
|
59488
59397
|
}
|
|
59489
59398
|
},
|
|
@@ -59495,9 +59404,9 @@ function staticVariableDefinition(name, type, defaultValue, variableName) {
|
|
|
59495
59404
|
}
|
|
59496
59405
|
function argumentNode(name, value) {
|
|
59497
59406
|
return {
|
|
59498
|
-
kind:
|
|
59407
|
+
kind: graphql13.Kind.ARGUMENT,
|
|
59499
59408
|
name: {
|
|
59500
|
-
kind:
|
|
59409
|
+
kind: graphql13.Kind.NAME,
|
|
59501
59410
|
value: name
|
|
59502
59411
|
},
|
|
59503
59412
|
value: objectNode(value)
|
|
@@ -59505,16 +59414,16 @@ function argumentNode(name, value) {
|
|
|
59505
59414
|
}
|
|
59506
59415
|
function objectNode([type, defaultValue]) {
|
|
59507
59416
|
const node = {
|
|
59508
|
-
kind:
|
|
59417
|
+
kind: graphql13.Kind.OBJECT,
|
|
59509
59418
|
fields: [
|
|
59510
59419
|
{
|
|
59511
|
-
kind:
|
|
59420
|
+
kind: graphql13.Kind.OBJECT_FIELD,
|
|
59512
59421
|
name: {
|
|
59513
|
-
kind:
|
|
59422
|
+
kind: graphql13.Kind.NAME,
|
|
59514
59423
|
value: "type"
|
|
59515
59424
|
},
|
|
59516
59425
|
value: {
|
|
59517
|
-
kind:
|
|
59426
|
+
kind: graphql13.Kind.STRING,
|
|
59518
59427
|
value: type
|
|
59519
59428
|
}
|
|
59520
59429
|
}
|
|
@@ -59522,8 +59431,8 @@ function objectNode([type, defaultValue]) {
|
|
|
59522
59431
|
};
|
|
59523
59432
|
if (defaultValue) {
|
|
59524
59433
|
node.fields.push({
|
|
59525
|
-
kind:
|
|
59526
|
-
name: { kind:
|
|
59434
|
+
kind: graphql13.Kind.OBJECT_FIELD,
|
|
59435
|
+
name: { kind: graphql13.Kind.NAME, value: "default" },
|
|
59527
59436
|
value: {
|
|
59528
59437
|
kind: typeof defaultValue === "number" ? "IntValue" : "StringValue",
|
|
59529
59438
|
value: defaultValue.toString()
|
|
@@ -59534,34 +59443,34 @@ function objectNode([type, defaultValue]) {
|
|
|
59534
59443
|
}
|
|
59535
59444
|
var pageInfoSelection = [
|
|
59536
59445
|
{
|
|
59537
|
-
kind:
|
|
59446
|
+
kind: graphql13.Kind.FIELD,
|
|
59538
59447
|
name: {
|
|
59539
|
-
kind:
|
|
59448
|
+
kind: graphql13.Kind.NAME,
|
|
59540
59449
|
value: "edges"
|
|
59541
59450
|
},
|
|
59542
59451
|
selectionSet: {
|
|
59543
|
-
kind:
|
|
59452
|
+
kind: graphql13.Kind.SELECTION_SET,
|
|
59544
59453
|
selections: [
|
|
59545
59454
|
{
|
|
59546
|
-
kind:
|
|
59455
|
+
kind: graphql13.Kind.FIELD,
|
|
59547
59456
|
name: {
|
|
59548
|
-
kind:
|
|
59457
|
+
kind: graphql13.Kind.NAME,
|
|
59549
59458
|
value: "cursor"
|
|
59550
59459
|
}
|
|
59551
59460
|
},
|
|
59552
59461
|
{
|
|
59553
|
-
kind:
|
|
59462
|
+
kind: graphql13.Kind.FIELD,
|
|
59554
59463
|
name: {
|
|
59555
|
-
kind:
|
|
59464
|
+
kind: graphql13.Kind.NAME,
|
|
59556
59465
|
value: "node"
|
|
59557
59466
|
},
|
|
59558
59467
|
selectionSet: {
|
|
59559
|
-
kind:
|
|
59468
|
+
kind: graphql13.Kind.SELECTION_SET,
|
|
59560
59469
|
selections: [
|
|
59561
59470
|
{
|
|
59562
|
-
kind:
|
|
59471
|
+
kind: graphql13.Kind.FIELD,
|
|
59563
59472
|
name: {
|
|
59564
|
-
kind:
|
|
59473
|
+
kind: graphql13.Kind.NAME,
|
|
59565
59474
|
value: "__typename"
|
|
59566
59475
|
}
|
|
59567
59476
|
}
|
|
@@ -59572,39 +59481,39 @@ var pageInfoSelection = [
|
|
|
59572
59481
|
}
|
|
59573
59482
|
},
|
|
59574
59483
|
{
|
|
59575
|
-
kind:
|
|
59484
|
+
kind: graphql13.Kind.FIELD,
|
|
59576
59485
|
name: {
|
|
59577
|
-
kind:
|
|
59486
|
+
kind: graphql13.Kind.NAME,
|
|
59578
59487
|
value: "pageInfo"
|
|
59579
59488
|
},
|
|
59580
59489
|
selectionSet: {
|
|
59581
|
-
kind:
|
|
59490
|
+
kind: graphql13.Kind.SELECTION_SET,
|
|
59582
59491
|
selections: [
|
|
59583
59492
|
{
|
|
59584
|
-
kind:
|
|
59493
|
+
kind: graphql13.Kind.FIELD,
|
|
59585
59494
|
name: {
|
|
59586
|
-
kind:
|
|
59495
|
+
kind: graphql13.Kind.NAME,
|
|
59587
59496
|
value: "hasPreviousPage"
|
|
59588
59497
|
}
|
|
59589
59498
|
},
|
|
59590
59499
|
{
|
|
59591
|
-
kind:
|
|
59500
|
+
kind: graphql13.Kind.FIELD,
|
|
59592
59501
|
name: {
|
|
59593
|
-
kind:
|
|
59502
|
+
kind: graphql13.Kind.NAME,
|
|
59594
59503
|
value: "hasNextPage"
|
|
59595
59504
|
}
|
|
59596
59505
|
},
|
|
59597
59506
|
{
|
|
59598
|
-
kind:
|
|
59507
|
+
kind: graphql13.Kind.FIELD,
|
|
59599
59508
|
name: {
|
|
59600
|
-
kind:
|
|
59509
|
+
kind: graphql13.Kind.NAME,
|
|
59601
59510
|
value: "startCursor"
|
|
59602
59511
|
}
|
|
59603
59512
|
},
|
|
59604
59513
|
{
|
|
59605
|
-
kind:
|
|
59514
|
+
kind: graphql13.Kind.FIELD,
|
|
59606
59515
|
name: {
|
|
59607
|
-
kind:
|
|
59516
|
+
kind: graphql13.Kind.NAME,
|
|
59608
59517
|
value: "endCursor"
|
|
59609
59518
|
}
|
|
59610
59519
|
}
|
|
@@ -59618,17 +59527,17 @@ async function addListFragments(config, documents) {
|
|
|
59618
59527
|
const lists = {};
|
|
59619
59528
|
const errors = [];
|
|
59620
59529
|
for (const doc of documents) {
|
|
59621
|
-
doc.document =
|
|
59530
|
+
doc.document = graphql14.visit(doc.document, {
|
|
59622
59531
|
Directive(node, key, parent2, path2, ancestors) {
|
|
59623
59532
|
if ([config.listDirective, config.paginateDirective].includes(node.name.value)) {
|
|
59624
59533
|
const nameArg = node.arguments?.find(
|
|
59625
59534
|
(arg) => arg.name.value === config.listOrPaginateNameArg
|
|
59626
59535
|
);
|
|
59627
59536
|
let error = {
|
|
59628
|
-
...new
|
|
59537
|
+
...new graphql14.GraphQLError(
|
|
59629
59538
|
"",
|
|
59630
59539
|
node,
|
|
59631
|
-
new
|
|
59540
|
+
new graphql14.Source(""),
|
|
59632
59541
|
node.loc ? [node.loc.start, node.loc.end] : null,
|
|
59633
59542
|
path2
|
|
59634
59543
|
),
|
|
@@ -59680,7 +59589,7 @@ async function addListFragments(config, documents) {
|
|
|
59680
59589
|
{
|
|
59681
59590
|
kind: "Argument",
|
|
59682
59591
|
name: {
|
|
59683
|
-
kind:
|
|
59592
|
+
kind: graphql14.Kind.NAME,
|
|
59684
59593
|
value: "connection"
|
|
59685
59594
|
},
|
|
59686
59595
|
value: {
|
|
@@ -59730,7 +59639,7 @@ async function addListFragments(config, documents) {
|
|
|
59730
59639
|
const validDeletes = [
|
|
59731
59640
|
...new Set(
|
|
59732
59641
|
Object.values(lists).map(({ type }) => {
|
|
59733
|
-
if (!(type instanceof
|
|
59642
|
+
if (!(type instanceof graphql14.GraphQLObjectType)) {
|
|
59734
59643
|
return "";
|
|
59735
59644
|
}
|
|
59736
59645
|
if (config.keyFieldsForType(type.name).length !== 1) {
|
|
@@ -59744,7 +59653,7 @@ async function addListFragments(config, documents) {
|
|
|
59744
59653
|
return;
|
|
59745
59654
|
}
|
|
59746
59655
|
const generatedDoc = {
|
|
59747
|
-
kind:
|
|
59656
|
+
kind: graphql14.Kind.DOCUMENT,
|
|
59748
59657
|
definitions: Object.entries(lists).flatMap(
|
|
59749
59658
|
([name, { selection, type }]) => {
|
|
59750
59659
|
const schemaType = config.schema.getType(type.name);
|
|
@@ -59752,7 +59661,7 @@ async function addListFragments(config, documents) {
|
|
|
59752
59661
|
throw new HoudiniError({ message: "Lists must have a selection" });
|
|
59753
59662
|
}
|
|
59754
59663
|
const fragmentSelection = {
|
|
59755
|
-
kind:
|
|
59664
|
+
kind: graphql14.Kind.SELECTION_SET,
|
|
59756
59665
|
selections: [...selection.selections]
|
|
59757
59666
|
};
|
|
59758
59667
|
if (schemaType && fragmentSelection && !fragmentSelection?.selections.find(
|
|
@@ -59767,14 +59676,14 @@ async function addListFragments(config, documents) {
|
|
|
59767
59676
|
{
|
|
59768
59677
|
name: {
|
|
59769
59678
|
value: config.listInsertFragment(name),
|
|
59770
|
-
kind:
|
|
59679
|
+
kind: graphql14.Kind.NAME
|
|
59771
59680
|
},
|
|
59772
|
-
kind:
|
|
59681
|
+
kind: graphql14.Kind.FRAGMENT_DEFINITION,
|
|
59773
59682
|
selectionSet: fragmentSelection,
|
|
59774
59683
|
typeCondition: {
|
|
59775
|
-
kind:
|
|
59684
|
+
kind: graphql14.Kind.NAMED_TYPE,
|
|
59776
59685
|
name: {
|
|
59777
|
-
kind:
|
|
59686
|
+
kind: graphql14.Kind.NAME,
|
|
59778
59687
|
value: type.name
|
|
59779
59688
|
}
|
|
59780
59689
|
}
|
|
@@ -59782,32 +59691,32 @@ async function addListFragments(config, documents) {
|
|
|
59782
59691
|
{
|
|
59783
59692
|
name: {
|
|
59784
59693
|
value: config.listToggleFragment(name),
|
|
59785
|
-
kind:
|
|
59694
|
+
kind: graphql14.Kind.NAME
|
|
59786
59695
|
},
|
|
59787
|
-
kind:
|
|
59696
|
+
kind: graphql14.Kind.FRAGMENT_DEFINITION,
|
|
59788
59697
|
selectionSet: fragmentSelection,
|
|
59789
59698
|
typeCondition: {
|
|
59790
|
-
kind:
|
|
59699
|
+
kind: graphql14.Kind.NAMED_TYPE,
|
|
59791
59700
|
name: {
|
|
59792
|
-
kind:
|
|
59701
|
+
kind: graphql14.Kind.NAME,
|
|
59793
59702
|
value: type.name
|
|
59794
59703
|
}
|
|
59795
59704
|
}
|
|
59796
59705
|
},
|
|
59797
59706
|
{
|
|
59798
|
-
kind:
|
|
59707
|
+
kind: graphql14.Kind.FRAGMENT_DEFINITION,
|
|
59799
59708
|
name: {
|
|
59800
59709
|
value: config.listRemoveFragment(name),
|
|
59801
|
-
kind:
|
|
59710
|
+
kind: graphql14.Kind.NAME
|
|
59802
59711
|
},
|
|
59803
59712
|
selectionSet: {
|
|
59804
|
-
kind:
|
|
59713
|
+
kind: graphql14.Kind.SELECTION_SET,
|
|
59805
59714
|
selections: [...objectIdentificationSelection(config, type)]
|
|
59806
59715
|
},
|
|
59807
59716
|
typeCondition: {
|
|
59808
|
-
kind:
|
|
59717
|
+
kind: graphql14.Kind.NAMED_TYPE,
|
|
59809
59718
|
name: {
|
|
59810
|
-
kind:
|
|
59719
|
+
kind: graphql14.Kind.NAME,
|
|
59811
59720
|
value: type.name
|
|
59812
59721
|
}
|
|
59813
59722
|
}
|
|
@@ -59816,14 +59725,14 @@ async function addListFragments(config, documents) {
|
|
|
59816
59725
|
}
|
|
59817
59726
|
).concat(
|
|
59818
59727
|
...validDeletes.map((typeName) => ({
|
|
59819
|
-
kind:
|
|
59728
|
+
kind: graphql14.Kind.DIRECTIVE_DEFINITION,
|
|
59820
59729
|
name: {
|
|
59821
|
-
kind:
|
|
59730
|
+
kind: graphql14.Kind.NAME,
|
|
59822
59731
|
value: config.listDeleteDirective(typeName)
|
|
59823
59732
|
},
|
|
59824
59733
|
locations: [
|
|
59825
59734
|
{
|
|
59826
|
-
kind:
|
|
59735
|
+
kind: graphql14.Kind.NAME,
|
|
59827
59736
|
value: "FIELD"
|
|
59828
59737
|
}
|
|
59829
59738
|
],
|
|
@@ -59831,8 +59740,8 @@ async function addListFragments(config, documents) {
|
|
|
59831
59740
|
}))
|
|
59832
59741
|
)
|
|
59833
59742
|
};
|
|
59834
|
-
config.newSchema += "\n" + generatedDoc.definitions.filter((c) => c.kind !== "FragmentDefinition").map(
|
|
59835
|
-
config.newDocuments += "\n" + generatedDoc.definitions.filter((c) => c.kind === "FragmentDefinition").map(
|
|
59743
|
+
config.newSchema += "\n" + generatedDoc.definitions.filter((c) => c.kind !== "FragmentDefinition").map(graphql14.print).join("\n\n");
|
|
59744
|
+
config.newDocuments += "\n" + generatedDoc.definitions.filter((c) => c.kind === "FragmentDefinition").map(graphql14.print).join("\n\n");
|
|
59836
59745
|
documents.push({
|
|
59837
59746
|
name: "generated::lists",
|
|
59838
59747
|
kind: ArtifactKind.Fragment,
|
|
@@ -59918,11 +59827,11 @@ var nodeNotDefinedMessage = (config) => `Looks like you are trying to use the ${
|
|
|
59918
59827
|
For more information, visit this link: ${siteURL}/guides/pagination`;
|
|
59919
59828
|
|
|
59920
59829
|
// src/codegen/generators/artifacts/fieldKey.ts
|
|
59921
|
-
import * as
|
|
59830
|
+
import * as graphql15 from "graphql";
|
|
59922
59831
|
function fieldKey(config, field) {
|
|
59923
59832
|
const attributeName = field.alias?.value || field.name.value;
|
|
59924
|
-
const printed =
|
|
59925
|
-
const secondParse =
|
|
59833
|
+
const printed = graphql15.print(field);
|
|
59834
|
+
const secondParse = graphql15.parse(`{${printed}}`).definitions[0].selectionSet.selections[0];
|
|
59926
59835
|
let paginateMode = config.defaultPaginateMode;
|
|
59927
59836
|
const paginatedDirective = field.directives?.find(
|
|
59928
59837
|
(directive) => directive.name.value === config.paginateDirective
|
|
@@ -60045,13 +59954,13 @@ function prepareSelection({
|
|
|
60045
59954
|
} else if ("getFields" in type) {
|
|
60046
59955
|
let typeRef = type.getFields()[field.name.value].type;
|
|
60047
59956
|
fieldType = getRootType(typeRef);
|
|
60048
|
-
nullable = !
|
|
60049
|
-
} else if (
|
|
59957
|
+
nullable = !graphql16.isNonNullType(typeRef);
|
|
59958
|
+
} else if (graphql16.isAbstractType(type)) {
|
|
60050
59959
|
for (const possible of config.schema.getPossibleTypes(type)) {
|
|
60051
|
-
if (
|
|
59960
|
+
if (graphql16.isObjectType(possible)) {
|
|
60052
59961
|
if (possible.getFields()[field.name.value]) {
|
|
60053
59962
|
fieldType = possible.getFields()[field.name.value].type;
|
|
60054
|
-
nullable = !
|
|
59963
|
+
nullable = !graphql16.isNonNullType(fieldType);
|
|
60055
59964
|
break;
|
|
60056
59965
|
}
|
|
60057
59966
|
}
|
|
@@ -60188,7 +60097,7 @@ function prepareSelection({
|
|
|
60188
60097
|
kind: "value"
|
|
60189
60098
|
} : { kind: "continue" };
|
|
60190
60099
|
const parentType = config.schema.getType(rootType);
|
|
60191
|
-
if (
|
|
60100
|
+
if (graphql16.isObjectType(parentType) || graphql16.isInterfaceType(parentType)) {
|
|
60192
60101
|
const fieldType2 = parentType.getFields()[field.name.value]?.type;
|
|
60193
60102
|
if (fieldType2) {
|
|
60194
60103
|
const listCount = unwrapType(config, fieldType2).wrappers.filter(
|
|
@@ -60211,7 +60120,7 @@ function prepareSelection({
|
|
|
60211
60120
|
}
|
|
60212
60121
|
fieldObj.loading = loadingValue;
|
|
60213
60122
|
}
|
|
60214
|
-
if (
|
|
60123
|
+
if (graphql16.isInterfaceType(fieldType) || graphql16.isUnionType(fieldType)) {
|
|
60215
60124
|
fieldObj.abstract = true;
|
|
60216
60125
|
if (Object.values(fieldObj.selection?.abstractFields?.fields ?? {}).some(
|
|
60217
60126
|
(fields) => Object.values(fields ?? {}).some((field2) => field2.required)
|
|
@@ -60293,7 +60202,7 @@ function mergeSelection({
|
|
|
60293
60202
|
typeSelection,
|
|
60294
60203
|
abstractSelection.fields[typeName] ?? {}
|
|
60295
60204
|
);
|
|
60296
|
-
if (
|
|
60205
|
+
if (graphql16.isAbstractType(gqlType)) {
|
|
60297
60206
|
for (const possible of config.schema.getPossibleTypes(gqlType)) {
|
|
60298
60207
|
if (!possibleSelectionTypes[typeName]) {
|
|
60299
60208
|
possibleSelectionTypes[typeName] = [];
|
|
@@ -60328,7 +60237,7 @@ function mergeSelection({
|
|
|
60328
60237
|
}
|
|
60329
60238
|
}
|
|
60330
60239
|
const parentType = config.schema.getType(rootType);
|
|
60331
|
-
const possibleParents =
|
|
60240
|
+
const possibleParents = graphql16.isAbstractType(parentType) ? config.schema.getPossibleTypes(parentType)?.map((t2) => t2.name) : [parentType.name];
|
|
60332
60241
|
for (const key of Object.keys(abstractSelection.typeMap)) {
|
|
60333
60242
|
if (!possibleParents.includes(key) && rootType !== key || abstractSelection.fields[key]) {
|
|
60334
60243
|
delete abstractSelection.typeMap[key];
|
|
@@ -60385,12 +60294,12 @@ function mergeSelection({
|
|
|
60385
60294
|
}
|
|
60386
60295
|
|
|
60387
60296
|
// src/codegen/generators/artifacts/index.ts
|
|
60388
|
-
var
|
|
60297
|
+
var AST5 = recast5.types.builders;
|
|
60389
60298
|
function artifactGenerator(stats) {
|
|
60390
60299
|
return async function(config, docs) {
|
|
60391
60300
|
const filterTypes = {};
|
|
60392
60301
|
for (const doc of docs) {
|
|
60393
|
-
|
|
60302
|
+
graphql17.visit(doc.document, {
|
|
60394
60303
|
Directive(node, _, __, ___, ancestors) {
|
|
60395
60304
|
if (node.name.value !== config.listDirective) {
|
|
60396
60305
|
return;
|
|
@@ -60450,7 +60359,7 @@ function artifactGenerator(stats) {
|
|
|
60450
60359
|
return;
|
|
60451
60360
|
}
|
|
60452
60361
|
const usedVariableNames = /* @__PURE__ */ new Set();
|
|
60453
|
-
let documentWithoutInternalDirectives =
|
|
60362
|
+
let documentWithoutInternalDirectives = graphql17.visit(document, {
|
|
60454
60363
|
Directive(node) {
|
|
60455
60364
|
if (config.isInternalDirective(node.name.value)) {
|
|
60456
60365
|
return null;
|
|
@@ -60463,7 +60372,7 @@ function artifactGenerator(stats) {
|
|
|
60463
60372
|
}
|
|
60464
60373
|
}
|
|
60465
60374
|
});
|
|
60466
|
-
let documentWithoutExtraVariables =
|
|
60375
|
+
let documentWithoutExtraVariables = graphql17.visit(
|
|
60467
60376
|
documentWithoutInternalDirectives,
|
|
60468
60377
|
{
|
|
60469
60378
|
VariableDefinition(variableDefinitionNode) {
|
|
@@ -60474,13 +60383,13 @@ function artifactGenerator(stats) {
|
|
|
60474
60383
|
}
|
|
60475
60384
|
}
|
|
60476
60385
|
);
|
|
60477
|
-
let rawString =
|
|
60386
|
+
let rawString = graphql17.print(documentWithoutExtraVariables);
|
|
60478
60387
|
let docKind = doc.kind;
|
|
60479
60388
|
const operations = document.definitions.filter(
|
|
60480
|
-
({ kind }) => kind ===
|
|
60389
|
+
({ kind }) => kind === graphql17.Kind.OPERATION_DEFINITION
|
|
60481
60390
|
);
|
|
60482
60391
|
const fragments = document.definitions.filter(
|
|
60483
|
-
({ kind }) => kind ===
|
|
60392
|
+
({ kind }) => kind === graphql17.Kind.FRAGMENT_DEFINITION
|
|
60484
60393
|
);
|
|
60485
60394
|
let rootType = "";
|
|
60486
60395
|
let selectionSet;
|
|
@@ -60680,9 +60589,9 @@ function artifactGenerator(stats) {
|
|
|
60680
60589
|
plugin2.artifactEnd({ config, document: doc });
|
|
60681
60590
|
}
|
|
60682
60591
|
const _houdiniHash = hashOriginal({ document: doc });
|
|
60683
|
-
const file =
|
|
60592
|
+
const file = AST5.program([
|
|
60684
60593
|
moduleExport(config, "default", serializeValue(artifact)),
|
|
60685
|
-
|
|
60594
|
+
AST5.expressionStatement(AST5.stringLiteral(`HoudiniHash=${_houdiniHash}`))
|
|
60686
60595
|
]);
|
|
60687
60596
|
const artifactPath = config.artifactPath(document);
|
|
60688
60597
|
const countDocument = doc.generateStore;
|
|
@@ -60740,7 +60649,7 @@ function applyMask(config, target, mask) {
|
|
|
60740
60649
|
if (!targetType) {
|
|
60741
60650
|
continue;
|
|
60742
60651
|
}
|
|
60743
|
-
if (
|
|
60652
|
+
if (graphql17.isAbstractType(targetType)) {
|
|
60744
60653
|
for (const possible of config.schema.getPossibleTypes(targetType)) {
|
|
60745
60654
|
if (target.abstractFields?.fields[possible.name]) {
|
|
60746
60655
|
applyMask(
|
|
@@ -60763,8 +60672,8 @@ function applyMask(config, target, mask) {
|
|
|
60763
60672
|
}
|
|
60764
60673
|
|
|
60765
60674
|
// src/codegen/generators/runtime/graphqlFunction.ts
|
|
60766
|
-
var
|
|
60767
|
-
var
|
|
60675
|
+
var recast6 = __toESM(require_main2(), 1);
|
|
60676
|
+
var AST6 = recast6.types.builders;
|
|
60768
60677
|
async function generateGraphqlReturnTypes(config, docs) {
|
|
60769
60678
|
const indexPath = path_exports.join(config.runtimeDirectory, "index.d.ts");
|
|
60770
60679
|
const fileContent = await fs_exports.readFile(indexPath) || "";
|
|
@@ -60799,18 +60708,18 @@ async function generateGraphqlReturnTypes(config, docs) {
|
|
|
60799
60708
|
continue;
|
|
60800
60709
|
}
|
|
60801
60710
|
for (const [queryString, returnValue] of Object.entries(overloaded_returns)) {
|
|
60802
|
-
const input =
|
|
60803
|
-
input.typeAnnotation =
|
|
60804
|
-
|
|
60711
|
+
const input = AST6.identifier("str");
|
|
60712
|
+
input.typeAnnotation = AST6.tsTypeAnnotation(
|
|
60713
|
+
AST6.tsLiteralType(AST6.stringLiteral(queryString))
|
|
60805
60714
|
);
|
|
60806
60715
|
script.body.splice(
|
|
60807
60716
|
i,
|
|
60808
60717
|
0,
|
|
60809
|
-
|
|
60810
|
-
|
|
60811
|
-
|
|
60718
|
+
AST6.exportNamedDeclaration(
|
|
60719
|
+
AST6.tsDeclareFunction(
|
|
60720
|
+
AST6.identifier("graphql"),
|
|
60812
60721
|
[input],
|
|
60813
|
-
|
|
60722
|
+
AST6.tsTypeAnnotation(AST6.tsTypeReference(AST6.identifier(returnValue)))
|
|
60814
60723
|
)
|
|
60815
60724
|
)
|
|
60816
60725
|
);
|
|
@@ -60985,165 +60894,22 @@ function moduleStatments(config) {
|
|
|
60985
60894
|
var recast11 = __toESM(require_main2(), 1);
|
|
60986
60895
|
|
|
60987
60896
|
// src/codegen/generators/typescript/addReferencedInputTypes.ts
|
|
60988
|
-
var recast8 = __toESM(require_main2(), 1);
|
|
60989
|
-
import * as graphql19 from "graphql";
|
|
60990
|
-
|
|
60991
|
-
// src/codegen/generators/typescript/typeReference.ts
|
|
60992
60897
|
var recast7 = __toESM(require_main2(), 1);
|
|
60993
60898
|
import * as graphql18 from "graphql";
|
|
60994
|
-
|
|
60995
|
-
// src/codegen/generators/typescript/types.ts
|
|
60996
|
-
var recast6 = __toESM(require_main2(), 1);
|
|
60997
|
-
import * as graphql17 from "graphql";
|
|
60998
|
-
var AST6 = recast6.types.builders;
|
|
60999
|
-
function readonlyProperty(prop, enable = true) {
|
|
61000
|
-
if (enable) {
|
|
61001
|
-
prop.readonly = true;
|
|
61002
|
-
}
|
|
61003
|
-
return prop;
|
|
61004
|
-
}
|
|
61005
|
-
function nullableField(inner, input = false) {
|
|
61006
|
-
const members = [inner, AST6.tsNullKeyword()];
|
|
61007
|
-
if (input) {
|
|
61008
|
-
members.push(AST6.tsUndefinedKeyword());
|
|
61009
|
-
}
|
|
61010
|
-
return AST6.tsUnionType(members);
|
|
61011
|
-
}
|
|
61012
|
-
function scalarPropertyValue(config, filepath, missingScalars, target, body, field) {
|
|
61013
|
-
if (config.configFile.features?.componentFields && target.name === config.componentScalar) {
|
|
61014
|
-
if (!field) {
|
|
61015
|
-
return AST6.tsNeverKeyword();
|
|
61016
|
-
}
|
|
61017
|
-
const component = config.componentFields[field.parent][field.field];
|
|
61018
|
-
const sourcePathRelative = path_exports.relative(
|
|
61019
|
-
path_exports.join(config.projectRoot, "src"),
|
|
61020
|
-
component.filepath
|
|
61021
|
-
);
|
|
61022
|
-
let sourcePathParsed = path_exports.parse(sourcePathRelative);
|
|
61023
|
-
let sourcePath = path_exports.join(sourcePathParsed.dir, sourcePathParsed.name);
|
|
61024
|
-
const localImport = ensureImports({
|
|
61025
|
-
config,
|
|
61026
|
-
body,
|
|
61027
|
-
import: "__component__" + component.fragment,
|
|
61028
|
-
sourceModule: path_exports.join(
|
|
61029
|
-
path_exports.relative(path_exports.dirname(filepath), config.projectRoot),
|
|
61030
|
-
"src",
|
|
61031
|
-
sourcePath
|
|
61032
|
-
)
|
|
61033
|
-
});
|
|
61034
|
-
const parameters = AST6.tsTypeReference(AST6.identifier("Parameters"));
|
|
61035
|
-
parameters.typeParameters = AST6.tsTypeParameterInstantiation([
|
|
61036
|
-
AST6.tsTypeQuery(AST6.identifier(localImport))
|
|
61037
|
-
]);
|
|
61038
|
-
const indexed = AST6.tsIndexedAccessType(
|
|
61039
|
-
parameters,
|
|
61040
|
-
AST6.tsLiteralType(AST6.numericLiteral(0))
|
|
61041
|
-
);
|
|
61042
|
-
const omit = AST6.tsTypeReference(AST6.identifier("Omit"));
|
|
61043
|
-
omit.typeParameters = AST6.tsTypeParameterInstantiation([
|
|
61044
|
-
indexed,
|
|
61045
|
-
AST6.tsLiteralType(AST6.stringLiteral(component.prop))
|
|
61046
|
-
]);
|
|
61047
|
-
const arg = AST6.identifier("props");
|
|
61048
|
-
arg.typeAnnotation = AST6.tsTypeAnnotation(omit);
|
|
61049
|
-
const returnType = AST6.tsTypeReference(AST6.identifier("ReturnType"));
|
|
61050
|
-
returnType.typeParameters = AST6.tsTypeParameterInstantiation([
|
|
61051
|
-
AST6.tsTypeQuery(AST6.identifier(localImport))
|
|
61052
|
-
]);
|
|
61053
|
-
const fnType = AST6.tsFunctionType([arg]);
|
|
61054
|
-
fnType.typeAnnotation = AST6.tsTypeAnnotation(returnType);
|
|
61055
|
-
return fnType;
|
|
61056
|
-
}
|
|
61057
|
-
switch (target.name) {
|
|
61058
|
-
case "String": {
|
|
61059
|
-
return AST6.tsStringKeyword();
|
|
61060
|
-
}
|
|
61061
|
-
case "Int": {
|
|
61062
|
-
return AST6.tsNumberKeyword();
|
|
61063
|
-
}
|
|
61064
|
-
case "Float": {
|
|
61065
|
-
return AST6.tsNumberKeyword();
|
|
61066
|
-
}
|
|
61067
|
-
case "Boolean": {
|
|
61068
|
-
return AST6.tsBooleanKeyword();
|
|
61069
|
-
}
|
|
61070
|
-
case "ID": {
|
|
61071
|
-
return AST6.tsStringKeyword();
|
|
61072
|
-
}
|
|
61073
|
-
default: {
|
|
61074
|
-
if (graphql17.isNonNullType(target) && "ofType" in target) {
|
|
61075
|
-
return scalarPropertyValue(
|
|
61076
|
-
config,
|
|
61077
|
-
filepath,
|
|
61078
|
-
missingScalars,
|
|
61079
|
-
target.ofType,
|
|
61080
|
-
body,
|
|
61081
|
-
field
|
|
61082
|
-
);
|
|
61083
|
-
}
|
|
61084
|
-
if (config.scalars?.[target.name]) {
|
|
61085
|
-
return AST6.tsTypeReference(AST6.identifier(config.scalars?.[target.name].type));
|
|
61086
|
-
}
|
|
61087
|
-
if (target.name !== config.componentScalar) {
|
|
61088
|
-
missingScalars.add(target.name);
|
|
61089
|
-
}
|
|
61090
|
-
return AST6.tsAnyKeyword();
|
|
61091
|
-
}
|
|
61092
|
-
}
|
|
61093
|
-
}
|
|
61094
|
-
|
|
61095
|
-
// src/codegen/generators/typescript/typeReference.ts
|
|
61096
60899
|
var AST7 = recast7.types.builders;
|
|
61097
|
-
function tsTypeReference(config, filepath, missingScalars, definition, body) {
|
|
61098
|
-
const { type, wrappers } = unwrapType(config, definition.type);
|
|
61099
|
-
let result;
|
|
61100
|
-
if (graphql18.isScalarType(type)) {
|
|
61101
|
-
result = scalarPropertyValue(config, filepath, missingScalars, type, body, null);
|
|
61102
|
-
} else if (graphql18.isEnumType(type)) {
|
|
61103
|
-
result = enumReference(config, body, type.name);
|
|
61104
|
-
} else {
|
|
61105
|
-
result = AST7.tsTypeReference(AST7.identifier(type.name));
|
|
61106
|
-
}
|
|
61107
|
-
for (const toWrap of wrappers) {
|
|
61108
|
-
if (toWrap === "NonNull" /* NonNull */) {
|
|
61109
|
-
continue;
|
|
61110
|
-
} else if (toWrap === "Nullable" /* Nullable */) {
|
|
61111
|
-
result = nullableField(result, true);
|
|
61112
|
-
} else if (toWrap === "List" /* List */) {
|
|
61113
|
-
result = AST7.tsArrayType(AST7.tsParenthesizedType(result));
|
|
61114
|
-
}
|
|
61115
|
-
}
|
|
61116
|
-
return result;
|
|
61117
|
-
}
|
|
61118
|
-
function enumReference(config, body, name) {
|
|
61119
|
-
ensureImports({
|
|
61120
|
-
config,
|
|
61121
|
-
body,
|
|
61122
|
-
import: ["ValueOf"],
|
|
61123
|
-
importKind: "type",
|
|
61124
|
-
sourceModule: "$houdini/runtime/lib/types"
|
|
61125
|
-
});
|
|
61126
|
-
return AST7.tsTypeReference(
|
|
61127
|
-
AST7.identifier("ValueOf"),
|
|
61128
|
-
AST7.tsTypeParameterInstantiation([AST7.tsTypeQuery(AST7.identifier(name))])
|
|
61129
|
-
);
|
|
61130
|
-
}
|
|
61131
|
-
|
|
61132
|
-
// src/codegen/generators/typescript/addReferencedInputTypes.ts
|
|
61133
|
-
var AST8 = recast8.types.builders;
|
|
61134
60900
|
function addReferencedInputTypes(config, filepath, body, visitedTypes, missingScalars, rootType) {
|
|
61135
60901
|
const { type } = unwrapType(config, rootType);
|
|
61136
|
-
if (
|
|
60902
|
+
if (graphql18.isScalarType(type)) {
|
|
61137
60903
|
return;
|
|
61138
60904
|
}
|
|
61139
60905
|
if (visitedTypes.has(type.name)) {
|
|
61140
60906
|
return;
|
|
61141
60907
|
}
|
|
61142
|
-
if (
|
|
60908
|
+
if (graphql18.isUnionType(type)) {
|
|
61143
60909
|
throw new HoudiniError({ filepath, message: "Input Unions are not supported yet. Sorry!" });
|
|
61144
60910
|
}
|
|
61145
60911
|
visitedTypes.add(type.name);
|
|
61146
|
-
if (
|
|
60912
|
+
if (graphql18.isEnumType(type)) {
|
|
61147
60913
|
ensureImports({
|
|
61148
60914
|
config,
|
|
61149
60915
|
body,
|
|
@@ -61157,21 +60923,37 @@ function addReferencedInputTypes(config, filepath, body, visitedTypes, missingSc
|
|
|
61157
60923
|
for (const field of Object.values(type.getFields())) {
|
|
61158
60924
|
addReferencedInputTypes(config, filepath, body, visitedTypes, missingScalars, field.type);
|
|
61159
60925
|
members.push(
|
|
61160
|
-
|
|
61161
|
-
|
|
61162
|
-
|
|
60926
|
+
AST7.tsPropertySignature(
|
|
60927
|
+
AST7.identifier(field.name),
|
|
60928
|
+
AST7.tsTypeAnnotation(
|
|
61163
60929
|
tsTypeReference(config, filepath, missingScalars, field, body)
|
|
61164
60930
|
),
|
|
61165
|
-
|
|
60931
|
+
graphql18.isNullableType(field.type)
|
|
61166
60932
|
)
|
|
61167
60933
|
);
|
|
61168
60934
|
}
|
|
61169
|
-
body.push(
|
|
60935
|
+
body.push(AST7.tsTypeAliasDeclaration(AST7.identifier(type.name), AST7.tsTypeLiteral(members)));
|
|
61170
60936
|
}
|
|
61171
60937
|
|
|
61172
60938
|
// src/codegen/generators/typescript/inlineType.ts
|
|
61173
60939
|
var recast9 = __toESM(require_main2(), 1);
|
|
61174
|
-
import * as
|
|
60940
|
+
import * as graphql19 from "graphql";
|
|
60941
|
+
|
|
60942
|
+
// src/codegen/generators/comments/jsdoc.ts
|
|
60943
|
+
var recast8 = __toESM(require_main2(), 1);
|
|
60944
|
+
var AST8 = recast8.types.builders;
|
|
60945
|
+
function jsdocComment(text, deprecated) {
|
|
60946
|
+
let commentContent = `*
|
|
60947
|
+
* ${text}
|
|
60948
|
+
`;
|
|
60949
|
+
if (deprecated) {
|
|
60950
|
+
commentContent = `${commentContent} * @deprecated ${deprecated}
|
|
60951
|
+
`;
|
|
60952
|
+
}
|
|
60953
|
+
return AST8.commentBlock(commentContent, true);
|
|
60954
|
+
}
|
|
60955
|
+
|
|
60956
|
+
// src/codegen/generators/typescript/inlineType.ts
|
|
61175
60957
|
var AST9 = recast9.types.builders;
|
|
61176
60958
|
var fragmentKey2 = " $fragments";
|
|
61177
60959
|
function inlineType({
|
|
@@ -61192,7 +60974,7 @@ function inlineType({
|
|
|
61192
60974
|
const { type, wrappers } = unwrapType(config, rootType);
|
|
61193
60975
|
let result;
|
|
61194
60976
|
let forceNullable = false;
|
|
61195
|
-
if (
|
|
60977
|
+
if (graphql19.isScalarType(type)) {
|
|
61196
60978
|
result = scalarPropertyValue(
|
|
61197
60979
|
config,
|
|
61198
60980
|
filepath,
|
|
@@ -61201,7 +60983,7 @@ function inlineType({
|
|
|
61201
60983
|
body,
|
|
61202
60984
|
field
|
|
61203
60985
|
);
|
|
61204
|
-
} else if (
|
|
60986
|
+
} else if (graphql19.isEnumType(type)) {
|
|
61205
60987
|
ensureImports({
|
|
61206
60988
|
config,
|
|
61207
60989
|
body,
|
|
@@ -61226,11 +61008,11 @@ function inlineType({
|
|
|
61226
61008
|
for (const selection of selections) {
|
|
61227
61009
|
if (selection.kind === "InlineFragment" && selection.typeCondition) {
|
|
61228
61010
|
const fragmentType = config.schema.getType(selection.typeCondition.name.value);
|
|
61229
|
-
if (!
|
|
61011
|
+
if (!graphql19.isInterfaceType(type) && !graphql19.isUnionType(type)) {
|
|
61230
61012
|
selectedFields.push(...selection.selectionSet.selections);
|
|
61231
61013
|
continue;
|
|
61232
61014
|
}
|
|
61233
|
-
if (!
|
|
61015
|
+
if (!graphql19.isInterfaceType(fragmentType) && !graphql19.isUnionType(fragmentType)) {
|
|
61234
61016
|
if (!inlineFragments[fragmentType.name]) {
|
|
61235
61017
|
inlineFragments[fragmentType.name] = [];
|
|
61236
61018
|
}
|
|
@@ -61322,6 +61104,11 @@ function inlineType({
|
|
|
61322
61104
|
if (allOptional) {
|
|
61323
61105
|
prop.optional = true;
|
|
61324
61106
|
}
|
|
61107
|
+
if (field2.description || field2.deprecationReason) {
|
|
61108
|
+
prop.comments = [
|
|
61109
|
+
jsdocComment(field2.description ?? "", field2.deprecationReason ?? void 0)
|
|
61110
|
+
];
|
|
61111
|
+
}
|
|
61325
61112
|
return prop;
|
|
61326
61113
|
})
|
|
61327
61114
|
]);
|
|
@@ -61373,7 +61160,7 @@ function inlineType({
|
|
|
61373
61160
|
}
|
|
61374
61161
|
}
|
|
61375
61162
|
}
|
|
61376
|
-
if (objectType.type === "TSTypeLiteral" && !
|
|
61163
|
+
if (objectType.type === "TSTypeLiteral" && !graphql19.isInterfaceType(fragmentRootType) && !graphql19.isUnionType(fragmentRootType)) {
|
|
61377
61164
|
const existingTypenameIndex = objectType.members.findIndex(
|
|
61378
61165
|
(member) => member.type === "TSPropertySignature" && member.key.type === "Identifier" && member.key.name === "__typename"
|
|
61379
61166
|
);
|
|
@@ -61398,11 +61185,11 @@ function inlineType({
|
|
|
61398
61185
|
];
|
|
61399
61186
|
}
|
|
61400
61187
|
let coveredTypenames;
|
|
61401
|
-
if (
|
|
61188
|
+
if (graphql19.isInterfaceType(fragmentRootType)) {
|
|
61402
61189
|
coveredTypenames = interfaceCoveredTypenames(fragmentRootType);
|
|
61403
|
-
} else if (
|
|
61190
|
+
} else if (graphql19.isUnionType(fragmentRootType)) {
|
|
61404
61191
|
coveredTypenames = fragmentRootType.getTypes().map((type2) => type2.name);
|
|
61405
|
-
} else if (
|
|
61192
|
+
} else if (graphql19.isObjectType(fragmentRootType)) {
|
|
61406
61193
|
coveredTypenames = [fragmentRootType.name];
|
|
61407
61194
|
} else {
|
|
61408
61195
|
throw Error("unreachable code");
|
|
@@ -61438,7 +61225,7 @@ function inlineType({
|
|
|
61438
61225
|
);
|
|
61439
61226
|
}
|
|
61440
61227
|
);
|
|
61441
|
-
const parentIsUnionOrInterface = !
|
|
61228
|
+
const parentIsUnionOrInterface = !graphql19.isInterfaceType(type) && !graphql19.isUnionType(type);
|
|
61442
61229
|
const possibleTypenames = parentIsUnionOrInterface ? [parent.name] : config.schema.getPossibleTypes(type).map((type2) => type2.name);
|
|
61443
61230
|
const coveredTypenames = new Set(
|
|
61444
61231
|
Object.values(inlineFragmentSelections).flatMap((sel) => sel.coveredTypenames)
|
|
@@ -61505,7 +61292,7 @@ function selectionTypeInfo(schema, filepath, rootType, selection) {
|
|
|
61505
61292
|
},
|
|
61506
61293
|
type: schema.getType("String")
|
|
61507
61294
|
};
|
|
61508
|
-
} else if (
|
|
61295
|
+
} else if (graphql19.isNonNullType(rootType) && "getFields" in rootType.ofType) {
|
|
61509
61296
|
fields = rootType.ofType.getFields();
|
|
61510
61297
|
} else {
|
|
61511
61298
|
fields = rootType.getFields();
|
|
@@ -61517,7 +61304,7 @@ function selectionTypeInfo(schema, filepath, rootType, selection) {
|
|
|
61517
61304
|
message: `Could not find type information for field ${rootType.toString()}.${selectionName} ${field}`
|
|
61518
61305
|
});
|
|
61519
61306
|
}
|
|
61520
|
-
const fieldType =
|
|
61307
|
+
const fieldType = graphql19.getNamedType(field.type);
|
|
61521
61308
|
if (!fieldType) {
|
|
61522
61309
|
throw new HoudiniError({
|
|
61523
61310
|
filepath,
|
|
@@ -62026,7 +61813,7 @@ async function generateFragmentTypeDefs(config, filepath, body, selections, defi
|
|
|
62026
61813
|
|
|
62027
61814
|
// src/codegen/generators/typescript/imperativeTypeDef.ts
|
|
62028
61815
|
var recast12 = __toESM(require_main2(), 1);
|
|
62029
|
-
import * as
|
|
61816
|
+
import * as graphql20 from "graphql";
|
|
62030
61817
|
var AST12 = recast12.types.builders;
|
|
62031
61818
|
async function imperativeCacheTypef(config, docs) {
|
|
62032
61819
|
const returnType = (doc) => config.plugins.find((plugin2) => plugin2.graphqlTagReturn)?.graphqlTagReturn?.({
|
|
@@ -62077,7 +61864,7 @@ function typeDefinitions(config, filepath, body, docs, returnType) {
|
|
|
62077
61864
|
const operationTypes = [config.schema.getMutationType(), config.schema.getSubscriptionType()].filter(Boolean).map((type) => type?.name);
|
|
62078
61865
|
const visitedTypes = /* @__PURE__ */ new Set();
|
|
62079
61866
|
const types14 = Object.values(config.schema.getTypeMap()).filter(
|
|
62080
|
-
(type) => !
|
|
61867
|
+
(type) => !graphql20.isAbstractType(type) && !graphql20.isScalarType(type) && !graphql20.isEnumType(type) && !graphql20.isInputObjectType(type) && !type.name.startsWith("__") && !operationTypes.includes(type.name)
|
|
62081
61868
|
);
|
|
62082
61869
|
const fragmentMap = fragmentListMap(
|
|
62083
61870
|
config,
|
|
@@ -62094,7 +61881,7 @@ function typeDefinitions(config, filepath, body, docs, returnType) {
|
|
|
62094
61881
|
}
|
|
62095
61882
|
let idFields = AST12.tsNeverKeyword();
|
|
62096
61883
|
const keys2 = keyFieldsForType(config.configFile, type.name);
|
|
62097
|
-
if (
|
|
61884
|
+
if (graphql20.isObjectType(type) && keys2.length > 0 && keys2.every((key) => type.getFields()[key])) {
|
|
62098
61885
|
idFields = AST12.tsTypeLiteral(
|
|
62099
61886
|
keys2.map((key) => {
|
|
62100
61887
|
const fieldType = type.getFields()[key];
|
|
@@ -62121,13 +61908,13 @@ function typeDefinitions(config, filepath, body, docs, returnType) {
|
|
|
62121
61908
|
idFields = AST12.tsTypeLiteral([]);
|
|
62122
61909
|
}
|
|
62123
61910
|
let fields = AST12.tsTypeLiteral([]);
|
|
62124
|
-
if (
|
|
61911
|
+
if (graphql20.isObjectType(type)) {
|
|
62125
61912
|
fields = AST12.tsTypeLiteral(
|
|
62126
61913
|
Object.entries(type.getFields()).map(
|
|
62127
61914
|
([key, fieldType]) => {
|
|
62128
61915
|
const unwrapped = unwrapType(config, fieldType.type);
|
|
62129
61916
|
let typeOptions = AST12.tsUnionType([]);
|
|
62130
|
-
if (
|
|
61917
|
+
if (graphql20.isScalarType(unwrapped.type)) {
|
|
62131
61918
|
typeOptions.types.push(
|
|
62132
61919
|
scalarPropertyValue(
|
|
62133
61920
|
config,
|
|
@@ -62141,11 +61928,11 @@ function typeDefinitions(config, filepath, body, docs, returnType) {
|
|
|
62141
61928
|
}
|
|
62142
61929
|
)
|
|
62143
61930
|
);
|
|
62144
|
-
} else if (
|
|
61931
|
+
} else if (graphql20.isEnumType(unwrapped.type)) {
|
|
62145
61932
|
typeOptions.types.push(
|
|
62146
61933
|
AST12.tsTypeReference(AST12.identifier(unwrapped.type.name))
|
|
62147
61934
|
);
|
|
62148
|
-
} else if (!
|
|
61935
|
+
} else if (!graphql20.isAbstractType(unwrapped.type)) {
|
|
62149
61936
|
typeOptions.types.push(record(unwrapped.type.name));
|
|
62150
61937
|
} else {
|
|
62151
61938
|
typeOptions.types.push(
|
|
@@ -62241,7 +62028,7 @@ function listDefinitions(config, filepath, body, docs) {
|
|
|
62241
62028
|
const lists = [];
|
|
62242
62029
|
const visitedLists = /* @__PURE__ */ new Set();
|
|
62243
62030
|
for (const doc of docs) {
|
|
62244
|
-
|
|
62031
|
+
graphql20.visit(doc.document, {
|
|
62245
62032
|
Directive(node, key, parent2, path2, ancestors) {
|
|
62246
62033
|
if (![config.listDirective, config.paginateDirective].includes(node.name.value)) {
|
|
62247
62034
|
return;
|
|
@@ -62263,7 +62050,7 @@ function listDefinitions(config, filepath, body, docs) {
|
|
|
62263
62050
|
const targetFieldDefinition = parentType.getFields()[targetField.name.value];
|
|
62264
62051
|
const { type: listType } = unwrapType(config, targetFieldDefinition.type);
|
|
62265
62052
|
const possibleTypes = [];
|
|
62266
|
-
if (
|
|
62053
|
+
if (graphql20.isAbstractType(listType)) {
|
|
62267
62054
|
possibleTypes.push(
|
|
62268
62055
|
...config.schema.getPossibleTypes(listType).map((possible) => possible.name)
|
|
62269
62056
|
);
|
|
@@ -62425,7 +62212,7 @@ async function typescriptGenerator(config, docs) {
|
|
|
62425
62212
|
}
|
|
62426
62213
|
|
|
62427
62214
|
// src/codegen/generators/persistedQueries/index.ts
|
|
62428
|
-
import * as
|
|
62215
|
+
import * as graphql21 from "graphql";
|
|
62429
62216
|
async function persistOutputGenerator(config, docs) {
|
|
62430
62217
|
if (!config.persistedQueriesPath.endsWith(".json")) {
|
|
62431
62218
|
throw new Error('Can write Persisted Queries only in a ".json" file.');
|
|
@@ -62435,8 +62222,8 @@ async function persistOutputGenerator(config, docs) {
|
|
|
62435
62222
|
if (!generateArtifact) {
|
|
62436
62223
|
return acc;
|
|
62437
62224
|
}
|
|
62438
|
-
let rawString =
|
|
62439
|
-
|
|
62225
|
+
let rawString = graphql21.print(
|
|
62226
|
+
graphql21.visit(document, {
|
|
62440
62227
|
Directive(node) {
|
|
62441
62228
|
if (config.isInternalDirective(node.name.value)) {
|
|
62442
62229
|
return null;
|
|
@@ -62445,7 +62232,7 @@ async function persistOutputGenerator(config, docs) {
|
|
|
62445
62232
|
})
|
|
62446
62233
|
);
|
|
62447
62234
|
const operations = document.definitions.filter(
|
|
62448
|
-
({ kind }) => kind ===
|
|
62235
|
+
({ kind }) => kind === graphql21.Kind.OPERATION_DEFINITION
|
|
62449
62236
|
);
|
|
62450
62237
|
if (operations.length > 0 && operations[0].kind === "OperationDefinition") {
|
|
62451
62238
|
if (artifact) {
|
|
@@ -62460,33 +62247,45 @@ async function persistOutputGenerator(config, docs) {
|
|
|
62460
62247
|
}
|
|
62461
62248
|
|
|
62462
62249
|
// src/codegen/generators/definitions/index.ts
|
|
62463
|
-
import * as
|
|
62250
|
+
import * as graphql23 from "graphql";
|
|
62464
62251
|
|
|
62465
62252
|
// src/codegen/generators/definitions/enums.ts
|
|
62466
62253
|
var recast13 = __toESM(require_main2(), 1);
|
|
62467
|
-
import * as
|
|
62254
|
+
import * as graphql22 from "graphql";
|
|
62468
62255
|
var AST13 = recast13.types.builders;
|
|
62469
62256
|
async function definitionsGenerator(config) {
|
|
62470
|
-
const enums =
|
|
62257
|
+
const enums = graphql22.parse(graphql22.printSchema(config.schema)).definitions.filter(
|
|
62471
62258
|
(definition) => definition.kind === "EnumTypeDefinition"
|
|
62472
62259
|
).filter((def) => !config.isInternalEnum(def));
|
|
62473
62260
|
const { code: runtimeDefinitions } = await printJS(
|
|
62474
62261
|
AST13.program(
|
|
62475
62262
|
enums.map((defn) => {
|
|
62476
62263
|
const name = defn.name.value;
|
|
62477
|
-
|
|
62264
|
+
const declaration = moduleExport(
|
|
62478
62265
|
config,
|
|
62479
62266
|
name,
|
|
62480
62267
|
AST13.objectExpression(
|
|
62481
62268
|
defn.values?.map((value) => {
|
|
62482
62269
|
const str = value.name.value;
|
|
62483
|
-
|
|
62270
|
+
const prop = AST13.objectProperty(
|
|
62484
62271
|
AST13.stringLiteral(str),
|
|
62485
62272
|
AST13.stringLiteral(str)
|
|
62486
62273
|
);
|
|
62274
|
+
const deprecationReason = value.directives?.find((d) => d.name.value === "deprecated")?.arguments?.find((a) => a.name.value === "reason")?.value?.value;
|
|
62275
|
+
if (value.description || deprecationReason)
|
|
62276
|
+
prop.comments = [
|
|
62277
|
+
jsdocComment(value.description?.value ?? "", deprecationReason)
|
|
62278
|
+
];
|
|
62279
|
+
return prop;
|
|
62487
62280
|
}) || []
|
|
62488
62281
|
)
|
|
62489
62282
|
);
|
|
62283
|
+
if (defn.description) {
|
|
62284
|
+
declaration.comments = [
|
|
62285
|
+
AST13.commentBlock(`* ${defn.description.value} `, true, false)
|
|
62286
|
+
];
|
|
62287
|
+
}
|
|
62288
|
+
return declaration;
|
|
62490
62289
|
})
|
|
62491
62290
|
)
|
|
62492
62291
|
);
|
|
@@ -62495,11 +62294,19 @@ type ValuesOf<T> = T[keyof T]
|
|
|
62495
62294
|
` + enums.sort((a, b) => a.name.value.localeCompare(b.name.value)).map((definition) => {
|
|
62496
62295
|
const name = definition.name.value;
|
|
62497
62296
|
const values = definition.values;
|
|
62498
|
-
|
|
62297
|
+
let jsdoc = "";
|
|
62298
|
+
if (definition.description) {
|
|
62299
|
+
jsdoc = `
|
|
62300
|
+
/** ${definition.description.value} */`;
|
|
62301
|
+
}
|
|
62302
|
+
return `${jsdoc}
|
|
62499
62303
|
export declare const ${name}: {
|
|
62500
|
-
${values?.map(
|
|
62304
|
+
${values?.map(
|
|
62305
|
+
(value) => (value.description ? ` /** ${value.description.value} */
|
|
62306
|
+
` : "") + ` readonly ${value.name.value}: "${value.name.value}";`
|
|
62307
|
+
).join("\n")}
|
|
62501
62308
|
}
|
|
62502
|
-
|
|
62309
|
+
${jsdoc}
|
|
62503
62310
|
export type ${name}$options = ValuesOf<typeof ${name}>
|
|
62504
62311
|
`;
|
|
62505
62312
|
}).join("");
|
|
@@ -62519,7 +62326,7 @@ async function schemaGenerator(config) {
|
|
|
62519
62326
|
await Promise.all([
|
|
62520
62327
|
fs_exports.writeFile(
|
|
62521
62328
|
config.definitionsSchemaPath,
|
|
62522
|
-
config.localSchema ?
|
|
62329
|
+
config.localSchema ? graphql23.printSchema(config.schema) : config.newSchema
|
|
62523
62330
|
),
|
|
62524
62331
|
fs_exports.writeFile(config.definitionsDocumentsPath, config.newDocuments),
|
|
62525
62332
|
definitionsGenerator(config)
|
|
@@ -64224,7 +64031,7 @@ function mergeGraphQLTypes(typeSource, config) {
|
|
|
64224
64031
|
}
|
|
64225
64032
|
|
|
64226
64033
|
// src/codegen/transforms/schema.ts
|
|
64227
|
-
import * as
|
|
64034
|
+
import * as graphql24 from "graphql";
|
|
64228
64035
|
async function graphqlExtensions(config, documents) {
|
|
64229
64036
|
let internalSchema = `
|
|
64230
64037
|
enum CachePolicy {
|
|
@@ -64347,7 +64154,7 @@ directive @${config.componentFieldDirective}(field: String!, prop: String, expor
|
|
|
64347
64154
|
const args = fragmentArguments(config, "", field.parent);
|
|
64348
64155
|
if (args.length > 0) {
|
|
64349
64156
|
argString = "(" + args.map((arg) => {
|
|
64350
|
-
const typeName =
|
|
64157
|
+
const typeName = graphql24.print(arg.type);
|
|
64351
64158
|
return `${arg.name}:${typeName}${arg.required ? "!" : ""}`;
|
|
64352
64159
|
}).join("\n") + ")";
|
|
64353
64160
|
}
|
|
@@ -64357,20 +64164,20 @@ directive @${config.componentFieldDirective}(field: String!, prop: String, expor
|
|
|
64357
64164
|
`;
|
|
64358
64165
|
}).join("\n");
|
|
64359
64166
|
extensions += `${Object.keys(config.configFile.features?.runtimeScalars ?? {}).map((scalar) => `scalar ${scalar}`).join("\n")}`;
|
|
64360
|
-
config.newSchema =
|
|
64167
|
+
config.newSchema = graphql24.print(mergeTypeDefs([internalSchema, config.newSchema]));
|
|
64361
64168
|
config.schemaString += extensions;
|
|
64362
|
-
config.schema =
|
|
64363
|
-
|
|
64364
|
-
mergeTypeDefs([
|
|
64169
|
+
config.schema = graphql24.buildSchema(
|
|
64170
|
+
graphql24.print(
|
|
64171
|
+
mergeTypeDefs([graphql24.printSchema(config.schema), internalSchema, extensions])
|
|
64365
64172
|
)
|
|
64366
64173
|
);
|
|
64367
64174
|
}
|
|
64368
64175
|
|
|
64369
64176
|
// src/codegen/transforms/typename.ts
|
|
64370
|
-
import * as
|
|
64177
|
+
import * as graphql25 from "graphql";
|
|
64371
64178
|
async function addTypename(config, documents) {
|
|
64372
64179
|
for (const doc of documents) {
|
|
64373
|
-
doc.document =
|
|
64180
|
+
doc.document = graphql25.visit(doc.document, {
|
|
64374
64181
|
Field(node, key, parent2, path2, ancestors) {
|
|
64375
64182
|
if (!node.selectionSet) {
|
|
64376
64183
|
return;
|
|
@@ -64382,7 +64189,7 @@ async function addTypename(config, documents) {
|
|
|
64382
64189
|
);
|
|
64383
64190
|
const field = type.getFields()[node.name.value];
|
|
64384
64191
|
const fieldType = unwrapType(config, field.type).type;
|
|
64385
|
-
if (
|
|
64192
|
+
if (graphql25.isInterfaceType(fieldType) || graphql25.isUnionType(fieldType)) {
|
|
64386
64193
|
return {
|
|
64387
64194
|
...node,
|
|
64388
64195
|
selectionSet: {
|
|
@@ -64390,9 +64197,9 @@ async function addTypename(config, documents) {
|
|
|
64390
64197
|
selections: [
|
|
64391
64198
|
...node.selectionSet.selections,
|
|
64392
64199
|
{
|
|
64393
|
-
kind:
|
|
64200
|
+
kind: graphql25.Kind.FIELD,
|
|
64394
64201
|
name: {
|
|
64395
|
-
kind:
|
|
64202
|
+
kind: graphql25.Kind.NAME,
|
|
64396
64203
|
value: "__typename"
|
|
64397
64204
|
}
|
|
64398
64205
|
}
|
|
@@ -64409,9 +64216,9 @@ async function addTypename(config, documents) {
|
|
|
64409
64216
|
selections: [
|
|
64410
64217
|
...node.selectionSet.selections,
|
|
64411
64218
|
{
|
|
64412
|
-
kind:
|
|
64219
|
+
kind: graphql25.Kind.FIELD,
|
|
64413
64220
|
name: {
|
|
64414
|
-
kind:
|
|
64221
|
+
kind: graphql25.Kind.NAME,
|
|
64415
64222
|
value: "__typename"
|
|
64416
64223
|
}
|
|
64417
64224
|
}
|
|
@@ -64424,10 +64231,10 @@ async function addTypename(config, documents) {
|
|
|
64424
64231
|
}
|
|
64425
64232
|
|
|
64426
64233
|
// src/codegen/transforms/addID.ts
|
|
64427
|
-
import * as
|
|
64234
|
+
import * as graphql26 from "graphql";
|
|
64428
64235
|
async function addID(config, documents) {
|
|
64429
64236
|
for (const doc of documents) {
|
|
64430
|
-
doc.document =
|
|
64237
|
+
doc.document = graphql26.visit(doc.document, {
|
|
64431
64238
|
Field(node, key, parent2, path2, ancestors) {
|
|
64432
64239
|
if (!node.selectionSet) {
|
|
64433
64240
|
return;
|
|
@@ -64465,7 +64272,7 @@ function addKeysToSelection(config, node, fieldType) {
|
|
|
64465
64272
|
if (!node.selectionSet || node.selectionSet.selections.length == 0) {
|
|
64466
64273
|
return;
|
|
64467
64274
|
}
|
|
64468
|
-
if (!
|
|
64275
|
+
if (!graphql26.isObjectType(fieldType) && !graphql26.isInterfaceType(fieldType)) {
|
|
64469
64276
|
return;
|
|
64470
64277
|
}
|
|
64471
64278
|
const keyFields = config.keyFieldsForType(fieldType.name);
|
|
@@ -64480,9 +64287,9 @@ function addKeysToSelection(config, node, fieldType) {
|
|
|
64480
64287
|
continue;
|
|
64481
64288
|
}
|
|
64482
64289
|
selections.push({
|
|
64483
|
-
kind:
|
|
64290
|
+
kind: graphql26.Kind.FIELD,
|
|
64484
64291
|
name: {
|
|
64485
|
-
kind:
|
|
64292
|
+
kind: graphql26.Kind.NAME,
|
|
64486
64293
|
value: keyField
|
|
64487
64294
|
}
|
|
64488
64295
|
});
|
|
@@ -64497,13 +64304,13 @@ function addKeysToSelection(config, node, fieldType) {
|
|
|
64497
64304
|
}
|
|
64498
64305
|
|
|
64499
64306
|
// src/codegen/transforms/componentFields.ts
|
|
64500
|
-
import * as
|
|
64307
|
+
import * as graphql27 from "graphql";
|
|
64501
64308
|
async function componentFields(config, documents) {
|
|
64502
64309
|
for (const document of documents) {
|
|
64503
|
-
const typeInfo = new
|
|
64504
|
-
document.document =
|
|
64310
|
+
const typeInfo = new graphql27.TypeInfo(config.schema);
|
|
64311
|
+
document.document = graphql27.visit(
|
|
64505
64312
|
document.document,
|
|
64506
|
-
|
|
64313
|
+
graphql27.visitWithTypeInfo(typeInfo, {
|
|
64507
64314
|
Field(node) {
|
|
64508
64315
|
const parentType = typeInfo.getParentType();
|
|
64509
64316
|
if (!parentType) {
|
|
@@ -64552,10 +64359,10 @@ async function componentFields(config, documents) {
|
|
|
64552
64359
|
}
|
|
64553
64360
|
|
|
64554
64361
|
// src/codegen/transforms/runtimeScalars.ts
|
|
64555
|
-
import * as
|
|
64362
|
+
import * as graphql28 from "graphql";
|
|
64556
64363
|
async function addTypename2(config, documents) {
|
|
64557
64364
|
for (const doc of documents) {
|
|
64558
|
-
doc.document =
|
|
64365
|
+
doc.document = graphql28.visit(doc.document, {
|
|
64559
64366
|
VariableDefinition(node) {
|
|
64560
64367
|
const { type, wrappers } = unwrapType(config, node.type);
|
|
64561
64368
|
const runtimeScalar = config.configFile.features?.runtimeScalars?.[type.name];
|
|
@@ -64594,7 +64401,7 @@ async function addTypename2(config, documents) {
|
|
|
64594
64401
|
}
|
|
64595
64402
|
|
|
64596
64403
|
// src/codegen/validators/typeCheck.ts
|
|
64597
|
-
import * as
|
|
64404
|
+
import * as graphql29 from "graphql";
|
|
64598
64405
|
async function typeCheck(config, docs) {
|
|
64599
64406
|
const errors = [];
|
|
64600
64407
|
const freeLists = [];
|
|
@@ -64602,7 +64409,7 @@ async function typeCheck(config, docs) {
|
|
|
64602
64409
|
const listTypes = [];
|
|
64603
64410
|
const fragments = {};
|
|
64604
64411
|
for (const { document: parsed, originalString, filename } of docs) {
|
|
64605
|
-
|
|
64412
|
+
graphql29.visit(parsed, {
|
|
64606
64413
|
FragmentDefinition(definition) {
|
|
64607
64414
|
fragments[definition.name.value] = definition;
|
|
64608
64415
|
},
|
|
@@ -64647,14 +64454,14 @@ async function typeCheck(config, docs) {
|
|
|
64647
64454
|
);
|
|
64648
64455
|
return;
|
|
64649
64456
|
}
|
|
64650
|
-
if (
|
|
64457
|
+
if (graphql29.isListType(rootType) || graphql29.isNonNullType(rootType) && graphql29.isListType(rootType.ofType)) {
|
|
64651
64458
|
needsParent = true;
|
|
64652
64459
|
break;
|
|
64653
64460
|
}
|
|
64654
|
-
if (
|
|
64461
|
+
if (graphql29.isNonNullType(rootType) && "ofType" in rootType) {
|
|
64655
64462
|
rootType = rootType.ofType;
|
|
64656
64463
|
}
|
|
64657
|
-
if (
|
|
64464
|
+
if (graphql29.isScalarType(rootType)) {
|
|
64658
64465
|
break;
|
|
64659
64466
|
}
|
|
64660
64467
|
rootType = rootType?.getFields()[parent3.name.value]?.type;
|
|
@@ -64730,9 +64537,9 @@ async function typeCheck(config, docs) {
|
|
|
64730
64537
|
);
|
|
64731
64538
|
}
|
|
64732
64539
|
let targetTypes = [type];
|
|
64733
|
-
if (
|
|
64540
|
+
if (graphql29.isUnionType(type)) {
|
|
64734
64541
|
targetTypes = config.schema.getPossibleTypes(type);
|
|
64735
|
-
} else if (
|
|
64542
|
+
} else if (graphql29.isInterfaceType(type)) {
|
|
64736
64543
|
try {
|
|
64737
64544
|
for (const key of config.keyFieldsForType(type.name)) {
|
|
64738
64545
|
if (!type.getFields()[key]) {
|
|
@@ -64768,13 +64575,13 @@ async function typeCheck(config, docs) {
|
|
|
64768
64575
|
if (errors.length > 0) {
|
|
64769
64576
|
throw errors;
|
|
64770
64577
|
}
|
|
64771
|
-
const rules = (filepath) => [...
|
|
64578
|
+
const rules = (filepath) => [...graphql29.specifiedRules].filter(
|
|
64772
64579
|
(rule) => ![
|
|
64773
|
-
|
|
64774
|
-
|
|
64775
|
-
|
|
64776
|
-
|
|
64777
|
-
|
|
64580
|
+
graphql29.NoUnusedFragmentsRule,
|
|
64581
|
+
graphql29.KnownFragmentNamesRule,
|
|
64582
|
+
graphql29.ExecutableDefinitionsRule,
|
|
64583
|
+
graphql29.KnownDirectivesRule,
|
|
64584
|
+
graphql29.KnownArgumentNamesRule
|
|
64778
64585
|
].includes(rule)
|
|
64779
64586
|
).concat(
|
|
64780
64587
|
validateLists({
|
|
@@ -64795,7 +64602,7 @@ async function typeCheck(config, docs) {
|
|
|
64795
64602
|
validateLoadingDirective(config)
|
|
64796
64603
|
);
|
|
64797
64604
|
for (const { filename, document: parsed, originalString } of docs) {
|
|
64798
|
-
for (const error of
|
|
64605
|
+
for (const error of graphql29.validate(config.schema, parsed, rules(filename))) {
|
|
64799
64606
|
errors.push(
|
|
64800
64607
|
new HoudiniError({
|
|
64801
64608
|
filepath: filename,
|
|
@@ -64824,20 +64631,20 @@ function validateRequiredDirective(config, filepath) {
|
|
|
64824
64631
|
if (!node.directives?.some(({ name }) => name.value === config.requiredDirective))
|
|
64825
64632
|
return;
|
|
64826
64633
|
const parentType = parentTypeFromAncestors(config.schema, filepath, ancestors);
|
|
64827
|
-
if (!
|
|
64634
|
+
if (!graphql29.isObjectType(parentType)) {
|
|
64828
64635
|
ctx.reportError(
|
|
64829
|
-
new
|
|
64636
|
+
new graphql29.GraphQLError(
|
|
64830
64637
|
`@${config.requiredDirective} may only be used on objects, not arguments`
|
|
64831
64638
|
)
|
|
64832
64639
|
);
|
|
64833
64640
|
return;
|
|
64834
64641
|
}
|
|
64835
64642
|
const type = parentType.getFields()[node.name.value].type;
|
|
64836
|
-
const isServerNullable = !
|
|
64643
|
+
const isServerNullable = !graphql29.isNonNullType(type);
|
|
64837
64644
|
const isAlreadyClientNullable = isClientNullable(node, true);
|
|
64838
64645
|
if (!isServerNullable && !isAlreadyClientNullable) {
|
|
64839
64646
|
ctx.reportError(
|
|
64840
|
-
new
|
|
64647
|
+
new graphql29.GraphQLError(
|
|
64841
64648
|
`@${config.requiredDirective} may only be used on nullable fields`
|
|
64842
64649
|
)
|
|
64843
64650
|
);
|
|
@@ -64859,7 +64666,7 @@ var validateLists = ({
|
|
|
64859
64666
|
if (!config.isListFragment(node.name.value)) {
|
|
64860
64667
|
if (!fragments[node.name.value]) {
|
|
64861
64668
|
ctx.reportError(
|
|
64862
|
-
new
|
|
64669
|
+
new graphql29.GraphQLError(
|
|
64863
64670
|
"Encountered unknown fragment: " + node.name.value
|
|
64864
64671
|
)
|
|
64865
64672
|
);
|
|
@@ -64869,7 +64676,7 @@ var validateLists = ({
|
|
|
64869
64676
|
const listName = config.listNameFromFragment(node.name.value);
|
|
64870
64677
|
if (!lists.includes(listName)) {
|
|
64871
64678
|
ctx.reportError(
|
|
64872
|
-
new
|
|
64679
|
+
new graphql29.GraphQLError(
|
|
64873
64680
|
"Encountered fragment referencing unknown list: " + listName
|
|
64874
64681
|
)
|
|
64875
64682
|
);
|
|
@@ -64894,7 +64701,7 @@ var validateLists = ({
|
|
|
64894
64701
|
);
|
|
64895
64702
|
if (parentArg) {
|
|
64896
64703
|
ctx.reportError(
|
|
64897
|
-
new
|
|
64704
|
+
new graphql29.GraphQLError(
|
|
64898
64705
|
`@${config.deprecatedlistDirectiveParentIDArg} should be defined only in it's own directive now`
|
|
64899
64706
|
)
|
|
64900
64707
|
);
|
|
@@ -64910,7 +64717,7 @@ var validateLists = ({
|
|
|
64910
64717
|
return;
|
|
64911
64718
|
}
|
|
64912
64719
|
ctx.reportError(
|
|
64913
|
-
new
|
|
64720
|
+
new graphql29.GraphQLError(
|
|
64914
64721
|
`For this list fragment, you need to add or @${config.listParentDirective} or @${config.listAllListsDirective} directive to specify the behavior`
|
|
64915
64722
|
)
|
|
64916
64723
|
);
|
|
@@ -64920,7 +64727,7 @@ var validateLists = ({
|
|
|
64920
64727
|
const directiveName = node.name.value;
|
|
64921
64728
|
if (directiveName === "connection") {
|
|
64922
64729
|
ctx.reportError(
|
|
64923
|
-
new
|
|
64730
|
+
new graphql29.GraphQLError(
|
|
64924
64731
|
"@connection was renamed to @list. Please change your components. If you were using `cache.connection` in your components, you will need to update that to `cache.list` too."
|
|
64925
64732
|
)
|
|
64926
64733
|
);
|
|
@@ -64929,7 +64736,7 @@ var validateLists = ({
|
|
|
64929
64736
|
if (!config.isInternalDirective(node.name.value)) {
|
|
64930
64737
|
if (!config.schema.getDirective(directiveName)) {
|
|
64931
64738
|
ctx.reportError(
|
|
64932
|
-
new
|
|
64739
|
+
new graphql29.GraphQLError(
|
|
64933
64740
|
"Encountered unknown directive: " + directiveName
|
|
64934
64741
|
)
|
|
64935
64742
|
);
|
|
@@ -64938,7 +64745,7 @@ var validateLists = ({
|
|
|
64938
64745
|
}
|
|
64939
64746
|
if (config.isListOperationDirective(directiveName) && !listTypes.includes(config.listNameFromDirective(directiveName))) {
|
|
64940
64747
|
ctx.reportError(
|
|
64941
|
-
new
|
|
64748
|
+
new graphql29.GraphQLError(
|
|
64942
64749
|
"Encountered directive referencing unknown list: " + directiveName
|
|
64943
64750
|
)
|
|
64944
64751
|
);
|
|
@@ -64949,7 +64756,7 @@ var validateLists = ({
|
|
|
64949
64756
|
};
|
|
64950
64757
|
function knownArguments(config) {
|
|
64951
64758
|
return function(ctx) {
|
|
64952
|
-
const nativeValidator =
|
|
64759
|
+
const nativeValidator = graphql29.KnownArgumentNamesRule(ctx);
|
|
64953
64760
|
return {
|
|
64954
64761
|
...nativeValidator,
|
|
64955
64762
|
Directive(directiveNode) {
|
|
@@ -64984,7 +64791,7 @@ function validateFragmentArguments(config, filepath, fragments) {
|
|
|
64984
64791
|
for (const arg of node.arguments || []) {
|
|
64985
64792
|
if (arg.value.kind !== "ObjectValue") {
|
|
64986
64793
|
ctx.reportError(
|
|
64987
|
-
new
|
|
64794
|
+
new graphql29.GraphQLError("values in @arguments must be an object")
|
|
64988
64795
|
);
|
|
64989
64796
|
return;
|
|
64990
64797
|
}
|
|
@@ -64994,13 +64801,13 @@ function validateFragmentArguments(config, filepath, fragments) {
|
|
|
64994
64801
|
);
|
|
64995
64802
|
if (!typeArg) {
|
|
64996
64803
|
ctx.reportError(
|
|
64997
|
-
new
|
|
64804
|
+
new graphql29.GraphQLError("missing type field for @arguments directive")
|
|
64998
64805
|
);
|
|
64999
64806
|
return;
|
|
65000
64807
|
}
|
|
65001
|
-
if (typeArg.value.kind !==
|
|
64808
|
+
if (typeArg.value.kind !== graphql29.Kind.STRING) {
|
|
65002
64809
|
ctx.reportError(
|
|
65003
|
-
new
|
|
64810
|
+
new graphql29.GraphQLError("type field to @arguments must be a string")
|
|
65004
64811
|
);
|
|
65005
64812
|
return;
|
|
65006
64813
|
}
|
|
@@ -65013,7 +64820,7 @@ function validateFragmentArguments(config, filepath, fragments) {
|
|
|
65013
64820
|
);
|
|
65014
64821
|
if (typeArg.value.value !== defaultValueType) {
|
|
65015
64822
|
ctx.reportError(
|
|
65016
|
-
new
|
|
64823
|
+
new graphql29.GraphQLError(
|
|
65017
64824
|
`Invalid default value provided for ${arg.name.value}. Expected ${typeArg.value.value}, found ${defaultValueType}`
|
|
65018
64825
|
)
|
|
65019
64826
|
);
|
|
@@ -65031,7 +64838,7 @@ function validateFragmentArguments(config, filepath, fragments) {
|
|
|
65031
64838
|
try {
|
|
65032
64839
|
args = fragmentArguments(config, filepath, fragments[fragmentName]);
|
|
65033
64840
|
} catch (e) {
|
|
65034
|
-
ctx.reportError(new
|
|
64841
|
+
ctx.reportError(new graphql29.GraphQLError(e.message));
|
|
65035
64842
|
return;
|
|
65036
64843
|
}
|
|
65037
64844
|
fragmentArguments2[fragmentName] = args;
|
|
@@ -65054,7 +64861,7 @@ function validateFragmentArguments(config, filepath, fragments) {
|
|
|
65054
64861
|
);
|
|
65055
64862
|
if (missing.length > 0) {
|
|
65056
64863
|
ctx.reportError(
|
|
65057
|
-
new
|
|
64864
|
+
new graphql29.GraphQLError(
|
|
65058
64865
|
`The following arguments are missing from the "${fragmentName}" fragment: ` + JSON.stringify(missing)
|
|
65059
64866
|
)
|
|
65060
64867
|
);
|
|
@@ -65065,7 +64872,7 @@ function validateFragmentArguments(config, filepath, fragments) {
|
|
|
65065
64872
|
);
|
|
65066
64873
|
if (unknown.length > 0) {
|
|
65067
64874
|
ctx.reportError(
|
|
65068
|
-
new
|
|
64875
|
+
new graphql29.GraphQLError(
|
|
65069
64876
|
"Encountered unknown arguments: " + JSON.stringify(unknown)
|
|
65070
64877
|
)
|
|
65071
64878
|
);
|
|
@@ -65077,7 +64884,7 @@ function validateFragmentArguments(config, filepath, fragments) {
|
|
|
65077
64884
|
for (const [applied, target] of zipped) {
|
|
65078
64885
|
if (!valueIsType(config, applied.value, target)) {
|
|
65079
64886
|
ctx.reportError(
|
|
65080
|
-
new
|
|
64887
|
+
new graphql29.GraphQLError(
|
|
65081
64888
|
`Invalid argument type. Expected ${target}, found ${applied.value.kind}`
|
|
65082
64889
|
)
|
|
65083
64890
|
);
|
|
@@ -65119,7 +64926,7 @@ function valueIsType(config, value, targetType) {
|
|
|
65119
64926
|
}
|
|
65120
64927
|
if (value.kind === "EnumValue" && targetType.kind === "NamedType") {
|
|
65121
64928
|
const enumType = config.schema.getType(targetType.name.value);
|
|
65122
|
-
if (!
|
|
64929
|
+
if (!graphql29.isEnumType(enumType)) {
|
|
65123
64930
|
return false;
|
|
65124
64931
|
}
|
|
65125
64932
|
return enumType.getValues().some((enumValue) => enumValue.value === value.value);
|
|
@@ -65139,7 +64946,7 @@ function paginateArgs(config, filepath) {
|
|
|
65139
64946
|
}
|
|
65140
64947
|
if (alreadyPaginated) {
|
|
65141
64948
|
ctx.reportError(
|
|
65142
|
-
new
|
|
64949
|
+
new graphql29.GraphQLError(
|
|
65143
64950
|
`@${config.paginateDirective} can only appear in a document once.`
|
|
65144
64951
|
)
|
|
65145
64952
|
);
|
|
@@ -65171,7 +64978,7 @@ function paginateArgs(config, filepath) {
|
|
|
65171
64978
|
const backwards = appliedArgs.has("last");
|
|
65172
64979
|
if (!forward && !backwards) {
|
|
65173
64980
|
ctx.reportError(
|
|
65174
|
-
new
|
|
64981
|
+
new graphql29.GraphQLError(
|
|
65175
64982
|
"A field with cursor-based pagination must have a first or last argument"
|
|
65176
64983
|
)
|
|
65177
64984
|
);
|
|
@@ -65185,7 +64992,7 @@ function paginateArgs(config, filepath) {
|
|
|
65185
64992
|
}
|
|
65186
64993
|
if (forward && backwards && paginateMode === "Infinite") {
|
|
65187
64994
|
ctx.reportError(
|
|
65188
|
-
new
|
|
64995
|
+
new graphql29.GraphQLError(
|
|
65189
64996
|
`A field with cursor pagination cannot go forwards an backwards simultaneously`
|
|
65190
64997
|
)
|
|
65191
64998
|
);
|
|
@@ -65199,7 +65006,7 @@ function paginateArgs(config, filepath) {
|
|
|
65199
65006
|
);
|
|
65200
65007
|
if (!appliedLimitArg) {
|
|
65201
65008
|
ctx.reportError(
|
|
65202
|
-
new
|
|
65009
|
+
new graphql29.GraphQLError(
|
|
65203
65010
|
"A field with offset-based pagination must have a limit argument"
|
|
65204
65011
|
)
|
|
65205
65012
|
);
|
|
@@ -65215,20 +65022,20 @@ function noUnusedFragmentArguments(config) {
|
|
|
65215
65022
|
const args = /* @__PURE__ */ new Set();
|
|
65216
65023
|
return {
|
|
65217
65024
|
enter(node) {
|
|
65218
|
-
if (node.kind ===
|
|
65025
|
+
if (node.kind === graphql29.Kind.FRAGMENT_DEFINITION) {
|
|
65219
65026
|
const definitionArguments = node.directives?.filter((directive) => directive.name.value === config.argumentsDirective).flatMap((directive) => directive.arguments);
|
|
65220
65027
|
for (const arg of definitionArguments?.map((arg2) => arg2?.name.value) || []) {
|
|
65221
65028
|
args.add(arg);
|
|
65222
65029
|
}
|
|
65223
|
-
} else if (node.kind ===
|
|
65030
|
+
} else if (node.kind === graphql29.Kind.VARIABLE) {
|
|
65224
65031
|
args.delete(node.name.value);
|
|
65225
65032
|
}
|
|
65226
65033
|
},
|
|
65227
65034
|
leave(node) {
|
|
65228
|
-
if (node.kind ===
|
|
65035
|
+
if (node.kind === graphql29.Kind.FRAGMENT_DEFINITION) {
|
|
65229
65036
|
if (args.size > 0) {
|
|
65230
65037
|
ctx.reportError(
|
|
65231
|
-
new
|
|
65038
|
+
new graphql29.GraphQLError(
|
|
65232
65039
|
"Encountered unused fragment arguments: " + [...args].join(",")
|
|
65233
65040
|
)
|
|
65234
65041
|
);
|
|
@@ -65264,7 +65071,7 @@ function nodeDirectives(config, directives) {
|
|
|
65264
65071
|
if (definition.kind === "OperationDefinition") {
|
|
65265
65072
|
if (definition.operation !== "query") {
|
|
65266
65073
|
ctx.reportError(
|
|
65267
|
-
new
|
|
65074
|
+
new graphql29.GraphQLError(
|
|
65268
65075
|
`@${node.name.value} must fall on a fragment or query document`
|
|
65269
65076
|
)
|
|
65270
65077
|
);
|
|
@@ -65276,7 +65083,7 @@ function nodeDirectives(config, directives) {
|
|
|
65276
65083
|
}
|
|
65277
65084
|
if (!possibleNodes.includes(definitionType)) {
|
|
65278
65085
|
ctx.reportError(
|
|
65279
|
-
new
|
|
65086
|
+
new graphql29.GraphQLError(paginateOnNonNodeMessage(node.name.value))
|
|
65280
65087
|
);
|
|
65281
65088
|
}
|
|
65282
65089
|
}
|
|
@@ -65295,7 +65102,7 @@ function checkMutationOperation(config) {
|
|
|
65295
65102
|
);
|
|
65296
65103
|
if (append && prepend) {
|
|
65297
65104
|
ctx.reportError(
|
|
65298
|
-
new
|
|
65105
|
+
new graphql29.GraphQLError(
|
|
65299
65106
|
`You can't apply both @${config.listPrependDirective} and @${config.listAppendDirective} at the same time`
|
|
65300
65107
|
)
|
|
65301
65108
|
);
|
|
@@ -65309,7 +65116,7 @@ function checkMutationOperation(config) {
|
|
|
65309
65116
|
);
|
|
65310
65117
|
if (parentId && allLists) {
|
|
65311
65118
|
ctx.reportError(
|
|
65312
|
-
new
|
|
65119
|
+
new graphql29.GraphQLError(
|
|
65313
65120
|
`You can't apply both @${config.listParentDirective} and @${config.listAllListsDirective} at the same time`
|
|
65314
65121
|
)
|
|
65315
65122
|
);
|
|
@@ -65331,7 +65138,7 @@ function checkMaskDirectives(config) {
|
|
|
65331
65138
|
);
|
|
65332
65139
|
if (maskEnableDirective && maskDisableDirective) {
|
|
65333
65140
|
ctx.reportError(
|
|
65334
|
-
new
|
|
65141
|
+
new graphql29.GraphQLError(
|
|
65335
65142
|
`You can't apply both @${config.maskEnableDirective} and @${config.maskDisableDirective} at the same time`
|
|
65336
65143
|
)
|
|
65337
65144
|
);
|
|
@@ -65373,7 +65180,7 @@ function validateLoadingDirective(config) {
|
|
|
65373
65180
|
);
|
|
65374
65181
|
if (!parentLoading && !global2) {
|
|
65375
65182
|
ctx.reportError(
|
|
65376
|
-
new
|
|
65183
|
+
new graphql29.GraphQLError(
|
|
65377
65184
|
`@${config.loadingDirective} can only be applied on a field or fragment spread at the root of a document or on one whose parent also has @${config.loadingDirective}`
|
|
65378
65185
|
)
|
|
65379
65186
|
);
|
|
@@ -65395,7 +65202,7 @@ function validateLoadingDirective(config) {
|
|
|
65395
65202
|
);
|
|
65396
65203
|
if (!parentLoading && !global2) {
|
|
65397
65204
|
ctx.reportError(
|
|
65398
|
-
new
|
|
65205
|
+
new graphql29.GraphQLError(
|
|
65399
65206
|
`@${config.loadingDirective} can only be applied on a field or fragment spread at the root of a document or on one whose parent also has @${config.loadingDirective}`
|
|
65400
65207
|
)
|
|
65401
65208
|
);
|
|
@@ -65410,7 +65217,7 @@ function getAndVerifyNodeInterface(config) {
|
|
|
65410
65217
|
if (!nodeInterface) {
|
|
65411
65218
|
return null;
|
|
65412
65219
|
}
|
|
65413
|
-
if (!
|
|
65220
|
+
if (!graphql29.isInterfaceType(nodeInterface)) {
|
|
65414
65221
|
displayInvalidNodeFieldMessage(config);
|
|
65415
65222
|
return null;
|
|
65416
65223
|
}
|
|
@@ -65505,11 +65312,11 @@ async function uniqueDocumentNames(config, docs) {
|
|
|
65505
65312
|
}
|
|
65506
65313
|
|
|
65507
65314
|
// src/codegen/validators/noIDAlias.ts
|
|
65508
|
-
import * as
|
|
65315
|
+
import * as graphql30 from "graphql";
|
|
65509
65316
|
async function noIDAlias(config, docs) {
|
|
65510
65317
|
const errors = [];
|
|
65511
65318
|
for (const { filename, document } of docs) {
|
|
65512
|
-
|
|
65319
|
+
graphql30.visit(document, {
|
|
65513
65320
|
Field(node, _, __, ___, ancestors) {
|
|
65514
65321
|
const fieldType = parentTypeFromAncestors(config.schema, filename, ancestors).name;
|
|
65515
65322
|
if (config.keyFieldsForType(fieldType).includes(node.alias?.value || "")) {
|
|
@@ -65548,11 +65355,11 @@ async function validatePlugins(config, documents) {
|
|
|
65548
65355
|
}
|
|
65549
65356
|
|
|
65550
65357
|
// src/codegen/validators/componentFields.ts
|
|
65551
|
-
import * as
|
|
65358
|
+
import * as graphql31 from "graphql";
|
|
65552
65359
|
async function componentFields2(config, docs) {
|
|
65553
65360
|
const errors = [];
|
|
65554
65361
|
for (const { filename: filepath, document } of docs) {
|
|
65555
|
-
|
|
65362
|
+
graphql31.visit(document, {
|
|
65556
65363
|
FragmentDefinition(node, _, __, ___, ancestors) {
|
|
65557
65364
|
const componentFieldDirective = node.directives?.find(
|
|
65558
65365
|
(dir) => dir.name.value === config.componentFieldDirective
|
|
@@ -65600,7 +65407,7 @@ async function componentFields2(config, docs) {
|
|
|
65600
65407
|
if (existingField && existingField.filepath !== filepath) {
|
|
65601
65408
|
conflict = true;
|
|
65602
65409
|
} else if (parentType && fieldValue) {
|
|
65603
|
-
const fieldDef =
|
|
65410
|
+
const fieldDef = graphql31.isObjectType(parentType) && parentType.getFields()[fieldValue];
|
|
65604
65411
|
if (fieldDef && !fieldDef.astNode?.directives?.find(
|
|
65605
65412
|
(dir) => dir.name.value === config.componentFieldDirective
|
|
65606
65413
|
)) {
|
|
@@ -65613,7 +65420,7 @@ async function componentFields2(config, docs) {
|
|
|
65613
65420
|
filepath
|
|
65614
65421
|
});
|
|
65615
65422
|
}
|
|
65616
|
-
if (parentType &&
|
|
65423
|
+
if (parentType && graphql31.isAbstractType(parentType)) {
|
|
65617
65424
|
errors.push({
|
|
65618
65425
|
message: `Cannot add component field ${parent2}.${fieldValue} because ${parent2} is an abstract type`,
|
|
65619
65426
|
filepath
|
|
@@ -65809,7 +65616,7 @@ function testConfigFile({ plugins, ...config } = {}) {
|
|
|
65809
65616
|
id: ID!
|
|
65810
65617
|
name(arg: Int): String!
|
|
65811
65618
|
birthday: DateTime!
|
|
65812
|
-
firstName: String!
|
|
65619
|
+
firstName: String! @deprecated(reason: "Use name instead")
|
|
65813
65620
|
friends: [User!]!
|
|
65814
65621
|
friendsByCursor(first: Int, after: String, last: Int, before: String, filter: String): UserConnection!
|
|
65815
65622
|
friendsByCursorSnapshot(snapshot: String!, first: Int, after: String, last: Int, before: String): UserConnection!
|
|
@@ -65839,13 +65646,22 @@ function testConfigFile({ plugins, ...config } = {}) {
|
|
|
65839
65646
|
believers(first: Int, after: String): GhostConnection
|
|
65840
65647
|
}
|
|
65841
65648
|
|
|
65649
|
+
"""
|
|
65650
|
+
Cat's documentation
|
|
65651
|
+
"""
|
|
65842
65652
|
type Cat implements Friend & Node {
|
|
65843
65653
|
id: ID!
|
|
65654
|
+
"""
|
|
65655
|
+
The name of the cat
|
|
65656
|
+
"""
|
|
65844
65657
|
name: String!
|
|
65845
65658
|
owner: User!
|
|
65846
65659
|
}
|
|
65847
65660
|
|
|
65848
65661
|
type Query {
|
|
65662
|
+
"""
|
|
65663
|
+
Get a user.
|
|
65664
|
+
"""
|
|
65849
65665
|
user: User!
|
|
65850
65666
|
entity: Entity!
|
|
65851
65667
|
version: Int!
|
|
@@ -66027,11 +65843,19 @@ function testConfigFile({ plugins, ...config } = {}) {
|
|
|
66027
65843
|
id: ID!
|
|
66028
65844
|
}
|
|
66029
65845
|
|
|
65846
|
+
"""
|
|
65847
|
+
Documentation of testenum1
|
|
65848
|
+
"""
|
|
66030
65849
|
enum TestEnum1 {
|
|
65850
|
+
"Documentation of Value1"
|
|
66031
65851
|
Value1
|
|
65852
|
+
"Documentation of Value2"
|
|
66032
65853
|
Value2
|
|
66033
65854
|
}
|
|
66034
65855
|
|
|
65856
|
+
"""
|
|
65857
|
+
Documentation of testenum2
|
|
65858
|
+
"""
|
|
66035
65859
|
enum TestEnum2 {
|
|
66036
65860
|
Value3
|
|
66037
65861
|
Value2
|
|
@@ -66116,7 +65940,7 @@ function pipelineTest(config, documents, shouldPass, testBody) {
|
|
|
66116
65940
|
};
|
|
66117
65941
|
}
|
|
66118
65942
|
function mockCollectedDoc(query2, data) {
|
|
66119
|
-
const parsed =
|
|
65943
|
+
const parsed = graphql33.parse(query2);
|
|
66120
65944
|
const name = parsed.definitions[0].name.value;
|
|
66121
65945
|
const operations = parsed.definitions;
|
|
66122
65946
|
let kind = ArtifactKind.Fragment;
|