houdini-svelte 1.2.43 → 1.2.44
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/plugin-cjs/index.js +46 -16
- package/build/plugin-esm/index.js +46 -16
- package/build/preprocess-cjs/index.js +50 -17
- package/build/preprocess-esm/index.js +50 -17
- package/build/test-cjs/index.js +260 -120
- package/build/test-esm/index.js +261 -121
- package/package.json +2 -2
package/build/test-esm/index.js
CHANGED
|
@@ -2301,7 +2301,7 @@ var require_path_visitor5 = __commonJS({
|
|
|
2301
2301
|
}
|
|
2302
2302
|
return target;
|
|
2303
2303
|
}
|
|
2304
|
-
PathVisitor.visit = function
|
|
2304
|
+
PathVisitor.visit = function visit55(node2, methods) {
|
|
2305
2305
|
return PathVisitor.fromMethodsObject(methods).visit(node2);
|
|
2306
2306
|
};
|
|
2307
2307
|
var PVp = PathVisitor.prototype;
|
|
@@ -2492,7 +2492,7 @@ var require_path_visitor5 = __commonJS({
|
|
|
2492
2492
|
this.needToCallTraverse = false;
|
|
2493
2493
|
return visitChildren(path5, PathVisitor.fromMethodsObject(newVisitor || this.visitor));
|
|
2494
2494
|
};
|
|
2495
|
-
sharedContextProtoMethods.visit = function
|
|
2495
|
+
sharedContextProtoMethods.visit = function visit55(path5, newVisitor) {
|
|
2496
2496
|
if (!(this instanceof this.Context)) {
|
|
2497
2497
|
throw new Error("");
|
|
2498
2498
|
}
|
|
@@ -3885,7 +3885,7 @@ var require_main6 = __commonJS({
|
|
|
3885
3885
|
var someField = _a.someField;
|
|
3886
3886
|
var Type = _a.Type;
|
|
3887
3887
|
var use = _a.use;
|
|
3888
|
-
var
|
|
3888
|
+
var visit55 = _a.visit;
|
|
3889
3889
|
exports.astNodesAreEquivalent = astNodesAreEquivalent;
|
|
3890
3890
|
exports.builders = builders;
|
|
3891
3891
|
exports.builtInTypes = builtInTypes;
|
|
@@ -3902,7 +3902,7 @@ var require_main6 = __commonJS({
|
|
|
3902
3902
|
exports.someField = someField;
|
|
3903
3903
|
exports.Type = Type;
|
|
3904
3904
|
exports.use = use;
|
|
3905
|
-
exports.visit =
|
|
3905
|
+
exports.visit = visit55;
|
|
3906
3906
|
Object.assign(namedTypes_1.namedTypes, n);
|
|
3907
3907
|
}
|
|
3908
3908
|
});
|
|
@@ -77843,8 +77843,22 @@ var query = documentPlugin(ArtifactKind.Query, function() {
|
|
|
77843
77843
|
let lastVariables = null;
|
|
77844
77844
|
return {
|
|
77845
77845
|
start(ctx, { next }) {
|
|
77846
|
+
const runtimeScalarPayload = {
|
|
77847
|
+
session: ctx.session
|
|
77848
|
+
};
|
|
77846
77849
|
ctx.variables = {
|
|
77847
77850
|
...lastVariables,
|
|
77851
|
+
...Object.fromEntries(
|
|
77852
|
+
Object.entries(ctx.artifact.input?.runtimeScalars ?? {}).map(
|
|
77853
|
+
([field, type]) => {
|
|
77854
|
+
const runtimeScalar = ctx.config.features?.runtimeScalars?.[type];
|
|
77855
|
+
if (!runtimeScalar) {
|
|
77856
|
+
return [field, type];
|
|
77857
|
+
}
|
|
77858
|
+
return [field, runtimeScalar.resolve(runtimeScalarPayload)];
|
|
77859
|
+
}
|
|
77860
|
+
)
|
|
77861
|
+
),
|
|
77848
77862
|
...ctx.variables
|
|
77849
77863
|
};
|
|
77850
77864
|
next(ctx);
|
|
@@ -78039,7 +78053,7 @@ function unwrapType(config2, type, wrappers = []) {
|
|
|
78039
78053
|
}
|
|
78040
78054
|
const namedType = config2.schema.getType(type.name.value || type.name);
|
|
78041
78055
|
if (!namedType) {
|
|
78042
|
-
throw new Error("
|
|
78056
|
+
throw new Error("Unknown type: " + type.name.value || type.name);
|
|
78043
78057
|
}
|
|
78044
78058
|
return { type: namedType, wrappers };
|
|
78045
78059
|
}
|
|
@@ -78595,7 +78609,7 @@ var t2 = __toESM2(require_lib6(), 1);
|
|
|
78595
78609
|
|
|
78596
78610
|
// ../houdini/build/codegen-esm/index.js
|
|
78597
78611
|
import { createRequire as conflict_free2 } from "module";
|
|
78598
|
-
import * as
|
|
78612
|
+
import * as graphql33 from "graphql";
|
|
78599
78613
|
import * as graphql22 from "graphql";
|
|
78600
78614
|
import { fileURLToPath as fileURLToPath2, pathToFileURL as pathToFileURL2 } from "node:url";
|
|
78601
78615
|
import fs3 from "node:fs/promises";
|
|
@@ -78603,7 +78617,7 @@ import { promisify as promisify3 } from "node:util";
|
|
|
78603
78617
|
import os2 from "node:os";
|
|
78604
78618
|
import path2 from "node:path";
|
|
78605
78619
|
import * as graphql6 from "graphql";
|
|
78606
|
-
import * as
|
|
78620
|
+
import * as graphql32 from "graphql";
|
|
78607
78621
|
import crypto2 from "node:crypto";
|
|
78608
78622
|
import * as graphql42 from "graphql";
|
|
78609
78623
|
import * as graphql52 from "graphql";
|
|
@@ -78653,6 +78667,7 @@ import * as graphql28 from "graphql";
|
|
|
78653
78667
|
import * as graphql29 from "graphql";
|
|
78654
78668
|
import * as graphql30 from "graphql";
|
|
78655
78669
|
import * as graphql31 from "graphql";
|
|
78670
|
+
import * as graphql322 from "graphql";
|
|
78656
78671
|
var require3 = conflict_free2(import.meta.url);
|
|
78657
78672
|
var __create3 = Object.create;
|
|
78658
78673
|
var __defProp3 = Object.defineProperty;
|
|
@@ -103360,7 +103375,7 @@ var require_path_visitor2 = __commonJS3({
|
|
|
103360
103375
|
}
|
|
103361
103376
|
return target;
|
|
103362
103377
|
}
|
|
103363
|
-
PathVisitor.visit = function
|
|
103378
|
+
PathVisitor.visit = function visit192(node2, methods) {
|
|
103364
103379
|
return PathVisitor.fromMethodsObject(methods).visit(node2);
|
|
103365
103380
|
};
|
|
103366
103381
|
var PVp = PathVisitor.prototype;
|
|
@@ -103551,7 +103566,7 @@ var require_path_visitor2 = __commonJS3({
|
|
|
103551
103566
|
this.needToCallTraverse = false;
|
|
103552
103567
|
return visitChildren(path22, PathVisitor.fromMethodsObject(newVisitor || this.visitor));
|
|
103553
103568
|
};
|
|
103554
|
-
sharedContextProtoMethods.visit = function
|
|
103569
|
+
sharedContextProtoMethods.visit = function visit192(path22, newVisitor) {
|
|
103555
103570
|
if (!(this instanceof this.Context)) {
|
|
103556
103571
|
throw new Error("");
|
|
103557
103572
|
}
|
|
@@ -104894,7 +104909,7 @@ var require_main3 = __commonJS3({
|
|
|
104894
104909
|
var someField = _a.someField;
|
|
104895
104910
|
var Type = _a.Type;
|
|
104896
104911
|
var use = _a.use;
|
|
104897
|
-
var
|
|
104912
|
+
var visit192 = _a.visit;
|
|
104898
104913
|
exports.astNodesAreEquivalent = astNodesAreEquivalent;
|
|
104899
104914
|
exports.builders = builders;
|
|
104900
104915
|
exports.builtInTypes = builtInTypes;
|
|
@@ -104911,7 +104926,7 @@ var require_main3 = __commonJS3({
|
|
|
104911
104926
|
exports.someField = someField;
|
|
104912
104927
|
exports.Type = Type;
|
|
104913
104928
|
exports.use = use;
|
|
104914
|
-
exports.visit =
|
|
104929
|
+
exports.visit = visit192;
|
|
104915
104930
|
Object.assign(namedTypes_1.namedTypes, n);
|
|
104916
104931
|
}
|
|
104917
104932
|
});
|
|
@@ -134863,8 +134878,22 @@ var query2 = documentPlugin2(ArtifactKind2.Query, function() {
|
|
|
134863
134878
|
let lastVariables = null;
|
|
134864
134879
|
return {
|
|
134865
134880
|
start(ctx, { next }) {
|
|
134881
|
+
const runtimeScalarPayload = {
|
|
134882
|
+
session: ctx.session
|
|
134883
|
+
};
|
|
134866
134884
|
ctx.variables = {
|
|
134867
134885
|
...lastVariables,
|
|
134886
|
+
...Object.fromEntries(
|
|
134887
|
+
Object.entries(ctx.artifact.input?.runtimeScalars ?? {}).map(
|
|
134888
|
+
([field, type]) => {
|
|
134889
|
+
const runtimeScalar = ctx.config.features?.runtimeScalars?.[type];
|
|
134890
|
+
if (!runtimeScalar) {
|
|
134891
|
+
return [field, type];
|
|
134892
|
+
}
|
|
134893
|
+
return [field, runtimeScalar.resolve(runtimeScalarPayload)];
|
|
134894
|
+
}
|
|
134895
|
+
)
|
|
134896
|
+
),
|
|
134868
134897
|
...ctx.variables
|
|
134869
134898
|
};
|
|
134870
134899
|
next(ctx);
|
|
@@ -135014,10 +135043,10 @@ var DEFAULT_CONFIG_PATH2 = join3(process.cwd(), "houdini.config.js");
|
|
|
135014
135043
|
var emptySchema2 = graphql22.buildSchema("type Query { hello: String }");
|
|
135015
135044
|
var defaultDirectives2 = emptySchema2.getDirectives().map((dir) => dir.name);
|
|
135016
135045
|
function getRootType(type) {
|
|
135017
|
-
if (
|
|
135046
|
+
if (graphql32.isNonNullType(type)) {
|
|
135018
135047
|
return getRootType(type.ofType);
|
|
135019
135048
|
}
|
|
135020
|
-
if (
|
|
135049
|
+
if (graphql32.isListType(type)) {
|
|
135021
135050
|
return getRootType(type.ofType);
|
|
135022
135051
|
}
|
|
135023
135052
|
return type;
|
|
@@ -135117,7 +135146,7 @@ function unwrapType2(config2, type, wrappers = []) {
|
|
|
135117
135146
|
if (type.kind === "NonNullType") {
|
|
135118
135147
|
return unwrapType2(config2, type.type, [TypeWrapper2.NonNull, ...wrappers]);
|
|
135119
135148
|
}
|
|
135120
|
-
if (type instanceof
|
|
135149
|
+
if (type instanceof graphql32.GraphQLNonNull) {
|
|
135121
135150
|
return unwrapType2(config2, type.ofType, [TypeWrapper2.NonNull, ...wrappers]);
|
|
135122
135151
|
}
|
|
135123
135152
|
if (wrappers[0] !== TypeWrapper2.NonNull) {
|
|
@@ -135126,12 +135155,12 @@ function unwrapType2(config2, type, wrappers = []) {
|
|
|
135126
135155
|
if (type.kind === "ListType") {
|
|
135127
135156
|
return unwrapType2(config2, type.type, [TypeWrapper2.List, ...wrappers]);
|
|
135128
135157
|
}
|
|
135129
|
-
if (type instanceof
|
|
135158
|
+
if (type instanceof graphql32.GraphQLList) {
|
|
135130
135159
|
return unwrapType2(config2, type.ofType, [TypeWrapper2.List, ...wrappers]);
|
|
135131
135160
|
}
|
|
135132
135161
|
const namedType = config2.schema.getType(type.name.value || type.name);
|
|
135133
135162
|
if (!namedType) {
|
|
135134
|
-
throw new Error("
|
|
135163
|
+
throw new Error("Unknown type: " + type.name.value || type.name);
|
|
135135
135164
|
}
|
|
135136
135165
|
return { type: namedType, wrappers };
|
|
135137
135166
|
}
|
|
@@ -135141,17 +135170,17 @@ function wrapType({
|
|
|
135141
135170
|
}) {
|
|
135142
135171
|
const head = wrappers[0];
|
|
135143
135172
|
const tail = wrappers.slice(1);
|
|
135144
|
-
let kind =
|
|
135173
|
+
let kind = graphql32.Kind.NAMED_TYPE;
|
|
135145
135174
|
if (head === TypeWrapper2.List) {
|
|
135146
|
-
kind =
|
|
135175
|
+
kind = graphql32.Kind.LIST_TYPE;
|
|
135147
135176
|
} else if (head === TypeWrapper2.NonNull) {
|
|
135148
|
-
kind =
|
|
135177
|
+
kind = graphql32.Kind.NON_NULL_TYPE;
|
|
135149
135178
|
}
|
|
135150
135179
|
if (kind === "NamedType") {
|
|
135151
135180
|
return {
|
|
135152
135181
|
kind,
|
|
135153
135182
|
name: {
|
|
135154
|
-
kind:
|
|
135183
|
+
kind: graphql32.Kind.NAME,
|
|
135155
135184
|
value: type.name
|
|
135156
135185
|
}
|
|
135157
135186
|
};
|
|
@@ -136193,7 +136222,7 @@ ${exportDefaultFrom(`./${doc.name}`, doc.name)}`,
|
|
|
136193
136222
|
);
|
|
136194
136223
|
await fs_exports2.writeFile(path_exports2.join(config2.artifactDirectory, "index.js"), body);
|
|
136195
136224
|
}
|
|
136196
|
-
function inputObject(config2, inputs) {
|
|
136225
|
+
function inputObject(config2, inputs, runtimeScalars) {
|
|
136197
136226
|
const visitedTypes = /* @__PURE__ */ new Set();
|
|
136198
136227
|
const inputObj = {
|
|
136199
136228
|
fields: inputs.reduce((fields, input) => {
|
|
@@ -136209,7 +136238,8 @@ function inputObject(config2, inputs) {
|
|
|
136209
136238
|
...fields,
|
|
136210
136239
|
[input.variable.name.value]: input.defaultValue ? variableValue2(input.defaultValue, {}) : void 0
|
|
136211
136240
|
};
|
|
136212
|
-
}, {})
|
|
136241
|
+
}, {}),
|
|
136242
|
+
runtimeScalars
|
|
136213
136243
|
};
|
|
136214
136244
|
for (const input of inputs) {
|
|
136215
136245
|
walkInputs(config2, visitedTypes, inputObj, input.type);
|
|
@@ -138023,7 +138053,21 @@ function artifactGenerator(stats) {
|
|
|
138023
138053
|
artifact.pluginData[plugin2.name] = plugin2.artifactData({ config: config2, document: doc }) ?? {};
|
|
138024
138054
|
}
|
|
138025
138055
|
if (inputs && inputs.length > 0) {
|
|
138026
|
-
|
|
138056
|
+
const runtimeScalars = inputs.reduce((prev, input) => {
|
|
138057
|
+
const runtimeScalarDirective = input.directives?.find(
|
|
138058
|
+
(directive2) => directive2.name.value === config2.runtimeScalarDirective
|
|
138059
|
+
);
|
|
138060
|
+
if (!runtimeScalarDirective) {
|
|
138061
|
+
return prev;
|
|
138062
|
+
}
|
|
138063
|
+
return {
|
|
138064
|
+
...prev,
|
|
138065
|
+
[input.variable.name.value]: runtimeScalarDirective.arguments?.find(
|
|
138066
|
+
(arg) => arg.name.value === "type"
|
|
138067
|
+
)?.value?.value
|
|
138068
|
+
};
|
|
138069
|
+
}, {});
|
|
138070
|
+
artifact.input = inputObject(config2, inputs, runtimeScalars);
|
|
138027
138071
|
}
|
|
138028
138072
|
if (artifact.kind === "HoudiniQuery") {
|
|
138029
138073
|
const cacheDirective = operations[0].directives?.find(
|
|
@@ -139081,17 +139125,20 @@ export * from "${module}"
|
|
|
139081
139125
|
}
|
|
139082
139126
|
}
|
|
139083
139127
|
await fs_exports2.writeFile(config2.typeIndexPath, indexContent);
|
|
139084
|
-
|
|
139085
|
-
|
|
139086
|
-
|
|
139087
|
-
|
|
139128
|
+
const missingScalarNames = [...missingScalars].filter(
|
|
139129
|
+
(scalar) => !config2.configFile.features?.runtimeScalars?.[scalar]
|
|
139130
|
+
);
|
|
139131
|
+
if (missingScalarNames.length > 0) {
|
|
139132
|
+
console.warn(`\u26A0\uFE0F Missing definitions for the following scalars: ${[
|
|
139133
|
+
...missingScalarNames
|
|
139134
|
+
].join(", ")}
|
|
139088
139135
|
Generated types will contain an any type in place of these values. To fix this, provide an equivalent
|
|
139089
139136
|
type in your config file:
|
|
139090
139137
|
|
|
139091
139138
|
{
|
|
139092
139139
|
scalars: {
|
|
139093
139140
|
${cyan22(`/* in your case, something like */`)}
|
|
139094
|
-
${[...
|
|
139141
|
+
${[...missingScalarNames].map(
|
|
139095
139142
|
(c2) => ` ${c2}: { ${green22(`// <- The GraphQL Scalar`)}
|
|
139096
139143
|
type: "${cyan22(`YourType_${c2}`)}" ${green22(`// <- The TypeScript type`)}
|
|
139097
139144
|
}`
|
|
@@ -141571,7 +141618,7 @@ ${config2.configFile.features?.componentFields ? `
|
|
|
141571
141618
|
"""
|
|
141572
141619
|
@${config2.componentFieldDirective} marks an inline fragment as the selection for a component field
|
|
141573
141620
|
"""
|
|
141574
|
-
directive @${config2.componentFieldDirective}(field: String!, prop: String, export: String, raw: String) on FRAGMENT_DEFINITION | INLINE_FRAGMENT
|
|
141621
|
+
directive @${config2.componentFieldDirective}(field: String!, prop: String, export: String, raw: String) on FRAGMENT_DEFINITION | INLINE_FRAGMENT | FIELD_DEFINITION
|
|
141575
141622
|
|
|
141576
141623
|
` : ""}
|
|
141577
141624
|
|
|
@@ -141582,7 +141629,7 @@ directive @${config2.componentFieldDirective}(field: String!, prop: String, expo
|
|
|
141582
141629
|
}
|
|
141583
141630
|
internalSchema += plugin2.schema({ config: config2 });
|
|
141584
141631
|
}
|
|
141585
|
-
|
|
141632
|
+
let extensions = Object.entries(config2.componentFields).map(([parent2, fields]) => {
|
|
141586
141633
|
return `
|
|
141587
141634
|
extend type ${parent2} {
|
|
141588
141635
|
${Object.entries(fields).map(([fieldName, field]) => {
|
|
@@ -141594,11 +141641,12 @@ directive @${config2.componentFieldDirective}(field: String!, prop: String, expo
|
|
|
141594
141641
|
return `${arg.name}:${typeName}${arg.required ? "!" : ""}`;
|
|
141595
141642
|
}).join("\n") + ")";
|
|
141596
141643
|
}
|
|
141597
|
-
return `${fieldName}${argString}: ${config2.componentScalar}
|
|
141644
|
+
return `${fieldName}${argString}: ${config2.componentScalar}! @componentField(field: "${fieldName}")`;
|
|
141598
141645
|
}).join("\n")}
|
|
141599
141646
|
}
|
|
141600
141647
|
`;
|
|
141601
141648
|
}).join("\n");
|
|
141649
|
+
extensions += `${Object.keys(config2.configFile.features?.runtimeScalars ?? {}).map((scalar) => `scalar ${scalar}`).join("\n")}`;
|
|
141602
141650
|
config2.newSchema = graphql25.print(mergeTypeDefs([internalSchema, config2.newSchema]));
|
|
141603
141651
|
config2.schemaString += extensions;
|
|
141604
141652
|
config2.schema = graphql25.buildSchema(
|
|
@@ -141783,6 +141831,45 @@ async function componentFields(config2, documents) {
|
|
|
141783
141831
|
);
|
|
141784
141832
|
}
|
|
141785
141833
|
}
|
|
141834
|
+
async function addTypename2(config2, documents) {
|
|
141835
|
+
for (const doc of documents) {
|
|
141836
|
+
doc.document = graphql29.visit(doc.document, {
|
|
141837
|
+
VariableDefinition(node2) {
|
|
141838
|
+
const { type, wrappers } = unwrapType2(config2, node2.type);
|
|
141839
|
+
const runtimeScalar = config2.configFile.features?.runtimeScalars?.[type.name];
|
|
141840
|
+
if (runtimeScalar) {
|
|
141841
|
+
return {
|
|
141842
|
+
...node2,
|
|
141843
|
+
type: wrapType({
|
|
141844
|
+
type: config2.schema.getType(runtimeScalar.type),
|
|
141845
|
+
wrappers
|
|
141846
|
+
}),
|
|
141847
|
+
directives: [
|
|
141848
|
+
...node2.directives ?? [],
|
|
141849
|
+
{
|
|
141850
|
+
kind: "Directive",
|
|
141851
|
+
name: {
|
|
141852
|
+
kind: "Name",
|
|
141853
|
+
value: config2.runtimeScalarDirective
|
|
141854
|
+
},
|
|
141855
|
+
arguments: [
|
|
141856
|
+
{
|
|
141857
|
+
kind: "Argument",
|
|
141858
|
+
name: { kind: "Name", value: "type" },
|
|
141859
|
+
value: {
|
|
141860
|
+
kind: "StringValue",
|
|
141861
|
+
value: type.name
|
|
141862
|
+
}
|
|
141863
|
+
}
|
|
141864
|
+
]
|
|
141865
|
+
}
|
|
141866
|
+
]
|
|
141867
|
+
};
|
|
141868
|
+
}
|
|
141869
|
+
}
|
|
141870
|
+
});
|
|
141871
|
+
}
|
|
141872
|
+
}
|
|
141786
141873
|
async function typeCheck(config2, docs) {
|
|
141787
141874
|
const errors = [];
|
|
141788
141875
|
const freeLists = [];
|
|
@@ -141790,7 +141877,7 @@ async function typeCheck(config2, docs) {
|
|
|
141790
141877
|
const listTypes = [];
|
|
141791
141878
|
const fragments = {};
|
|
141792
141879
|
for (const { document: parsed, originalString, filename } of docs) {
|
|
141793
|
-
|
|
141880
|
+
graphql30.visit(parsed, {
|
|
141794
141881
|
FragmentDefinition(definition) {
|
|
141795
141882
|
fragments[definition.name.value] = definition;
|
|
141796
141883
|
},
|
|
@@ -141835,14 +141922,14 @@ async function typeCheck(config2, docs) {
|
|
|
141835
141922
|
);
|
|
141836
141923
|
return;
|
|
141837
141924
|
}
|
|
141838
|
-
if (
|
|
141925
|
+
if (graphql30.isListType(rootType) || graphql30.isNonNullType(rootType) && graphql30.isListType(rootType.ofType)) {
|
|
141839
141926
|
needsParent = true;
|
|
141840
141927
|
break;
|
|
141841
141928
|
}
|
|
141842
|
-
if (
|
|
141929
|
+
if (graphql30.isNonNullType(rootType) && "ofType" in rootType) {
|
|
141843
141930
|
rootType = rootType.ofType;
|
|
141844
141931
|
}
|
|
141845
|
-
if (
|
|
141932
|
+
if (graphql30.isScalarType(rootType)) {
|
|
141846
141933
|
break;
|
|
141847
141934
|
}
|
|
141848
141935
|
rootType = rootType?.getFields()[parent3.name.value]?.type;
|
|
@@ -141918,9 +142005,9 @@ async function typeCheck(config2, docs) {
|
|
|
141918
142005
|
);
|
|
141919
142006
|
}
|
|
141920
142007
|
let targetTypes = [type];
|
|
141921
|
-
if (
|
|
142008
|
+
if (graphql30.isUnionType(type)) {
|
|
141922
142009
|
targetTypes = config2.schema.getPossibleTypes(type);
|
|
141923
|
-
} else if (
|
|
142010
|
+
} else if (graphql30.isInterfaceType(type)) {
|
|
141924
142011
|
try {
|
|
141925
142012
|
for (const key of config2.keyFieldsForType(type.name)) {
|
|
141926
142013
|
if (!type.getFields()[key]) {
|
|
@@ -141956,13 +142043,13 @@ async function typeCheck(config2, docs) {
|
|
|
141956
142043
|
if (errors.length > 0) {
|
|
141957
142044
|
throw errors;
|
|
141958
142045
|
}
|
|
141959
|
-
const rules = (filepath) => [...
|
|
142046
|
+
const rules = (filepath) => [...graphql30.specifiedRules].filter(
|
|
141960
142047
|
(rule) => ![
|
|
141961
|
-
|
|
141962
|
-
|
|
141963
|
-
|
|
141964
|
-
|
|
141965
|
-
|
|
142048
|
+
graphql30.NoUnusedFragmentsRule,
|
|
142049
|
+
graphql30.KnownFragmentNamesRule,
|
|
142050
|
+
graphql30.ExecutableDefinitionsRule,
|
|
142051
|
+
graphql30.KnownDirectivesRule,
|
|
142052
|
+
graphql30.KnownArgumentNamesRule
|
|
141966
142053
|
].includes(rule)
|
|
141967
142054
|
).concat(
|
|
141968
142055
|
validateLists({
|
|
@@ -141983,7 +142070,7 @@ async function typeCheck(config2, docs) {
|
|
|
141983
142070
|
validateLoadingDirective(config2)
|
|
141984
142071
|
);
|
|
141985
142072
|
for (const { filename, document: parsed, originalString } of docs) {
|
|
141986
|
-
for (const error2 of
|
|
142073
|
+
for (const error2 of graphql30.validate(config2.schema, parsed, rules(filename))) {
|
|
141987
142074
|
errors.push(
|
|
141988
142075
|
new HoudiniError2({
|
|
141989
142076
|
filepath: filename,
|
|
@@ -142012,20 +142099,20 @@ function validateRequiredDirective(config2, filepath) {
|
|
|
142012
142099
|
if (!node2.directives?.some(({ name }) => name.value === config2.requiredDirective))
|
|
142013
142100
|
return;
|
|
142014
142101
|
const parentType = parentTypeFromAncestors(config2.schema, filepath, ancestors);
|
|
142015
|
-
if (!
|
|
142102
|
+
if (!graphql30.isObjectType(parentType)) {
|
|
142016
142103
|
ctx.reportError(
|
|
142017
|
-
new
|
|
142104
|
+
new graphql30.GraphQLError(
|
|
142018
142105
|
`@${config2.requiredDirective} may only be used on objects, not arguments`
|
|
142019
142106
|
)
|
|
142020
142107
|
);
|
|
142021
142108
|
return;
|
|
142022
142109
|
}
|
|
142023
142110
|
const type = parentType.getFields()[node2.name.value].type;
|
|
142024
|
-
const isServerNullable = !
|
|
142111
|
+
const isServerNullable = !graphql30.isNonNullType(type);
|
|
142025
142112
|
const isAlreadyClientNullable = isClientNullable(node2, true);
|
|
142026
142113
|
if (!isServerNullable && !isAlreadyClientNullable) {
|
|
142027
142114
|
ctx.reportError(
|
|
142028
|
-
new
|
|
142115
|
+
new graphql30.GraphQLError(
|
|
142029
142116
|
`@${config2.requiredDirective} may only be used on nullable fields`
|
|
142030
142117
|
)
|
|
142031
142118
|
);
|
|
@@ -142047,7 +142134,7 @@ var validateLists = ({
|
|
|
142047
142134
|
if (!config2.isListFragment(node2.name.value)) {
|
|
142048
142135
|
if (!fragments[node2.name.value]) {
|
|
142049
142136
|
ctx.reportError(
|
|
142050
|
-
new
|
|
142137
|
+
new graphql30.GraphQLError(
|
|
142051
142138
|
"Encountered unknown fragment: " + node2.name.value
|
|
142052
142139
|
)
|
|
142053
142140
|
);
|
|
@@ -142057,7 +142144,7 @@ var validateLists = ({
|
|
|
142057
142144
|
const listName = config2.listNameFromFragment(node2.name.value);
|
|
142058
142145
|
if (!lists.includes(listName)) {
|
|
142059
142146
|
ctx.reportError(
|
|
142060
|
-
new
|
|
142147
|
+
new graphql30.GraphQLError(
|
|
142061
142148
|
"Encountered fragment referencing unknown list: " + listName
|
|
142062
142149
|
)
|
|
142063
142150
|
);
|
|
@@ -142082,7 +142169,7 @@ var validateLists = ({
|
|
|
142082
142169
|
);
|
|
142083
142170
|
if (parentArg) {
|
|
142084
142171
|
ctx.reportError(
|
|
142085
|
-
new
|
|
142172
|
+
new graphql30.GraphQLError(
|
|
142086
142173
|
`@${config2.deprecatedlistDirectiveParentIDArg} should be defined only in it's own directive now`
|
|
142087
142174
|
)
|
|
142088
142175
|
);
|
|
@@ -142098,7 +142185,7 @@ var validateLists = ({
|
|
|
142098
142185
|
return;
|
|
142099
142186
|
}
|
|
142100
142187
|
ctx.reportError(
|
|
142101
|
-
new
|
|
142188
|
+
new graphql30.GraphQLError(
|
|
142102
142189
|
`For this list fragment, you need to add or @${config2.listParentDirective} or @${config2.listAllListsDirective} directive to specify the behavior`
|
|
142103
142190
|
)
|
|
142104
142191
|
);
|
|
@@ -142108,7 +142195,7 @@ var validateLists = ({
|
|
|
142108
142195
|
const directiveName = node2.name.value;
|
|
142109
142196
|
if (directiveName === "connection") {
|
|
142110
142197
|
ctx.reportError(
|
|
142111
|
-
new
|
|
142198
|
+
new graphql30.GraphQLError(
|
|
142112
142199
|
"@connection was renamed to @list. Please change your components. If you were using `cache.connection` in your components, you will need to update that to `cache.list` too."
|
|
142113
142200
|
)
|
|
142114
142201
|
);
|
|
@@ -142117,7 +142204,7 @@ var validateLists = ({
|
|
|
142117
142204
|
if (!config2.isInternalDirective(node2.name.value)) {
|
|
142118
142205
|
if (!config2.schema.getDirective(directiveName)) {
|
|
142119
142206
|
ctx.reportError(
|
|
142120
|
-
new
|
|
142207
|
+
new graphql30.GraphQLError(
|
|
142121
142208
|
"Encountered unknown directive: " + directiveName
|
|
142122
142209
|
)
|
|
142123
142210
|
);
|
|
@@ -142126,7 +142213,7 @@ var validateLists = ({
|
|
|
142126
142213
|
}
|
|
142127
142214
|
if (config2.isListOperationDirective(directiveName) && !listTypes.includes(config2.listNameFromDirective(directiveName))) {
|
|
142128
142215
|
ctx.reportError(
|
|
142129
|
-
new
|
|
142216
|
+
new graphql30.GraphQLError(
|
|
142130
142217
|
"Encountered directive referencing unknown list: " + directiveName
|
|
142131
142218
|
)
|
|
142132
142219
|
);
|
|
@@ -142137,7 +142224,7 @@ var validateLists = ({
|
|
|
142137
142224
|
};
|
|
142138
142225
|
function knownArguments(config2) {
|
|
142139
142226
|
return function(ctx) {
|
|
142140
|
-
const nativeValidator =
|
|
142227
|
+
const nativeValidator = graphql30.KnownArgumentNamesRule(ctx);
|
|
142141
142228
|
return {
|
|
142142
142229
|
...nativeValidator,
|
|
142143
142230
|
Directive(directiveNode) {
|
|
@@ -142172,7 +142259,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
142172
142259
|
for (const arg of node2.arguments || []) {
|
|
142173
142260
|
if (arg.value.kind !== "ObjectValue") {
|
|
142174
142261
|
ctx.reportError(
|
|
142175
|
-
new
|
|
142262
|
+
new graphql30.GraphQLError("values in @arguments must be an object")
|
|
142176
142263
|
);
|
|
142177
142264
|
return;
|
|
142178
142265
|
}
|
|
@@ -142182,13 +142269,13 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
142182
142269
|
);
|
|
142183
142270
|
if (!typeArg) {
|
|
142184
142271
|
ctx.reportError(
|
|
142185
|
-
new
|
|
142272
|
+
new graphql30.GraphQLError("missing type field for @arguments directive")
|
|
142186
142273
|
);
|
|
142187
142274
|
return;
|
|
142188
142275
|
}
|
|
142189
|
-
if (typeArg.value.kind !==
|
|
142276
|
+
if (typeArg.value.kind !== graphql30.Kind.STRING) {
|
|
142190
142277
|
ctx.reportError(
|
|
142191
|
-
new
|
|
142278
|
+
new graphql30.GraphQLError("type field to @arguments must be a string")
|
|
142192
142279
|
);
|
|
142193
142280
|
return;
|
|
142194
142281
|
}
|
|
@@ -142201,7 +142288,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
142201
142288
|
);
|
|
142202
142289
|
if (typeArg.value.value !== defaultValueType) {
|
|
142203
142290
|
ctx.reportError(
|
|
142204
|
-
new
|
|
142291
|
+
new graphql30.GraphQLError(
|
|
142205
142292
|
`Invalid default value provided for ${arg.name.value}. Expected ${typeArg.value.value}, found ${defaultValueType}`
|
|
142206
142293
|
)
|
|
142207
142294
|
);
|
|
@@ -142219,7 +142306,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
142219
142306
|
try {
|
|
142220
142307
|
args = fragmentArguments(config2, filepath, fragments[fragmentName]);
|
|
142221
142308
|
} catch (e3) {
|
|
142222
|
-
ctx.reportError(new
|
|
142309
|
+
ctx.reportError(new graphql30.GraphQLError(e3.message));
|
|
142223
142310
|
return;
|
|
142224
142311
|
}
|
|
142225
142312
|
fragmentArguments2[fragmentName] = args;
|
|
@@ -142242,7 +142329,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
142242
142329
|
);
|
|
142243
142330
|
if (missing.length > 0) {
|
|
142244
142331
|
ctx.reportError(
|
|
142245
|
-
new
|
|
142332
|
+
new graphql30.GraphQLError(
|
|
142246
142333
|
`The following arguments are missing from the "${fragmentName}" fragment: ` + JSON.stringify(missing)
|
|
142247
142334
|
)
|
|
142248
142335
|
);
|
|
@@ -142253,7 +142340,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
142253
142340
|
);
|
|
142254
142341
|
if (unknown.length > 0) {
|
|
142255
142342
|
ctx.reportError(
|
|
142256
|
-
new
|
|
142343
|
+
new graphql30.GraphQLError(
|
|
142257
142344
|
"Encountered unknown arguments: " + JSON.stringify(unknown)
|
|
142258
142345
|
)
|
|
142259
142346
|
);
|
|
@@ -142265,7 +142352,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
142265
142352
|
for (const [applied, target] of zipped) {
|
|
142266
142353
|
if (!valueIsType(config2, applied.value, target)) {
|
|
142267
142354
|
ctx.reportError(
|
|
142268
|
-
new
|
|
142355
|
+
new graphql30.GraphQLError(
|
|
142269
142356
|
`Invalid argument type. Expected ${target}, found ${applied.value.kind}`
|
|
142270
142357
|
)
|
|
142271
142358
|
);
|
|
@@ -142307,7 +142394,7 @@ function valueIsType(config2, value2, targetType) {
|
|
|
142307
142394
|
}
|
|
142308
142395
|
if (value2.kind === "EnumValue" && targetType.kind === "NamedType") {
|
|
142309
142396
|
const enumType = config2.schema.getType(targetType.name.value);
|
|
142310
|
-
if (!
|
|
142397
|
+
if (!graphql30.isEnumType(enumType)) {
|
|
142311
142398
|
return false;
|
|
142312
142399
|
}
|
|
142313
142400
|
return enumType.getValues().some((enumValue) => enumValue.value === value2.value);
|
|
@@ -142327,7 +142414,7 @@ function paginateArgs(config2, filepath) {
|
|
|
142327
142414
|
}
|
|
142328
142415
|
if (alreadyPaginated) {
|
|
142329
142416
|
ctx.reportError(
|
|
142330
|
-
new
|
|
142417
|
+
new graphql30.GraphQLError(
|
|
142331
142418
|
`@${config2.paginateDirective} can only appear in a document once.`
|
|
142332
142419
|
)
|
|
142333
142420
|
);
|
|
@@ -142359,7 +142446,7 @@ function paginateArgs(config2, filepath) {
|
|
|
142359
142446
|
const backwards = appliedArgs.has("last");
|
|
142360
142447
|
if (!forward && !backwards) {
|
|
142361
142448
|
ctx.reportError(
|
|
142362
|
-
new
|
|
142449
|
+
new graphql30.GraphQLError(
|
|
142363
142450
|
"A field with cursor-based pagination must have a first or last argument"
|
|
142364
142451
|
)
|
|
142365
142452
|
);
|
|
@@ -142373,7 +142460,7 @@ function paginateArgs(config2, filepath) {
|
|
|
142373
142460
|
}
|
|
142374
142461
|
if (forward && backwards && paginateMode === "Infinite") {
|
|
142375
142462
|
ctx.reportError(
|
|
142376
|
-
new
|
|
142463
|
+
new graphql30.GraphQLError(
|
|
142377
142464
|
`A field with cursor pagination cannot go forwards an backwards simultaneously`
|
|
142378
142465
|
)
|
|
142379
142466
|
);
|
|
@@ -142387,7 +142474,7 @@ function paginateArgs(config2, filepath) {
|
|
|
142387
142474
|
);
|
|
142388
142475
|
if (!appliedLimitArg) {
|
|
142389
142476
|
ctx.reportError(
|
|
142390
|
-
new
|
|
142477
|
+
new graphql30.GraphQLError(
|
|
142391
142478
|
"A field with offset-based pagination must have a limit argument"
|
|
142392
142479
|
)
|
|
142393
142480
|
);
|
|
@@ -142403,20 +142490,20 @@ function noUnusedFragmentArguments(config2) {
|
|
|
142403
142490
|
const args = /* @__PURE__ */ new Set();
|
|
142404
142491
|
return {
|
|
142405
142492
|
enter(node2) {
|
|
142406
|
-
if (node2.kind ===
|
|
142493
|
+
if (node2.kind === graphql30.Kind.FRAGMENT_DEFINITION) {
|
|
142407
142494
|
const definitionArguments = node2.directives?.filter((directive) => directive.name.value === config2.argumentsDirective).flatMap((directive) => directive.arguments);
|
|
142408
142495
|
for (const arg of definitionArguments?.map((arg2) => arg2?.name.value) || []) {
|
|
142409
142496
|
args.add(arg);
|
|
142410
142497
|
}
|
|
142411
|
-
} else if (node2.kind ===
|
|
142498
|
+
} else if (node2.kind === graphql30.Kind.VARIABLE) {
|
|
142412
142499
|
args.delete(node2.name.value);
|
|
142413
142500
|
}
|
|
142414
142501
|
},
|
|
142415
142502
|
leave(node2) {
|
|
142416
|
-
if (node2.kind ===
|
|
142503
|
+
if (node2.kind === graphql30.Kind.FRAGMENT_DEFINITION) {
|
|
142417
142504
|
if (args.size > 0) {
|
|
142418
142505
|
ctx.reportError(
|
|
142419
|
-
new
|
|
142506
|
+
new graphql30.GraphQLError(
|
|
142420
142507
|
"Encountered unused fragment arguments: " + [...args].join(",")
|
|
142421
142508
|
)
|
|
142422
142509
|
);
|
|
@@ -142452,7 +142539,7 @@ function nodeDirectives(config2, directives) {
|
|
|
142452
142539
|
if (definition.kind === "OperationDefinition") {
|
|
142453
142540
|
if (definition.operation !== "query") {
|
|
142454
142541
|
ctx.reportError(
|
|
142455
|
-
new
|
|
142542
|
+
new graphql30.GraphQLError(
|
|
142456
142543
|
`@${node2.name.value} must fall on a fragment or query document`
|
|
142457
142544
|
)
|
|
142458
142545
|
);
|
|
@@ -142464,7 +142551,7 @@ function nodeDirectives(config2, directives) {
|
|
|
142464
142551
|
}
|
|
142465
142552
|
if (!possibleNodes.includes(definitionType)) {
|
|
142466
142553
|
ctx.reportError(
|
|
142467
|
-
new
|
|
142554
|
+
new graphql30.GraphQLError(paginateOnNonNodeMessage(node2.name.value))
|
|
142468
142555
|
);
|
|
142469
142556
|
}
|
|
142470
142557
|
}
|
|
@@ -142483,7 +142570,7 @@ function checkMutationOperation(config2) {
|
|
|
142483
142570
|
);
|
|
142484
142571
|
if (append && prepend) {
|
|
142485
142572
|
ctx.reportError(
|
|
142486
|
-
new
|
|
142573
|
+
new graphql30.GraphQLError(
|
|
142487
142574
|
`You can't apply both @${config2.listPrependDirective} and @${config2.listAppendDirective} at the same time`
|
|
142488
142575
|
)
|
|
142489
142576
|
);
|
|
@@ -142497,7 +142584,7 @@ function checkMutationOperation(config2) {
|
|
|
142497
142584
|
);
|
|
142498
142585
|
if (parentId && allLists) {
|
|
142499
142586
|
ctx.reportError(
|
|
142500
|
-
new
|
|
142587
|
+
new graphql30.GraphQLError(
|
|
142501
142588
|
`You can't apply both @${config2.listParentDirective} and @${config2.listAllListsDirective} at the same time`
|
|
142502
142589
|
)
|
|
142503
142590
|
);
|
|
@@ -142519,7 +142606,7 @@ function checkMaskDirectives(config2) {
|
|
|
142519
142606
|
);
|
|
142520
142607
|
if (maskEnableDirective && maskDisableDirective) {
|
|
142521
142608
|
ctx.reportError(
|
|
142522
|
-
new
|
|
142609
|
+
new graphql30.GraphQLError(
|
|
142523
142610
|
`You can't apply both @${config2.maskEnableDirective} and @${config2.maskDisableDirective} at the same time`
|
|
142524
142611
|
)
|
|
142525
142612
|
);
|
|
@@ -142561,7 +142648,7 @@ function validateLoadingDirective(config2) {
|
|
|
142561
142648
|
);
|
|
142562
142649
|
if (!parentLoading && !global2) {
|
|
142563
142650
|
ctx.reportError(
|
|
142564
|
-
new
|
|
142651
|
+
new graphql30.GraphQLError(
|
|
142565
142652
|
`@${config2.loadingDirective} can only be applied on a field or fragment spread at the root of a document or on one whose parent also has @${config2.loadingDirective}`
|
|
142566
142653
|
)
|
|
142567
142654
|
);
|
|
@@ -142583,7 +142670,7 @@ function validateLoadingDirective(config2) {
|
|
|
142583
142670
|
);
|
|
142584
142671
|
if (!parentLoading && !global2) {
|
|
142585
142672
|
ctx.reportError(
|
|
142586
|
-
new
|
|
142673
|
+
new graphql30.GraphQLError(
|
|
142587
142674
|
`@${config2.loadingDirective} can only be applied on a field or fragment spread at the root of a document or on one whose parent also has @${config2.loadingDirective}`
|
|
142588
142675
|
)
|
|
142589
142676
|
);
|
|
@@ -142598,7 +142685,7 @@ function getAndVerifyNodeInterface(config2) {
|
|
|
142598
142685
|
if (!nodeInterface) {
|
|
142599
142686
|
return null;
|
|
142600
142687
|
}
|
|
142601
|
-
if (!
|
|
142688
|
+
if (!graphql30.isInterfaceType(nodeInterface)) {
|
|
142602
142689
|
displayInvalidNodeFieldMessage(config2);
|
|
142603
142690
|
return null;
|
|
142604
142691
|
}
|
|
@@ -142692,7 +142779,7 @@ async function uniqueDocumentNames(config2, docs) {
|
|
|
142692
142779
|
async function noIDAlias(config2, docs) {
|
|
142693
142780
|
const errors = [];
|
|
142694
142781
|
for (const { filename, document: document2 } of docs) {
|
|
142695
|
-
|
|
142782
|
+
graphql31.visit(document2, {
|
|
142696
142783
|
Field(node2, _, __, ___, ancestors) {
|
|
142697
142784
|
const fieldType = parentTypeFromAncestors(config2.schema, filename, ancestors).name;
|
|
142698
142785
|
if (config2.keyFieldsForType(fieldType).includes(node2.alias?.value || "")) {
|
|
@@ -142730,7 +142817,7 @@ async function validatePlugins(config2, documents) {
|
|
|
142730
142817
|
async function componentFields2(config2, docs) {
|
|
142731
142818
|
const errors = [];
|
|
142732
142819
|
for (const { filename: filepath, document: document2 } of docs) {
|
|
142733
|
-
|
|
142820
|
+
graphql322.visit(document2, {
|
|
142734
142821
|
FragmentDefinition(node2, _, __, ___, ancestors) {
|
|
142735
142822
|
const componentFieldDirective = node2.directives?.find(
|
|
142736
142823
|
(dir) => dir.name.value === config2.componentFieldDirective
|
|
@@ -142772,14 +142859,26 @@ async function componentFields2(config2, docs) {
|
|
|
142772
142859
|
}
|
|
142773
142860
|
const fieldValue = fieldArg.value?.kind === "StringValue" ? fieldArg.value.value : void 0;
|
|
142774
142861
|
const propValue = propArg.value?.kind === "StringValue" ? propArg.value.value : void 0;
|
|
142862
|
+
const existingField = fieldValue && config2.componentFields[parent2]?.[fieldValue];
|
|
142775
142863
|
const parentType = config2.schema.getType(parent2);
|
|
142776
|
-
|
|
142864
|
+
let conflict = false;
|
|
142865
|
+
if (existingField && existingField.filepath !== filepath) {
|
|
142866
|
+
conflict = true;
|
|
142867
|
+
} else if (parentType && fieldValue) {
|
|
142868
|
+
const fieldDef = graphql322.isObjectType(parentType) && parentType.getFields()[fieldValue];
|
|
142869
|
+
if (fieldDef && !fieldDef.astNode?.directives?.find(
|
|
142870
|
+
(dir) => dir.name.value === config2.componentFieldDirective
|
|
142871
|
+
)) {
|
|
142872
|
+
conflict = true;
|
|
142873
|
+
}
|
|
142874
|
+
}
|
|
142875
|
+
if (conflict) {
|
|
142777
142876
|
errors.push({
|
|
142778
|
-
message: `Duplicate component field definition for ${parent2}.${fieldValue}
|
|
142877
|
+
message: `Duplicate component field definition for ${parent2}.${fieldValue}.` + (existingField ? "The conflicting component field was defined in " + existingField.filepath : ""),
|
|
142779
142878
|
filepath
|
|
142780
142879
|
});
|
|
142781
142880
|
}
|
|
142782
|
-
if (parentType &&
|
|
142881
|
+
if (parentType && graphql322.isAbstractType(parentType)) {
|
|
142783
142882
|
errors.push({
|
|
142784
142883
|
message: `Cannot add component field ${parent2}.${fieldValue} because ${parent2} is an abstract type`,
|
|
142785
142884
|
filepath
|
|
@@ -142839,6 +142938,7 @@ async function runPipeline22(config2, docs) {
|
|
|
142839
142938
|
[
|
|
142840
142939
|
componentFields2,
|
|
142841
142940
|
graphqlExtensions,
|
|
142941
|
+
addTypename2,
|
|
142842
142942
|
...wrapHook(beforeValidate),
|
|
142843
142943
|
typeCheck,
|
|
142844
142944
|
uniqueDocumentNames,
|
|
@@ -142957,16 +143057,16 @@ function logStyled(kind, stat23, logLevel, plugin2) {
|
|
|
142957
143057
|
|
|
142958
143058
|
// ../houdini/build/test-esm/index.js
|
|
142959
143059
|
import { createRequire as conflict_free3 } from "module";
|
|
143060
|
+
import * as graphql34 from "graphql";
|
|
142960
143061
|
import * as graphql332 from "graphql";
|
|
142961
|
-
import * as graphql322 from "graphql";
|
|
142962
143062
|
import * as graphql210 from "graphql";
|
|
142963
143063
|
import { fileURLToPath as fileURLToPath3, pathToFileURL as pathToFileURL3 } from "node:url";
|
|
142964
143064
|
import fs4 from "node:fs/promises";
|
|
142965
143065
|
import { promisify as promisify4 } from "node:util";
|
|
142966
143066
|
import os3 from "node:os";
|
|
142967
143067
|
import path3 from "node:path";
|
|
142968
|
-
import * as graphql34 from "graphql";
|
|
142969
143068
|
import * as graphql35 from "graphql";
|
|
143069
|
+
import * as graphql36 from "graphql";
|
|
142970
143070
|
import * as graphql43 from "graphql";
|
|
142971
143071
|
import * as graphql53 from "graphql";
|
|
142972
143072
|
import * as graphql162 from "graphql";
|
|
@@ -143015,6 +143115,7 @@ import * as graphql282 from "graphql";
|
|
|
143015
143115
|
import * as graphql292 from "graphql";
|
|
143016
143116
|
import * as graphql302 from "graphql";
|
|
143017
143117
|
import * as graphql312 from "graphql";
|
|
143118
|
+
import * as graphql323 from "graphql";
|
|
143018
143119
|
var require4 = conflict_free3(import.meta.url);
|
|
143019
143120
|
var __create4 = Object.create;
|
|
143020
143121
|
var __defProp4 = Object.defineProperty;
|
|
@@ -167722,7 +167823,7 @@ var require_path_visitor3 = __commonJS4({
|
|
|
167722
167823
|
}
|
|
167723
167824
|
return target;
|
|
167724
167825
|
}
|
|
167725
|
-
PathVisitor.visit = function
|
|
167826
|
+
PathVisitor.visit = function visit192(node2, methods) {
|
|
167726
167827
|
return PathVisitor.fromMethodsObject(methods).visit(node2);
|
|
167727
167828
|
};
|
|
167728
167829
|
var PVp = PathVisitor.prototype;
|
|
@@ -167913,7 +168014,7 @@ var require_path_visitor3 = __commonJS4({
|
|
|
167913
168014
|
this.needToCallTraverse = false;
|
|
167914
168015
|
return visitChildren(path22, PathVisitor.fromMethodsObject(newVisitor || this.visitor));
|
|
167915
168016
|
};
|
|
167916
|
-
sharedContextProtoMethods.visit = function
|
|
168017
|
+
sharedContextProtoMethods.visit = function visit192(path22, newVisitor) {
|
|
167917
168018
|
if (!(this instanceof this.Context)) {
|
|
167918
168019
|
throw new Error("");
|
|
167919
168020
|
}
|
|
@@ -169256,7 +169357,7 @@ var require_main4 = __commonJS4({
|
|
|
169256
169357
|
var someField = _a.someField;
|
|
169257
169358
|
var Type = _a.Type;
|
|
169258
169359
|
var use = _a.use;
|
|
169259
|
-
var
|
|
169360
|
+
var visit192 = _a.visit;
|
|
169260
169361
|
exports.astNodesAreEquivalent = astNodesAreEquivalent;
|
|
169261
169362
|
exports.builders = builders;
|
|
169262
169363
|
exports.builtInTypes = builtInTypes;
|
|
@@ -169273,7 +169374,7 @@ var require_main4 = __commonJS4({
|
|
|
169273
169374
|
exports.someField = someField;
|
|
169274
169375
|
exports.Type = Type;
|
|
169275
169376
|
exports.use = use;
|
|
169276
|
-
exports.visit =
|
|
169377
|
+
exports.visit = visit192;
|
|
169277
169378
|
Object.assign(namedTypes_1.namedTypes, n);
|
|
169278
169379
|
}
|
|
169279
169380
|
});
|
|
@@ -199194,8 +199295,22 @@ var query3 = documentPlugin3(ArtifactKind3.Query, function() {
|
|
|
199194
199295
|
let lastVariables = null;
|
|
199195
199296
|
return {
|
|
199196
199297
|
start(ctx, { next }) {
|
|
199298
|
+
const runtimeScalarPayload = {
|
|
199299
|
+
session: ctx.session
|
|
199300
|
+
};
|
|
199197
199301
|
ctx.variables = {
|
|
199198
199302
|
...lastVariables,
|
|
199303
|
+
...Object.fromEntries(
|
|
199304
|
+
Object.entries(ctx.artifact.input?.runtimeScalars ?? {}).map(
|
|
199305
|
+
([field, type]) => {
|
|
199306
|
+
const runtimeScalar = ctx.config.features?.runtimeScalars?.[type];
|
|
199307
|
+
if (!runtimeScalar) {
|
|
199308
|
+
return [field, type];
|
|
199309
|
+
}
|
|
199310
|
+
return [field, runtimeScalar.resolve(runtimeScalarPayload)];
|
|
199311
|
+
}
|
|
199312
|
+
)
|
|
199313
|
+
),
|
|
199199
199314
|
...ctx.variables
|
|
199200
199315
|
};
|
|
199201
199316
|
next(ctx);
|
|
@@ -199767,6 +199882,9 @@ var Config = class {
|
|
|
199767
199882
|
get loadingDirective() {
|
|
199768
199883
|
return `loading`;
|
|
199769
199884
|
}
|
|
199885
|
+
get runtimeScalarDirective() {
|
|
199886
|
+
return "__houdini__runtimeScalar";
|
|
199887
|
+
}
|
|
199770
199888
|
get whenDirective() {
|
|
199771
199889
|
return "when";
|
|
199772
199890
|
}
|
|
@@ -199837,7 +199955,7 @@ var Config = class {
|
|
|
199837
199955
|
const internalDirectives = this.#newSchemaInstance?.getDirectives().reduce((list, directive) => {
|
|
199838
199956
|
return list.concat(directive.name);
|
|
199839
199957
|
}, []) ?? [];
|
|
199840
|
-
return !defaultDirectives3.includes(name) && (internalDirectives.includes(name) || this.isDeleteDirective(name));
|
|
199958
|
+
return !defaultDirectives3.includes(name) && (internalDirectives.includes(name) || this.isDeleteDirective(name) || name === this.runtimeScalarDirective);
|
|
199841
199959
|
}
|
|
199842
199960
|
get componentFieldDirective() {
|
|
199843
199961
|
return "componentField";
|
|
@@ -200644,9 +200762,15 @@ function testConfigFile({ plugins, ...config2 } = {}) {
|
|
|
200644
200762
|
...plugins
|
|
200645
200763
|
},
|
|
200646
200764
|
features: {
|
|
200647
|
-
componentFields: true
|
|
200765
|
+
componentFields: true,
|
|
200766
|
+
imperativeCache: true,
|
|
200767
|
+
runtimeScalars: {
|
|
200768
|
+
ViewerIDFromSession: {
|
|
200769
|
+
type: "ID",
|
|
200770
|
+
resolve: ({ session }) => session.token
|
|
200771
|
+
}
|
|
200772
|
+
}
|
|
200648
200773
|
},
|
|
200649
|
-
acceptImperativeInstability: true,
|
|
200650
200774
|
...config2
|
|
200651
200775
|
};
|
|
200652
200776
|
}
|
|
@@ -200657,7 +200781,7 @@ function testConfig(config2 = {}) {
|
|
|
200657
200781
|
});
|
|
200658
200782
|
}
|
|
200659
200783
|
function mockCollectedDoc(query22, data2) {
|
|
200660
|
-
const parsed =
|
|
200784
|
+
const parsed = graphql34.parse(query22);
|
|
200661
200785
|
const name = parsed.definitions[0].name.value;
|
|
200662
200786
|
const operations = parsed.definitions;
|
|
200663
200787
|
let kind = ArtifactKind3.Fragment;
|
|
@@ -200689,14 +200813,14 @@ import * as url from "node:url";
|
|
|
200689
200813
|
import { loadEnv } from "vite";
|
|
200690
200814
|
|
|
200691
200815
|
// src/plugin/artifactData.ts
|
|
200692
|
-
import * as
|
|
200816
|
+
import * as graphql37 from "graphql";
|
|
200693
200817
|
function artifactData({
|
|
200694
200818
|
config: config2,
|
|
200695
200819
|
document: document2
|
|
200696
200820
|
}) {
|
|
200697
200821
|
let isManualLoad = document2.filename.endsWith(".svelte");
|
|
200698
200822
|
let set_blocking = void 0;
|
|
200699
|
-
|
|
200823
|
+
graphql37.visit(document2.document, {
|
|
200700
200824
|
Directive(node2, _, __, ___) {
|
|
200701
200825
|
if (node2.name.value === config2.loadDirective) {
|
|
200702
200826
|
isManualLoad = false;
|
|
@@ -200726,19 +200850,19 @@ function artifactData({
|
|
|
200726
200850
|
}
|
|
200727
200851
|
|
|
200728
200852
|
// src/plugin/kit.ts
|
|
200729
|
-
import * as
|
|
200853
|
+
import * as graphql41 from "graphql";
|
|
200730
200854
|
|
|
200731
200855
|
// ../houdini/build/vite-esm/index.js
|
|
200732
200856
|
import { createRequire as conflict_free4 } from "module";
|
|
200733
200857
|
import { statSync as statSync2, createReadStream as createReadStream2, promises as fs22 } from "node:fs";
|
|
200734
|
-
import * as
|
|
200858
|
+
import * as graphql333 from "graphql";
|
|
200735
200859
|
import { getNamedType as getNamedType32, isScalarType as isScalarType52 } from "graphql";
|
|
200736
200860
|
import { parse as parse15 } from "graphql";
|
|
200737
200861
|
import { GraphQLError as GraphQLError6 } from "graphql";
|
|
200738
200862
|
import { print as print17, Kind as Kind310, isSpecifiedScalarType as isSpecifiedScalarType7, isIntrospectionType as isIntrospectionType4, isSpecifiedDirective as isSpecifiedDirective5, astFromValue as astFromValue3, GraphQLDeprecatedDirective as GraphQLDeprecatedDirective4, isObjectType as isObjectType22, isInterfaceType as isInterfaceType17, isUnionType as isUnionType19, isInputObjectType as isInputObjectType9, isEnumType as isEnumType18, isScalarType as isScalarType19 } from "graphql";
|
|
200739
200863
|
import { isNonNullType as isNonNullType16, Kind as Kind44, isListType as isListType11 } from "graphql";
|
|
200740
200864
|
import { Kind as Kind210 } from "graphql";
|
|
200741
|
-
import { visit as
|
|
200865
|
+
import { visit as visit36, TokenKind as TokenKind4 } from "graphql";
|
|
200742
200866
|
import { GraphQLObjectType as GraphQLObjectType32, GraphQLSchema as GraphQLSchema2, isInterfaceType as isInterfaceType34, isEnumType as isEnumType32, isObjectType as isObjectType44, isScalarType as isScalarType32, isUnionType as isUnionType32, isInputObjectType as isInputObjectType42, GraphQLInputObjectType as GraphQLInputObjectType32, GraphQLInterfaceType as GraphQLInterfaceType32, isLeafType as isLeafType22, isListType as isListType42, isNonNullType as isNonNullType32, isNamedType as isNamedType22, GraphQLList as GraphQLList32, GraphQLNonNull as GraphQLNonNull32, GraphQLEnumType as GraphQLEnumType22, Kind as Kind52 } from "graphql";
|
|
200743
200867
|
import { isObjectType as isObjectType23 } from "graphql";
|
|
200744
200868
|
import { GraphQLDirective as GraphQLDirective2, GraphQLEnumType as GraphQLEnumType4, GraphQLInputObjectType as GraphQLInputObjectType22, GraphQLInterfaceType as GraphQLInterfaceType22, GraphQLList as GraphQLList22, GraphQLObjectType as GraphQLObjectType22, GraphQLNonNull as GraphQLNonNull22, GraphQLScalarType as GraphQLScalarType4, GraphQLUnionType as GraphQLUnionType3, isInterfaceType as isInterfaceType22, isEnumType as isEnumType22, isInputObjectType as isInputObjectType24, isListType as isListType24, isNamedType as isNamedType4, isNonNullType as isNonNullType22, isObjectType as isObjectType32, isScalarType as isScalarType22, isUnionType as isUnionType22, isSpecifiedScalarType as isSpecifiedScalarType22, isSpecifiedDirective as isSpecifiedDirective22 } from "graphql";
|
|
@@ -200768,7 +200892,7 @@ import fs5 from "node:fs/promises";
|
|
|
200768
200892
|
import { promisify as promisify5 } from "node:util";
|
|
200769
200893
|
import os4 from "node:os";
|
|
200770
200894
|
import path4 from "node:path";
|
|
200771
|
-
import * as
|
|
200895
|
+
import * as graphql38 from "graphql";
|
|
200772
200896
|
import Stream2, { PassThrough as PassThrough2 } from "node:stream";
|
|
200773
200897
|
import { types as types3, deprecate as deprecate3, promisify as promisify22 } from "node:util";
|
|
200774
200898
|
import { Buffer as Buffer22 } from "node:buffer";
|
|
@@ -200776,7 +200900,7 @@ import { types as types22 } from "node:util";
|
|
|
200776
200900
|
import http2 from "node:http";
|
|
200777
200901
|
import { format as formatUrl2 } from "node:url";
|
|
200778
200902
|
import { deprecate as deprecate22 } from "node:util";
|
|
200779
|
-
import * as
|
|
200903
|
+
import * as graphql39 from "graphql";
|
|
200780
200904
|
import * as graphql44 from "graphql";
|
|
200781
200905
|
import * as graphql54 from "graphql";
|
|
200782
200906
|
import * as graphql163 from "graphql";
|
|
@@ -200825,6 +200949,7 @@ import * as graphql283 from "graphql";
|
|
|
200825
200949
|
import * as graphql293 from "graphql";
|
|
200826
200950
|
import * as graphql303 from "graphql";
|
|
200827
200951
|
import * as graphql313 from "graphql";
|
|
200952
|
+
import * as graphql324 from "graphql";
|
|
200828
200953
|
var require5 = conflict_free4(import.meta.url);
|
|
200829
200954
|
var __create5 = Object.create;
|
|
200830
200955
|
var __defProp5 = Object.defineProperty;
|
|
@@ -232527,7 +232652,7 @@ var require_path_visitor4 = __commonJS5({
|
|
|
232527
232652
|
}
|
|
232528
232653
|
return target;
|
|
232529
232654
|
}
|
|
232530
|
-
PathVisitor.visit = function
|
|
232655
|
+
PathVisitor.visit = function visit202(node2, methods) {
|
|
232531
232656
|
return PathVisitor.fromMethodsObject(methods).visit(node2);
|
|
232532
232657
|
};
|
|
232533
232658
|
var PVp = PathVisitor.prototype;
|
|
@@ -232718,7 +232843,7 @@ var require_path_visitor4 = __commonJS5({
|
|
|
232718
232843
|
this.needToCallTraverse = false;
|
|
232719
232844
|
return visitChildren(path32, PathVisitor.fromMethodsObject(newVisitor || this.visitor));
|
|
232720
232845
|
};
|
|
232721
|
-
sharedContextProtoMethods.visit = function
|
|
232846
|
+
sharedContextProtoMethods.visit = function visit202(path32, newVisitor) {
|
|
232722
232847
|
if (!(this instanceof this.Context)) {
|
|
232723
232848
|
throw new Error("");
|
|
232724
232849
|
}
|
|
@@ -234061,7 +234186,7 @@ var require_main5 = __commonJS5({
|
|
|
234061
234186
|
var someField = _a.someField;
|
|
234062
234187
|
var Type = _a.Type;
|
|
234063
234188
|
var use = _a.use;
|
|
234064
|
-
var
|
|
234189
|
+
var visit202 = _a.visit;
|
|
234065
234190
|
exports.astNodesAreEquivalent = astNodesAreEquivalent;
|
|
234066
234191
|
exports.builders = builders;
|
|
234067
234192
|
exports.builtInTypes = builtInTypes;
|
|
@@ -234078,7 +234203,7 @@ var require_main5 = __commonJS5({
|
|
|
234078
234203
|
exports.someField = someField;
|
|
234079
234204
|
exports.Type = Type;
|
|
234080
234205
|
exports.use = use;
|
|
234081
|
-
exports.visit =
|
|
234206
|
+
exports.visit = visit202;
|
|
234082
234207
|
Object.assign(namedTypes_1.namedTypes, n);
|
|
234083
234208
|
}
|
|
234084
234209
|
});
|
|
@@ -265073,8 +265198,22 @@ var query4 = documentPlugin4(ArtifactKind4.Query, function() {
|
|
|
265073
265198
|
let lastVariables = null;
|
|
265074
265199
|
return {
|
|
265075
265200
|
start(ctx, { next }) {
|
|
265201
|
+
const runtimeScalarPayload = {
|
|
265202
|
+
session: ctx.session
|
|
265203
|
+
};
|
|
265076
265204
|
ctx.variables = {
|
|
265077
265205
|
...lastVariables,
|
|
265206
|
+
...Object.fromEntries(
|
|
265207
|
+
Object.entries(ctx.artifact.input?.runtimeScalars ?? {}).map(
|
|
265208
|
+
([field, type]) => {
|
|
265209
|
+
const runtimeScalar = ctx.config.features?.runtimeScalars?.[type];
|
|
265210
|
+
if (!runtimeScalar) {
|
|
265211
|
+
return [field, type];
|
|
265212
|
+
}
|
|
265213
|
+
return [field, runtimeScalar.resolve(runtimeScalarPayload)];
|
|
265214
|
+
}
|
|
265215
|
+
)
|
|
265216
|
+
),
|
|
265078
265217
|
...ctx.variables
|
|
265079
265218
|
};
|
|
265080
265219
|
next(ctx);
|
|
@@ -293566,7 +293705,7 @@ var yellow6 = (str) => {
|
|
|
293566
293705
|
};
|
|
293567
293706
|
|
|
293568
293707
|
// src/plugin/extractLoadFunction.ts
|
|
293569
|
-
import * as
|
|
293708
|
+
import * as graphql40 from "graphql";
|
|
293570
293709
|
import { transformWithEsbuild } from "vite";
|
|
293571
293710
|
|
|
293572
293711
|
// src/plugin/naming.ts
|
|
@@ -293603,7 +293742,7 @@ async function extract_load_function(config2, filepath, mockArtifacts) {
|
|
|
293603
293742
|
return {
|
|
293604
293743
|
exports,
|
|
293605
293744
|
houdini_load: load.map(
|
|
293606
|
-
(query5) =>
|
|
293745
|
+
(query5) => graphql40.parse(query5).definitions[0]
|
|
293607
293746
|
)
|
|
293608
293747
|
};
|
|
293609
293748
|
}
|
|
@@ -293916,7 +294055,7 @@ async function walk_routes(config2, framework2, visitor, dirpath = config2.route
|
|
|
293916
294055
|
continue;
|
|
293917
294056
|
}
|
|
293918
294057
|
try {
|
|
293919
|
-
const query5 = config2.extractQueryDefinition(
|
|
294058
|
+
const query5 = config2.extractQueryDefinition(graphql41.parse(contents));
|
|
293920
294059
|
await visitor.routeLayoutQuery?.(query5, childPath);
|
|
293921
294060
|
layoutQueries.push(query5);
|
|
293922
294061
|
} catch (e3) {
|
|
@@ -293929,7 +294068,7 @@ async function walk_routes(config2, framework2, visitor, dirpath = config2.route
|
|
|
293929
294068
|
continue;
|
|
293930
294069
|
}
|
|
293931
294070
|
try {
|
|
293932
|
-
const query5 = config2.extractQueryDefinition(
|
|
294071
|
+
const query5 = config2.extractQueryDefinition(graphql41.parse(contents));
|
|
293933
294072
|
await visitor.routePageQuery?.(query5, childPath);
|
|
293934
294073
|
pageQueries.push(query5);
|
|
293935
294074
|
} catch (e3) {
|
|
@@ -295333,7 +295472,7 @@ async function kit_init(page2) {
|
|
|
295333
295472
|
}
|
|
295334
295473
|
|
|
295335
295474
|
// src/plugin/transforms/kit/load.ts
|
|
295336
|
-
import * as
|
|
295475
|
+
import * as graphql45 from "graphql";
|
|
295337
295476
|
var recast19 = __toESM(require_main7(), 1);
|
|
295338
295477
|
var AST19 = recast19.types.builders;
|
|
295339
295478
|
async function kit_load_generator(page2) {
|
|
@@ -295616,7 +295755,7 @@ async function find_special_query(type, page2) {
|
|
|
295616
295755
|
if (!contents) {
|
|
295617
295756
|
return null;
|
|
295618
295757
|
}
|
|
295619
|
-
const parsed =
|
|
295758
|
+
const parsed = graphql45.parse(contents);
|
|
295620
295759
|
const definition = parsed.definitions.find(
|
|
295621
295760
|
(defn) => defn.kind === "OperationDefinition" && defn.operation === "query"
|
|
295622
295761
|
);
|
|
@@ -295687,7 +295826,8 @@ function variable_function_for_query(page2, query5, has_local) {
|
|
|
295687
295826
|
const has_args = {};
|
|
295688
295827
|
for (const definition of query5.variableDefinitions ?? []) {
|
|
295689
295828
|
const unwrapped = unwrapType(page2.config, definition.type);
|
|
295690
|
-
|
|
295829
|
+
const runtime_scalar = page2.config.configFile.features?.runtimeScalars?.[unwrapped.type.name];
|
|
295830
|
+
if (unwrapped.wrappers[unwrapped.wrappers.length - 1] === TypeWrapper.NonNull && !definition.defaultValue && !runtime_scalar && (!params[definition.variable.name.value] || params[definition.variable.name.value].optional)) {
|
|
295691
295831
|
missing_args.push(definition.variable.name);
|
|
295692
295832
|
}
|
|
295693
295833
|
if (params[definition.variable.name.value]) {
|
|
@@ -295707,8 +295847,8 @@ function variable_function_for_query(page2, query5, has_local) {
|
|
|
295707
295847
|
AST19.variableDeclarator(
|
|
295708
295848
|
AST19.identifier("result"),
|
|
295709
295849
|
AST19.objectExpression(
|
|
295710
|
-
Object.entries(has_args).map(
|
|
295711
|
-
|
|
295850
|
+
Object.entries(has_args).map(([arg, type]) => {
|
|
295851
|
+
return AST19.objectProperty(
|
|
295712
295852
|
AST19.identifier(arg),
|
|
295713
295853
|
AST19.callExpression(AST19.identifier("parseScalar"), [
|
|
295714
295854
|
AST19.identifier("config"),
|
|
@@ -295721,8 +295861,8 @@ function variable_function_for_query(page2, query5, has_local) {
|
|
|
295721
295861
|
AST19.identifier(arg)
|
|
295722
295862
|
)
|
|
295723
295863
|
])
|
|
295724
|
-
)
|
|
295725
|
-
)
|
|
295864
|
+
);
|
|
295865
|
+
})
|
|
295726
295866
|
)
|
|
295727
295867
|
)
|
|
295728
295868
|
])
|
|
@@ -295950,7 +296090,7 @@ function replace_tag_content(source, start, end, insert) {
|
|
|
295950
296090
|
var replace_between = (origin, startIndex, endIndex, insertion) => origin.substring(0, startIndex) + insertion + origin.substring(endIndex);
|
|
295951
296091
|
|
|
295952
296092
|
// src/plugin/validate.ts
|
|
295953
|
-
import * as
|
|
296093
|
+
import * as graphql46 from "graphql";
|
|
295954
296094
|
async function validate4({
|
|
295955
296095
|
config: config2,
|
|
295956
296096
|
documents
|
|
@@ -295977,7 +296117,7 @@ async function validate4({
|
|
|
295977
296117
|
})
|
|
295978
296118
|
);
|
|
295979
296119
|
}
|
|
295980
|
-
|
|
296120
|
+
graphql46.visit(doc.document, {
|
|
295981
296121
|
Directive(node2, _, __, ___, ancestors) {
|
|
295982
296122
|
const blockingDirectives = [
|
|
295983
296123
|
config2.blockingDirective,
|