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
|
@@ -53824,7 +53824,7 @@ var require_lib6 = __commonJS({
|
|
|
53824
53824
|
});
|
|
53825
53825
|
|
|
53826
53826
|
// src/codegen/index.ts
|
|
53827
|
-
import * as
|
|
53827
|
+
import * as graphql32 from "graphql";
|
|
53828
53828
|
|
|
53829
53829
|
// src/lib/pipeline.ts
|
|
53830
53830
|
async function runPipeline(config, pipeline, target) {
|
|
@@ -53965,47 +53965,6 @@ function deepMerge(...objects) {
|
|
|
53965
53965
|
return mergedObj;
|
|
53966
53966
|
}
|
|
53967
53967
|
|
|
53968
|
-
// src/runtime/lib/scalars.ts
|
|
53969
|
-
async function marshalSelection({
|
|
53970
|
-
selection,
|
|
53971
|
-
data
|
|
53972
|
-
}) {
|
|
53973
|
-
const config = getCurrentConfig();
|
|
53974
|
-
if (data === null || typeof data === "undefined") {
|
|
53975
|
-
return data;
|
|
53976
|
-
}
|
|
53977
|
-
if (Array.isArray(data)) {
|
|
53978
|
-
return await Promise.all(data.map((val) => marshalSelection({ selection, data: val })));
|
|
53979
|
-
}
|
|
53980
|
-
const targetSelection = getFieldsForType(selection, data["__typename"], false);
|
|
53981
|
-
return Object.fromEntries(
|
|
53982
|
-
await Promise.all(
|
|
53983
|
-
Object.entries(data).map(async ([fieldName, value]) => {
|
|
53984
|
-
const { type, selection: selection2 } = targetSelection[fieldName];
|
|
53985
|
-
if (!type) {
|
|
53986
|
-
return [fieldName, value];
|
|
53987
|
-
}
|
|
53988
|
-
if (selection2) {
|
|
53989
|
-
return [fieldName, await marshalSelection({ selection: selection2, data: value })];
|
|
53990
|
-
}
|
|
53991
|
-
if (config.scalars?.[type]) {
|
|
53992
|
-
const marshalFn = config.scalars[type].marshal;
|
|
53993
|
-
if (!marshalFn) {
|
|
53994
|
-
throw new Error(
|
|
53995
|
-
`scalar type ${type} is missing a \`marshal\` function. see https://github.com/AlecAivazis/houdini#%EF%B8%8Fcustom-scalars`
|
|
53996
|
-
);
|
|
53997
|
-
}
|
|
53998
|
-
if (Array.isArray(value)) {
|
|
53999
|
-
return [fieldName, value.map(marshalFn)];
|
|
54000
|
-
}
|
|
54001
|
-
return [fieldName, marshalFn(value)];
|
|
54002
|
-
}
|
|
54003
|
-
return [fieldName, value];
|
|
54004
|
-
})
|
|
54005
|
-
)
|
|
54006
|
-
);
|
|
54007
|
-
}
|
|
54008
|
-
|
|
54009
53968
|
// src/runtime/lib/types.ts
|
|
54010
53969
|
var CachePolicy = {
|
|
54011
53970
|
CacheOrNetwork: "CacheOrNetwork",
|
|
@@ -54033,11 +53992,6 @@ var RefetchUpdateMode = {
|
|
|
54033
53992
|
prepend: "prepend",
|
|
54034
53993
|
replace: "replace"
|
|
54035
53994
|
};
|
|
54036
|
-
var DataSource = {
|
|
54037
|
-
Cache: "cache",
|
|
54038
|
-
Network: "network",
|
|
54039
|
-
Ssr: "ssr"
|
|
54040
|
-
};
|
|
54041
53995
|
var fragmentKey = " $fragments";
|
|
54042
53996
|
var PendingValue = Symbol("houdini_loading");
|
|
54043
53997
|
|
|
@@ -56659,202 +56613,6 @@ var cache_default = new Cache();
|
|
|
56659
56613
|
// src/runtime/client/plugins/cache.ts
|
|
56660
56614
|
var serverSide = typeof globalThis.window === "undefined";
|
|
56661
56615
|
|
|
56662
|
-
// src/runtime/client/utils/documentPlugins.ts
|
|
56663
|
-
var documentPlugin = (kind, source) => {
|
|
56664
|
-
return () => {
|
|
56665
|
-
const sourceHandlers = source();
|
|
56666
|
-
const enterWrapper = (handler) => {
|
|
56667
|
-
return !handler ? void 0 : (ctx, handlers) => {
|
|
56668
|
-
if (ctx.artifact.kind !== kind) {
|
|
56669
|
-
return handlers.next(ctx);
|
|
56670
|
-
}
|
|
56671
|
-
return handler(ctx, handlers);
|
|
56672
|
-
};
|
|
56673
|
-
};
|
|
56674
|
-
const exitWrapper = (handler) => {
|
|
56675
|
-
return !handler ? void 0 : (ctx, handlers) => {
|
|
56676
|
-
if (ctx.artifact.kind !== kind) {
|
|
56677
|
-
return handlers.resolve(ctx);
|
|
56678
|
-
}
|
|
56679
|
-
return handler(ctx, handlers);
|
|
56680
|
-
};
|
|
56681
|
-
};
|
|
56682
|
-
return {
|
|
56683
|
-
start: enterWrapper(sourceHandlers.start),
|
|
56684
|
-
network: enterWrapper(sourceHandlers.network),
|
|
56685
|
-
afterNetwork: exitWrapper(sourceHandlers.afterNetwork),
|
|
56686
|
-
end: exitWrapper(sourceHandlers.end),
|
|
56687
|
-
catch: sourceHandlers.catch ? (ctx, handlers) => sourceHandlers.catch(ctx, handlers) : void 0,
|
|
56688
|
-
cleanup: (...args) => sourceHandlers.cleanup?.(...args)
|
|
56689
|
-
};
|
|
56690
|
-
};
|
|
56691
|
-
};
|
|
56692
|
-
|
|
56693
|
-
// src/runtime/client/plugins/query.ts
|
|
56694
|
-
var query = documentPlugin(ArtifactKind.Query, function() {
|
|
56695
|
-
let subscriptionSpec = null;
|
|
56696
|
-
let lastVariables = null;
|
|
56697
|
-
return {
|
|
56698
|
-
start(ctx, { next }) {
|
|
56699
|
-
const runtimeScalarPayload = {
|
|
56700
|
-
session: ctx.session
|
|
56701
|
-
};
|
|
56702
|
-
ctx.variables = {
|
|
56703
|
-
...lastVariables,
|
|
56704
|
-
...Object.fromEntries(
|
|
56705
|
-
Object.entries(ctx.artifact.input?.runtimeScalars ?? {}).map(
|
|
56706
|
-
([field, type]) => {
|
|
56707
|
-
const runtimeScalar = ctx.config.features?.runtimeScalars?.[type];
|
|
56708
|
-
if (!runtimeScalar) {
|
|
56709
|
-
return [field, type];
|
|
56710
|
-
}
|
|
56711
|
-
return [field, runtimeScalar.resolve(runtimeScalarPayload)];
|
|
56712
|
-
}
|
|
56713
|
-
)
|
|
56714
|
-
),
|
|
56715
|
-
...ctx.variables
|
|
56716
|
-
};
|
|
56717
|
-
next(ctx);
|
|
56718
|
-
},
|
|
56719
|
-
end(ctx, { resolve: resolve2, marshalVariables, variablesChanged }) {
|
|
56720
|
-
if (variablesChanged(ctx) && !ctx.cacheParams?.disableSubscriptions) {
|
|
56721
|
-
if (subscriptionSpec) {
|
|
56722
|
-
cache_default.unsubscribe(subscriptionSpec, subscriptionSpec.variables?.() || {});
|
|
56723
|
-
}
|
|
56724
|
-
lastVariables = { ...marshalVariables(ctx) };
|
|
56725
|
-
const variables = lastVariables;
|
|
56726
|
-
subscriptionSpec = {
|
|
56727
|
-
rootType: ctx.artifact.rootType,
|
|
56728
|
-
selection: ctx.artifact.selection,
|
|
56729
|
-
variables: () => variables,
|
|
56730
|
-
set: (newValue) => {
|
|
56731
|
-
resolve2(ctx, {
|
|
56732
|
-
data: newValue,
|
|
56733
|
-
errors: null,
|
|
56734
|
-
fetching: false,
|
|
56735
|
-
partial: false,
|
|
56736
|
-
stale: false,
|
|
56737
|
-
source: DataSource.Cache,
|
|
56738
|
-
variables: ctx.variables ?? {}
|
|
56739
|
-
});
|
|
56740
|
-
}
|
|
56741
|
-
};
|
|
56742
|
-
cache_default.subscribe(subscriptionSpec, lastVariables);
|
|
56743
|
-
}
|
|
56744
|
-
resolve2(ctx);
|
|
56745
|
-
},
|
|
56746
|
-
cleanup() {
|
|
56747
|
-
if (subscriptionSpec) {
|
|
56748
|
-
cache_default.unsubscribe(subscriptionSpec, subscriptionSpec.variables?.());
|
|
56749
|
-
lastVariables = null;
|
|
56750
|
-
}
|
|
56751
|
-
}
|
|
56752
|
-
};
|
|
56753
|
-
});
|
|
56754
|
-
|
|
56755
|
-
// src/runtime/client/plugins/fragment.ts
|
|
56756
|
-
var fragment = documentPlugin(ArtifactKind.Fragment, function() {
|
|
56757
|
-
let subscriptionSpec = null;
|
|
56758
|
-
let lastReference = null;
|
|
56759
|
-
return {
|
|
56760
|
-
start(ctx, { next, resolve: resolve2, variablesChanged, marshalVariables }) {
|
|
56761
|
-
if (!ctx.stuff.parentID) {
|
|
56762
|
-
return next(ctx);
|
|
56763
|
-
}
|
|
56764
|
-
const currentReference = {
|
|
56765
|
-
parent: ctx.stuff.parentID,
|
|
56766
|
-
variables: marshalVariables(ctx)
|
|
56767
|
-
};
|
|
56768
|
-
if (!ctx.cacheParams?.disableSubscriptions && (!deepEquals(lastReference, currentReference) || variablesChanged(ctx))) {
|
|
56769
|
-
if (subscriptionSpec) {
|
|
56770
|
-
cache_default.unsubscribe(subscriptionSpec, subscriptionSpec.variables?.() || {});
|
|
56771
|
-
}
|
|
56772
|
-
const variables = marshalVariables(ctx);
|
|
56773
|
-
subscriptionSpec = {
|
|
56774
|
-
rootType: ctx.artifact.rootType,
|
|
56775
|
-
selection: ctx.artifact.selection,
|
|
56776
|
-
variables: () => variables,
|
|
56777
|
-
parentID: ctx.stuff.parentID,
|
|
56778
|
-
set: (newValue) => {
|
|
56779
|
-
resolve2(ctx, {
|
|
56780
|
-
data: newValue,
|
|
56781
|
-
errors: null,
|
|
56782
|
-
fetching: false,
|
|
56783
|
-
partial: false,
|
|
56784
|
-
stale: false,
|
|
56785
|
-
source: DataSource.Cache,
|
|
56786
|
-
variables
|
|
56787
|
-
});
|
|
56788
|
-
}
|
|
56789
|
-
};
|
|
56790
|
-
cache_default.subscribe(subscriptionSpec, variables);
|
|
56791
|
-
lastReference = currentReference;
|
|
56792
|
-
}
|
|
56793
|
-
next(ctx);
|
|
56794
|
-
},
|
|
56795
|
-
cleanup() {
|
|
56796
|
-
if (subscriptionSpec) {
|
|
56797
|
-
cache_default.unsubscribe(subscriptionSpec, subscriptionSpec.variables?.());
|
|
56798
|
-
}
|
|
56799
|
-
}
|
|
56800
|
-
};
|
|
56801
|
-
});
|
|
56802
|
-
|
|
56803
|
-
// src/runtime/client/plugins/mutation.ts
|
|
56804
|
-
var mutation = documentPlugin(ArtifactKind.Mutation, () => {
|
|
56805
|
-
return {
|
|
56806
|
-
async start(ctx, { next, marshalVariables }) {
|
|
56807
|
-
const layerOptimistic = cache_default._internal_unstable.storage.createLayer(true);
|
|
56808
|
-
const optimisticResponse = ctx.stuff.optimisticResponse;
|
|
56809
|
-
let toNotify = [];
|
|
56810
|
-
if (optimisticResponse) {
|
|
56811
|
-
toNotify = cache_default.write({
|
|
56812
|
-
selection: ctx.artifact.selection,
|
|
56813
|
-
data: await marshalSelection({
|
|
56814
|
-
selection: ctx.artifact.selection,
|
|
56815
|
-
data: optimisticResponse
|
|
56816
|
-
}),
|
|
56817
|
-
variables: marshalVariables(ctx),
|
|
56818
|
-
layer: layerOptimistic.id
|
|
56819
|
-
});
|
|
56820
|
-
}
|
|
56821
|
-
ctx.cacheParams = {
|
|
56822
|
-
...ctx.cacheParams,
|
|
56823
|
-
layer: layerOptimistic,
|
|
56824
|
-
notifySubscribers: toNotify,
|
|
56825
|
-
forceNotify: true
|
|
56826
|
-
};
|
|
56827
|
-
next(ctx);
|
|
56828
|
-
},
|
|
56829
|
-
afterNetwork(ctx, { resolve: resolve2 }) {
|
|
56830
|
-
if (ctx.cacheParams?.layer) {
|
|
56831
|
-
cache_default.clearLayer(ctx.cacheParams.layer.id);
|
|
56832
|
-
}
|
|
56833
|
-
resolve2(ctx);
|
|
56834
|
-
},
|
|
56835
|
-
end(ctx, { resolve: resolve2, value }) {
|
|
56836
|
-
const hasErrors = value.errors && value.errors.length > 0;
|
|
56837
|
-
if (hasErrors) {
|
|
56838
|
-
if (ctx.cacheParams?.layer) {
|
|
56839
|
-
cache_default.clearLayer(ctx.cacheParams.layer.id);
|
|
56840
|
-
}
|
|
56841
|
-
}
|
|
56842
|
-
if (ctx.cacheParams?.layer) {
|
|
56843
|
-
cache_default._internal_unstable.storage.resolveLayer(ctx.cacheParams.layer.id);
|
|
56844
|
-
}
|
|
56845
|
-
resolve2(ctx);
|
|
56846
|
-
},
|
|
56847
|
-
catch(ctx, { error }) {
|
|
56848
|
-
if (ctx.cacheParams?.layer) {
|
|
56849
|
-
const { layer } = ctx.cacheParams;
|
|
56850
|
-
cache_default.clearLayer(layer.id);
|
|
56851
|
-
cache_default._internal_unstable.storage.resolveLayer(layer.id);
|
|
56852
|
-
}
|
|
56853
|
-
throw error;
|
|
56854
|
-
}
|
|
56855
|
-
};
|
|
56856
|
-
});
|
|
56857
|
-
|
|
56858
56616
|
// src/lib/types.ts
|
|
56859
56617
|
var LogLevel = {
|
|
56860
56618
|
Full: "full",
|
|
@@ -56972,7 +56730,7 @@ function definitionFromAncestors(ancestors) {
|
|
|
56972
56730
|
}
|
|
56973
56731
|
return { parents, definition };
|
|
56974
56732
|
}
|
|
56975
|
-
function unwrapType(config, type, wrappers = []) {
|
|
56733
|
+
function unwrapType(config, type, wrappers = [], convertRuntimeScalars) {
|
|
56976
56734
|
if (type.kind === "NonNullType") {
|
|
56977
56735
|
return unwrapType(config, type.type, [TypeWrapper.NonNull, ...wrappers]);
|
|
56978
56736
|
}
|
|
@@ -56988,6 +56746,11 @@ function unwrapType(config, type, wrappers = []) {
|
|
|
56988
56746
|
if (type instanceof graphql3.GraphQLList) {
|
|
56989
56747
|
return unwrapType(config, type.ofType, [TypeWrapper.List, ...wrappers]);
|
|
56990
56748
|
}
|
|
56749
|
+
if (convertRuntimeScalars && config.configFile.features?.runtimeScalars?.[type.name.value]) {
|
|
56750
|
+
type = config.schema.getType(
|
|
56751
|
+
config.configFile.features?.runtimeScalars?.[type.name.value].type
|
|
56752
|
+
);
|
|
56753
|
+
}
|
|
56991
56754
|
const namedType = config.schema.getType(type.name.value || type.name);
|
|
56992
56755
|
if (!namedType) {
|
|
56993
56756
|
throw new Error("Unknown type: " + type.name.value || type.name);
|
|
@@ -57055,7 +56818,12 @@ function deepMerge2(filepath, ...targets) {
|
|
|
57055
56818
|
// src/lib/parse.ts
|
|
57056
56819
|
function parseJS(str, config) {
|
|
57057
56820
|
const defaultConfig = {
|
|
57058
|
-
plugins: [
|
|
56821
|
+
plugins: [
|
|
56822
|
+
"typescript",
|
|
56823
|
+
"importAssertions",
|
|
56824
|
+
"decorators-legacy",
|
|
56825
|
+
"explicitResourceManagement"
|
|
56826
|
+
],
|
|
57059
56827
|
sourceType: "module"
|
|
57060
56828
|
};
|
|
57061
56829
|
return (0, import_parser.parse)(str || "", config ? deepMerge2("", defaultConfig, config) : defaultConfig).program;
|
|
@@ -57127,6 +56895,152 @@ async function cleanupFiles(pathFolder, listOfObj) {
|
|
|
57127
56895
|
return allFilesNotInList;
|
|
57128
56896
|
}
|
|
57129
56897
|
|
|
56898
|
+
// src/lib/typescript.ts
|
|
56899
|
+
var recast2 = __toESM(require_main2(), 1);
|
|
56900
|
+
import * as graphql4 from "graphql";
|
|
56901
|
+
var AST2 = recast2.types.builders;
|
|
56902
|
+
function unwrappedTsTypeReference(config, filepath, missingScalars, {
|
|
56903
|
+
type,
|
|
56904
|
+
wrappers
|
|
56905
|
+
}, body) {
|
|
56906
|
+
let result;
|
|
56907
|
+
if (graphql4.isScalarType(type)) {
|
|
56908
|
+
result = scalarPropertyValue(config, filepath, missingScalars, type, body, null);
|
|
56909
|
+
} else if (graphql4.isEnumType(type)) {
|
|
56910
|
+
result = enumReference(config, body, type.name);
|
|
56911
|
+
} else {
|
|
56912
|
+
result = AST2.tsTypeReference(AST2.identifier(type.name));
|
|
56913
|
+
}
|
|
56914
|
+
for (const toWrap of wrappers) {
|
|
56915
|
+
if (toWrap === "NonNull" /* NonNull */) {
|
|
56916
|
+
continue;
|
|
56917
|
+
} else if (toWrap === "Nullable" /* Nullable */) {
|
|
56918
|
+
result = nullableField(result, true);
|
|
56919
|
+
} else if (toWrap === "List" /* List */) {
|
|
56920
|
+
result = AST2.tsArrayType(AST2.tsParenthesizedType(result));
|
|
56921
|
+
}
|
|
56922
|
+
}
|
|
56923
|
+
return result;
|
|
56924
|
+
}
|
|
56925
|
+
function tsTypeReference(config, filepath, missingScalars, definition, body) {
|
|
56926
|
+
const { type, wrappers } = unwrapType(config, definition.type);
|
|
56927
|
+
return unwrappedTsTypeReference(
|
|
56928
|
+
config,
|
|
56929
|
+
filepath,
|
|
56930
|
+
missingScalars,
|
|
56931
|
+
{ type, wrappers },
|
|
56932
|
+
body
|
|
56933
|
+
);
|
|
56934
|
+
}
|
|
56935
|
+
function enumReference(config, body, name) {
|
|
56936
|
+
ensureImports({
|
|
56937
|
+
config,
|
|
56938
|
+
body,
|
|
56939
|
+
import: ["ValueOf"],
|
|
56940
|
+
importKind: "type",
|
|
56941
|
+
sourceModule: "$houdini/runtime/lib/types"
|
|
56942
|
+
});
|
|
56943
|
+
return AST2.tsTypeReference(
|
|
56944
|
+
AST2.identifier("ValueOf"),
|
|
56945
|
+
AST2.tsTypeParameterInstantiation([AST2.tsTypeQuery(AST2.identifier(name))])
|
|
56946
|
+
);
|
|
56947
|
+
}
|
|
56948
|
+
function readonlyProperty(prop, enable = true) {
|
|
56949
|
+
if (enable) {
|
|
56950
|
+
prop.readonly = true;
|
|
56951
|
+
}
|
|
56952
|
+
return prop;
|
|
56953
|
+
}
|
|
56954
|
+
function nullableField(inner, input = false) {
|
|
56955
|
+
const members = [inner, AST2.tsNullKeyword()];
|
|
56956
|
+
if (input) {
|
|
56957
|
+
members.push(AST2.tsUndefinedKeyword());
|
|
56958
|
+
}
|
|
56959
|
+
return AST2.tsUnionType(members);
|
|
56960
|
+
}
|
|
56961
|
+
function scalarPropertyValue(config, filepath, missingScalars, target, body, field) {
|
|
56962
|
+
if (config.configFile.features?.componentFields && target.name === config.componentScalar) {
|
|
56963
|
+
if (!field) {
|
|
56964
|
+
return AST2.tsNeverKeyword();
|
|
56965
|
+
}
|
|
56966
|
+
const component = config.componentFields[field.parent][field.field];
|
|
56967
|
+
const sourcePathRelative = path_exports.relative(
|
|
56968
|
+
path_exports.join(config.projectRoot, "src"),
|
|
56969
|
+
component.filepath
|
|
56970
|
+
);
|
|
56971
|
+
let sourcePathParsed = path_exports.parse(sourcePathRelative);
|
|
56972
|
+
let sourcePath = path_exports.join(sourcePathParsed.dir, sourcePathParsed.name);
|
|
56973
|
+
const localImport = ensureImports({
|
|
56974
|
+
config,
|
|
56975
|
+
body,
|
|
56976
|
+
import: "__component__" + component.fragment,
|
|
56977
|
+
sourceModule: path_exports.join(
|
|
56978
|
+
path_exports.relative(path_exports.dirname(filepath), config.projectRoot),
|
|
56979
|
+
"src",
|
|
56980
|
+
sourcePath
|
|
56981
|
+
)
|
|
56982
|
+
}) ?? "__component__" + component.fragment;
|
|
56983
|
+
const parameters = AST2.tsTypeReference(AST2.identifier("Parameters"));
|
|
56984
|
+
parameters.typeParameters = AST2.tsTypeParameterInstantiation([
|
|
56985
|
+
AST2.tsTypeQuery(AST2.identifier(localImport))
|
|
56986
|
+
]);
|
|
56987
|
+
const indexed = AST2.tsIndexedAccessType(
|
|
56988
|
+
parameters,
|
|
56989
|
+
AST2.tsLiteralType(AST2.numericLiteral(0))
|
|
56990
|
+
);
|
|
56991
|
+
const omit = AST2.tsTypeReference(AST2.identifier("Omit"));
|
|
56992
|
+
omit.typeParameters = AST2.tsTypeParameterInstantiation([
|
|
56993
|
+
indexed,
|
|
56994
|
+
AST2.tsLiteralType(AST2.stringLiteral(component.prop))
|
|
56995
|
+
]);
|
|
56996
|
+
const arg = AST2.identifier("props");
|
|
56997
|
+
arg.typeAnnotation = AST2.tsTypeAnnotation(omit);
|
|
56998
|
+
const returnType = AST2.tsTypeReference(AST2.identifier("ReturnType"));
|
|
56999
|
+
returnType.typeParameters = AST2.tsTypeParameterInstantiation([
|
|
57000
|
+
AST2.tsTypeQuery(AST2.identifier(localImport))
|
|
57001
|
+
]);
|
|
57002
|
+
const fnType = AST2.tsFunctionType([arg]);
|
|
57003
|
+
fnType.typeAnnotation = AST2.tsTypeAnnotation(returnType);
|
|
57004
|
+
return fnType;
|
|
57005
|
+
}
|
|
57006
|
+
switch (target.name) {
|
|
57007
|
+
case "String": {
|
|
57008
|
+
return AST2.tsStringKeyword();
|
|
57009
|
+
}
|
|
57010
|
+
case "Int": {
|
|
57011
|
+
return AST2.tsNumberKeyword();
|
|
57012
|
+
}
|
|
57013
|
+
case "Float": {
|
|
57014
|
+
return AST2.tsNumberKeyword();
|
|
57015
|
+
}
|
|
57016
|
+
case "Boolean": {
|
|
57017
|
+
return AST2.tsBooleanKeyword();
|
|
57018
|
+
}
|
|
57019
|
+
case "ID": {
|
|
57020
|
+
return AST2.tsStringKeyword();
|
|
57021
|
+
}
|
|
57022
|
+
default: {
|
|
57023
|
+
if (graphql4.isNonNullType(target) && "ofType" in target) {
|
|
57024
|
+
return scalarPropertyValue(
|
|
57025
|
+
config,
|
|
57026
|
+
filepath,
|
|
57027
|
+
missingScalars,
|
|
57028
|
+
target.ofType,
|
|
57029
|
+
body,
|
|
57030
|
+
field
|
|
57031
|
+
);
|
|
57032
|
+
}
|
|
57033
|
+
if (config.scalars?.[target.name]) {
|
|
57034
|
+
return AST2.tsTypeReference(AST2.identifier(config.scalars?.[target.name].type));
|
|
57035
|
+
}
|
|
57036
|
+
if (target.name !== config.componentScalar) {
|
|
57037
|
+
missingScalars.add(target.name);
|
|
57038
|
+
}
|
|
57039
|
+
return AST2.tsAnyKeyword();
|
|
57040
|
+
}
|
|
57041
|
+
}
|
|
57042
|
+
}
|
|
57043
|
+
|
|
57130
57044
|
// ../../node_modules/.pnpm/estree-walker@3.0.1/node_modules/estree-walker/src/walker.js
|
|
57131
57045
|
var WalkerBase = class {
|
|
57132
57046
|
constructor() {
|
|
@@ -57240,7 +57154,7 @@ async function asyncWalk(ast, { enter, leave }) {
|
|
|
57240
57154
|
}
|
|
57241
57155
|
|
|
57242
57156
|
// src/lib/walk.ts
|
|
57243
|
-
import * as
|
|
57157
|
+
import * as graphql5 from "graphql";
|
|
57244
57158
|
async function find_graphql(config, parsedScript, walker) {
|
|
57245
57159
|
await asyncWalk(parsedScript, {
|
|
57246
57160
|
async enter(node, parent2) {
|
|
@@ -57295,7 +57209,7 @@ async function find_graphql(config, parsedScript, walker) {
|
|
|
57295
57209
|
} else if (!documentString) {
|
|
57296
57210
|
return;
|
|
57297
57211
|
}
|
|
57298
|
-
const parsedTag =
|
|
57212
|
+
const parsedTag = graphql5.parse(documentString);
|
|
57299
57213
|
if (walker.where && !walker.where(parsedTag, { node, parent: parent2 })) {
|
|
57300
57214
|
return;
|
|
57301
57215
|
}
|
|
@@ -57427,7 +57341,7 @@ function extractAnonymousQuery(config, raw, expr, propName) {
|
|
|
57427
57341
|
};
|
|
57428
57342
|
return defs.concat([
|
|
57429
57343
|
{
|
|
57430
|
-
raw:
|
|
57344
|
+
raw: graphql5.print(parsed),
|
|
57431
57345
|
parsed
|
|
57432
57346
|
}
|
|
57433
57347
|
]);
|
|
@@ -57442,11 +57356,11 @@ function extractAnonymousQuery(config, raw, expr, propName) {
|
|
|
57442
57356
|
|
|
57443
57357
|
// src/lib/router/manifest.ts
|
|
57444
57358
|
var t = __toESM(require_lib6(), 1);
|
|
57445
|
-
import * as
|
|
57359
|
+
import * as graphql6 from "graphql";
|
|
57446
57360
|
|
|
57447
57361
|
// src/codegen/generators/artifacts/index.ts
|
|
57448
|
-
var
|
|
57449
|
-
import * as
|
|
57362
|
+
var recast5 = __toESM(require_main2(), 1);
|
|
57363
|
+
import * as graphql17 from "graphql";
|
|
57450
57364
|
|
|
57451
57365
|
// src/codegen/utils/commonjs.ts
|
|
57452
57366
|
var cjsIndexFilePreamble = `"use strict";
|
|
@@ -57688,19 +57602,19 @@ var FieldCollection = class {
|
|
|
57688
57602
|
};
|
|
57689
57603
|
|
|
57690
57604
|
// src/codegen/utils/moduleExport.ts
|
|
57691
|
-
var
|
|
57692
|
-
var
|
|
57605
|
+
var recast3 = __toESM(require_main2(), 1);
|
|
57606
|
+
var AST3 = recast3.types.builders;
|
|
57693
57607
|
function moduleExport(config, key, value) {
|
|
57694
57608
|
if (config.module === "commonjs") {
|
|
57695
|
-
let target =
|
|
57609
|
+
let target = AST3.memberExpression(AST3.identifier("module"), AST3.identifier("exports"));
|
|
57696
57610
|
if (key !== "default") {
|
|
57697
|
-
target =
|
|
57611
|
+
target = AST3.memberExpression(target, AST3.identifier(key));
|
|
57698
57612
|
}
|
|
57699
|
-
return
|
|
57613
|
+
return AST3.expressionStatement(AST3.assignmentExpression("=", target, value));
|
|
57700
57614
|
}
|
|
57701
|
-
return key === "default" ?
|
|
57702
|
-
|
|
57703
|
-
|
|
57615
|
+
return key === "default" ? AST3.exportDefaultDeclaration(value) : AST3.exportNamedDeclaration(
|
|
57616
|
+
AST3.variableDeclaration("const", [
|
|
57617
|
+
AST3.variableDeclarator(AST3.identifier(key), value)
|
|
57704
57618
|
])
|
|
57705
57619
|
);
|
|
57706
57620
|
}
|
|
@@ -57957,7 +57871,7 @@ var serialize = (value, { json, lossy } = {}) => {
|
|
|
57957
57871
|
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));
|
|
57958
57872
|
|
|
57959
57873
|
// src/codegen/transforms/fragmentVariables.ts
|
|
57960
|
-
import * as
|
|
57874
|
+
import * as graphql8 from "graphql";
|
|
57961
57875
|
|
|
57962
57876
|
// src/codegen/utils/stripLoc.ts
|
|
57963
57877
|
function stripLoc(value) {
|
|
@@ -57978,7 +57892,7 @@ function stripLoc(value) {
|
|
|
57978
57892
|
}
|
|
57979
57893
|
|
|
57980
57894
|
// src/codegen/transforms/collectDefinitions.ts
|
|
57981
|
-
import * as
|
|
57895
|
+
import * as graphql7 from "graphql";
|
|
57982
57896
|
import { Kind as GraphqlKinds } from "graphql";
|
|
57983
57897
|
async function includeFragmentDefinitions(config, documents) {
|
|
57984
57898
|
const fragments = collectDefinitions(config, documents);
|
|
@@ -58028,10 +57942,10 @@ function collectDefinitions(config, docs) {
|
|
|
58028
57942
|
}
|
|
58029
57943
|
function findRequiredFragments(config, definition) {
|
|
58030
57944
|
const referencedFragments = [];
|
|
58031
|
-
const typeInfo = new
|
|
58032
|
-
definition.selectionSet =
|
|
57945
|
+
const typeInfo = new graphql7.TypeInfo(config.schema);
|
|
57946
|
+
definition.selectionSet = graphql7.visit(
|
|
58033
57947
|
definition,
|
|
58034
|
-
|
|
57948
|
+
graphql7.visitWithTypeInfo(typeInfo, {
|
|
58035
57949
|
FragmentSpread(node) {
|
|
58036
57950
|
referencedFragments.push(node.name.value);
|
|
58037
57951
|
}
|
|
@@ -58065,7 +57979,7 @@ function flattenFragments(filepath, operation, fragments) {
|
|
|
58065
57979
|
}
|
|
58066
57980
|
|
|
58067
57981
|
// src/codegen/transforms/fragmentVariables.ts
|
|
58068
|
-
var GraphqlKinds2 =
|
|
57982
|
+
var GraphqlKinds2 = graphql8.Kind;
|
|
58069
57983
|
async function fragmentVariables(config, documents) {
|
|
58070
57984
|
const fragments = collectDefinitions(config, documents);
|
|
58071
57985
|
const generatedFragments = {};
|
|
@@ -58088,7 +58002,7 @@ async function fragmentVariables(config, documents) {
|
|
|
58088
58002
|
});
|
|
58089
58003
|
}
|
|
58090
58004
|
const doc = {
|
|
58091
|
-
kind:
|
|
58005
|
+
kind: graphql8.Kind.DOCUMENT,
|
|
58092
58006
|
definitions: Object.values(generatedFragments)
|
|
58093
58007
|
};
|
|
58094
58008
|
documents.push({
|
|
@@ -58159,7 +58073,7 @@ function inlineFragmentArgs({
|
|
|
58159
58073
|
return null;
|
|
58160
58074
|
};
|
|
58161
58075
|
const result = esm_default(
|
|
58162
|
-
|
|
58076
|
+
graphql8.visit(document, {
|
|
58163
58077
|
FragmentSpread(node) {
|
|
58164
58078
|
if (!fragmentDefinitions[node.name.value]) {
|
|
58165
58079
|
throw new Error("Could not find definition for fragment" + node.name.value);
|
|
@@ -58245,7 +58159,7 @@ function inlineFragmentArgs({
|
|
|
58245
58159
|
);
|
|
58246
58160
|
if (newName) {
|
|
58247
58161
|
result.name = {
|
|
58248
|
-
kind:
|
|
58162
|
+
kind: graphql8.Kind.NAME,
|
|
58249
58163
|
value: newName
|
|
58250
58164
|
};
|
|
58251
58165
|
}
|
|
@@ -58412,7 +58326,7 @@ ${exportDefaultFrom(`./${doc.name}`, doc.name)}`,
|
|
|
58412
58326
|
}
|
|
58413
58327
|
|
|
58414
58328
|
// src/codegen/generators/artifacts/inputs.ts
|
|
58415
|
-
import * as
|
|
58329
|
+
import * as graphql9 from "graphql";
|
|
58416
58330
|
function inputObject(config, inputs, runtimeScalars) {
|
|
58417
58331
|
const visitedTypes = /* @__PURE__ */ new Set();
|
|
58418
58332
|
const inputObj = {
|
|
@@ -58442,10 +58356,10 @@ function walkInputs(config, visitedTypes, inputObj, rootType) {
|
|
|
58442
58356
|
if (visitedTypes.has(type.name)) {
|
|
58443
58357
|
return;
|
|
58444
58358
|
}
|
|
58445
|
-
if (
|
|
58359
|
+
if (graphql9.isEnumType(type) || graphql9.isScalarType(type)) {
|
|
58446
58360
|
return;
|
|
58447
58361
|
}
|
|
58448
|
-
if (
|
|
58362
|
+
if (graphql9.isUnionType(type)) {
|
|
58449
58363
|
return;
|
|
58450
58364
|
}
|
|
58451
58365
|
visitedTypes.add(type.name);
|
|
@@ -58463,50 +58377,50 @@ function walkInputs(config, visitedTypes, inputObj, rootType) {
|
|
|
58463
58377
|
}
|
|
58464
58378
|
|
|
58465
58379
|
// src/codegen/generators/artifacts/operations.ts
|
|
58466
|
-
import * as
|
|
58380
|
+
import * as graphql11 from "graphql";
|
|
58467
58381
|
|
|
58468
58382
|
// src/codegen/generators/artifacts/utils.ts
|
|
58469
|
-
var
|
|
58470
|
-
import * as
|
|
58471
|
-
var
|
|
58383
|
+
var recast4 = __toESM(require_main2(), 1);
|
|
58384
|
+
import * as graphql10 from "graphql";
|
|
58385
|
+
var AST4 = recast4.types.builders;
|
|
58472
58386
|
function serializeValue(value) {
|
|
58473
58387
|
if (Array.isArray(value)) {
|
|
58474
|
-
return
|
|
58388
|
+
return AST4.arrayExpression(value.map(serializeValue));
|
|
58475
58389
|
}
|
|
58476
58390
|
if (typeof value === "object" && value !== null) {
|
|
58477
|
-
return
|
|
58391
|
+
return AST4.objectExpression(
|
|
58478
58392
|
Object.entries(value).filter(([key, value2]) => typeof value2 !== "undefined").map(([key, val]) => {
|
|
58479
|
-
return
|
|
58393
|
+
return AST4.objectProperty(AST4.stringLiteral(key), serializeValue(val));
|
|
58480
58394
|
})
|
|
58481
58395
|
);
|
|
58482
58396
|
}
|
|
58483
58397
|
if (typeof value === "string") {
|
|
58484
58398
|
if (value.indexOf("\n") !== -1) {
|
|
58485
|
-
return
|
|
58486
|
-
[
|
|
58399
|
+
return AST4.templateLiteral(
|
|
58400
|
+
[AST4.templateElement({ raw: value, cooked: value }, true)],
|
|
58487
58401
|
[]
|
|
58488
58402
|
);
|
|
58489
58403
|
}
|
|
58490
|
-
return
|
|
58404
|
+
return AST4.stringLiteral(value);
|
|
58491
58405
|
}
|
|
58492
|
-
return
|
|
58406
|
+
return AST4.literal(value);
|
|
58493
58407
|
}
|
|
58494
58408
|
function convertValue(config, val) {
|
|
58495
58409
|
let value;
|
|
58496
58410
|
let kind;
|
|
58497
|
-
if (val.kind ===
|
|
58411
|
+
if (val.kind === graphql10.Kind.INT) {
|
|
58498
58412
|
value = parseInt(val.value, 10);
|
|
58499
58413
|
kind = "Int";
|
|
58500
|
-
} else if (val.kind ===
|
|
58414
|
+
} else if (val.kind === graphql10.Kind.FLOAT) {
|
|
58501
58415
|
value = parseFloat(val.value);
|
|
58502
58416
|
kind = "Float";
|
|
58503
|
-
} else if (val.kind ===
|
|
58417
|
+
} else if (val.kind === graphql10.Kind.BOOLEAN) {
|
|
58504
58418
|
value = val.value;
|
|
58505
58419
|
kind = "Boolean";
|
|
58506
|
-
} else if (val.kind ===
|
|
58420
|
+
} else if (val.kind === graphql10.Kind.VARIABLE) {
|
|
58507
58421
|
value = val.name.value;
|
|
58508
58422
|
kind = "Variable";
|
|
58509
|
-
} else if (val.kind ===
|
|
58423
|
+
} else if (val.kind === graphql10.Kind.STRING) {
|
|
58510
58424
|
value = val.value;
|
|
58511
58425
|
kind = "String";
|
|
58512
58426
|
}
|
|
@@ -58519,9 +58433,13 @@ function operationsByPath(config, filepath, definition, filterTypes) {
|
|
|
58519
58433
|
return {};
|
|
58520
58434
|
}
|
|
58521
58435
|
const pathOperations = {};
|
|
58522
|
-
|
|
58436
|
+
graphql11.visit(definition, {
|
|
58523
58437
|
FragmentSpread(node, _, __, ___, ancestors) {
|
|
58524
|
-
|
|
58438
|
+
let nameWithoutHash = node.name.value;
|
|
58439
|
+
if (node.directives && node.directives.find((directive) => directive.name.value === "with")) {
|
|
58440
|
+
nameWithoutHash = nameWithoutHash.substring(0, nameWithoutHash.lastIndexOf("_"));
|
|
58441
|
+
}
|
|
58442
|
+
if (!config.isListFragment(nameWithoutHash)) {
|
|
58525
58443
|
return;
|
|
58526
58444
|
}
|
|
58527
58445
|
const path2 = ancestorKey(ancestors);
|
|
@@ -58532,8 +58450,8 @@ function operationsByPath(config, filepath, definition, filterTypes) {
|
|
|
58532
58450
|
operationObject({
|
|
58533
58451
|
config,
|
|
58534
58452
|
filepath,
|
|
58535
|
-
listName: config.listNameFromFragment(
|
|
58536
|
-
operationKind: config.listOperationFromFragment(
|
|
58453
|
+
listName: config.listNameFromFragment(nameWithoutHash),
|
|
58454
|
+
operationKind: config.listOperationFromFragment(nameWithoutHash),
|
|
58537
58455
|
type: parentTypeFromAncestors(config.schema, filepath, ancestors).name,
|
|
58538
58456
|
selection: node
|
|
58539
58457
|
})
|
|
@@ -58678,19 +58596,19 @@ function ancestorKey(ancestors) {
|
|
|
58678
58596
|
}
|
|
58679
58597
|
|
|
58680
58598
|
// src/codegen/generators/artifacts/selection.ts
|
|
58681
|
-
import * as
|
|
58599
|
+
import * as graphql16 from "graphql";
|
|
58682
58600
|
|
|
58683
58601
|
// src/codegen/transforms/list.ts
|
|
58684
|
-
import * as
|
|
58602
|
+
import * as graphql14 from "graphql";
|
|
58685
58603
|
|
|
58686
58604
|
// src/codegen/utils/objectIdentificationSelection.ts
|
|
58687
|
-
import * as
|
|
58605
|
+
import * as graphql12 from "graphql";
|
|
58688
58606
|
var objectIdentificationSelection = (config, type) => {
|
|
58689
58607
|
return config.keyFieldsForType(type.name).map((key) => {
|
|
58690
58608
|
return {
|
|
58691
|
-
kind:
|
|
58609
|
+
kind: graphql12.Kind.FIELD,
|
|
58692
58610
|
name: {
|
|
58693
|
-
kind:
|
|
58611
|
+
kind: graphql12.Kind.NAME,
|
|
58694
58612
|
value: key
|
|
58695
58613
|
}
|
|
58696
58614
|
};
|
|
@@ -58698,7 +58616,7 @@ var objectIdentificationSelection = (config, type) => {
|
|
|
58698
58616
|
};
|
|
58699
58617
|
|
|
58700
58618
|
// src/codegen/transforms/paginate.ts
|
|
58701
|
-
import * as
|
|
58619
|
+
import * as graphql13 from "graphql";
|
|
58702
58620
|
async function paginate(config, documents) {
|
|
58703
58621
|
const newDocs = [];
|
|
58704
58622
|
for (const doc of documents) {
|
|
@@ -58731,7 +58649,7 @@ async function paginate(config, documents) {
|
|
|
58731
58649
|
};
|
|
58732
58650
|
let cursorType = "String";
|
|
58733
58651
|
let paginationPath = [];
|
|
58734
|
-
doc.document =
|
|
58652
|
+
doc.document = graphql13.visit(doc.document, {
|
|
58735
58653
|
Field(node, _, __, ___, ancestors) {
|
|
58736
58654
|
const paginateDirective = node.directives?.find(
|
|
58737
58655
|
(directive) => directive.name.value === config.paginateDirective
|
|
@@ -58757,7 +58675,7 @@ async function paginate(config, documents) {
|
|
|
58757
58675
|
flags.offset.enabled = offsetPagination;
|
|
58758
58676
|
flags.limit.enabled = offsetPagination;
|
|
58759
58677
|
paginationPath = ancestors.filter(
|
|
58760
|
-
(ancestor) => !Array.isArray(ancestor) && ancestor.kind ===
|
|
58678
|
+
(ancestor) => !Array.isArray(ancestor) && ancestor.kind === graphql13.Kind.FIELD
|
|
58761
58679
|
).concat(node).map((field) => field.alias?.value || field.name.value);
|
|
58762
58680
|
return {
|
|
58763
58681
|
...node,
|
|
@@ -58776,7 +58694,7 @@ async function paginate(config, documents) {
|
|
|
58776
58694
|
let fragment2 = "";
|
|
58777
58695
|
let paginateMode = config.defaultPaginateMode;
|
|
58778
58696
|
const requiredArgs = [];
|
|
58779
|
-
doc.document =
|
|
58697
|
+
doc.document = graphql13.visit(doc.document, {
|
|
58780
58698
|
OperationDefinition(node) {
|
|
58781
58699
|
if (node.operation !== "query") {
|
|
58782
58700
|
throw new HoudiniError({
|
|
@@ -58835,9 +58753,9 @@ async function paginate(config, documents) {
|
|
|
58835
58753
|
directives: [
|
|
58836
58754
|
...node.directives || [],
|
|
58837
58755
|
{
|
|
58838
|
-
kind:
|
|
58756
|
+
kind: graphql13.Kind.DIRECTIVE,
|
|
58839
58757
|
name: {
|
|
58840
|
-
kind:
|
|
58758
|
+
kind: graphql13.Kind.NAME,
|
|
58841
58759
|
value: config.argumentsDirective
|
|
58842
58760
|
}
|
|
58843
58761
|
}
|
|
@@ -58907,22 +58825,22 @@ async function paginate(config, documents) {
|
|
|
58907
58825
|
const paginationArgs = Object.entries(flags).filter(([_, { enabled }]) => enabled).map(([key, value]) => ({ name: key, ...value }));
|
|
58908
58826
|
const fragmentSpreadSelection = [
|
|
58909
58827
|
{
|
|
58910
|
-
kind:
|
|
58828
|
+
kind: graphql13.Kind.FRAGMENT_SPREAD,
|
|
58911
58829
|
name: {
|
|
58912
|
-
kind:
|
|
58830
|
+
kind: graphql13.Kind.NAME,
|
|
58913
58831
|
value: fragmentName
|
|
58914
58832
|
},
|
|
58915
58833
|
directives: [
|
|
58916
58834
|
{
|
|
58917
|
-
kind:
|
|
58835
|
+
kind: graphql13.Kind.DIRECTIVE,
|
|
58918
58836
|
name: {
|
|
58919
|
-
kind:
|
|
58837
|
+
kind: graphql13.Kind.NAME,
|
|
58920
58838
|
value: config.withDirective
|
|
58921
58839
|
},
|
|
58922
58840
|
["arguments"]: requiredArgs.map((arg) => variableAsArgument(arg.name)).concat(paginationArgs.map(({ name }) => variableAsArgument(name)))
|
|
58923
58841
|
},
|
|
58924
58842
|
{
|
|
58925
|
-
kind:
|
|
58843
|
+
kind: graphql13.Kind.DIRECTIVE,
|
|
58926
58844
|
name: {
|
|
58927
58845
|
kind: "Name",
|
|
58928
58846
|
value: config.maskDisableDirective
|
|
@@ -58949,23 +58867,23 @@ async function paginate(config, documents) {
|
|
|
58949
58867
|
});
|
|
58950
58868
|
const typeConfig = config.typeConfig?.[fragment2];
|
|
58951
58869
|
const queryDoc = {
|
|
58952
|
-
kind:
|
|
58870
|
+
kind: graphql13.Kind.DOCUMENT,
|
|
58953
58871
|
definitions: [
|
|
58954
58872
|
{
|
|
58955
|
-
kind:
|
|
58873
|
+
kind: graphql13.Kind.OPERATION_DEFINITION,
|
|
58956
58874
|
name: {
|
|
58957
|
-
kind:
|
|
58875
|
+
kind: graphql13.Kind.NAME,
|
|
58958
58876
|
value: refetchQueryName
|
|
58959
58877
|
},
|
|
58960
58878
|
operation: "query",
|
|
58961
58879
|
variableDefinitions: requiredArgs.map(
|
|
58962
58880
|
(arg) => ({
|
|
58963
|
-
kind:
|
|
58881
|
+
kind: graphql13.Kind.VARIABLE_DEFINITION,
|
|
58964
58882
|
type: arg.type,
|
|
58965
58883
|
variable: {
|
|
58966
|
-
kind:
|
|
58884
|
+
kind: graphql13.Kind.VARIABLE,
|
|
58967
58885
|
name: {
|
|
58968
|
-
kind:
|
|
58886
|
+
kind: graphql13.Kind.NAME,
|
|
58969
58887
|
value: arg.name
|
|
58970
58888
|
}
|
|
58971
58889
|
}
|
|
@@ -58973,18 +58891,18 @@ async function paginate(config, documents) {
|
|
|
58973
58891
|
).concat(
|
|
58974
58892
|
paginationArgs.map(
|
|
58975
58893
|
(arg) => ({
|
|
58976
|
-
kind:
|
|
58894
|
+
kind: graphql13.Kind.VARIABLE_DEFINITION,
|
|
58977
58895
|
type: {
|
|
58978
|
-
kind:
|
|
58896
|
+
kind: graphql13.Kind.NAMED_TYPE,
|
|
58979
58897
|
name: {
|
|
58980
|
-
kind:
|
|
58898
|
+
kind: graphql13.Kind.NAME,
|
|
58981
58899
|
value: arg.type
|
|
58982
58900
|
}
|
|
58983
58901
|
},
|
|
58984
58902
|
variable: {
|
|
58985
|
-
kind:
|
|
58903
|
+
kind: graphql13.Kind.VARIABLE,
|
|
58986
58904
|
name: {
|
|
58987
|
-
kind:
|
|
58905
|
+
kind: graphql13.Kind.NAME,
|
|
58988
58906
|
value: arg.name
|
|
58989
58907
|
}
|
|
58990
58908
|
},
|
|
@@ -58996,12 +58914,12 @@ async function paginate(config, documents) {
|
|
|
58996
58914
|
).concat(
|
|
58997
58915
|
!nodeQuery ? [] : keys2.map(
|
|
58998
58916
|
(key) => ({
|
|
58999
|
-
kind:
|
|
58917
|
+
kind: graphql13.Kind.VARIABLE_DEFINITION,
|
|
59000
58918
|
type: key.type,
|
|
59001
58919
|
variable: {
|
|
59002
|
-
kind:
|
|
58920
|
+
kind: graphql13.Kind.VARIABLE,
|
|
59003
58921
|
name: {
|
|
59004
|
-
kind:
|
|
58922
|
+
kind: graphql13.Kind.NAME,
|
|
59005
58923
|
value: key.name
|
|
59006
58924
|
}
|
|
59007
58925
|
}
|
|
@@ -59010,42 +58928,42 @@ async function paginate(config, documents) {
|
|
|
59010
58928
|
)
|
|
59011
58929
|
),
|
|
59012
58930
|
selectionSet: {
|
|
59013
|
-
kind:
|
|
58931
|
+
kind: graphql13.Kind.SELECTION_SET,
|
|
59014
58932
|
selections: !nodeQuery ? fragmentSpreadSelection : [
|
|
59015
58933
|
{
|
|
59016
|
-
kind:
|
|
58934
|
+
kind: graphql13.Kind.FIELD,
|
|
59017
58935
|
name: {
|
|
59018
|
-
kind:
|
|
58936
|
+
kind: graphql13.Kind.NAME,
|
|
59019
58937
|
value: typeConfig?.resolve?.queryField || "node"
|
|
59020
58938
|
},
|
|
59021
58939
|
["arguments"]: keys2.map((key) => ({
|
|
59022
|
-
kind:
|
|
58940
|
+
kind: graphql13.Kind.ARGUMENT,
|
|
59023
58941
|
name: {
|
|
59024
|
-
kind:
|
|
58942
|
+
kind: graphql13.Kind.NAME,
|
|
59025
58943
|
value: key.name
|
|
59026
58944
|
},
|
|
59027
58945
|
value: {
|
|
59028
|
-
kind:
|
|
58946
|
+
kind: graphql13.Kind.VARIABLE,
|
|
59029
58947
|
name: {
|
|
59030
|
-
kind:
|
|
58948
|
+
kind: graphql13.Kind.NAME,
|
|
59031
58949
|
value: key.name
|
|
59032
58950
|
}
|
|
59033
58951
|
}
|
|
59034
58952
|
})),
|
|
59035
58953
|
selectionSet: {
|
|
59036
|
-
kind:
|
|
58954
|
+
kind: graphql13.Kind.SELECTION_SET,
|
|
59037
58955
|
selections: [
|
|
59038
58956
|
{
|
|
59039
|
-
kind:
|
|
58957
|
+
kind: graphql13.Kind.FIELD,
|
|
59040
58958
|
name: {
|
|
59041
|
-
kind:
|
|
58959
|
+
kind: graphql13.Kind.NAME,
|
|
59042
58960
|
value: "__typename"
|
|
59043
58961
|
}
|
|
59044
58962
|
},
|
|
59045
58963
|
...(typeConfig?.keys || [config.defaultKeys[0]]).map((key) => ({
|
|
59046
|
-
kind:
|
|
58964
|
+
kind: graphql13.Kind.FIELD,
|
|
59047
58965
|
name: {
|
|
59048
|
-
kind:
|
|
58966
|
+
kind: graphql13.Kind.NAME,
|
|
59049
58967
|
value: key
|
|
59050
58968
|
}
|
|
59051
58969
|
})),
|
|
@@ -59102,15 +59020,15 @@ function replaceArgumentsWithVariables(args, flags) {
|
|
|
59102
59020
|
}
|
|
59103
59021
|
function variableAsArgument(name, variable) {
|
|
59104
59022
|
return {
|
|
59105
|
-
kind:
|
|
59023
|
+
kind: graphql13.Kind.ARGUMENT,
|
|
59106
59024
|
name: {
|
|
59107
|
-
kind:
|
|
59025
|
+
kind: graphql13.Kind.NAME,
|
|
59108
59026
|
value: name
|
|
59109
59027
|
},
|
|
59110
59028
|
value: {
|
|
59111
|
-
kind:
|
|
59029
|
+
kind: graphql13.Kind.VARIABLE,
|
|
59112
59030
|
name: {
|
|
59113
|
-
kind:
|
|
59031
|
+
kind: graphql13.Kind.NAME,
|
|
59114
59032
|
value: variable ?? name
|
|
59115
59033
|
}
|
|
59116
59034
|
}
|
|
@@ -59118,18 +59036,18 @@ function variableAsArgument(name, variable) {
|
|
|
59118
59036
|
}
|
|
59119
59037
|
function staticVariableDefinition(name, type, defaultValue, variableName) {
|
|
59120
59038
|
return {
|
|
59121
|
-
kind:
|
|
59039
|
+
kind: graphql13.Kind.VARIABLE_DEFINITION,
|
|
59122
59040
|
type: {
|
|
59123
|
-
kind:
|
|
59041
|
+
kind: graphql13.Kind.NAMED_TYPE,
|
|
59124
59042
|
name: {
|
|
59125
|
-
kind:
|
|
59043
|
+
kind: graphql13.Kind.NAME,
|
|
59126
59044
|
value: type
|
|
59127
59045
|
}
|
|
59128
59046
|
},
|
|
59129
59047
|
variable: {
|
|
59130
|
-
kind:
|
|
59048
|
+
kind: graphql13.Kind.VARIABLE,
|
|
59131
59049
|
name: {
|
|
59132
|
-
kind:
|
|
59050
|
+
kind: graphql13.Kind.NAME,
|
|
59133
59051
|
value: variableName ?? name
|
|
59134
59052
|
}
|
|
59135
59053
|
},
|
|
@@ -59141,9 +59059,9 @@ function staticVariableDefinition(name, type, defaultValue, variableName) {
|
|
|
59141
59059
|
}
|
|
59142
59060
|
function argumentNode(name, value) {
|
|
59143
59061
|
return {
|
|
59144
|
-
kind:
|
|
59062
|
+
kind: graphql13.Kind.ARGUMENT,
|
|
59145
59063
|
name: {
|
|
59146
|
-
kind:
|
|
59064
|
+
kind: graphql13.Kind.NAME,
|
|
59147
59065
|
value: name
|
|
59148
59066
|
},
|
|
59149
59067
|
value: objectNode(value)
|
|
@@ -59151,16 +59069,16 @@ function argumentNode(name, value) {
|
|
|
59151
59069
|
}
|
|
59152
59070
|
function objectNode([type, defaultValue]) {
|
|
59153
59071
|
const node = {
|
|
59154
|
-
kind:
|
|
59072
|
+
kind: graphql13.Kind.OBJECT,
|
|
59155
59073
|
fields: [
|
|
59156
59074
|
{
|
|
59157
|
-
kind:
|
|
59075
|
+
kind: graphql13.Kind.OBJECT_FIELD,
|
|
59158
59076
|
name: {
|
|
59159
|
-
kind:
|
|
59077
|
+
kind: graphql13.Kind.NAME,
|
|
59160
59078
|
value: "type"
|
|
59161
59079
|
},
|
|
59162
59080
|
value: {
|
|
59163
|
-
kind:
|
|
59081
|
+
kind: graphql13.Kind.STRING,
|
|
59164
59082
|
value: type
|
|
59165
59083
|
}
|
|
59166
59084
|
}
|
|
@@ -59168,8 +59086,8 @@ function objectNode([type, defaultValue]) {
|
|
|
59168
59086
|
};
|
|
59169
59087
|
if (defaultValue) {
|
|
59170
59088
|
node.fields.push({
|
|
59171
|
-
kind:
|
|
59172
|
-
name: { kind:
|
|
59089
|
+
kind: graphql13.Kind.OBJECT_FIELD,
|
|
59090
|
+
name: { kind: graphql13.Kind.NAME, value: "default" },
|
|
59173
59091
|
value: {
|
|
59174
59092
|
kind: typeof defaultValue === "number" ? "IntValue" : "StringValue",
|
|
59175
59093
|
value: defaultValue.toString()
|
|
@@ -59180,34 +59098,34 @@ function objectNode([type, defaultValue]) {
|
|
|
59180
59098
|
}
|
|
59181
59099
|
var pageInfoSelection = [
|
|
59182
59100
|
{
|
|
59183
|
-
kind:
|
|
59101
|
+
kind: graphql13.Kind.FIELD,
|
|
59184
59102
|
name: {
|
|
59185
|
-
kind:
|
|
59103
|
+
kind: graphql13.Kind.NAME,
|
|
59186
59104
|
value: "edges"
|
|
59187
59105
|
},
|
|
59188
59106
|
selectionSet: {
|
|
59189
|
-
kind:
|
|
59107
|
+
kind: graphql13.Kind.SELECTION_SET,
|
|
59190
59108
|
selections: [
|
|
59191
59109
|
{
|
|
59192
|
-
kind:
|
|
59110
|
+
kind: graphql13.Kind.FIELD,
|
|
59193
59111
|
name: {
|
|
59194
|
-
kind:
|
|
59112
|
+
kind: graphql13.Kind.NAME,
|
|
59195
59113
|
value: "cursor"
|
|
59196
59114
|
}
|
|
59197
59115
|
},
|
|
59198
59116
|
{
|
|
59199
|
-
kind:
|
|
59117
|
+
kind: graphql13.Kind.FIELD,
|
|
59200
59118
|
name: {
|
|
59201
|
-
kind:
|
|
59119
|
+
kind: graphql13.Kind.NAME,
|
|
59202
59120
|
value: "node"
|
|
59203
59121
|
},
|
|
59204
59122
|
selectionSet: {
|
|
59205
|
-
kind:
|
|
59123
|
+
kind: graphql13.Kind.SELECTION_SET,
|
|
59206
59124
|
selections: [
|
|
59207
59125
|
{
|
|
59208
|
-
kind:
|
|
59126
|
+
kind: graphql13.Kind.FIELD,
|
|
59209
59127
|
name: {
|
|
59210
|
-
kind:
|
|
59128
|
+
kind: graphql13.Kind.NAME,
|
|
59211
59129
|
value: "__typename"
|
|
59212
59130
|
}
|
|
59213
59131
|
}
|
|
@@ -59218,39 +59136,39 @@ var pageInfoSelection = [
|
|
|
59218
59136
|
}
|
|
59219
59137
|
},
|
|
59220
59138
|
{
|
|
59221
|
-
kind:
|
|
59139
|
+
kind: graphql13.Kind.FIELD,
|
|
59222
59140
|
name: {
|
|
59223
|
-
kind:
|
|
59141
|
+
kind: graphql13.Kind.NAME,
|
|
59224
59142
|
value: "pageInfo"
|
|
59225
59143
|
},
|
|
59226
59144
|
selectionSet: {
|
|
59227
|
-
kind:
|
|
59145
|
+
kind: graphql13.Kind.SELECTION_SET,
|
|
59228
59146
|
selections: [
|
|
59229
59147
|
{
|
|
59230
|
-
kind:
|
|
59148
|
+
kind: graphql13.Kind.FIELD,
|
|
59231
59149
|
name: {
|
|
59232
|
-
kind:
|
|
59150
|
+
kind: graphql13.Kind.NAME,
|
|
59233
59151
|
value: "hasPreviousPage"
|
|
59234
59152
|
}
|
|
59235
59153
|
},
|
|
59236
59154
|
{
|
|
59237
|
-
kind:
|
|
59155
|
+
kind: graphql13.Kind.FIELD,
|
|
59238
59156
|
name: {
|
|
59239
|
-
kind:
|
|
59157
|
+
kind: graphql13.Kind.NAME,
|
|
59240
59158
|
value: "hasNextPage"
|
|
59241
59159
|
}
|
|
59242
59160
|
},
|
|
59243
59161
|
{
|
|
59244
|
-
kind:
|
|
59162
|
+
kind: graphql13.Kind.FIELD,
|
|
59245
59163
|
name: {
|
|
59246
|
-
kind:
|
|
59164
|
+
kind: graphql13.Kind.NAME,
|
|
59247
59165
|
value: "startCursor"
|
|
59248
59166
|
}
|
|
59249
59167
|
},
|
|
59250
59168
|
{
|
|
59251
|
-
kind:
|
|
59169
|
+
kind: graphql13.Kind.FIELD,
|
|
59252
59170
|
name: {
|
|
59253
|
-
kind:
|
|
59171
|
+
kind: graphql13.Kind.NAME,
|
|
59254
59172
|
value: "endCursor"
|
|
59255
59173
|
}
|
|
59256
59174
|
}
|
|
@@ -59264,17 +59182,17 @@ async function addListFragments(config, documents) {
|
|
|
59264
59182
|
const lists = {};
|
|
59265
59183
|
const errors = [];
|
|
59266
59184
|
for (const doc of documents) {
|
|
59267
|
-
doc.document =
|
|
59185
|
+
doc.document = graphql14.visit(doc.document, {
|
|
59268
59186
|
Directive(node, key, parent2, path2, ancestors) {
|
|
59269
59187
|
if ([config.listDirective, config.paginateDirective].includes(node.name.value)) {
|
|
59270
59188
|
const nameArg = node.arguments?.find(
|
|
59271
59189
|
(arg) => arg.name.value === config.listOrPaginateNameArg
|
|
59272
59190
|
);
|
|
59273
59191
|
let error = {
|
|
59274
|
-
...new
|
|
59192
|
+
...new graphql14.GraphQLError(
|
|
59275
59193
|
"",
|
|
59276
59194
|
node,
|
|
59277
|
-
new
|
|
59195
|
+
new graphql14.Source(""),
|
|
59278
59196
|
node.loc ? [node.loc.start, node.loc.end] : null,
|
|
59279
59197
|
path2
|
|
59280
59198
|
),
|
|
@@ -59326,7 +59244,7 @@ async function addListFragments(config, documents) {
|
|
|
59326
59244
|
{
|
|
59327
59245
|
kind: "Argument",
|
|
59328
59246
|
name: {
|
|
59329
|
-
kind:
|
|
59247
|
+
kind: graphql14.Kind.NAME,
|
|
59330
59248
|
value: "connection"
|
|
59331
59249
|
},
|
|
59332
59250
|
value: {
|
|
@@ -59376,7 +59294,7 @@ async function addListFragments(config, documents) {
|
|
|
59376
59294
|
const validDeletes = [
|
|
59377
59295
|
...new Set(
|
|
59378
59296
|
Object.values(lists).map(({ type }) => {
|
|
59379
|
-
if (!(type instanceof
|
|
59297
|
+
if (!(type instanceof graphql14.GraphQLObjectType)) {
|
|
59380
59298
|
return "";
|
|
59381
59299
|
}
|
|
59382
59300
|
if (config.keyFieldsForType(type.name).length !== 1) {
|
|
@@ -59390,7 +59308,7 @@ async function addListFragments(config, documents) {
|
|
|
59390
59308
|
return;
|
|
59391
59309
|
}
|
|
59392
59310
|
const generatedDoc = {
|
|
59393
|
-
kind:
|
|
59311
|
+
kind: graphql14.Kind.DOCUMENT,
|
|
59394
59312
|
definitions: Object.entries(lists).flatMap(
|
|
59395
59313
|
([name, { selection, type }]) => {
|
|
59396
59314
|
const schemaType = config.schema.getType(type.name);
|
|
@@ -59398,7 +59316,7 @@ async function addListFragments(config, documents) {
|
|
|
59398
59316
|
throw new HoudiniError({ message: "Lists must have a selection" });
|
|
59399
59317
|
}
|
|
59400
59318
|
const fragmentSelection = {
|
|
59401
|
-
kind:
|
|
59319
|
+
kind: graphql14.Kind.SELECTION_SET,
|
|
59402
59320
|
selections: [...selection.selections]
|
|
59403
59321
|
};
|
|
59404
59322
|
if (schemaType && fragmentSelection && !fragmentSelection?.selections.find(
|
|
@@ -59413,14 +59331,14 @@ async function addListFragments(config, documents) {
|
|
|
59413
59331
|
{
|
|
59414
59332
|
name: {
|
|
59415
59333
|
value: config.listInsertFragment(name),
|
|
59416
|
-
kind:
|
|
59334
|
+
kind: graphql14.Kind.NAME
|
|
59417
59335
|
},
|
|
59418
|
-
kind:
|
|
59336
|
+
kind: graphql14.Kind.FRAGMENT_DEFINITION,
|
|
59419
59337
|
selectionSet: fragmentSelection,
|
|
59420
59338
|
typeCondition: {
|
|
59421
|
-
kind:
|
|
59339
|
+
kind: graphql14.Kind.NAMED_TYPE,
|
|
59422
59340
|
name: {
|
|
59423
|
-
kind:
|
|
59341
|
+
kind: graphql14.Kind.NAME,
|
|
59424
59342
|
value: type.name
|
|
59425
59343
|
}
|
|
59426
59344
|
}
|
|
@@ -59428,32 +59346,32 @@ async function addListFragments(config, documents) {
|
|
|
59428
59346
|
{
|
|
59429
59347
|
name: {
|
|
59430
59348
|
value: config.listToggleFragment(name),
|
|
59431
|
-
kind:
|
|
59349
|
+
kind: graphql14.Kind.NAME
|
|
59432
59350
|
},
|
|
59433
|
-
kind:
|
|
59351
|
+
kind: graphql14.Kind.FRAGMENT_DEFINITION,
|
|
59434
59352
|
selectionSet: fragmentSelection,
|
|
59435
59353
|
typeCondition: {
|
|
59436
|
-
kind:
|
|
59354
|
+
kind: graphql14.Kind.NAMED_TYPE,
|
|
59437
59355
|
name: {
|
|
59438
|
-
kind:
|
|
59356
|
+
kind: graphql14.Kind.NAME,
|
|
59439
59357
|
value: type.name
|
|
59440
59358
|
}
|
|
59441
59359
|
}
|
|
59442
59360
|
},
|
|
59443
59361
|
{
|
|
59444
|
-
kind:
|
|
59362
|
+
kind: graphql14.Kind.FRAGMENT_DEFINITION,
|
|
59445
59363
|
name: {
|
|
59446
59364
|
value: config.listRemoveFragment(name),
|
|
59447
|
-
kind:
|
|
59365
|
+
kind: graphql14.Kind.NAME
|
|
59448
59366
|
},
|
|
59449
59367
|
selectionSet: {
|
|
59450
|
-
kind:
|
|
59368
|
+
kind: graphql14.Kind.SELECTION_SET,
|
|
59451
59369
|
selections: [...objectIdentificationSelection(config, type)]
|
|
59452
59370
|
},
|
|
59453
59371
|
typeCondition: {
|
|
59454
|
-
kind:
|
|
59372
|
+
kind: graphql14.Kind.NAMED_TYPE,
|
|
59455
59373
|
name: {
|
|
59456
|
-
kind:
|
|
59374
|
+
kind: graphql14.Kind.NAME,
|
|
59457
59375
|
value: type.name
|
|
59458
59376
|
}
|
|
59459
59377
|
}
|
|
@@ -59462,14 +59380,14 @@ async function addListFragments(config, documents) {
|
|
|
59462
59380
|
}
|
|
59463
59381
|
).concat(
|
|
59464
59382
|
...validDeletes.map((typeName) => ({
|
|
59465
|
-
kind:
|
|
59383
|
+
kind: graphql14.Kind.DIRECTIVE_DEFINITION,
|
|
59466
59384
|
name: {
|
|
59467
|
-
kind:
|
|
59385
|
+
kind: graphql14.Kind.NAME,
|
|
59468
59386
|
value: config.listDeleteDirective(typeName)
|
|
59469
59387
|
},
|
|
59470
59388
|
locations: [
|
|
59471
59389
|
{
|
|
59472
|
-
kind:
|
|
59390
|
+
kind: graphql14.Kind.NAME,
|
|
59473
59391
|
value: "FIELD"
|
|
59474
59392
|
}
|
|
59475
59393
|
],
|
|
@@ -59477,8 +59395,8 @@ async function addListFragments(config, documents) {
|
|
|
59477
59395
|
}))
|
|
59478
59396
|
)
|
|
59479
59397
|
};
|
|
59480
|
-
config.newSchema += "\n" + generatedDoc.definitions.filter((c) => c.kind !== "FragmentDefinition").map(
|
|
59481
|
-
config.newDocuments += "\n" + generatedDoc.definitions.filter((c) => c.kind === "FragmentDefinition").map(
|
|
59398
|
+
config.newSchema += "\n" + generatedDoc.definitions.filter((c) => c.kind !== "FragmentDefinition").map(graphql14.print).join("\n\n");
|
|
59399
|
+
config.newDocuments += "\n" + generatedDoc.definitions.filter((c) => c.kind === "FragmentDefinition").map(graphql14.print).join("\n\n");
|
|
59482
59400
|
documents.push({
|
|
59483
59401
|
name: "generated::lists",
|
|
59484
59402
|
kind: ArtifactKind.Fragment,
|
|
@@ -59564,11 +59482,11 @@ var nodeNotDefinedMessage = (config) => `Looks like you are trying to use the ${
|
|
|
59564
59482
|
For more information, visit this link: ${siteURL}/guides/pagination`;
|
|
59565
59483
|
|
|
59566
59484
|
// src/codegen/generators/artifacts/fieldKey.ts
|
|
59567
|
-
import * as
|
|
59485
|
+
import * as graphql15 from "graphql";
|
|
59568
59486
|
function fieldKey(config, field) {
|
|
59569
59487
|
const attributeName = field.alias?.value || field.name.value;
|
|
59570
|
-
const printed =
|
|
59571
|
-
const secondParse =
|
|
59488
|
+
const printed = graphql15.print(field);
|
|
59489
|
+
const secondParse = graphql15.parse(`{${printed}}`).definitions[0].selectionSet.selections[0];
|
|
59572
59490
|
let paginateMode = config.defaultPaginateMode;
|
|
59573
59491
|
const paginatedDirective = field.directives?.find(
|
|
59574
59492
|
(directive) => directive.name.value === config.paginateDirective
|
|
@@ -59691,13 +59609,13 @@ function prepareSelection({
|
|
|
59691
59609
|
} else if ("getFields" in type) {
|
|
59692
59610
|
let typeRef = type.getFields()[field.name.value].type;
|
|
59693
59611
|
fieldType = getRootType(typeRef);
|
|
59694
|
-
nullable = !
|
|
59695
|
-
} else if (
|
|
59612
|
+
nullable = !graphql16.isNonNullType(typeRef);
|
|
59613
|
+
} else if (graphql16.isAbstractType(type)) {
|
|
59696
59614
|
for (const possible of config.schema.getPossibleTypes(type)) {
|
|
59697
|
-
if (
|
|
59615
|
+
if (graphql16.isObjectType(possible)) {
|
|
59698
59616
|
if (possible.getFields()[field.name.value]) {
|
|
59699
59617
|
fieldType = possible.getFields()[field.name.value].type;
|
|
59700
|
-
nullable = !
|
|
59618
|
+
nullable = !graphql16.isNonNullType(fieldType);
|
|
59701
59619
|
break;
|
|
59702
59620
|
}
|
|
59703
59621
|
}
|
|
@@ -59834,7 +59752,7 @@ function prepareSelection({
|
|
|
59834
59752
|
kind: "value"
|
|
59835
59753
|
} : { kind: "continue" };
|
|
59836
59754
|
const parentType = config.schema.getType(rootType);
|
|
59837
|
-
if (
|
|
59755
|
+
if (graphql16.isObjectType(parentType) || graphql16.isInterfaceType(parentType)) {
|
|
59838
59756
|
const fieldType2 = parentType.getFields()[field.name.value]?.type;
|
|
59839
59757
|
if (fieldType2) {
|
|
59840
59758
|
const listCount = unwrapType(config, fieldType2).wrappers.filter(
|
|
@@ -59857,7 +59775,7 @@ function prepareSelection({
|
|
|
59857
59775
|
}
|
|
59858
59776
|
fieldObj.loading = loadingValue;
|
|
59859
59777
|
}
|
|
59860
|
-
if (
|
|
59778
|
+
if (graphql16.isInterfaceType(fieldType) || graphql16.isUnionType(fieldType)) {
|
|
59861
59779
|
fieldObj.abstract = true;
|
|
59862
59780
|
if (Object.values(fieldObj.selection?.abstractFields?.fields ?? {}).some(
|
|
59863
59781
|
(fields) => Object.values(fields ?? {}).some((field2) => field2.required)
|
|
@@ -59939,7 +59857,7 @@ function mergeSelection({
|
|
|
59939
59857
|
typeSelection,
|
|
59940
59858
|
abstractSelection.fields[typeName] ?? {}
|
|
59941
59859
|
);
|
|
59942
|
-
if (
|
|
59860
|
+
if (graphql16.isAbstractType(gqlType)) {
|
|
59943
59861
|
for (const possible of config.schema.getPossibleTypes(gqlType)) {
|
|
59944
59862
|
if (!possibleSelectionTypes[typeName]) {
|
|
59945
59863
|
possibleSelectionTypes[typeName] = [];
|
|
@@ -59974,7 +59892,7 @@ function mergeSelection({
|
|
|
59974
59892
|
}
|
|
59975
59893
|
}
|
|
59976
59894
|
const parentType = config.schema.getType(rootType);
|
|
59977
|
-
const possibleParents =
|
|
59895
|
+
const possibleParents = graphql16.isAbstractType(parentType) ? config.schema.getPossibleTypes(parentType)?.map((t2) => t2.name) : [parentType.name];
|
|
59978
59896
|
for (const key of Object.keys(abstractSelection.typeMap)) {
|
|
59979
59897
|
if (!possibleParents.includes(key) && rootType !== key || abstractSelection.fields[key]) {
|
|
59980
59898
|
delete abstractSelection.typeMap[key];
|
|
@@ -60031,12 +59949,12 @@ function mergeSelection({
|
|
|
60031
59949
|
}
|
|
60032
59950
|
|
|
60033
59951
|
// src/codegen/generators/artifacts/index.ts
|
|
60034
|
-
var
|
|
59952
|
+
var AST5 = recast5.types.builders;
|
|
60035
59953
|
function artifactGenerator(stats) {
|
|
60036
59954
|
return async function(config, docs) {
|
|
60037
59955
|
const filterTypes = {};
|
|
60038
59956
|
for (const doc of docs) {
|
|
60039
|
-
|
|
59957
|
+
graphql17.visit(doc.document, {
|
|
60040
59958
|
Directive(node, _, __, ___, ancestors) {
|
|
60041
59959
|
if (node.name.value !== config.listDirective) {
|
|
60042
59960
|
return;
|
|
@@ -60096,7 +60014,7 @@ function artifactGenerator(stats) {
|
|
|
60096
60014
|
return;
|
|
60097
60015
|
}
|
|
60098
60016
|
const usedVariableNames = /* @__PURE__ */ new Set();
|
|
60099
|
-
let documentWithoutInternalDirectives =
|
|
60017
|
+
let documentWithoutInternalDirectives = graphql17.visit(document, {
|
|
60100
60018
|
Directive(node) {
|
|
60101
60019
|
if (config.isInternalDirective(node.name.value)) {
|
|
60102
60020
|
return null;
|
|
@@ -60109,7 +60027,7 @@ function artifactGenerator(stats) {
|
|
|
60109
60027
|
}
|
|
60110
60028
|
}
|
|
60111
60029
|
});
|
|
60112
|
-
let documentWithoutExtraVariables =
|
|
60030
|
+
let documentWithoutExtraVariables = graphql17.visit(
|
|
60113
60031
|
documentWithoutInternalDirectives,
|
|
60114
60032
|
{
|
|
60115
60033
|
VariableDefinition(variableDefinitionNode) {
|
|
@@ -60120,13 +60038,13 @@ function artifactGenerator(stats) {
|
|
|
60120
60038
|
}
|
|
60121
60039
|
}
|
|
60122
60040
|
);
|
|
60123
|
-
let rawString =
|
|
60041
|
+
let rawString = graphql17.print(documentWithoutExtraVariables);
|
|
60124
60042
|
let docKind = doc.kind;
|
|
60125
60043
|
const operations = document.definitions.filter(
|
|
60126
|
-
({ kind }) => kind ===
|
|
60044
|
+
({ kind }) => kind === graphql17.Kind.OPERATION_DEFINITION
|
|
60127
60045
|
);
|
|
60128
60046
|
const fragments = document.definitions.filter(
|
|
60129
|
-
({ kind }) => kind ===
|
|
60047
|
+
({ kind }) => kind === graphql17.Kind.FRAGMENT_DEFINITION
|
|
60130
60048
|
);
|
|
60131
60049
|
let rootType = "";
|
|
60132
60050
|
let selectionSet;
|
|
@@ -60326,9 +60244,9 @@ function artifactGenerator(stats) {
|
|
|
60326
60244
|
plugin2.artifactEnd({ config, document: doc });
|
|
60327
60245
|
}
|
|
60328
60246
|
const _houdiniHash = hashOriginal({ document: doc });
|
|
60329
|
-
const file =
|
|
60247
|
+
const file = AST5.program([
|
|
60330
60248
|
moduleExport(config, "default", serializeValue(artifact)),
|
|
60331
|
-
|
|
60249
|
+
AST5.expressionStatement(AST5.stringLiteral(`HoudiniHash=${_houdiniHash}`))
|
|
60332
60250
|
]);
|
|
60333
60251
|
const artifactPath = config.artifactPath(document);
|
|
60334
60252
|
const countDocument = doc.generateStore;
|
|
@@ -60386,7 +60304,7 @@ function applyMask(config, target, mask) {
|
|
|
60386
60304
|
if (!targetType) {
|
|
60387
60305
|
continue;
|
|
60388
60306
|
}
|
|
60389
|
-
if (
|
|
60307
|
+
if (graphql17.isAbstractType(targetType)) {
|
|
60390
60308
|
for (const possible of config.schema.getPossibleTypes(targetType)) {
|
|
60391
60309
|
if (target.abstractFields?.fields[possible.name]) {
|
|
60392
60310
|
applyMask(
|
|
@@ -60409,8 +60327,8 @@ function applyMask(config, target, mask) {
|
|
|
60409
60327
|
}
|
|
60410
60328
|
|
|
60411
60329
|
// src/codegen/generators/runtime/graphqlFunction.ts
|
|
60412
|
-
var
|
|
60413
|
-
var
|
|
60330
|
+
var recast6 = __toESM(require_main2(), 1);
|
|
60331
|
+
var AST6 = recast6.types.builders;
|
|
60414
60332
|
async function generateGraphqlReturnTypes(config, docs) {
|
|
60415
60333
|
const indexPath = path_exports.join(config.runtimeDirectory, "index.d.ts");
|
|
60416
60334
|
const fileContent = await fs_exports.readFile(indexPath) || "";
|
|
@@ -60445,18 +60363,18 @@ async function generateGraphqlReturnTypes(config, docs) {
|
|
|
60445
60363
|
continue;
|
|
60446
60364
|
}
|
|
60447
60365
|
for (const [queryString, returnValue] of Object.entries(overloaded_returns)) {
|
|
60448
|
-
const input =
|
|
60449
|
-
input.typeAnnotation =
|
|
60450
|
-
|
|
60366
|
+
const input = AST6.identifier("str");
|
|
60367
|
+
input.typeAnnotation = AST6.tsTypeAnnotation(
|
|
60368
|
+
AST6.tsLiteralType(AST6.stringLiteral(queryString))
|
|
60451
60369
|
);
|
|
60452
60370
|
script.body.splice(
|
|
60453
60371
|
i,
|
|
60454
60372
|
0,
|
|
60455
|
-
|
|
60456
|
-
|
|
60457
|
-
|
|
60373
|
+
AST6.exportNamedDeclaration(
|
|
60374
|
+
AST6.tsDeclareFunction(
|
|
60375
|
+
AST6.identifier("graphql"),
|
|
60458
60376
|
[input],
|
|
60459
|
-
|
|
60377
|
+
AST6.tsTypeAnnotation(AST6.tsTypeReference(AST6.identifier(returnValue)))
|
|
60460
60378
|
)
|
|
60461
60379
|
)
|
|
60462
60380
|
);
|
|
@@ -60631,165 +60549,22 @@ function moduleStatments(config) {
|
|
|
60631
60549
|
var recast11 = __toESM(require_main2(), 1);
|
|
60632
60550
|
|
|
60633
60551
|
// src/codegen/generators/typescript/addReferencedInputTypes.ts
|
|
60634
|
-
var recast8 = __toESM(require_main2(), 1);
|
|
60635
|
-
import * as graphql19 from "graphql";
|
|
60636
|
-
|
|
60637
|
-
// src/codegen/generators/typescript/typeReference.ts
|
|
60638
60552
|
var recast7 = __toESM(require_main2(), 1);
|
|
60639
60553
|
import * as graphql18 from "graphql";
|
|
60640
|
-
|
|
60641
|
-
// src/codegen/generators/typescript/types.ts
|
|
60642
|
-
var recast6 = __toESM(require_main2(), 1);
|
|
60643
|
-
import * as graphql17 from "graphql";
|
|
60644
|
-
var AST6 = recast6.types.builders;
|
|
60645
|
-
function readonlyProperty(prop, enable = true) {
|
|
60646
|
-
if (enable) {
|
|
60647
|
-
prop.readonly = true;
|
|
60648
|
-
}
|
|
60649
|
-
return prop;
|
|
60650
|
-
}
|
|
60651
|
-
function nullableField(inner, input = false) {
|
|
60652
|
-
const members = [inner, AST6.tsNullKeyword()];
|
|
60653
|
-
if (input) {
|
|
60654
|
-
members.push(AST6.tsUndefinedKeyword());
|
|
60655
|
-
}
|
|
60656
|
-
return AST6.tsUnionType(members);
|
|
60657
|
-
}
|
|
60658
|
-
function scalarPropertyValue(config, filepath, missingScalars, target, body, field) {
|
|
60659
|
-
if (config.configFile.features?.componentFields && target.name === config.componentScalar) {
|
|
60660
|
-
if (!field) {
|
|
60661
|
-
return AST6.tsNeverKeyword();
|
|
60662
|
-
}
|
|
60663
|
-
const component = config.componentFields[field.parent][field.field];
|
|
60664
|
-
const sourcePathRelative = path_exports.relative(
|
|
60665
|
-
path_exports.join(config.projectRoot, "src"),
|
|
60666
|
-
component.filepath
|
|
60667
|
-
);
|
|
60668
|
-
let sourcePathParsed = path_exports.parse(sourcePathRelative);
|
|
60669
|
-
let sourcePath = path_exports.join(sourcePathParsed.dir, sourcePathParsed.name);
|
|
60670
|
-
const localImport = ensureImports({
|
|
60671
|
-
config,
|
|
60672
|
-
body,
|
|
60673
|
-
import: "__component__" + component.fragment,
|
|
60674
|
-
sourceModule: path_exports.join(
|
|
60675
|
-
path_exports.relative(path_exports.dirname(filepath), config.projectRoot),
|
|
60676
|
-
"src",
|
|
60677
|
-
sourcePath
|
|
60678
|
-
)
|
|
60679
|
-
});
|
|
60680
|
-
const parameters = AST6.tsTypeReference(AST6.identifier("Parameters"));
|
|
60681
|
-
parameters.typeParameters = AST6.tsTypeParameterInstantiation([
|
|
60682
|
-
AST6.tsTypeQuery(AST6.identifier(localImport))
|
|
60683
|
-
]);
|
|
60684
|
-
const indexed = AST6.tsIndexedAccessType(
|
|
60685
|
-
parameters,
|
|
60686
|
-
AST6.tsLiteralType(AST6.numericLiteral(0))
|
|
60687
|
-
);
|
|
60688
|
-
const omit = AST6.tsTypeReference(AST6.identifier("Omit"));
|
|
60689
|
-
omit.typeParameters = AST6.tsTypeParameterInstantiation([
|
|
60690
|
-
indexed,
|
|
60691
|
-
AST6.tsLiteralType(AST6.stringLiteral(component.prop))
|
|
60692
|
-
]);
|
|
60693
|
-
const arg = AST6.identifier("props");
|
|
60694
|
-
arg.typeAnnotation = AST6.tsTypeAnnotation(omit);
|
|
60695
|
-
const returnType = AST6.tsTypeReference(AST6.identifier("ReturnType"));
|
|
60696
|
-
returnType.typeParameters = AST6.tsTypeParameterInstantiation([
|
|
60697
|
-
AST6.tsTypeQuery(AST6.identifier(localImport))
|
|
60698
|
-
]);
|
|
60699
|
-
const fnType = AST6.tsFunctionType([arg]);
|
|
60700
|
-
fnType.typeAnnotation = AST6.tsTypeAnnotation(returnType);
|
|
60701
|
-
return fnType;
|
|
60702
|
-
}
|
|
60703
|
-
switch (target.name) {
|
|
60704
|
-
case "String": {
|
|
60705
|
-
return AST6.tsStringKeyword();
|
|
60706
|
-
}
|
|
60707
|
-
case "Int": {
|
|
60708
|
-
return AST6.tsNumberKeyword();
|
|
60709
|
-
}
|
|
60710
|
-
case "Float": {
|
|
60711
|
-
return AST6.tsNumberKeyword();
|
|
60712
|
-
}
|
|
60713
|
-
case "Boolean": {
|
|
60714
|
-
return AST6.tsBooleanKeyword();
|
|
60715
|
-
}
|
|
60716
|
-
case "ID": {
|
|
60717
|
-
return AST6.tsStringKeyword();
|
|
60718
|
-
}
|
|
60719
|
-
default: {
|
|
60720
|
-
if (graphql17.isNonNullType(target) && "ofType" in target) {
|
|
60721
|
-
return scalarPropertyValue(
|
|
60722
|
-
config,
|
|
60723
|
-
filepath,
|
|
60724
|
-
missingScalars,
|
|
60725
|
-
target.ofType,
|
|
60726
|
-
body,
|
|
60727
|
-
field
|
|
60728
|
-
);
|
|
60729
|
-
}
|
|
60730
|
-
if (config.scalars?.[target.name]) {
|
|
60731
|
-
return AST6.tsTypeReference(AST6.identifier(config.scalars?.[target.name].type));
|
|
60732
|
-
}
|
|
60733
|
-
if (target.name !== config.componentScalar) {
|
|
60734
|
-
missingScalars.add(target.name);
|
|
60735
|
-
}
|
|
60736
|
-
return AST6.tsAnyKeyword();
|
|
60737
|
-
}
|
|
60738
|
-
}
|
|
60739
|
-
}
|
|
60740
|
-
|
|
60741
|
-
// src/codegen/generators/typescript/typeReference.ts
|
|
60742
60554
|
var AST7 = recast7.types.builders;
|
|
60743
|
-
function tsTypeReference(config, filepath, missingScalars, definition, body) {
|
|
60744
|
-
const { type, wrappers } = unwrapType(config, definition.type);
|
|
60745
|
-
let result;
|
|
60746
|
-
if (graphql18.isScalarType(type)) {
|
|
60747
|
-
result = scalarPropertyValue(config, filepath, missingScalars, type, body, null);
|
|
60748
|
-
} else if (graphql18.isEnumType(type)) {
|
|
60749
|
-
result = enumReference(config, body, type.name);
|
|
60750
|
-
} else {
|
|
60751
|
-
result = AST7.tsTypeReference(AST7.identifier(type.name));
|
|
60752
|
-
}
|
|
60753
|
-
for (const toWrap of wrappers) {
|
|
60754
|
-
if (toWrap === "NonNull" /* NonNull */) {
|
|
60755
|
-
continue;
|
|
60756
|
-
} else if (toWrap === "Nullable" /* Nullable */) {
|
|
60757
|
-
result = nullableField(result, true);
|
|
60758
|
-
} else if (toWrap === "List" /* List */) {
|
|
60759
|
-
result = AST7.tsArrayType(AST7.tsParenthesizedType(result));
|
|
60760
|
-
}
|
|
60761
|
-
}
|
|
60762
|
-
return result;
|
|
60763
|
-
}
|
|
60764
|
-
function enumReference(config, body, name) {
|
|
60765
|
-
ensureImports({
|
|
60766
|
-
config,
|
|
60767
|
-
body,
|
|
60768
|
-
import: ["ValueOf"],
|
|
60769
|
-
importKind: "type",
|
|
60770
|
-
sourceModule: "$houdini/runtime/lib/types"
|
|
60771
|
-
});
|
|
60772
|
-
return AST7.tsTypeReference(
|
|
60773
|
-
AST7.identifier("ValueOf"),
|
|
60774
|
-
AST7.tsTypeParameterInstantiation([AST7.tsTypeQuery(AST7.identifier(name))])
|
|
60775
|
-
);
|
|
60776
|
-
}
|
|
60777
|
-
|
|
60778
|
-
// src/codegen/generators/typescript/addReferencedInputTypes.ts
|
|
60779
|
-
var AST8 = recast8.types.builders;
|
|
60780
60555
|
function addReferencedInputTypes(config, filepath, body, visitedTypes, missingScalars, rootType) {
|
|
60781
60556
|
const { type } = unwrapType(config, rootType);
|
|
60782
|
-
if (
|
|
60557
|
+
if (graphql18.isScalarType(type)) {
|
|
60783
60558
|
return;
|
|
60784
60559
|
}
|
|
60785
60560
|
if (visitedTypes.has(type.name)) {
|
|
60786
60561
|
return;
|
|
60787
60562
|
}
|
|
60788
|
-
if (
|
|
60563
|
+
if (graphql18.isUnionType(type)) {
|
|
60789
60564
|
throw new HoudiniError({ filepath, message: "Input Unions are not supported yet. Sorry!" });
|
|
60790
60565
|
}
|
|
60791
60566
|
visitedTypes.add(type.name);
|
|
60792
|
-
if (
|
|
60567
|
+
if (graphql18.isEnumType(type)) {
|
|
60793
60568
|
ensureImports({
|
|
60794
60569
|
config,
|
|
60795
60570
|
body,
|
|
@@ -60803,21 +60578,37 @@ function addReferencedInputTypes(config, filepath, body, visitedTypes, missingSc
|
|
|
60803
60578
|
for (const field of Object.values(type.getFields())) {
|
|
60804
60579
|
addReferencedInputTypes(config, filepath, body, visitedTypes, missingScalars, field.type);
|
|
60805
60580
|
members.push(
|
|
60806
|
-
|
|
60807
|
-
|
|
60808
|
-
|
|
60581
|
+
AST7.tsPropertySignature(
|
|
60582
|
+
AST7.identifier(field.name),
|
|
60583
|
+
AST7.tsTypeAnnotation(
|
|
60809
60584
|
tsTypeReference(config, filepath, missingScalars, field, body)
|
|
60810
60585
|
),
|
|
60811
|
-
|
|
60586
|
+
graphql18.isNullableType(field.type)
|
|
60812
60587
|
)
|
|
60813
60588
|
);
|
|
60814
60589
|
}
|
|
60815
|
-
body.push(
|
|
60590
|
+
body.push(AST7.tsTypeAliasDeclaration(AST7.identifier(type.name), AST7.tsTypeLiteral(members)));
|
|
60816
60591
|
}
|
|
60817
60592
|
|
|
60818
60593
|
// src/codegen/generators/typescript/inlineType.ts
|
|
60819
60594
|
var recast9 = __toESM(require_main2(), 1);
|
|
60820
|
-
import * as
|
|
60595
|
+
import * as graphql19 from "graphql";
|
|
60596
|
+
|
|
60597
|
+
// src/codegen/generators/comments/jsdoc.ts
|
|
60598
|
+
var recast8 = __toESM(require_main2(), 1);
|
|
60599
|
+
var AST8 = recast8.types.builders;
|
|
60600
|
+
function jsdocComment(text, deprecated) {
|
|
60601
|
+
let commentContent = `*
|
|
60602
|
+
* ${text}
|
|
60603
|
+
`;
|
|
60604
|
+
if (deprecated) {
|
|
60605
|
+
commentContent = `${commentContent} * @deprecated ${deprecated}
|
|
60606
|
+
`;
|
|
60607
|
+
}
|
|
60608
|
+
return AST8.commentBlock(commentContent, true);
|
|
60609
|
+
}
|
|
60610
|
+
|
|
60611
|
+
// src/codegen/generators/typescript/inlineType.ts
|
|
60821
60612
|
var AST9 = recast9.types.builders;
|
|
60822
60613
|
var fragmentKey2 = " $fragments";
|
|
60823
60614
|
function inlineType({
|
|
@@ -60838,7 +60629,7 @@ function inlineType({
|
|
|
60838
60629
|
const { type, wrappers } = unwrapType(config, rootType);
|
|
60839
60630
|
let result;
|
|
60840
60631
|
let forceNullable = false;
|
|
60841
|
-
if (
|
|
60632
|
+
if (graphql19.isScalarType(type)) {
|
|
60842
60633
|
result = scalarPropertyValue(
|
|
60843
60634
|
config,
|
|
60844
60635
|
filepath,
|
|
@@ -60847,7 +60638,7 @@ function inlineType({
|
|
|
60847
60638
|
body,
|
|
60848
60639
|
field
|
|
60849
60640
|
);
|
|
60850
|
-
} else if (
|
|
60641
|
+
} else if (graphql19.isEnumType(type)) {
|
|
60851
60642
|
ensureImports({
|
|
60852
60643
|
config,
|
|
60853
60644
|
body,
|
|
@@ -60872,11 +60663,11 @@ function inlineType({
|
|
|
60872
60663
|
for (const selection of selections) {
|
|
60873
60664
|
if (selection.kind === "InlineFragment" && selection.typeCondition) {
|
|
60874
60665
|
const fragmentType = config.schema.getType(selection.typeCondition.name.value);
|
|
60875
|
-
if (!
|
|
60666
|
+
if (!graphql19.isInterfaceType(type) && !graphql19.isUnionType(type)) {
|
|
60876
60667
|
selectedFields.push(...selection.selectionSet.selections);
|
|
60877
60668
|
continue;
|
|
60878
60669
|
}
|
|
60879
|
-
if (!
|
|
60670
|
+
if (!graphql19.isInterfaceType(fragmentType) && !graphql19.isUnionType(fragmentType)) {
|
|
60880
60671
|
if (!inlineFragments[fragmentType.name]) {
|
|
60881
60672
|
inlineFragments[fragmentType.name] = [];
|
|
60882
60673
|
}
|
|
@@ -60968,6 +60759,11 @@ function inlineType({
|
|
|
60968
60759
|
if (allOptional) {
|
|
60969
60760
|
prop.optional = true;
|
|
60970
60761
|
}
|
|
60762
|
+
if (field2.description || field2.deprecationReason) {
|
|
60763
|
+
prop.comments = [
|
|
60764
|
+
jsdocComment(field2.description ?? "", field2.deprecationReason ?? void 0)
|
|
60765
|
+
];
|
|
60766
|
+
}
|
|
60971
60767
|
return prop;
|
|
60972
60768
|
})
|
|
60973
60769
|
]);
|
|
@@ -61019,7 +60815,7 @@ function inlineType({
|
|
|
61019
60815
|
}
|
|
61020
60816
|
}
|
|
61021
60817
|
}
|
|
61022
|
-
if (objectType.type === "TSTypeLiteral" && !
|
|
60818
|
+
if (objectType.type === "TSTypeLiteral" && !graphql19.isInterfaceType(fragmentRootType) && !graphql19.isUnionType(fragmentRootType)) {
|
|
61023
60819
|
const existingTypenameIndex = objectType.members.findIndex(
|
|
61024
60820
|
(member) => member.type === "TSPropertySignature" && member.key.type === "Identifier" && member.key.name === "__typename"
|
|
61025
60821
|
);
|
|
@@ -61044,11 +60840,11 @@ function inlineType({
|
|
|
61044
60840
|
];
|
|
61045
60841
|
}
|
|
61046
60842
|
let coveredTypenames;
|
|
61047
|
-
if (
|
|
60843
|
+
if (graphql19.isInterfaceType(fragmentRootType)) {
|
|
61048
60844
|
coveredTypenames = interfaceCoveredTypenames(fragmentRootType);
|
|
61049
|
-
} else if (
|
|
60845
|
+
} else if (graphql19.isUnionType(fragmentRootType)) {
|
|
61050
60846
|
coveredTypenames = fragmentRootType.getTypes().map((type2) => type2.name);
|
|
61051
|
-
} else if (
|
|
60847
|
+
} else if (graphql19.isObjectType(fragmentRootType)) {
|
|
61052
60848
|
coveredTypenames = [fragmentRootType.name];
|
|
61053
60849
|
} else {
|
|
61054
60850
|
throw Error("unreachable code");
|
|
@@ -61084,7 +60880,7 @@ function inlineType({
|
|
|
61084
60880
|
);
|
|
61085
60881
|
}
|
|
61086
60882
|
);
|
|
61087
|
-
const parentIsUnionOrInterface = !
|
|
60883
|
+
const parentIsUnionOrInterface = !graphql19.isInterfaceType(type) && !graphql19.isUnionType(type);
|
|
61088
60884
|
const possibleTypenames = parentIsUnionOrInterface ? [parent.name] : config.schema.getPossibleTypes(type).map((type2) => type2.name);
|
|
61089
60885
|
const coveredTypenames = new Set(
|
|
61090
60886
|
Object.values(inlineFragmentSelections).flatMap((sel) => sel.coveredTypenames)
|
|
@@ -61151,7 +60947,7 @@ function selectionTypeInfo(schema, filepath, rootType, selection) {
|
|
|
61151
60947
|
},
|
|
61152
60948
|
type: schema.getType("String")
|
|
61153
60949
|
};
|
|
61154
|
-
} else if (
|
|
60950
|
+
} else if (graphql19.isNonNullType(rootType) && "getFields" in rootType.ofType) {
|
|
61155
60951
|
fields = rootType.ofType.getFields();
|
|
61156
60952
|
} else {
|
|
61157
60953
|
fields = rootType.getFields();
|
|
@@ -61163,7 +60959,7 @@ function selectionTypeInfo(schema, filepath, rootType, selection) {
|
|
|
61163
60959
|
message: `Could not find type information for field ${rootType.toString()}.${selectionName} ${field}`
|
|
61164
60960
|
});
|
|
61165
60961
|
}
|
|
61166
|
-
const fieldType =
|
|
60962
|
+
const fieldType = graphql19.getNamedType(field.type);
|
|
61167
60963
|
if (!fieldType) {
|
|
61168
60964
|
throw new HoudiniError({
|
|
61169
60965
|
filepath,
|
|
@@ -61672,7 +61468,7 @@ async function generateFragmentTypeDefs(config, filepath, body, selections, defi
|
|
|
61672
61468
|
|
|
61673
61469
|
// src/codegen/generators/typescript/imperativeTypeDef.ts
|
|
61674
61470
|
var recast12 = __toESM(require_main2(), 1);
|
|
61675
|
-
import * as
|
|
61471
|
+
import * as graphql20 from "graphql";
|
|
61676
61472
|
var AST12 = recast12.types.builders;
|
|
61677
61473
|
async function imperativeCacheTypef(config, docs) {
|
|
61678
61474
|
const returnType = (doc) => config.plugins.find((plugin2) => plugin2.graphqlTagReturn)?.graphqlTagReturn?.({
|
|
@@ -61723,7 +61519,7 @@ function typeDefinitions(config, filepath, body, docs, returnType) {
|
|
|
61723
61519
|
const operationTypes = [config.schema.getMutationType(), config.schema.getSubscriptionType()].filter(Boolean).map((type) => type?.name);
|
|
61724
61520
|
const visitedTypes = /* @__PURE__ */ new Set();
|
|
61725
61521
|
const types14 = Object.values(config.schema.getTypeMap()).filter(
|
|
61726
|
-
(type) => !
|
|
61522
|
+
(type) => !graphql20.isAbstractType(type) && !graphql20.isScalarType(type) && !graphql20.isEnumType(type) && !graphql20.isInputObjectType(type) && !type.name.startsWith("__") && !operationTypes.includes(type.name)
|
|
61727
61523
|
);
|
|
61728
61524
|
const fragmentMap = fragmentListMap(
|
|
61729
61525
|
config,
|
|
@@ -61740,7 +61536,7 @@ function typeDefinitions(config, filepath, body, docs, returnType) {
|
|
|
61740
61536
|
}
|
|
61741
61537
|
let idFields = AST12.tsNeverKeyword();
|
|
61742
61538
|
const keys2 = keyFieldsForType(config.configFile, type.name);
|
|
61743
|
-
if (
|
|
61539
|
+
if (graphql20.isObjectType(type) && keys2.length > 0 && keys2.every((key) => type.getFields()[key])) {
|
|
61744
61540
|
idFields = AST12.tsTypeLiteral(
|
|
61745
61541
|
keys2.map((key) => {
|
|
61746
61542
|
const fieldType = type.getFields()[key];
|
|
@@ -61767,13 +61563,13 @@ function typeDefinitions(config, filepath, body, docs, returnType) {
|
|
|
61767
61563
|
idFields = AST12.tsTypeLiteral([]);
|
|
61768
61564
|
}
|
|
61769
61565
|
let fields = AST12.tsTypeLiteral([]);
|
|
61770
|
-
if (
|
|
61566
|
+
if (graphql20.isObjectType(type)) {
|
|
61771
61567
|
fields = AST12.tsTypeLiteral(
|
|
61772
61568
|
Object.entries(type.getFields()).map(
|
|
61773
61569
|
([key, fieldType]) => {
|
|
61774
61570
|
const unwrapped = unwrapType(config, fieldType.type);
|
|
61775
61571
|
let typeOptions = AST12.tsUnionType([]);
|
|
61776
|
-
if (
|
|
61572
|
+
if (graphql20.isScalarType(unwrapped.type)) {
|
|
61777
61573
|
typeOptions.types.push(
|
|
61778
61574
|
scalarPropertyValue(
|
|
61779
61575
|
config,
|
|
@@ -61787,11 +61583,11 @@ function typeDefinitions(config, filepath, body, docs, returnType) {
|
|
|
61787
61583
|
}
|
|
61788
61584
|
)
|
|
61789
61585
|
);
|
|
61790
|
-
} else if (
|
|
61586
|
+
} else if (graphql20.isEnumType(unwrapped.type)) {
|
|
61791
61587
|
typeOptions.types.push(
|
|
61792
61588
|
AST12.tsTypeReference(AST12.identifier(unwrapped.type.name))
|
|
61793
61589
|
);
|
|
61794
|
-
} else if (!
|
|
61590
|
+
} else if (!graphql20.isAbstractType(unwrapped.type)) {
|
|
61795
61591
|
typeOptions.types.push(record(unwrapped.type.name));
|
|
61796
61592
|
} else {
|
|
61797
61593
|
typeOptions.types.push(
|
|
@@ -61887,7 +61683,7 @@ function listDefinitions(config, filepath, body, docs) {
|
|
|
61887
61683
|
const lists = [];
|
|
61888
61684
|
const visitedLists = /* @__PURE__ */ new Set();
|
|
61889
61685
|
for (const doc of docs) {
|
|
61890
|
-
|
|
61686
|
+
graphql20.visit(doc.document, {
|
|
61891
61687
|
Directive(node, key, parent2, path2, ancestors) {
|
|
61892
61688
|
if (![config.listDirective, config.paginateDirective].includes(node.name.value)) {
|
|
61893
61689
|
return;
|
|
@@ -61909,7 +61705,7 @@ function listDefinitions(config, filepath, body, docs) {
|
|
|
61909
61705
|
const targetFieldDefinition = parentType.getFields()[targetField.name.value];
|
|
61910
61706
|
const { type: listType } = unwrapType(config, targetFieldDefinition.type);
|
|
61911
61707
|
const possibleTypes = [];
|
|
61912
|
-
if (
|
|
61708
|
+
if (graphql20.isAbstractType(listType)) {
|
|
61913
61709
|
possibleTypes.push(
|
|
61914
61710
|
...config.schema.getPossibleTypes(listType).map((possible) => possible.name)
|
|
61915
61711
|
);
|
|
@@ -62071,7 +61867,7 @@ async function typescriptGenerator(config, docs) {
|
|
|
62071
61867
|
}
|
|
62072
61868
|
|
|
62073
61869
|
// src/codegen/generators/persistedQueries/index.ts
|
|
62074
|
-
import * as
|
|
61870
|
+
import * as graphql21 from "graphql";
|
|
62075
61871
|
async function persistOutputGenerator(config, docs) {
|
|
62076
61872
|
if (!config.persistedQueriesPath.endsWith(".json")) {
|
|
62077
61873
|
throw new Error('Can write Persisted Queries only in a ".json" file.');
|
|
@@ -62081,8 +61877,8 @@ async function persistOutputGenerator(config, docs) {
|
|
|
62081
61877
|
if (!generateArtifact) {
|
|
62082
61878
|
return acc;
|
|
62083
61879
|
}
|
|
62084
|
-
let rawString =
|
|
62085
|
-
|
|
61880
|
+
let rawString = graphql21.print(
|
|
61881
|
+
graphql21.visit(document, {
|
|
62086
61882
|
Directive(node) {
|
|
62087
61883
|
if (config.isInternalDirective(node.name.value)) {
|
|
62088
61884
|
return null;
|
|
@@ -62091,7 +61887,7 @@ async function persistOutputGenerator(config, docs) {
|
|
|
62091
61887
|
})
|
|
62092
61888
|
);
|
|
62093
61889
|
const operations = document.definitions.filter(
|
|
62094
|
-
({ kind }) => kind ===
|
|
61890
|
+
({ kind }) => kind === graphql21.Kind.OPERATION_DEFINITION
|
|
62095
61891
|
);
|
|
62096
61892
|
if (operations.length > 0 && operations[0].kind === "OperationDefinition") {
|
|
62097
61893
|
if (artifact) {
|
|
@@ -62106,33 +61902,45 @@ async function persistOutputGenerator(config, docs) {
|
|
|
62106
61902
|
}
|
|
62107
61903
|
|
|
62108
61904
|
// src/codegen/generators/definitions/index.ts
|
|
62109
|
-
import * as
|
|
61905
|
+
import * as graphql23 from "graphql";
|
|
62110
61906
|
|
|
62111
61907
|
// src/codegen/generators/definitions/enums.ts
|
|
62112
61908
|
var recast13 = __toESM(require_main2(), 1);
|
|
62113
|
-
import * as
|
|
61909
|
+
import * as graphql22 from "graphql";
|
|
62114
61910
|
var AST13 = recast13.types.builders;
|
|
62115
61911
|
async function definitionsGenerator(config) {
|
|
62116
|
-
const enums =
|
|
61912
|
+
const enums = graphql22.parse(graphql22.printSchema(config.schema)).definitions.filter(
|
|
62117
61913
|
(definition) => definition.kind === "EnumTypeDefinition"
|
|
62118
61914
|
).filter((def) => !config.isInternalEnum(def));
|
|
62119
61915
|
const { code: runtimeDefinitions } = await printJS(
|
|
62120
61916
|
AST13.program(
|
|
62121
61917
|
enums.map((defn) => {
|
|
62122
61918
|
const name = defn.name.value;
|
|
62123
|
-
|
|
61919
|
+
const declaration = moduleExport(
|
|
62124
61920
|
config,
|
|
62125
61921
|
name,
|
|
62126
61922
|
AST13.objectExpression(
|
|
62127
61923
|
defn.values?.map((value) => {
|
|
62128
61924
|
const str = value.name.value;
|
|
62129
|
-
|
|
61925
|
+
const prop = AST13.objectProperty(
|
|
62130
61926
|
AST13.stringLiteral(str),
|
|
62131
61927
|
AST13.stringLiteral(str)
|
|
62132
61928
|
);
|
|
61929
|
+
const deprecationReason = value.directives?.find((d) => d.name.value === "deprecated")?.arguments?.find((a) => a.name.value === "reason")?.value?.value;
|
|
61930
|
+
if (value.description || deprecationReason)
|
|
61931
|
+
prop.comments = [
|
|
61932
|
+
jsdocComment(value.description?.value ?? "", deprecationReason)
|
|
61933
|
+
];
|
|
61934
|
+
return prop;
|
|
62133
61935
|
}) || []
|
|
62134
61936
|
)
|
|
62135
61937
|
);
|
|
61938
|
+
if (defn.description) {
|
|
61939
|
+
declaration.comments = [
|
|
61940
|
+
AST13.commentBlock(`* ${defn.description.value} `, true, false)
|
|
61941
|
+
];
|
|
61942
|
+
}
|
|
61943
|
+
return declaration;
|
|
62136
61944
|
})
|
|
62137
61945
|
)
|
|
62138
61946
|
);
|
|
@@ -62141,11 +61949,19 @@ type ValuesOf<T> = T[keyof T]
|
|
|
62141
61949
|
` + enums.sort((a, b) => a.name.value.localeCompare(b.name.value)).map((definition) => {
|
|
62142
61950
|
const name = definition.name.value;
|
|
62143
61951
|
const values = definition.values;
|
|
62144
|
-
|
|
61952
|
+
let jsdoc = "";
|
|
61953
|
+
if (definition.description) {
|
|
61954
|
+
jsdoc = `
|
|
61955
|
+
/** ${definition.description.value} */`;
|
|
61956
|
+
}
|
|
61957
|
+
return `${jsdoc}
|
|
62145
61958
|
export declare const ${name}: {
|
|
62146
|
-
${values?.map(
|
|
61959
|
+
${values?.map(
|
|
61960
|
+
(value) => (value.description ? ` /** ${value.description.value} */
|
|
61961
|
+
` : "") + ` readonly ${value.name.value}: "${value.name.value}";`
|
|
61962
|
+
).join("\n")}
|
|
62147
61963
|
}
|
|
62148
|
-
|
|
61964
|
+
${jsdoc}
|
|
62149
61965
|
export type ${name}$options = ValuesOf<typeof ${name}>
|
|
62150
61966
|
`;
|
|
62151
61967
|
}).join("");
|
|
@@ -62165,7 +61981,7 @@ async function schemaGenerator(config) {
|
|
|
62165
61981
|
await Promise.all([
|
|
62166
61982
|
fs_exports.writeFile(
|
|
62167
61983
|
config.definitionsSchemaPath,
|
|
62168
|
-
config.localSchema ?
|
|
61984
|
+
config.localSchema ? graphql23.printSchema(config.schema) : config.newSchema
|
|
62169
61985
|
),
|
|
62170
61986
|
fs_exports.writeFile(config.definitionsDocumentsPath, config.newDocuments),
|
|
62171
61987
|
definitionsGenerator(config)
|
|
@@ -63870,7 +63686,7 @@ function mergeGraphQLTypes(typeSource, config) {
|
|
|
63870
63686
|
}
|
|
63871
63687
|
|
|
63872
63688
|
// src/codegen/transforms/schema.ts
|
|
63873
|
-
import * as
|
|
63689
|
+
import * as graphql24 from "graphql";
|
|
63874
63690
|
async function graphqlExtensions(config, documents) {
|
|
63875
63691
|
let internalSchema = `
|
|
63876
63692
|
enum CachePolicy {
|
|
@@ -63993,7 +63809,7 @@ directive @${config.componentFieldDirective}(field: String!, prop: String, expor
|
|
|
63993
63809
|
const args = fragmentArguments(config, "", field.parent);
|
|
63994
63810
|
if (args.length > 0) {
|
|
63995
63811
|
argString = "(" + args.map((arg) => {
|
|
63996
|
-
const typeName =
|
|
63812
|
+
const typeName = graphql24.print(arg.type);
|
|
63997
63813
|
return `${arg.name}:${typeName}${arg.required ? "!" : ""}`;
|
|
63998
63814
|
}).join("\n") + ")";
|
|
63999
63815
|
}
|
|
@@ -64003,20 +63819,20 @@ directive @${config.componentFieldDirective}(field: String!, prop: String, expor
|
|
|
64003
63819
|
`;
|
|
64004
63820
|
}).join("\n");
|
|
64005
63821
|
extensions += `${Object.keys(config.configFile.features?.runtimeScalars ?? {}).map((scalar) => `scalar ${scalar}`).join("\n")}`;
|
|
64006
|
-
config.newSchema =
|
|
63822
|
+
config.newSchema = graphql24.print(mergeTypeDefs([internalSchema, config.newSchema]));
|
|
64007
63823
|
config.schemaString += extensions;
|
|
64008
|
-
config.schema =
|
|
64009
|
-
|
|
64010
|
-
mergeTypeDefs([
|
|
63824
|
+
config.schema = graphql24.buildSchema(
|
|
63825
|
+
graphql24.print(
|
|
63826
|
+
mergeTypeDefs([graphql24.printSchema(config.schema), internalSchema, extensions])
|
|
64011
63827
|
)
|
|
64012
63828
|
);
|
|
64013
63829
|
}
|
|
64014
63830
|
|
|
64015
63831
|
// src/codegen/transforms/typename.ts
|
|
64016
|
-
import * as
|
|
63832
|
+
import * as graphql25 from "graphql";
|
|
64017
63833
|
async function addTypename(config, documents) {
|
|
64018
63834
|
for (const doc of documents) {
|
|
64019
|
-
doc.document =
|
|
63835
|
+
doc.document = graphql25.visit(doc.document, {
|
|
64020
63836
|
Field(node, key, parent2, path2, ancestors) {
|
|
64021
63837
|
if (!node.selectionSet) {
|
|
64022
63838
|
return;
|
|
@@ -64028,7 +63844,7 @@ async function addTypename(config, documents) {
|
|
|
64028
63844
|
);
|
|
64029
63845
|
const field = type.getFields()[node.name.value];
|
|
64030
63846
|
const fieldType = unwrapType(config, field.type).type;
|
|
64031
|
-
if (
|
|
63847
|
+
if (graphql25.isInterfaceType(fieldType) || graphql25.isUnionType(fieldType)) {
|
|
64032
63848
|
return {
|
|
64033
63849
|
...node,
|
|
64034
63850
|
selectionSet: {
|
|
@@ -64036,9 +63852,9 @@ async function addTypename(config, documents) {
|
|
|
64036
63852
|
selections: [
|
|
64037
63853
|
...node.selectionSet.selections,
|
|
64038
63854
|
{
|
|
64039
|
-
kind:
|
|
63855
|
+
kind: graphql25.Kind.FIELD,
|
|
64040
63856
|
name: {
|
|
64041
|
-
kind:
|
|
63857
|
+
kind: graphql25.Kind.NAME,
|
|
64042
63858
|
value: "__typename"
|
|
64043
63859
|
}
|
|
64044
63860
|
}
|
|
@@ -64055,9 +63871,9 @@ async function addTypename(config, documents) {
|
|
|
64055
63871
|
selections: [
|
|
64056
63872
|
...node.selectionSet.selections,
|
|
64057
63873
|
{
|
|
64058
|
-
kind:
|
|
63874
|
+
kind: graphql25.Kind.FIELD,
|
|
64059
63875
|
name: {
|
|
64060
|
-
kind:
|
|
63876
|
+
kind: graphql25.Kind.NAME,
|
|
64061
63877
|
value: "__typename"
|
|
64062
63878
|
}
|
|
64063
63879
|
}
|
|
@@ -64070,10 +63886,10 @@ async function addTypename(config, documents) {
|
|
|
64070
63886
|
}
|
|
64071
63887
|
|
|
64072
63888
|
// src/codegen/transforms/addID.ts
|
|
64073
|
-
import * as
|
|
63889
|
+
import * as graphql26 from "graphql";
|
|
64074
63890
|
async function addID(config, documents) {
|
|
64075
63891
|
for (const doc of documents) {
|
|
64076
|
-
doc.document =
|
|
63892
|
+
doc.document = graphql26.visit(doc.document, {
|
|
64077
63893
|
Field(node, key, parent2, path2, ancestors) {
|
|
64078
63894
|
if (!node.selectionSet) {
|
|
64079
63895
|
return;
|
|
@@ -64111,7 +63927,7 @@ function addKeysToSelection(config, node, fieldType) {
|
|
|
64111
63927
|
if (!node.selectionSet || node.selectionSet.selections.length == 0) {
|
|
64112
63928
|
return;
|
|
64113
63929
|
}
|
|
64114
|
-
if (!
|
|
63930
|
+
if (!graphql26.isObjectType(fieldType) && !graphql26.isInterfaceType(fieldType)) {
|
|
64115
63931
|
return;
|
|
64116
63932
|
}
|
|
64117
63933
|
const keyFields = config.keyFieldsForType(fieldType.name);
|
|
@@ -64126,9 +63942,9 @@ function addKeysToSelection(config, node, fieldType) {
|
|
|
64126
63942
|
continue;
|
|
64127
63943
|
}
|
|
64128
63944
|
selections.push({
|
|
64129
|
-
kind:
|
|
63945
|
+
kind: graphql26.Kind.FIELD,
|
|
64130
63946
|
name: {
|
|
64131
|
-
kind:
|
|
63947
|
+
kind: graphql26.Kind.NAME,
|
|
64132
63948
|
value: keyField
|
|
64133
63949
|
}
|
|
64134
63950
|
});
|
|
@@ -64143,13 +63959,13 @@ function addKeysToSelection(config, node, fieldType) {
|
|
|
64143
63959
|
}
|
|
64144
63960
|
|
|
64145
63961
|
// src/codegen/transforms/componentFields.ts
|
|
64146
|
-
import * as
|
|
63962
|
+
import * as graphql27 from "graphql";
|
|
64147
63963
|
async function componentFields(config, documents) {
|
|
64148
63964
|
for (const document of documents) {
|
|
64149
|
-
const typeInfo = new
|
|
64150
|
-
document.document =
|
|
63965
|
+
const typeInfo = new graphql27.TypeInfo(config.schema);
|
|
63966
|
+
document.document = graphql27.visit(
|
|
64151
63967
|
document.document,
|
|
64152
|
-
|
|
63968
|
+
graphql27.visitWithTypeInfo(typeInfo, {
|
|
64153
63969
|
Field(node) {
|
|
64154
63970
|
const parentType = typeInfo.getParentType();
|
|
64155
63971
|
if (!parentType) {
|
|
@@ -64198,10 +64014,10 @@ async function componentFields(config, documents) {
|
|
|
64198
64014
|
}
|
|
64199
64015
|
|
|
64200
64016
|
// src/codegen/transforms/runtimeScalars.ts
|
|
64201
|
-
import * as
|
|
64017
|
+
import * as graphql28 from "graphql";
|
|
64202
64018
|
async function addTypename2(config, documents) {
|
|
64203
64019
|
for (const doc of documents) {
|
|
64204
|
-
doc.document =
|
|
64020
|
+
doc.document = graphql28.visit(doc.document, {
|
|
64205
64021
|
VariableDefinition(node) {
|
|
64206
64022
|
const { type, wrappers } = unwrapType(config, node.type);
|
|
64207
64023
|
const runtimeScalar = config.configFile.features?.runtimeScalars?.[type.name];
|
|
@@ -64240,7 +64056,7 @@ async function addTypename2(config, documents) {
|
|
|
64240
64056
|
}
|
|
64241
64057
|
|
|
64242
64058
|
// src/codegen/validators/typeCheck.ts
|
|
64243
|
-
import * as
|
|
64059
|
+
import * as graphql29 from "graphql";
|
|
64244
64060
|
async function typeCheck(config, docs) {
|
|
64245
64061
|
const errors = [];
|
|
64246
64062
|
const freeLists = [];
|
|
@@ -64248,7 +64064,7 @@ async function typeCheck(config, docs) {
|
|
|
64248
64064
|
const listTypes = [];
|
|
64249
64065
|
const fragments = {};
|
|
64250
64066
|
for (const { document: parsed, originalString, filename } of docs) {
|
|
64251
|
-
|
|
64067
|
+
graphql29.visit(parsed, {
|
|
64252
64068
|
FragmentDefinition(definition) {
|
|
64253
64069
|
fragments[definition.name.value] = definition;
|
|
64254
64070
|
},
|
|
@@ -64293,14 +64109,14 @@ async function typeCheck(config, docs) {
|
|
|
64293
64109
|
);
|
|
64294
64110
|
return;
|
|
64295
64111
|
}
|
|
64296
|
-
if (
|
|
64112
|
+
if (graphql29.isListType(rootType) || graphql29.isNonNullType(rootType) && graphql29.isListType(rootType.ofType)) {
|
|
64297
64113
|
needsParent = true;
|
|
64298
64114
|
break;
|
|
64299
64115
|
}
|
|
64300
|
-
if (
|
|
64116
|
+
if (graphql29.isNonNullType(rootType) && "ofType" in rootType) {
|
|
64301
64117
|
rootType = rootType.ofType;
|
|
64302
64118
|
}
|
|
64303
|
-
if (
|
|
64119
|
+
if (graphql29.isScalarType(rootType)) {
|
|
64304
64120
|
break;
|
|
64305
64121
|
}
|
|
64306
64122
|
rootType = rootType?.getFields()[parent3.name.value]?.type;
|
|
@@ -64376,9 +64192,9 @@ async function typeCheck(config, docs) {
|
|
|
64376
64192
|
);
|
|
64377
64193
|
}
|
|
64378
64194
|
let targetTypes = [type];
|
|
64379
|
-
if (
|
|
64195
|
+
if (graphql29.isUnionType(type)) {
|
|
64380
64196
|
targetTypes = config.schema.getPossibleTypes(type);
|
|
64381
|
-
} else if (
|
|
64197
|
+
} else if (graphql29.isInterfaceType(type)) {
|
|
64382
64198
|
try {
|
|
64383
64199
|
for (const key of config.keyFieldsForType(type.name)) {
|
|
64384
64200
|
if (!type.getFields()[key]) {
|
|
@@ -64414,13 +64230,13 @@ async function typeCheck(config, docs) {
|
|
|
64414
64230
|
if (errors.length > 0) {
|
|
64415
64231
|
throw errors;
|
|
64416
64232
|
}
|
|
64417
|
-
const rules = (filepath) => [...
|
|
64233
|
+
const rules = (filepath) => [...graphql29.specifiedRules].filter(
|
|
64418
64234
|
(rule) => ![
|
|
64419
|
-
|
|
64420
|
-
|
|
64421
|
-
|
|
64422
|
-
|
|
64423
|
-
|
|
64235
|
+
graphql29.NoUnusedFragmentsRule,
|
|
64236
|
+
graphql29.KnownFragmentNamesRule,
|
|
64237
|
+
graphql29.ExecutableDefinitionsRule,
|
|
64238
|
+
graphql29.KnownDirectivesRule,
|
|
64239
|
+
graphql29.KnownArgumentNamesRule
|
|
64424
64240
|
].includes(rule)
|
|
64425
64241
|
).concat(
|
|
64426
64242
|
validateLists({
|
|
@@ -64441,7 +64257,7 @@ async function typeCheck(config, docs) {
|
|
|
64441
64257
|
validateLoadingDirective(config)
|
|
64442
64258
|
);
|
|
64443
64259
|
for (const { filename, document: parsed, originalString } of docs) {
|
|
64444
|
-
for (const error of
|
|
64260
|
+
for (const error of graphql29.validate(config.schema, parsed, rules(filename))) {
|
|
64445
64261
|
errors.push(
|
|
64446
64262
|
new HoudiniError({
|
|
64447
64263
|
filepath: filename,
|
|
@@ -64470,20 +64286,20 @@ function validateRequiredDirective(config, filepath) {
|
|
|
64470
64286
|
if (!node.directives?.some(({ name }) => name.value === config.requiredDirective))
|
|
64471
64287
|
return;
|
|
64472
64288
|
const parentType = parentTypeFromAncestors(config.schema, filepath, ancestors);
|
|
64473
|
-
if (!
|
|
64289
|
+
if (!graphql29.isObjectType(parentType)) {
|
|
64474
64290
|
ctx.reportError(
|
|
64475
|
-
new
|
|
64291
|
+
new graphql29.GraphQLError(
|
|
64476
64292
|
`@${config.requiredDirective} may only be used on objects, not arguments`
|
|
64477
64293
|
)
|
|
64478
64294
|
);
|
|
64479
64295
|
return;
|
|
64480
64296
|
}
|
|
64481
64297
|
const type = parentType.getFields()[node.name.value].type;
|
|
64482
|
-
const isServerNullable = !
|
|
64298
|
+
const isServerNullable = !graphql29.isNonNullType(type);
|
|
64483
64299
|
const isAlreadyClientNullable = isClientNullable(node, true);
|
|
64484
64300
|
if (!isServerNullable && !isAlreadyClientNullable) {
|
|
64485
64301
|
ctx.reportError(
|
|
64486
|
-
new
|
|
64302
|
+
new graphql29.GraphQLError(
|
|
64487
64303
|
`@${config.requiredDirective} may only be used on nullable fields`
|
|
64488
64304
|
)
|
|
64489
64305
|
);
|
|
@@ -64505,7 +64321,7 @@ var validateLists = ({
|
|
|
64505
64321
|
if (!config.isListFragment(node.name.value)) {
|
|
64506
64322
|
if (!fragments[node.name.value]) {
|
|
64507
64323
|
ctx.reportError(
|
|
64508
|
-
new
|
|
64324
|
+
new graphql29.GraphQLError(
|
|
64509
64325
|
"Encountered unknown fragment: " + node.name.value
|
|
64510
64326
|
)
|
|
64511
64327
|
);
|
|
@@ -64515,7 +64331,7 @@ var validateLists = ({
|
|
|
64515
64331
|
const listName = config.listNameFromFragment(node.name.value);
|
|
64516
64332
|
if (!lists.includes(listName)) {
|
|
64517
64333
|
ctx.reportError(
|
|
64518
|
-
new
|
|
64334
|
+
new graphql29.GraphQLError(
|
|
64519
64335
|
"Encountered fragment referencing unknown list: " + listName
|
|
64520
64336
|
)
|
|
64521
64337
|
);
|
|
@@ -64540,7 +64356,7 @@ var validateLists = ({
|
|
|
64540
64356
|
);
|
|
64541
64357
|
if (parentArg) {
|
|
64542
64358
|
ctx.reportError(
|
|
64543
|
-
new
|
|
64359
|
+
new graphql29.GraphQLError(
|
|
64544
64360
|
`@${config.deprecatedlistDirectiveParentIDArg} should be defined only in it's own directive now`
|
|
64545
64361
|
)
|
|
64546
64362
|
);
|
|
@@ -64556,7 +64372,7 @@ var validateLists = ({
|
|
|
64556
64372
|
return;
|
|
64557
64373
|
}
|
|
64558
64374
|
ctx.reportError(
|
|
64559
|
-
new
|
|
64375
|
+
new graphql29.GraphQLError(
|
|
64560
64376
|
`For this list fragment, you need to add or @${config.listParentDirective} or @${config.listAllListsDirective} directive to specify the behavior`
|
|
64561
64377
|
)
|
|
64562
64378
|
);
|
|
@@ -64566,7 +64382,7 @@ var validateLists = ({
|
|
|
64566
64382
|
const directiveName = node.name.value;
|
|
64567
64383
|
if (directiveName === "connection") {
|
|
64568
64384
|
ctx.reportError(
|
|
64569
|
-
new
|
|
64385
|
+
new graphql29.GraphQLError(
|
|
64570
64386
|
"@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."
|
|
64571
64387
|
)
|
|
64572
64388
|
);
|
|
@@ -64575,7 +64391,7 @@ var validateLists = ({
|
|
|
64575
64391
|
if (!config.isInternalDirective(node.name.value)) {
|
|
64576
64392
|
if (!config.schema.getDirective(directiveName)) {
|
|
64577
64393
|
ctx.reportError(
|
|
64578
|
-
new
|
|
64394
|
+
new graphql29.GraphQLError(
|
|
64579
64395
|
"Encountered unknown directive: " + directiveName
|
|
64580
64396
|
)
|
|
64581
64397
|
);
|
|
@@ -64584,7 +64400,7 @@ var validateLists = ({
|
|
|
64584
64400
|
}
|
|
64585
64401
|
if (config.isListOperationDirective(directiveName) && !listTypes.includes(config.listNameFromDirective(directiveName))) {
|
|
64586
64402
|
ctx.reportError(
|
|
64587
|
-
new
|
|
64403
|
+
new graphql29.GraphQLError(
|
|
64588
64404
|
"Encountered directive referencing unknown list: " + directiveName
|
|
64589
64405
|
)
|
|
64590
64406
|
);
|
|
@@ -64595,7 +64411,7 @@ var validateLists = ({
|
|
|
64595
64411
|
};
|
|
64596
64412
|
function knownArguments(config) {
|
|
64597
64413
|
return function(ctx) {
|
|
64598
|
-
const nativeValidator =
|
|
64414
|
+
const nativeValidator = graphql29.KnownArgumentNamesRule(ctx);
|
|
64599
64415
|
return {
|
|
64600
64416
|
...nativeValidator,
|
|
64601
64417
|
Directive(directiveNode) {
|
|
@@ -64630,7 +64446,7 @@ function validateFragmentArguments(config, filepath, fragments) {
|
|
|
64630
64446
|
for (const arg of node.arguments || []) {
|
|
64631
64447
|
if (arg.value.kind !== "ObjectValue") {
|
|
64632
64448
|
ctx.reportError(
|
|
64633
|
-
new
|
|
64449
|
+
new graphql29.GraphQLError("values in @arguments must be an object")
|
|
64634
64450
|
);
|
|
64635
64451
|
return;
|
|
64636
64452
|
}
|
|
@@ -64640,13 +64456,13 @@ function validateFragmentArguments(config, filepath, fragments) {
|
|
|
64640
64456
|
);
|
|
64641
64457
|
if (!typeArg) {
|
|
64642
64458
|
ctx.reportError(
|
|
64643
|
-
new
|
|
64459
|
+
new graphql29.GraphQLError("missing type field for @arguments directive")
|
|
64644
64460
|
);
|
|
64645
64461
|
return;
|
|
64646
64462
|
}
|
|
64647
|
-
if (typeArg.value.kind !==
|
|
64463
|
+
if (typeArg.value.kind !== graphql29.Kind.STRING) {
|
|
64648
64464
|
ctx.reportError(
|
|
64649
|
-
new
|
|
64465
|
+
new graphql29.GraphQLError("type field to @arguments must be a string")
|
|
64650
64466
|
);
|
|
64651
64467
|
return;
|
|
64652
64468
|
}
|
|
@@ -64659,7 +64475,7 @@ function validateFragmentArguments(config, filepath, fragments) {
|
|
|
64659
64475
|
);
|
|
64660
64476
|
if (typeArg.value.value !== defaultValueType) {
|
|
64661
64477
|
ctx.reportError(
|
|
64662
|
-
new
|
|
64478
|
+
new graphql29.GraphQLError(
|
|
64663
64479
|
`Invalid default value provided for ${arg.name.value}. Expected ${typeArg.value.value}, found ${defaultValueType}`
|
|
64664
64480
|
)
|
|
64665
64481
|
);
|
|
@@ -64677,7 +64493,7 @@ function validateFragmentArguments(config, filepath, fragments) {
|
|
|
64677
64493
|
try {
|
|
64678
64494
|
args = fragmentArguments(config, filepath, fragments[fragmentName]);
|
|
64679
64495
|
} catch (e) {
|
|
64680
|
-
ctx.reportError(new
|
|
64496
|
+
ctx.reportError(new graphql29.GraphQLError(e.message));
|
|
64681
64497
|
return;
|
|
64682
64498
|
}
|
|
64683
64499
|
fragmentArguments2[fragmentName] = args;
|
|
@@ -64700,7 +64516,7 @@ function validateFragmentArguments(config, filepath, fragments) {
|
|
|
64700
64516
|
);
|
|
64701
64517
|
if (missing.length > 0) {
|
|
64702
64518
|
ctx.reportError(
|
|
64703
|
-
new
|
|
64519
|
+
new graphql29.GraphQLError(
|
|
64704
64520
|
`The following arguments are missing from the "${fragmentName}" fragment: ` + JSON.stringify(missing)
|
|
64705
64521
|
)
|
|
64706
64522
|
);
|
|
@@ -64711,7 +64527,7 @@ function validateFragmentArguments(config, filepath, fragments) {
|
|
|
64711
64527
|
);
|
|
64712
64528
|
if (unknown.length > 0) {
|
|
64713
64529
|
ctx.reportError(
|
|
64714
|
-
new
|
|
64530
|
+
new graphql29.GraphQLError(
|
|
64715
64531
|
"Encountered unknown arguments: " + JSON.stringify(unknown)
|
|
64716
64532
|
)
|
|
64717
64533
|
);
|
|
@@ -64723,7 +64539,7 @@ function validateFragmentArguments(config, filepath, fragments) {
|
|
|
64723
64539
|
for (const [applied, target] of zipped) {
|
|
64724
64540
|
if (!valueIsType(config, applied.value, target)) {
|
|
64725
64541
|
ctx.reportError(
|
|
64726
|
-
new
|
|
64542
|
+
new graphql29.GraphQLError(
|
|
64727
64543
|
`Invalid argument type. Expected ${target}, found ${applied.value.kind}`
|
|
64728
64544
|
)
|
|
64729
64545
|
);
|
|
@@ -64765,7 +64581,7 @@ function valueIsType(config, value, targetType) {
|
|
|
64765
64581
|
}
|
|
64766
64582
|
if (value.kind === "EnumValue" && targetType.kind === "NamedType") {
|
|
64767
64583
|
const enumType = config.schema.getType(targetType.name.value);
|
|
64768
|
-
if (!
|
|
64584
|
+
if (!graphql29.isEnumType(enumType)) {
|
|
64769
64585
|
return false;
|
|
64770
64586
|
}
|
|
64771
64587
|
return enumType.getValues().some((enumValue) => enumValue.value === value.value);
|
|
@@ -64785,7 +64601,7 @@ function paginateArgs(config, filepath) {
|
|
|
64785
64601
|
}
|
|
64786
64602
|
if (alreadyPaginated) {
|
|
64787
64603
|
ctx.reportError(
|
|
64788
|
-
new
|
|
64604
|
+
new graphql29.GraphQLError(
|
|
64789
64605
|
`@${config.paginateDirective} can only appear in a document once.`
|
|
64790
64606
|
)
|
|
64791
64607
|
);
|
|
@@ -64817,7 +64633,7 @@ function paginateArgs(config, filepath) {
|
|
|
64817
64633
|
const backwards = appliedArgs.has("last");
|
|
64818
64634
|
if (!forward && !backwards) {
|
|
64819
64635
|
ctx.reportError(
|
|
64820
|
-
new
|
|
64636
|
+
new graphql29.GraphQLError(
|
|
64821
64637
|
"A field with cursor-based pagination must have a first or last argument"
|
|
64822
64638
|
)
|
|
64823
64639
|
);
|
|
@@ -64831,7 +64647,7 @@ function paginateArgs(config, filepath) {
|
|
|
64831
64647
|
}
|
|
64832
64648
|
if (forward && backwards && paginateMode === "Infinite") {
|
|
64833
64649
|
ctx.reportError(
|
|
64834
|
-
new
|
|
64650
|
+
new graphql29.GraphQLError(
|
|
64835
64651
|
`A field with cursor pagination cannot go forwards an backwards simultaneously`
|
|
64836
64652
|
)
|
|
64837
64653
|
);
|
|
@@ -64845,7 +64661,7 @@ function paginateArgs(config, filepath) {
|
|
|
64845
64661
|
);
|
|
64846
64662
|
if (!appliedLimitArg) {
|
|
64847
64663
|
ctx.reportError(
|
|
64848
|
-
new
|
|
64664
|
+
new graphql29.GraphQLError(
|
|
64849
64665
|
"A field with offset-based pagination must have a limit argument"
|
|
64850
64666
|
)
|
|
64851
64667
|
);
|
|
@@ -64861,20 +64677,20 @@ function noUnusedFragmentArguments(config) {
|
|
|
64861
64677
|
const args = /* @__PURE__ */ new Set();
|
|
64862
64678
|
return {
|
|
64863
64679
|
enter(node) {
|
|
64864
|
-
if (node.kind ===
|
|
64680
|
+
if (node.kind === graphql29.Kind.FRAGMENT_DEFINITION) {
|
|
64865
64681
|
const definitionArguments = node.directives?.filter((directive) => directive.name.value === config.argumentsDirective).flatMap((directive) => directive.arguments);
|
|
64866
64682
|
for (const arg of definitionArguments?.map((arg2) => arg2?.name.value) || []) {
|
|
64867
64683
|
args.add(arg);
|
|
64868
64684
|
}
|
|
64869
|
-
} else if (node.kind ===
|
|
64685
|
+
} else if (node.kind === graphql29.Kind.VARIABLE) {
|
|
64870
64686
|
args.delete(node.name.value);
|
|
64871
64687
|
}
|
|
64872
64688
|
},
|
|
64873
64689
|
leave(node) {
|
|
64874
|
-
if (node.kind ===
|
|
64690
|
+
if (node.kind === graphql29.Kind.FRAGMENT_DEFINITION) {
|
|
64875
64691
|
if (args.size > 0) {
|
|
64876
64692
|
ctx.reportError(
|
|
64877
|
-
new
|
|
64693
|
+
new graphql29.GraphQLError(
|
|
64878
64694
|
"Encountered unused fragment arguments: " + [...args].join(",")
|
|
64879
64695
|
)
|
|
64880
64696
|
);
|
|
@@ -64910,7 +64726,7 @@ function nodeDirectives(config, directives) {
|
|
|
64910
64726
|
if (definition.kind === "OperationDefinition") {
|
|
64911
64727
|
if (definition.operation !== "query") {
|
|
64912
64728
|
ctx.reportError(
|
|
64913
|
-
new
|
|
64729
|
+
new graphql29.GraphQLError(
|
|
64914
64730
|
`@${node.name.value} must fall on a fragment or query document`
|
|
64915
64731
|
)
|
|
64916
64732
|
);
|
|
@@ -64922,7 +64738,7 @@ function nodeDirectives(config, directives) {
|
|
|
64922
64738
|
}
|
|
64923
64739
|
if (!possibleNodes.includes(definitionType)) {
|
|
64924
64740
|
ctx.reportError(
|
|
64925
|
-
new
|
|
64741
|
+
new graphql29.GraphQLError(paginateOnNonNodeMessage(node.name.value))
|
|
64926
64742
|
);
|
|
64927
64743
|
}
|
|
64928
64744
|
}
|
|
@@ -64941,7 +64757,7 @@ function checkMutationOperation(config) {
|
|
|
64941
64757
|
);
|
|
64942
64758
|
if (append && prepend) {
|
|
64943
64759
|
ctx.reportError(
|
|
64944
|
-
new
|
|
64760
|
+
new graphql29.GraphQLError(
|
|
64945
64761
|
`You can't apply both @${config.listPrependDirective} and @${config.listAppendDirective} at the same time`
|
|
64946
64762
|
)
|
|
64947
64763
|
);
|
|
@@ -64955,7 +64771,7 @@ function checkMutationOperation(config) {
|
|
|
64955
64771
|
);
|
|
64956
64772
|
if (parentId && allLists) {
|
|
64957
64773
|
ctx.reportError(
|
|
64958
|
-
new
|
|
64774
|
+
new graphql29.GraphQLError(
|
|
64959
64775
|
`You can't apply both @${config.listParentDirective} and @${config.listAllListsDirective} at the same time`
|
|
64960
64776
|
)
|
|
64961
64777
|
);
|
|
@@ -64977,7 +64793,7 @@ function checkMaskDirectives(config) {
|
|
|
64977
64793
|
);
|
|
64978
64794
|
if (maskEnableDirective && maskDisableDirective) {
|
|
64979
64795
|
ctx.reportError(
|
|
64980
|
-
new
|
|
64796
|
+
new graphql29.GraphQLError(
|
|
64981
64797
|
`You can't apply both @${config.maskEnableDirective} and @${config.maskDisableDirective} at the same time`
|
|
64982
64798
|
)
|
|
64983
64799
|
);
|
|
@@ -65019,7 +64835,7 @@ function validateLoadingDirective(config) {
|
|
|
65019
64835
|
);
|
|
65020
64836
|
if (!parentLoading && !global2) {
|
|
65021
64837
|
ctx.reportError(
|
|
65022
|
-
new
|
|
64838
|
+
new graphql29.GraphQLError(
|
|
65023
64839
|
`@${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}`
|
|
65024
64840
|
)
|
|
65025
64841
|
);
|
|
@@ -65041,7 +64857,7 @@ function validateLoadingDirective(config) {
|
|
|
65041
64857
|
);
|
|
65042
64858
|
if (!parentLoading && !global2) {
|
|
65043
64859
|
ctx.reportError(
|
|
65044
|
-
new
|
|
64860
|
+
new graphql29.GraphQLError(
|
|
65045
64861
|
`@${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}`
|
|
65046
64862
|
)
|
|
65047
64863
|
);
|
|
@@ -65056,7 +64872,7 @@ function getAndVerifyNodeInterface(config) {
|
|
|
65056
64872
|
if (!nodeInterface) {
|
|
65057
64873
|
return null;
|
|
65058
64874
|
}
|
|
65059
|
-
if (!
|
|
64875
|
+
if (!graphql29.isInterfaceType(nodeInterface)) {
|
|
65060
64876
|
displayInvalidNodeFieldMessage(config);
|
|
65061
64877
|
return null;
|
|
65062
64878
|
}
|
|
@@ -65151,11 +64967,11 @@ async function uniqueDocumentNames(config, docs) {
|
|
|
65151
64967
|
}
|
|
65152
64968
|
|
|
65153
64969
|
// src/codegen/validators/noIDAlias.ts
|
|
65154
|
-
import * as
|
|
64970
|
+
import * as graphql30 from "graphql";
|
|
65155
64971
|
async function noIDAlias(config, docs) {
|
|
65156
64972
|
const errors = [];
|
|
65157
64973
|
for (const { filename, document } of docs) {
|
|
65158
|
-
|
|
64974
|
+
graphql30.visit(document, {
|
|
65159
64975
|
Field(node, _, __, ___, ancestors) {
|
|
65160
64976
|
const fieldType = parentTypeFromAncestors(config.schema, filename, ancestors).name;
|
|
65161
64977
|
if (config.keyFieldsForType(fieldType).includes(node.alias?.value || "")) {
|
|
@@ -65194,11 +65010,11 @@ async function validatePlugins(config, documents) {
|
|
|
65194
65010
|
}
|
|
65195
65011
|
|
|
65196
65012
|
// src/codegen/validators/componentFields.ts
|
|
65197
|
-
import * as
|
|
65013
|
+
import * as graphql31 from "graphql";
|
|
65198
65014
|
async function componentFields2(config, docs) {
|
|
65199
65015
|
const errors = [];
|
|
65200
65016
|
for (const { filename: filepath, document } of docs) {
|
|
65201
|
-
|
|
65017
|
+
graphql31.visit(document, {
|
|
65202
65018
|
FragmentDefinition(node, _, __, ___, ancestors) {
|
|
65203
65019
|
const componentFieldDirective = node.directives?.find(
|
|
65204
65020
|
(dir) => dir.name.value === config.componentFieldDirective
|
|
@@ -65246,7 +65062,7 @@ async function componentFields2(config, docs) {
|
|
|
65246
65062
|
if (existingField && existingField.filepath !== filepath) {
|
|
65247
65063
|
conflict = true;
|
|
65248
65064
|
} else if (parentType && fieldValue) {
|
|
65249
|
-
const fieldDef =
|
|
65065
|
+
const fieldDef = graphql31.isObjectType(parentType) && parentType.getFields()[fieldValue];
|
|
65250
65066
|
if (fieldDef && !fieldDef.astNode?.directives?.find(
|
|
65251
65067
|
(dir) => dir.name.value === config.componentFieldDirective
|
|
65252
65068
|
)) {
|
|
@@ -65259,7 +65075,7 @@ async function componentFields2(config, docs) {
|
|
|
65259
65075
|
filepath
|
|
65260
65076
|
});
|
|
65261
65077
|
}
|
|
65262
|
-
if (parentType &&
|
|
65078
|
+
if (parentType && graphql31.isAbstractType(parentType)) {
|
|
65263
65079
|
errors.push({
|
|
65264
65080
|
message: `Cannot add component field ${parent2}.${fieldValue} because ${parent2} is an abstract type`,
|
|
65265
65081
|
filepath
|
|
@@ -65480,12 +65296,12 @@ async function processJSFile(config, contents) {
|
|
|
65480
65296
|
return documents;
|
|
65481
65297
|
}
|
|
65482
65298
|
async function processGraphQLDocument(config, filepath, document) {
|
|
65483
|
-
const parsedDoc =
|
|
65299
|
+
const parsedDoc = graphql32.parse(document);
|
|
65484
65300
|
const operations = parsedDoc.definitions.filter(
|
|
65485
|
-
({ kind: kind2 }) => kind2 ===
|
|
65301
|
+
({ kind: kind2 }) => kind2 === graphql32.Kind.OPERATION_DEFINITION
|
|
65486
65302
|
);
|
|
65487
65303
|
const fragments = parsedDoc.definitions.filter(
|
|
65488
|
-
({ kind: kind2 }) => kind2 ===
|
|
65304
|
+
({ kind: kind2 }) => kind2 === graphql32.Kind.FRAGMENT_DEFINITION
|
|
65489
65305
|
);
|
|
65490
65306
|
if (operations.length > 1) {
|
|
65491
65307
|
throw new HoudiniError({
|