houdini 1.2.44 → 1.2.46
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 +664 -848
- package/build/cmd-esm/index.js +514 -698
- package/build/codegen/generators/comments/jsdoc.d.ts +2 -0
- package/build/codegen-cjs/index.js +662 -846
- package/build/codegen-esm/index.js +512 -696
- 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 +726 -467
- package/build/lib-esm/index.js +720 -467
- 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/match.d.ts +3 -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/match.d.ts +3 -2
- package/build/runtime-cjs/router/match.js +11 -2
- package/build/runtime-cjs/router/server.js +1 -1
- 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/match.d.ts +3 -2
- package/build/runtime-esm/router/match.js +11 -2
- package/build/runtime-esm/router/server.js +1 -1
- package/build/runtime-esm/router/types.d.ts +3 -1
- package/build/test-cjs/index.js +677 -844
- package/build/test-esm/index.js +527 -694
- package/build/vite-cjs/index.js +786 -857
- package/build/vite-esm/index.js +636 -707
- 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);
|
|
@@ -57719,7 +57482,12 @@ function deepMerge2(filepath, ...targets) {
|
|
|
57719
57482
|
// src/lib/parse.ts
|
|
57720
57483
|
function parseJS(str, config) {
|
|
57721
57484
|
const defaultConfig = {
|
|
57722
|
-
plugins: [
|
|
57485
|
+
plugins: [
|
|
57486
|
+
"typescript",
|
|
57487
|
+
"importAssertions",
|
|
57488
|
+
"decorators-legacy",
|
|
57489
|
+
"explicitResourceManagement"
|
|
57490
|
+
],
|
|
57723
57491
|
sourceType: "module"
|
|
57724
57492
|
};
|
|
57725
57493
|
return (0, import_parser.parse)(str || "", config ? deepMerge2("", defaultConfig, config) : defaultConfig).program;
|
|
@@ -57791,16 +57559,162 @@ async function cleanupFiles(pathFolder, listOfObj) {
|
|
|
57791
57559
|
return allFilesNotInList;
|
|
57792
57560
|
}
|
|
57793
57561
|
|
|
57794
|
-
// src/lib/
|
|
57562
|
+
// src/lib/typescript.ts
|
|
57563
|
+
var recast2 = __toESM(require_main2(), 1);
|
|
57795
57564
|
import * as graphql4 from "graphql";
|
|
57565
|
+
var AST2 = recast2.types.builders;
|
|
57566
|
+
function unwrappedTsTypeReference(config, filepath, missingScalars, {
|
|
57567
|
+
type,
|
|
57568
|
+
wrappers
|
|
57569
|
+
}, body) {
|
|
57570
|
+
let result;
|
|
57571
|
+
if (graphql4.isScalarType(type)) {
|
|
57572
|
+
result = scalarPropertyValue(config, filepath, missingScalars, type, body, null);
|
|
57573
|
+
} else if (graphql4.isEnumType(type)) {
|
|
57574
|
+
result = enumReference(config, body, type.name);
|
|
57575
|
+
} else {
|
|
57576
|
+
result = AST2.tsTypeReference(AST2.identifier(type.name));
|
|
57577
|
+
}
|
|
57578
|
+
for (const toWrap of wrappers) {
|
|
57579
|
+
if (toWrap === "NonNull" /* NonNull */) {
|
|
57580
|
+
continue;
|
|
57581
|
+
} else if (toWrap === "Nullable" /* Nullable */) {
|
|
57582
|
+
result = nullableField(result, true);
|
|
57583
|
+
} else if (toWrap === "List" /* List */) {
|
|
57584
|
+
result = AST2.tsArrayType(AST2.tsParenthesizedType(result));
|
|
57585
|
+
}
|
|
57586
|
+
}
|
|
57587
|
+
return result;
|
|
57588
|
+
}
|
|
57589
|
+
function tsTypeReference(config, filepath, missingScalars, definition, body) {
|
|
57590
|
+
const { type, wrappers } = unwrapType(config, definition.type);
|
|
57591
|
+
return unwrappedTsTypeReference(
|
|
57592
|
+
config,
|
|
57593
|
+
filepath,
|
|
57594
|
+
missingScalars,
|
|
57595
|
+
{ type, wrappers },
|
|
57596
|
+
body
|
|
57597
|
+
);
|
|
57598
|
+
}
|
|
57599
|
+
function enumReference(config, body, name) {
|
|
57600
|
+
ensureImports({
|
|
57601
|
+
config,
|
|
57602
|
+
body,
|
|
57603
|
+
import: ["ValueOf"],
|
|
57604
|
+
importKind: "type",
|
|
57605
|
+
sourceModule: "$houdini/runtime/lib/types"
|
|
57606
|
+
});
|
|
57607
|
+
return AST2.tsTypeReference(
|
|
57608
|
+
AST2.identifier("ValueOf"),
|
|
57609
|
+
AST2.tsTypeParameterInstantiation([AST2.tsTypeQuery(AST2.identifier(name))])
|
|
57610
|
+
);
|
|
57611
|
+
}
|
|
57612
|
+
function readonlyProperty(prop, enable = true) {
|
|
57613
|
+
if (enable) {
|
|
57614
|
+
prop.readonly = true;
|
|
57615
|
+
}
|
|
57616
|
+
return prop;
|
|
57617
|
+
}
|
|
57618
|
+
function nullableField(inner, input = false) {
|
|
57619
|
+
const members = [inner, AST2.tsNullKeyword()];
|
|
57620
|
+
if (input) {
|
|
57621
|
+
members.push(AST2.tsUndefinedKeyword());
|
|
57622
|
+
}
|
|
57623
|
+
return AST2.tsUnionType(members);
|
|
57624
|
+
}
|
|
57625
|
+
function scalarPropertyValue(config, filepath, missingScalars, target, body, field) {
|
|
57626
|
+
if (config.configFile.features?.componentFields && target.name === config.componentScalar) {
|
|
57627
|
+
if (!field) {
|
|
57628
|
+
return AST2.tsNeverKeyword();
|
|
57629
|
+
}
|
|
57630
|
+
const component = config.componentFields[field.parent][field.field];
|
|
57631
|
+
const sourcePathRelative = path_exports.relative(
|
|
57632
|
+
path_exports.join(config.projectRoot, "src"),
|
|
57633
|
+
component.filepath
|
|
57634
|
+
);
|
|
57635
|
+
let sourcePathParsed = path_exports.parse(sourcePathRelative);
|
|
57636
|
+
let sourcePath = path_exports.join(sourcePathParsed.dir, sourcePathParsed.name);
|
|
57637
|
+
const localImport = ensureImports({
|
|
57638
|
+
config,
|
|
57639
|
+
body,
|
|
57640
|
+
import: "__component__" + component.fragment,
|
|
57641
|
+
sourceModule: path_exports.join(
|
|
57642
|
+
path_exports.relative(path_exports.dirname(filepath), config.projectRoot),
|
|
57643
|
+
"src",
|
|
57644
|
+
sourcePath
|
|
57645
|
+
)
|
|
57646
|
+
}) ?? "__component__" + component.fragment;
|
|
57647
|
+
const parameters = AST2.tsTypeReference(AST2.identifier("Parameters"));
|
|
57648
|
+
parameters.typeParameters = AST2.tsTypeParameterInstantiation([
|
|
57649
|
+
AST2.tsTypeQuery(AST2.identifier(localImport))
|
|
57650
|
+
]);
|
|
57651
|
+
const indexed = AST2.tsIndexedAccessType(
|
|
57652
|
+
parameters,
|
|
57653
|
+
AST2.tsLiteralType(AST2.numericLiteral(0))
|
|
57654
|
+
);
|
|
57655
|
+
const omit = AST2.tsTypeReference(AST2.identifier("Omit"));
|
|
57656
|
+
omit.typeParameters = AST2.tsTypeParameterInstantiation([
|
|
57657
|
+
indexed,
|
|
57658
|
+
AST2.tsLiteralType(AST2.stringLiteral(component.prop))
|
|
57659
|
+
]);
|
|
57660
|
+
const arg = AST2.identifier("props");
|
|
57661
|
+
arg.typeAnnotation = AST2.tsTypeAnnotation(omit);
|
|
57662
|
+
const returnType = AST2.tsTypeReference(AST2.identifier("ReturnType"));
|
|
57663
|
+
returnType.typeParameters = AST2.tsTypeParameterInstantiation([
|
|
57664
|
+
AST2.tsTypeQuery(AST2.identifier(localImport))
|
|
57665
|
+
]);
|
|
57666
|
+
const fnType = AST2.tsFunctionType([arg]);
|
|
57667
|
+
fnType.typeAnnotation = AST2.tsTypeAnnotation(returnType);
|
|
57668
|
+
return fnType;
|
|
57669
|
+
}
|
|
57670
|
+
switch (target.name) {
|
|
57671
|
+
case "String": {
|
|
57672
|
+
return AST2.tsStringKeyword();
|
|
57673
|
+
}
|
|
57674
|
+
case "Int": {
|
|
57675
|
+
return AST2.tsNumberKeyword();
|
|
57676
|
+
}
|
|
57677
|
+
case "Float": {
|
|
57678
|
+
return AST2.tsNumberKeyword();
|
|
57679
|
+
}
|
|
57680
|
+
case "Boolean": {
|
|
57681
|
+
return AST2.tsBooleanKeyword();
|
|
57682
|
+
}
|
|
57683
|
+
case "ID": {
|
|
57684
|
+
return AST2.tsStringKeyword();
|
|
57685
|
+
}
|
|
57686
|
+
default: {
|
|
57687
|
+
if (graphql4.isNonNullType(target) && "ofType" in target) {
|
|
57688
|
+
return scalarPropertyValue(
|
|
57689
|
+
config,
|
|
57690
|
+
filepath,
|
|
57691
|
+
missingScalars,
|
|
57692
|
+
target.ofType,
|
|
57693
|
+
body,
|
|
57694
|
+
field
|
|
57695
|
+
);
|
|
57696
|
+
}
|
|
57697
|
+
if (config.scalars?.[target.name]) {
|
|
57698
|
+
return AST2.tsTypeReference(AST2.identifier(config.scalars?.[target.name].type));
|
|
57699
|
+
}
|
|
57700
|
+
if (target.name !== config.componentScalar) {
|
|
57701
|
+
missingScalars.add(target.name);
|
|
57702
|
+
}
|
|
57703
|
+
return AST2.tsAnyKeyword();
|
|
57704
|
+
}
|
|
57705
|
+
}
|
|
57706
|
+
}
|
|
57707
|
+
|
|
57708
|
+
// src/lib/walk.ts
|
|
57709
|
+
import * as graphql5 from "graphql";
|
|
57796
57710
|
|
|
57797
57711
|
// src/lib/router/manifest.ts
|
|
57798
57712
|
var t = __toESM(require_lib6(), 1);
|
|
57799
|
-
import * as
|
|
57713
|
+
import * as graphql6 from "graphql";
|
|
57800
57714
|
|
|
57801
57715
|
// src/codegen/generators/artifacts/index.ts
|
|
57802
|
-
var
|
|
57803
|
-
import * as
|
|
57716
|
+
var recast5 = __toESM(require_main2(), 1);
|
|
57717
|
+
import * as graphql17 from "graphql";
|
|
57804
57718
|
|
|
57805
57719
|
// src/codegen/utils/commonjs.ts
|
|
57806
57720
|
var cjsIndexFilePreamble = `"use strict";
|
|
@@ -58042,19 +57956,19 @@ var FieldCollection = class {
|
|
|
58042
57956
|
};
|
|
58043
57957
|
|
|
58044
57958
|
// src/codegen/utils/moduleExport.ts
|
|
58045
|
-
var
|
|
58046
|
-
var
|
|
57959
|
+
var recast3 = __toESM(require_main2(), 1);
|
|
57960
|
+
var AST3 = recast3.types.builders;
|
|
58047
57961
|
function moduleExport(config, key, value) {
|
|
58048
57962
|
if (config.module === "commonjs") {
|
|
58049
|
-
let target =
|
|
57963
|
+
let target = AST3.memberExpression(AST3.identifier("module"), AST3.identifier("exports"));
|
|
58050
57964
|
if (key !== "default") {
|
|
58051
|
-
target =
|
|
57965
|
+
target = AST3.memberExpression(target, AST3.identifier(key));
|
|
58052
57966
|
}
|
|
58053
|
-
return
|
|
57967
|
+
return AST3.expressionStatement(AST3.assignmentExpression("=", target, value));
|
|
58054
57968
|
}
|
|
58055
|
-
return key === "default" ?
|
|
58056
|
-
|
|
58057
|
-
|
|
57969
|
+
return key === "default" ? AST3.exportDefaultDeclaration(value) : AST3.exportNamedDeclaration(
|
|
57970
|
+
AST3.variableDeclaration("const", [
|
|
57971
|
+
AST3.variableDeclarator(AST3.identifier(key), value)
|
|
58058
57972
|
])
|
|
58059
57973
|
);
|
|
58060
57974
|
}
|
|
@@ -58311,7 +58225,7 @@ var serialize = (value, { json, lossy } = {}) => {
|
|
|
58311
58225
|
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
58226
|
|
|
58313
58227
|
// src/codegen/transforms/fragmentVariables.ts
|
|
58314
|
-
import * as
|
|
58228
|
+
import * as graphql8 from "graphql";
|
|
58315
58229
|
|
|
58316
58230
|
// src/codegen/utils/stripLoc.ts
|
|
58317
58231
|
function stripLoc(value) {
|
|
@@ -58332,7 +58246,7 @@ function stripLoc(value) {
|
|
|
58332
58246
|
}
|
|
58333
58247
|
|
|
58334
58248
|
// src/codegen/transforms/collectDefinitions.ts
|
|
58335
|
-
import * as
|
|
58249
|
+
import * as graphql7 from "graphql";
|
|
58336
58250
|
import { Kind as GraphqlKinds } from "graphql";
|
|
58337
58251
|
async function includeFragmentDefinitions(config, documents) {
|
|
58338
58252
|
const fragments = collectDefinitions(config, documents);
|
|
@@ -58382,10 +58296,10 @@ function collectDefinitions(config, docs) {
|
|
|
58382
58296
|
}
|
|
58383
58297
|
function findRequiredFragments(config, definition) {
|
|
58384
58298
|
const referencedFragments = [];
|
|
58385
|
-
const typeInfo = new
|
|
58386
|
-
definition.selectionSet =
|
|
58299
|
+
const typeInfo = new graphql7.TypeInfo(config.schema);
|
|
58300
|
+
definition.selectionSet = graphql7.visit(
|
|
58387
58301
|
definition,
|
|
58388
|
-
|
|
58302
|
+
graphql7.visitWithTypeInfo(typeInfo, {
|
|
58389
58303
|
FragmentSpread(node) {
|
|
58390
58304
|
referencedFragments.push(node.name.value);
|
|
58391
58305
|
}
|
|
@@ -58419,7 +58333,7 @@ function flattenFragments(filepath, operation, fragments) {
|
|
|
58419
58333
|
}
|
|
58420
58334
|
|
|
58421
58335
|
// src/codegen/transforms/fragmentVariables.ts
|
|
58422
|
-
var GraphqlKinds2 =
|
|
58336
|
+
var GraphqlKinds2 = graphql8.Kind;
|
|
58423
58337
|
async function fragmentVariables(config, documents) {
|
|
58424
58338
|
const fragments = collectDefinitions(config, documents);
|
|
58425
58339
|
const generatedFragments = {};
|
|
@@ -58442,7 +58356,7 @@ async function fragmentVariables(config, documents) {
|
|
|
58442
58356
|
});
|
|
58443
58357
|
}
|
|
58444
58358
|
const doc = {
|
|
58445
|
-
kind:
|
|
58359
|
+
kind: graphql8.Kind.DOCUMENT,
|
|
58446
58360
|
definitions: Object.values(generatedFragments)
|
|
58447
58361
|
};
|
|
58448
58362
|
documents.push({
|
|
@@ -58513,7 +58427,7 @@ function inlineFragmentArgs({
|
|
|
58513
58427
|
return null;
|
|
58514
58428
|
};
|
|
58515
58429
|
const result = esm_default(
|
|
58516
|
-
|
|
58430
|
+
graphql8.visit(document, {
|
|
58517
58431
|
FragmentSpread(node) {
|
|
58518
58432
|
if (!fragmentDefinitions[node.name.value]) {
|
|
58519
58433
|
throw new Error("Could not find definition for fragment" + node.name.value);
|
|
@@ -58599,7 +58513,7 @@ function inlineFragmentArgs({
|
|
|
58599
58513
|
);
|
|
58600
58514
|
if (newName) {
|
|
58601
58515
|
result.name = {
|
|
58602
|
-
kind:
|
|
58516
|
+
kind: graphql8.Kind.NAME,
|
|
58603
58517
|
value: newName
|
|
58604
58518
|
};
|
|
58605
58519
|
}
|
|
@@ -58766,7 +58680,7 @@ ${exportDefaultFrom(`./${doc.name}`, doc.name)}`,
|
|
|
58766
58680
|
}
|
|
58767
58681
|
|
|
58768
58682
|
// src/codegen/generators/artifacts/inputs.ts
|
|
58769
|
-
import * as
|
|
58683
|
+
import * as graphql9 from "graphql";
|
|
58770
58684
|
function inputObject(config, inputs, runtimeScalars) {
|
|
58771
58685
|
const visitedTypes = /* @__PURE__ */ new Set();
|
|
58772
58686
|
const inputObj = {
|
|
@@ -58796,10 +58710,10 @@ function walkInputs(config, visitedTypes, inputObj, rootType) {
|
|
|
58796
58710
|
if (visitedTypes.has(type.name)) {
|
|
58797
58711
|
return;
|
|
58798
58712
|
}
|
|
58799
|
-
if (
|
|
58713
|
+
if (graphql9.isEnumType(type) || graphql9.isScalarType(type)) {
|
|
58800
58714
|
return;
|
|
58801
58715
|
}
|
|
58802
|
-
if (
|
|
58716
|
+
if (graphql9.isUnionType(type)) {
|
|
58803
58717
|
return;
|
|
58804
58718
|
}
|
|
58805
58719
|
visitedTypes.add(type.name);
|
|
@@ -58817,50 +58731,50 @@ function walkInputs(config, visitedTypes, inputObj, rootType) {
|
|
|
58817
58731
|
}
|
|
58818
58732
|
|
|
58819
58733
|
// src/codegen/generators/artifacts/operations.ts
|
|
58820
|
-
import * as
|
|
58734
|
+
import * as graphql11 from "graphql";
|
|
58821
58735
|
|
|
58822
58736
|
// src/codegen/generators/artifacts/utils.ts
|
|
58823
|
-
var
|
|
58824
|
-
import * as
|
|
58825
|
-
var
|
|
58737
|
+
var recast4 = __toESM(require_main2(), 1);
|
|
58738
|
+
import * as graphql10 from "graphql";
|
|
58739
|
+
var AST4 = recast4.types.builders;
|
|
58826
58740
|
function serializeValue(value) {
|
|
58827
58741
|
if (Array.isArray(value)) {
|
|
58828
|
-
return
|
|
58742
|
+
return AST4.arrayExpression(value.map(serializeValue));
|
|
58829
58743
|
}
|
|
58830
58744
|
if (typeof value === "object" && value !== null) {
|
|
58831
|
-
return
|
|
58745
|
+
return AST4.objectExpression(
|
|
58832
58746
|
Object.entries(value).filter(([key, value2]) => typeof value2 !== "undefined").map(([key, val]) => {
|
|
58833
|
-
return
|
|
58747
|
+
return AST4.objectProperty(AST4.stringLiteral(key), serializeValue(val));
|
|
58834
58748
|
})
|
|
58835
58749
|
);
|
|
58836
58750
|
}
|
|
58837
58751
|
if (typeof value === "string") {
|
|
58838
58752
|
if (value.indexOf("\n") !== -1) {
|
|
58839
|
-
return
|
|
58840
|
-
[
|
|
58753
|
+
return AST4.templateLiteral(
|
|
58754
|
+
[AST4.templateElement({ raw: value, cooked: value }, true)],
|
|
58841
58755
|
[]
|
|
58842
58756
|
);
|
|
58843
58757
|
}
|
|
58844
|
-
return
|
|
58758
|
+
return AST4.stringLiteral(value);
|
|
58845
58759
|
}
|
|
58846
|
-
return
|
|
58760
|
+
return AST4.literal(value);
|
|
58847
58761
|
}
|
|
58848
58762
|
function convertValue(config, val) {
|
|
58849
58763
|
let value;
|
|
58850
58764
|
let kind;
|
|
58851
|
-
if (val.kind ===
|
|
58765
|
+
if (val.kind === graphql10.Kind.INT) {
|
|
58852
58766
|
value = parseInt(val.value, 10);
|
|
58853
58767
|
kind = "Int";
|
|
58854
|
-
} else if (val.kind ===
|
|
58768
|
+
} else if (val.kind === graphql10.Kind.FLOAT) {
|
|
58855
58769
|
value = parseFloat(val.value);
|
|
58856
58770
|
kind = "Float";
|
|
58857
|
-
} else if (val.kind ===
|
|
58771
|
+
} else if (val.kind === graphql10.Kind.BOOLEAN) {
|
|
58858
58772
|
value = val.value;
|
|
58859
58773
|
kind = "Boolean";
|
|
58860
|
-
} else if (val.kind ===
|
|
58774
|
+
} else if (val.kind === graphql10.Kind.VARIABLE) {
|
|
58861
58775
|
value = val.name.value;
|
|
58862
58776
|
kind = "Variable";
|
|
58863
|
-
} else if (val.kind ===
|
|
58777
|
+
} else if (val.kind === graphql10.Kind.STRING) {
|
|
58864
58778
|
value = val.value;
|
|
58865
58779
|
kind = "String";
|
|
58866
58780
|
}
|
|
@@ -58873,9 +58787,13 @@ function operationsByPath(config, filepath, definition, filterTypes) {
|
|
|
58873
58787
|
return {};
|
|
58874
58788
|
}
|
|
58875
58789
|
const pathOperations = {};
|
|
58876
|
-
|
|
58790
|
+
graphql11.visit(definition, {
|
|
58877
58791
|
FragmentSpread(node, _, __, ___, ancestors) {
|
|
58878
|
-
|
|
58792
|
+
let nameWithoutHash = node.name.value;
|
|
58793
|
+
if (node.directives && node.directives.find((directive) => directive.name.value === "with")) {
|
|
58794
|
+
nameWithoutHash = nameWithoutHash.substring(0, nameWithoutHash.lastIndexOf("_"));
|
|
58795
|
+
}
|
|
58796
|
+
if (!config.isListFragment(nameWithoutHash)) {
|
|
58879
58797
|
return;
|
|
58880
58798
|
}
|
|
58881
58799
|
const path2 = ancestorKey(ancestors);
|
|
@@ -58886,8 +58804,8 @@ function operationsByPath(config, filepath, definition, filterTypes) {
|
|
|
58886
58804
|
operationObject({
|
|
58887
58805
|
config,
|
|
58888
58806
|
filepath,
|
|
58889
|
-
listName: config.listNameFromFragment(
|
|
58890
|
-
operationKind: config.listOperationFromFragment(
|
|
58807
|
+
listName: config.listNameFromFragment(nameWithoutHash),
|
|
58808
|
+
operationKind: config.listOperationFromFragment(nameWithoutHash),
|
|
58891
58809
|
type: parentTypeFromAncestors(config.schema, filepath, ancestors).name,
|
|
58892
58810
|
selection: node
|
|
58893
58811
|
})
|
|
@@ -59032,19 +58950,19 @@ function ancestorKey(ancestors) {
|
|
|
59032
58950
|
}
|
|
59033
58951
|
|
|
59034
58952
|
// src/codegen/generators/artifacts/selection.ts
|
|
59035
|
-
import * as
|
|
58953
|
+
import * as graphql16 from "graphql";
|
|
59036
58954
|
|
|
59037
58955
|
// src/codegen/transforms/list.ts
|
|
59038
|
-
import * as
|
|
58956
|
+
import * as graphql14 from "graphql";
|
|
59039
58957
|
|
|
59040
58958
|
// src/codegen/utils/objectIdentificationSelection.ts
|
|
59041
|
-
import * as
|
|
58959
|
+
import * as graphql12 from "graphql";
|
|
59042
58960
|
var objectIdentificationSelection = (config, type) => {
|
|
59043
58961
|
return config.keyFieldsForType(type.name).map((key) => {
|
|
59044
58962
|
return {
|
|
59045
|
-
kind:
|
|
58963
|
+
kind: graphql12.Kind.FIELD,
|
|
59046
58964
|
name: {
|
|
59047
|
-
kind:
|
|
58965
|
+
kind: graphql12.Kind.NAME,
|
|
59048
58966
|
value: key
|
|
59049
58967
|
}
|
|
59050
58968
|
};
|
|
@@ -59052,7 +58970,7 @@ var objectIdentificationSelection = (config, type) => {
|
|
|
59052
58970
|
};
|
|
59053
58971
|
|
|
59054
58972
|
// src/codegen/transforms/paginate.ts
|
|
59055
|
-
import * as
|
|
58973
|
+
import * as graphql13 from "graphql";
|
|
59056
58974
|
async function paginate(config, documents) {
|
|
59057
58975
|
const newDocs = [];
|
|
59058
58976
|
for (const doc of documents) {
|
|
@@ -59085,7 +59003,7 @@ async function paginate(config, documents) {
|
|
|
59085
59003
|
};
|
|
59086
59004
|
let cursorType = "String";
|
|
59087
59005
|
let paginationPath = [];
|
|
59088
|
-
doc.document =
|
|
59006
|
+
doc.document = graphql13.visit(doc.document, {
|
|
59089
59007
|
Field(node, _, __, ___, ancestors) {
|
|
59090
59008
|
const paginateDirective = node.directives?.find(
|
|
59091
59009
|
(directive) => directive.name.value === config.paginateDirective
|
|
@@ -59111,7 +59029,7 @@ async function paginate(config, documents) {
|
|
|
59111
59029
|
flags.offset.enabled = offsetPagination;
|
|
59112
59030
|
flags.limit.enabled = offsetPagination;
|
|
59113
59031
|
paginationPath = ancestors.filter(
|
|
59114
|
-
(ancestor) => !Array.isArray(ancestor) && ancestor.kind ===
|
|
59032
|
+
(ancestor) => !Array.isArray(ancestor) && ancestor.kind === graphql13.Kind.FIELD
|
|
59115
59033
|
).concat(node).map((field) => field.alias?.value || field.name.value);
|
|
59116
59034
|
return {
|
|
59117
59035
|
...node,
|
|
@@ -59130,7 +59048,7 @@ async function paginate(config, documents) {
|
|
|
59130
59048
|
let fragment2 = "";
|
|
59131
59049
|
let paginateMode = config.defaultPaginateMode;
|
|
59132
59050
|
const requiredArgs = [];
|
|
59133
|
-
doc.document =
|
|
59051
|
+
doc.document = graphql13.visit(doc.document, {
|
|
59134
59052
|
OperationDefinition(node) {
|
|
59135
59053
|
if (node.operation !== "query") {
|
|
59136
59054
|
throw new HoudiniError({
|
|
@@ -59189,9 +59107,9 @@ async function paginate(config, documents) {
|
|
|
59189
59107
|
directives: [
|
|
59190
59108
|
...node.directives || [],
|
|
59191
59109
|
{
|
|
59192
|
-
kind:
|
|
59110
|
+
kind: graphql13.Kind.DIRECTIVE,
|
|
59193
59111
|
name: {
|
|
59194
|
-
kind:
|
|
59112
|
+
kind: graphql13.Kind.NAME,
|
|
59195
59113
|
value: config.argumentsDirective
|
|
59196
59114
|
}
|
|
59197
59115
|
}
|
|
@@ -59261,22 +59179,22 @@ async function paginate(config, documents) {
|
|
|
59261
59179
|
const paginationArgs = Object.entries(flags).filter(([_, { enabled }]) => enabled).map(([key, value]) => ({ name: key, ...value }));
|
|
59262
59180
|
const fragmentSpreadSelection = [
|
|
59263
59181
|
{
|
|
59264
|
-
kind:
|
|
59182
|
+
kind: graphql13.Kind.FRAGMENT_SPREAD,
|
|
59265
59183
|
name: {
|
|
59266
|
-
kind:
|
|
59184
|
+
kind: graphql13.Kind.NAME,
|
|
59267
59185
|
value: fragmentName
|
|
59268
59186
|
},
|
|
59269
59187
|
directives: [
|
|
59270
59188
|
{
|
|
59271
|
-
kind:
|
|
59189
|
+
kind: graphql13.Kind.DIRECTIVE,
|
|
59272
59190
|
name: {
|
|
59273
|
-
kind:
|
|
59191
|
+
kind: graphql13.Kind.NAME,
|
|
59274
59192
|
value: config.withDirective
|
|
59275
59193
|
},
|
|
59276
59194
|
["arguments"]: requiredArgs.map((arg) => variableAsArgument(arg.name)).concat(paginationArgs.map(({ name }) => variableAsArgument(name)))
|
|
59277
59195
|
},
|
|
59278
59196
|
{
|
|
59279
|
-
kind:
|
|
59197
|
+
kind: graphql13.Kind.DIRECTIVE,
|
|
59280
59198
|
name: {
|
|
59281
59199
|
kind: "Name",
|
|
59282
59200
|
value: config.maskDisableDirective
|
|
@@ -59303,23 +59221,23 @@ async function paginate(config, documents) {
|
|
|
59303
59221
|
});
|
|
59304
59222
|
const typeConfig = config.typeConfig?.[fragment2];
|
|
59305
59223
|
const queryDoc = {
|
|
59306
|
-
kind:
|
|
59224
|
+
kind: graphql13.Kind.DOCUMENT,
|
|
59307
59225
|
definitions: [
|
|
59308
59226
|
{
|
|
59309
|
-
kind:
|
|
59227
|
+
kind: graphql13.Kind.OPERATION_DEFINITION,
|
|
59310
59228
|
name: {
|
|
59311
|
-
kind:
|
|
59229
|
+
kind: graphql13.Kind.NAME,
|
|
59312
59230
|
value: refetchQueryName
|
|
59313
59231
|
},
|
|
59314
59232
|
operation: "query",
|
|
59315
59233
|
variableDefinitions: requiredArgs.map(
|
|
59316
59234
|
(arg) => ({
|
|
59317
|
-
kind:
|
|
59235
|
+
kind: graphql13.Kind.VARIABLE_DEFINITION,
|
|
59318
59236
|
type: arg.type,
|
|
59319
59237
|
variable: {
|
|
59320
|
-
kind:
|
|
59238
|
+
kind: graphql13.Kind.VARIABLE,
|
|
59321
59239
|
name: {
|
|
59322
|
-
kind:
|
|
59240
|
+
kind: graphql13.Kind.NAME,
|
|
59323
59241
|
value: arg.name
|
|
59324
59242
|
}
|
|
59325
59243
|
}
|
|
@@ -59327,18 +59245,18 @@ async function paginate(config, documents) {
|
|
|
59327
59245
|
).concat(
|
|
59328
59246
|
paginationArgs.map(
|
|
59329
59247
|
(arg) => ({
|
|
59330
|
-
kind:
|
|
59248
|
+
kind: graphql13.Kind.VARIABLE_DEFINITION,
|
|
59331
59249
|
type: {
|
|
59332
|
-
kind:
|
|
59250
|
+
kind: graphql13.Kind.NAMED_TYPE,
|
|
59333
59251
|
name: {
|
|
59334
|
-
kind:
|
|
59252
|
+
kind: graphql13.Kind.NAME,
|
|
59335
59253
|
value: arg.type
|
|
59336
59254
|
}
|
|
59337
59255
|
},
|
|
59338
59256
|
variable: {
|
|
59339
|
-
kind:
|
|
59257
|
+
kind: graphql13.Kind.VARIABLE,
|
|
59340
59258
|
name: {
|
|
59341
|
-
kind:
|
|
59259
|
+
kind: graphql13.Kind.NAME,
|
|
59342
59260
|
value: arg.name
|
|
59343
59261
|
}
|
|
59344
59262
|
},
|
|
@@ -59350,12 +59268,12 @@ async function paginate(config, documents) {
|
|
|
59350
59268
|
).concat(
|
|
59351
59269
|
!nodeQuery ? [] : keys2.map(
|
|
59352
59270
|
(key) => ({
|
|
59353
|
-
kind:
|
|
59271
|
+
kind: graphql13.Kind.VARIABLE_DEFINITION,
|
|
59354
59272
|
type: key.type,
|
|
59355
59273
|
variable: {
|
|
59356
|
-
kind:
|
|
59274
|
+
kind: graphql13.Kind.VARIABLE,
|
|
59357
59275
|
name: {
|
|
59358
|
-
kind:
|
|
59276
|
+
kind: graphql13.Kind.NAME,
|
|
59359
59277
|
value: key.name
|
|
59360
59278
|
}
|
|
59361
59279
|
}
|
|
@@ -59364,42 +59282,42 @@ async function paginate(config, documents) {
|
|
|
59364
59282
|
)
|
|
59365
59283
|
),
|
|
59366
59284
|
selectionSet: {
|
|
59367
|
-
kind:
|
|
59285
|
+
kind: graphql13.Kind.SELECTION_SET,
|
|
59368
59286
|
selections: !nodeQuery ? fragmentSpreadSelection : [
|
|
59369
59287
|
{
|
|
59370
|
-
kind:
|
|
59288
|
+
kind: graphql13.Kind.FIELD,
|
|
59371
59289
|
name: {
|
|
59372
|
-
kind:
|
|
59290
|
+
kind: graphql13.Kind.NAME,
|
|
59373
59291
|
value: typeConfig?.resolve?.queryField || "node"
|
|
59374
59292
|
},
|
|
59375
59293
|
["arguments"]: keys2.map((key) => ({
|
|
59376
|
-
kind:
|
|
59294
|
+
kind: graphql13.Kind.ARGUMENT,
|
|
59377
59295
|
name: {
|
|
59378
|
-
kind:
|
|
59296
|
+
kind: graphql13.Kind.NAME,
|
|
59379
59297
|
value: key.name
|
|
59380
59298
|
},
|
|
59381
59299
|
value: {
|
|
59382
|
-
kind:
|
|
59300
|
+
kind: graphql13.Kind.VARIABLE,
|
|
59383
59301
|
name: {
|
|
59384
|
-
kind:
|
|
59302
|
+
kind: graphql13.Kind.NAME,
|
|
59385
59303
|
value: key.name
|
|
59386
59304
|
}
|
|
59387
59305
|
}
|
|
59388
59306
|
})),
|
|
59389
59307
|
selectionSet: {
|
|
59390
|
-
kind:
|
|
59308
|
+
kind: graphql13.Kind.SELECTION_SET,
|
|
59391
59309
|
selections: [
|
|
59392
59310
|
{
|
|
59393
|
-
kind:
|
|
59311
|
+
kind: graphql13.Kind.FIELD,
|
|
59394
59312
|
name: {
|
|
59395
|
-
kind:
|
|
59313
|
+
kind: graphql13.Kind.NAME,
|
|
59396
59314
|
value: "__typename"
|
|
59397
59315
|
}
|
|
59398
59316
|
},
|
|
59399
59317
|
...(typeConfig?.keys || [config.defaultKeys[0]]).map((key) => ({
|
|
59400
|
-
kind:
|
|
59318
|
+
kind: graphql13.Kind.FIELD,
|
|
59401
59319
|
name: {
|
|
59402
|
-
kind:
|
|
59320
|
+
kind: graphql13.Kind.NAME,
|
|
59403
59321
|
value: key
|
|
59404
59322
|
}
|
|
59405
59323
|
})),
|
|
@@ -59456,15 +59374,15 @@ function replaceArgumentsWithVariables(args, flags) {
|
|
|
59456
59374
|
}
|
|
59457
59375
|
function variableAsArgument(name, variable) {
|
|
59458
59376
|
return {
|
|
59459
|
-
kind:
|
|
59377
|
+
kind: graphql13.Kind.ARGUMENT,
|
|
59460
59378
|
name: {
|
|
59461
|
-
kind:
|
|
59379
|
+
kind: graphql13.Kind.NAME,
|
|
59462
59380
|
value: name
|
|
59463
59381
|
},
|
|
59464
59382
|
value: {
|
|
59465
|
-
kind:
|
|
59383
|
+
kind: graphql13.Kind.VARIABLE,
|
|
59466
59384
|
name: {
|
|
59467
|
-
kind:
|
|
59385
|
+
kind: graphql13.Kind.NAME,
|
|
59468
59386
|
value: variable ?? name
|
|
59469
59387
|
}
|
|
59470
59388
|
}
|
|
@@ -59472,18 +59390,18 @@ function variableAsArgument(name, variable) {
|
|
|
59472
59390
|
}
|
|
59473
59391
|
function staticVariableDefinition(name, type, defaultValue, variableName) {
|
|
59474
59392
|
return {
|
|
59475
|
-
kind:
|
|
59393
|
+
kind: graphql13.Kind.VARIABLE_DEFINITION,
|
|
59476
59394
|
type: {
|
|
59477
|
-
kind:
|
|
59395
|
+
kind: graphql13.Kind.NAMED_TYPE,
|
|
59478
59396
|
name: {
|
|
59479
|
-
kind:
|
|
59397
|
+
kind: graphql13.Kind.NAME,
|
|
59480
59398
|
value: type
|
|
59481
59399
|
}
|
|
59482
59400
|
},
|
|
59483
59401
|
variable: {
|
|
59484
|
-
kind:
|
|
59402
|
+
kind: graphql13.Kind.VARIABLE,
|
|
59485
59403
|
name: {
|
|
59486
|
-
kind:
|
|
59404
|
+
kind: graphql13.Kind.NAME,
|
|
59487
59405
|
value: variableName ?? name
|
|
59488
59406
|
}
|
|
59489
59407
|
},
|
|
@@ -59495,9 +59413,9 @@ function staticVariableDefinition(name, type, defaultValue, variableName) {
|
|
|
59495
59413
|
}
|
|
59496
59414
|
function argumentNode(name, value) {
|
|
59497
59415
|
return {
|
|
59498
|
-
kind:
|
|
59416
|
+
kind: graphql13.Kind.ARGUMENT,
|
|
59499
59417
|
name: {
|
|
59500
|
-
kind:
|
|
59418
|
+
kind: graphql13.Kind.NAME,
|
|
59501
59419
|
value: name
|
|
59502
59420
|
},
|
|
59503
59421
|
value: objectNode(value)
|
|
@@ -59505,16 +59423,16 @@ function argumentNode(name, value) {
|
|
|
59505
59423
|
}
|
|
59506
59424
|
function objectNode([type, defaultValue]) {
|
|
59507
59425
|
const node = {
|
|
59508
|
-
kind:
|
|
59426
|
+
kind: graphql13.Kind.OBJECT,
|
|
59509
59427
|
fields: [
|
|
59510
59428
|
{
|
|
59511
|
-
kind:
|
|
59429
|
+
kind: graphql13.Kind.OBJECT_FIELD,
|
|
59512
59430
|
name: {
|
|
59513
|
-
kind:
|
|
59431
|
+
kind: graphql13.Kind.NAME,
|
|
59514
59432
|
value: "type"
|
|
59515
59433
|
},
|
|
59516
59434
|
value: {
|
|
59517
|
-
kind:
|
|
59435
|
+
kind: graphql13.Kind.STRING,
|
|
59518
59436
|
value: type
|
|
59519
59437
|
}
|
|
59520
59438
|
}
|
|
@@ -59522,8 +59440,8 @@ function objectNode([type, defaultValue]) {
|
|
|
59522
59440
|
};
|
|
59523
59441
|
if (defaultValue) {
|
|
59524
59442
|
node.fields.push({
|
|
59525
|
-
kind:
|
|
59526
|
-
name: { kind:
|
|
59443
|
+
kind: graphql13.Kind.OBJECT_FIELD,
|
|
59444
|
+
name: { kind: graphql13.Kind.NAME, value: "default" },
|
|
59527
59445
|
value: {
|
|
59528
59446
|
kind: typeof defaultValue === "number" ? "IntValue" : "StringValue",
|
|
59529
59447
|
value: defaultValue.toString()
|
|
@@ -59534,34 +59452,34 @@ function objectNode([type, defaultValue]) {
|
|
|
59534
59452
|
}
|
|
59535
59453
|
var pageInfoSelection = [
|
|
59536
59454
|
{
|
|
59537
|
-
kind:
|
|
59455
|
+
kind: graphql13.Kind.FIELD,
|
|
59538
59456
|
name: {
|
|
59539
|
-
kind:
|
|
59457
|
+
kind: graphql13.Kind.NAME,
|
|
59540
59458
|
value: "edges"
|
|
59541
59459
|
},
|
|
59542
59460
|
selectionSet: {
|
|
59543
|
-
kind:
|
|
59461
|
+
kind: graphql13.Kind.SELECTION_SET,
|
|
59544
59462
|
selections: [
|
|
59545
59463
|
{
|
|
59546
|
-
kind:
|
|
59464
|
+
kind: graphql13.Kind.FIELD,
|
|
59547
59465
|
name: {
|
|
59548
|
-
kind:
|
|
59466
|
+
kind: graphql13.Kind.NAME,
|
|
59549
59467
|
value: "cursor"
|
|
59550
59468
|
}
|
|
59551
59469
|
},
|
|
59552
59470
|
{
|
|
59553
|
-
kind:
|
|
59471
|
+
kind: graphql13.Kind.FIELD,
|
|
59554
59472
|
name: {
|
|
59555
|
-
kind:
|
|
59473
|
+
kind: graphql13.Kind.NAME,
|
|
59556
59474
|
value: "node"
|
|
59557
59475
|
},
|
|
59558
59476
|
selectionSet: {
|
|
59559
|
-
kind:
|
|
59477
|
+
kind: graphql13.Kind.SELECTION_SET,
|
|
59560
59478
|
selections: [
|
|
59561
59479
|
{
|
|
59562
|
-
kind:
|
|
59480
|
+
kind: graphql13.Kind.FIELD,
|
|
59563
59481
|
name: {
|
|
59564
|
-
kind:
|
|
59482
|
+
kind: graphql13.Kind.NAME,
|
|
59565
59483
|
value: "__typename"
|
|
59566
59484
|
}
|
|
59567
59485
|
}
|
|
@@ -59572,39 +59490,39 @@ var pageInfoSelection = [
|
|
|
59572
59490
|
}
|
|
59573
59491
|
},
|
|
59574
59492
|
{
|
|
59575
|
-
kind:
|
|
59493
|
+
kind: graphql13.Kind.FIELD,
|
|
59576
59494
|
name: {
|
|
59577
|
-
kind:
|
|
59495
|
+
kind: graphql13.Kind.NAME,
|
|
59578
59496
|
value: "pageInfo"
|
|
59579
59497
|
},
|
|
59580
59498
|
selectionSet: {
|
|
59581
|
-
kind:
|
|
59499
|
+
kind: graphql13.Kind.SELECTION_SET,
|
|
59582
59500
|
selections: [
|
|
59583
59501
|
{
|
|
59584
|
-
kind:
|
|
59502
|
+
kind: graphql13.Kind.FIELD,
|
|
59585
59503
|
name: {
|
|
59586
|
-
kind:
|
|
59504
|
+
kind: graphql13.Kind.NAME,
|
|
59587
59505
|
value: "hasPreviousPage"
|
|
59588
59506
|
}
|
|
59589
59507
|
},
|
|
59590
59508
|
{
|
|
59591
|
-
kind:
|
|
59509
|
+
kind: graphql13.Kind.FIELD,
|
|
59592
59510
|
name: {
|
|
59593
|
-
kind:
|
|
59511
|
+
kind: graphql13.Kind.NAME,
|
|
59594
59512
|
value: "hasNextPage"
|
|
59595
59513
|
}
|
|
59596
59514
|
},
|
|
59597
59515
|
{
|
|
59598
|
-
kind:
|
|
59516
|
+
kind: graphql13.Kind.FIELD,
|
|
59599
59517
|
name: {
|
|
59600
|
-
kind:
|
|
59518
|
+
kind: graphql13.Kind.NAME,
|
|
59601
59519
|
value: "startCursor"
|
|
59602
59520
|
}
|
|
59603
59521
|
},
|
|
59604
59522
|
{
|
|
59605
|
-
kind:
|
|
59523
|
+
kind: graphql13.Kind.FIELD,
|
|
59606
59524
|
name: {
|
|
59607
|
-
kind:
|
|
59525
|
+
kind: graphql13.Kind.NAME,
|
|
59608
59526
|
value: "endCursor"
|
|
59609
59527
|
}
|
|
59610
59528
|
}
|
|
@@ -59618,17 +59536,17 @@ async function addListFragments(config, documents) {
|
|
|
59618
59536
|
const lists = {};
|
|
59619
59537
|
const errors = [];
|
|
59620
59538
|
for (const doc of documents) {
|
|
59621
|
-
doc.document =
|
|
59539
|
+
doc.document = graphql14.visit(doc.document, {
|
|
59622
59540
|
Directive(node, key, parent2, path2, ancestors) {
|
|
59623
59541
|
if ([config.listDirective, config.paginateDirective].includes(node.name.value)) {
|
|
59624
59542
|
const nameArg = node.arguments?.find(
|
|
59625
59543
|
(arg) => arg.name.value === config.listOrPaginateNameArg
|
|
59626
59544
|
);
|
|
59627
59545
|
let error = {
|
|
59628
|
-
...new
|
|
59546
|
+
...new graphql14.GraphQLError(
|
|
59629
59547
|
"",
|
|
59630
59548
|
node,
|
|
59631
|
-
new
|
|
59549
|
+
new graphql14.Source(""),
|
|
59632
59550
|
node.loc ? [node.loc.start, node.loc.end] : null,
|
|
59633
59551
|
path2
|
|
59634
59552
|
),
|
|
@@ -59680,7 +59598,7 @@ async function addListFragments(config, documents) {
|
|
|
59680
59598
|
{
|
|
59681
59599
|
kind: "Argument",
|
|
59682
59600
|
name: {
|
|
59683
|
-
kind:
|
|
59601
|
+
kind: graphql14.Kind.NAME,
|
|
59684
59602
|
value: "connection"
|
|
59685
59603
|
},
|
|
59686
59604
|
value: {
|
|
@@ -59730,7 +59648,7 @@ async function addListFragments(config, documents) {
|
|
|
59730
59648
|
const validDeletes = [
|
|
59731
59649
|
...new Set(
|
|
59732
59650
|
Object.values(lists).map(({ type }) => {
|
|
59733
|
-
if (!(type instanceof
|
|
59651
|
+
if (!(type instanceof graphql14.GraphQLObjectType)) {
|
|
59734
59652
|
return "";
|
|
59735
59653
|
}
|
|
59736
59654
|
if (config.keyFieldsForType(type.name).length !== 1) {
|
|
@@ -59744,7 +59662,7 @@ async function addListFragments(config, documents) {
|
|
|
59744
59662
|
return;
|
|
59745
59663
|
}
|
|
59746
59664
|
const generatedDoc = {
|
|
59747
|
-
kind:
|
|
59665
|
+
kind: graphql14.Kind.DOCUMENT,
|
|
59748
59666
|
definitions: Object.entries(lists).flatMap(
|
|
59749
59667
|
([name, { selection, type }]) => {
|
|
59750
59668
|
const schemaType = config.schema.getType(type.name);
|
|
@@ -59752,7 +59670,7 @@ async function addListFragments(config, documents) {
|
|
|
59752
59670
|
throw new HoudiniError({ message: "Lists must have a selection" });
|
|
59753
59671
|
}
|
|
59754
59672
|
const fragmentSelection = {
|
|
59755
|
-
kind:
|
|
59673
|
+
kind: graphql14.Kind.SELECTION_SET,
|
|
59756
59674
|
selections: [...selection.selections]
|
|
59757
59675
|
};
|
|
59758
59676
|
if (schemaType && fragmentSelection && !fragmentSelection?.selections.find(
|
|
@@ -59767,14 +59685,14 @@ async function addListFragments(config, documents) {
|
|
|
59767
59685
|
{
|
|
59768
59686
|
name: {
|
|
59769
59687
|
value: config.listInsertFragment(name),
|
|
59770
|
-
kind:
|
|
59688
|
+
kind: graphql14.Kind.NAME
|
|
59771
59689
|
},
|
|
59772
|
-
kind:
|
|
59690
|
+
kind: graphql14.Kind.FRAGMENT_DEFINITION,
|
|
59773
59691
|
selectionSet: fragmentSelection,
|
|
59774
59692
|
typeCondition: {
|
|
59775
|
-
kind:
|
|
59693
|
+
kind: graphql14.Kind.NAMED_TYPE,
|
|
59776
59694
|
name: {
|
|
59777
|
-
kind:
|
|
59695
|
+
kind: graphql14.Kind.NAME,
|
|
59778
59696
|
value: type.name
|
|
59779
59697
|
}
|
|
59780
59698
|
}
|
|
@@ -59782,32 +59700,32 @@ async function addListFragments(config, documents) {
|
|
|
59782
59700
|
{
|
|
59783
59701
|
name: {
|
|
59784
59702
|
value: config.listToggleFragment(name),
|
|
59785
|
-
kind:
|
|
59703
|
+
kind: graphql14.Kind.NAME
|
|
59786
59704
|
},
|
|
59787
|
-
kind:
|
|
59705
|
+
kind: graphql14.Kind.FRAGMENT_DEFINITION,
|
|
59788
59706
|
selectionSet: fragmentSelection,
|
|
59789
59707
|
typeCondition: {
|
|
59790
|
-
kind:
|
|
59708
|
+
kind: graphql14.Kind.NAMED_TYPE,
|
|
59791
59709
|
name: {
|
|
59792
|
-
kind:
|
|
59710
|
+
kind: graphql14.Kind.NAME,
|
|
59793
59711
|
value: type.name
|
|
59794
59712
|
}
|
|
59795
59713
|
}
|
|
59796
59714
|
},
|
|
59797
59715
|
{
|
|
59798
|
-
kind:
|
|
59716
|
+
kind: graphql14.Kind.FRAGMENT_DEFINITION,
|
|
59799
59717
|
name: {
|
|
59800
59718
|
value: config.listRemoveFragment(name),
|
|
59801
|
-
kind:
|
|
59719
|
+
kind: graphql14.Kind.NAME
|
|
59802
59720
|
},
|
|
59803
59721
|
selectionSet: {
|
|
59804
|
-
kind:
|
|
59722
|
+
kind: graphql14.Kind.SELECTION_SET,
|
|
59805
59723
|
selections: [...objectIdentificationSelection(config, type)]
|
|
59806
59724
|
},
|
|
59807
59725
|
typeCondition: {
|
|
59808
|
-
kind:
|
|
59726
|
+
kind: graphql14.Kind.NAMED_TYPE,
|
|
59809
59727
|
name: {
|
|
59810
|
-
kind:
|
|
59728
|
+
kind: graphql14.Kind.NAME,
|
|
59811
59729
|
value: type.name
|
|
59812
59730
|
}
|
|
59813
59731
|
}
|
|
@@ -59816,14 +59734,14 @@ async function addListFragments(config, documents) {
|
|
|
59816
59734
|
}
|
|
59817
59735
|
).concat(
|
|
59818
59736
|
...validDeletes.map((typeName) => ({
|
|
59819
|
-
kind:
|
|
59737
|
+
kind: graphql14.Kind.DIRECTIVE_DEFINITION,
|
|
59820
59738
|
name: {
|
|
59821
|
-
kind:
|
|
59739
|
+
kind: graphql14.Kind.NAME,
|
|
59822
59740
|
value: config.listDeleteDirective(typeName)
|
|
59823
59741
|
},
|
|
59824
59742
|
locations: [
|
|
59825
59743
|
{
|
|
59826
|
-
kind:
|
|
59744
|
+
kind: graphql14.Kind.NAME,
|
|
59827
59745
|
value: "FIELD"
|
|
59828
59746
|
}
|
|
59829
59747
|
],
|
|
@@ -59831,8 +59749,8 @@ async function addListFragments(config, documents) {
|
|
|
59831
59749
|
}))
|
|
59832
59750
|
)
|
|
59833
59751
|
};
|
|
59834
|
-
config.newSchema += "\n" + generatedDoc.definitions.filter((c) => c.kind !== "FragmentDefinition").map(
|
|
59835
|
-
config.newDocuments += "\n" + generatedDoc.definitions.filter((c) => c.kind === "FragmentDefinition").map(
|
|
59752
|
+
config.newSchema += "\n" + generatedDoc.definitions.filter((c) => c.kind !== "FragmentDefinition").map(graphql14.print).join("\n\n");
|
|
59753
|
+
config.newDocuments += "\n" + generatedDoc.definitions.filter((c) => c.kind === "FragmentDefinition").map(graphql14.print).join("\n\n");
|
|
59836
59754
|
documents.push({
|
|
59837
59755
|
name: "generated::lists",
|
|
59838
59756
|
kind: ArtifactKind.Fragment,
|
|
@@ -59918,11 +59836,11 @@ var nodeNotDefinedMessage = (config) => `Looks like you are trying to use the ${
|
|
|
59918
59836
|
For more information, visit this link: ${siteURL}/guides/pagination`;
|
|
59919
59837
|
|
|
59920
59838
|
// src/codegen/generators/artifacts/fieldKey.ts
|
|
59921
|
-
import * as
|
|
59839
|
+
import * as graphql15 from "graphql";
|
|
59922
59840
|
function fieldKey(config, field) {
|
|
59923
59841
|
const attributeName = field.alias?.value || field.name.value;
|
|
59924
|
-
const printed =
|
|
59925
|
-
const secondParse =
|
|
59842
|
+
const printed = graphql15.print(field);
|
|
59843
|
+
const secondParse = graphql15.parse(`{${printed}}`).definitions[0].selectionSet.selections[0];
|
|
59926
59844
|
let paginateMode = config.defaultPaginateMode;
|
|
59927
59845
|
const paginatedDirective = field.directives?.find(
|
|
59928
59846
|
(directive) => directive.name.value === config.paginateDirective
|
|
@@ -60045,13 +59963,13 @@ function prepareSelection({
|
|
|
60045
59963
|
} else if ("getFields" in type) {
|
|
60046
59964
|
let typeRef = type.getFields()[field.name.value].type;
|
|
60047
59965
|
fieldType = getRootType(typeRef);
|
|
60048
|
-
nullable = !
|
|
60049
|
-
} else if (
|
|
59966
|
+
nullable = !graphql16.isNonNullType(typeRef);
|
|
59967
|
+
} else if (graphql16.isAbstractType(type)) {
|
|
60050
59968
|
for (const possible of config.schema.getPossibleTypes(type)) {
|
|
60051
|
-
if (
|
|
59969
|
+
if (graphql16.isObjectType(possible)) {
|
|
60052
59970
|
if (possible.getFields()[field.name.value]) {
|
|
60053
59971
|
fieldType = possible.getFields()[field.name.value].type;
|
|
60054
|
-
nullable = !
|
|
59972
|
+
nullable = !graphql16.isNonNullType(fieldType);
|
|
60055
59973
|
break;
|
|
60056
59974
|
}
|
|
60057
59975
|
}
|
|
@@ -60188,7 +60106,7 @@ function prepareSelection({
|
|
|
60188
60106
|
kind: "value"
|
|
60189
60107
|
} : { kind: "continue" };
|
|
60190
60108
|
const parentType = config.schema.getType(rootType);
|
|
60191
|
-
if (
|
|
60109
|
+
if (graphql16.isObjectType(parentType) || graphql16.isInterfaceType(parentType)) {
|
|
60192
60110
|
const fieldType2 = parentType.getFields()[field.name.value]?.type;
|
|
60193
60111
|
if (fieldType2) {
|
|
60194
60112
|
const listCount = unwrapType(config, fieldType2).wrappers.filter(
|
|
@@ -60211,7 +60129,7 @@ function prepareSelection({
|
|
|
60211
60129
|
}
|
|
60212
60130
|
fieldObj.loading = loadingValue;
|
|
60213
60131
|
}
|
|
60214
|
-
if (
|
|
60132
|
+
if (graphql16.isInterfaceType(fieldType) || graphql16.isUnionType(fieldType)) {
|
|
60215
60133
|
fieldObj.abstract = true;
|
|
60216
60134
|
if (Object.values(fieldObj.selection?.abstractFields?.fields ?? {}).some(
|
|
60217
60135
|
(fields) => Object.values(fields ?? {}).some((field2) => field2.required)
|
|
@@ -60293,7 +60211,7 @@ function mergeSelection({
|
|
|
60293
60211
|
typeSelection,
|
|
60294
60212
|
abstractSelection.fields[typeName] ?? {}
|
|
60295
60213
|
);
|
|
60296
|
-
if (
|
|
60214
|
+
if (graphql16.isAbstractType(gqlType)) {
|
|
60297
60215
|
for (const possible of config.schema.getPossibleTypes(gqlType)) {
|
|
60298
60216
|
if (!possibleSelectionTypes[typeName]) {
|
|
60299
60217
|
possibleSelectionTypes[typeName] = [];
|
|
@@ -60328,7 +60246,7 @@ function mergeSelection({
|
|
|
60328
60246
|
}
|
|
60329
60247
|
}
|
|
60330
60248
|
const parentType = config.schema.getType(rootType);
|
|
60331
|
-
const possibleParents =
|
|
60249
|
+
const possibleParents = graphql16.isAbstractType(parentType) ? config.schema.getPossibleTypes(parentType)?.map((t2) => t2.name) : [parentType.name];
|
|
60332
60250
|
for (const key of Object.keys(abstractSelection.typeMap)) {
|
|
60333
60251
|
if (!possibleParents.includes(key) && rootType !== key || abstractSelection.fields[key]) {
|
|
60334
60252
|
delete abstractSelection.typeMap[key];
|
|
@@ -60385,12 +60303,12 @@ function mergeSelection({
|
|
|
60385
60303
|
}
|
|
60386
60304
|
|
|
60387
60305
|
// src/codegen/generators/artifacts/index.ts
|
|
60388
|
-
var
|
|
60306
|
+
var AST5 = recast5.types.builders;
|
|
60389
60307
|
function artifactGenerator(stats) {
|
|
60390
60308
|
return async function(config, docs) {
|
|
60391
60309
|
const filterTypes = {};
|
|
60392
60310
|
for (const doc of docs) {
|
|
60393
|
-
|
|
60311
|
+
graphql17.visit(doc.document, {
|
|
60394
60312
|
Directive(node, _, __, ___, ancestors) {
|
|
60395
60313
|
if (node.name.value !== config.listDirective) {
|
|
60396
60314
|
return;
|
|
@@ -60450,7 +60368,7 @@ function artifactGenerator(stats) {
|
|
|
60450
60368
|
return;
|
|
60451
60369
|
}
|
|
60452
60370
|
const usedVariableNames = /* @__PURE__ */ new Set();
|
|
60453
|
-
let documentWithoutInternalDirectives =
|
|
60371
|
+
let documentWithoutInternalDirectives = graphql17.visit(document, {
|
|
60454
60372
|
Directive(node) {
|
|
60455
60373
|
if (config.isInternalDirective(node.name.value)) {
|
|
60456
60374
|
return null;
|
|
@@ -60463,7 +60381,7 @@ function artifactGenerator(stats) {
|
|
|
60463
60381
|
}
|
|
60464
60382
|
}
|
|
60465
60383
|
});
|
|
60466
|
-
let documentWithoutExtraVariables =
|
|
60384
|
+
let documentWithoutExtraVariables = graphql17.visit(
|
|
60467
60385
|
documentWithoutInternalDirectives,
|
|
60468
60386
|
{
|
|
60469
60387
|
VariableDefinition(variableDefinitionNode) {
|
|
@@ -60474,13 +60392,13 @@ function artifactGenerator(stats) {
|
|
|
60474
60392
|
}
|
|
60475
60393
|
}
|
|
60476
60394
|
);
|
|
60477
|
-
let rawString =
|
|
60395
|
+
let rawString = graphql17.print(documentWithoutExtraVariables);
|
|
60478
60396
|
let docKind = doc.kind;
|
|
60479
60397
|
const operations = document.definitions.filter(
|
|
60480
|
-
({ kind }) => kind ===
|
|
60398
|
+
({ kind }) => kind === graphql17.Kind.OPERATION_DEFINITION
|
|
60481
60399
|
);
|
|
60482
60400
|
const fragments = document.definitions.filter(
|
|
60483
|
-
({ kind }) => kind ===
|
|
60401
|
+
({ kind }) => kind === graphql17.Kind.FRAGMENT_DEFINITION
|
|
60484
60402
|
);
|
|
60485
60403
|
let rootType = "";
|
|
60486
60404
|
let selectionSet;
|
|
@@ -60680,9 +60598,9 @@ function artifactGenerator(stats) {
|
|
|
60680
60598
|
plugin2.artifactEnd({ config, document: doc });
|
|
60681
60599
|
}
|
|
60682
60600
|
const _houdiniHash = hashOriginal({ document: doc });
|
|
60683
|
-
const file =
|
|
60601
|
+
const file = AST5.program([
|
|
60684
60602
|
moduleExport(config, "default", serializeValue(artifact)),
|
|
60685
|
-
|
|
60603
|
+
AST5.expressionStatement(AST5.stringLiteral(`HoudiniHash=${_houdiniHash}`))
|
|
60686
60604
|
]);
|
|
60687
60605
|
const artifactPath = config.artifactPath(document);
|
|
60688
60606
|
const countDocument = doc.generateStore;
|
|
@@ -60740,7 +60658,7 @@ function applyMask(config, target, mask) {
|
|
|
60740
60658
|
if (!targetType) {
|
|
60741
60659
|
continue;
|
|
60742
60660
|
}
|
|
60743
|
-
if (
|
|
60661
|
+
if (graphql17.isAbstractType(targetType)) {
|
|
60744
60662
|
for (const possible of config.schema.getPossibleTypes(targetType)) {
|
|
60745
60663
|
if (target.abstractFields?.fields[possible.name]) {
|
|
60746
60664
|
applyMask(
|
|
@@ -60763,8 +60681,8 @@ function applyMask(config, target, mask) {
|
|
|
60763
60681
|
}
|
|
60764
60682
|
|
|
60765
60683
|
// src/codegen/generators/runtime/graphqlFunction.ts
|
|
60766
|
-
var
|
|
60767
|
-
var
|
|
60684
|
+
var recast6 = __toESM(require_main2(), 1);
|
|
60685
|
+
var AST6 = recast6.types.builders;
|
|
60768
60686
|
async function generateGraphqlReturnTypes(config, docs) {
|
|
60769
60687
|
const indexPath = path_exports.join(config.runtimeDirectory, "index.d.ts");
|
|
60770
60688
|
const fileContent = await fs_exports.readFile(indexPath) || "";
|
|
@@ -60799,18 +60717,18 @@ async function generateGraphqlReturnTypes(config, docs) {
|
|
|
60799
60717
|
continue;
|
|
60800
60718
|
}
|
|
60801
60719
|
for (const [queryString, returnValue] of Object.entries(overloaded_returns)) {
|
|
60802
|
-
const input =
|
|
60803
|
-
input.typeAnnotation =
|
|
60804
|
-
|
|
60720
|
+
const input = AST6.identifier("str");
|
|
60721
|
+
input.typeAnnotation = AST6.tsTypeAnnotation(
|
|
60722
|
+
AST6.tsLiteralType(AST6.stringLiteral(queryString))
|
|
60805
60723
|
);
|
|
60806
60724
|
script.body.splice(
|
|
60807
60725
|
i,
|
|
60808
60726
|
0,
|
|
60809
|
-
|
|
60810
|
-
|
|
60811
|
-
|
|
60727
|
+
AST6.exportNamedDeclaration(
|
|
60728
|
+
AST6.tsDeclareFunction(
|
|
60729
|
+
AST6.identifier("graphql"),
|
|
60812
60730
|
[input],
|
|
60813
|
-
|
|
60731
|
+
AST6.tsTypeAnnotation(AST6.tsTypeReference(AST6.identifier(returnValue)))
|
|
60814
60732
|
)
|
|
60815
60733
|
)
|
|
60816
60734
|
);
|
|
@@ -60985,165 +60903,22 @@ function moduleStatments(config) {
|
|
|
60985
60903
|
var recast11 = __toESM(require_main2(), 1);
|
|
60986
60904
|
|
|
60987
60905
|
// 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
60906
|
var recast7 = __toESM(require_main2(), 1);
|
|
60993
60907
|
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
60908
|
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
60909
|
function addReferencedInputTypes(config, filepath, body, visitedTypes, missingScalars, rootType) {
|
|
61135
60910
|
const { type } = unwrapType(config, rootType);
|
|
61136
|
-
if (
|
|
60911
|
+
if (graphql18.isScalarType(type)) {
|
|
61137
60912
|
return;
|
|
61138
60913
|
}
|
|
61139
60914
|
if (visitedTypes.has(type.name)) {
|
|
61140
60915
|
return;
|
|
61141
60916
|
}
|
|
61142
|
-
if (
|
|
60917
|
+
if (graphql18.isUnionType(type)) {
|
|
61143
60918
|
throw new HoudiniError({ filepath, message: "Input Unions are not supported yet. Sorry!" });
|
|
61144
60919
|
}
|
|
61145
60920
|
visitedTypes.add(type.name);
|
|
61146
|
-
if (
|
|
60921
|
+
if (graphql18.isEnumType(type)) {
|
|
61147
60922
|
ensureImports({
|
|
61148
60923
|
config,
|
|
61149
60924
|
body,
|
|
@@ -61157,21 +60932,37 @@ function addReferencedInputTypes(config, filepath, body, visitedTypes, missingSc
|
|
|
61157
60932
|
for (const field of Object.values(type.getFields())) {
|
|
61158
60933
|
addReferencedInputTypes(config, filepath, body, visitedTypes, missingScalars, field.type);
|
|
61159
60934
|
members.push(
|
|
61160
|
-
|
|
61161
|
-
|
|
61162
|
-
|
|
60935
|
+
AST7.tsPropertySignature(
|
|
60936
|
+
AST7.identifier(field.name),
|
|
60937
|
+
AST7.tsTypeAnnotation(
|
|
61163
60938
|
tsTypeReference(config, filepath, missingScalars, field, body)
|
|
61164
60939
|
),
|
|
61165
|
-
|
|
60940
|
+
graphql18.isNullableType(field.type)
|
|
61166
60941
|
)
|
|
61167
60942
|
);
|
|
61168
60943
|
}
|
|
61169
|
-
body.push(
|
|
60944
|
+
body.push(AST7.tsTypeAliasDeclaration(AST7.identifier(type.name), AST7.tsTypeLiteral(members)));
|
|
61170
60945
|
}
|
|
61171
60946
|
|
|
61172
60947
|
// src/codegen/generators/typescript/inlineType.ts
|
|
61173
60948
|
var recast9 = __toESM(require_main2(), 1);
|
|
61174
|
-
import * as
|
|
60949
|
+
import * as graphql19 from "graphql";
|
|
60950
|
+
|
|
60951
|
+
// src/codegen/generators/comments/jsdoc.ts
|
|
60952
|
+
var recast8 = __toESM(require_main2(), 1);
|
|
60953
|
+
var AST8 = recast8.types.builders;
|
|
60954
|
+
function jsdocComment(text, deprecated) {
|
|
60955
|
+
let commentContent = `*
|
|
60956
|
+
* ${text}
|
|
60957
|
+
`;
|
|
60958
|
+
if (deprecated) {
|
|
60959
|
+
commentContent = `${commentContent} * @deprecated ${deprecated}
|
|
60960
|
+
`;
|
|
60961
|
+
}
|
|
60962
|
+
return AST8.commentBlock(commentContent, true);
|
|
60963
|
+
}
|
|
60964
|
+
|
|
60965
|
+
// src/codegen/generators/typescript/inlineType.ts
|
|
61175
60966
|
var AST9 = recast9.types.builders;
|
|
61176
60967
|
var fragmentKey2 = " $fragments";
|
|
61177
60968
|
function inlineType({
|
|
@@ -61192,7 +60983,7 @@ function inlineType({
|
|
|
61192
60983
|
const { type, wrappers } = unwrapType(config, rootType);
|
|
61193
60984
|
let result;
|
|
61194
60985
|
let forceNullable = false;
|
|
61195
|
-
if (
|
|
60986
|
+
if (graphql19.isScalarType(type)) {
|
|
61196
60987
|
result = scalarPropertyValue(
|
|
61197
60988
|
config,
|
|
61198
60989
|
filepath,
|
|
@@ -61201,7 +60992,7 @@ function inlineType({
|
|
|
61201
60992
|
body,
|
|
61202
60993
|
field
|
|
61203
60994
|
);
|
|
61204
|
-
} else if (
|
|
60995
|
+
} else if (graphql19.isEnumType(type)) {
|
|
61205
60996
|
ensureImports({
|
|
61206
60997
|
config,
|
|
61207
60998
|
body,
|
|
@@ -61226,11 +61017,11 @@ function inlineType({
|
|
|
61226
61017
|
for (const selection of selections) {
|
|
61227
61018
|
if (selection.kind === "InlineFragment" && selection.typeCondition) {
|
|
61228
61019
|
const fragmentType = config.schema.getType(selection.typeCondition.name.value);
|
|
61229
|
-
if (!
|
|
61020
|
+
if (!graphql19.isInterfaceType(type) && !graphql19.isUnionType(type)) {
|
|
61230
61021
|
selectedFields.push(...selection.selectionSet.selections);
|
|
61231
61022
|
continue;
|
|
61232
61023
|
}
|
|
61233
|
-
if (!
|
|
61024
|
+
if (!graphql19.isInterfaceType(fragmentType) && !graphql19.isUnionType(fragmentType)) {
|
|
61234
61025
|
if (!inlineFragments[fragmentType.name]) {
|
|
61235
61026
|
inlineFragments[fragmentType.name] = [];
|
|
61236
61027
|
}
|
|
@@ -61322,6 +61113,11 @@ function inlineType({
|
|
|
61322
61113
|
if (allOptional) {
|
|
61323
61114
|
prop.optional = true;
|
|
61324
61115
|
}
|
|
61116
|
+
if (field2.description || field2.deprecationReason) {
|
|
61117
|
+
prop.comments = [
|
|
61118
|
+
jsdocComment(field2.description ?? "", field2.deprecationReason ?? void 0)
|
|
61119
|
+
];
|
|
61120
|
+
}
|
|
61325
61121
|
return prop;
|
|
61326
61122
|
})
|
|
61327
61123
|
]);
|
|
@@ -61373,7 +61169,7 @@ function inlineType({
|
|
|
61373
61169
|
}
|
|
61374
61170
|
}
|
|
61375
61171
|
}
|
|
61376
|
-
if (objectType.type === "TSTypeLiteral" && !
|
|
61172
|
+
if (objectType.type === "TSTypeLiteral" && !graphql19.isInterfaceType(fragmentRootType) && !graphql19.isUnionType(fragmentRootType)) {
|
|
61377
61173
|
const existingTypenameIndex = objectType.members.findIndex(
|
|
61378
61174
|
(member) => member.type === "TSPropertySignature" && member.key.type === "Identifier" && member.key.name === "__typename"
|
|
61379
61175
|
);
|
|
@@ -61398,11 +61194,11 @@ function inlineType({
|
|
|
61398
61194
|
];
|
|
61399
61195
|
}
|
|
61400
61196
|
let coveredTypenames;
|
|
61401
|
-
if (
|
|
61197
|
+
if (graphql19.isInterfaceType(fragmentRootType)) {
|
|
61402
61198
|
coveredTypenames = interfaceCoveredTypenames(fragmentRootType);
|
|
61403
|
-
} else if (
|
|
61199
|
+
} else if (graphql19.isUnionType(fragmentRootType)) {
|
|
61404
61200
|
coveredTypenames = fragmentRootType.getTypes().map((type2) => type2.name);
|
|
61405
|
-
} else if (
|
|
61201
|
+
} else if (graphql19.isObjectType(fragmentRootType)) {
|
|
61406
61202
|
coveredTypenames = [fragmentRootType.name];
|
|
61407
61203
|
} else {
|
|
61408
61204
|
throw Error("unreachable code");
|
|
@@ -61438,7 +61234,7 @@ function inlineType({
|
|
|
61438
61234
|
);
|
|
61439
61235
|
}
|
|
61440
61236
|
);
|
|
61441
|
-
const parentIsUnionOrInterface = !
|
|
61237
|
+
const parentIsUnionOrInterface = !graphql19.isInterfaceType(type) && !graphql19.isUnionType(type);
|
|
61442
61238
|
const possibleTypenames = parentIsUnionOrInterface ? [parent.name] : config.schema.getPossibleTypes(type).map((type2) => type2.name);
|
|
61443
61239
|
const coveredTypenames = new Set(
|
|
61444
61240
|
Object.values(inlineFragmentSelections).flatMap((sel) => sel.coveredTypenames)
|
|
@@ -61505,7 +61301,7 @@ function selectionTypeInfo(schema, filepath, rootType, selection) {
|
|
|
61505
61301
|
},
|
|
61506
61302
|
type: schema.getType("String")
|
|
61507
61303
|
};
|
|
61508
|
-
} else if (
|
|
61304
|
+
} else if (graphql19.isNonNullType(rootType) && "getFields" in rootType.ofType) {
|
|
61509
61305
|
fields = rootType.ofType.getFields();
|
|
61510
61306
|
} else {
|
|
61511
61307
|
fields = rootType.getFields();
|
|
@@ -61517,7 +61313,7 @@ function selectionTypeInfo(schema, filepath, rootType, selection) {
|
|
|
61517
61313
|
message: `Could not find type information for field ${rootType.toString()}.${selectionName} ${field}`
|
|
61518
61314
|
});
|
|
61519
61315
|
}
|
|
61520
|
-
const fieldType =
|
|
61316
|
+
const fieldType = graphql19.getNamedType(field.type);
|
|
61521
61317
|
if (!fieldType) {
|
|
61522
61318
|
throw new HoudiniError({
|
|
61523
61319
|
filepath,
|
|
@@ -62026,7 +61822,7 @@ async function generateFragmentTypeDefs(config, filepath, body, selections, defi
|
|
|
62026
61822
|
|
|
62027
61823
|
// src/codegen/generators/typescript/imperativeTypeDef.ts
|
|
62028
61824
|
var recast12 = __toESM(require_main2(), 1);
|
|
62029
|
-
import * as
|
|
61825
|
+
import * as graphql20 from "graphql";
|
|
62030
61826
|
var AST12 = recast12.types.builders;
|
|
62031
61827
|
async function imperativeCacheTypef(config, docs) {
|
|
62032
61828
|
const returnType = (doc) => config.plugins.find((plugin2) => plugin2.graphqlTagReturn)?.graphqlTagReturn?.({
|
|
@@ -62077,7 +61873,7 @@ function typeDefinitions(config, filepath, body, docs, returnType) {
|
|
|
62077
61873
|
const operationTypes = [config.schema.getMutationType(), config.schema.getSubscriptionType()].filter(Boolean).map((type) => type?.name);
|
|
62078
61874
|
const visitedTypes = /* @__PURE__ */ new Set();
|
|
62079
61875
|
const types14 = Object.values(config.schema.getTypeMap()).filter(
|
|
62080
|
-
(type) => !
|
|
61876
|
+
(type) => !graphql20.isAbstractType(type) && !graphql20.isScalarType(type) && !graphql20.isEnumType(type) && !graphql20.isInputObjectType(type) && !type.name.startsWith("__") && !operationTypes.includes(type.name)
|
|
62081
61877
|
);
|
|
62082
61878
|
const fragmentMap = fragmentListMap(
|
|
62083
61879
|
config,
|
|
@@ -62094,7 +61890,7 @@ function typeDefinitions(config, filepath, body, docs, returnType) {
|
|
|
62094
61890
|
}
|
|
62095
61891
|
let idFields = AST12.tsNeverKeyword();
|
|
62096
61892
|
const keys2 = keyFieldsForType(config.configFile, type.name);
|
|
62097
|
-
if (
|
|
61893
|
+
if (graphql20.isObjectType(type) && keys2.length > 0 && keys2.every((key) => type.getFields()[key])) {
|
|
62098
61894
|
idFields = AST12.tsTypeLiteral(
|
|
62099
61895
|
keys2.map((key) => {
|
|
62100
61896
|
const fieldType = type.getFields()[key];
|
|
@@ -62121,13 +61917,13 @@ function typeDefinitions(config, filepath, body, docs, returnType) {
|
|
|
62121
61917
|
idFields = AST12.tsTypeLiteral([]);
|
|
62122
61918
|
}
|
|
62123
61919
|
let fields = AST12.tsTypeLiteral([]);
|
|
62124
|
-
if (
|
|
61920
|
+
if (graphql20.isObjectType(type)) {
|
|
62125
61921
|
fields = AST12.tsTypeLiteral(
|
|
62126
61922
|
Object.entries(type.getFields()).map(
|
|
62127
61923
|
([key, fieldType]) => {
|
|
62128
61924
|
const unwrapped = unwrapType(config, fieldType.type);
|
|
62129
61925
|
let typeOptions = AST12.tsUnionType([]);
|
|
62130
|
-
if (
|
|
61926
|
+
if (graphql20.isScalarType(unwrapped.type)) {
|
|
62131
61927
|
typeOptions.types.push(
|
|
62132
61928
|
scalarPropertyValue(
|
|
62133
61929
|
config,
|
|
@@ -62141,11 +61937,11 @@ function typeDefinitions(config, filepath, body, docs, returnType) {
|
|
|
62141
61937
|
}
|
|
62142
61938
|
)
|
|
62143
61939
|
);
|
|
62144
|
-
} else if (
|
|
61940
|
+
} else if (graphql20.isEnumType(unwrapped.type)) {
|
|
62145
61941
|
typeOptions.types.push(
|
|
62146
61942
|
AST12.tsTypeReference(AST12.identifier(unwrapped.type.name))
|
|
62147
61943
|
);
|
|
62148
|
-
} else if (!
|
|
61944
|
+
} else if (!graphql20.isAbstractType(unwrapped.type)) {
|
|
62149
61945
|
typeOptions.types.push(record(unwrapped.type.name));
|
|
62150
61946
|
} else {
|
|
62151
61947
|
typeOptions.types.push(
|
|
@@ -62241,7 +62037,7 @@ function listDefinitions(config, filepath, body, docs) {
|
|
|
62241
62037
|
const lists = [];
|
|
62242
62038
|
const visitedLists = /* @__PURE__ */ new Set();
|
|
62243
62039
|
for (const doc of docs) {
|
|
62244
|
-
|
|
62040
|
+
graphql20.visit(doc.document, {
|
|
62245
62041
|
Directive(node, key, parent2, path2, ancestors) {
|
|
62246
62042
|
if (![config.listDirective, config.paginateDirective].includes(node.name.value)) {
|
|
62247
62043
|
return;
|
|
@@ -62263,7 +62059,7 @@ function listDefinitions(config, filepath, body, docs) {
|
|
|
62263
62059
|
const targetFieldDefinition = parentType.getFields()[targetField.name.value];
|
|
62264
62060
|
const { type: listType } = unwrapType(config, targetFieldDefinition.type);
|
|
62265
62061
|
const possibleTypes = [];
|
|
62266
|
-
if (
|
|
62062
|
+
if (graphql20.isAbstractType(listType)) {
|
|
62267
62063
|
possibleTypes.push(
|
|
62268
62064
|
...config.schema.getPossibleTypes(listType).map((possible) => possible.name)
|
|
62269
62065
|
);
|
|
@@ -62425,7 +62221,7 @@ async function typescriptGenerator(config, docs) {
|
|
|
62425
62221
|
}
|
|
62426
62222
|
|
|
62427
62223
|
// src/codegen/generators/persistedQueries/index.ts
|
|
62428
|
-
import * as
|
|
62224
|
+
import * as graphql21 from "graphql";
|
|
62429
62225
|
async function persistOutputGenerator(config, docs) {
|
|
62430
62226
|
if (!config.persistedQueriesPath.endsWith(".json")) {
|
|
62431
62227
|
throw new Error('Can write Persisted Queries only in a ".json" file.');
|
|
@@ -62435,8 +62231,8 @@ async function persistOutputGenerator(config, docs) {
|
|
|
62435
62231
|
if (!generateArtifact) {
|
|
62436
62232
|
return acc;
|
|
62437
62233
|
}
|
|
62438
|
-
let rawString =
|
|
62439
|
-
|
|
62234
|
+
let rawString = graphql21.print(
|
|
62235
|
+
graphql21.visit(document, {
|
|
62440
62236
|
Directive(node) {
|
|
62441
62237
|
if (config.isInternalDirective(node.name.value)) {
|
|
62442
62238
|
return null;
|
|
@@ -62445,7 +62241,7 @@ async function persistOutputGenerator(config, docs) {
|
|
|
62445
62241
|
})
|
|
62446
62242
|
);
|
|
62447
62243
|
const operations = document.definitions.filter(
|
|
62448
|
-
({ kind }) => kind ===
|
|
62244
|
+
({ kind }) => kind === graphql21.Kind.OPERATION_DEFINITION
|
|
62449
62245
|
);
|
|
62450
62246
|
if (operations.length > 0 && operations[0].kind === "OperationDefinition") {
|
|
62451
62247
|
if (artifact) {
|
|
@@ -62460,33 +62256,45 @@ async function persistOutputGenerator(config, docs) {
|
|
|
62460
62256
|
}
|
|
62461
62257
|
|
|
62462
62258
|
// src/codegen/generators/definitions/index.ts
|
|
62463
|
-
import * as
|
|
62259
|
+
import * as graphql23 from "graphql";
|
|
62464
62260
|
|
|
62465
62261
|
// src/codegen/generators/definitions/enums.ts
|
|
62466
62262
|
var recast13 = __toESM(require_main2(), 1);
|
|
62467
|
-
import * as
|
|
62263
|
+
import * as graphql22 from "graphql";
|
|
62468
62264
|
var AST13 = recast13.types.builders;
|
|
62469
62265
|
async function definitionsGenerator(config) {
|
|
62470
|
-
const enums =
|
|
62266
|
+
const enums = graphql22.parse(graphql22.printSchema(config.schema)).definitions.filter(
|
|
62471
62267
|
(definition) => definition.kind === "EnumTypeDefinition"
|
|
62472
62268
|
).filter((def) => !config.isInternalEnum(def));
|
|
62473
62269
|
const { code: runtimeDefinitions } = await printJS(
|
|
62474
62270
|
AST13.program(
|
|
62475
62271
|
enums.map((defn) => {
|
|
62476
62272
|
const name = defn.name.value;
|
|
62477
|
-
|
|
62273
|
+
const declaration = moduleExport(
|
|
62478
62274
|
config,
|
|
62479
62275
|
name,
|
|
62480
62276
|
AST13.objectExpression(
|
|
62481
62277
|
defn.values?.map((value) => {
|
|
62482
62278
|
const str = value.name.value;
|
|
62483
|
-
|
|
62279
|
+
const prop = AST13.objectProperty(
|
|
62484
62280
|
AST13.stringLiteral(str),
|
|
62485
62281
|
AST13.stringLiteral(str)
|
|
62486
62282
|
);
|
|
62283
|
+
const deprecationReason = value.directives?.find((d) => d.name.value === "deprecated")?.arguments?.find((a) => a.name.value === "reason")?.value?.value;
|
|
62284
|
+
if (value.description || deprecationReason)
|
|
62285
|
+
prop.comments = [
|
|
62286
|
+
jsdocComment(value.description?.value ?? "", deprecationReason)
|
|
62287
|
+
];
|
|
62288
|
+
return prop;
|
|
62487
62289
|
}) || []
|
|
62488
62290
|
)
|
|
62489
62291
|
);
|
|
62292
|
+
if (defn.description) {
|
|
62293
|
+
declaration.comments = [
|
|
62294
|
+
AST13.commentBlock(`* ${defn.description.value} `, true, false)
|
|
62295
|
+
];
|
|
62296
|
+
}
|
|
62297
|
+
return declaration;
|
|
62490
62298
|
})
|
|
62491
62299
|
)
|
|
62492
62300
|
);
|
|
@@ -62495,11 +62303,19 @@ type ValuesOf<T> = T[keyof T]
|
|
|
62495
62303
|
` + enums.sort((a, b) => a.name.value.localeCompare(b.name.value)).map((definition) => {
|
|
62496
62304
|
const name = definition.name.value;
|
|
62497
62305
|
const values = definition.values;
|
|
62498
|
-
|
|
62306
|
+
let jsdoc = "";
|
|
62307
|
+
if (definition.description) {
|
|
62308
|
+
jsdoc = `
|
|
62309
|
+
/** ${definition.description.value} */`;
|
|
62310
|
+
}
|
|
62311
|
+
return `${jsdoc}
|
|
62499
62312
|
export declare const ${name}: {
|
|
62500
|
-
${values?.map(
|
|
62313
|
+
${values?.map(
|
|
62314
|
+
(value) => (value.description ? ` /** ${value.description.value} */
|
|
62315
|
+
` : "") + ` readonly ${value.name.value}: "${value.name.value}";`
|
|
62316
|
+
).join("\n")}
|
|
62501
62317
|
}
|
|
62502
|
-
|
|
62318
|
+
${jsdoc}
|
|
62503
62319
|
export type ${name}$options = ValuesOf<typeof ${name}>
|
|
62504
62320
|
`;
|
|
62505
62321
|
}).join("");
|
|
@@ -62519,7 +62335,7 @@ async function schemaGenerator(config) {
|
|
|
62519
62335
|
await Promise.all([
|
|
62520
62336
|
fs_exports.writeFile(
|
|
62521
62337
|
config.definitionsSchemaPath,
|
|
62522
|
-
config.localSchema ?
|
|
62338
|
+
config.localSchema ? graphql23.printSchema(config.schema) : config.newSchema
|
|
62523
62339
|
),
|
|
62524
62340
|
fs_exports.writeFile(config.definitionsDocumentsPath, config.newDocuments),
|
|
62525
62341
|
definitionsGenerator(config)
|
|
@@ -64224,7 +64040,7 @@ function mergeGraphQLTypes(typeSource, config) {
|
|
|
64224
64040
|
}
|
|
64225
64041
|
|
|
64226
64042
|
// src/codegen/transforms/schema.ts
|
|
64227
|
-
import * as
|
|
64043
|
+
import * as graphql24 from "graphql";
|
|
64228
64044
|
async function graphqlExtensions(config, documents) {
|
|
64229
64045
|
let internalSchema = `
|
|
64230
64046
|
enum CachePolicy {
|
|
@@ -64347,7 +64163,7 @@ directive @${config.componentFieldDirective}(field: String!, prop: String, expor
|
|
|
64347
64163
|
const args = fragmentArguments(config, "", field.parent);
|
|
64348
64164
|
if (args.length > 0) {
|
|
64349
64165
|
argString = "(" + args.map((arg) => {
|
|
64350
|
-
const typeName =
|
|
64166
|
+
const typeName = graphql24.print(arg.type);
|
|
64351
64167
|
return `${arg.name}:${typeName}${arg.required ? "!" : ""}`;
|
|
64352
64168
|
}).join("\n") + ")";
|
|
64353
64169
|
}
|
|
@@ -64357,20 +64173,20 @@ directive @${config.componentFieldDirective}(field: String!, prop: String, expor
|
|
|
64357
64173
|
`;
|
|
64358
64174
|
}).join("\n");
|
|
64359
64175
|
extensions += `${Object.keys(config.configFile.features?.runtimeScalars ?? {}).map((scalar) => `scalar ${scalar}`).join("\n")}`;
|
|
64360
|
-
config.newSchema =
|
|
64176
|
+
config.newSchema = graphql24.print(mergeTypeDefs([internalSchema, config.newSchema]));
|
|
64361
64177
|
config.schemaString += extensions;
|
|
64362
|
-
config.schema =
|
|
64363
|
-
|
|
64364
|
-
mergeTypeDefs([
|
|
64178
|
+
config.schema = graphql24.buildSchema(
|
|
64179
|
+
graphql24.print(
|
|
64180
|
+
mergeTypeDefs([graphql24.printSchema(config.schema), internalSchema, extensions])
|
|
64365
64181
|
)
|
|
64366
64182
|
);
|
|
64367
64183
|
}
|
|
64368
64184
|
|
|
64369
64185
|
// src/codegen/transforms/typename.ts
|
|
64370
|
-
import * as
|
|
64186
|
+
import * as graphql25 from "graphql";
|
|
64371
64187
|
async function addTypename(config, documents) {
|
|
64372
64188
|
for (const doc of documents) {
|
|
64373
|
-
doc.document =
|
|
64189
|
+
doc.document = graphql25.visit(doc.document, {
|
|
64374
64190
|
Field(node, key, parent2, path2, ancestors) {
|
|
64375
64191
|
if (!node.selectionSet) {
|
|
64376
64192
|
return;
|
|
@@ -64382,7 +64198,7 @@ async function addTypename(config, documents) {
|
|
|
64382
64198
|
);
|
|
64383
64199
|
const field = type.getFields()[node.name.value];
|
|
64384
64200
|
const fieldType = unwrapType(config, field.type).type;
|
|
64385
|
-
if (
|
|
64201
|
+
if (graphql25.isInterfaceType(fieldType) || graphql25.isUnionType(fieldType)) {
|
|
64386
64202
|
return {
|
|
64387
64203
|
...node,
|
|
64388
64204
|
selectionSet: {
|
|
@@ -64390,9 +64206,9 @@ async function addTypename(config, documents) {
|
|
|
64390
64206
|
selections: [
|
|
64391
64207
|
...node.selectionSet.selections,
|
|
64392
64208
|
{
|
|
64393
|
-
kind:
|
|
64209
|
+
kind: graphql25.Kind.FIELD,
|
|
64394
64210
|
name: {
|
|
64395
|
-
kind:
|
|
64211
|
+
kind: graphql25.Kind.NAME,
|
|
64396
64212
|
value: "__typename"
|
|
64397
64213
|
}
|
|
64398
64214
|
}
|
|
@@ -64409,9 +64225,9 @@ async function addTypename(config, documents) {
|
|
|
64409
64225
|
selections: [
|
|
64410
64226
|
...node.selectionSet.selections,
|
|
64411
64227
|
{
|
|
64412
|
-
kind:
|
|
64228
|
+
kind: graphql25.Kind.FIELD,
|
|
64413
64229
|
name: {
|
|
64414
|
-
kind:
|
|
64230
|
+
kind: graphql25.Kind.NAME,
|
|
64415
64231
|
value: "__typename"
|
|
64416
64232
|
}
|
|
64417
64233
|
}
|
|
@@ -64424,10 +64240,10 @@ async function addTypename(config, documents) {
|
|
|
64424
64240
|
}
|
|
64425
64241
|
|
|
64426
64242
|
// src/codegen/transforms/addID.ts
|
|
64427
|
-
import * as
|
|
64243
|
+
import * as graphql26 from "graphql";
|
|
64428
64244
|
async function addID(config, documents) {
|
|
64429
64245
|
for (const doc of documents) {
|
|
64430
|
-
doc.document =
|
|
64246
|
+
doc.document = graphql26.visit(doc.document, {
|
|
64431
64247
|
Field(node, key, parent2, path2, ancestors) {
|
|
64432
64248
|
if (!node.selectionSet) {
|
|
64433
64249
|
return;
|
|
@@ -64465,7 +64281,7 @@ function addKeysToSelection(config, node, fieldType) {
|
|
|
64465
64281
|
if (!node.selectionSet || node.selectionSet.selections.length == 0) {
|
|
64466
64282
|
return;
|
|
64467
64283
|
}
|
|
64468
|
-
if (!
|
|
64284
|
+
if (!graphql26.isObjectType(fieldType) && !graphql26.isInterfaceType(fieldType)) {
|
|
64469
64285
|
return;
|
|
64470
64286
|
}
|
|
64471
64287
|
const keyFields = config.keyFieldsForType(fieldType.name);
|
|
@@ -64480,9 +64296,9 @@ function addKeysToSelection(config, node, fieldType) {
|
|
|
64480
64296
|
continue;
|
|
64481
64297
|
}
|
|
64482
64298
|
selections.push({
|
|
64483
|
-
kind:
|
|
64299
|
+
kind: graphql26.Kind.FIELD,
|
|
64484
64300
|
name: {
|
|
64485
|
-
kind:
|
|
64301
|
+
kind: graphql26.Kind.NAME,
|
|
64486
64302
|
value: keyField
|
|
64487
64303
|
}
|
|
64488
64304
|
});
|
|
@@ -64497,13 +64313,13 @@ function addKeysToSelection(config, node, fieldType) {
|
|
|
64497
64313
|
}
|
|
64498
64314
|
|
|
64499
64315
|
// src/codegen/transforms/componentFields.ts
|
|
64500
|
-
import * as
|
|
64316
|
+
import * as graphql27 from "graphql";
|
|
64501
64317
|
async function componentFields(config, documents) {
|
|
64502
64318
|
for (const document of documents) {
|
|
64503
|
-
const typeInfo = new
|
|
64504
|
-
document.document =
|
|
64319
|
+
const typeInfo = new graphql27.TypeInfo(config.schema);
|
|
64320
|
+
document.document = graphql27.visit(
|
|
64505
64321
|
document.document,
|
|
64506
|
-
|
|
64322
|
+
graphql27.visitWithTypeInfo(typeInfo, {
|
|
64507
64323
|
Field(node) {
|
|
64508
64324
|
const parentType = typeInfo.getParentType();
|
|
64509
64325
|
if (!parentType) {
|
|
@@ -64552,10 +64368,10 @@ async function componentFields(config, documents) {
|
|
|
64552
64368
|
}
|
|
64553
64369
|
|
|
64554
64370
|
// src/codegen/transforms/runtimeScalars.ts
|
|
64555
|
-
import * as
|
|
64371
|
+
import * as graphql28 from "graphql";
|
|
64556
64372
|
async function addTypename2(config, documents) {
|
|
64557
64373
|
for (const doc of documents) {
|
|
64558
|
-
doc.document =
|
|
64374
|
+
doc.document = graphql28.visit(doc.document, {
|
|
64559
64375
|
VariableDefinition(node) {
|
|
64560
64376
|
const { type, wrappers } = unwrapType(config, node.type);
|
|
64561
64377
|
const runtimeScalar = config.configFile.features?.runtimeScalars?.[type.name];
|
|
@@ -64594,7 +64410,7 @@ async function addTypename2(config, documents) {
|
|
|
64594
64410
|
}
|
|
64595
64411
|
|
|
64596
64412
|
// src/codegen/validators/typeCheck.ts
|
|
64597
|
-
import * as
|
|
64413
|
+
import * as graphql29 from "graphql";
|
|
64598
64414
|
async function typeCheck(config, docs) {
|
|
64599
64415
|
const errors = [];
|
|
64600
64416
|
const freeLists = [];
|
|
@@ -64602,7 +64418,7 @@ async function typeCheck(config, docs) {
|
|
|
64602
64418
|
const listTypes = [];
|
|
64603
64419
|
const fragments = {};
|
|
64604
64420
|
for (const { document: parsed, originalString, filename } of docs) {
|
|
64605
|
-
|
|
64421
|
+
graphql29.visit(parsed, {
|
|
64606
64422
|
FragmentDefinition(definition) {
|
|
64607
64423
|
fragments[definition.name.value] = definition;
|
|
64608
64424
|
},
|
|
@@ -64647,14 +64463,14 @@ async function typeCheck(config, docs) {
|
|
|
64647
64463
|
);
|
|
64648
64464
|
return;
|
|
64649
64465
|
}
|
|
64650
|
-
if (
|
|
64466
|
+
if (graphql29.isListType(rootType) || graphql29.isNonNullType(rootType) && graphql29.isListType(rootType.ofType)) {
|
|
64651
64467
|
needsParent = true;
|
|
64652
64468
|
break;
|
|
64653
64469
|
}
|
|
64654
|
-
if (
|
|
64470
|
+
if (graphql29.isNonNullType(rootType) && "ofType" in rootType) {
|
|
64655
64471
|
rootType = rootType.ofType;
|
|
64656
64472
|
}
|
|
64657
|
-
if (
|
|
64473
|
+
if (graphql29.isScalarType(rootType)) {
|
|
64658
64474
|
break;
|
|
64659
64475
|
}
|
|
64660
64476
|
rootType = rootType?.getFields()[parent3.name.value]?.type;
|
|
@@ -64730,9 +64546,9 @@ async function typeCheck(config, docs) {
|
|
|
64730
64546
|
);
|
|
64731
64547
|
}
|
|
64732
64548
|
let targetTypes = [type];
|
|
64733
|
-
if (
|
|
64549
|
+
if (graphql29.isUnionType(type)) {
|
|
64734
64550
|
targetTypes = config.schema.getPossibleTypes(type);
|
|
64735
|
-
} else if (
|
|
64551
|
+
} else if (graphql29.isInterfaceType(type)) {
|
|
64736
64552
|
try {
|
|
64737
64553
|
for (const key of config.keyFieldsForType(type.name)) {
|
|
64738
64554
|
if (!type.getFields()[key]) {
|
|
@@ -64768,13 +64584,13 @@ async function typeCheck(config, docs) {
|
|
|
64768
64584
|
if (errors.length > 0) {
|
|
64769
64585
|
throw errors;
|
|
64770
64586
|
}
|
|
64771
|
-
const rules = (filepath) => [...
|
|
64587
|
+
const rules = (filepath) => [...graphql29.specifiedRules].filter(
|
|
64772
64588
|
(rule) => ![
|
|
64773
|
-
|
|
64774
|
-
|
|
64775
|
-
|
|
64776
|
-
|
|
64777
|
-
|
|
64589
|
+
graphql29.NoUnusedFragmentsRule,
|
|
64590
|
+
graphql29.KnownFragmentNamesRule,
|
|
64591
|
+
graphql29.ExecutableDefinitionsRule,
|
|
64592
|
+
graphql29.KnownDirectivesRule,
|
|
64593
|
+
graphql29.KnownArgumentNamesRule
|
|
64778
64594
|
].includes(rule)
|
|
64779
64595
|
).concat(
|
|
64780
64596
|
validateLists({
|
|
@@ -64795,7 +64611,7 @@ async function typeCheck(config, docs) {
|
|
|
64795
64611
|
validateLoadingDirective(config)
|
|
64796
64612
|
);
|
|
64797
64613
|
for (const { filename, document: parsed, originalString } of docs) {
|
|
64798
|
-
for (const error of
|
|
64614
|
+
for (const error of graphql29.validate(config.schema, parsed, rules(filename))) {
|
|
64799
64615
|
errors.push(
|
|
64800
64616
|
new HoudiniError({
|
|
64801
64617
|
filepath: filename,
|
|
@@ -64824,20 +64640,20 @@ function validateRequiredDirective(config, filepath) {
|
|
|
64824
64640
|
if (!node.directives?.some(({ name }) => name.value === config.requiredDirective))
|
|
64825
64641
|
return;
|
|
64826
64642
|
const parentType = parentTypeFromAncestors(config.schema, filepath, ancestors);
|
|
64827
|
-
if (!
|
|
64643
|
+
if (!graphql29.isObjectType(parentType)) {
|
|
64828
64644
|
ctx.reportError(
|
|
64829
|
-
new
|
|
64645
|
+
new graphql29.GraphQLError(
|
|
64830
64646
|
`@${config.requiredDirective} may only be used on objects, not arguments`
|
|
64831
64647
|
)
|
|
64832
64648
|
);
|
|
64833
64649
|
return;
|
|
64834
64650
|
}
|
|
64835
64651
|
const type = parentType.getFields()[node.name.value].type;
|
|
64836
|
-
const isServerNullable = !
|
|
64652
|
+
const isServerNullable = !graphql29.isNonNullType(type);
|
|
64837
64653
|
const isAlreadyClientNullable = isClientNullable(node, true);
|
|
64838
64654
|
if (!isServerNullable && !isAlreadyClientNullable) {
|
|
64839
64655
|
ctx.reportError(
|
|
64840
|
-
new
|
|
64656
|
+
new graphql29.GraphQLError(
|
|
64841
64657
|
`@${config.requiredDirective} may only be used on nullable fields`
|
|
64842
64658
|
)
|
|
64843
64659
|
);
|
|
@@ -64859,7 +64675,7 @@ var validateLists = ({
|
|
|
64859
64675
|
if (!config.isListFragment(node.name.value)) {
|
|
64860
64676
|
if (!fragments[node.name.value]) {
|
|
64861
64677
|
ctx.reportError(
|
|
64862
|
-
new
|
|
64678
|
+
new graphql29.GraphQLError(
|
|
64863
64679
|
"Encountered unknown fragment: " + node.name.value
|
|
64864
64680
|
)
|
|
64865
64681
|
);
|
|
@@ -64869,7 +64685,7 @@ var validateLists = ({
|
|
|
64869
64685
|
const listName = config.listNameFromFragment(node.name.value);
|
|
64870
64686
|
if (!lists.includes(listName)) {
|
|
64871
64687
|
ctx.reportError(
|
|
64872
|
-
new
|
|
64688
|
+
new graphql29.GraphQLError(
|
|
64873
64689
|
"Encountered fragment referencing unknown list: " + listName
|
|
64874
64690
|
)
|
|
64875
64691
|
);
|
|
@@ -64894,7 +64710,7 @@ var validateLists = ({
|
|
|
64894
64710
|
);
|
|
64895
64711
|
if (parentArg) {
|
|
64896
64712
|
ctx.reportError(
|
|
64897
|
-
new
|
|
64713
|
+
new graphql29.GraphQLError(
|
|
64898
64714
|
`@${config.deprecatedlistDirectiveParentIDArg} should be defined only in it's own directive now`
|
|
64899
64715
|
)
|
|
64900
64716
|
);
|
|
@@ -64910,7 +64726,7 @@ var validateLists = ({
|
|
|
64910
64726
|
return;
|
|
64911
64727
|
}
|
|
64912
64728
|
ctx.reportError(
|
|
64913
|
-
new
|
|
64729
|
+
new graphql29.GraphQLError(
|
|
64914
64730
|
`For this list fragment, you need to add or @${config.listParentDirective} or @${config.listAllListsDirective} directive to specify the behavior`
|
|
64915
64731
|
)
|
|
64916
64732
|
);
|
|
@@ -64920,7 +64736,7 @@ var validateLists = ({
|
|
|
64920
64736
|
const directiveName = node.name.value;
|
|
64921
64737
|
if (directiveName === "connection") {
|
|
64922
64738
|
ctx.reportError(
|
|
64923
|
-
new
|
|
64739
|
+
new graphql29.GraphQLError(
|
|
64924
64740
|
"@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
64741
|
)
|
|
64926
64742
|
);
|
|
@@ -64929,7 +64745,7 @@ var validateLists = ({
|
|
|
64929
64745
|
if (!config.isInternalDirective(node.name.value)) {
|
|
64930
64746
|
if (!config.schema.getDirective(directiveName)) {
|
|
64931
64747
|
ctx.reportError(
|
|
64932
|
-
new
|
|
64748
|
+
new graphql29.GraphQLError(
|
|
64933
64749
|
"Encountered unknown directive: " + directiveName
|
|
64934
64750
|
)
|
|
64935
64751
|
);
|
|
@@ -64938,7 +64754,7 @@ var validateLists = ({
|
|
|
64938
64754
|
}
|
|
64939
64755
|
if (config.isListOperationDirective(directiveName) && !listTypes.includes(config.listNameFromDirective(directiveName))) {
|
|
64940
64756
|
ctx.reportError(
|
|
64941
|
-
new
|
|
64757
|
+
new graphql29.GraphQLError(
|
|
64942
64758
|
"Encountered directive referencing unknown list: " + directiveName
|
|
64943
64759
|
)
|
|
64944
64760
|
);
|
|
@@ -64949,7 +64765,7 @@ var validateLists = ({
|
|
|
64949
64765
|
};
|
|
64950
64766
|
function knownArguments(config) {
|
|
64951
64767
|
return function(ctx) {
|
|
64952
|
-
const nativeValidator =
|
|
64768
|
+
const nativeValidator = graphql29.KnownArgumentNamesRule(ctx);
|
|
64953
64769
|
return {
|
|
64954
64770
|
...nativeValidator,
|
|
64955
64771
|
Directive(directiveNode) {
|
|
@@ -64984,7 +64800,7 @@ function validateFragmentArguments(config, filepath, fragments) {
|
|
|
64984
64800
|
for (const arg of node.arguments || []) {
|
|
64985
64801
|
if (arg.value.kind !== "ObjectValue") {
|
|
64986
64802
|
ctx.reportError(
|
|
64987
|
-
new
|
|
64803
|
+
new graphql29.GraphQLError("values in @arguments must be an object")
|
|
64988
64804
|
);
|
|
64989
64805
|
return;
|
|
64990
64806
|
}
|
|
@@ -64994,13 +64810,13 @@ function validateFragmentArguments(config, filepath, fragments) {
|
|
|
64994
64810
|
);
|
|
64995
64811
|
if (!typeArg) {
|
|
64996
64812
|
ctx.reportError(
|
|
64997
|
-
new
|
|
64813
|
+
new graphql29.GraphQLError("missing type field for @arguments directive")
|
|
64998
64814
|
);
|
|
64999
64815
|
return;
|
|
65000
64816
|
}
|
|
65001
|
-
if (typeArg.value.kind !==
|
|
64817
|
+
if (typeArg.value.kind !== graphql29.Kind.STRING) {
|
|
65002
64818
|
ctx.reportError(
|
|
65003
|
-
new
|
|
64819
|
+
new graphql29.GraphQLError("type field to @arguments must be a string")
|
|
65004
64820
|
);
|
|
65005
64821
|
return;
|
|
65006
64822
|
}
|
|
@@ -65013,7 +64829,7 @@ function validateFragmentArguments(config, filepath, fragments) {
|
|
|
65013
64829
|
);
|
|
65014
64830
|
if (typeArg.value.value !== defaultValueType) {
|
|
65015
64831
|
ctx.reportError(
|
|
65016
|
-
new
|
|
64832
|
+
new graphql29.GraphQLError(
|
|
65017
64833
|
`Invalid default value provided for ${arg.name.value}. Expected ${typeArg.value.value}, found ${defaultValueType}`
|
|
65018
64834
|
)
|
|
65019
64835
|
);
|
|
@@ -65031,7 +64847,7 @@ function validateFragmentArguments(config, filepath, fragments) {
|
|
|
65031
64847
|
try {
|
|
65032
64848
|
args = fragmentArguments(config, filepath, fragments[fragmentName]);
|
|
65033
64849
|
} catch (e) {
|
|
65034
|
-
ctx.reportError(new
|
|
64850
|
+
ctx.reportError(new graphql29.GraphQLError(e.message));
|
|
65035
64851
|
return;
|
|
65036
64852
|
}
|
|
65037
64853
|
fragmentArguments2[fragmentName] = args;
|
|
@@ -65054,7 +64870,7 @@ function validateFragmentArguments(config, filepath, fragments) {
|
|
|
65054
64870
|
);
|
|
65055
64871
|
if (missing.length > 0) {
|
|
65056
64872
|
ctx.reportError(
|
|
65057
|
-
new
|
|
64873
|
+
new graphql29.GraphQLError(
|
|
65058
64874
|
`The following arguments are missing from the "${fragmentName}" fragment: ` + JSON.stringify(missing)
|
|
65059
64875
|
)
|
|
65060
64876
|
);
|
|
@@ -65065,7 +64881,7 @@ function validateFragmentArguments(config, filepath, fragments) {
|
|
|
65065
64881
|
);
|
|
65066
64882
|
if (unknown.length > 0) {
|
|
65067
64883
|
ctx.reportError(
|
|
65068
|
-
new
|
|
64884
|
+
new graphql29.GraphQLError(
|
|
65069
64885
|
"Encountered unknown arguments: " + JSON.stringify(unknown)
|
|
65070
64886
|
)
|
|
65071
64887
|
);
|
|
@@ -65077,7 +64893,7 @@ function validateFragmentArguments(config, filepath, fragments) {
|
|
|
65077
64893
|
for (const [applied, target] of zipped) {
|
|
65078
64894
|
if (!valueIsType(config, applied.value, target)) {
|
|
65079
64895
|
ctx.reportError(
|
|
65080
|
-
new
|
|
64896
|
+
new graphql29.GraphQLError(
|
|
65081
64897
|
`Invalid argument type. Expected ${target}, found ${applied.value.kind}`
|
|
65082
64898
|
)
|
|
65083
64899
|
);
|
|
@@ -65119,7 +64935,7 @@ function valueIsType(config, value, targetType) {
|
|
|
65119
64935
|
}
|
|
65120
64936
|
if (value.kind === "EnumValue" && targetType.kind === "NamedType") {
|
|
65121
64937
|
const enumType = config.schema.getType(targetType.name.value);
|
|
65122
|
-
if (!
|
|
64938
|
+
if (!graphql29.isEnumType(enumType)) {
|
|
65123
64939
|
return false;
|
|
65124
64940
|
}
|
|
65125
64941
|
return enumType.getValues().some((enumValue) => enumValue.value === value.value);
|
|
@@ -65139,7 +64955,7 @@ function paginateArgs(config, filepath) {
|
|
|
65139
64955
|
}
|
|
65140
64956
|
if (alreadyPaginated) {
|
|
65141
64957
|
ctx.reportError(
|
|
65142
|
-
new
|
|
64958
|
+
new graphql29.GraphQLError(
|
|
65143
64959
|
`@${config.paginateDirective} can only appear in a document once.`
|
|
65144
64960
|
)
|
|
65145
64961
|
);
|
|
@@ -65171,7 +64987,7 @@ function paginateArgs(config, filepath) {
|
|
|
65171
64987
|
const backwards = appliedArgs.has("last");
|
|
65172
64988
|
if (!forward && !backwards) {
|
|
65173
64989
|
ctx.reportError(
|
|
65174
|
-
new
|
|
64990
|
+
new graphql29.GraphQLError(
|
|
65175
64991
|
"A field with cursor-based pagination must have a first or last argument"
|
|
65176
64992
|
)
|
|
65177
64993
|
);
|
|
@@ -65185,7 +65001,7 @@ function paginateArgs(config, filepath) {
|
|
|
65185
65001
|
}
|
|
65186
65002
|
if (forward && backwards && paginateMode === "Infinite") {
|
|
65187
65003
|
ctx.reportError(
|
|
65188
|
-
new
|
|
65004
|
+
new graphql29.GraphQLError(
|
|
65189
65005
|
`A field with cursor pagination cannot go forwards an backwards simultaneously`
|
|
65190
65006
|
)
|
|
65191
65007
|
);
|
|
@@ -65199,7 +65015,7 @@ function paginateArgs(config, filepath) {
|
|
|
65199
65015
|
);
|
|
65200
65016
|
if (!appliedLimitArg) {
|
|
65201
65017
|
ctx.reportError(
|
|
65202
|
-
new
|
|
65018
|
+
new graphql29.GraphQLError(
|
|
65203
65019
|
"A field with offset-based pagination must have a limit argument"
|
|
65204
65020
|
)
|
|
65205
65021
|
);
|
|
@@ -65215,20 +65031,20 @@ function noUnusedFragmentArguments(config) {
|
|
|
65215
65031
|
const args = /* @__PURE__ */ new Set();
|
|
65216
65032
|
return {
|
|
65217
65033
|
enter(node) {
|
|
65218
|
-
if (node.kind ===
|
|
65034
|
+
if (node.kind === graphql29.Kind.FRAGMENT_DEFINITION) {
|
|
65219
65035
|
const definitionArguments = node.directives?.filter((directive) => directive.name.value === config.argumentsDirective).flatMap((directive) => directive.arguments);
|
|
65220
65036
|
for (const arg of definitionArguments?.map((arg2) => arg2?.name.value) || []) {
|
|
65221
65037
|
args.add(arg);
|
|
65222
65038
|
}
|
|
65223
|
-
} else if (node.kind ===
|
|
65039
|
+
} else if (node.kind === graphql29.Kind.VARIABLE) {
|
|
65224
65040
|
args.delete(node.name.value);
|
|
65225
65041
|
}
|
|
65226
65042
|
},
|
|
65227
65043
|
leave(node) {
|
|
65228
|
-
if (node.kind ===
|
|
65044
|
+
if (node.kind === graphql29.Kind.FRAGMENT_DEFINITION) {
|
|
65229
65045
|
if (args.size > 0) {
|
|
65230
65046
|
ctx.reportError(
|
|
65231
|
-
new
|
|
65047
|
+
new graphql29.GraphQLError(
|
|
65232
65048
|
"Encountered unused fragment arguments: " + [...args].join(",")
|
|
65233
65049
|
)
|
|
65234
65050
|
);
|
|
@@ -65264,7 +65080,7 @@ function nodeDirectives(config, directives) {
|
|
|
65264
65080
|
if (definition.kind === "OperationDefinition") {
|
|
65265
65081
|
if (definition.operation !== "query") {
|
|
65266
65082
|
ctx.reportError(
|
|
65267
|
-
new
|
|
65083
|
+
new graphql29.GraphQLError(
|
|
65268
65084
|
`@${node.name.value} must fall on a fragment or query document`
|
|
65269
65085
|
)
|
|
65270
65086
|
);
|
|
@@ -65276,7 +65092,7 @@ function nodeDirectives(config, directives) {
|
|
|
65276
65092
|
}
|
|
65277
65093
|
if (!possibleNodes.includes(definitionType)) {
|
|
65278
65094
|
ctx.reportError(
|
|
65279
|
-
new
|
|
65095
|
+
new graphql29.GraphQLError(paginateOnNonNodeMessage(node.name.value))
|
|
65280
65096
|
);
|
|
65281
65097
|
}
|
|
65282
65098
|
}
|
|
@@ -65295,7 +65111,7 @@ function checkMutationOperation(config) {
|
|
|
65295
65111
|
);
|
|
65296
65112
|
if (append && prepend) {
|
|
65297
65113
|
ctx.reportError(
|
|
65298
|
-
new
|
|
65114
|
+
new graphql29.GraphQLError(
|
|
65299
65115
|
`You can't apply both @${config.listPrependDirective} and @${config.listAppendDirective} at the same time`
|
|
65300
65116
|
)
|
|
65301
65117
|
);
|
|
@@ -65309,7 +65125,7 @@ function checkMutationOperation(config) {
|
|
|
65309
65125
|
);
|
|
65310
65126
|
if (parentId && allLists) {
|
|
65311
65127
|
ctx.reportError(
|
|
65312
|
-
new
|
|
65128
|
+
new graphql29.GraphQLError(
|
|
65313
65129
|
`You can't apply both @${config.listParentDirective} and @${config.listAllListsDirective} at the same time`
|
|
65314
65130
|
)
|
|
65315
65131
|
);
|
|
@@ -65331,7 +65147,7 @@ function checkMaskDirectives(config) {
|
|
|
65331
65147
|
);
|
|
65332
65148
|
if (maskEnableDirective && maskDisableDirective) {
|
|
65333
65149
|
ctx.reportError(
|
|
65334
|
-
new
|
|
65150
|
+
new graphql29.GraphQLError(
|
|
65335
65151
|
`You can't apply both @${config.maskEnableDirective} and @${config.maskDisableDirective} at the same time`
|
|
65336
65152
|
)
|
|
65337
65153
|
);
|
|
@@ -65373,7 +65189,7 @@ function validateLoadingDirective(config) {
|
|
|
65373
65189
|
);
|
|
65374
65190
|
if (!parentLoading && !global2) {
|
|
65375
65191
|
ctx.reportError(
|
|
65376
|
-
new
|
|
65192
|
+
new graphql29.GraphQLError(
|
|
65377
65193
|
`@${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
65194
|
)
|
|
65379
65195
|
);
|
|
@@ -65395,7 +65211,7 @@ function validateLoadingDirective(config) {
|
|
|
65395
65211
|
);
|
|
65396
65212
|
if (!parentLoading && !global2) {
|
|
65397
65213
|
ctx.reportError(
|
|
65398
|
-
new
|
|
65214
|
+
new graphql29.GraphQLError(
|
|
65399
65215
|
`@${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
65216
|
)
|
|
65401
65217
|
);
|
|
@@ -65410,7 +65226,7 @@ function getAndVerifyNodeInterface(config) {
|
|
|
65410
65226
|
if (!nodeInterface) {
|
|
65411
65227
|
return null;
|
|
65412
65228
|
}
|
|
65413
|
-
if (!
|
|
65229
|
+
if (!graphql29.isInterfaceType(nodeInterface)) {
|
|
65414
65230
|
displayInvalidNodeFieldMessage(config);
|
|
65415
65231
|
return null;
|
|
65416
65232
|
}
|
|
@@ -65505,11 +65321,11 @@ async function uniqueDocumentNames(config, docs) {
|
|
|
65505
65321
|
}
|
|
65506
65322
|
|
|
65507
65323
|
// src/codegen/validators/noIDAlias.ts
|
|
65508
|
-
import * as
|
|
65324
|
+
import * as graphql30 from "graphql";
|
|
65509
65325
|
async function noIDAlias(config, docs) {
|
|
65510
65326
|
const errors = [];
|
|
65511
65327
|
for (const { filename, document } of docs) {
|
|
65512
|
-
|
|
65328
|
+
graphql30.visit(document, {
|
|
65513
65329
|
Field(node, _, __, ___, ancestors) {
|
|
65514
65330
|
const fieldType = parentTypeFromAncestors(config.schema, filename, ancestors).name;
|
|
65515
65331
|
if (config.keyFieldsForType(fieldType).includes(node.alias?.value || "")) {
|
|
@@ -65548,11 +65364,11 @@ async function validatePlugins(config, documents) {
|
|
|
65548
65364
|
}
|
|
65549
65365
|
|
|
65550
65366
|
// src/codegen/validators/componentFields.ts
|
|
65551
|
-
import * as
|
|
65367
|
+
import * as graphql31 from "graphql";
|
|
65552
65368
|
async function componentFields2(config, docs) {
|
|
65553
65369
|
const errors = [];
|
|
65554
65370
|
for (const { filename: filepath, document } of docs) {
|
|
65555
|
-
|
|
65371
|
+
graphql31.visit(document, {
|
|
65556
65372
|
FragmentDefinition(node, _, __, ___, ancestors) {
|
|
65557
65373
|
const componentFieldDirective = node.directives?.find(
|
|
65558
65374
|
(dir) => dir.name.value === config.componentFieldDirective
|
|
@@ -65600,7 +65416,7 @@ async function componentFields2(config, docs) {
|
|
|
65600
65416
|
if (existingField && existingField.filepath !== filepath) {
|
|
65601
65417
|
conflict = true;
|
|
65602
65418
|
} else if (parentType && fieldValue) {
|
|
65603
|
-
const fieldDef =
|
|
65419
|
+
const fieldDef = graphql31.isObjectType(parentType) && parentType.getFields()[fieldValue];
|
|
65604
65420
|
if (fieldDef && !fieldDef.astNode?.directives?.find(
|
|
65605
65421
|
(dir) => dir.name.value === config.componentFieldDirective
|
|
65606
65422
|
)) {
|
|
@@ -65613,7 +65429,7 @@ async function componentFields2(config, docs) {
|
|
|
65613
65429
|
filepath
|
|
65614
65430
|
});
|
|
65615
65431
|
}
|
|
65616
|
-
if (parentType &&
|
|
65432
|
+
if (parentType && graphql31.isAbstractType(parentType)) {
|
|
65617
65433
|
errors.push({
|
|
65618
65434
|
message: `Cannot add component field ${parent2}.${fieldValue} because ${parent2} is an abstract type`,
|
|
65619
65435
|
filepath
|
|
@@ -65809,7 +65625,7 @@ function testConfigFile({ plugins, ...config } = {}) {
|
|
|
65809
65625
|
id: ID!
|
|
65810
65626
|
name(arg: Int): String!
|
|
65811
65627
|
birthday: DateTime!
|
|
65812
|
-
firstName: String!
|
|
65628
|
+
firstName: String! @deprecated(reason: "Use name instead")
|
|
65813
65629
|
friends: [User!]!
|
|
65814
65630
|
friendsByCursor(first: Int, after: String, last: Int, before: String, filter: String): UserConnection!
|
|
65815
65631
|
friendsByCursorSnapshot(snapshot: String!, first: Int, after: String, last: Int, before: String): UserConnection!
|
|
@@ -65839,13 +65655,22 @@ function testConfigFile({ plugins, ...config } = {}) {
|
|
|
65839
65655
|
believers(first: Int, after: String): GhostConnection
|
|
65840
65656
|
}
|
|
65841
65657
|
|
|
65658
|
+
"""
|
|
65659
|
+
Cat's documentation
|
|
65660
|
+
"""
|
|
65842
65661
|
type Cat implements Friend & Node {
|
|
65843
65662
|
id: ID!
|
|
65663
|
+
"""
|
|
65664
|
+
The name of the cat
|
|
65665
|
+
"""
|
|
65844
65666
|
name: String!
|
|
65845
65667
|
owner: User!
|
|
65846
65668
|
}
|
|
65847
65669
|
|
|
65848
65670
|
type Query {
|
|
65671
|
+
"""
|
|
65672
|
+
Get a user.
|
|
65673
|
+
"""
|
|
65849
65674
|
user: User!
|
|
65850
65675
|
entity: Entity!
|
|
65851
65676
|
version: Int!
|
|
@@ -66027,11 +65852,19 @@ function testConfigFile({ plugins, ...config } = {}) {
|
|
|
66027
65852
|
id: ID!
|
|
66028
65853
|
}
|
|
66029
65854
|
|
|
65855
|
+
"""
|
|
65856
|
+
Documentation of testenum1
|
|
65857
|
+
"""
|
|
66030
65858
|
enum TestEnum1 {
|
|
65859
|
+
"Documentation of Value1"
|
|
66031
65860
|
Value1
|
|
65861
|
+
"Documentation of Value2"
|
|
66032
65862
|
Value2
|
|
66033
65863
|
}
|
|
66034
65864
|
|
|
65865
|
+
"""
|
|
65866
|
+
Documentation of testenum2
|
|
65867
|
+
"""
|
|
66035
65868
|
enum TestEnum2 {
|
|
66036
65869
|
Value3
|
|
66037
65870
|
Value2
|
|
@@ -66116,7 +65949,7 @@ function pipelineTest(config, documents, shouldPass, testBody) {
|
|
|
66116
65949
|
};
|
|
66117
65950
|
}
|
|
66118
65951
|
function mockCollectedDoc(query2, data) {
|
|
66119
|
-
const parsed =
|
|
65952
|
+
const parsed = graphql33.parse(query2);
|
|
66120
65953
|
const name = parsed.definitions[0].name.value;
|
|
66121
65954
|
const operations = parsed.definitions;
|
|
66122
65955
|
let kind = ArtifactKind.Fragment;
|