houdini 1.2.43 → 1.2.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cmd-cjs/index.js +684 -786
- package/build/cmd-esm/index.js +534 -636
- package/build/codegen/generators/artifacts/inputs.d.ts +1 -1
- package/build/codegen/generators/comments/jsdoc.d.ts +2 -0
- package/build/codegen/transforms/index.d.ts +1 -0
- package/build/codegen/transforms/runtimeScalars.d.ts +2 -0
- package/build/codegen-cjs/index.js +677 -782
- package/build/codegen-esm/index.js +527 -632
- package/build/lib/config.d.ts +1 -0
- 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 +711 -477
- package/build/lib-esm/index.js +705 -477
- 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/config.d.ts +12 -2
- package/build/runtime/lib/scalars.d.ts +1 -1
- package/build/runtime/lib/types.d.ts +17 -2
- package/build/runtime/router/session.d.ts +1 -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 +18 -11
- package/build/runtime-cjs/lib/config.d.ts +12 -2
- 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 +17 -2
- package/build/runtime-cjs/router/server.js +2 -3
- package/build/runtime-cjs/router/session.d.ts +1 -2
- package/build/runtime-cjs/router/session.js +25 -11
- 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 +15 -2
- package/build/runtime-esm/lib/config.d.ts +12 -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 +17 -2
- package/build/runtime-esm/router/server.js +2 -3
- package/build/runtime-esm/router/session.d.ts +1 -2
- package/build/runtime-esm/router/session.js +25 -11
- package/build/runtime-esm/router/types.d.ts +3 -1
- package/build/test-cjs/index.js +706 -785
- package/build/test-esm/index.js +556 -635
- package/build/vite-cjs/index.js +793 -793
- package/build/vite-esm/index.js +643 -643
- package/package.json +1 -1
- package/build/codegen/generators/typescript/typeReference.d.ts +0 -8
- package/build/codegen/generators/typescript/types.d.ts +0 -10
package/build/test-cjs/index.js
CHANGED
|
@@ -24845,7 +24845,7 @@ var require_path_visitor = __commonJS({
|
|
|
24845
24845
|
}
|
|
24846
24846
|
return target;
|
|
24847
24847
|
}
|
|
24848
|
-
PathVisitor.visit = function
|
|
24848
|
+
PathVisitor.visit = function visit19(node, methods) {
|
|
24849
24849
|
return PathVisitor.fromMethodsObject(methods).visit(node);
|
|
24850
24850
|
};
|
|
24851
24851
|
var PVp = PathVisitor.prototype;
|
|
@@ -25036,7 +25036,7 @@ var require_path_visitor = __commonJS({
|
|
|
25036
25036
|
this.needToCallTraverse = false;
|
|
25037
25037
|
return visitChildren(path2, PathVisitor.fromMethodsObject(newVisitor || this.visitor));
|
|
25038
25038
|
};
|
|
25039
|
-
sharedContextProtoMethods.visit = function
|
|
25039
|
+
sharedContextProtoMethods.visit = function visit19(path2, newVisitor) {
|
|
25040
25040
|
if (!(this instanceof this.Context)) {
|
|
25041
25041
|
throw new Error("");
|
|
25042
25042
|
}
|
|
@@ -26429,7 +26429,7 @@ var require_main = __commonJS({
|
|
|
26429
26429
|
var someField = _a.someField;
|
|
26430
26430
|
var Type = _a.Type;
|
|
26431
26431
|
var use = _a.use;
|
|
26432
|
-
var
|
|
26432
|
+
var visit19 = _a.visit;
|
|
26433
26433
|
exports.astNodesAreEquivalent = astNodesAreEquivalent;
|
|
26434
26434
|
exports.builders = builders;
|
|
26435
26435
|
exports.builtInTypes = builtInTypes;
|
|
@@ -26446,7 +26446,7 @@ var require_main = __commonJS({
|
|
|
26446
26446
|
exports.someField = someField;
|
|
26447
26447
|
exports.Type = Type;
|
|
26448
26448
|
exports.use = use;
|
|
26449
|
-
exports.visit =
|
|
26449
|
+
exports.visit = visit19;
|
|
26450
26450
|
Object.assign(namedTypes_1.namedTypes, n);
|
|
26451
26451
|
}
|
|
26452
26452
|
});
|
|
@@ -53975,47 +53975,6 @@ function deepMerge(...objects) {
|
|
|
53975
53975
|
return mergedObj;
|
|
53976
53976
|
}
|
|
53977
53977
|
|
|
53978
|
-
// src/runtime/lib/scalars.ts
|
|
53979
|
-
async function marshalSelection({
|
|
53980
|
-
selection,
|
|
53981
|
-
data
|
|
53982
|
-
}) {
|
|
53983
|
-
const config = getCurrentConfig();
|
|
53984
|
-
if (data === null || typeof data === "undefined") {
|
|
53985
|
-
return data;
|
|
53986
|
-
}
|
|
53987
|
-
if (Array.isArray(data)) {
|
|
53988
|
-
return await Promise.all(data.map((val) => marshalSelection({ selection, data: val })));
|
|
53989
|
-
}
|
|
53990
|
-
const targetSelection = getFieldsForType(selection, data["__typename"], false);
|
|
53991
|
-
return Object.fromEntries(
|
|
53992
|
-
await Promise.all(
|
|
53993
|
-
Object.entries(data).map(async ([fieldName, value]) => {
|
|
53994
|
-
const { type, selection: selection2 } = targetSelection[fieldName];
|
|
53995
|
-
if (!type) {
|
|
53996
|
-
return [fieldName, value];
|
|
53997
|
-
}
|
|
53998
|
-
if (selection2) {
|
|
53999
|
-
return [fieldName, await marshalSelection({ selection: selection2, data: value })];
|
|
54000
|
-
}
|
|
54001
|
-
if (config.scalars?.[type]) {
|
|
54002
|
-
const marshalFn = config.scalars[type].marshal;
|
|
54003
|
-
if (!marshalFn) {
|
|
54004
|
-
throw new Error(
|
|
54005
|
-
`scalar type ${type} is missing a \`marshal\` function. see https://github.com/AlecAivazis/houdini#%EF%B8%8Fcustom-scalars`
|
|
54006
|
-
);
|
|
54007
|
-
}
|
|
54008
|
-
if (Array.isArray(value)) {
|
|
54009
|
-
return [fieldName, value.map(marshalFn)];
|
|
54010
|
-
}
|
|
54011
|
-
return [fieldName, marshalFn(value)];
|
|
54012
|
-
}
|
|
54013
|
-
return [fieldName, value];
|
|
54014
|
-
})
|
|
54015
|
-
)
|
|
54016
|
-
);
|
|
54017
|
-
}
|
|
54018
|
-
|
|
54019
53978
|
// src/runtime/lib/types.ts
|
|
54020
53979
|
var CachePolicy = {
|
|
54021
53980
|
CacheOrNetwork: "CacheOrNetwork",
|
|
@@ -54043,11 +54002,6 @@ var RefetchUpdateMode = {
|
|
|
54043
54002
|
prepend: "prepend",
|
|
54044
54003
|
replace: "replace"
|
|
54045
54004
|
};
|
|
54046
|
-
var DataSource = {
|
|
54047
|
-
Cache: "cache",
|
|
54048
|
-
Network: "network",
|
|
54049
|
-
Ssr: "ssr"
|
|
54050
|
-
};
|
|
54051
54005
|
var fragmentKey = " $fragments";
|
|
54052
54006
|
var PendingValue = Symbol("houdini_loading");
|
|
54053
54007
|
|
|
@@ -56669,188 +56623,6 @@ var cache_default = new Cache();
|
|
|
56669
56623
|
// src/runtime/client/plugins/cache.ts
|
|
56670
56624
|
var serverSide = typeof globalThis.window === "undefined";
|
|
56671
56625
|
|
|
56672
|
-
// src/runtime/client/utils/documentPlugins.ts
|
|
56673
|
-
var documentPlugin = (kind, source) => {
|
|
56674
|
-
return () => {
|
|
56675
|
-
const sourceHandlers = source();
|
|
56676
|
-
const enterWrapper = (handler) => {
|
|
56677
|
-
return !handler ? void 0 : (ctx, handlers) => {
|
|
56678
|
-
if (ctx.artifact.kind !== kind) {
|
|
56679
|
-
return handlers.next(ctx);
|
|
56680
|
-
}
|
|
56681
|
-
return handler(ctx, handlers);
|
|
56682
|
-
};
|
|
56683
|
-
};
|
|
56684
|
-
const exitWrapper = (handler) => {
|
|
56685
|
-
return !handler ? void 0 : (ctx, handlers) => {
|
|
56686
|
-
if (ctx.artifact.kind !== kind) {
|
|
56687
|
-
return handlers.resolve(ctx);
|
|
56688
|
-
}
|
|
56689
|
-
return handler(ctx, handlers);
|
|
56690
|
-
};
|
|
56691
|
-
};
|
|
56692
|
-
return {
|
|
56693
|
-
start: enterWrapper(sourceHandlers.start),
|
|
56694
|
-
network: enterWrapper(sourceHandlers.network),
|
|
56695
|
-
afterNetwork: exitWrapper(sourceHandlers.afterNetwork),
|
|
56696
|
-
end: exitWrapper(sourceHandlers.end),
|
|
56697
|
-
catch: sourceHandlers.catch ? (ctx, handlers) => sourceHandlers.catch(ctx, handlers) : void 0,
|
|
56698
|
-
cleanup: (...args) => sourceHandlers.cleanup?.(...args)
|
|
56699
|
-
};
|
|
56700
|
-
};
|
|
56701
|
-
};
|
|
56702
|
-
|
|
56703
|
-
// src/runtime/client/plugins/query.ts
|
|
56704
|
-
var query = documentPlugin(ArtifactKind.Query, function() {
|
|
56705
|
-
let subscriptionSpec = null;
|
|
56706
|
-
let lastVariables = null;
|
|
56707
|
-
return {
|
|
56708
|
-
start(ctx, { next }) {
|
|
56709
|
-
ctx.variables = {
|
|
56710
|
-
...lastVariables,
|
|
56711
|
-
...ctx.variables
|
|
56712
|
-
};
|
|
56713
|
-
next(ctx);
|
|
56714
|
-
},
|
|
56715
|
-
end(ctx, { resolve: resolve2, marshalVariables, variablesChanged }) {
|
|
56716
|
-
if (variablesChanged(ctx) && !ctx.cacheParams?.disableSubscriptions) {
|
|
56717
|
-
if (subscriptionSpec) {
|
|
56718
|
-
cache_default.unsubscribe(subscriptionSpec, subscriptionSpec.variables?.() || {});
|
|
56719
|
-
}
|
|
56720
|
-
lastVariables = { ...marshalVariables(ctx) };
|
|
56721
|
-
const variables = lastVariables;
|
|
56722
|
-
subscriptionSpec = {
|
|
56723
|
-
rootType: ctx.artifact.rootType,
|
|
56724
|
-
selection: ctx.artifact.selection,
|
|
56725
|
-
variables: () => variables,
|
|
56726
|
-
set: (newValue) => {
|
|
56727
|
-
resolve2(ctx, {
|
|
56728
|
-
data: newValue,
|
|
56729
|
-
errors: null,
|
|
56730
|
-
fetching: false,
|
|
56731
|
-
partial: false,
|
|
56732
|
-
stale: false,
|
|
56733
|
-
source: DataSource.Cache,
|
|
56734
|
-
variables: ctx.variables ?? {}
|
|
56735
|
-
});
|
|
56736
|
-
}
|
|
56737
|
-
};
|
|
56738
|
-
cache_default.subscribe(subscriptionSpec, lastVariables);
|
|
56739
|
-
}
|
|
56740
|
-
resolve2(ctx);
|
|
56741
|
-
},
|
|
56742
|
-
cleanup() {
|
|
56743
|
-
if (subscriptionSpec) {
|
|
56744
|
-
cache_default.unsubscribe(subscriptionSpec, subscriptionSpec.variables?.());
|
|
56745
|
-
lastVariables = null;
|
|
56746
|
-
}
|
|
56747
|
-
}
|
|
56748
|
-
};
|
|
56749
|
-
});
|
|
56750
|
-
|
|
56751
|
-
// src/runtime/client/plugins/fragment.ts
|
|
56752
|
-
var fragment = documentPlugin(ArtifactKind.Fragment, function() {
|
|
56753
|
-
let subscriptionSpec = null;
|
|
56754
|
-
let lastReference = null;
|
|
56755
|
-
return {
|
|
56756
|
-
start(ctx, { next, resolve: resolve2, variablesChanged, marshalVariables }) {
|
|
56757
|
-
if (!ctx.stuff.parentID) {
|
|
56758
|
-
return next(ctx);
|
|
56759
|
-
}
|
|
56760
|
-
const currentReference = {
|
|
56761
|
-
parent: ctx.stuff.parentID,
|
|
56762
|
-
variables: marshalVariables(ctx)
|
|
56763
|
-
};
|
|
56764
|
-
if (!ctx.cacheParams?.disableSubscriptions && (!deepEquals(lastReference, currentReference) || variablesChanged(ctx))) {
|
|
56765
|
-
if (subscriptionSpec) {
|
|
56766
|
-
cache_default.unsubscribe(subscriptionSpec, subscriptionSpec.variables?.() || {});
|
|
56767
|
-
}
|
|
56768
|
-
const variables = marshalVariables(ctx);
|
|
56769
|
-
subscriptionSpec = {
|
|
56770
|
-
rootType: ctx.artifact.rootType,
|
|
56771
|
-
selection: ctx.artifact.selection,
|
|
56772
|
-
variables: () => variables,
|
|
56773
|
-
parentID: ctx.stuff.parentID,
|
|
56774
|
-
set: (newValue) => {
|
|
56775
|
-
resolve2(ctx, {
|
|
56776
|
-
data: newValue,
|
|
56777
|
-
errors: null,
|
|
56778
|
-
fetching: false,
|
|
56779
|
-
partial: false,
|
|
56780
|
-
stale: false,
|
|
56781
|
-
source: DataSource.Cache,
|
|
56782
|
-
variables
|
|
56783
|
-
});
|
|
56784
|
-
}
|
|
56785
|
-
};
|
|
56786
|
-
cache_default.subscribe(subscriptionSpec, variables);
|
|
56787
|
-
lastReference = currentReference;
|
|
56788
|
-
}
|
|
56789
|
-
next(ctx);
|
|
56790
|
-
},
|
|
56791
|
-
cleanup() {
|
|
56792
|
-
if (subscriptionSpec) {
|
|
56793
|
-
cache_default.unsubscribe(subscriptionSpec, subscriptionSpec.variables?.());
|
|
56794
|
-
}
|
|
56795
|
-
}
|
|
56796
|
-
};
|
|
56797
|
-
});
|
|
56798
|
-
|
|
56799
|
-
// src/runtime/client/plugins/mutation.ts
|
|
56800
|
-
var mutation = documentPlugin(ArtifactKind.Mutation, () => {
|
|
56801
|
-
return {
|
|
56802
|
-
async start(ctx, { next, marshalVariables }) {
|
|
56803
|
-
const layerOptimistic = cache_default._internal_unstable.storage.createLayer(true);
|
|
56804
|
-
const optimisticResponse = ctx.stuff.optimisticResponse;
|
|
56805
|
-
let toNotify = [];
|
|
56806
|
-
if (optimisticResponse) {
|
|
56807
|
-
toNotify = cache_default.write({
|
|
56808
|
-
selection: ctx.artifact.selection,
|
|
56809
|
-
data: await marshalSelection({
|
|
56810
|
-
selection: ctx.artifact.selection,
|
|
56811
|
-
data: optimisticResponse
|
|
56812
|
-
}),
|
|
56813
|
-
variables: marshalVariables(ctx),
|
|
56814
|
-
layer: layerOptimistic.id
|
|
56815
|
-
});
|
|
56816
|
-
}
|
|
56817
|
-
ctx.cacheParams = {
|
|
56818
|
-
...ctx.cacheParams,
|
|
56819
|
-
layer: layerOptimistic,
|
|
56820
|
-
notifySubscribers: toNotify,
|
|
56821
|
-
forceNotify: true
|
|
56822
|
-
};
|
|
56823
|
-
next(ctx);
|
|
56824
|
-
},
|
|
56825
|
-
afterNetwork(ctx, { resolve: resolve2 }) {
|
|
56826
|
-
if (ctx.cacheParams?.layer) {
|
|
56827
|
-
cache_default.clearLayer(ctx.cacheParams.layer.id);
|
|
56828
|
-
}
|
|
56829
|
-
resolve2(ctx);
|
|
56830
|
-
},
|
|
56831
|
-
end(ctx, { resolve: resolve2, value }) {
|
|
56832
|
-
const hasErrors = value.errors && value.errors.length > 0;
|
|
56833
|
-
if (hasErrors) {
|
|
56834
|
-
if (ctx.cacheParams?.layer) {
|
|
56835
|
-
cache_default.clearLayer(ctx.cacheParams.layer.id);
|
|
56836
|
-
}
|
|
56837
|
-
}
|
|
56838
|
-
if (ctx.cacheParams?.layer) {
|
|
56839
|
-
cache_default._internal_unstable.storage.resolveLayer(ctx.cacheParams.layer.id);
|
|
56840
|
-
}
|
|
56841
|
-
resolve2(ctx);
|
|
56842
|
-
},
|
|
56843
|
-
catch(ctx, { error }) {
|
|
56844
|
-
if (ctx.cacheParams?.layer) {
|
|
56845
|
-
const { layer } = ctx.cacheParams;
|
|
56846
|
-
cache_default.clearLayer(layer.id);
|
|
56847
|
-
cache_default._internal_unstable.storage.resolveLayer(layer.id);
|
|
56848
|
-
}
|
|
56849
|
-
throw error;
|
|
56850
|
-
}
|
|
56851
|
-
};
|
|
56852
|
-
});
|
|
56853
|
-
|
|
56854
56626
|
// src/lib/types.ts
|
|
56855
56627
|
var LogLevel = {
|
|
56856
56628
|
Full: "full",
|
|
@@ -57288,6 +57060,9 @@ var Config = class {
|
|
|
57288
57060
|
get loadingDirective() {
|
|
57289
57061
|
return `loading`;
|
|
57290
57062
|
}
|
|
57063
|
+
get runtimeScalarDirective() {
|
|
57064
|
+
return "__houdini__runtimeScalar";
|
|
57065
|
+
}
|
|
57291
57066
|
get whenDirective() {
|
|
57292
57067
|
return "when";
|
|
57293
57068
|
}
|
|
@@ -57358,7 +57133,7 @@ var Config = class {
|
|
|
57358
57133
|
const internalDirectives = this.#newSchemaInstance?.getDirectives().reduce((list, directive) => {
|
|
57359
57134
|
return list.concat(directive.name);
|
|
57360
57135
|
}, []) ?? [];
|
|
57361
|
-
return !defaultDirectives.includes(name) && (internalDirectives.includes(name) || this.isDeleteDirective(name));
|
|
57136
|
+
return !defaultDirectives.includes(name) && (internalDirectives.includes(name) || this.isDeleteDirective(name) || name === this.runtimeScalarDirective);
|
|
57362
57137
|
}
|
|
57363
57138
|
get componentFieldDirective() {
|
|
57364
57139
|
return "componentField";
|
|
@@ -57623,7 +57398,7 @@ function definitionFromAncestors(ancestors) {
|
|
|
57623
57398
|
}
|
|
57624
57399
|
return { parents, definition };
|
|
57625
57400
|
}
|
|
57626
|
-
function unwrapType(config, type, wrappers = []) {
|
|
57401
|
+
function unwrapType(config, type, wrappers = [], convertRuntimeScalars) {
|
|
57627
57402
|
if (type.kind === "NonNullType") {
|
|
57628
57403
|
return unwrapType(config, type.type, [TypeWrapper.NonNull, ...wrappers]);
|
|
57629
57404
|
}
|
|
@@ -57639,9 +57414,14 @@ function unwrapType(config, type, wrappers = []) {
|
|
|
57639
57414
|
if (type instanceof graphql3.GraphQLList) {
|
|
57640
57415
|
return unwrapType(config, type.ofType, [TypeWrapper.List, ...wrappers]);
|
|
57641
57416
|
}
|
|
57417
|
+
if (convertRuntimeScalars && config.configFile.features?.runtimeScalars?.[type.name.value]) {
|
|
57418
|
+
type = config.schema.getType(
|
|
57419
|
+
config.configFile.features?.runtimeScalars?.[type.name.value].type
|
|
57420
|
+
);
|
|
57421
|
+
}
|
|
57642
57422
|
const namedType = config.schema.getType(type.name.value || type.name);
|
|
57643
57423
|
if (!namedType) {
|
|
57644
|
-
throw new Error("
|
|
57424
|
+
throw new Error("Unknown type: " + type.name.value || type.name);
|
|
57645
57425
|
}
|
|
57646
57426
|
return { type: namedType, wrappers };
|
|
57647
57427
|
}
|
|
@@ -57778,16 +57558,162 @@ async function cleanupFiles(pathFolder, listOfObj) {
|
|
|
57778
57558
|
return allFilesNotInList;
|
|
57779
57559
|
}
|
|
57780
57560
|
|
|
57781
|
-
// src/lib/
|
|
57561
|
+
// src/lib/typescript.ts
|
|
57782
57562
|
var graphql4 = __toESM(require("graphql"), 1);
|
|
57563
|
+
var recast2 = __toESM(require_main2(), 1);
|
|
57564
|
+
var AST2 = recast2.types.builders;
|
|
57565
|
+
function unwrappedTsTypeReference(config, filepath, missingScalars, {
|
|
57566
|
+
type,
|
|
57567
|
+
wrappers
|
|
57568
|
+
}, body) {
|
|
57569
|
+
let result;
|
|
57570
|
+
if (graphql4.isScalarType(type)) {
|
|
57571
|
+
result = scalarPropertyValue(config, filepath, missingScalars, type, body, null);
|
|
57572
|
+
} else if (graphql4.isEnumType(type)) {
|
|
57573
|
+
result = enumReference(config, body, type.name);
|
|
57574
|
+
} else {
|
|
57575
|
+
result = AST2.tsTypeReference(AST2.identifier(type.name));
|
|
57576
|
+
}
|
|
57577
|
+
for (const toWrap of wrappers) {
|
|
57578
|
+
if (toWrap === "NonNull" /* NonNull */) {
|
|
57579
|
+
continue;
|
|
57580
|
+
} else if (toWrap === "Nullable" /* Nullable */) {
|
|
57581
|
+
result = nullableField(result, true);
|
|
57582
|
+
} else if (toWrap === "List" /* List */) {
|
|
57583
|
+
result = AST2.tsArrayType(AST2.tsParenthesizedType(result));
|
|
57584
|
+
}
|
|
57585
|
+
}
|
|
57586
|
+
return result;
|
|
57587
|
+
}
|
|
57588
|
+
function tsTypeReference(config, filepath, missingScalars, definition, body) {
|
|
57589
|
+
const { type, wrappers } = unwrapType(config, definition.type);
|
|
57590
|
+
return unwrappedTsTypeReference(
|
|
57591
|
+
config,
|
|
57592
|
+
filepath,
|
|
57593
|
+
missingScalars,
|
|
57594
|
+
{ type, wrappers },
|
|
57595
|
+
body
|
|
57596
|
+
);
|
|
57597
|
+
}
|
|
57598
|
+
function enumReference(config, body, name) {
|
|
57599
|
+
ensureImports({
|
|
57600
|
+
config,
|
|
57601
|
+
body,
|
|
57602
|
+
import: ["ValueOf"],
|
|
57603
|
+
importKind: "type",
|
|
57604
|
+
sourceModule: "$houdini/runtime/lib/types"
|
|
57605
|
+
});
|
|
57606
|
+
return AST2.tsTypeReference(
|
|
57607
|
+
AST2.identifier("ValueOf"),
|
|
57608
|
+
AST2.tsTypeParameterInstantiation([AST2.tsTypeQuery(AST2.identifier(name))])
|
|
57609
|
+
);
|
|
57610
|
+
}
|
|
57611
|
+
function readonlyProperty(prop, enable = true) {
|
|
57612
|
+
if (enable) {
|
|
57613
|
+
prop.readonly = true;
|
|
57614
|
+
}
|
|
57615
|
+
return prop;
|
|
57616
|
+
}
|
|
57617
|
+
function nullableField(inner, input = false) {
|
|
57618
|
+
const members = [inner, AST2.tsNullKeyword()];
|
|
57619
|
+
if (input) {
|
|
57620
|
+
members.push(AST2.tsUndefinedKeyword());
|
|
57621
|
+
}
|
|
57622
|
+
return AST2.tsUnionType(members);
|
|
57623
|
+
}
|
|
57624
|
+
function scalarPropertyValue(config, filepath, missingScalars, target, body, field) {
|
|
57625
|
+
if (config.configFile.features?.componentFields && target.name === config.componentScalar) {
|
|
57626
|
+
if (!field) {
|
|
57627
|
+
return AST2.tsNeverKeyword();
|
|
57628
|
+
}
|
|
57629
|
+
const component = config.componentFields[field.parent][field.field];
|
|
57630
|
+
const sourcePathRelative = path_exports.relative(
|
|
57631
|
+
path_exports.join(config.projectRoot, "src"),
|
|
57632
|
+
component.filepath
|
|
57633
|
+
);
|
|
57634
|
+
let sourcePathParsed = path_exports.parse(sourcePathRelative);
|
|
57635
|
+
let sourcePath = path_exports.join(sourcePathParsed.dir, sourcePathParsed.name);
|
|
57636
|
+
const localImport = ensureImports({
|
|
57637
|
+
config,
|
|
57638
|
+
body,
|
|
57639
|
+
import: "__component__" + component.fragment,
|
|
57640
|
+
sourceModule: path_exports.join(
|
|
57641
|
+
path_exports.relative(path_exports.dirname(filepath), config.projectRoot),
|
|
57642
|
+
"src",
|
|
57643
|
+
sourcePath
|
|
57644
|
+
)
|
|
57645
|
+
}) ?? "__component__" + component.fragment;
|
|
57646
|
+
const parameters = AST2.tsTypeReference(AST2.identifier("Parameters"));
|
|
57647
|
+
parameters.typeParameters = AST2.tsTypeParameterInstantiation([
|
|
57648
|
+
AST2.tsTypeQuery(AST2.identifier(localImport))
|
|
57649
|
+
]);
|
|
57650
|
+
const indexed = AST2.tsIndexedAccessType(
|
|
57651
|
+
parameters,
|
|
57652
|
+
AST2.tsLiteralType(AST2.numericLiteral(0))
|
|
57653
|
+
);
|
|
57654
|
+
const omit = AST2.tsTypeReference(AST2.identifier("Omit"));
|
|
57655
|
+
omit.typeParameters = AST2.tsTypeParameterInstantiation([
|
|
57656
|
+
indexed,
|
|
57657
|
+
AST2.tsLiteralType(AST2.stringLiteral(component.prop))
|
|
57658
|
+
]);
|
|
57659
|
+
const arg = AST2.identifier("props");
|
|
57660
|
+
arg.typeAnnotation = AST2.tsTypeAnnotation(omit);
|
|
57661
|
+
const returnType = AST2.tsTypeReference(AST2.identifier("ReturnType"));
|
|
57662
|
+
returnType.typeParameters = AST2.tsTypeParameterInstantiation([
|
|
57663
|
+
AST2.tsTypeQuery(AST2.identifier(localImport))
|
|
57664
|
+
]);
|
|
57665
|
+
const fnType = AST2.tsFunctionType([arg]);
|
|
57666
|
+
fnType.typeAnnotation = AST2.tsTypeAnnotation(returnType);
|
|
57667
|
+
return fnType;
|
|
57668
|
+
}
|
|
57669
|
+
switch (target.name) {
|
|
57670
|
+
case "String": {
|
|
57671
|
+
return AST2.tsStringKeyword();
|
|
57672
|
+
}
|
|
57673
|
+
case "Int": {
|
|
57674
|
+
return AST2.tsNumberKeyword();
|
|
57675
|
+
}
|
|
57676
|
+
case "Float": {
|
|
57677
|
+
return AST2.tsNumberKeyword();
|
|
57678
|
+
}
|
|
57679
|
+
case "Boolean": {
|
|
57680
|
+
return AST2.tsBooleanKeyword();
|
|
57681
|
+
}
|
|
57682
|
+
case "ID": {
|
|
57683
|
+
return AST2.tsStringKeyword();
|
|
57684
|
+
}
|
|
57685
|
+
default: {
|
|
57686
|
+
if (graphql4.isNonNullType(target) && "ofType" in target) {
|
|
57687
|
+
return scalarPropertyValue(
|
|
57688
|
+
config,
|
|
57689
|
+
filepath,
|
|
57690
|
+
missingScalars,
|
|
57691
|
+
target.ofType,
|
|
57692
|
+
body,
|
|
57693
|
+
field
|
|
57694
|
+
);
|
|
57695
|
+
}
|
|
57696
|
+
if (config.scalars?.[target.name]) {
|
|
57697
|
+
return AST2.tsTypeReference(AST2.identifier(config.scalars?.[target.name].type));
|
|
57698
|
+
}
|
|
57699
|
+
if (target.name !== config.componentScalar) {
|
|
57700
|
+
missingScalars.add(target.name);
|
|
57701
|
+
}
|
|
57702
|
+
return AST2.tsAnyKeyword();
|
|
57703
|
+
}
|
|
57704
|
+
}
|
|
57705
|
+
}
|
|
57706
|
+
|
|
57707
|
+
// src/lib/walk.ts
|
|
57708
|
+
var graphql5 = __toESM(require("graphql"), 1);
|
|
57783
57709
|
|
|
57784
57710
|
// src/lib/router/manifest.ts
|
|
57785
57711
|
var t = __toESM(require_lib6(), 1);
|
|
57786
|
-
var
|
|
57712
|
+
var graphql6 = __toESM(require("graphql"), 1);
|
|
57787
57713
|
|
|
57788
57714
|
// src/codegen/generators/artifacts/index.ts
|
|
57789
|
-
var
|
|
57790
|
-
var
|
|
57715
|
+
var graphql17 = __toESM(require("graphql"), 1);
|
|
57716
|
+
var recast5 = __toESM(require_main2(), 1);
|
|
57791
57717
|
|
|
57792
57718
|
// src/codegen/utils/commonjs.ts
|
|
57793
57719
|
var cjsIndexFilePreamble = `"use strict";
|
|
@@ -58029,19 +57955,19 @@ var FieldCollection = class {
|
|
|
58029
57955
|
};
|
|
58030
57956
|
|
|
58031
57957
|
// src/codegen/utils/moduleExport.ts
|
|
58032
|
-
var
|
|
58033
|
-
var
|
|
57958
|
+
var recast3 = __toESM(require_main2(), 1);
|
|
57959
|
+
var AST3 = recast3.types.builders;
|
|
58034
57960
|
function moduleExport(config, key, value) {
|
|
58035
57961
|
if (config.module === "commonjs") {
|
|
58036
|
-
let target =
|
|
57962
|
+
let target = AST3.memberExpression(AST3.identifier("module"), AST3.identifier("exports"));
|
|
58037
57963
|
if (key !== "default") {
|
|
58038
|
-
target =
|
|
57964
|
+
target = AST3.memberExpression(target, AST3.identifier(key));
|
|
58039
57965
|
}
|
|
58040
|
-
return
|
|
57966
|
+
return AST3.expressionStatement(AST3.assignmentExpression("=", target, value));
|
|
58041
57967
|
}
|
|
58042
|
-
return key === "default" ?
|
|
58043
|
-
|
|
58044
|
-
|
|
57968
|
+
return key === "default" ? AST3.exportDefaultDeclaration(value) : AST3.exportNamedDeclaration(
|
|
57969
|
+
AST3.variableDeclaration("const", [
|
|
57970
|
+
AST3.variableDeclarator(AST3.identifier(key), value)
|
|
58045
57971
|
])
|
|
58046
57972
|
);
|
|
58047
57973
|
}
|
|
@@ -58298,7 +58224,7 @@ var serialize = (value, { json, lossy } = {}) => {
|
|
|
58298
58224
|
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));
|
|
58299
58225
|
|
|
58300
58226
|
// src/codegen/transforms/fragmentVariables.ts
|
|
58301
|
-
var
|
|
58227
|
+
var graphql8 = __toESM(require("graphql"), 1);
|
|
58302
58228
|
|
|
58303
58229
|
// src/codegen/utils/stripLoc.ts
|
|
58304
58230
|
function stripLoc(value) {
|
|
@@ -58319,13 +58245,13 @@ function stripLoc(value) {
|
|
|
58319
58245
|
}
|
|
58320
58246
|
|
|
58321
58247
|
// src/codegen/transforms/collectDefinitions.ts
|
|
58322
|
-
var
|
|
58323
|
-
var
|
|
58248
|
+
var graphql7 = __toESM(require("graphql"), 1);
|
|
58249
|
+
var import_graphql2 = require("graphql");
|
|
58324
58250
|
async function includeFragmentDefinitions(config, documents) {
|
|
58325
58251
|
const fragments = collectDefinitions(config, documents);
|
|
58326
58252
|
for (const [index, { name, document, filename }] of documents.entries()) {
|
|
58327
58253
|
const operation = document.definitions.find(
|
|
58328
|
-
(def) => def.kind ===
|
|
58254
|
+
(def) => def.kind === import_graphql2.Kind.OPERATION_DEFINITION || def.kind === "FragmentDefinition"
|
|
58329
58255
|
);
|
|
58330
58256
|
if (!operation) {
|
|
58331
58257
|
continue;
|
|
@@ -58369,10 +58295,10 @@ function collectDefinitions(config, docs) {
|
|
|
58369
58295
|
}
|
|
58370
58296
|
function findRequiredFragments(config, definition) {
|
|
58371
58297
|
const referencedFragments = [];
|
|
58372
|
-
const typeInfo = new
|
|
58373
|
-
definition.selectionSet =
|
|
58298
|
+
const typeInfo = new graphql7.TypeInfo(config.schema);
|
|
58299
|
+
definition.selectionSet = graphql7.visit(
|
|
58374
58300
|
definition,
|
|
58375
|
-
|
|
58301
|
+
graphql7.visitWithTypeInfo(typeInfo, {
|
|
58376
58302
|
FragmentSpread(node) {
|
|
58377
58303
|
referencedFragments.push(node.name.value);
|
|
58378
58304
|
}
|
|
@@ -58406,7 +58332,7 @@ function flattenFragments(filepath, operation, fragments) {
|
|
|
58406
58332
|
}
|
|
58407
58333
|
|
|
58408
58334
|
// src/codegen/transforms/fragmentVariables.ts
|
|
58409
|
-
var GraphqlKinds2 =
|
|
58335
|
+
var GraphqlKinds2 = graphql8.Kind;
|
|
58410
58336
|
async function fragmentVariables(config, documents) {
|
|
58411
58337
|
const fragments = collectDefinitions(config, documents);
|
|
58412
58338
|
const generatedFragments = {};
|
|
@@ -58429,7 +58355,7 @@ async function fragmentVariables(config, documents) {
|
|
|
58429
58355
|
});
|
|
58430
58356
|
}
|
|
58431
58357
|
const doc = {
|
|
58432
|
-
kind:
|
|
58358
|
+
kind: graphql8.Kind.DOCUMENT,
|
|
58433
58359
|
definitions: Object.values(generatedFragments)
|
|
58434
58360
|
};
|
|
58435
58361
|
documents.push({
|
|
@@ -58500,7 +58426,7 @@ function inlineFragmentArgs({
|
|
|
58500
58426
|
return null;
|
|
58501
58427
|
};
|
|
58502
58428
|
const result = esm_default(
|
|
58503
|
-
|
|
58429
|
+
graphql8.visit(document, {
|
|
58504
58430
|
FragmentSpread(node) {
|
|
58505
58431
|
if (!fragmentDefinitions[node.name.value]) {
|
|
58506
58432
|
throw new Error("Could not find definition for fragment" + node.name.value);
|
|
@@ -58586,7 +58512,7 @@ function inlineFragmentArgs({
|
|
|
58586
58512
|
);
|
|
58587
58513
|
if (newName) {
|
|
58588
58514
|
result.name = {
|
|
58589
|
-
kind:
|
|
58515
|
+
kind: graphql8.Kind.NAME,
|
|
58590
58516
|
value: newName
|
|
58591
58517
|
};
|
|
58592
58518
|
}
|
|
@@ -58753,8 +58679,8 @@ ${exportDefaultFrom(`./${doc.name}`, doc.name)}`,
|
|
|
58753
58679
|
}
|
|
58754
58680
|
|
|
58755
58681
|
// src/codegen/generators/artifacts/inputs.ts
|
|
58756
|
-
var
|
|
58757
|
-
function inputObject(config, inputs) {
|
|
58682
|
+
var graphql9 = __toESM(require("graphql"), 1);
|
|
58683
|
+
function inputObject(config, inputs, runtimeScalars) {
|
|
58758
58684
|
const visitedTypes = /* @__PURE__ */ new Set();
|
|
58759
58685
|
const inputObj = {
|
|
58760
58686
|
fields: inputs.reduce((fields, input) => {
|
|
@@ -58770,7 +58696,8 @@ function inputObject(config, inputs) {
|
|
|
58770
58696
|
...fields,
|
|
58771
58697
|
[input.variable.name.value]: input.defaultValue ? variableValue(input.defaultValue, {}) : void 0
|
|
58772
58698
|
};
|
|
58773
|
-
}, {})
|
|
58699
|
+
}, {}),
|
|
58700
|
+
runtimeScalars
|
|
58774
58701
|
};
|
|
58775
58702
|
for (const input of inputs) {
|
|
58776
58703
|
walkInputs(config, visitedTypes, inputObj, input.type);
|
|
@@ -58782,10 +58709,10 @@ function walkInputs(config, visitedTypes, inputObj, rootType) {
|
|
|
58782
58709
|
if (visitedTypes.has(type.name)) {
|
|
58783
58710
|
return;
|
|
58784
58711
|
}
|
|
58785
|
-
if (
|
|
58712
|
+
if (graphql9.isEnumType(type) || graphql9.isScalarType(type)) {
|
|
58786
58713
|
return;
|
|
58787
58714
|
}
|
|
58788
|
-
if (
|
|
58715
|
+
if (graphql9.isUnionType(type)) {
|
|
58789
58716
|
return;
|
|
58790
58717
|
}
|
|
58791
58718
|
visitedTypes.add(type.name);
|
|
@@ -58803,50 +58730,50 @@ function walkInputs(config, visitedTypes, inputObj, rootType) {
|
|
|
58803
58730
|
}
|
|
58804
58731
|
|
|
58805
58732
|
// src/codegen/generators/artifacts/operations.ts
|
|
58806
|
-
var
|
|
58733
|
+
var graphql11 = __toESM(require("graphql"), 1);
|
|
58807
58734
|
|
|
58808
58735
|
// src/codegen/generators/artifacts/utils.ts
|
|
58809
|
-
var
|
|
58810
|
-
var
|
|
58811
|
-
var
|
|
58736
|
+
var graphql10 = __toESM(require("graphql"), 1);
|
|
58737
|
+
var recast4 = __toESM(require_main2(), 1);
|
|
58738
|
+
var AST4 = recast4.types.builders;
|
|
58812
58739
|
function serializeValue(value) {
|
|
58813
58740
|
if (Array.isArray(value)) {
|
|
58814
|
-
return
|
|
58741
|
+
return AST4.arrayExpression(value.map(serializeValue));
|
|
58815
58742
|
}
|
|
58816
58743
|
if (typeof value === "object" && value !== null) {
|
|
58817
|
-
return
|
|
58744
|
+
return AST4.objectExpression(
|
|
58818
58745
|
Object.entries(value).filter(([key, value2]) => typeof value2 !== "undefined").map(([key, val]) => {
|
|
58819
|
-
return
|
|
58746
|
+
return AST4.objectProperty(AST4.stringLiteral(key), serializeValue(val));
|
|
58820
58747
|
})
|
|
58821
58748
|
);
|
|
58822
58749
|
}
|
|
58823
58750
|
if (typeof value === "string") {
|
|
58824
58751
|
if (value.indexOf("\n") !== -1) {
|
|
58825
|
-
return
|
|
58826
|
-
[
|
|
58752
|
+
return AST4.templateLiteral(
|
|
58753
|
+
[AST4.templateElement({ raw: value, cooked: value }, true)],
|
|
58827
58754
|
[]
|
|
58828
58755
|
);
|
|
58829
58756
|
}
|
|
58830
|
-
return
|
|
58757
|
+
return AST4.stringLiteral(value);
|
|
58831
58758
|
}
|
|
58832
|
-
return
|
|
58759
|
+
return AST4.literal(value);
|
|
58833
58760
|
}
|
|
58834
58761
|
function convertValue(config, val) {
|
|
58835
58762
|
let value;
|
|
58836
58763
|
let kind;
|
|
58837
|
-
if (val.kind ===
|
|
58764
|
+
if (val.kind === graphql10.Kind.INT) {
|
|
58838
58765
|
value = parseInt(val.value, 10);
|
|
58839
58766
|
kind = "Int";
|
|
58840
|
-
} else if (val.kind ===
|
|
58767
|
+
} else if (val.kind === graphql10.Kind.FLOAT) {
|
|
58841
58768
|
value = parseFloat(val.value);
|
|
58842
58769
|
kind = "Float";
|
|
58843
|
-
} else if (val.kind ===
|
|
58770
|
+
} else if (val.kind === graphql10.Kind.BOOLEAN) {
|
|
58844
58771
|
value = val.value;
|
|
58845
58772
|
kind = "Boolean";
|
|
58846
|
-
} else if (val.kind ===
|
|
58773
|
+
} else if (val.kind === graphql10.Kind.VARIABLE) {
|
|
58847
58774
|
value = val.name.value;
|
|
58848
58775
|
kind = "Variable";
|
|
58849
|
-
} else if (val.kind ===
|
|
58776
|
+
} else if (val.kind === graphql10.Kind.STRING) {
|
|
58850
58777
|
value = val.value;
|
|
58851
58778
|
kind = "String";
|
|
58852
58779
|
}
|
|
@@ -58859,7 +58786,7 @@ function operationsByPath(config, filepath, definition, filterTypes) {
|
|
|
58859
58786
|
return {};
|
|
58860
58787
|
}
|
|
58861
58788
|
const pathOperations = {};
|
|
58862
|
-
|
|
58789
|
+
graphql11.visit(definition, {
|
|
58863
58790
|
FragmentSpread(node, _, __, ___, ancestors) {
|
|
58864
58791
|
if (!config.isListFragment(node.name.value)) {
|
|
58865
58792
|
return;
|
|
@@ -59018,19 +58945,19 @@ function ancestorKey(ancestors) {
|
|
|
59018
58945
|
}
|
|
59019
58946
|
|
|
59020
58947
|
// src/codegen/generators/artifacts/selection.ts
|
|
59021
|
-
var
|
|
58948
|
+
var graphql16 = __toESM(require("graphql"), 1);
|
|
59022
58949
|
|
|
59023
58950
|
// src/codegen/transforms/list.ts
|
|
59024
|
-
var
|
|
58951
|
+
var graphql14 = __toESM(require("graphql"), 1);
|
|
59025
58952
|
|
|
59026
58953
|
// src/codegen/utils/objectIdentificationSelection.ts
|
|
59027
|
-
var
|
|
58954
|
+
var graphql12 = __toESM(require("graphql"), 1);
|
|
59028
58955
|
var objectIdentificationSelection = (config, type) => {
|
|
59029
58956
|
return config.keyFieldsForType(type.name).map((key) => {
|
|
59030
58957
|
return {
|
|
59031
|
-
kind:
|
|
58958
|
+
kind: graphql12.Kind.FIELD,
|
|
59032
58959
|
name: {
|
|
59033
|
-
kind:
|
|
58960
|
+
kind: graphql12.Kind.NAME,
|
|
59034
58961
|
value: key
|
|
59035
58962
|
}
|
|
59036
58963
|
};
|
|
@@ -59038,7 +58965,7 @@ var objectIdentificationSelection = (config, type) => {
|
|
|
59038
58965
|
};
|
|
59039
58966
|
|
|
59040
58967
|
// src/codegen/transforms/paginate.ts
|
|
59041
|
-
var
|
|
58968
|
+
var graphql13 = __toESM(require("graphql"), 1);
|
|
59042
58969
|
async function paginate(config, documents) {
|
|
59043
58970
|
const newDocs = [];
|
|
59044
58971
|
for (const doc of documents) {
|
|
@@ -59071,7 +58998,7 @@ async function paginate(config, documents) {
|
|
|
59071
58998
|
};
|
|
59072
58999
|
let cursorType = "String";
|
|
59073
59000
|
let paginationPath = [];
|
|
59074
|
-
doc.document =
|
|
59001
|
+
doc.document = graphql13.visit(doc.document, {
|
|
59075
59002
|
Field(node, _, __, ___, ancestors) {
|
|
59076
59003
|
const paginateDirective = node.directives?.find(
|
|
59077
59004
|
(directive) => directive.name.value === config.paginateDirective
|
|
@@ -59097,7 +59024,7 @@ async function paginate(config, documents) {
|
|
|
59097
59024
|
flags.offset.enabled = offsetPagination;
|
|
59098
59025
|
flags.limit.enabled = offsetPagination;
|
|
59099
59026
|
paginationPath = ancestors.filter(
|
|
59100
|
-
(ancestor) => !Array.isArray(ancestor) && ancestor.kind ===
|
|
59027
|
+
(ancestor) => !Array.isArray(ancestor) && ancestor.kind === graphql13.Kind.FIELD
|
|
59101
59028
|
).concat(node).map((field) => field.alias?.value || field.name.value);
|
|
59102
59029
|
return {
|
|
59103
59030
|
...node,
|
|
@@ -59116,7 +59043,7 @@ async function paginate(config, documents) {
|
|
|
59116
59043
|
let fragment2 = "";
|
|
59117
59044
|
let paginateMode = config.defaultPaginateMode;
|
|
59118
59045
|
const requiredArgs = [];
|
|
59119
|
-
doc.document =
|
|
59046
|
+
doc.document = graphql13.visit(doc.document, {
|
|
59120
59047
|
OperationDefinition(node) {
|
|
59121
59048
|
if (node.operation !== "query") {
|
|
59122
59049
|
throw new HoudiniError({
|
|
@@ -59175,9 +59102,9 @@ async function paginate(config, documents) {
|
|
|
59175
59102
|
directives: [
|
|
59176
59103
|
...node.directives || [],
|
|
59177
59104
|
{
|
|
59178
|
-
kind:
|
|
59105
|
+
kind: graphql13.Kind.DIRECTIVE,
|
|
59179
59106
|
name: {
|
|
59180
|
-
kind:
|
|
59107
|
+
kind: graphql13.Kind.NAME,
|
|
59181
59108
|
value: config.argumentsDirective
|
|
59182
59109
|
}
|
|
59183
59110
|
}
|
|
@@ -59247,22 +59174,22 @@ async function paginate(config, documents) {
|
|
|
59247
59174
|
const paginationArgs = Object.entries(flags).filter(([_, { enabled }]) => enabled).map(([key, value]) => ({ name: key, ...value }));
|
|
59248
59175
|
const fragmentSpreadSelection = [
|
|
59249
59176
|
{
|
|
59250
|
-
kind:
|
|
59177
|
+
kind: graphql13.Kind.FRAGMENT_SPREAD,
|
|
59251
59178
|
name: {
|
|
59252
|
-
kind:
|
|
59179
|
+
kind: graphql13.Kind.NAME,
|
|
59253
59180
|
value: fragmentName
|
|
59254
59181
|
},
|
|
59255
59182
|
directives: [
|
|
59256
59183
|
{
|
|
59257
|
-
kind:
|
|
59184
|
+
kind: graphql13.Kind.DIRECTIVE,
|
|
59258
59185
|
name: {
|
|
59259
|
-
kind:
|
|
59186
|
+
kind: graphql13.Kind.NAME,
|
|
59260
59187
|
value: config.withDirective
|
|
59261
59188
|
},
|
|
59262
59189
|
["arguments"]: requiredArgs.map((arg) => variableAsArgument(arg.name)).concat(paginationArgs.map(({ name }) => variableAsArgument(name)))
|
|
59263
59190
|
},
|
|
59264
59191
|
{
|
|
59265
|
-
kind:
|
|
59192
|
+
kind: graphql13.Kind.DIRECTIVE,
|
|
59266
59193
|
name: {
|
|
59267
59194
|
kind: "Name",
|
|
59268
59195
|
value: config.maskDisableDirective
|
|
@@ -59289,23 +59216,23 @@ async function paginate(config, documents) {
|
|
|
59289
59216
|
});
|
|
59290
59217
|
const typeConfig = config.typeConfig?.[fragment2];
|
|
59291
59218
|
const queryDoc = {
|
|
59292
|
-
kind:
|
|
59219
|
+
kind: graphql13.Kind.DOCUMENT,
|
|
59293
59220
|
definitions: [
|
|
59294
59221
|
{
|
|
59295
|
-
kind:
|
|
59222
|
+
kind: graphql13.Kind.OPERATION_DEFINITION,
|
|
59296
59223
|
name: {
|
|
59297
|
-
kind:
|
|
59224
|
+
kind: graphql13.Kind.NAME,
|
|
59298
59225
|
value: refetchQueryName
|
|
59299
59226
|
},
|
|
59300
59227
|
operation: "query",
|
|
59301
59228
|
variableDefinitions: requiredArgs.map(
|
|
59302
59229
|
(arg) => ({
|
|
59303
|
-
kind:
|
|
59230
|
+
kind: graphql13.Kind.VARIABLE_DEFINITION,
|
|
59304
59231
|
type: arg.type,
|
|
59305
59232
|
variable: {
|
|
59306
|
-
kind:
|
|
59233
|
+
kind: graphql13.Kind.VARIABLE,
|
|
59307
59234
|
name: {
|
|
59308
|
-
kind:
|
|
59235
|
+
kind: graphql13.Kind.NAME,
|
|
59309
59236
|
value: arg.name
|
|
59310
59237
|
}
|
|
59311
59238
|
}
|
|
@@ -59313,18 +59240,18 @@ async function paginate(config, documents) {
|
|
|
59313
59240
|
).concat(
|
|
59314
59241
|
paginationArgs.map(
|
|
59315
59242
|
(arg) => ({
|
|
59316
|
-
kind:
|
|
59243
|
+
kind: graphql13.Kind.VARIABLE_DEFINITION,
|
|
59317
59244
|
type: {
|
|
59318
|
-
kind:
|
|
59245
|
+
kind: graphql13.Kind.NAMED_TYPE,
|
|
59319
59246
|
name: {
|
|
59320
|
-
kind:
|
|
59247
|
+
kind: graphql13.Kind.NAME,
|
|
59321
59248
|
value: arg.type
|
|
59322
59249
|
}
|
|
59323
59250
|
},
|
|
59324
59251
|
variable: {
|
|
59325
|
-
kind:
|
|
59252
|
+
kind: graphql13.Kind.VARIABLE,
|
|
59326
59253
|
name: {
|
|
59327
|
-
kind:
|
|
59254
|
+
kind: graphql13.Kind.NAME,
|
|
59328
59255
|
value: arg.name
|
|
59329
59256
|
}
|
|
59330
59257
|
},
|
|
@@ -59336,12 +59263,12 @@ async function paginate(config, documents) {
|
|
|
59336
59263
|
).concat(
|
|
59337
59264
|
!nodeQuery ? [] : keys2.map(
|
|
59338
59265
|
(key) => ({
|
|
59339
|
-
kind:
|
|
59266
|
+
kind: graphql13.Kind.VARIABLE_DEFINITION,
|
|
59340
59267
|
type: key.type,
|
|
59341
59268
|
variable: {
|
|
59342
|
-
kind:
|
|
59269
|
+
kind: graphql13.Kind.VARIABLE,
|
|
59343
59270
|
name: {
|
|
59344
|
-
kind:
|
|
59271
|
+
kind: graphql13.Kind.NAME,
|
|
59345
59272
|
value: key.name
|
|
59346
59273
|
}
|
|
59347
59274
|
}
|
|
@@ -59350,42 +59277,42 @@ async function paginate(config, documents) {
|
|
|
59350
59277
|
)
|
|
59351
59278
|
),
|
|
59352
59279
|
selectionSet: {
|
|
59353
|
-
kind:
|
|
59280
|
+
kind: graphql13.Kind.SELECTION_SET,
|
|
59354
59281
|
selections: !nodeQuery ? fragmentSpreadSelection : [
|
|
59355
59282
|
{
|
|
59356
|
-
kind:
|
|
59283
|
+
kind: graphql13.Kind.FIELD,
|
|
59357
59284
|
name: {
|
|
59358
|
-
kind:
|
|
59285
|
+
kind: graphql13.Kind.NAME,
|
|
59359
59286
|
value: typeConfig?.resolve?.queryField || "node"
|
|
59360
59287
|
},
|
|
59361
59288
|
["arguments"]: keys2.map((key) => ({
|
|
59362
|
-
kind:
|
|
59289
|
+
kind: graphql13.Kind.ARGUMENT,
|
|
59363
59290
|
name: {
|
|
59364
|
-
kind:
|
|
59291
|
+
kind: graphql13.Kind.NAME,
|
|
59365
59292
|
value: key.name
|
|
59366
59293
|
},
|
|
59367
59294
|
value: {
|
|
59368
|
-
kind:
|
|
59295
|
+
kind: graphql13.Kind.VARIABLE,
|
|
59369
59296
|
name: {
|
|
59370
|
-
kind:
|
|
59297
|
+
kind: graphql13.Kind.NAME,
|
|
59371
59298
|
value: key.name
|
|
59372
59299
|
}
|
|
59373
59300
|
}
|
|
59374
59301
|
})),
|
|
59375
59302
|
selectionSet: {
|
|
59376
|
-
kind:
|
|
59303
|
+
kind: graphql13.Kind.SELECTION_SET,
|
|
59377
59304
|
selections: [
|
|
59378
59305
|
{
|
|
59379
|
-
kind:
|
|
59306
|
+
kind: graphql13.Kind.FIELD,
|
|
59380
59307
|
name: {
|
|
59381
|
-
kind:
|
|
59308
|
+
kind: graphql13.Kind.NAME,
|
|
59382
59309
|
value: "__typename"
|
|
59383
59310
|
}
|
|
59384
59311
|
},
|
|
59385
59312
|
...(typeConfig?.keys || [config.defaultKeys[0]]).map((key) => ({
|
|
59386
|
-
kind:
|
|
59313
|
+
kind: graphql13.Kind.FIELD,
|
|
59387
59314
|
name: {
|
|
59388
|
-
kind:
|
|
59315
|
+
kind: graphql13.Kind.NAME,
|
|
59389
59316
|
value: key
|
|
59390
59317
|
}
|
|
59391
59318
|
})),
|
|
@@ -59442,15 +59369,15 @@ function replaceArgumentsWithVariables(args, flags) {
|
|
|
59442
59369
|
}
|
|
59443
59370
|
function variableAsArgument(name, variable) {
|
|
59444
59371
|
return {
|
|
59445
|
-
kind:
|
|
59372
|
+
kind: graphql13.Kind.ARGUMENT,
|
|
59446
59373
|
name: {
|
|
59447
|
-
kind:
|
|
59374
|
+
kind: graphql13.Kind.NAME,
|
|
59448
59375
|
value: name
|
|
59449
59376
|
},
|
|
59450
59377
|
value: {
|
|
59451
|
-
kind:
|
|
59378
|
+
kind: graphql13.Kind.VARIABLE,
|
|
59452
59379
|
name: {
|
|
59453
|
-
kind:
|
|
59380
|
+
kind: graphql13.Kind.NAME,
|
|
59454
59381
|
value: variable ?? name
|
|
59455
59382
|
}
|
|
59456
59383
|
}
|
|
@@ -59458,18 +59385,18 @@ function variableAsArgument(name, variable) {
|
|
|
59458
59385
|
}
|
|
59459
59386
|
function staticVariableDefinition(name, type, defaultValue, variableName) {
|
|
59460
59387
|
return {
|
|
59461
|
-
kind:
|
|
59388
|
+
kind: graphql13.Kind.VARIABLE_DEFINITION,
|
|
59462
59389
|
type: {
|
|
59463
|
-
kind:
|
|
59390
|
+
kind: graphql13.Kind.NAMED_TYPE,
|
|
59464
59391
|
name: {
|
|
59465
|
-
kind:
|
|
59392
|
+
kind: graphql13.Kind.NAME,
|
|
59466
59393
|
value: type
|
|
59467
59394
|
}
|
|
59468
59395
|
},
|
|
59469
59396
|
variable: {
|
|
59470
|
-
kind:
|
|
59397
|
+
kind: graphql13.Kind.VARIABLE,
|
|
59471
59398
|
name: {
|
|
59472
|
-
kind:
|
|
59399
|
+
kind: graphql13.Kind.NAME,
|
|
59473
59400
|
value: variableName ?? name
|
|
59474
59401
|
}
|
|
59475
59402
|
},
|
|
@@ -59481,9 +59408,9 @@ function staticVariableDefinition(name, type, defaultValue, variableName) {
|
|
|
59481
59408
|
}
|
|
59482
59409
|
function argumentNode(name, value) {
|
|
59483
59410
|
return {
|
|
59484
|
-
kind:
|
|
59411
|
+
kind: graphql13.Kind.ARGUMENT,
|
|
59485
59412
|
name: {
|
|
59486
|
-
kind:
|
|
59413
|
+
kind: graphql13.Kind.NAME,
|
|
59487
59414
|
value: name
|
|
59488
59415
|
},
|
|
59489
59416
|
value: objectNode(value)
|
|
@@ -59491,16 +59418,16 @@ function argumentNode(name, value) {
|
|
|
59491
59418
|
}
|
|
59492
59419
|
function objectNode([type, defaultValue]) {
|
|
59493
59420
|
const node = {
|
|
59494
|
-
kind:
|
|
59421
|
+
kind: graphql13.Kind.OBJECT,
|
|
59495
59422
|
fields: [
|
|
59496
59423
|
{
|
|
59497
|
-
kind:
|
|
59424
|
+
kind: graphql13.Kind.OBJECT_FIELD,
|
|
59498
59425
|
name: {
|
|
59499
|
-
kind:
|
|
59426
|
+
kind: graphql13.Kind.NAME,
|
|
59500
59427
|
value: "type"
|
|
59501
59428
|
},
|
|
59502
59429
|
value: {
|
|
59503
|
-
kind:
|
|
59430
|
+
kind: graphql13.Kind.STRING,
|
|
59504
59431
|
value: type
|
|
59505
59432
|
}
|
|
59506
59433
|
}
|
|
@@ -59508,8 +59435,8 @@ function objectNode([type, defaultValue]) {
|
|
|
59508
59435
|
};
|
|
59509
59436
|
if (defaultValue) {
|
|
59510
59437
|
node.fields.push({
|
|
59511
|
-
kind:
|
|
59512
|
-
name: { kind:
|
|
59438
|
+
kind: graphql13.Kind.OBJECT_FIELD,
|
|
59439
|
+
name: { kind: graphql13.Kind.NAME, value: "default" },
|
|
59513
59440
|
value: {
|
|
59514
59441
|
kind: typeof defaultValue === "number" ? "IntValue" : "StringValue",
|
|
59515
59442
|
value: defaultValue.toString()
|
|
@@ -59520,34 +59447,34 @@ function objectNode([type, defaultValue]) {
|
|
|
59520
59447
|
}
|
|
59521
59448
|
var pageInfoSelection = [
|
|
59522
59449
|
{
|
|
59523
|
-
kind:
|
|
59450
|
+
kind: graphql13.Kind.FIELD,
|
|
59524
59451
|
name: {
|
|
59525
|
-
kind:
|
|
59452
|
+
kind: graphql13.Kind.NAME,
|
|
59526
59453
|
value: "edges"
|
|
59527
59454
|
},
|
|
59528
59455
|
selectionSet: {
|
|
59529
|
-
kind:
|
|
59456
|
+
kind: graphql13.Kind.SELECTION_SET,
|
|
59530
59457
|
selections: [
|
|
59531
59458
|
{
|
|
59532
|
-
kind:
|
|
59459
|
+
kind: graphql13.Kind.FIELD,
|
|
59533
59460
|
name: {
|
|
59534
|
-
kind:
|
|
59461
|
+
kind: graphql13.Kind.NAME,
|
|
59535
59462
|
value: "cursor"
|
|
59536
59463
|
}
|
|
59537
59464
|
},
|
|
59538
59465
|
{
|
|
59539
|
-
kind:
|
|
59466
|
+
kind: graphql13.Kind.FIELD,
|
|
59540
59467
|
name: {
|
|
59541
|
-
kind:
|
|
59468
|
+
kind: graphql13.Kind.NAME,
|
|
59542
59469
|
value: "node"
|
|
59543
59470
|
},
|
|
59544
59471
|
selectionSet: {
|
|
59545
|
-
kind:
|
|
59472
|
+
kind: graphql13.Kind.SELECTION_SET,
|
|
59546
59473
|
selections: [
|
|
59547
59474
|
{
|
|
59548
|
-
kind:
|
|
59475
|
+
kind: graphql13.Kind.FIELD,
|
|
59549
59476
|
name: {
|
|
59550
|
-
kind:
|
|
59477
|
+
kind: graphql13.Kind.NAME,
|
|
59551
59478
|
value: "__typename"
|
|
59552
59479
|
}
|
|
59553
59480
|
}
|
|
@@ -59558,39 +59485,39 @@ var pageInfoSelection = [
|
|
|
59558
59485
|
}
|
|
59559
59486
|
},
|
|
59560
59487
|
{
|
|
59561
|
-
kind:
|
|
59488
|
+
kind: graphql13.Kind.FIELD,
|
|
59562
59489
|
name: {
|
|
59563
|
-
kind:
|
|
59490
|
+
kind: graphql13.Kind.NAME,
|
|
59564
59491
|
value: "pageInfo"
|
|
59565
59492
|
},
|
|
59566
59493
|
selectionSet: {
|
|
59567
|
-
kind:
|
|
59494
|
+
kind: graphql13.Kind.SELECTION_SET,
|
|
59568
59495
|
selections: [
|
|
59569
59496
|
{
|
|
59570
|
-
kind:
|
|
59497
|
+
kind: graphql13.Kind.FIELD,
|
|
59571
59498
|
name: {
|
|
59572
|
-
kind:
|
|
59499
|
+
kind: graphql13.Kind.NAME,
|
|
59573
59500
|
value: "hasPreviousPage"
|
|
59574
59501
|
}
|
|
59575
59502
|
},
|
|
59576
59503
|
{
|
|
59577
|
-
kind:
|
|
59504
|
+
kind: graphql13.Kind.FIELD,
|
|
59578
59505
|
name: {
|
|
59579
|
-
kind:
|
|
59506
|
+
kind: graphql13.Kind.NAME,
|
|
59580
59507
|
value: "hasNextPage"
|
|
59581
59508
|
}
|
|
59582
59509
|
},
|
|
59583
59510
|
{
|
|
59584
|
-
kind:
|
|
59511
|
+
kind: graphql13.Kind.FIELD,
|
|
59585
59512
|
name: {
|
|
59586
|
-
kind:
|
|
59513
|
+
kind: graphql13.Kind.NAME,
|
|
59587
59514
|
value: "startCursor"
|
|
59588
59515
|
}
|
|
59589
59516
|
},
|
|
59590
59517
|
{
|
|
59591
|
-
kind:
|
|
59518
|
+
kind: graphql13.Kind.FIELD,
|
|
59592
59519
|
name: {
|
|
59593
|
-
kind:
|
|
59520
|
+
kind: graphql13.Kind.NAME,
|
|
59594
59521
|
value: "endCursor"
|
|
59595
59522
|
}
|
|
59596
59523
|
}
|
|
@@ -59604,17 +59531,17 @@ async function addListFragments(config, documents) {
|
|
|
59604
59531
|
const lists = {};
|
|
59605
59532
|
const errors = [];
|
|
59606
59533
|
for (const doc of documents) {
|
|
59607
|
-
doc.document =
|
|
59534
|
+
doc.document = graphql14.visit(doc.document, {
|
|
59608
59535
|
Directive(node, key, parent2, path2, ancestors) {
|
|
59609
59536
|
if ([config.listDirective, config.paginateDirective].includes(node.name.value)) {
|
|
59610
59537
|
const nameArg = node.arguments?.find(
|
|
59611
59538
|
(arg) => arg.name.value === config.listOrPaginateNameArg
|
|
59612
59539
|
);
|
|
59613
59540
|
let error = {
|
|
59614
|
-
...new
|
|
59541
|
+
...new graphql14.GraphQLError(
|
|
59615
59542
|
"",
|
|
59616
59543
|
node,
|
|
59617
|
-
new
|
|
59544
|
+
new graphql14.Source(""),
|
|
59618
59545
|
node.loc ? [node.loc.start, node.loc.end] : null,
|
|
59619
59546
|
path2
|
|
59620
59547
|
),
|
|
@@ -59666,7 +59593,7 @@ async function addListFragments(config, documents) {
|
|
|
59666
59593
|
{
|
|
59667
59594
|
kind: "Argument",
|
|
59668
59595
|
name: {
|
|
59669
|
-
kind:
|
|
59596
|
+
kind: graphql14.Kind.NAME,
|
|
59670
59597
|
value: "connection"
|
|
59671
59598
|
},
|
|
59672
59599
|
value: {
|
|
@@ -59716,7 +59643,7 @@ async function addListFragments(config, documents) {
|
|
|
59716
59643
|
const validDeletes = [
|
|
59717
59644
|
...new Set(
|
|
59718
59645
|
Object.values(lists).map(({ type }) => {
|
|
59719
|
-
if (!(type instanceof
|
|
59646
|
+
if (!(type instanceof graphql14.GraphQLObjectType)) {
|
|
59720
59647
|
return "";
|
|
59721
59648
|
}
|
|
59722
59649
|
if (config.keyFieldsForType(type.name).length !== 1) {
|
|
@@ -59730,7 +59657,7 @@ async function addListFragments(config, documents) {
|
|
|
59730
59657
|
return;
|
|
59731
59658
|
}
|
|
59732
59659
|
const generatedDoc = {
|
|
59733
|
-
kind:
|
|
59660
|
+
kind: graphql14.Kind.DOCUMENT,
|
|
59734
59661
|
definitions: Object.entries(lists).flatMap(
|
|
59735
59662
|
([name, { selection, type }]) => {
|
|
59736
59663
|
const schemaType = config.schema.getType(type.name);
|
|
@@ -59738,7 +59665,7 @@ async function addListFragments(config, documents) {
|
|
|
59738
59665
|
throw new HoudiniError({ message: "Lists must have a selection" });
|
|
59739
59666
|
}
|
|
59740
59667
|
const fragmentSelection = {
|
|
59741
|
-
kind:
|
|
59668
|
+
kind: graphql14.Kind.SELECTION_SET,
|
|
59742
59669
|
selections: [...selection.selections]
|
|
59743
59670
|
};
|
|
59744
59671
|
if (schemaType && fragmentSelection && !fragmentSelection?.selections.find(
|
|
@@ -59753,14 +59680,14 @@ async function addListFragments(config, documents) {
|
|
|
59753
59680
|
{
|
|
59754
59681
|
name: {
|
|
59755
59682
|
value: config.listInsertFragment(name),
|
|
59756
|
-
kind:
|
|
59683
|
+
kind: graphql14.Kind.NAME
|
|
59757
59684
|
},
|
|
59758
|
-
kind:
|
|
59685
|
+
kind: graphql14.Kind.FRAGMENT_DEFINITION,
|
|
59759
59686
|
selectionSet: fragmentSelection,
|
|
59760
59687
|
typeCondition: {
|
|
59761
|
-
kind:
|
|
59688
|
+
kind: graphql14.Kind.NAMED_TYPE,
|
|
59762
59689
|
name: {
|
|
59763
|
-
kind:
|
|
59690
|
+
kind: graphql14.Kind.NAME,
|
|
59764
59691
|
value: type.name
|
|
59765
59692
|
}
|
|
59766
59693
|
}
|
|
@@ -59768,32 +59695,32 @@ async function addListFragments(config, documents) {
|
|
|
59768
59695
|
{
|
|
59769
59696
|
name: {
|
|
59770
59697
|
value: config.listToggleFragment(name),
|
|
59771
|
-
kind:
|
|
59698
|
+
kind: graphql14.Kind.NAME
|
|
59772
59699
|
},
|
|
59773
|
-
kind:
|
|
59700
|
+
kind: graphql14.Kind.FRAGMENT_DEFINITION,
|
|
59774
59701
|
selectionSet: fragmentSelection,
|
|
59775
59702
|
typeCondition: {
|
|
59776
|
-
kind:
|
|
59703
|
+
kind: graphql14.Kind.NAMED_TYPE,
|
|
59777
59704
|
name: {
|
|
59778
|
-
kind:
|
|
59705
|
+
kind: graphql14.Kind.NAME,
|
|
59779
59706
|
value: type.name
|
|
59780
59707
|
}
|
|
59781
59708
|
}
|
|
59782
59709
|
},
|
|
59783
59710
|
{
|
|
59784
|
-
kind:
|
|
59711
|
+
kind: graphql14.Kind.FRAGMENT_DEFINITION,
|
|
59785
59712
|
name: {
|
|
59786
59713
|
value: config.listRemoveFragment(name),
|
|
59787
|
-
kind:
|
|
59714
|
+
kind: graphql14.Kind.NAME
|
|
59788
59715
|
},
|
|
59789
59716
|
selectionSet: {
|
|
59790
|
-
kind:
|
|
59717
|
+
kind: graphql14.Kind.SELECTION_SET,
|
|
59791
59718
|
selections: [...objectIdentificationSelection(config, type)]
|
|
59792
59719
|
},
|
|
59793
59720
|
typeCondition: {
|
|
59794
|
-
kind:
|
|
59721
|
+
kind: graphql14.Kind.NAMED_TYPE,
|
|
59795
59722
|
name: {
|
|
59796
|
-
kind:
|
|
59723
|
+
kind: graphql14.Kind.NAME,
|
|
59797
59724
|
value: type.name
|
|
59798
59725
|
}
|
|
59799
59726
|
}
|
|
@@ -59802,14 +59729,14 @@ async function addListFragments(config, documents) {
|
|
|
59802
59729
|
}
|
|
59803
59730
|
).concat(
|
|
59804
59731
|
...validDeletes.map((typeName) => ({
|
|
59805
|
-
kind:
|
|
59732
|
+
kind: graphql14.Kind.DIRECTIVE_DEFINITION,
|
|
59806
59733
|
name: {
|
|
59807
|
-
kind:
|
|
59734
|
+
kind: graphql14.Kind.NAME,
|
|
59808
59735
|
value: config.listDeleteDirective(typeName)
|
|
59809
59736
|
},
|
|
59810
59737
|
locations: [
|
|
59811
59738
|
{
|
|
59812
|
-
kind:
|
|
59739
|
+
kind: graphql14.Kind.NAME,
|
|
59813
59740
|
value: "FIELD"
|
|
59814
59741
|
}
|
|
59815
59742
|
],
|
|
@@ -59817,8 +59744,8 @@ async function addListFragments(config, documents) {
|
|
|
59817
59744
|
}))
|
|
59818
59745
|
)
|
|
59819
59746
|
};
|
|
59820
|
-
config.newSchema += "\n" + generatedDoc.definitions.filter((c) => c.kind !== "FragmentDefinition").map(
|
|
59821
|
-
config.newDocuments += "\n" + generatedDoc.definitions.filter((c) => c.kind === "FragmentDefinition").map(
|
|
59747
|
+
config.newSchema += "\n" + generatedDoc.definitions.filter((c) => c.kind !== "FragmentDefinition").map(graphql14.print).join("\n\n");
|
|
59748
|
+
config.newDocuments += "\n" + generatedDoc.definitions.filter((c) => c.kind === "FragmentDefinition").map(graphql14.print).join("\n\n");
|
|
59822
59749
|
documents.push({
|
|
59823
59750
|
name: "generated::lists",
|
|
59824
59751
|
kind: ArtifactKind.Fragment,
|
|
@@ -59904,11 +59831,11 @@ var nodeNotDefinedMessage = (config) => `Looks like you are trying to use the ${
|
|
|
59904
59831
|
For more information, visit this link: ${siteURL}/guides/pagination`;
|
|
59905
59832
|
|
|
59906
59833
|
// src/codegen/generators/artifacts/fieldKey.ts
|
|
59907
|
-
var
|
|
59834
|
+
var graphql15 = __toESM(require("graphql"), 1);
|
|
59908
59835
|
function fieldKey(config, field) {
|
|
59909
59836
|
const attributeName = field.alias?.value || field.name.value;
|
|
59910
|
-
const printed =
|
|
59911
|
-
const secondParse =
|
|
59837
|
+
const printed = graphql15.print(field);
|
|
59838
|
+
const secondParse = graphql15.parse(`{${printed}}`).definitions[0].selectionSet.selections[0];
|
|
59912
59839
|
let paginateMode = config.defaultPaginateMode;
|
|
59913
59840
|
const paginatedDirective = field.directives?.find(
|
|
59914
59841
|
(directive) => directive.name.value === config.paginateDirective
|
|
@@ -60031,13 +59958,13 @@ function prepareSelection({
|
|
|
60031
59958
|
} else if ("getFields" in type) {
|
|
60032
59959
|
let typeRef = type.getFields()[field.name.value].type;
|
|
60033
59960
|
fieldType = getRootType(typeRef);
|
|
60034
|
-
nullable = !
|
|
60035
|
-
} else if (
|
|
59961
|
+
nullable = !graphql16.isNonNullType(typeRef);
|
|
59962
|
+
} else if (graphql16.isAbstractType(type)) {
|
|
60036
59963
|
for (const possible of config.schema.getPossibleTypes(type)) {
|
|
60037
|
-
if (
|
|
59964
|
+
if (graphql16.isObjectType(possible)) {
|
|
60038
59965
|
if (possible.getFields()[field.name.value]) {
|
|
60039
59966
|
fieldType = possible.getFields()[field.name.value].type;
|
|
60040
|
-
nullable = !
|
|
59967
|
+
nullable = !graphql16.isNonNullType(fieldType);
|
|
60041
59968
|
break;
|
|
60042
59969
|
}
|
|
60043
59970
|
}
|
|
@@ -60174,7 +60101,7 @@ function prepareSelection({
|
|
|
60174
60101
|
kind: "value"
|
|
60175
60102
|
} : { kind: "continue" };
|
|
60176
60103
|
const parentType = config.schema.getType(rootType);
|
|
60177
|
-
if (
|
|
60104
|
+
if (graphql16.isObjectType(parentType) || graphql16.isInterfaceType(parentType)) {
|
|
60178
60105
|
const fieldType2 = parentType.getFields()[field.name.value]?.type;
|
|
60179
60106
|
if (fieldType2) {
|
|
60180
60107
|
const listCount = unwrapType(config, fieldType2).wrappers.filter(
|
|
@@ -60197,7 +60124,7 @@ function prepareSelection({
|
|
|
60197
60124
|
}
|
|
60198
60125
|
fieldObj.loading = loadingValue;
|
|
60199
60126
|
}
|
|
60200
|
-
if (
|
|
60127
|
+
if (graphql16.isInterfaceType(fieldType) || graphql16.isUnionType(fieldType)) {
|
|
60201
60128
|
fieldObj.abstract = true;
|
|
60202
60129
|
if (Object.values(fieldObj.selection?.abstractFields?.fields ?? {}).some(
|
|
60203
60130
|
(fields) => Object.values(fields ?? {}).some((field2) => field2.required)
|
|
@@ -60279,7 +60206,7 @@ function mergeSelection({
|
|
|
60279
60206
|
typeSelection,
|
|
60280
60207
|
abstractSelection.fields[typeName] ?? {}
|
|
60281
60208
|
);
|
|
60282
|
-
if (
|
|
60209
|
+
if (graphql16.isAbstractType(gqlType)) {
|
|
60283
60210
|
for (const possible of config.schema.getPossibleTypes(gqlType)) {
|
|
60284
60211
|
if (!possibleSelectionTypes[typeName]) {
|
|
60285
60212
|
possibleSelectionTypes[typeName] = [];
|
|
@@ -60314,7 +60241,7 @@ function mergeSelection({
|
|
|
60314
60241
|
}
|
|
60315
60242
|
}
|
|
60316
60243
|
const parentType = config.schema.getType(rootType);
|
|
60317
|
-
const possibleParents =
|
|
60244
|
+
const possibleParents = graphql16.isAbstractType(parentType) ? config.schema.getPossibleTypes(parentType)?.map((t2) => t2.name) : [parentType.name];
|
|
60318
60245
|
for (const key of Object.keys(abstractSelection.typeMap)) {
|
|
60319
60246
|
if (!possibleParents.includes(key) && rootType !== key || abstractSelection.fields[key]) {
|
|
60320
60247
|
delete abstractSelection.typeMap[key];
|
|
@@ -60371,12 +60298,12 @@ function mergeSelection({
|
|
|
60371
60298
|
}
|
|
60372
60299
|
|
|
60373
60300
|
// src/codegen/generators/artifacts/index.ts
|
|
60374
|
-
var
|
|
60301
|
+
var AST5 = recast5.types.builders;
|
|
60375
60302
|
function artifactGenerator(stats) {
|
|
60376
60303
|
return async function(config, docs) {
|
|
60377
60304
|
const filterTypes = {};
|
|
60378
60305
|
for (const doc of docs) {
|
|
60379
|
-
|
|
60306
|
+
graphql17.visit(doc.document, {
|
|
60380
60307
|
Directive(node, _, __, ___, ancestors) {
|
|
60381
60308
|
if (node.name.value !== config.listDirective) {
|
|
60382
60309
|
return;
|
|
@@ -60436,7 +60363,7 @@ function artifactGenerator(stats) {
|
|
|
60436
60363
|
return;
|
|
60437
60364
|
}
|
|
60438
60365
|
const usedVariableNames = /* @__PURE__ */ new Set();
|
|
60439
|
-
let documentWithoutInternalDirectives =
|
|
60366
|
+
let documentWithoutInternalDirectives = graphql17.visit(document, {
|
|
60440
60367
|
Directive(node) {
|
|
60441
60368
|
if (config.isInternalDirective(node.name.value)) {
|
|
60442
60369
|
return null;
|
|
@@ -60449,7 +60376,7 @@ function artifactGenerator(stats) {
|
|
|
60449
60376
|
}
|
|
60450
60377
|
}
|
|
60451
60378
|
});
|
|
60452
|
-
let documentWithoutExtraVariables =
|
|
60379
|
+
let documentWithoutExtraVariables = graphql17.visit(
|
|
60453
60380
|
documentWithoutInternalDirectives,
|
|
60454
60381
|
{
|
|
60455
60382
|
VariableDefinition(variableDefinitionNode) {
|
|
@@ -60460,13 +60387,13 @@ function artifactGenerator(stats) {
|
|
|
60460
60387
|
}
|
|
60461
60388
|
}
|
|
60462
60389
|
);
|
|
60463
|
-
let rawString =
|
|
60390
|
+
let rawString = graphql17.print(documentWithoutExtraVariables);
|
|
60464
60391
|
let docKind = doc.kind;
|
|
60465
60392
|
const operations = document.definitions.filter(
|
|
60466
|
-
({ kind }) => kind ===
|
|
60393
|
+
({ kind }) => kind === graphql17.Kind.OPERATION_DEFINITION
|
|
60467
60394
|
);
|
|
60468
60395
|
const fragments = document.definitions.filter(
|
|
60469
|
-
({ kind }) => kind ===
|
|
60396
|
+
({ kind }) => kind === graphql17.Kind.FRAGMENT_DEFINITION
|
|
60470
60397
|
);
|
|
60471
60398
|
let rootType = "";
|
|
60472
60399
|
let selectionSet;
|
|
@@ -60613,7 +60540,21 @@ function artifactGenerator(stats) {
|
|
|
60613
60540
|
artifact.pluginData[plugin2.name] = plugin2.artifactData({ config, document: doc }) ?? {};
|
|
60614
60541
|
}
|
|
60615
60542
|
if (inputs && inputs.length > 0) {
|
|
60616
|
-
|
|
60543
|
+
const runtimeScalars = inputs.reduce((prev, input) => {
|
|
60544
|
+
const runtimeScalarDirective = input.directives?.find(
|
|
60545
|
+
(directive2) => directive2.name.value === config.runtimeScalarDirective
|
|
60546
|
+
);
|
|
60547
|
+
if (!runtimeScalarDirective) {
|
|
60548
|
+
return prev;
|
|
60549
|
+
}
|
|
60550
|
+
return {
|
|
60551
|
+
...prev,
|
|
60552
|
+
[input.variable.name.value]: runtimeScalarDirective.arguments?.find(
|
|
60553
|
+
(arg) => arg.name.value === "type"
|
|
60554
|
+
)?.value?.value
|
|
60555
|
+
};
|
|
60556
|
+
}, {});
|
|
60557
|
+
artifact.input = inputObject(config, inputs, runtimeScalars);
|
|
60617
60558
|
}
|
|
60618
60559
|
if (artifact.kind === "HoudiniQuery") {
|
|
60619
60560
|
const cacheDirective = operations[0].directives?.find(
|
|
@@ -60652,9 +60593,9 @@ function artifactGenerator(stats) {
|
|
|
60652
60593
|
plugin2.artifactEnd({ config, document: doc });
|
|
60653
60594
|
}
|
|
60654
60595
|
const _houdiniHash = hashOriginal({ document: doc });
|
|
60655
|
-
const file =
|
|
60596
|
+
const file = AST5.program([
|
|
60656
60597
|
moduleExport(config, "default", serializeValue(artifact)),
|
|
60657
|
-
|
|
60598
|
+
AST5.expressionStatement(AST5.stringLiteral(`HoudiniHash=${_houdiniHash}`))
|
|
60658
60599
|
]);
|
|
60659
60600
|
const artifactPath = config.artifactPath(document);
|
|
60660
60601
|
const countDocument = doc.generateStore;
|
|
@@ -60712,7 +60653,7 @@ function applyMask(config, target, mask) {
|
|
|
60712
60653
|
if (!targetType) {
|
|
60713
60654
|
continue;
|
|
60714
60655
|
}
|
|
60715
|
-
if (
|
|
60656
|
+
if (graphql17.isAbstractType(targetType)) {
|
|
60716
60657
|
for (const possible of config.schema.getPossibleTypes(targetType)) {
|
|
60717
60658
|
if (target.abstractFields?.fields[possible.name]) {
|
|
60718
60659
|
applyMask(
|
|
@@ -60735,8 +60676,8 @@ function applyMask(config, target, mask) {
|
|
|
60735
60676
|
}
|
|
60736
60677
|
|
|
60737
60678
|
// src/codegen/generators/runtime/graphqlFunction.ts
|
|
60738
|
-
var
|
|
60739
|
-
var
|
|
60679
|
+
var recast6 = __toESM(require_main2(), 1);
|
|
60680
|
+
var AST6 = recast6.types.builders;
|
|
60740
60681
|
async function generateGraphqlReturnTypes(config, docs) {
|
|
60741
60682
|
const indexPath = path_exports.join(config.runtimeDirectory, "index.d.ts");
|
|
60742
60683
|
const fileContent = await fs_exports.readFile(indexPath) || "";
|
|
@@ -60771,18 +60712,18 @@ async function generateGraphqlReturnTypes(config, docs) {
|
|
|
60771
60712
|
continue;
|
|
60772
60713
|
}
|
|
60773
60714
|
for (const [queryString, returnValue] of Object.entries(overloaded_returns)) {
|
|
60774
|
-
const input =
|
|
60775
|
-
input.typeAnnotation =
|
|
60776
|
-
|
|
60715
|
+
const input = AST6.identifier("str");
|
|
60716
|
+
input.typeAnnotation = AST6.tsTypeAnnotation(
|
|
60717
|
+
AST6.tsLiteralType(AST6.stringLiteral(queryString))
|
|
60777
60718
|
);
|
|
60778
60719
|
script.body.splice(
|
|
60779
60720
|
i,
|
|
60780
60721
|
0,
|
|
60781
|
-
|
|
60782
|
-
|
|
60783
|
-
|
|
60722
|
+
AST6.exportNamedDeclaration(
|
|
60723
|
+
AST6.tsDeclareFunction(
|
|
60724
|
+
AST6.identifier("graphql"),
|
|
60784
60725
|
[input],
|
|
60785
|
-
|
|
60726
|
+
AST6.tsTypeAnnotation(AST6.tsTypeReference(AST6.identifier(returnValue)))
|
|
60786
60727
|
)
|
|
60787
60728
|
)
|
|
60788
60729
|
);
|
|
@@ -60957,165 +60898,22 @@ function moduleStatments(config) {
|
|
|
60957
60898
|
var recast11 = __toESM(require_main2(), 1);
|
|
60958
60899
|
|
|
60959
60900
|
// src/codegen/generators/typescript/addReferencedInputTypes.ts
|
|
60960
|
-
var graphql19 = __toESM(require("graphql"), 1);
|
|
60961
|
-
var recast8 = __toESM(require_main2(), 1);
|
|
60962
|
-
|
|
60963
|
-
// src/codegen/generators/typescript/typeReference.ts
|
|
60964
60901
|
var graphql18 = __toESM(require("graphql"), 1);
|
|
60965
60902
|
var recast7 = __toESM(require_main2(), 1);
|
|
60966
|
-
|
|
60967
|
-
// src/codegen/generators/typescript/types.ts
|
|
60968
|
-
var graphql17 = __toESM(require("graphql"), 1);
|
|
60969
|
-
var recast6 = __toESM(require_main2(), 1);
|
|
60970
|
-
var AST6 = recast6.types.builders;
|
|
60971
|
-
function readonlyProperty(prop, enable = true) {
|
|
60972
|
-
if (enable) {
|
|
60973
|
-
prop.readonly = true;
|
|
60974
|
-
}
|
|
60975
|
-
return prop;
|
|
60976
|
-
}
|
|
60977
|
-
function nullableField(inner, input = false) {
|
|
60978
|
-
const members = [inner, AST6.tsNullKeyword()];
|
|
60979
|
-
if (input) {
|
|
60980
|
-
members.push(AST6.tsUndefinedKeyword());
|
|
60981
|
-
}
|
|
60982
|
-
return AST6.tsUnionType(members);
|
|
60983
|
-
}
|
|
60984
|
-
function scalarPropertyValue(config, filepath, missingScalars, target, body, field) {
|
|
60985
|
-
if (config.configFile.features?.componentFields && target.name === config.componentScalar) {
|
|
60986
|
-
if (!field) {
|
|
60987
|
-
return AST6.tsNeverKeyword();
|
|
60988
|
-
}
|
|
60989
|
-
const component = config.componentFields[field.parent][field.field];
|
|
60990
|
-
const sourcePathRelative = path_exports.relative(
|
|
60991
|
-
path_exports.join(config.projectRoot, "src"),
|
|
60992
|
-
component.filepath
|
|
60993
|
-
);
|
|
60994
|
-
let sourcePathParsed = path_exports.parse(sourcePathRelative);
|
|
60995
|
-
let sourcePath = path_exports.join(sourcePathParsed.dir, sourcePathParsed.name);
|
|
60996
|
-
const localImport = ensureImports({
|
|
60997
|
-
config,
|
|
60998
|
-
body,
|
|
60999
|
-
import: "__component__" + component.fragment,
|
|
61000
|
-
sourceModule: path_exports.join(
|
|
61001
|
-
path_exports.relative(path_exports.dirname(filepath), config.projectRoot),
|
|
61002
|
-
"src",
|
|
61003
|
-
sourcePath
|
|
61004
|
-
)
|
|
61005
|
-
});
|
|
61006
|
-
const parameters = AST6.tsTypeReference(AST6.identifier("Parameters"));
|
|
61007
|
-
parameters.typeParameters = AST6.tsTypeParameterInstantiation([
|
|
61008
|
-
AST6.tsTypeQuery(AST6.identifier(localImport))
|
|
61009
|
-
]);
|
|
61010
|
-
const indexed = AST6.tsIndexedAccessType(
|
|
61011
|
-
parameters,
|
|
61012
|
-
AST6.tsLiteralType(AST6.numericLiteral(0))
|
|
61013
|
-
);
|
|
61014
|
-
const omit = AST6.tsTypeReference(AST6.identifier("Omit"));
|
|
61015
|
-
omit.typeParameters = AST6.tsTypeParameterInstantiation([
|
|
61016
|
-
indexed,
|
|
61017
|
-
AST6.tsLiteralType(AST6.stringLiteral(component.prop))
|
|
61018
|
-
]);
|
|
61019
|
-
const arg = AST6.identifier("props");
|
|
61020
|
-
arg.typeAnnotation = AST6.tsTypeAnnotation(omit);
|
|
61021
|
-
const returnType = AST6.tsTypeReference(AST6.identifier("ReturnType"));
|
|
61022
|
-
returnType.typeParameters = AST6.tsTypeParameterInstantiation([
|
|
61023
|
-
AST6.tsTypeQuery(AST6.identifier(localImport))
|
|
61024
|
-
]);
|
|
61025
|
-
const fnType = AST6.tsFunctionType([arg]);
|
|
61026
|
-
fnType.typeAnnotation = AST6.tsTypeAnnotation(returnType);
|
|
61027
|
-
return fnType;
|
|
61028
|
-
}
|
|
61029
|
-
switch (target.name) {
|
|
61030
|
-
case "String": {
|
|
61031
|
-
return AST6.tsStringKeyword();
|
|
61032
|
-
}
|
|
61033
|
-
case "Int": {
|
|
61034
|
-
return AST6.tsNumberKeyword();
|
|
61035
|
-
}
|
|
61036
|
-
case "Float": {
|
|
61037
|
-
return AST6.tsNumberKeyword();
|
|
61038
|
-
}
|
|
61039
|
-
case "Boolean": {
|
|
61040
|
-
return AST6.tsBooleanKeyword();
|
|
61041
|
-
}
|
|
61042
|
-
case "ID": {
|
|
61043
|
-
return AST6.tsStringKeyword();
|
|
61044
|
-
}
|
|
61045
|
-
default: {
|
|
61046
|
-
if (graphql17.isNonNullType(target) && "ofType" in target) {
|
|
61047
|
-
return scalarPropertyValue(
|
|
61048
|
-
config,
|
|
61049
|
-
filepath,
|
|
61050
|
-
missingScalars,
|
|
61051
|
-
target.ofType,
|
|
61052
|
-
body,
|
|
61053
|
-
field
|
|
61054
|
-
);
|
|
61055
|
-
}
|
|
61056
|
-
if (config.scalars?.[target.name]) {
|
|
61057
|
-
return AST6.tsTypeReference(AST6.identifier(config.scalars?.[target.name].type));
|
|
61058
|
-
}
|
|
61059
|
-
if (target.name !== config.componentScalar) {
|
|
61060
|
-
missingScalars.add(target.name);
|
|
61061
|
-
}
|
|
61062
|
-
return AST6.tsAnyKeyword();
|
|
61063
|
-
}
|
|
61064
|
-
}
|
|
61065
|
-
}
|
|
61066
|
-
|
|
61067
|
-
// src/codegen/generators/typescript/typeReference.ts
|
|
61068
60903
|
var AST7 = recast7.types.builders;
|
|
61069
|
-
function tsTypeReference(config, filepath, missingScalars, definition, body) {
|
|
61070
|
-
const { type, wrappers } = unwrapType(config, definition.type);
|
|
61071
|
-
let result;
|
|
61072
|
-
if (graphql18.isScalarType(type)) {
|
|
61073
|
-
result = scalarPropertyValue(config, filepath, missingScalars, type, body, null);
|
|
61074
|
-
} else if (graphql18.isEnumType(type)) {
|
|
61075
|
-
result = enumReference(config, body, type.name);
|
|
61076
|
-
} else {
|
|
61077
|
-
result = AST7.tsTypeReference(AST7.identifier(type.name));
|
|
61078
|
-
}
|
|
61079
|
-
for (const toWrap of wrappers) {
|
|
61080
|
-
if (toWrap === "NonNull" /* NonNull */) {
|
|
61081
|
-
continue;
|
|
61082
|
-
} else if (toWrap === "Nullable" /* Nullable */) {
|
|
61083
|
-
result = nullableField(result, true);
|
|
61084
|
-
} else if (toWrap === "List" /* List */) {
|
|
61085
|
-
result = AST7.tsArrayType(AST7.tsParenthesizedType(result));
|
|
61086
|
-
}
|
|
61087
|
-
}
|
|
61088
|
-
return result;
|
|
61089
|
-
}
|
|
61090
|
-
function enumReference(config, body, name) {
|
|
61091
|
-
ensureImports({
|
|
61092
|
-
config,
|
|
61093
|
-
body,
|
|
61094
|
-
import: ["ValueOf"],
|
|
61095
|
-
importKind: "type",
|
|
61096
|
-
sourceModule: "$houdini/runtime/lib/types"
|
|
61097
|
-
});
|
|
61098
|
-
return AST7.tsTypeReference(
|
|
61099
|
-
AST7.identifier("ValueOf"),
|
|
61100
|
-
AST7.tsTypeParameterInstantiation([AST7.tsTypeQuery(AST7.identifier(name))])
|
|
61101
|
-
);
|
|
61102
|
-
}
|
|
61103
|
-
|
|
61104
|
-
// src/codegen/generators/typescript/addReferencedInputTypes.ts
|
|
61105
|
-
var AST8 = recast8.types.builders;
|
|
61106
60904
|
function addReferencedInputTypes(config, filepath, body, visitedTypes, missingScalars, rootType) {
|
|
61107
60905
|
const { type } = unwrapType(config, rootType);
|
|
61108
|
-
if (
|
|
60906
|
+
if (graphql18.isScalarType(type)) {
|
|
61109
60907
|
return;
|
|
61110
60908
|
}
|
|
61111
60909
|
if (visitedTypes.has(type.name)) {
|
|
61112
60910
|
return;
|
|
61113
60911
|
}
|
|
61114
|
-
if (
|
|
60912
|
+
if (graphql18.isUnionType(type)) {
|
|
61115
60913
|
throw new HoudiniError({ filepath, message: "Input Unions are not supported yet. Sorry!" });
|
|
61116
60914
|
}
|
|
61117
60915
|
visitedTypes.add(type.name);
|
|
61118
|
-
if (
|
|
60916
|
+
if (graphql18.isEnumType(type)) {
|
|
61119
60917
|
ensureImports({
|
|
61120
60918
|
config,
|
|
61121
60919
|
body,
|
|
@@ -61129,21 +60927,37 @@ function addReferencedInputTypes(config, filepath, body, visitedTypes, missingSc
|
|
|
61129
60927
|
for (const field of Object.values(type.getFields())) {
|
|
61130
60928
|
addReferencedInputTypes(config, filepath, body, visitedTypes, missingScalars, field.type);
|
|
61131
60929
|
members.push(
|
|
61132
|
-
|
|
61133
|
-
|
|
61134
|
-
|
|
60930
|
+
AST7.tsPropertySignature(
|
|
60931
|
+
AST7.identifier(field.name),
|
|
60932
|
+
AST7.tsTypeAnnotation(
|
|
61135
60933
|
tsTypeReference(config, filepath, missingScalars, field, body)
|
|
61136
60934
|
),
|
|
61137
|
-
|
|
60935
|
+
graphql18.isNullableType(field.type)
|
|
61138
60936
|
)
|
|
61139
60937
|
);
|
|
61140
60938
|
}
|
|
61141
|
-
body.push(
|
|
60939
|
+
body.push(AST7.tsTypeAliasDeclaration(AST7.identifier(type.name), AST7.tsTypeLiteral(members)));
|
|
61142
60940
|
}
|
|
61143
60941
|
|
|
61144
60942
|
// src/codegen/generators/typescript/inlineType.ts
|
|
61145
|
-
var
|
|
60943
|
+
var graphql19 = __toESM(require("graphql"), 1);
|
|
61146
60944
|
var recast9 = __toESM(require_main2(), 1);
|
|
60945
|
+
|
|
60946
|
+
// src/codegen/generators/comments/jsdoc.ts
|
|
60947
|
+
var recast8 = __toESM(require_main2(), 1);
|
|
60948
|
+
var AST8 = recast8.types.builders;
|
|
60949
|
+
function jsdocComment(text, deprecated) {
|
|
60950
|
+
let commentContent = `*
|
|
60951
|
+
* ${text}
|
|
60952
|
+
`;
|
|
60953
|
+
if (deprecated) {
|
|
60954
|
+
commentContent = `${commentContent} * @deprecated ${deprecated}
|
|
60955
|
+
`;
|
|
60956
|
+
}
|
|
60957
|
+
return AST8.commentBlock(commentContent, true);
|
|
60958
|
+
}
|
|
60959
|
+
|
|
60960
|
+
// src/codegen/generators/typescript/inlineType.ts
|
|
61147
60961
|
var AST9 = recast9.types.builders;
|
|
61148
60962
|
var fragmentKey2 = " $fragments";
|
|
61149
60963
|
function inlineType({
|
|
@@ -61164,7 +60978,7 @@ function inlineType({
|
|
|
61164
60978
|
const { type, wrappers } = unwrapType(config, rootType);
|
|
61165
60979
|
let result;
|
|
61166
60980
|
let forceNullable = false;
|
|
61167
|
-
if (
|
|
60981
|
+
if (graphql19.isScalarType(type)) {
|
|
61168
60982
|
result = scalarPropertyValue(
|
|
61169
60983
|
config,
|
|
61170
60984
|
filepath,
|
|
@@ -61173,7 +60987,7 @@ function inlineType({
|
|
|
61173
60987
|
body,
|
|
61174
60988
|
field
|
|
61175
60989
|
);
|
|
61176
|
-
} else if (
|
|
60990
|
+
} else if (graphql19.isEnumType(type)) {
|
|
61177
60991
|
ensureImports({
|
|
61178
60992
|
config,
|
|
61179
60993
|
body,
|
|
@@ -61198,11 +61012,11 @@ function inlineType({
|
|
|
61198
61012
|
for (const selection of selections) {
|
|
61199
61013
|
if (selection.kind === "InlineFragment" && selection.typeCondition) {
|
|
61200
61014
|
const fragmentType = config.schema.getType(selection.typeCondition.name.value);
|
|
61201
|
-
if (!
|
|
61015
|
+
if (!graphql19.isInterfaceType(type) && !graphql19.isUnionType(type)) {
|
|
61202
61016
|
selectedFields.push(...selection.selectionSet.selections);
|
|
61203
61017
|
continue;
|
|
61204
61018
|
}
|
|
61205
|
-
if (!
|
|
61019
|
+
if (!graphql19.isInterfaceType(fragmentType) && !graphql19.isUnionType(fragmentType)) {
|
|
61206
61020
|
if (!inlineFragments[fragmentType.name]) {
|
|
61207
61021
|
inlineFragments[fragmentType.name] = [];
|
|
61208
61022
|
}
|
|
@@ -61294,6 +61108,11 @@ function inlineType({
|
|
|
61294
61108
|
if (allOptional) {
|
|
61295
61109
|
prop.optional = true;
|
|
61296
61110
|
}
|
|
61111
|
+
if (field2.description || field2.deprecationReason) {
|
|
61112
|
+
prop.comments = [
|
|
61113
|
+
jsdocComment(field2.description ?? "", field2.deprecationReason ?? void 0)
|
|
61114
|
+
];
|
|
61115
|
+
}
|
|
61297
61116
|
return prop;
|
|
61298
61117
|
})
|
|
61299
61118
|
]);
|
|
@@ -61345,7 +61164,7 @@ function inlineType({
|
|
|
61345
61164
|
}
|
|
61346
61165
|
}
|
|
61347
61166
|
}
|
|
61348
|
-
if (objectType.type === "TSTypeLiteral" && !
|
|
61167
|
+
if (objectType.type === "TSTypeLiteral" && !graphql19.isInterfaceType(fragmentRootType) && !graphql19.isUnionType(fragmentRootType)) {
|
|
61349
61168
|
const existingTypenameIndex = objectType.members.findIndex(
|
|
61350
61169
|
(member) => member.type === "TSPropertySignature" && member.key.type === "Identifier" && member.key.name === "__typename"
|
|
61351
61170
|
);
|
|
@@ -61370,11 +61189,11 @@ function inlineType({
|
|
|
61370
61189
|
];
|
|
61371
61190
|
}
|
|
61372
61191
|
let coveredTypenames;
|
|
61373
|
-
if (
|
|
61192
|
+
if (graphql19.isInterfaceType(fragmentRootType)) {
|
|
61374
61193
|
coveredTypenames = interfaceCoveredTypenames(fragmentRootType);
|
|
61375
|
-
} else if (
|
|
61194
|
+
} else if (graphql19.isUnionType(fragmentRootType)) {
|
|
61376
61195
|
coveredTypenames = fragmentRootType.getTypes().map((type2) => type2.name);
|
|
61377
|
-
} else if (
|
|
61196
|
+
} else if (graphql19.isObjectType(fragmentRootType)) {
|
|
61378
61197
|
coveredTypenames = [fragmentRootType.name];
|
|
61379
61198
|
} else {
|
|
61380
61199
|
throw Error("unreachable code");
|
|
@@ -61410,7 +61229,7 @@ function inlineType({
|
|
|
61410
61229
|
);
|
|
61411
61230
|
}
|
|
61412
61231
|
);
|
|
61413
|
-
const parentIsUnionOrInterface = !
|
|
61232
|
+
const parentIsUnionOrInterface = !graphql19.isInterfaceType(type) && !graphql19.isUnionType(type);
|
|
61414
61233
|
const possibleTypenames = parentIsUnionOrInterface ? [parent.name] : config.schema.getPossibleTypes(type).map((type2) => type2.name);
|
|
61415
61234
|
const coveredTypenames = new Set(
|
|
61416
61235
|
Object.values(inlineFragmentSelections).flatMap((sel) => sel.coveredTypenames)
|
|
@@ -61477,7 +61296,7 @@ function selectionTypeInfo(schema, filepath, rootType, selection) {
|
|
|
61477
61296
|
},
|
|
61478
61297
|
type: schema.getType("String")
|
|
61479
61298
|
};
|
|
61480
|
-
} else if (
|
|
61299
|
+
} else if (graphql19.isNonNullType(rootType) && "getFields" in rootType.ofType) {
|
|
61481
61300
|
fields = rootType.ofType.getFields();
|
|
61482
61301
|
} else {
|
|
61483
61302
|
fields = rootType.getFields();
|
|
@@ -61489,7 +61308,7 @@ function selectionTypeInfo(schema, filepath, rootType, selection) {
|
|
|
61489
61308
|
message: `Could not find type information for field ${rootType.toString()}.${selectionName} ${field}`
|
|
61490
61309
|
});
|
|
61491
61310
|
}
|
|
61492
|
-
const fieldType =
|
|
61311
|
+
const fieldType = graphql19.getNamedType(field.type);
|
|
61493
61312
|
if (!fieldType) {
|
|
61494
61313
|
throw new HoudiniError({
|
|
61495
61314
|
filepath,
|
|
@@ -61705,17 +61524,20 @@ export * from "${module2}"
|
|
|
61705
61524
|
}
|
|
61706
61525
|
}
|
|
61707
61526
|
await fs_exports.writeFile(config.typeIndexPath, indexContent);
|
|
61708
|
-
|
|
61709
|
-
|
|
61710
|
-
|
|
61711
|
-
|
|
61527
|
+
const missingScalarNames = [...missingScalars].filter(
|
|
61528
|
+
(scalar) => !config.configFile.features?.runtimeScalars?.[scalar]
|
|
61529
|
+
);
|
|
61530
|
+
if (missingScalarNames.length > 0) {
|
|
61531
|
+
console.warn(`\u26A0\uFE0F Missing definitions for the following scalars: ${[
|
|
61532
|
+
...missingScalarNames
|
|
61533
|
+
].join(", ")}
|
|
61712
61534
|
Generated types will contain an any type in place of these values. To fix this, provide an equivalent
|
|
61713
61535
|
type in your config file:
|
|
61714
61536
|
|
|
61715
61537
|
{
|
|
61716
61538
|
scalars: {
|
|
61717
61539
|
${cyan2(`/* in your case, something like */`)}
|
|
61718
|
-
${[...
|
|
61540
|
+
${[...missingScalarNames].map(
|
|
61719
61541
|
(c) => ` ${c}: { ${green2(`// <- The GraphQL Scalar`)}
|
|
61720
61542
|
type: "${cyan2(`YourType_${c}`)}" ${green2(`// <- The TypeScript type`)}
|
|
61721
61543
|
}`
|
|
@@ -61994,7 +61816,7 @@ async function generateFragmentTypeDefs(config, filepath, body, selections, defi
|
|
|
61994
61816
|
}
|
|
61995
61817
|
|
|
61996
61818
|
// src/codegen/generators/typescript/imperativeTypeDef.ts
|
|
61997
|
-
var
|
|
61819
|
+
var graphql20 = __toESM(require("graphql"), 1);
|
|
61998
61820
|
var recast12 = __toESM(require_main2(), 1);
|
|
61999
61821
|
var AST12 = recast12.types.builders;
|
|
62000
61822
|
async function imperativeCacheTypef(config, docs) {
|
|
@@ -62046,7 +61868,7 @@ function typeDefinitions(config, filepath, body, docs, returnType) {
|
|
|
62046
61868
|
const operationTypes = [config.schema.getMutationType(), config.schema.getSubscriptionType()].filter(Boolean).map((type) => type?.name);
|
|
62047
61869
|
const visitedTypes = /* @__PURE__ */ new Set();
|
|
62048
61870
|
const types14 = Object.values(config.schema.getTypeMap()).filter(
|
|
62049
|
-
(type) => !
|
|
61871
|
+
(type) => !graphql20.isAbstractType(type) && !graphql20.isScalarType(type) && !graphql20.isEnumType(type) && !graphql20.isInputObjectType(type) && !type.name.startsWith("__") && !operationTypes.includes(type.name)
|
|
62050
61872
|
);
|
|
62051
61873
|
const fragmentMap = fragmentListMap(
|
|
62052
61874
|
config,
|
|
@@ -62063,7 +61885,7 @@ function typeDefinitions(config, filepath, body, docs, returnType) {
|
|
|
62063
61885
|
}
|
|
62064
61886
|
let idFields = AST12.tsNeverKeyword();
|
|
62065
61887
|
const keys2 = keyFieldsForType(config.configFile, type.name);
|
|
62066
|
-
if (
|
|
61888
|
+
if (graphql20.isObjectType(type) && keys2.length > 0 && keys2.every((key) => type.getFields()[key])) {
|
|
62067
61889
|
idFields = AST12.tsTypeLiteral(
|
|
62068
61890
|
keys2.map((key) => {
|
|
62069
61891
|
const fieldType = type.getFields()[key];
|
|
@@ -62090,13 +61912,13 @@ function typeDefinitions(config, filepath, body, docs, returnType) {
|
|
|
62090
61912
|
idFields = AST12.tsTypeLiteral([]);
|
|
62091
61913
|
}
|
|
62092
61914
|
let fields = AST12.tsTypeLiteral([]);
|
|
62093
|
-
if (
|
|
61915
|
+
if (graphql20.isObjectType(type)) {
|
|
62094
61916
|
fields = AST12.tsTypeLiteral(
|
|
62095
61917
|
Object.entries(type.getFields()).map(
|
|
62096
61918
|
([key, fieldType]) => {
|
|
62097
61919
|
const unwrapped = unwrapType(config, fieldType.type);
|
|
62098
61920
|
let typeOptions = AST12.tsUnionType([]);
|
|
62099
|
-
if (
|
|
61921
|
+
if (graphql20.isScalarType(unwrapped.type)) {
|
|
62100
61922
|
typeOptions.types.push(
|
|
62101
61923
|
scalarPropertyValue(
|
|
62102
61924
|
config,
|
|
@@ -62110,11 +61932,11 @@ function typeDefinitions(config, filepath, body, docs, returnType) {
|
|
|
62110
61932
|
}
|
|
62111
61933
|
)
|
|
62112
61934
|
);
|
|
62113
|
-
} else if (
|
|
61935
|
+
} else if (graphql20.isEnumType(unwrapped.type)) {
|
|
62114
61936
|
typeOptions.types.push(
|
|
62115
61937
|
AST12.tsTypeReference(AST12.identifier(unwrapped.type.name))
|
|
62116
61938
|
);
|
|
62117
|
-
} else if (!
|
|
61939
|
+
} else if (!graphql20.isAbstractType(unwrapped.type)) {
|
|
62118
61940
|
typeOptions.types.push(record(unwrapped.type.name));
|
|
62119
61941
|
} else {
|
|
62120
61942
|
typeOptions.types.push(
|
|
@@ -62210,7 +62032,7 @@ function listDefinitions(config, filepath, body, docs) {
|
|
|
62210
62032
|
const lists = [];
|
|
62211
62033
|
const visitedLists = /* @__PURE__ */ new Set();
|
|
62212
62034
|
for (const doc of docs) {
|
|
62213
|
-
|
|
62035
|
+
graphql20.visit(doc.document, {
|
|
62214
62036
|
Directive(node, key, parent2, path2, ancestors) {
|
|
62215
62037
|
if (![config.listDirective, config.paginateDirective].includes(node.name.value)) {
|
|
62216
62038
|
return;
|
|
@@ -62232,7 +62054,7 @@ function listDefinitions(config, filepath, body, docs) {
|
|
|
62232
62054
|
const targetFieldDefinition = parentType.getFields()[targetField.name.value];
|
|
62233
62055
|
const { type: listType } = unwrapType(config, targetFieldDefinition.type);
|
|
62234
62056
|
const possibleTypes = [];
|
|
62235
|
-
if (
|
|
62057
|
+
if (graphql20.isAbstractType(listType)) {
|
|
62236
62058
|
possibleTypes.push(
|
|
62237
62059
|
...config.schema.getPossibleTypes(listType).map((possible) => possible.name)
|
|
62238
62060
|
);
|
|
@@ -62394,7 +62216,7 @@ async function typescriptGenerator(config, docs) {
|
|
|
62394
62216
|
}
|
|
62395
62217
|
|
|
62396
62218
|
// src/codegen/generators/persistedQueries/index.ts
|
|
62397
|
-
var
|
|
62219
|
+
var graphql21 = __toESM(require("graphql"), 1);
|
|
62398
62220
|
async function persistOutputGenerator(config, docs) {
|
|
62399
62221
|
if (!config.persistedQueriesPath.endsWith(".json")) {
|
|
62400
62222
|
throw new Error('Can write Persisted Queries only in a ".json" file.');
|
|
@@ -62404,8 +62226,8 @@ async function persistOutputGenerator(config, docs) {
|
|
|
62404
62226
|
if (!generateArtifact) {
|
|
62405
62227
|
return acc;
|
|
62406
62228
|
}
|
|
62407
|
-
let rawString =
|
|
62408
|
-
|
|
62229
|
+
let rawString = graphql21.print(
|
|
62230
|
+
graphql21.visit(document, {
|
|
62409
62231
|
Directive(node) {
|
|
62410
62232
|
if (config.isInternalDirective(node.name.value)) {
|
|
62411
62233
|
return null;
|
|
@@ -62414,7 +62236,7 @@ async function persistOutputGenerator(config, docs) {
|
|
|
62414
62236
|
})
|
|
62415
62237
|
);
|
|
62416
62238
|
const operations = document.definitions.filter(
|
|
62417
|
-
({ kind }) => kind ===
|
|
62239
|
+
({ kind }) => kind === graphql21.Kind.OPERATION_DEFINITION
|
|
62418
62240
|
);
|
|
62419
62241
|
if (operations.length > 0 && operations[0].kind === "OperationDefinition") {
|
|
62420
62242
|
if (artifact) {
|
|
@@ -62429,33 +62251,45 @@ async function persistOutputGenerator(config, docs) {
|
|
|
62429
62251
|
}
|
|
62430
62252
|
|
|
62431
62253
|
// src/codegen/generators/definitions/index.ts
|
|
62432
|
-
var
|
|
62254
|
+
var graphql23 = __toESM(require("graphql"), 1);
|
|
62433
62255
|
|
|
62434
62256
|
// src/codegen/generators/definitions/enums.ts
|
|
62435
|
-
var
|
|
62257
|
+
var graphql22 = __toESM(require("graphql"), 1);
|
|
62436
62258
|
var recast13 = __toESM(require_main2(), 1);
|
|
62437
62259
|
var AST13 = recast13.types.builders;
|
|
62438
62260
|
async function definitionsGenerator(config) {
|
|
62439
|
-
const enums =
|
|
62261
|
+
const enums = graphql22.parse(graphql22.printSchema(config.schema)).definitions.filter(
|
|
62440
62262
|
(definition) => definition.kind === "EnumTypeDefinition"
|
|
62441
62263
|
).filter((def) => !config.isInternalEnum(def));
|
|
62442
62264
|
const { code: runtimeDefinitions } = await printJS(
|
|
62443
62265
|
AST13.program(
|
|
62444
62266
|
enums.map((defn) => {
|
|
62445
62267
|
const name = defn.name.value;
|
|
62446
|
-
|
|
62268
|
+
const declaration = moduleExport(
|
|
62447
62269
|
config,
|
|
62448
62270
|
name,
|
|
62449
62271
|
AST13.objectExpression(
|
|
62450
62272
|
defn.values?.map((value) => {
|
|
62451
62273
|
const str = value.name.value;
|
|
62452
|
-
|
|
62274
|
+
const prop = AST13.objectProperty(
|
|
62453
62275
|
AST13.stringLiteral(str),
|
|
62454
62276
|
AST13.stringLiteral(str)
|
|
62455
62277
|
);
|
|
62278
|
+
const deprecationReason = value.directives?.find((d) => d.name.value === "deprecated")?.arguments?.find((a) => a.name.value === "reason")?.value?.value;
|
|
62279
|
+
if (value.description || deprecationReason)
|
|
62280
|
+
prop.comments = [
|
|
62281
|
+
jsdocComment(value.description?.value ?? "", deprecationReason)
|
|
62282
|
+
];
|
|
62283
|
+
return prop;
|
|
62456
62284
|
}) || []
|
|
62457
62285
|
)
|
|
62458
62286
|
);
|
|
62287
|
+
if (defn.description) {
|
|
62288
|
+
declaration.comments = [
|
|
62289
|
+
AST13.commentBlock(`* ${defn.description.value} `, true, false)
|
|
62290
|
+
];
|
|
62291
|
+
}
|
|
62292
|
+
return declaration;
|
|
62459
62293
|
})
|
|
62460
62294
|
)
|
|
62461
62295
|
);
|
|
@@ -62464,11 +62298,19 @@ type ValuesOf<T> = T[keyof T]
|
|
|
62464
62298
|
` + enums.sort((a, b) => a.name.value.localeCompare(b.name.value)).map((definition) => {
|
|
62465
62299
|
const name = definition.name.value;
|
|
62466
62300
|
const values = definition.values;
|
|
62467
|
-
|
|
62301
|
+
let jsdoc = "";
|
|
62302
|
+
if (definition.description) {
|
|
62303
|
+
jsdoc = `
|
|
62304
|
+
/** ${definition.description.value} */`;
|
|
62305
|
+
}
|
|
62306
|
+
return `${jsdoc}
|
|
62468
62307
|
export declare const ${name}: {
|
|
62469
|
-
${values?.map(
|
|
62308
|
+
${values?.map(
|
|
62309
|
+
(value) => (value.description ? ` /** ${value.description.value} */
|
|
62310
|
+
` : "") + ` readonly ${value.name.value}: "${value.name.value}";`
|
|
62311
|
+
).join("\n")}
|
|
62470
62312
|
}
|
|
62471
|
-
|
|
62313
|
+
${jsdoc}
|
|
62472
62314
|
export type ${name}$options = ValuesOf<typeof ${name}>
|
|
62473
62315
|
`;
|
|
62474
62316
|
}).join("");
|
|
@@ -62488,7 +62330,7 @@ async function schemaGenerator(config) {
|
|
|
62488
62330
|
await Promise.all([
|
|
62489
62331
|
fs_exports.writeFile(
|
|
62490
62332
|
config.definitionsSchemaPath,
|
|
62491
|
-
config.localSchema ?
|
|
62333
|
+
config.localSchema ? graphql23.printSchema(config.schema) : config.newSchema
|
|
62492
62334
|
),
|
|
62493
62335
|
fs_exports.writeFile(config.definitionsDocumentsPath, config.newDocuments),
|
|
62494
62336
|
definitionsGenerator(config)
|
|
@@ -62533,7 +62375,7 @@ async function writeIndexFile2(config, docs) {
|
|
|
62533
62375
|
}
|
|
62534
62376
|
|
|
62535
62377
|
// ../../node_modules/.pnpm/@graphql-tools+utils@10.0.6_graphql@15.5.0/node_modules/@graphql-tools/utils/esm/helpers.js
|
|
62536
|
-
var
|
|
62378
|
+
var import_graphql3 = require("graphql");
|
|
62537
62379
|
function compareStrings(a, b) {
|
|
62538
62380
|
if (String(a) < String(b)) {
|
|
62539
62381
|
return -1;
|
|
@@ -62569,7 +62411,7 @@ function isSome(input) {
|
|
|
62569
62411
|
}
|
|
62570
62412
|
|
|
62571
62413
|
// ../../node_modules/.pnpm/@graphql-tools+utils@10.0.6_graphql@15.5.0/node_modules/@graphql-tools/utils/esm/inspect.js
|
|
62572
|
-
var
|
|
62414
|
+
var import_graphql4 = require("graphql");
|
|
62573
62415
|
var MAX_RECURSIVE_DEPTH = 3;
|
|
62574
62416
|
function inspect(value) {
|
|
62575
62417
|
return formatValue(value, []);
|
|
@@ -62587,7 +62429,7 @@ function formatValue(value, seenValues) {
|
|
|
62587
62429
|
}
|
|
62588
62430
|
}
|
|
62589
62431
|
function formatError(value) {
|
|
62590
|
-
if (value instanceof
|
|
62432
|
+
if (value instanceof import_graphql4.GraphQLError) {
|
|
62591
62433
|
return value.toString();
|
|
62592
62434
|
}
|
|
62593
62435
|
return `${value.name}: ${value.message};
|
|
@@ -62670,43 +62512,43 @@ function getDirectivesInExtensions(node, pathToDirectivesInExtensions = ["direct
|
|
|
62670
62512
|
}
|
|
62671
62513
|
|
|
62672
62514
|
// ../../node_modules/.pnpm/@graphql-tools+utils@10.0.6_graphql@15.5.0/node_modules/@graphql-tools/utils/esm/print-schema-with-directives.js
|
|
62673
|
-
var
|
|
62515
|
+
var import_graphql8 = require("graphql");
|
|
62674
62516
|
|
|
62675
62517
|
// ../../node_modules/.pnpm/@graphql-tools+utils@10.0.6_graphql@15.5.0/node_modules/@graphql-tools/utils/esm/astFromType.js
|
|
62676
|
-
var
|
|
62518
|
+
var import_graphql5 = require("graphql");
|
|
62677
62519
|
function astFromType(type) {
|
|
62678
|
-
if ((0,
|
|
62520
|
+
if ((0, import_graphql5.isNonNullType)(type)) {
|
|
62679
62521
|
const innerType = astFromType(type.ofType);
|
|
62680
|
-
if (innerType.kind ===
|
|
62522
|
+
if (innerType.kind === import_graphql5.Kind.NON_NULL_TYPE) {
|
|
62681
62523
|
throw new Error(`Invalid type node ${inspect(type)}. Inner type of non-null type cannot be a non-null type.`);
|
|
62682
62524
|
}
|
|
62683
62525
|
return {
|
|
62684
|
-
kind:
|
|
62526
|
+
kind: import_graphql5.Kind.NON_NULL_TYPE,
|
|
62685
62527
|
type: innerType
|
|
62686
62528
|
};
|
|
62687
|
-
} else if ((0,
|
|
62529
|
+
} else if ((0, import_graphql5.isListType)(type)) {
|
|
62688
62530
|
return {
|
|
62689
|
-
kind:
|
|
62531
|
+
kind: import_graphql5.Kind.LIST_TYPE,
|
|
62690
62532
|
type: astFromType(type.ofType)
|
|
62691
62533
|
};
|
|
62692
62534
|
}
|
|
62693
62535
|
return {
|
|
62694
|
-
kind:
|
|
62536
|
+
kind: import_graphql5.Kind.NAMED_TYPE,
|
|
62695
62537
|
name: {
|
|
62696
|
-
kind:
|
|
62538
|
+
kind: import_graphql5.Kind.NAME,
|
|
62697
62539
|
value: type.name
|
|
62698
62540
|
}
|
|
62699
62541
|
};
|
|
62700
62542
|
}
|
|
62701
62543
|
|
|
62702
62544
|
// ../../node_modules/.pnpm/@graphql-tools+utils@10.0.6_graphql@15.5.0/node_modules/@graphql-tools/utils/esm/astFromValue.js
|
|
62703
|
-
var
|
|
62545
|
+
var import_graphql7 = require("graphql");
|
|
62704
62546
|
|
|
62705
62547
|
// ../../node_modules/.pnpm/@graphql-tools+utils@10.0.6_graphql@15.5.0/node_modules/@graphql-tools/utils/esm/astFromValueUntyped.js
|
|
62706
|
-
var
|
|
62548
|
+
var import_graphql6 = require("graphql");
|
|
62707
62549
|
function astFromValueUntyped(value) {
|
|
62708
62550
|
if (value === null) {
|
|
62709
|
-
return { kind:
|
|
62551
|
+
return { kind: import_graphql6.Kind.NULL };
|
|
62710
62552
|
}
|
|
62711
62553
|
if (value === void 0) {
|
|
62712
62554
|
return null;
|
|
@@ -62719,7 +62561,7 @@ function astFromValueUntyped(value) {
|
|
|
62719
62561
|
valuesNodes.push(itemNode);
|
|
62720
62562
|
}
|
|
62721
62563
|
}
|
|
62722
|
-
return { kind:
|
|
62564
|
+
return { kind: import_graphql6.Kind.LIST, values: valuesNodes };
|
|
62723
62565
|
}
|
|
62724
62566
|
if (typeof value === "object") {
|
|
62725
62567
|
const fieldNodes = [];
|
|
@@ -62728,26 +62570,26 @@ function astFromValueUntyped(value) {
|
|
|
62728
62570
|
const ast = astFromValueUntyped(fieldValue);
|
|
62729
62571
|
if (ast) {
|
|
62730
62572
|
fieldNodes.push({
|
|
62731
|
-
kind:
|
|
62732
|
-
name: { kind:
|
|
62573
|
+
kind: import_graphql6.Kind.OBJECT_FIELD,
|
|
62574
|
+
name: { kind: import_graphql6.Kind.NAME, value: fieldName },
|
|
62733
62575
|
value: ast
|
|
62734
62576
|
});
|
|
62735
62577
|
}
|
|
62736
62578
|
}
|
|
62737
|
-
return { kind:
|
|
62579
|
+
return { kind: import_graphql6.Kind.OBJECT, fields: fieldNodes };
|
|
62738
62580
|
}
|
|
62739
62581
|
if (typeof value === "boolean") {
|
|
62740
|
-
return { kind:
|
|
62582
|
+
return { kind: import_graphql6.Kind.BOOLEAN, value };
|
|
62741
62583
|
}
|
|
62742
62584
|
if (typeof value === "bigint") {
|
|
62743
|
-
return { kind:
|
|
62585
|
+
return { kind: import_graphql6.Kind.INT, value: String(value) };
|
|
62744
62586
|
}
|
|
62745
62587
|
if (typeof value === "number" && isFinite(value)) {
|
|
62746
62588
|
const stringNum = String(value);
|
|
62747
|
-
return integerStringRegExp.test(stringNum) ? { kind:
|
|
62589
|
+
return integerStringRegExp.test(stringNum) ? { kind: import_graphql6.Kind.INT, value: stringNum } : { kind: import_graphql6.Kind.FLOAT, value: stringNum };
|
|
62748
62590
|
}
|
|
62749
62591
|
if (typeof value === "string") {
|
|
62750
|
-
return { kind:
|
|
62592
|
+
return { kind: import_graphql6.Kind.STRING, value };
|
|
62751
62593
|
}
|
|
62752
62594
|
throw new TypeError(`Cannot convert value to AST: ${value}.`);
|
|
62753
62595
|
}
|
|
@@ -62755,20 +62597,20 @@ var integerStringRegExp = /^-?(?:0|[1-9][0-9]*)$/;
|
|
|
62755
62597
|
|
|
62756
62598
|
// ../../node_modules/.pnpm/@graphql-tools+utils@10.0.6_graphql@15.5.0/node_modules/@graphql-tools/utils/esm/astFromValue.js
|
|
62757
62599
|
function astFromValue(value, type) {
|
|
62758
|
-
if ((0,
|
|
62600
|
+
if ((0, import_graphql7.isNonNullType)(type)) {
|
|
62759
62601
|
const astValue = astFromValue(value, type.ofType);
|
|
62760
|
-
if (astValue?.kind ===
|
|
62602
|
+
if (astValue?.kind === import_graphql7.Kind.NULL) {
|
|
62761
62603
|
return null;
|
|
62762
62604
|
}
|
|
62763
62605
|
return astValue;
|
|
62764
62606
|
}
|
|
62765
62607
|
if (value === null) {
|
|
62766
|
-
return { kind:
|
|
62608
|
+
return { kind: import_graphql7.Kind.NULL };
|
|
62767
62609
|
}
|
|
62768
62610
|
if (value === void 0) {
|
|
62769
62611
|
return null;
|
|
62770
62612
|
}
|
|
62771
|
-
if ((0,
|
|
62613
|
+
if ((0, import_graphql7.isListType)(type)) {
|
|
62772
62614
|
const itemType = type.ofType;
|
|
62773
62615
|
if (isIterableObject(value)) {
|
|
62774
62616
|
const valuesNodes = [];
|
|
@@ -62778,11 +62620,11 @@ function astFromValue(value, type) {
|
|
|
62778
62620
|
valuesNodes.push(itemNode);
|
|
62779
62621
|
}
|
|
62780
62622
|
}
|
|
62781
|
-
return { kind:
|
|
62623
|
+
return { kind: import_graphql7.Kind.LIST, values: valuesNodes };
|
|
62782
62624
|
}
|
|
62783
62625
|
return astFromValue(value, itemType);
|
|
62784
62626
|
}
|
|
62785
|
-
if ((0,
|
|
62627
|
+
if ((0, import_graphql7.isInputObjectType)(type)) {
|
|
62786
62628
|
if (!isObjectLike(value)) {
|
|
62787
62629
|
return null;
|
|
62788
62630
|
}
|
|
@@ -62791,24 +62633,24 @@ function astFromValue(value, type) {
|
|
|
62791
62633
|
const fieldValue = astFromValue(value[field.name], field.type);
|
|
62792
62634
|
if (fieldValue) {
|
|
62793
62635
|
fieldNodes.push({
|
|
62794
|
-
kind:
|
|
62795
|
-
name: { kind:
|
|
62636
|
+
kind: import_graphql7.Kind.OBJECT_FIELD,
|
|
62637
|
+
name: { kind: import_graphql7.Kind.NAME, value: field.name },
|
|
62796
62638
|
value: fieldValue
|
|
62797
62639
|
});
|
|
62798
62640
|
}
|
|
62799
62641
|
}
|
|
62800
|
-
return { kind:
|
|
62642
|
+
return { kind: import_graphql7.Kind.OBJECT, fields: fieldNodes };
|
|
62801
62643
|
}
|
|
62802
|
-
if ((0,
|
|
62644
|
+
if ((0, import_graphql7.isLeafType)(type)) {
|
|
62803
62645
|
const serialized = type.serialize(value);
|
|
62804
62646
|
if (serialized == null) {
|
|
62805
62647
|
return null;
|
|
62806
62648
|
}
|
|
62807
|
-
if ((0,
|
|
62808
|
-
return { kind:
|
|
62649
|
+
if ((0, import_graphql7.isEnumType)(type)) {
|
|
62650
|
+
return { kind: import_graphql7.Kind.ENUM, value: serialized };
|
|
62809
62651
|
}
|
|
62810
62652
|
if (type.name === "ID" && typeof serialized === "string" && integerStringRegExp2.test(serialized)) {
|
|
62811
|
-
return { kind:
|
|
62653
|
+
return { kind: import_graphql7.Kind.INT, value: serialized };
|
|
62812
62654
|
}
|
|
62813
62655
|
return astFromValueUntyped(serialized);
|
|
62814
62656
|
}
|
|
@@ -62864,36 +62706,36 @@ function getDocumentNodeFromSchema(schema, options = {}) {
|
|
|
62864
62706
|
const definitions = schemaNode != null ? [schemaNode] : [];
|
|
62865
62707
|
const directives = schema.getDirectives();
|
|
62866
62708
|
for (const directive of directives) {
|
|
62867
|
-
if ((0,
|
|
62709
|
+
if ((0, import_graphql8.isSpecifiedDirective)(directive)) {
|
|
62868
62710
|
continue;
|
|
62869
62711
|
}
|
|
62870
62712
|
definitions.push(astFromDirective(directive, schema, pathToDirectivesInExtensions));
|
|
62871
62713
|
}
|
|
62872
62714
|
for (const typeName in typesMap) {
|
|
62873
62715
|
const type = typesMap[typeName];
|
|
62874
|
-
const isPredefinedScalar = (0,
|
|
62875
|
-
const isIntrospection = (0,
|
|
62716
|
+
const isPredefinedScalar = (0, import_graphql8.isSpecifiedScalarType)(type);
|
|
62717
|
+
const isIntrospection = (0, import_graphql8.isIntrospectionType)(type);
|
|
62876
62718
|
if (isPredefinedScalar || isIntrospection) {
|
|
62877
62719
|
continue;
|
|
62878
62720
|
}
|
|
62879
|
-
if ((0,
|
|
62721
|
+
if ((0, import_graphql8.isObjectType)(type)) {
|
|
62880
62722
|
definitions.push(astFromObjectType(type, schema, pathToDirectivesInExtensions));
|
|
62881
|
-
} else if ((0,
|
|
62723
|
+
} else if ((0, import_graphql8.isInterfaceType)(type)) {
|
|
62882
62724
|
definitions.push(astFromInterfaceType(type, schema, pathToDirectivesInExtensions));
|
|
62883
|
-
} else if ((0,
|
|
62725
|
+
} else if ((0, import_graphql8.isUnionType)(type)) {
|
|
62884
62726
|
definitions.push(astFromUnionType(type, schema, pathToDirectivesInExtensions));
|
|
62885
|
-
} else if ((0,
|
|
62727
|
+
} else if ((0, import_graphql8.isInputObjectType)(type)) {
|
|
62886
62728
|
definitions.push(astFromInputObjectType(type, schema, pathToDirectivesInExtensions));
|
|
62887
|
-
} else if ((0,
|
|
62729
|
+
} else if ((0, import_graphql8.isEnumType)(type)) {
|
|
62888
62730
|
definitions.push(astFromEnumType(type, schema, pathToDirectivesInExtensions));
|
|
62889
|
-
} else if ((0,
|
|
62731
|
+
} else if ((0, import_graphql8.isScalarType)(type)) {
|
|
62890
62732
|
definitions.push(astFromScalarType(type, schema, pathToDirectivesInExtensions));
|
|
62891
62733
|
} else {
|
|
62892
62734
|
throw new Error(`Unknown type ${type}.`);
|
|
62893
62735
|
}
|
|
62894
62736
|
}
|
|
62895
62737
|
return {
|
|
62896
|
-
kind:
|
|
62738
|
+
kind: import_graphql8.Kind.DOCUMENT,
|
|
62897
62739
|
definitions
|
|
62898
62740
|
};
|
|
62899
62741
|
}
|
|
@@ -62928,7 +62770,7 @@ function astFromSchema(schema, pathToDirectivesInExtensions) {
|
|
|
62928
62770
|
operationTypeDefinitionNode.type = rootTypeAST;
|
|
62929
62771
|
} else {
|
|
62930
62772
|
operationTypeMap.set(operationTypeNode, {
|
|
62931
|
-
kind:
|
|
62773
|
+
kind: import_graphql8.Kind.OPERATION_TYPE_DEFINITION,
|
|
62932
62774
|
operation: operationTypeNode,
|
|
62933
62775
|
type: rootTypeAST
|
|
62934
62776
|
});
|
|
@@ -62941,12 +62783,12 @@ function astFromSchema(schema, pathToDirectivesInExtensions) {
|
|
|
62941
62783
|
return null;
|
|
62942
62784
|
}
|
|
62943
62785
|
const schemaNode = {
|
|
62944
|
-
kind: operationTypes != null ?
|
|
62786
|
+
kind: operationTypes != null ? import_graphql8.Kind.SCHEMA_DEFINITION : import_graphql8.Kind.SCHEMA_EXTENSION,
|
|
62945
62787
|
operationTypes,
|
|
62946
62788
|
directives
|
|
62947
62789
|
};
|
|
62948
62790
|
schemaNode.description = schema.astNode?.description ?? schema.description != null ? {
|
|
62949
|
-
kind:
|
|
62791
|
+
kind: import_graphql8.Kind.STRING,
|
|
62950
62792
|
value: schema.description,
|
|
62951
62793
|
block: true
|
|
62952
62794
|
} : void 0;
|
|
@@ -62954,19 +62796,19 @@ function astFromSchema(schema, pathToDirectivesInExtensions) {
|
|
|
62954
62796
|
}
|
|
62955
62797
|
function astFromDirective(directive, schema, pathToDirectivesInExtensions) {
|
|
62956
62798
|
return {
|
|
62957
|
-
kind:
|
|
62799
|
+
kind: import_graphql8.Kind.DIRECTIVE_DEFINITION,
|
|
62958
62800
|
description: directive.astNode?.description ?? (directive.description ? {
|
|
62959
|
-
kind:
|
|
62801
|
+
kind: import_graphql8.Kind.STRING,
|
|
62960
62802
|
value: directive.description
|
|
62961
62803
|
} : void 0),
|
|
62962
62804
|
name: {
|
|
62963
|
-
kind:
|
|
62805
|
+
kind: import_graphql8.Kind.NAME,
|
|
62964
62806
|
value: directive.name
|
|
62965
62807
|
},
|
|
62966
62808
|
arguments: directive.args?.map((arg) => astFromArg(arg, schema, pathToDirectivesInExtensions)),
|
|
62967
62809
|
repeatable: directive.isRepeatable,
|
|
62968
62810
|
locations: directive.locations?.map((location) => ({
|
|
62969
|
-
kind:
|
|
62811
|
+
kind: import_graphql8.Kind.NAME,
|
|
62970
62812
|
value: location
|
|
62971
62813
|
})) || []
|
|
62972
62814
|
};
|
|
@@ -63016,14 +62858,14 @@ function getDeprecatableDirectiveNodes(entity, schema, pathToDirectivesInExtensi
|
|
|
63016
62858
|
}
|
|
63017
62859
|
function astFromArg(arg, schema, pathToDirectivesInExtensions) {
|
|
63018
62860
|
return {
|
|
63019
|
-
kind:
|
|
62861
|
+
kind: import_graphql8.Kind.INPUT_VALUE_DEFINITION,
|
|
63020
62862
|
description: arg.astNode?.description ?? (arg.description ? {
|
|
63021
|
-
kind:
|
|
62863
|
+
kind: import_graphql8.Kind.STRING,
|
|
63022
62864
|
value: arg.description,
|
|
63023
62865
|
block: true
|
|
63024
62866
|
} : void 0),
|
|
63025
62867
|
name: {
|
|
63026
|
-
kind:
|
|
62868
|
+
kind: import_graphql8.Kind.NAME,
|
|
63027
62869
|
value: arg.name
|
|
63028
62870
|
},
|
|
63029
62871
|
type: astFromType(arg.type),
|
|
@@ -63033,14 +62875,14 @@ function astFromArg(arg, schema, pathToDirectivesInExtensions) {
|
|
|
63033
62875
|
}
|
|
63034
62876
|
function astFromObjectType(type, schema, pathToDirectivesInExtensions) {
|
|
63035
62877
|
return {
|
|
63036
|
-
kind:
|
|
62878
|
+
kind: import_graphql8.Kind.OBJECT_TYPE_DEFINITION,
|
|
63037
62879
|
description: type.astNode?.description ?? (type.description ? {
|
|
63038
|
-
kind:
|
|
62880
|
+
kind: import_graphql8.Kind.STRING,
|
|
63039
62881
|
value: type.description,
|
|
63040
62882
|
block: true
|
|
63041
62883
|
} : void 0),
|
|
63042
62884
|
name: {
|
|
63043
|
-
kind:
|
|
62885
|
+
kind: import_graphql8.Kind.NAME,
|
|
63044
62886
|
value: type.name
|
|
63045
62887
|
},
|
|
63046
62888
|
fields: Object.values(type.getFields()).map((field) => astFromField(field, schema, pathToDirectivesInExtensions)),
|
|
@@ -63050,14 +62892,14 @@ function astFromObjectType(type, schema, pathToDirectivesInExtensions) {
|
|
|
63050
62892
|
}
|
|
63051
62893
|
function astFromInterfaceType(type, schema, pathToDirectivesInExtensions) {
|
|
63052
62894
|
const node = {
|
|
63053
|
-
kind:
|
|
62895
|
+
kind: import_graphql8.Kind.INTERFACE_TYPE_DEFINITION,
|
|
63054
62896
|
description: type.astNode?.description ?? (type.description ? {
|
|
63055
|
-
kind:
|
|
62897
|
+
kind: import_graphql8.Kind.STRING,
|
|
63056
62898
|
value: type.description,
|
|
63057
62899
|
block: true
|
|
63058
62900
|
} : void 0),
|
|
63059
62901
|
name: {
|
|
63060
|
-
kind:
|
|
62902
|
+
kind: import_graphql8.Kind.NAME,
|
|
63061
62903
|
value: type.name
|
|
63062
62904
|
},
|
|
63063
62905
|
fields: Object.values(type.getFields()).map((field) => astFromField(field, schema, pathToDirectivesInExtensions)),
|
|
@@ -63070,14 +62912,14 @@ function astFromInterfaceType(type, schema, pathToDirectivesInExtensions) {
|
|
|
63070
62912
|
}
|
|
63071
62913
|
function astFromUnionType(type, schema, pathToDirectivesInExtensions) {
|
|
63072
62914
|
return {
|
|
63073
|
-
kind:
|
|
62915
|
+
kind: import_graphql8.Kind.UNION_TYPE_DEFINITION,
|
|
63074
62916
|
description: type.astNode?.description ?? (type.description ? {
|
|
63075
|
-
kind:
|
|
62917
|
+
kind: import_graphql8.Kind.STRING,
|
|
63076
62918
|
value: type.description,
|
|
63077
62919
|
block: true
|
|
63078
62920
|
} : void 0),
|
|
63079
62921
|
name: {
|
|
63080
|
-
kind:
|
|
62922
|
+
kind: import_graphql8.Kind.NAME,
|
|
63081
62923
|
value: type.name
|
|
63082
62924
|
},
|
|
63083
62925
|
directives: getDirectiveNodes(type, schema, pathToDirectivesInExtensions),
|
|
@@ -63086,14 +62928,14 @@ function astFromUnionType(type, schema, pathToDirectivesInExtensions) {
|
|
|
63086
62928
|
}
|
|
63087
62929
|
function astFromInputObjectType(type, schema, pathToDirectivesInExtensions) {
|
|
63088
62930
|
return {
|
|
63089
|
-
kind:
|
|
62931
|
+
kind: import_graphql8.Kind.INPUT_OBJECT_TYPE_DEFINITION,
|
|
63090
62932
|
description: type.astNode?.description ?? (type.description ? {
|
|
63091
|
-
kind:
|
|
62933
|
+
kind: import_graphql8.Kind.STRING,
|
|
63092
62934
|
value: type.description,
|
|
63093
62935
|
block: true
|
|
63094
62936
|
} : void 0),
|
|
63095
62937
|
name: {
|
|
63096
|
-
kind:
|
|
62938
|
+
kind: import_graphql8.Kind.NAME,
|
|
63097
62939
|
value: type.name
|
|
63098
62940
|
},
|
|
63099
62941
|
fields: Object.values(type.getFields()).map((field) => astFromInputField(field, schema, pathToDirectivesInExtensions)),
|
|
@@ -63102,14 +62944,14 @@ function astFromInputObjectType(type, schema, pathToDirectivesInExtensions) {
|
|
|
63102
62944
|
}
|
|
63103
62945
|
function astFromEnumType(type, schema, pathToDirectivesInExtensions) {
|
|
63104
62946
|
return {
|
|
63105
|
-
kind:
|
|
62947
|
+
kind: import_graphql8.Kind.ENUM_TYPE_DEFINITION,
|
|
63106
62948
|
description: type.astNode?.description ?? (type.description ? {
|
|
63107
|
-
kind:
|
|
62949
|
+
kind: import_graphql8.Kind.STRING,
|
|
63108
62950
|
value: type.description,
|
|
63109
62951
|
block: true
|
|
63110
62952
|
} : void 0),
|
|
63111
62953
|
name: {
|
|
63112
|
-
kind:
|
|
62954
|
+
kind: import_graphql8.Kind.NAME,
|
|
63113
62955
|
value: type.name
|
|
63114
62956
|
},
|
|
63115
62957
|
values: Object.values(type.getValues()).map((value) => astFromEnumValue(value, schema, pathToDirectivesInExtensions)),
|
|
@@ -63127,14 +62969,14 @@ function astFromScalarType(type, schema, pathToDirectivesInExtensions) {
|
|
|
63127
62969
|
directives.push(makeDirectiveNode("specifiedBy", specifiedByArgs));
|
|
63128
62970
|
}
|
|
63129
62971
|
return {
|
|
63130
|
-
kind:
|
|
62972
|
+
kind: import_graphql8.Kind.SCALAR_TYPE_DEFINITION,
|
|
63131
62973
|
description: type.astNode?.description ?? (type.description ? {
|
|
63132
|
-
kind:
|
|
62974
|
+
kind: import_graphql8.Kind.STRING,
|
|
63133
62975
|
value: type.description,
|
|
63134
62976
|
block: true
|
|
63135
62977
|
} : void 0),
|
|
63136
62978
|
name: {
|
|
63137
|
-
kind:
|
|
62979
|
+
kind: import_graphql8.Kind.NAME,
|
|
63138
62980
|
value: type.name
|
|
63139
62981
|
},
|
|
63140
62982
|
directives
|
|
@@ -63142,14 +62984,14 @@ function astFromScalarType(type, schema, pathToDirectivesInExtensions) {
|
|
|
63142
62984
|
}
|
|
63143
62985
|
function astFromField(field, schema, pathToDirectivesInExtensions) {
|
|
63144
62986
|
return {
|
|
63145
|
-
kind:
|
|
62987
|
+
kind: import_graphql8.Kind.FIELD_DEFINITION,
|
|
63146
62988
|
description: field.astNode?.description ?? (field.description ? {
|
|
63147
|
-
kind:
|
|
62989
|
+
kind: import_graphql8.Kind.STRING,
|
|
63148
62990
|
value: field.description,
|
|
63149
62991
|
block: true
|
|
63150
62992
|
} : void 0),
|
|
63151
62993
|
name: {
|
|
63152
|
-
kind:
|
|
62994
|
+
kind: import_graphql8.Kind.NAME,
|
|
63153
62995
|
value: field.name
|
|
63154
62996
|
},
|
|
63155
62997
|
arguments: field.args.map((arg) => astFromArg(arg, schema, pathToDirectivesInExtensions)),
|
|
@@ -63159,14 +63001,14 @@ function astFromField(field, schema, pathToDirectivesInExtensions) {
|
|
|
63159
63001
|
}
|
|
63160
63002
|
function astFromInputField(field, schema, pathToDirectivesInExtensions) {
|
|
63161
63003
|
return {
|
|
63162
|
-
kind:
|
|
63004
|
+
kind: import_graphql8.Kind.INPUT_VALUE_DEFINITION,
|
|
63163
63005
|
description: field.astNode?.description ?? (field.description ? {
|
|
63164
|
-
kind:
|
|
63006
|
+
kind: import_graphql8.Kind.STRING,
|
|
63165
63007
|
value: field.description,
|
|
63166
63008
|
block: true
|
|
63167
63009
|
} : void 0),
|
|
63168
63010
|
name: {
|
|
63169
|
-
kind:
|
|
63011
|
+
kind: import_graphql8.Kind.NAME,
|
|
63170
63012
|
value: field.name
|
|
63171
63013
|
},
|
|
63172
63014
|
type: astFromType(field.type),
|
|
@@ -63176,21 +63018,21 @@ function astFromInputField(field, schema, pathToDirectivesInExtensions) {
|
|
|
63176
63018
|
}
|
|
63177
63019
|
function astFromEnumValue(value, schema, pathToDirectivesInExtensions) {
|
|
63178
63020
|
return {
|
|
63179
|
-
kind:
|
|
63021
|
+
kind: import_graphql8.Kind.ENUM_VALUE_DEFINITION,
|
|
63180
63022
|
description: value.astNode?.description ?? (value.description ? {
|
|
63181
|
-
kind:
|
|
63023
|
+
kind: import_graphql8.Kind.STRING,
|
|
63182
63024
|
value: value.description,
|
|
63183
63025
|
block: true
|
|
63184
63026
|
} : void 0),
|
|
63185
63027
|
name: {
|
|
63186
|
-
kind:
|
|
63028
|
+
kind: import_graphql8.Kind.NAME,
|
|
63187
63029
|
value: value.name
|
|
63188
63030
|
},
|
|
63189
63031
|
directives: getDeprecatableDirectiveNodes(value, schema, pathToDirectivesInExtensions)
|
|
63190
63032
|
};
|
|
63191
63033
|
}
|
|
63192
63034
|
function makeDeprecatedDirective(deprecationReason) {
|
|
63193
|
-
return makeDirectiveNode("deprecated", { reason: deprecationReason },
|
|
63035
|
+
return makeDirectiveNode("deprecated", { reason: deprecationReason }, import_graphql8.GraphQLDeprecatedDirective);
|
|
63194
63036
|
}
|
|
63195
63037
|
function makeDirectiveNode(name, args, directive) {
|
|
63196
63038
|
const directiveArguments = [];
|
|
@@ -63202,9 +63044,9 @@ function makeDirectiveNode(name, args, directive) {
|
|
|
63202
63044
|
const value = astFromValue(argValue, arg.type);
|
|
63203
63045
|
if (value) {
|
|
63204
63046
|
directiveArguments.push({
|
|
63205
|
-
kind:
|
|
63047
|
+
kind: import_graphql8.Kind.ARGUMENT,
|
|
63206
63048
|
name: {
|
|
63207
|
-
kind:
|
|
63049
|
+
kind: import_graphql8.Kind.NAME,
|
|
63208
63050
|
value: argName
|
|
63209
63051
|
},
|
|
63210
63052
|
value
|
|
@@ -63218,9 +63060,9 @@ function makeDirectiveNode(name, args, directive) {
|
|
|
63218
63060
|
const value = astFromValueUntyped(argValue);
|
|
63219
63061
|
if (value) {
|
|
63220
63062
|
directiveArguments.push({
|
|
63221
|
-
kind:
|
|
63063
|
+
kind: import_graphql8.Kind.ARGUMENT,
|
|
63222
63064
|
name: {
|
|
63223
|
-
kind:
|
|
63065
|
+
kind: import_graphql8.Kind.NAME,
|
|
63224
63066
|
value: argName
|
|
63225
63067
|
},
|
|
63226
63068
|
value
|
|
@@ -63229,9 +63071,9 @@ function makeDirectiveNode(name, args, directive) {
|
|
|
63229
63071
|
}
|
|
63230
63072
|
}
|
|
63231
63073
|
return {
|
|
63232
|
-
kind:
|
|
63074
|
+
kind: import_graphql8.Kind.DIRECTIVE,
|
|
63233
63075
|
name: {
|
|
63234
|
-
kind:
|
|
63076
|
+
kind: import_graphql8.Kind.NAME,
|
|
63235
63077
|
value: name
|
|
63236
63078
|
},
|
|
63237
63079
|
arguments: directiveArguments
|
|
@@ -63254,7 +63096,7 @@ function makeDirectiveNodes(schema, directiveValues) {
|
|
|
63254
63096
|
}
|
|
63255
63097
|
|
|
63256
63098
|
// ../../node_modules/.pnpm/@graphql-tools+utils@10.0.6_graphql@15.5.0/node_modules/@graphql-tools/utils/esm/comments.js
|
|
63257
|
-
var
|
|
63099
|
+
var import_graphql9 = require("graphql");
|
|
63258
63100
|
var MAX_LINE_LENGTH = 80;
|
|
63259
63101
|
var commentsRegistry = {};
|
|
63260
63102
|
function resetComments() {
|
|
@@ -63499,7 +63341,7 @@ var printDocASTReducerWithComments = Object.keys(printDocASTReducer).reduce((pre
|
|
|
63499
63341
|
}
|
|
63500
63342
|
}), {});
|
|
63501
63343
|
function printWithComments(ast) {
|
|
63502
|
-
return (0,
|
|
63344
|
+
return (0, import_graphql9.visit)(ast, printDocASTReducerWithComments);
|
|
63503
63345
|
}
|
|
63504
63346
|
function isFieldDefinitionNode(node) {
|
|
63505
63347
|
return node.kind === "FieldDefinition";
|
|
@@ -63518,7 +63360,7 @@ function getLeadingCommentBlock(node) {
|
|
|
63518
63360
|
}
|
|
63519
63361
|
const comments = [];
|
|
63520
63362
|
let token = loc.startToken.prev;
|
|
63521
|
-
while (token != null && token.kind ===
|
|
63363
|
+
while (token != null && token.kind === import_graphql9.TokenKind.COMMENT && token.next != null && token.prev != null && token.line + 1 === token.next.line && token.line !== token.prev.line) {
|
|
63522
63364
|
const value = String(token.value);
|
|
63523
63365
|
comments.push(value);
|
|
63524
63366
|
token = token.prev;
|
|
@@ -63570,9 +63412,9 @@ function isBlank(str) {
|
|
|
63570
63412
|
}
|
|
63571
63413
|
|
|
63572
63414
|
// ../../node_modules/.pnpm/@graphql-tools+utils@10.0.6_graphql@15.5.0/node_modules/@graphql-tools/utils/esm/isDocumentNode.js
|
|
63573
|
-
var
|
|
63415
|
+
var import_graphql10 = require("graphql");
|
|
63574
63416
|
function isDocumentNode(object) {
|
|
63575
|
-
return object && typeof object === "object" && "kind" in object && object.kind ===
|
|
63417
|
+
return object && typeof object === "object" && "kind" in object && object.kind === import_graphql10.Kind.DOCUMENT;
|
|
63576
63418
|
}
|
|
63577
63419
|
|
|
63578
63420
|
// ../../node_modules/.pnpm/@graphql-tools+merge@9.0.0_graphql@15.5.0/node_modules/@graphql-tools/merge/esm/typedefs-mergers/arguments.js
|
|
@@ -63596,7 +63438,7 @@ function deduplicateArguments(args, config) {
|
|
|
63596
63438
|
}
|
|
63597
63439
|
|
|
63598
63440
|
// ../../node_modules/.pnpm/@graphql-tools+merge@9.0.0_graphql@15.5.0/node_modules/@graphql-tools/merge/esm/typedefs-mergers/directives.js
|
|
63599
|
-
var
|
|
63441
|
+
var import_graphql11 = require("graphql");
|
|
63600
63442
|
function directiveAlreadyExists(directivesArr, otherDirective) {
|
|
63601
63443
|
return !!directivesArr.find((directive) => directive.name.value === otherDirective.name.value);
|
|
63602
63444
|
}
|
|
@@ -63656,11 +63498,11 @@ function mergeDirectives(d1 = [], d2 = [], config, directives) {
|
|
|
63656
63498
|
return result;
|
|
63657
63499
|
}
|
|
63658
63500
|
function validateInputs(node, existingNode) {
|
|
63659
|
-
const printedNode = (0,
|
|
63501
|
+
const printedNode = (0, import_graphql11.print)({
|
|
63660
63502
|
...node,
|
|
63661
63503
|
description: void 0
|
|
63662
63504
|
});
|
|
63663
|
-
const printedExistingNode = (0,
|
|
63505
|
+
const printedExistingNode = (0, import_graphql11.print)({
|
|
63664
63506
|
...existingNode,
|
|
63665
63507
|
description: void 0
|
|
63666
63508
|
});
|
|
@@ -63727,7 +63569,7 @@ function mergeEnumValues(first, second, config, directives) {
|
|
|
63727
63569
|
}
|
|
63728
63570
|
|
|
63729
63571
|
// ../../node_modules/.pnpm/@graphql-tools+merge@9.0.0_graphql@15.5.0/node_modules/@graphql-tools/merge/esm/typedefs-mergers/enum.js
|
|
63730
|
-
var
|
|
63572
|
+
var import_graphql12 = require("graphql");
|
|
63731
63573
|
function mergeEnum(e1, e2, config, directives) {
|
|
63732
63574
|
if (e2) {
|
|
63733
63575
|
return {
|
|
@@ -63741,33 +63583,33 @@ function mergeEnum(e1, e2, config, directives) {
|
|
|
63741
63583
|
}
|
|
63742
63584
|
return config?.convertExtensions ? {
|
|
63743
63585
|
...e1,
|
|
63744
|
-
kind:
|
|
63586
|
+
kind: import_graphql12.Kind.ENUM_TYPE_DEFINITION
|
|
63745
63587
|
} : e1;
|
|
63746
63588
|
}
|
|
63747
63589
|
|
|
63748
63590
|
// ../../node_modules/.pnpm/@graphql-tools+merge@9.0.0_graphql@15.5.0/node_modules/@graphql-tools/merge/esm/typedefs-mergers/utils.js
|
|
63749
|
-
var
|
|
63591
|
+
var import_graphql13 = require("graphql");
|
|
63750
63592
|
function isStringTypes(types14) {
|
|
63751
63593
|
return typeof types14 === "string";
|
|
63752
63594
|
}
|
|
63753
63595
|
function isSourceTypes(types14) {
|
|
63754
|
-
return types14 instanceof
|
|
63596
|
+
return types14 instanceof import_graphql13.Source;
|
|
63755
63597
|
}
|
|
63756
63598
|
function extractType(type) {
|
|
63757
63599
|
let visitedType = type;
|
|
63758
|
-
while (visitedType.kind ===
|
|
63600
|
+
while (visitedType.kind === import_graphql13.Kind.LIST_TYPE || visitedType.kind === "NonNullType") {
|
|
63759
63601
|
visitedType = visitedType.type;
|
|
63760
63602
|
}
|
|
63761
63603
|
return visitedType;
|
|
63762
63604
|
}
|
|
63763
63605
|
function isWrappingTypeNode(type) {
|
|
63764
|
-
return type.kind !==
|
|
63606
|
+
return type.kind !== import_graphql13.Kind.NAMED_TYPE;
|
|
63765
63607
|
}
|
|
63766
63608
|
function isListTypeNode(type) {
|
|
63767
|
-
return type.kind ===
|
|
63609
|
+
return type.kind === import_graphql13.Kind.LIST_TYPE;
|
|
63768
63610
|
}
|
|
63769
63611
|
function isNonNullTypeNode(type) {
|
|
63770
|
-
return type.kind ===
|
|
63612
|
+
return type.kind === import_graphql13.Kind.NON_NULL_TYPE;
|
|
63771
63613
|
}
|
|
63772
63614
|
function printTypeNode(type) {
|
|
63773
63615
|
if (isListTypeNode(type)) {
|
|
@@ -63870,7 +63712,7 @@ function safeChangeForFieldType(oldType, newType, ignoreNullability = false) {
|
|
|
63870
63712
|
}
|
|
63871
63713
|
|
|
63872
63714
|
// ../../node_modules/.pnpm/@graphql-tools+merge@9.0.0_graphql@15.5.0/node_modules/@graphql-tools/merge/esm/typedefs-mergers/input-type.js
|
|
63873
|
-
var
|
|
63715
|
+
var import_graphql14 = require("graphql");
|
|
63874
63716
|
function mergeInputType(node, existingNode, config, directives) {
|
|
63875
63717
|
if (existingNode) {
|
|
63876
63718
|
try {
|
|
@@ -63888,12 +63730,12 @@ function mergeInputType(node, existingNode, config, directives) {
|
|
|
63888
63730
|
}
|
|
63889
63731
|
return config?.convertExtensions ? {
|
|
63890
63732
|
...node,
|
|
63891
|
-
kind:
|
|
63733
|
+
kind: import_graphql14.Kind.INPUT_OBJECT_TYPE_DEFINITION
|
|
63892
63734
|
} : node;
|
|
63893
63735
|
}
|
|
63894
63736
|
|
|
63895
63737
|
// ../../node_modules/.pnpm/@graphql-tools+merge@9.0.0_graphql@15.5.0/node_modules/@graphql-tools/merge/esm/typedefs-mergers/interface.js
|
|
63896
|
-
var
|
|
63738
|
+
var import_graphql15 = require("graphql");
|
|
63897
63739
|
|
|
63898
63740
|
// ../../node_modules/.pnpm/@graphql-tools+merge@9.0.0_graphql@15.5.0/node_modules/@graphql-tools/merge/esm/typedefs-mergers/merge-named-type-array.js
|
|
63899
63741
|
function alreadyExists(arr, other) {
|
|
@@ -63926,15 +63768,15 @@ function mergeInterface(node, existingNode, config, directives) {
|
|
|
63926
63768
|
}
|
|
63927
63769
|
return config?.convertExtensions ? {
|
|
63928
63770
|
...node,
|
|
63929
|
-
kind:
|
|
63771
|
+
kind: import_graphql15.Kind.INTERFACE_TYPE_DEFINITION
|
|
63930
63772
|
} : node;
|
|
63931
63773
|
}
|
|
63932
63774
|
|
|
63933
63775
|
// ../../node_modules/.pnpm/@graphql-tools+merge@9.0.0_graphql@15.5.0/node_modules/@graphql-tools/merge/esm/typedefs-mergers/merge-nodes.js
|
|
63934
|
-
var
|
|
63776
|
+
var import_graphql20 = require("graphql");
|
|
63935
63777
|
|
|
63936
63778
|
// ../../node_modules/.pnpm/@graphql-tools+merge@9.0.0_graphql@15.5.0/node_modules/@graphql-tools/merge/esm/typedefs-mergers/type.js
|
|
63937
|
-
var
|
|
63779
|
+
var import_graphql16 = require("graphql");
|
|
63938
63780
|
function mergeType(node, existingNode, config, directives) {
|
|
63939
63781
|
if (existingNode) {
|
|
63940
63782
|
try {
|
|
@@ -63953,12 +63795,12 @@ function mergeType(node, existingNode, config, directives) {
|
|
|
63953
63795
|
}
|
|
63954
63796
|
return config?.convertExtensions ? {
|
|
63955
63797
|
...node,
|
|
63956
|
-
kind:
|
|
63798
|
+
kind: import_graphql16.Kind.OBJECT_TYPE_DEFINITION
|
|
63957
63799
|
} : node;
|
|
63958
63800
|
}
|
|
63959
63801
|
|
|
63960
63802
|
// ../../node_modules/.pnpm/@graphql-tools+merge@9.0.0_graphql@15.5.0/node_modules/@graphql-tools/merge/esm/typedefs-mergers/scalar.js
|
|
63961
|
-
var
|
|
63803
|
+
var import_graphql17 = require("graphql");
|
|
63962
63804
|
function mergeScalar(node, existingNode, config, directives) {
|
|
63963
63805
|
if (existingNode) {
|
|
63964
63806
|
return {
|
|
@@ -63971,31 +63813,31 @@ function mergeScalar(node, existingNode, config, directives) {
|
|
|
63971
63813
|
}
|
|
63972
63814
|
return config?.convertExtensions ? {
|
|
63973
63815
|
...node,
|
|
63974
|
-
kind:
|
|
63816
|
+
kind: import_graphql17.Kind.SCALAR_TYPE_DEFINITION
|
|
63975
63817
|
} : node;
|
|
63976
63818
|
}
|
|
63977
63819
|
|
|
63978
63820
|
// ../../node_modules/.pnpm/@graphql-tools+merge@9.0.0_graphql@15.5.0/node_modules/@graphql-tools/merge/esm/typedefs-mergers/union.js
|
|
63979
|
-
var
|
|
63821
|
+
var import_graphql18 = require("graphql");
|
|
63980
63822
|
function mergeUnion(first, second, config, directives) {
|
|
63981
63823
|
if (second) {
|
|
63982
63824
|
return {
|
|
63983
63825
|
name: first.name,
|
|
63984
63826
|
description: first["description"] || second["description"],
|
|
63985
63827
|
directives: mergeDirectives(first.directives, second.directives, config, directives),
|
|
63986
|
-
kind: config?.convertExtensions || first.kind === "UnionTypeDefinition" || second.kind === "UnionTypeDefinition" ?
|
|
63828
|
+
kind: config?.convertExtensions || first.kind === "UnionTypeDefinition" || second.kind === "UnionTypeDefinition" ? import_graphql18.Kind.UNION_TYPE_DEFINITION : import_graphql18.Kind.UNION_TYPE_EXTENSION,
|
|
63987
63829
|
loc: first.loc,
|
|
63988
63830
|
types: mergeNamedTypeArray(first.types, second.types, config)
|
|
63989
63831
|
};
|
|
63990
63832
|
}
|
|
63991
63833
|
return config?.convertExtensions ? {
|
|
63992
63834
|
...first,
|
|
63993
|
-
kind:
|
|
63835
|
+
kind: import_graphql18.Kind.UNION_TYPE_DEFINITION
|
|
63994
63836
|
} : first;
|
|
63995
63837
|
}
|
|
63996
63838
|
|
|
63997
63839
|
// ../../node_modules/.pnpm/@graphql-tools+merge@9.0.0_graphql@15.5.0/node_modules/@graphql-tools/merge/esm/typedefs-mergers/schema-def.js
|
|
63998
|
-
var
|
|
63840
|
+
var import_graphql19 = require("graphql");
|
|
63999
63841
|
var DEFAULT_OPERATION_TYPE_NAME_MAP = {
|
|
64000
63842
|
query: "Query",
|
|
64001
63843
|
mutation: "Mutation",
|
|
@@ -64014,7 +63856,7 @@ function mergeOperationTypes(opNodeList = [], existingOpNodeList = []) {
|
|
|
64014
63856
|
function mergeSchemaDefs(node, existingNode, config, directives) {
|
|
64015
63857
|
if (existingNode) {
|
|
64016
63858
|
return {
|
|
64017
|
-
kind: node.kind ===
|
|
63859
|
+
kind: node.kind === import_graphql19.Kind.SCHEMA_DEFINITION || existingNode.kind === import_graphql19.Kind.SCHEMA_DEFINITION ? import_graphql19.Kind.SCHEMA_DEFINITION : import_graphql19.Kind.SCHEMA_EXTENSION,
|
|
64018
63860
|
description: node["description"] || existingNode["description"],
|
|
64019
63861
|
directives: mergeDirectives(node.directives, existingNode.directives, config, directives),
|
|
64020
63862
|
operationTypes: mergeOperationTypes(node.operationTypes, existingNode.operationTypes)
|
|
@@ -64022,7 +63864,7 @@ function mergeSchemaDefs(node, existingNode, config, directives) {
|
|
|
64022
63864
|
}
|
|
64023
63865
|
return config?.convertExtensions ? {
|
|
64024
63866
|
...node,
|
|
64025
|
-
kind:
|
|
63867
|
+
kind: import_graphql19.Kind.SCHEMA_DEFINITION
|
|
64026
63868
|
} : node;
|
|
64027
63869
|
}
|
|
64028
63870
|
|
|
@@ -64046,36 +63888,36 @@ function mergeGraphQLNodes(nodes, config, directives = {}) {
|
|
|
64046
63888
|
delete mergedResultMap[name];
|
|
64047
63889
|
} else {
|
|
64048
63890
|
switch (nodeDefinition.kind) {
|
|
64049
|
-
case
|
|
64050
|
-
case
|
|
63891
|
+
case import_graphql20.Kind.OBJECT_TYPE_DEFINITION:
|
|
63892
|
+
case import_graphql20.Kind.OBJECT_TYPE_EXTENSION:
|
|
64051
63893
|
mergedResultMap[name] = mergeType(nodeDefinition, mergedResultMap[name], config, directives);
|
|
64052
63894
|
break;
|
|
64053
|
-
case
|
|
64054
|
-
case
|
|
63895
|
+
case import_graphql20.Kind.ENUM_TYPE_DEFINITION:
|
|
63896
|
+
case import_graphql20.Kind.ENUM_TYPE_EXTENSION:
|
|
64055
63897
|
mergedResultMap[name] = mergeEnum(nodeDefinition, mergedResultMap[name], config, directives);
|
|
64056
63898
|
break;
|
|
64057
|
-
case
|
|
64058
|
-
case
|
|
63899
|
+
case import_graphql20.Kind.UNION_TYPE_DEFINITION:
|
|
63900
|
+
case import_graphql20.Kind.UNION_TYPE_EXTENSION:
|
|
64059
63901
|
mergedResultMap[name] = mergeUnion(nodeDefinition, mergedResultMap[name], config, directives);
|
|
64060
63902
|
break;
|
|
64061
|
-
case
|
|
64062
|
-
case
|
|
63903
|
+
case import_graphql20.Kind.SCALAR_TYPE_DEFINITION:
|
|
63904
|
+
case import_graphql20.Kind.SCALAR_TYPE_EXTENSION:
|
|
64063
63905
|
mergedResultMap[name] = mergeScalar(nodeDefinition, mergedResultMap[name], config, directives);
|
|
64064
63906
|
break;
|
|
64065
|
-
case
|
|
64066
|
-
case
|
|
63907
|
+
case import_graphql20.Kind.INPUT_OBJECT_TYPE_DEFINITION:
|
|
63908
|
+
case import_graphql20.Kind.INPUT_OBJECT_TYPE_EXTENSION:
|
|
64067
63909
|
mergedResultMap[name] = mergeInputType(nodeDefinition, mergedResultMap[name], config, directives);
|
|
64068
63910
|
break;
|
|
64069
|
-
case
|
|
64070
|
-
case
|
|
63911
|
+
case import_graphql20.Kind.INTERFACE_TYPE_DEFINITION:
|
|
63912
|
+
case import_graphql20.Kind.INTERFACE_TYPE_EXTENSION:
|
|
64071
63913
|
mergedResultMap[name] = mergeInterface(nodeDefinition, mergedResultMap[name], config, directives);
|
|
64072
63914
|
break;
|
|
64073
|
-
case
|
|
63915
|
+
case import_graphql20.Kind.DIRECTIVE_DEFINITION:
|
|
64074
63916
|
mergedResultMap[name] = mergeDirective(nodeDefinition, mergedResultMap[name]);
|
|
64075
63917
|
break;
|
|
64076
63918
|
}
|
|
64077
63919
|
}
|
|
64078
|
-
} else if (nodeDefinition.kind ===
|
|
63920
|
+
} else if (nodeDefinition.kind === import_graphql20.Kind.SCHEMA_DEFINITION || nodeDefinition.kind === import_graphql20.Kind.SCHEMA_EXTENSION) {
|
|
64079
63921
|
mergedResultMap[schemaDefSymbol] = mergeSchemaDefs(nodeDefinition, mergedResultMap[schemaDefSymbol], config);
|
|
64080
63922
|
}
|
|
64081
63923
|
}
|
|
@@ -64083,11 +63925,11 @@ function mergeGraphQLNodes(nodes, config, directives = {}) {
|
|
|
64083
63925
|
}
|
|
64084
63926
|
|
|
64085
63927
|
// ../../node_modules/.pnpm/@graphql-tools+merge@9.0.0_graphql@15.5.0/node_modules/@graphql-tools/merge/esm/typedefs-mergers/merge-typedefs.js
|
|
64086
|
-
var
|
|
63928
|
+
var import_graphql21 = require("graphql");
|
|
64087
63929
|
function mergeTypeDefs(typeSource, config) {
|
|
64088
63930
|
resetComments();
|
|
64089
63931
|
const doc = {
|
|
64090
|
-
kind:
|
|
63932
|
+
kind: import_graphql21.Kind.DOCUMENT,
|
|
64091
63933
|
definitions: mergeGraphQLTypes(typeSource, {
|
|
64092
63934
|
useSchemaDefinition: true,
|
|
64093
63935
|
forceSchemaDefinition: false,
|
|
@@ -64114,14 +63956,14 @@ function visitTypeSources(typeSource, options, allDirectives = [], allNodes = []
|
|
|
64114
63956
|
for (const type of typeSource) {
|
|
64115
63957
|
visitTypeSources(type, options, allDirectives, allNodes, visitedTypeSources);
|
|
64116
63958
|
}
|
|
64117
|
-
} else if ((0,
|
|
63959
|
+
} else if ((0, import_graphql21.isSchema)(typeSource)) {
|
|
64118
63960
|
const documentNode = getDocumentNodeFromSchema(typeSource, options);
|
|
64119
63961
|
visitTypeSources(documentNode.definitions, options, allDirectives, allNodes, visitedTypeSources);
|
|
64120
63962
|
} else if (isStringTypes(typeSource) || isSourceTypes(typeSource)) {
|
|
64121
|
-
const documentNode = (0,
|
|
63963
|
+
const documentNode = (0, import_graphql21.parse)(typeSource, options);
|
|
64122
63964
|
visitTypeSources(documentNode.definitions, options, allDirectives, allNodes, visitedTypeSources);
|
|
64123
|
-
} else if (typeof typeSource === "object" && (0,
|
|
64124
|
-
if (typeSource.kind ===
|
|
63965
|
+
} else if (typeof typeSource === "object" && (0, import_graphql21.isDefinitionNode)(typeSource)) {
|
|
63966
|
+
if (typeSource.kind === import_graphql21.Kind.DIRECTIVE_DEFINITION) {
|
|
64125
63967
|
allDirectives.push(typeSource);
|
|
64126
63968
|
} else {
|
|
64127
63969
|
allNodes.push(typeSource);
|
|
@@ -64141,7 +63983,7 @@ function mergeGraphQLTypes(typeSource, config) {
|
|
|
64141
63983
|
const mergedNodes = mergeGraphQLNodes(allNodes, config, mergedDirectives);
|
|
64142
63984
|
if (config?.useSchemaDefinition) {
|
|
64143
63985
|
const schemaDef = mergedNodes[schemaDefSymbol] || {
|
|
64144
|
-
kind:
|
|
63986
|
+
kind: import_graphql21.Kind.SCHEMA_DEFINITION,
|
|
64145
63987
|
operationTypes: []
|
|
64146
63988
|
};
|
|
64147
63989
|
const operationTypes = schemaDef.operationTypes;
|
|
@@ -64152,9 +63994,9 @@ function mergeGraphQLTypes(typeSource, config) {
|
|
|
64152
63994
|
const existingPossibleRootType = mergedNodes[possibleRootTypeName];
|
|
64153
63995
|
if (existingPossibleRootType != null && existingPossibleRootType.name != null) {
|
|
64154
63996
|
operationTypes.push({
|
|
64155
|
-
kind:
|
|
63997
|
+
kind: import_graphql21.Kind.OPERATION_TYPE_DEFINITION,
|
|
64156
63998
|
type: {
|
|
64157
|
-
kind:
|
|
63999
|
+
kind: import_graphql21.Kind.NAMED_TYPE,
|
|
64158
64000
|
name: existingPossibleRootType.name
|
|
64159
64001
|
},
|
|
64160
64002
|
operation: opTypeDefNodeType
|
|
@@ -64168,15 +64010,15 @@ function mergeGraphQLTypes(typeSource, config) {
|
|
|
64168
64010
|
}
|
|
64169
64011
|
if (config?.forceSchemaDefinition && !mergedNodes[schemaDefSymbol]?.operationTypes?.length) {
|
|
64170
64012
|
mergedNodes[schemaDefSymbol] = {
|
|
64171
|
-
kind:
|
|
64013
|
+
kind: import_graphql21.Kind.SCHEMA_DEFINITION,
|
|
64172
64014
|
operationTypes: [
|
|
64173
64015
|
{
|
|
64174
|
-
kind:
|
|
64016
|
+
kind: import_graphql21.Kind.OPERATION_TYPE_DEFINITION,
|
|
64175
64017
|
operation: "query",
|
|
64176
64018
|
type: {
|
|
64177
|
-
kind:
|
|
64019
|
+
kind: import_graphql21.Kind.NAMED_TYPE,
|
|
64178
64020
|
name: {
|
|
64179
|
-
kind:
|
|
64021
|
+
kind: import_graphql21.Kind.NAME,
|
|
64180
64022
|
value: "Query"
|
|
64181
64023
|
}
|
|
64182
64024
|
}
|
|
@@ -64193,7 +64035,7 @@ function mergeGraphQLTypes(typeSource, config) {
|
|
|
64193
64035
|
}
|
|
64194
64036
|
|
|
64195
64037
|
// src/codegen/transforms/schema.ts
|
|
64196
|
-
var
|
|
64038
|
+
var graphql24 = __toESM(require("graphql"), 1);
|
|
64197
64039
|
async function graphqlExtensions(config, documents) {
|
|
64198
64040
|
let internalSchema = `
|
|
64199
64041
|
enum CachePolicy {
|
|
@@ -64297,7 +64139,7 @@ ${config.configFile.features?.componentFields ? `
|
|
|
64297
64139
|
"""
|
|
64298
64140
|
@${config.componentFieldDirective} marks an inline fragment as the selection for a component field
|
|
64299
64141
|
"""
|
|
64300
|
-
directive @${config.componentFieldDirective}(field: String!, prop: String, export: String, raw: String) on FRAGMENT_DEFINITION | INLINE_FRAGMENT
|
|
64142
|
+
directive @${config.componentFieldDirective}(field: String!, prop: String, export: String, raw: String) on FRAGMENT_DEFINITION | INLINE_FRAGMENT | FIELD_DEFINITION
|
|
64301
64143
|
|
|
64302
64144
|
` : ""}
|
|
64303
64145
|
|
|
@@ -64308,7 +64150,7 @@ directive @${config.componentFieldDirective}(field: String!, prop: String, expor
|
|
|
64308
64150
|
}
|
|
64309
64151
|
internalSchema += plugin2.schema({ config });
|
|
64310
64152
|
}
|
|
64311
|
-
|
|
64153
|
+
let extensions = Object.entries(config.componentFields).map(([parent2, fields]) => {
|
|
64312
64154
|
return `
|
|
64313
64155
|
extend type ${parent2} {
|
|
64314
64156
|
${Object.entries(fields).map(([fieldName, field]) => {
|
|
@@ -64316,29 +64158,30 @@ directive @${config.componentFieldDirective}(field: String!, prop: String, expor
|
|
|
64316
64158
|
const args = fragmentArguments(config, "", field.parent);
|
|
64317
64159
|
if (args.length > 0) {
|
|
64318
64160
|
argString = "(" + args.map((arg) => {
|
|
64319
|
-
const typeName =
|
|
64161
|
+
const typeName = graphql24.print(arg.type);
|
|
64320
64162
|
return `${arg.name}:${typeName}${arg.required ? "!" : ""}`;
|
|
64321
64163
|
}).join("\n") + ")";
|
|
64322
64164
|
}
|
|
64323
|
-
return `${fieldName}${argString}: ${config.componentScalar}
|
|
64165
|
+
return `${fieldName}${argString}: ${config.componentScalar}! @componentField(field: "${fieldName}")`;
|
|
64324
64166
|
}).join("\n")}
|
|
64325
64167
|
}
|
|
64326
64168
|
`;
|
|
64327
64169
|
}).join("\n");
|
|
64328
|
-
config.
|
|
64170
|
+
extensions += `${Object.keys(config.configFile.features?.runtimeScalars ?? {}).map((scalar) => `scalar ${scalar}`).join("\n")}`;
|
|
64171
|
+
config.newSchema = graphql24.print(mergeTypeDefs([internalSchema, config.newSchema]));
|
|
64329
64172
|
config.schemaString += extensions;
|
|
64330
|
-
config.schema =
|
|
64331
|
-
|
|
64332
|
-
mergeTypeDefs([
|
|
64173
|
+
config.schema = graphql24.buildSchema(
|
|
64174
|
+
graphql24.print(
|
|
64175
|
+
mergeTypeDefs([graphql24.printSchema(config.schema), internalSchema, extensions])
|
|
64333
64176
|
)
|
|
64334
64177
|
);
|
|
64335
64178
|
}
|
|
64336
64179
|
|
|
64337
64180
|
// src/codegen/transforms/typename.ts
|
|
64338
|
-
var
|
|
64181
|
+
var graphql25 = __toESM(require("graphql"), 1);
|
|
64339
64182
|
async function addTypename(config, documents) {
|
|
64340
64183
|
for (const doc of documents) {
|
|
64341
|
-
doc.document =
|
|
64184
|
+
doc.document = graphql25.visit(doc.document, {
|
|
64342
64185
|
Field(node, key, parent2, path2, ancestors) {
|
|
64343
64186
|
if (!node.selectionSet) {
|
|
64344
64187
|
return;
|
|
@@ -64350,7 +64193,7 @@ async function addTypename(config, documents) {
|
|
|
64350
64193
|
);
|
|
64351
64194
|
const field = type.getFields()[node.name.value];
|
|
64352
64195
|
const fieldType = unwrapType(config, field.type).type;
|
|
64353
|
-
if (
|
|
64196
|
+
if (graphql25.isInterfaceType(fieldType) || graphql25.isUnionType(fieldType)) {
|
|
64354
64197
|
return {
|
|
64355
64198
|
...node,
|
|
64356
64199
|
selectionSet: {
|
|
@@ -64358,9 +64201,9 @@ async function addTypename(config, documents) {
|
|
|
64358
64201
|
selections: [
|
|
64359
64202
|
...node.selectionSet.selections,
|
|
64360
64203
|
{
|
|
64361
|
-
kind:
|
|
64204
|
+
kind: graphql25.Kind.FIELD,
|
|
64362
64205
|
name: {
|
|
64363
|
-
kind:
|
|
64206
|
+
kind: graphql25.Kind.NAME,
|
|
64364
64207
|
value: "__typename"
|
|
64365
64208
|
}
|
|
64366
64209
|
}
|
|
@@ -64377,9 +64220,9 @@ async function addTypename(config, documents) {
|
|
|
64377
64220
|
selections: [
|
|
64378
64221
|
...node.selectionSet.selections,
|
|
64379
64222
|
{
|
|
64380
|
-
kind:
|
|
64223
|
+
kind: graphql25.Kind.FIELD,
|
|
64381
64224
|
name: {
|
|
64382
|
-
kind:
|
|
64225
|
+
kind: graphql25.Kind.NAME,
|
|
64383
64226
|
value: "__typename"
|
|
64384
64227
|
}
|
|
64385
64228
|
}
|
|
@@ -64392,10 +64235,10 @@ async function addTypename(config, documents) {
|
|
|
64392
64235
|
}
|
|
64393
64236
|
|
|
64394
64237
|
// src/codegen/transforms/addID.ts
|
|
64395
|
-
var
|
|
64238
|
+
var graphql26 = __toESM(require("graphql"), 1);
|
|
64396
64239
|
async function addID(config, documents) {
|
|
64397
64240
|
for (const doc of documents) {
|
|
64398
|
-
doc.document =
|
|
64241
|
+
doc.document = graphql26.visit(doc.document, {
|
|
64399
64242
|
Field(node, key, parent2, path2, ancestors) {
|
|
64400
64243
|
if (!node.selectionSet) {
|
|
64401
64244
|
return;
|
|
@@ -64433,7 +64276,7 @@ function addKeysToSelection(config, node, fieldType) {
|
|
|
64433
64276
|
if (!node.selectionSet || node.selectionSet.selections.length == 0) {
|
|
64434
64277
|
return;
|
|
64435
64278
|
}
|
|
64436
|
-
if (!
|
|
64279
|
+
if (!graphql26.isObjectType(fieldType) && !graphql26.isInterfaceType(fieldType)) {
|
|
64437
64280
|
return;
|
|
64438
64281
|
}
|
|
64439
64282
|
const keyFields = config.keyFieldsForType(fieldType.name);
|
|
@@ -64448,9 +64291,9 @@ function addKeysToSelection(config, node, fieldType) {
|
|
|
64448
64291
|
continue;
|
|
64449
64292
|
}
|
|
64450
64293
|
selections.push({
|
|
64451
|
-
kind:
|
|
64294
|
+
kind: graphql26.Kind.FIELD,
|
|
64452
64295
|
name: {
|
|
64453
|
-
kind:
|
|
64296
|
+
kind: graphql26.Kind.NAME,
|
|
64454
64297
|
value: keyField
|
|
64455
64298
|
}
|
|
64456
64299
|
});
|
|
@@ -64465,13 +64308,13 @@ function addKeysToSelection(config, node, fieldType) {
|
|
|
64465
64308
|
}
|
|
64466
64309
|
|
|
64467
64310
|
// src/codegen/transforms/componentFields.ts
|
|
64468
|
-
var
|
|
64311
|
+
var graphql27 = __toESM(require("graphql"), 1);
|
|
64469
64312
|
async function componentFields(config, documents) {
|
|
64470
64313
|
for (const document of documents) {
|
|
64471
|
-
const typeInfo = new
|
|
64472
|
-
document.document =
|
|
64314
|
+
const typeInfo = new graphql27.TypeInfo(config.schema);
|
|
64315
|
+
document.document = graphql27.visit(
|
|
64473
64316
|
document.document,
|
|
64474
|
-
|
|
64317
|
+
graphql27.visitWithTypeInfo(typeInfo, {
|
|
64475
64318
|
Field(node) {
|
|
64476
64319
|
const parentType = typeInfo.getParentType();
|
|
64477
64320
|
if (!parentType) {
|
|
@@ -64519,6 +64362,48 @@ async function componentFields(config, documents) {
|
|
|
64519
64362
|
}
|
|
64520
64363
|
}
|
|
64521
64364
|
|
|
64365
|
+
// src/codegen/transforms/runtimeScalars.ts
|
|
64366
|
+
var graphql28 = __toESM(require("graphql"), 1);
|
|
64367
|
+
async function addTypename2(config, documents) {
|
|
64368
|
+
for (const doc of documents) {
|
|
64369
|
+
doc.document = graphql28.visit(doc.document, {
|
|
64370
|
+
VariableDefinition(node) {
|
|
64371
|
+
const { type, wrappers } = unwrapType(config, node.type);
|
|
64372
|
+
const runtimeScalar = config.configFile.features?.runtimeScalars?.[type.name];
|
|
64373
|
+
if (runtimeScalar) {
|
|
64374
|
+
return {
|
|
64375
|
+
...node,
|
|
64376
|
+
type: wrapType({
|
|
64377
|
+
type: config.schema.getType(runtimeScalar.type),
|
|
64378
|
+
wrappers
|
|
64379
|
+
}),
|
|
64380
|
+
directives: [
|
|
64381
|
+
...node.directives ?? [],
|
|
64382
|
+
{
|
|
64383
|
+
kind: "Directive",
|
|
64384
|
+
name: {
|
|
64385
|
+
kind: "Name",
|
|
64386
|
+
value: config.runtimeScalarDirective
|
|
64387
|
+
},
|
|
64388
|
+
arguments: [
|
|
64389
|
+
{
|
|
64390
|
+
kind: "Argument",
|
|
64391
|
+
name: { kind: "Name", value: "type" },
|
|
64392
|
+
value: {
|
|
64393
|
+
kind: "StringValue",
|
|
64394
|
+
value: type.name
|
|
64395
|
+
}
|
|
64396
|
+
}
|
|
64397
|
+
]
|
|
64398
|
+
}
|
|
64399
|
+
]
|
|
64400
|
+
};
|
|
64401
|
+
}
|
|
64402
|
+
}
|
|
64403
|
+
});
|
|
64404
|
+
}
|
|
64405
|
+
}
|
|
64406
|
+
|
|
64522
64407
|
// src/codegen/validators/typeCheck.ts
|
|
64523
64408
|
var graphql29 = __toESM(require("graphql"), 1);
|
|
64524
64409
|
async function typeCheck(config, docs) {
|
|
@@ -65520,10 +65405,22 @@ async function componentFields2(config, docs) {
|
|
|
65520
65405
|
}
|
|
65521
65406
|
const fieldValue = fieldArg.value?.kind === "StringValue" ? fieldArg.value.value : void 0;
|
|
65522
65407
|
const propValue = propArg.value?.kind === "StringValue" ? propArg.value.value : void 0;
|
|
65408
|
+
const existingField = fieldValue && config.componentFields[parent2]?.[fieldValue];
|
|
65523
65409
|
const parentType = config.schema.getType(parent2);
|
|
65524
|
-
|
|
65410
|
+
let conflict = false;
|
|
65411
|
+
if (existingField && existingField.filepath !== filepath) {
|
|
65412
|
+
conflict = true;
|
|
65413
|
+
} else if (parentType && fieldValue) {
|
|
65414
|
+
const fieldDef = graphql31.isObjectType(parentType) && parentType.getFields()[fieldValue];
|
|
65415
|
+
if (fieldDef && !fieldDef.astNode?.directives?.find(
|
|
65416
|
+
(dir) => dir.name.value === config.componentFieldDirective
|
|
65417
|
+
)) {
|
|
65418
|
+
conflict = true;
|
|
65419
|
+
}
|
|
65420
|
+
}
|
|
65421
|
+
if (conflict) {
|
|
65525
65422
|
errors.push({
|
|
65526
|
-
message: `Duplicate component field definition for ${parent2}.${fieldValue}
|
|
65423
|
+
message: `Duplicate component field definition for ${parent2}.${fieldValue}.` + (existingField ? "The conflicting component field was defined in " + existingField.filepath : ""),
|
|
65527
65424
|
filepath
|
|
65528
65425
|
});
|
|
65529
65426
|
}
|
|
@@ -65589,6 +65486,7 @@ async function runPipeline2(config, docs) {
|
|
|
65589
65486
|
[
|
|
65590
65487
|
componentFields2,
|
|
65591
65488
|
graphqlExtensions,
|
|
65489
|
+
addTypename2,
|
|
65592
65490
|
...wrapHook(beforeValidate),
|
|
65593
65491
|
typeCheck,
|
|
65594
65492
|
uniqueDocumentNames,
|
|
@@ -65722,7 +65620,7 @@ function testConfigFile({ plugins, ...config } = {}) {
|
|
|
65722
65620
|
id: ID!
|
|
65723
65621
|
name(arg: Int): String!
|
|
65724
65622
|
birthday: DateTime!
|
|
65725
|
-
firstName: String!
|
|
65623
|
+
firstName: String! @deprecated(reason: "Use name instead")
|
|
65726
65624
|
friends: [User!]!
|
|
65727
65625
|
friendsByCursor(first: Int, after: String, last: Int, before: String, filter: String): UserConnection!
|
|
65728
65626
|
friendsByCursorSnapshot(snapshot: String!, first: Int, after: String, last: Int, before: String): UserConnection!
|
|
@@ -65752,13 +65650,22 @@ function testConfigFile({ plugins, ...config } = {}) {
|
|
|
65752
65650
|
believers(first: Int, after: String): GhostConnection
|
|
65753
65651
|
}
|
|
65754
65652
|
|
|
65653
|
+
"""
|
|
65654
|
+
Cat's documentation
|
|
65655
|
+
"""
|
|
65755
65656
|
type Cat implements Friend & Node {
|
|
65756
65657
|
id: ID!
|
|
65658
|
+
"""
|
|
65659
|
+
The name of the cat
|
|
65660
|
+
"""
|
|
65757
65661
|
name: String!
|
|
65758
65662
|
owner: User!
|
|
65759
65663
|
}
|
|
65760
65664
|
|
|
65761
65665
|
type Query {
|
|
65666
|
+
"""
|
|
65667
|
+
Get a user.
|
|
65668
|
+
"""
|
|
65762
65669
|
user: User!
|
|
65763
65670
|
entity: Entity!
|
|
65764
65671
|
version: Int!
|
|
@@ -65940,11 +65847,19 @@ function testConfigFile({ plugins, ...config } = {}) {
|
|
|
65940
65847
|
id: ID!
|
|
65941
65848
|
}
|
|
65942
65849
|
|
|
65850
|
+
"""
|
|
65851
|
+
Documentation of testenum1
|
|
65852
|
+
"""
|
|
65943
65853
|
enum TestEnum1 {
|
|
65854
|
+
"Documentation of Value1"
|
|
65944
65855
|
Value1
|
|
65856
|
+
"Documentation of Value2"
|
|
65945
65857
|
Value2
|
|
65946
65858
|
}
|
|
65947
65859
|
|
|
65860
|
+
"""
|
|
65861
|
+
Documentation of testenum2
|
|
65862
|
+
"""
|
|
65948
65863
|
enum TestEnum2 {
|
|
65949
65864
|
Value3
|
|
65950
65865
|
Value2
|
|
@@ -65990,9 +65905,15 @@ function testConfigFile({ plugins, ...config } = {}) {
|
|
|
65990
65905
|
...plugins
|
|
65991
65906
|
},
|
|
65992
65907
|
features: {
|
|
65993
|
-
componentFields: true
|
|
65908
|
+
componentFields: true,
|
|
65909
|
+
imperativeCache: true,
|
|
65910
|
+
runtimeScalars: {
|
|
65911
|
+
ViewerIDFromSession: {
|
|
65912
|
+
type: "ID",
|
|
65913
|
+
resolve: ({ session }) => session.token
|
|
65914
|
+
}
|
|
65915
|
+
}
|
|
65994
65916
|
},
|
|
65995
|
-
acceptImperativeInstability: true,
|
|
65996
65917
|
...config
|
|
65997
65918
|
};
|
|
65998
65919
|
}
|
|
@@ -66010,7 +65931,7 @@ function pipelineTest(config, documents, shouldPass, testBody) {
|
|
|
66010
65931
|
await runPipeline2(config, docs);
|
|
66011
65932
|
} catch (e) {
|
|
66012
65933
|
if (shouldPass) {
|
|
66013
|
-
throw "pipeline failed when it should have passed. " + e;
|
|
65934
|
+
throw new Error("pipeline failed when it should have passed. " + e);
|
|
66014
65935
|
}
|
|
66015
65936
|
error = e;
|
|
66016
65937
|
}
|