houdini 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/cmd-cjs/index.js +174 -83
- package/build/cmd-esm/index.js +174 -83
- package/build/codegen/generators/artifacts/inputs.d.ts +1 -1
- package/build/codegen/transforms/index.d.ts +1 -0
- package/build/codegen/transforms/runtimeScalars.d.ts +2 -0
- package/build/codegen-cjs/index.js +167 -79
- package/build/codegen-esm/index.js +167 -79
- package/build/lib/config.d.ts +1 -0
- package/build/lib-cjs/index.js +44 -13
- package/build/lib-esm/index.js +44 -13
- package/build/runtime/lib/config.d.ts +12 -2
- package/build/runtime/lib/types.d.ts +4 -0
- package/build/runtime/router/session.d.ts +1 -2
- package/build/runtime-cjs/client/plugins/query.js +14 -0
- package/build/runtime-cjs/lib/config.d.ts +12 -2
- package/build/runtime-cjs/lib/types.d.ts +4 -0
- 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-esm/client/plugins/query.js +14 -0
- package/build/runtime-esm/lib/config.d.ts +12 -2
- package/build/runtime-esm/lib/types.d.ts +4 -0
- 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/test-cjs/index.js +179 -82
- package/build/test-esm/index.js +179 -82
- package/build/vite-cjs/index.js +171 -80
- package/build/vite-esm/index.js +171 -80
- package/package.json +1 -1
package/build/cmd-cjs/index.js
CHANGED
|
@@ -30948,7 +30948,7 @@ var require_path_visitor = __commonJS({
|
|
|
30948
30948
|
}
|
|
30949
30949
|
return target;
|
|
30950
30950
|
}
|
|
30951
|
-
PathVisitor.visit = function
|
|
30951
|
+
PathVisitor.visit = function visit20(node, methods) {
|
|
30952
30952
|
return PathVisitor.fromMethodsObject(methods).visit(node);
|
|
30953
30953
|
};
|
|
30954
30954
|
var PVp = PathVisitor.prototype;
|
|
@@ -31139,7 +31139,7 @@ var require_path_visitor = __commonJS({
|
|
|
31139
31139
|
this.needToCallTraverse = false;
|
|
31140
31140
|
return visitChildren(path3, PathVisitor.fromMethodsObject(newVisitor || this.visitor));
|
|
31141
31141
|
};
|
|
31142
|
-
sharedContextProtoMethods.visit = function
|
|
31142
|
+
sharedContextProtoMethods.visit = function visit20(path3, newVisitor) {
|
|
31143
31143
|
if (!(this instanceof this.Context)) {
|
|
31144
31144
|
throw new Error("");
|
|
31145
31145
|
}
|
|
@@ -32532,7 +32532,7 @@ var require_main = __commonJS({
|
|
|
32532
32532
|
var someField = _a.someField;
|
|
32533
32533
|
var Type = _a.Type;
|
|
32534
32534
|
var use = _a.use;
|
|
32535
|
-
var
|
|
32535
|
+
var visit20 = _a.visit;
|
|
32536
32536
|
exports.astNodesAreEquivalent = astNodesAreEquivalent;
|
|
32537
32537
|
exports.builders = builders;
|
|
32538
32538
|
exports.builtInTypes = builtInTypes;
|
|
@@ -32549,7 +32549,7 @@ var require_main = __commonJS({
|
|
|
32549
32549
|
exports.someField = someField;
|
|
32550
32550
|
exports.Type = Type;
|
|
32551
32551
|
exports.use = use;
|
|
32552
|
-
exports.visit =
|
|
32552
|
+
exports.visit = visit20;
|
|
32553
32553
|
Object.assign(namedTypes_1.namedTypes, n);
|
|
32554
32554
|
}
|
|
32555
32555
|
});
|
|
@@ -67322,8 +67322,22 @@ var query = documentPlugin(ArtifactKind.Query, function() {
|
|
|
67322
67322
|
let lastVariables = null;
|
|
67323
67323
|
return {
|
|
67324
67324
|
start(ctx, { next }) {
|
|
67325
|
+
const runtimeScalarPayload = {
|
|
67326
|
+
session: ctx.session
|
|
67327
|
+
};
|
|
67325
67328
|
ctx.variables = {
|
|
67326
67329
|
...lastVariables,
|
|
67330
|
+
...Object.fromEntries(
|
|
67331
|
+
Object.entries(ctx.artifact.input?.runtimeScalars ?? {}).map(
|
|
67332
|
+
([field, type]) => {
|
|
67333
|
+
const runtimeScalar = ctx.config.features?.runtimeScalars?.[type];
|
|
67334
|
+
if (!runtimeScalar) {
|
|
67335
|
+
return [field, type];
|
|
67336
|
+
}
|
|
67337
|
+
return [field, runtimeScalar.resolve(runtimeScalarPayload)];
|
|
67338
|
+
}
|
|
67339
|
+
)
|
|
67340
|
+
),
|
|
67327
67341
|
...ctx.variables
|
|
67328
67342
|
};
|
|
67329
67343
|
next(ctx);
|
|
@@ -67904,6 +67918,9 @@ var Config = class {
|
|
|
67904
67918
|
get loadingDirective() {
|
|
67905
67919
|
return `loading`;
|
|
67906
67920
|
}
|
|
67921
|
+
get runtimeScalarDirective() {
|
|
67922
|
+
return "__houdini__runtimeScalar";
|
|
67923
|
+
}
|
|
67907
67924
|
get whenDirective() {
|
|
67908
67925
|
return "when";
|
|
67909
67926
|
}
|
|
@@ -67974,7 +67991,7 @@ var Config = class {
|
|
|
67974
67991
|
const internalDirectives = this.#newSchemaInstance?.getDirectives().reduce((list, directive) => {
|
|
67975
67992
|
return list.concat(directive.name);
|
|
67976
67993
|
}, []) ?? [];
|
|
67977
|
-
return !defaultDirectives.includes(name) && (internalDirectives.includes(name) || this.isDeleteDirective(name));
|
|
67994
|
+
return !defaultDirectives.includes(name) && (internalDirectives.includes(name) || this.isDeleteDirective(name) || name === this.runtimeScalarDirective);
|
|
67978
67995
|
}
|
|
67979
67996
|
get componentFieldDirective() {
|
|
67980
67997
|
return "componentField";
|
|
@@ -68495,7 +68512,7 @@ function unwrapType(config, type, wrappers = []) {
|
|
|
68495
68512
|
}
|
|
68496
68513
|
const namedType = config.schema.getType(type.name.value || type.name);
|
|
68497
68514
|
if (!namedType) {
|
|
68498
|
-
throw new Error("
|
|
68515
|
+
throw new Error("Unknown type: " + type.name.value || type.name);
|
|
68499
68516
|
}
|
|
68500
68517
|
return { type: namedType, wrappers };
|
|
68501
68518
|
}
|
|
@@ -69040,7 +69057,7 @@ async function loadLocalSchema(config) {
|
|
|
69040
69057
|
}
|
|
69041
69058
|
|
|
69042
69059
|
// src/codegen/index.ts
|
|
69043
|
-
var
|
|
69060
|
+
var graphql33 = __toESM(require("graphql"), 1);
|
|
69044
69061
|
|
|
69045
69062
|
// src/codegen/generators/artifacts/index.ts
|
|
69046
69063
|
var graphql16 = __toESM(require("graphql"), 1);
|
|
@@ -70011,7 +70028,7 @@ ${exportDefaultFrom(`./${doc.name}`, doc.name)}`,
|
|
|
70011
70028
|
|
|
70012
70029
|
// src/codegen/generators/artifacts/inputs.ts
|
|
70013
70030
|
var graphql8 = __toESM(require("graphql"), 1);
|
|
70014
|
-
function inputObject(config, inputs) {
|
|
70031
|
+
function inputObject(config, inputs, runtimeScalars) {
|
|
70015
70032
|
const visitedTypes = /* @__PURE__ */ new Set();
|
|
70016
70033
|
const inputObj = {
|
|
70017
70034
|
fields: inputs.reduce((fields, input) => {
|
|
@@ -70027,7 +70044,8 @@ function inputObject(config, inputs) {
|
|
|
70027
70044
|
...fields,
|
|
70028
70045
|
[input.variable.name.value]: input.defaultValue ? variableValue(input.defaultValue, {}) : void 0
|
|
70029
70046
|
};
|
|
70030
|
-
}, {})
|
|
70047
|
+
}, {}),
|
|
70048
|
+
runtimeScalars
|
|
70031
70049
|
};
|
|
70032
70050
|
for (const input of inputs) {
|
|
70033
70051
|
walkInputs(config, visitedTypes, inputObj, input.type);
|
|
@@ -71870,7 +71888,21 @@ function artifactGenerator(stats) {
|
|
|
71870
71888
|
artifact.pluginData[plugin2.name] = plugin2.artifactData({ config, document: doc }) ?? {};
|
|
71871
71889
|
}
|
|
71872
71890
|
if (inputs && inputs.length > 0) {
|
|
71873
|
-
|
|
71891
|
+
const runtimeScalars = inputs.reduce((prev, input) => {
|
|
71892
|
+
const runtimeScalarDirective = input.directives?.find(
|
|
71893
|
+
(directive2) => directive2.name.value === config.runtimeScalarDirective
|
|
71894
|
+
);
|
|
71895
|
+
if (!runtimeScalarDirective) {
|
|
71896
|
+
return prev;
|
|
71897
|
+
}
|
|
71898
|
+
return {
|
|
71899
|
+
...prev,
|
|
71900
|
+
[input.variable.name.value]: runtimeScalarDirective.arguments?.find(
|
|
71901
|
+
(arg) => arg.name.value === "type"
|
|
71902
|
+
)?.value?.value
|
|
71903
|
+
};
|
|
71904
|
+
}, {});
|
|
71905
|
+
artifact.input = inputObject(config, inputs, runtimeScalars);
|
|
71874
71906
|
}
|
|
71875
71907
|
if (artifact.kind === "HoudiniQuery") {
|
|
71876
71908
|
const cacheDirective = operations[0].directives?.find(
|
|
@@ -72962,17 +72994,20 @@ export * from "${module2}"
|
|
|
72962
72994
|
}
|
|
72963
72995
|
}
|
|
72964
72996
|
await fs_exports.writeFile(config.typeIndexPath, indexContent);
|
|
72965
|
-
|
|
72966
|
-
|
|
72967
|
-
|
|
72968
|
-
|
|
72997
|
+
const missingScalarNames = [...missingScalars].filter(
|
|
72998
|
+
(scalar) => !config.configFile.features?.runtimeScalars?.[scalar]
|
|
72999
|
+
);
|
|
73000
|
+
if (missingScalarNames.length > 0) {
|
|
73001
|
+
console.warn(`\u26A0\uFE0F Missing definitions for the following scalars: ${[
|
|
73002
|
+
...missingScalarNames
|
|
73003
|
+
].join(", ")}
|
|
72969
73004
|
Generated types will contain an any type in place of these values. To fix this, provide an equivalent
|
|
72970
73005
|
type in your config file:
|
|
72971
73006
|
|
|
72972
73007
|
{
|
|
72973
73008
|
scalars: {
|
|
72974
73009
|
${cyan2(`/* in your case, something like */`)}
|
|
72975
|
-
${[...
|
|
73010
|
+
${[...missingScalarNames].map(
|
|
72976
73011
|
(c2) => ` ${c2}: { ${green2(`// <- The GraphQL Scalar`)}
|
|
72977
73012
|
type: "${cyan2(`YourType_${c2}`)}" ${green2(`// <- The TypeScript type`)}
|
|
72978
73013
|
}`
|
|
@@ -75554,7 +75589,7 @@ ${config.configFile.features?.componentFields ? `
|
|
|
75554
75589
|
"""
|
|
75555
75590
|
@${config.componentFieldDirective} marks an inline fragment as the selection for a component field
|
|
75556
75591
|
"""
|
|
75557
|
-
directive @${config.componentFieldDirective}(field: String!, prop: String, export: String, raw: String) on FRAGMENT_DEFINITION | INLINE_FRAGMENT
|
|
75592
|
+
directive @${config.componentFieldDirective}(field: String!, prop: String, export: String, raw: String) on FRAGMENT_DEFINITION | INLINE_FRAGMENT | FIELD_DEFINITION
|
|
75558
75593
|
|
|
75559
75594
|
` : ""}
|
|
75560
75595
|
|
|
@@ -75565,7 +75600,7 @@ directive @${config.componentFieldDirective}(field: String!, prop: String, expor
|
|
|
75565
75600
|
}
|
|
75566
75601
|
internalSchema += plugin2.schema({ config });
|
|
75567
75602
|
}
|
|
75568
|
-
|
|
75603
|
+
let extensions = Object.entries(config.componentFields).map(([parent2, fields]) => {
|
|
75569
75604
|
return `
|
|
75570
75605
|
extend type ${parent2} {
|
|
75571
75606
|
${Object.entries(fields).map(([fieldName, field]) => {
|
|
@@ -75577,11 +75612,12 @@ directive @${config.componentFieldDirective}(field: String!, prop: String, expor
|
|
|
75577
75612
|
return `${arg.name}:${typeName}${arg.required ? "!" : ""}`;
|
|
75578
75613
|
}).join("\n") + ")";
|
|
75579
75614
|
}
|
|
75580
|
-
return `${fieldName}${argString}: ${config.componentScalar}
|
|
75615
|
+
return `${fieldName}${argString}: ${config.componentScalar}! @componentField(field: "${fieldName}")`;
|
|
75581
75616
|
}).join("\n")}
|
|
75582
75617
|
}
|
|
75583
75618
|
`;
|
|
75584
75619
|
}).join("\n");
|
|
75620
|
+
extensions += `${Object.keys(config.configFile.features?.runtimeScalars ?? {}).map((scalar) => `scalar ${scalar}`).join("\n")}`;
|
|
75585
75621
|
config.newSchema = graphql25.print(mergeTypeDefs2([internalSchema, config.newSchema]));
|
|
75586
75622
|
config.schemaString += extensions;
|
|
75587
75623
|
config.schema = graphql25.buildSchema(
|
|
@@ -75776,8 +75812,50 @@ async function componentFields(config, documents) {
|
|
|
75776
75812
|
}
|
|
75777
75813
|
}
|
|
75778
75814
|
|
|
75779
|
-
// src/codegen/
|
|
75815
|
+
// src/codegen/transforms/runtimeScalars.ts
|
|
75780
75816
|
var graphql29 = __toESM(require("graphql"), 1);
|
|
75817
|
+
async function addTypename2(config, documents) {
|
|
75818
|
+
for (const doc of documents) {
|
|
75819
|
+
doc.document = graphql29.visit(doc.document, {
|
|
75820
|
+
VariableDefinition(node) {
|
|
75821
|
+
const { type, wrappers } = unwrapType(config, node.type);
|
|
75822
|
+
const runtimeScalar = config.configFile.features?.runtimeScalars?.[type.name];
|
|
75823
|
+
if (runtimeScalar) {
|
|
75824
|
+
return {
|
|
75825
|
+
...node,
|
|
75826
|
+
type: wrapType({
|
|
75827
|
+
type: config.schema.getType(runtimeScalar.type),
|
|
75828
|
+
wrappers
|
|
75829
|
+
}),
|
|
75830
|
+
directives: [
|
|
75831
|
+
...node.directives ?? [],
|
|
75832
|
+
{
|
|
75833
|
+
kind: "Directive",
|
|
75834
|
+
name: {
|
|
75835
|
+
kind: "Name",
|
|
75836
|
+
value: config.runtimeScalarDirective
|
|
75837
|
+
},
|
|
75838
|
+
arguments: [
|
|
75839
|
+
{
|
|
75840
|
+
kind: "Argument",
|
|
75841
|
+
name: { kind: "Name", value: "type" },
|
|
75842
|
+
value: {
|
|
75843
|
+
kind: "StringValue",
|
|
75844
|
+
value: type.name
|
|
75845
|
+
}
|
|
75846
|
+
}
|
|
75847
|
+
]
|
|
75848
|
+
}
|
|
75849
|
+
]
|
|
75850
|
+
};
|
|
75851
|
+
}
|
|
75852
|
+
}
|
|
75853
|
+
});
|
|
75854
|
+
}
|
|
75855
|
+
}
|
|
75856
|
+
|
|
75857
|
+
// src/codegen/validators/typeCheck.ts
|
|
75858
|
+
var graphql30 = __toESM(require("graphql"), 1);
|
|
75781
75859
|
async function typeCheck(config, docs) {
|
|
75782
75860
|
const errors = [];
|
|
75783
75861
|
const freeLists = [];
|
|
@@ -75785,7 +75863,7 @@ async function typeCheck(config, docs) {
|
|
|
75785
75863
|
const listTypes = [];
|
|
75786
75864
|
const fragments = {};
|
|
75787
75865
|
for (const { document: parsed, originalString, filename } of docs) {
|
|
75788
|
-
|
|
75866
|
+
graphql30.visit(parsed, {
|
|
75789
75867
|
FragmentDefinition(definition) {
|
|
75790
75868
|
fragments[definition.name.value] = definition;
|
|
75791
75869
|
},
|
|
@@ -75830,14 +75908,14 @@ async function typeCheck(config, docs) {
|
|
|
75830
75908
|
);
|
|
75831
75909
|
return;
|
|
75832
75910
|
}
|
|
75833
|
-
if (
|
|
75911
|
+
if (graphql30.isListType(rootType) || graphql30.isNonNullType(rootType) && graphql30.isListType(rootType.ofType)) {
|
|
75834
75912
|
needsParent = true;
|
|
75835
75913
|
break;
|
|
75836
75914
|
}
|
|
75837
|
-
if (
|
|
75915
|
+
if (graphql30.isNonNullType(rootType) && "ofType" in rootType) {
|
|
75838
75916
|
rootType = rootType.ofType;
|
|
75839
75917
|
}
|
|
75840
|
-
if (
|
|
75918
|
+
if (graphql30.isScalarType(rootType)) {
|
|
75841
75919
|
break;
|
|
75842
75920
|
}
|
|
75843
75921
|
rootType = rootType?.getFields()[parent3.name.value]?.type;
|
|
@@ -75913,9 +75991,9 @@ async function typeCheck(config, docs) {
|
|
|
75913
75991
|
);
|
|
75914
75992
|
}
|
|
75915
75993
|
let targetTypes = [type];
|
|
75916
|
-
if (
|
|
75994
|
+
if (graphql30.isUnionType(type)) {
|
|
75917
75995
|
targetTypes = config.schema.getPossibleTypes(type);
|
|
75918
|
-
} else if (
|
|
75996
|
+
} else if (graphql30.isInterfaceType(type)) {
|
|
75919
75997
|
try {
|
|
75920
75998
|
for (const key of config.keyFieldsForType(type.name)) {
|
|
75921
75999
|
if (!type.getFields()[key]) {
|
|
@@ -75951,13 +76029,13 @@ async function typeCheck(config, docs) {
|
|
|
75951
76029
|
if (errors.length > 0) {
|
|
75952
76030
|
throw errors;
|
|
75953
76031
|
}
|
|
75954
|
-
const rules = (filepath) => [...
|
|
76032
|
+
const rules = (filepath) => [...graphql30.specifiedRules].filter(
|
|
75955
76033
|
(rule) => ![
|
|
75956
|
-
|
|
75957
|
-
|
|
75958
|
-
|
|
75959
|
-
|
|
75960
|
-
|
|
76034
|
+
graphql30.NoUnusedFragmentsRule,
|
|
76035
|
+
graphql30.KnownFragmentNamesRule,
|
|
76036
|
+
graphql30.ExecutableDefinitionsRule,
|
|
76037
|
+
graphql30.KnownDirectivesRule,
|
|
76038
|
+
graphql30.KnownArgumentNamesRule
|
|
75961
76039
|
].includes(rule)
|
|
75962
76040
|
).concat(
|
|
75963
76041
|
validateLists({
|
|
@@ -75978,7 +76056,7 @@ async function typeCheck(config, docs) {
|
|
|
75978
76056
|
validateLoadingDirective(config)
|
|
75979
76057
|
);
|
|
75980
76058
|
for (const { filename, document: parsed, originalString } of docs) {
|
|
75981
|
-
for (const error of
|
|
76059
|
+
for (const error of graphql30.validate(config.schema, parsed, rules(filename))) {
|
|
75982
76060
|
errors.push(
|
|
75983
76061
|
new HoudiniError({
|
|
75984
76062
|
filepath: filename,
|
|
@@ -76007,20 +76085,20 @@ function validateRequiredDirective(config, filepath) {
|
|
|
76007
76085
|
if (!node.directives?.some(({ name }) => name.value === config.requiredDirective))
|
|
76008
76086
|
return;
|
|
76009
76087
|
const parentType = parentTypeFromAncestors(config.schema, filepath, ancestors);
|
|
76010
|
-
if (!
|
|
76088
|
+
if (!graphql30.isObjectType(parentType)) {
|
|
76011
76089
|
ctx.reportError(
|
|
76012
|
-
new
|
|
76090
|
+
new graphql30.GraphQLError(
|
|
76013
76091
|
`@${config.requiredDirective} may only be used on objects, not arguments`
|
|
76014
76092
|
)
|
|
76015
76093
|
);
|
|
76016
76094
|
return;
|
|
76017
76095
|
}
|
|
76018
76096
|
const type = parentType.getFields()[node.name.value].type;
|
|
76019
|
-
const isServerNullable = !
|
|
76097
|
+
const isServerNullable = !graphql30.isNonNullType(type);
|
|
76020
76098
|
const isAlreadyClientNullable = isClientNullable(node, true);
|
|
76021
76099
|
if (!isServerNullable && !isAlreadyClientNullable) {
|
|
76022
76100
|
ctx.reportError(
|
|
76023
|
-
new
|
|
76101
|
+
new graphql30.GraphQLError(
|
|
76024
76102
|
`@${config.requiredDirective} may only be used on nullable fields`
|
|
76025
76103
|
)
|
|
76026
76104
|
);
|
|
@@ -76042,7 +76120,7 @@ var validateLists = ({
|
|
|
76042
76120
|
if (!config.isListFragment(node.name.value)) {
|
|
76043
76121
|
if (!fragments[node.name.value]) {
|
|
76044
76122
|
ctx.reportError(
|
|
76045
|
-
new
|
|
76123
|
+
new graphql30.GraphQLError(
|
|
76046
76124
|
"Encountered unknown fragment: " + node.name.value
|
|
76047
76125
|
)
|
|
76048
76126
|
);
|
|
@@ -76052,7 +76130,7 @@ var validateLists = ({
|
|
|
76052
76130
|
const listName = config.listNameFromFragment(node.name.value);
|
|
76053
76131
|
if (!lists.includes(listName)) {
|
|
76054
76132
|
ctx.reportError(
|
|
76055
|
-
new
|
|
76133
|
+
new graphql30.GraphQLError(
|
|
76056
76134
|
"Encountered fragment referencing unknown list: " + listName
|
|
76057
76135
|
)
|
|
76058
76136
|
);
|
|
@@ -76077,7 +76155,7 @@ var validateLists = ({
|
|
|
76077
76155
|
);
|
|
76078
76156
|
if (parentArg) {
|
|
76079
76157
|
ctx.reportError(
|
|
76080
|
-
new
|
|
76158
|
+
new graphql30.GraphQLError(
|
|
76081
76159
|
`@${config.deprecatedlistDirectiveParentIDArg} should be defined only in it's own directive now`
|
|
76082
76160
|
)
|
|
76083
76161
|
);
|
|
@@ -76093,7 +76171,7 @@ var validateLists = ({
|
|
|
76093
76171
|
return;
|
|
76094
76172
|
}
|
|
76095
76173
|
ctx.reportError(
|
|
76096
|
-
new
|
|
76174
|
+
new graphql30.GraphQLError(
|
|
76097
76175
|
`For this list fragment, you need to add or @${config.listParentDirective} or @${config.listAllListsDirective} directive to specify the behavior`
|
|
76098
76176
|
)
|
|
76099
76177
|
);
|
|
@@ -76103,7 +76181,7 @@ var validateLists = ({
|
|
|
76103
76181
|
const directiveName = node.name.value;
|
|
76104
76182
|
if (directiveName === "connection") {
|
|
76105
76183
|
ctx.reportError(
|
|
76106
|
-
new
|
|
76184
|
+
new graphql30.GraphQLError(
|
|
76107
76185
|
"@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."
|
|
76108
76186
|
)
|
|
76109
76187
|
);
|
|
@@ -76112,7 +76190,7 @@ var validateLists = ({
|
|
|
76112
76190
|
if (!config.isInternalDirective(node.name.value)) {
|
|
76113
76191
|
if (!config.schema.getDirective(directiveName)) {
|
|
76114
76192
|
ctx.reportError(
|
|
76115
|
-
new
|
|
76193
|
+
new graphql30.GraphQLError(
|
|
76116
76194
|
"Encountered unknown directive: " + directiveName
|
|
76117
76195
|
)
|
|
76118
76196
|
);
|
|
@@ -76121,7 +76199,7 @@ var validateLists = ({
|
|
|
76121
76199
|
}
|
|
76122
76200
|
if (config.isListOperationDirective(directiveName) && !listTypes.includes(config.listNameFromDirective(directiveName))) {
|
|
76123
76201
|
ctx.reportError(
|
|
76124
|
-
new
|
|
76202
|
+
new graphql30.GraphQLError(
|
|
76125
76203
|
"Encountered directive referencing unknown list: " + directiveName
|
|
76126
76204
|
)
|
|
76127
76205
|
);
|
|
@@ -76132,7 +76210,7 @@ var validateLists = ({
|
|
|
76132
76210
|
};
|
|
76133
76211
|
function knownArguments(config) {
|
|
76134
76212
|
return function(ctx) {
|
|
76135
|
-
const nativeValidator =
|
|
76213
|
+
const nativeValidator = graphql30.KnownArgumentNamesRule(ctx);
|
|
76136
76214
|
return {
|
|
76137
76215
|
...nativeValidator,
|
|
76138
76216
|
Directive(directiveNode) {
|
|
@@ -76167,7 +76245,7 @@ function validateFragmentArguments(config, filepath, fragments) {
|
|
|
76167
76245
|
for (const arg of node.arguments || []) {
|
|
76168
76246
|
if (arg.value.kind !== "ObjectValue") {
|
|
76169
76247
|
ctx.reportError(
|
|
76170
|
-
new
|
|
76248
|
+
new graphql30.GraphQLError("values in @arguments must be an object")
|
|
76171
76249
|
);
|
|
76172
76250
|
return;
|
|
76173
76251
|
}
|
|
@@ -76177,13 +76255,13 @@ function validateFragmentArguments(config, filepath, fragments) {
|
|
|
76177
76255
|
);
|
|
76178
76256
|
if (!typeArg) {
|
|
76179
76257
|
ctx.reportError(
|
|
76180
|
-
new
|
|
76258
|
+
new graphql30.GraphQLError("missing type field for @arguments directive")
|
|
76181
76259
|
);
|
|
76182
76260
|
return;
|
|
76183
76261
|
}
|
|
76184
|
-
if (typeArg.value.kind !==
|
|
76262
|
+
if (typeArg.value.kind !== graphql30.Kind.STRING) {
|
|
76185
76263
|
ctx.reportError(
|
|
76186
|
-
new
|
|
76264
|
+
new graphql30.GraphQLError("type field to @arguments must be a string")
|
|
76187
76265
|
);
|
|
76188
76266
|
return;
|
|
76189
76267
|
}
|
|
@@ -76196,7 +76274,7 @@ function validateFragmentArguments(config, filepath, fragments) {
|
|
|
76196
76274
|
);
|
|
76197
76275
|
if (typeArg.value.value !== defaultValueType) {
|
|
76198
76276
|
ctx.reportError(
|
|
76199
|
-
new
|
|
76277
|
+
new graphql30.GraphQLError(
|
|
76200
76278
|
`Invalid default value provided for ${arg.name.value}. Expected ${typeArg.value.value}, found ${defaultValueType}`
|
|
76201
76279
|
)
|
|
76202
76280
|
);
|
|
@@ -76214,7 +76292,7 @@ function validateFragmentArguments(config, filepath, fragments) {
|
|
|
76214
76292
|
try {
|
|
76215
76293
|
args = fragmentArguments(config, filepath, fragments[fragmentName]);
|
|
76216
76294
|
} catch (e3) {
|
|
76217
|
-
ctx.reportError(new
|
|
76295
|
+
ctx.reportError(new graphql30.GraphQLError(e3.message));
|
|
76218
76296
|
return;
|
|
76219
76297
|
}
|
|
76220
76298
|
fragmentArguments2[fragmentName] = args;
|
|
@@ -76237,7 +76315,7 @@ function validateFragmentArguments(config, filepath, fragments) {
|
|
|
76237
76315
|
);
|
|
76238
76316
|
if (missing.length > 0) {
|
|
76239
76317
|
ctx.reportError(
|
|
76240
|
-
new
|
|
76318
|
+
new graphql30.GraphQLError(
|
|
76241
76319
|
`The following arguments are missing from the "${fragmentName}" fragment: ` + JSON.stringify(missing)
|
|
76242
76320
|
)
|
|
76243
76321
|
);
|
|
@@ -76248,7 +76326,7 @@ function validateFragmentArguments(config, filepath, fragments) {
|
|
|
76248
76326
|
);
|
|
76249
76327
|
if (unknown.length > 0) {
|
|
76250
76328
|
ctx.reportError(
|
|
76251
|
-
new
|
|
76329
|
+
new graphql30.GraphQLError(
|
|
76252
76330
|
"Encountered unknown arguments: " + JSON.stringify(unknown)
|
|
76253
76331
|
)
|
|
76254
76332
|
);
|
|
@@ -76260,7 +76338,7 @@ function validateFragmentArguments(config, filepath, fragments) {
|
|
|
76260
76338
|
for (const [applied, target] of zipped) {
|
|
76261
76339
|
if (!valueIsType(config, applied.value, target)) {
|
|
76262
76340
|
ctx.reportError(
|
|
76263
|
-
new
|
|
76341
|
+
new graphql30.GraphQLError(
|
|
76264
76342
|
`Invalid argument type. Expected ${target}, found ${applied.value.kind}`
|
|
76265
76343
|
)
|
|
76266
76344
|
);
|
|
@@ -76302,7 +76380,7 @@ function valueIsType(config, value, targetType) {
|
|
|
76302
76380
|
}
|
|
76303
76381
|
if (value.kind === "EnumValue" && targetType.kind === "NamedType") {
|
|
76304
76382
|
const enumType = config.schema.getType(targetType.name.value);
|
|
76305
|
-
if (!
|
|
76383
|
+
if (!graphql30.isEnumType(enumType)) {
|
|
76306
76384
|
return false;
|
|
76307
76385
|
}
|
|
76308
76386
|
return enumType.getValues().some((enumValue) => enumValue.value === value.value);
|
|
@@ -76322,7 +76400,7 @@ function paginateArgs(config, filepath) {
|
|
|
76322
76400
|
}
|
|
76323
76401
|
if (alreadyPaginated) {
|
|
76324
76402
|
ctx.reportError(
|
|
76325
|
-
new
|
|
76403
|
+
new graphql30.GraphQLError(
|
|
76326
76404
|
`@${config.paginateDirective} can only appear in a document once.`
|
|
76327
76405
|
)
|
|
76328
76406
|
);
|
|
@@ -76354,7 +76432,7 @@ function paginateArgs(config, filepath) {
|
|
|
76354
76432
|
const backwards = appliedArgs.has("last");
|
|
76355
76433
|
if (!forward && !backwards) {
|
|
76356
76434
|
ctx.reportError(
|
|
76357
|
-
new
|
|
76435
|
+
new graphql30.GraphQLError(
|
|
76358
76436
|
"A field with cursor-based pagination must have a first or last argument"
|
|
76359
76437
|
)
|
|
76360
76438
|
);
|
|
@@ -76368,7 +76446,7 @@ function paginateArgs(config, filepath) {
|
|
|
76368
76446
|
}
|
|
76369
76447
|
if (forward && backwards && paginateMode === "Infinite") {
|
|
76370
76448
|
ctx.reportError(
|
|
76371
|
-
new
|
|
76449
|
+
new graphql30.GraphQLError(
|
|
76372
76450
|
`A field with cursor pagination cannot go forwards an backwards simultaneously`
|
|
76373
76451
|
)
|
|
76374
76452
|
);
|
|
@@ -76382,7 +76460,7 @@ function paginateArgs(config, filepath) {
|
|
|
76382
76460
|
);
|
|
76383
76461
|
if (!appliedLimitArg) {
|
|
76384
76462
|
ctx.reportError(
|
|
76385
|
-
new
|
|
76463
|
+
new graphql30.GraphQLError(
|
|
76386
76464
|
"A field with offset-based pagination must have a limit argument"
|
|
76387
76465
|
)
|
|
76388
76466
|
);
|
|
@@ -76398,20 +76476,20 @@ function noUnusedFragmentArguments(config) {
|
|
|
76398
76476
|
const args = /* @__PURE__ */ new Set();
|
|
76399
76477
|
return {
|
|
76400
76478
|
enter(node) {
|
|
76401
|
-
if (node.kind ===
|
|
76479
|
+
if (node.kind === graphql30.Kind.FRAGMENT_DEFINITION) {
|
|
76402
76480
|
const definitionArguments = node.directives?.filter((directive) => directive.name.value === config.argumentsDirective).flatMap((directive) => directive.arguments);
|
|
76403
76481
|
for (const arg of definitionArguments?.map((arg2) => arg2?.name.value) || []) {
|
|
76404
76482
|
args.add(arg);
|
|
76405
76483
|
}
|
|
76406
|
-
} else if (node.kind ===
|
|
76484
|
+
} else if (node.kind === graphql30.Kind.VARIABLE) {
|
|
76407
76485
|
args.delete(node.name.value);
|
|
76408
76486
|
}
|
|
76409
76487
|
},
|
|
76410
76488
|
leave(node) {
|
|
76411
|
-
if (node.kind ===
|
|
76489
|
+
if (node.kind === graphql30.Kind.FRAGMENT_DEFINITION) {
|
|
76412
76490
|
if (args.size > 0) {
|
|
76413
76491
|
ctx.reportError(
|
|
76414
|
-
new
|
|
76492
|
+
new graphql30.GraphQLError(
|
|
76415
76493
|
"Encountered unused fragment arguments: " + [...args].join(",")
|
|
76416
76494
|
)
|
|
76417
76495
|
);
|
|
@@ -76447,7 +76525,7 @@ function nodeDirectives(config, directives) {
|
|
|
76447
76525
|
if (definition.kind === "OperationDefinition") {
|
|
76448
76526
|
if (definition.operation !== "query") {
|
|
76449
76527
|
ctx.reportError(
|
|
76450
|
-
new
|
|
76528
|
+
new graphql30.GraphQLError(
|
|
76451
76529
|
`@${node.name.value} must fall on a fragment or query document`
|
|
76452
76530
|
)
|
|
76453
76531
|
);
|
|
@@ -76459,7 +76537,7 @@ function nodeDirectives(config, directives) {
|
|
|
76459
76537
|
}
|
|
76460
76538
|
if (!possibleNodes.includes(definitionType)) {
|
|
76461
76539
|
ctx.reportError(
|
|
76462
|
-
new
|
|
76540
|
+
new graphql30.GraphQLError(paginateOnNonNodeMessage(node.name.value))
|
|
76463
76541
|
);
|
|
76464
76542
|
}
|
|
76465
76543
|
}
|
|
@@ -76478,7 +76556,7 @@ function checkMutationOperation(config) {
|
|
|
76478
76556
|
);
|
|
76479
76557
|
if (append && prepend) {
|
|
76480
76558
|
ctx.reportError(
|
|
76481
|
-
new
|
|
76559
|
+
new graphql30.GraphQLError(
|
|
76482
76560
|
`You can't apply both @${config.listPrependDirective} and @${config.listAppendDirective} at the same time`
|
|
76483
76561
|
)
|
|
76484
76562
|
);
|
|
@@ -76492,7 +76570,7 @@ function checkMutationOperation(config) {
|
|
|
76492
76570
|
);
|
|
76493
76571
|
if (parentId && allLists) {
|
|
76494
76572
|
ctx.reportError(
|
|
76495
|
-
new
|
|
76573
|
+
new graphql30.GraphQLError(
|
|
76496
76574
|
`You can't apply both @${config.listParentDirective} and @${config.listAllListsDirective} at the same time`
|
|
76497
76575
|
)
|
|
76498
76576
|
);
|
|
@@ -76514,7 +76592,7 @@ function checkMaskDirectives(config) {
|
|
|
76514
76592
|
);
|
|
76515
76593
|
if (maskEnableDirective && maskDisableDirective) {
|
|
76516
76594
|
ctx.reportError(
|
|
76517
|
-
new
|
|
76595
|
+
new graphql30.GraphQLError(
|
|
76518
76596
|
`You can't apply both @${config.maskEnableDirective} and @${config.maskDisableDirective} at the same time`
|
|
76519
76597
|
)
|
|
76520
76598
|
);
|
|
@@ -76556,7 +76634,7 @@ function validateLoadingDirective(config) {
|
|
|
76556
76634
|
);
|
|
76557
76635
|
if (!parentLoading && !global2) {
|
|
76558
76636
|
ctx.reportError(
|
|
76559
|
-
new
|
|
76637
|
+
new graphql30.GraphQLError(
|
|
76560
76638
|
`@${config.loadingDirective} can only be applied on a field or fragment spread at the root of a document or on one whose parent also has @${config.loadingDirective}`
|
|
76561
76639
|
)
|
|
76562
76640
|
);
|
|
@@ -76578,7 +76656,7 @@ function validateLoadingDirective(config) {
|
|
|
76578
76656
|
);
|
|
76579
76657
|
if (!parentLoading && !global2) {
|
|
76580
76658
|
ctx.reportError(
|
|
76581
|
-
new
|
|
76659
|
+
new graphql30.GraphQLError(
|
|
76582
76660
|
`@${config.loadingDirective} can only be applied on a field or fragment spread at the root of a document or on one whose parent also has @${config.loadingDirective}`
|
|
76583
76661
|
)
|
|
76584
76662
|
);
|
|
@@ -76593,7 +76671,7 @@ function getAndVerifyNodeInterface(config) {
|
|
|
76593
76671
|
if (!nodeInterface) {
|
|
76594
76672
|
return null;
|
|
76595
76673
|
}
|
|
76596
|
-
if (!
|
|
76674
|
+
if (!graphql30.isInterfaceType(nodeInterface)) {
|
|
76597
76675
|
displayInvalidNodeFieldMessage(config);
|
|
76598
76676
|
return null;
|
|
76599
76677
|
}
|
|
@@ -76688,11 +76766,11 @@ async function uniqueDocumentNames(config, docs) {
|
|
|
76688
76766
|
}
|
|
76689
76767
|
|
|
76690
76768
|
// src/codegen/validators/noIDAlias.ts
|
|
76691
|
-
var
|
|
76769
|
+
var graphql31 = __toESM(require("graphql"), 1);
|
|
76692
76770
|
async function noIDAlias(config, docs) {
|
|
76693
76771
|
const errors = [];
|
|
76694
76772
|
for (const { filename, document } of docs) {
|
|
76695
|
-
|
|
76773
|
+
graphql31.visit(document, {
|
|
76696
76774
|
Field(node, _3, __, ___, ancestors) {
|
|
76697
76775
|
const fieldType = parentTypeFromAncestors(config.schema, filename, ancestors).name;
|
|
76698
76776
|
if (config.keyFieldsForType(fieldType).includes(node.alias?.value || "")) {
|
|
@@ -76731,11 +76809,11 @@ async function validatePlugins(config, documents) {
|
|
|
76731
76809
|
}
|
|
76732
76810
|
|
|
76733
76811
|
// src/codegen/validators/componentFields.ts
|
|
76734
|
-
var
|
|
76812
|
+
var graphql32 = __toESM(require("graphql"), 1);
|
|
76735
76813
|
async function componentFields2(config, docs) {
|
|
76736
76814
|
const errors = [];
|
|
76737
76815
|
for (const { filename: filepath, document } of docs) {
|
|
76738
|
-
|
|
76816
|
+
graphql32.visit(document, {
|
|
76739
76817
|
FragmentDefinition(node, _3, __, ___, ancestors) {
|
|
76740
76818
|
const componentFieldDirective = node.directives?.find(
|
|
76741
76819
|
(dir) => dir.name.value === config.componentFieldDirective
|
|
@@ -76777,14 +76855,26 @@ async function componentFields2(config, docs) {
|
|
|
76777
76855
|
}
|
|
76778
76856
|
const fieldValue = fieldArg.value?.kind === "StringValue" ? fieldArg.value.value : void 0;
|
|
76779
76857
|
const propValue = propArg.value?.kind === "StringValue" ? propArg.value.value : void 0;
|
|
76858
|
+
const existingField = fieldValue && config.componentFields[parent2]?.[fieldValue];
|
|
76780
76859
|
const parentType = config.schema.getType(parent2);
|
|
76781
|
-
|
|
76860
|
+
let conflict = false;
|
|
76861
|
+
if (existingField && existingField.filepath !== filepath) {
|
|
76862
|
+
conflict = true;
|
|
76863
|
+
} else if (parentType && fieldValue) {
|
|
76864
|
+
const fieldDef = graphql32.isObjectType(parentType) && parentType.getFields()[fieldValue];
|
|
76865
|
+
if (fieldDef && !fieldDef.astNode?.directives?.find(
|
|
76866
|
+
(dir) => dir.name.value === config.componentFieldDirective
|
|
76867
|
+
)) {
|
|
76868
|
+
conflict = true;
|
|
76869
|
+
}
|
|
76870
|
+
}
|
|
76871
|
+
if (conflict) {
|
|
76782
76872
|
errors.push({
|
|
76783
|
-
message: `Duplicate component field definition for ${parent2}.${fieldValue}
|
|
76873
|
+
message: `Duplicate component field definition for ${parent2}.${fieldValue}.` + (existingField ? "The conflicting component field was defined in " + existingField.filepath : ""),
|
|
76784
76874
|
filepath
|
|
76785
76875
|
});
|
|
76786
76876
|
}
|
|
76787
|
-
if (parentType &&
|
|
76877
|
+
if (parentType && graphql32.isAbstractType(parentType)) {
|
|
76788
76878
|
errors.push({
|
|
76789
76879
|
message: `Cannot add component field ${parent2}.${fieldValue} because ${parent2} is an abstract type`,
|
|
76790
76880
|
filepath
|
|
@@ -76850,6 +76940,7 @@ async function runPipeline2(config, docs) {
|
|
|
76850
76940
|
[
|
|
76851
76941
|
componentFields2,
|
|
76852
76942
|
graphqlExtensions,
|
|
76943
|
+
addTypename2,
|
|
76853
76944
|
...wrapHook(beforeValidate),
|
|
76854
76945
|
typeCheck,
|
|
76855
76946
|
uniqueDocumentNames,
|
|
@@ -77004,12 +77095,12 @@ async function processJSFile(config, contents) {
|
|
|
77004
77095
|
return documents;
|
|
77005
77096
|
}
|
|
77006
77097
|
async function processGraphQLDocument(config, filepath, document) {
|
|
77007
|
-
const parsedDoc =
|
|
77098
|
+
const parsedDoc = graphql33.parse(document);
|
|
77008
77099
|
const operations = parsedDoc.definitions.filter(
|
|
77009
|
-
({ kind: kind2 }) => kind2 ===
|
|
77100
|
+
({ kind: kind2 }) => kind2 === graphql33.Kind.OPERATION_DEFINITION
|
|
77010
77101
|
);
|
|
77011
77102
|
const fragments = parsedDoc.definitions.filter(
|
|
77012
|
-
({ kind: kind2 }) => kind2 ===
|
|
77103
|
+
({ kind: kind2 }) => kind2 === graphql33.Kind.FRAGMENT_DEFINITION
|
|
77013
77104
|
);
|
|
77014
77105
|
if (operations.length > 1) {
|
|
77015
77106
|
throw new HoudiniError({
|
|
@@ -77994,7 +78085,7 @@ export default app
|
|
|
77994
78085
|
async function svelteConfig(targetPath, typescript) {
|
|
77995
78086
|
const svelteConfigPath = path_exports.join(targetPath, "svelte.config.js");
|
|
77996
78087
|
const newContentTs = `import adapter from '@sveltejs/adapter-auto';
|
|
77997
|
-
import { vitePreprocess } from '@sveltejs/
|
|
78088
|
+
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
|
|
77998
78089
|
|
|
77999
78090
|
/** @type {import('@sveltejs/kit').Config} */
|
|
78000
78091
|
const config = {
|
|
@@ -78125,12 +78216,12 @@ async function packageJSON(targetPath, frameworkInfo) {
|
|
|
78125
78216
|
}
|
|
78126
78217
|
packageJSON2.devDependencies = {
|
|
78127
78218
|
...packageJSON2.devDependencies,
|
|
78128
|
-
houdini: "^1.2.
|
|
78219
|
+
houdini: "^1.2.44"
|
|
78129
78220
|
};
|
|
78130
78221
|
if (frameworkInfo.framework === "svelte" || frameworkInfo.framework === "kit") {
|
|
78131
78222
|
packageJSON2.devDependencies = {
|
|
78132
78223
|
...packageJSON2.devDependencies,
|
|
78133
|
-
"houdini-svelte": "^1.2.
|
|
78224
|
+
"houdini-svelte": "^1.2.44"
|
|
78134
78225
|
};
|
|
78135
78226
|
} else {
|
|
78136
78227
|
throw new Error(`Unmanaged framework: "${JSON.stringify(frameworkInfo)}"`);
|