houdini 1.5.2 → 1.5.4

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.
@@ -62977,7 +62977,7 @@ function mergeSchemas(config2) {
62977
62977
  }
62978
62978
 
62979
62979
  // src/lib/config.ts
62980
- var graphql4 = __toESM(require("graphql"), 1);
62980
+ var graphql5 = __toESM(require("graphql"), 1);
62981
62981
  var import_minimatch8 = __toESM(require_minimatch(), 1);
62982
62982
  var import_node_url4 = require("node:url");
62983
62983
 
@@ -70198,43 +70198,43 @@ __export(conventions_exports, {
70198
70198
  vite_render_path: () => vite_render_path
70199
70199
  });
70200
70200
  function router_path(config2) {
70201
- return path_exports.join(base_dir(config2), "Router.jsx");
70201
+ return join2(base_dir(config2), "Router.jsx");
70202
70202
  }
70203
70203
  function page_entry_path(config2, id, base) {
70204
- return path_exports.join(page_entries_dir(config2, base), `${id}.jsx`);
70204
+ return join2(page_entries_dir(config2, base), `${id}.jsx`);
70205
70205
  }
70206
70206
  function server_adapter_path(config2, base) {
70207
- return path_exports.join(units_dir(config2, base), "render", "server.js");
70207
+ return join2(units_dir(config2, base), "render", "server.js");
70208
70208
  }
70209
70209
  function adapter_config_path(config2, base) {
70210
- return path_exports.join(units_dir(config2, base), "render", "config.js");
70210
+ return join2(units_dir(config2, base), "render", "config.js");
70211
70211
  }
70212
70212
  function vite_render_path(config2, base) {
70213
- return path_exports.join(units_dir(config2, base), "render", "vite.js");
70213
+ return join2(units_dir(config2, base), "render", "vite.js");
70214
70214
  }
70215
70215
  function app_component_path(config2, base) {
70216
- return path_exports.join(units_dir(config2, base), "render", "App.jsx");
70216
+ return join2(units_dir(config2, base), "render", "App.jsx");
70217
70217
  }
70218
70218
  function page_unit_path(config2, id, base) {
70219
- return path_exports.join(page_units_dir(config2, base), `${id}.jsx`);
70219
+ return join2(page_units_dir(config2, base), `${id}.jsx`);
70220
70220
  }
70221
70221
  function layout_unit_path(config2, id, base) {
70222
- return path_exports.join(layout_units_dir(config2, base), `${id}.jsx`);
70222
+ return join2(layout_units_dir(config2, base), `${id}.jsx`);
70223
70223
  }
70224
70224
  function componentField_unit_path(config2, id, base) {
70225
- return path_exports.join(units_dir(config2, base), "componentFields", `wrapper_${id}.jsx`);
70225
+ return join2(units_dir(config2, base), "componentFields", `wrapper_${id}.jsx`);
70226
70226
  }
70227
70227
  function fallback_unit_path(config2, which, id, base) {
70228
- return path_exports.join(fallbacks_units_dir(config2, which, base), `${id}.jsx`);
70228
+ return join2(fallbacks_units_dir(config2, which, base), `${id}.jsx`);
70229
70229
  }
70230
70230
  async function read_pageQuery(base) {
70231
- const target = path_exports.join(base, "+page.gql");
70232
- return [target, await fs_exports.readFile(target)];
70231
+ const target = join2(base, "+page.gql");
70232
+ return [target, await readFile(target)];
70233
70233
  }
70234
70234
  async function read_pageView(base) {
70235
70235
  for (const name of ["+page.tsx", "+page.jsx"]) {
70236
- let target = path_exports.join(base, name);
70237
- let result = await fs_exports.readFile(target);
70236
+ let target = join2(base, name);
70237
+ let result = await readFile(target);
70238
70238
  if (result) {
70239
70239
  return [target, result];
70240
70240
  }
@@ -70242,13 +70242,13 @@ async function read_pageView(base) {
70242
70242
  return [null, null];
70243
70243
  }
70244
70244
  async function read_layoutQuery(base) {
70245
- const target = path_exports.join(base, "+layout.gql");
70246
- return [target, await fs_exports.readFile(target)];
70245
+ const target = join2(base, "+layout.gql");
70246
+ return [target, await readFile(target)];
70247
70247
  }
70248
70248
  async function read_layoutView(base) {
70249
70249
  for (const name of ["+layout.tsx", "+layout.jsx"]) {
70250
- let target = path_exports.join(base, name);
70251
- let result = await fs_exports.readFile(target);
70250
+ let target = join2(base, name);
70251
+ let result = await readFile(target);
70252
70252
  if (result) {
70253
70253
  return [target, result];
70254
70254
  }
@@ -70256,10 +70256,10 @@ async function read_layoutView(base) {
70256
70256
  return [null, null];
70257
70257
  }
70258
70258
  function temp_dir(config2, key) {
70259
- return path_exports.join(config2.rootDir, "temp", key);
70259
+ return join2(config2.rootDir, "temp", key);
70260
70260
  }
70261
70261
  function router_index_path(config2) {
70262
- return path_exports.join(config2.routesDir, "..", "+index.jsx");
70262
+ return join2(config2.routesDir, "..", "+index.jsx");
70263
70263
  }
70264
70264
  function is_layout(path4) {
70265
70265
  return path4.endsWith("+layout.tsx") || path4.endsWith("+layout.jsx");
@@ -70282,202 +70282,510 @@ function page_id(path4) {
70282
70282
  return copy;
70283
70283
  }
70284
70284
  function page_entries_dir(config2, base) {
70285
- return path_exports.join(units_dir(config2, base), "entries");
70285
+ return join2(units_dir(config2, base), "entries");
70286
70286
  }
70287
70287
  function page_units_dir(config2, base) {
70288
- return path_exports.join(units_dir(config2, base), "pages");
70288
+ return join2(units_dir(config2, base), "pages");
70289
70289
  }
70290
70290
  function layout_units_dir(config2, base) {
70291
- return path_exports.join(units_dir(config2, base), "layouts");
70291
+ return join2(units_dir(config2, base), "layouts");
70292
70292
  }
70293
70293
  function fallbacks_units_dir(config2, which, base) {
70294
- return path_exports.join(units_dir(config2, base), "fallbacks", which);
70294
+ return join2(units_dir(config2, base), "fallbacks", which);
70295
70295
  }
70296
70296
  function units_dir(config2, base = base_dir(config2)) {
70297
- return path_exports.join(base, "units");
70297
+ return join2(base, "units");
70298
70298
  }
70299
70299
  function base_dir(config2) {
70300
70300
  return config2.pluginDirectory("houdini-react");
70301
70301
  }
70302
70302
  function serialized_manifest_path(config2, base = base_dir(config2)) {
70303
- return path_exports.join(base, "manifest.json");
70303
+ return join2(base, "manifest.json");
70304
70304
  }
70305
70305
 
70306
70306
  // src/lib/router/manifest.ts
70307
70307
  var t2 = __toESM(require_lib5(), 1);
70308
- var graphql2 = __toESM(require("graphql"), 1);
70309
- async function load_manifest(args) {
70310
- const manifest = await walk_routes({
70311
- config: args.config,
70312
- url: "/",
70313
- filepath: args.config.routesDir,
70314
- project: {
70315
- component_fields: {},
70316
- pages: {},
70317
- layouts: {},
70318
- page_queries: {},
70319
- layout_queries: {},
70320
- artifacts: [],
70321
- local_schema: false,
70322
- local_yoga: false
70323
- },
70324
- queries: [],
70325
- layouts: [],
70326
- variables: {}
70327
- });
70328
- if (args.includeArtifacts) {
70329
- try {
70330
- for (const artifactPath of await fs_exports.readdir(args.config.artifactDirectory)) {
70331
- if (!artifactPath.endsWith(".js") || artifactPath === "index.js") {
70332
- continue;
70333
- }
70334
- manifest.artifacts.push(artifactPath.substring(0, artifactPath.length - 3));
70308
+ var graphql3 = __toESM(require("graphql"), 1);
70309
+
70310
+ // src/runtime/router/match.ts
70311
+ var param_pattern = /^(\[)?(\.\.\.)?(\w+)(?:=(\w+))?(\])?$/;
70312
+ function parse_page_pattern(id) {
70313
+ const params = [];
70314
+ const pattern = id === "/" ? /^\/$/ : new RegExp(
70315
+ `^${get_route_segments(id).map((segment) => {
70316
+ const rest_match = /^\[\.\.\.(\w+)(?:=(\w+))?\]$/.exec(segment);
70317
+ if (rest_match) {
70318
+ params.push({
70319
+ name: rest_match[1],
70320
+ matcher: rest_match[2],
70321
+ optional: false,
70322
+ rest: true,
70323
+ chained: true
70324
+ });
70325
+ return "(?:/(.*))?";
70335
70326
  }
70336
- } catch {
70337
- }
70338
- }
70339
- try {
70340
- await fs_exports.stat(args.config.localApiDir);
70341
- for (const child of await fs_exports.readdir(args.config.localApiDir, { withFileTypes: true })) {
70342
- const name = child.isDirectory() ? child.name : path_exports.parse(child.name).name;
70343
- if (name === "+schema") {
70344
- manifest.local_schema = true;
70345
- } else if (name === "+yoga") {
70346
- manifest.local_yoga = true;
70327
+ const optional_match = /^\[\[(\w+)(?:=(\w+))?\]\]$/.exec(segment);
70328
+ if (optional_match) {
70329
+ params.push({
70330
+ name: optional_match[1],
70331
+ matcher: optional_match[2],
70332
+ optional: true,
70333
+ rest: false,
70334
+ chained: true
70335
+ });
70336
+ return "(?:/([^/]+))?";
70347
70337
  }
70348
- }
70349
- } catch {
70350
- }
70351
- return manifest;
70352
- }
70353
- async function walk_routes(args) {
70354
- const directory_contents = await fs_exports.readdir(args.filepath, {
70355
- withFileTypes: true
70356
- });
70357
- const variables = { ...args.variables };
70358
- let newLayouts = args.layouts;
70359
- let newLayoutQueries = args.queries;
70360
- let layout = null;
70361
- let layoutQuery = null;
70362
- let pageQuery = null;
70363
- const [
70364
- [layoutQueryPath, layoutQueryContents],
70365
- [layoutViewPath, layoutViewContents],
70366
- [pageQueryPath, pageQueryContents],
70367
- [pageViewPath, pageViewContents]
70368
- ] = await Promise.all([
70369
- read_layoutQuery(args.filepath),
70370
- read_layoutView(args.filepath),
70371
- read_pageQuery(args.filepath),
70372
- read_pageView(args.filepath)
70373
- ]);
70374
- if (layoutQueryContents) {
70375
- layoutQuery = await add_query({
70376
- path: layoutQueryPath,
70377
- config: args.config,
70378
- url: args.url,
70379
- project: args.project,
70380
- type: "layout",
70381
- contents: layoutQueryContents,
70382
- variables
70383
- });
70384
- newLayoutQueries = [...args.queries, layoutQuery.name];
70385
- }
70386
- if (layoutViewContents) {
70387
- layout = await add_view({
70388
- url: args.url,
70389
- path: layoutViewPath,
70390
- project: args.project,
70391
- type: "layout",
70392
- contents: layoutViewContents,
70393
- layouts: args.layouts,
70394
- queries: newLayoutQueries,
70395
- config: args.config,
70396
- variables
70397
- });
70398
- newLayouts = [...args.layouts, page_id(layout.url)];
70399
- }
70400
- if (pageQueryContents) {
70401
- pageQuery = await add_query({
70402
- path: pageQueryPath,
70403
- config: args.config,
70404
- url: args.url,
70405
- project: args.project,
70406
- type: "page",
70407
- contents: pageQueryContents,
70408
- variables
70409
- });
70410
- }
70411
- if (pageViewContents) {
70412
- await add_view({
70413
- path: pageViewPath,
70414
- url: args.url.substring(0, args.url.length - 1) || "/",
70415
- project: args.project,
70416
- type: "page",
70417
- contents: pageViewContents,
70418
- layouts: newLayouts,
70419
- queries: pageQuery ? [...newLayoutQueries, pageQuery.name] : newLayoutQueries,
70420
- config: args.config,
70421
- variables
70422
- });
70423
- }
70424
- await Promise.all(
70425
- directory_contents.map((dir) => {
70426
- if (!dir.isDirectory()) {
70338
+ if (!segment) {
70427
70339
  return;
70428
70340
  }
70429
- return walk_routes({
70430
- ...args,
70431
- filepath: path_exports.join(args.filepath, dir.name),
70432
- url: `${args.url}${dir.name}/`,
70433
- queries: newLayoutQueries,
70434
- layouts: newLayouts,
70435
- variables
70436
- });
70437
- })
70341
+ const parts = segment.split(/\[(.+?)\](?!\])/);
70342
+ const result = parts.map((content, i2) => {
70343
+ if (i2 % 2) {
70344
+ if (content.startsWith("x+")) {
70345
+ return escape3(
70346
+ String.fromCharCode(parseInt(content.slice(2), 16))
70347
+ );
70348
+ }
70349
+ if (content.startsWith("u+")) {
70350
+ return escape3(
70351
+ String.fromCharCode(
70352
+ ...content.slice(2).split("-").map((code) => parseInt(code, 16))
70353
+ )
70354
+ );
70355
+ }
70356
+ const match2 = param_pattern.exec(content);
70357
+ if (!match2) {
70358
+ throw new Error(
70359
+ `Invalid param: ${content}. Params and matcher names can only have underscores and alphanumeric characters.`
70360
+ );
70361
+ }
70362
+ const [, is_optional, is_rest, name, matcher] = match2;
70363
+ params.push({
70364
+ name,
70365
+ matcher,
70366
+ optional: !!is_optional,
70367
+ rest: !!is_rest,
70368
+ chained: is_rest ? i2 === 1 && parts[0] === "" : false
70369
+ });
70370
+ return is_rest ? "(.*?)" : is_optional ? "([^/]*)?" : "([^/]+?)";
70371
+ }
70372
+ return escape3(content);
70373
+ }).join("");
70374
+ return "/" + result;
70375
+ }).join("")}/?$`
70438
70376
  );
70439
- return args.project;
70377
+ return { pattern, params, page_id: id };
70440
70378
  }
70441
- async function add_view(args) {
70442
- const target = args.type === "page" ? args.project.pages : args.project.layouts;
70443
- const queries = await extractQueries(args.contents);
70444
- const missing_queries = queries.filter((query2) => !args.queries.includes(query2));
70445
- if (missing_queries.length > 0) {
70446
- throw {
70447
- message: `Unknown queries in ${args.path}: ${missing_queries.join(", ")}`
70448
- };
70379
+ function affects_path(segment) {
70380
+ return !/^\([^)]+\)$/.test(segment);
70381
+ }
70382
+ function get_route_segments(route) {
70383
+ return route.slice(1).split("/").filter(affects_path);
70384
+ }
70385
+ function escape3(str) {
70386
+ return str.normalize().replace(/[[\]]/g, "\\$&").replace(/%/g, "%25").replace(/\//g, "%2[Ff]").replace(/\?/g, "%3[Ff]").replace(/#/g, "%23").replace(/[.*+?^${}()|\\]/g, "\\$&");
70387
+ }
70388
+
70389
+ // src/lib/graphql.ts
70390
+ var graphql2 = __toESM(require("graphql"), 1);
70391
+ var import_node_crypto = __toESM(require("node:crypto"), 1);
70392
+ function getRootType(type) {
70393
+ if (graphql2.isNonNullType(type)) {
70394
+ return getRootType(type.ofType);
70449
70395
  }
70450
- const id = page_id(args.url);
70451
- target[id] = {
70452
- id,
70453
- queries,
70454
- url: args.url,
70455
- layouts: args.layouts,
70456
- path: path_exports.relative(args.config.projectRoot, args.path),
70457
- query_options: args.queries,
70458
- params: Object.fromEntries(
70459
- parse_page_pattern(args.url).params.map((param) => [
70460
- param.name,
70461
- args.variables[param.name] ?? null
70462
- ])
70463
- )
70464
- };
70465
- return target[id];
70396
+ if (graphql2.isListType(type)) {
70397
+ return getRootType(type.ofType);
70398
+ }
70399
+ return type;
70466
70400
  }
70467
- async function add_query(args) {
70468
- const parsed = graphql2.parse(args.contents);
70469
- const query2 = parsed.definitions.find(
70470
- (def) => def.kind === "OperationDefinition" && def.operation === "query"
70471
- );
70472
- if (!query2?.name) {
70473
- throw new Error("No query found");
70401
+ function hashOriginal({ document }) {
70402
+ return hashDocument(document.originalString);
70403
+ }
70404
+ function hashRaw({ document }) {
70405
+ return hashDocument(document.artifact?.raw);
70406
+ }
70407
+ function hashDocument(str) {
70408
+ return import_node_crypto.default.createHash("sha256").update(str || "").digest("hex");
70409
+ }
70410
+ function parentField(ancestors) {
70411
+ return walkParentField([...ancestors].sort(() => -1));
70412
+ }
70413
+ function walkParentField(ancestors) {
70414
+ let head = ancestors.shift();
70415
+ if (Array.isArray(head) || head.kind === "SelectionSet") {
70416
+ return walkParentField(ancestors);
70474
70417
  }
70475
- let loading = false;
70476
- await graphql2.visit(parsed, {
70477
- Directive(node) {
70478
- if (node.name.value === args.config.loadingDirective) {
70479
- loading = true;
70480
- }
70418
+ return head;
70419
+ }
70420
+ function parentTypeFromAncestors(schema, filepath, ancestors) {
70421
+ const parents = [...ancestors];
70422
+ parents.reverse();
70423
+ return walkAncestors(schema, filepath, parents);
70424
+ }
70425
+ function walkAncestors(schema, filepath, ancestors) {
70426
+ let head = ancestors.shift();
70427
+ if (Array.isArray(head)) {
70428
+ return walkAncestors(schema, filepath, ancestors);
70429
+ }
70430
+ if (!head) {
70431
+ throw new HoudiniError({ filepath, message: "Could not figure out type of field" });
70432
+ }
70433
+ if (head.kind === "OperationDefinition") {
70434
+ const operationType = {
70435
+ query: schema.getQueryType(),
70436
+ mutation: schema.getMutationType(),
70437
+ subscription: schema.getSubscriptionType()
70438
+ }[head.operation];
70439
+ if (!operationType) {
70440
+ throw new HoudiniError({ filepath, message: "Could not find operation type" });
70441
+ }
70442
+ return operationType;
70443
+ }
70444
+ if (head.kind === "FragmentDefinition") {
70445
+ const result = schema.getType(head.typeCondition.name.value);
70446
+ if (!result) {
70447
+ throw new HoudiniError({
70448
+ filepath,
70449
+ message: `Could not find definition for ${head.typeCondition.name.value} in the schema`
70450
+ });
70451
+ }
70452
+ return result;
70453
+ }
70454
+ if (head.kind === "FragmentSpread") {
70455
+ throw new Error("How the hell did this happen?");
70456
+ }
70457
+ const parent2 = walkAncestors(schema, filepath, ancestors);
70458
+ if (head.kind === "InlineFragment") {
70459
+ if (!head.typeCondition) {
70460
+ return parent2;
70461
+ }
70462
+ const wrapper = schema.getType(head.typeCondition.name.value);
70463
+ if (!wrapper) {
70464
+ throw new HoudiniError({
70465
+ filepath,
70466
+ message: "Could not find type with name: " + head.typeCondition.name.value
70467
+ });
70468
+ }
70469
+ return wrapper;
70470
+ }
70471
+ if (head.kind === "SelectionSet") {
70472
+ return parent2;
70473
+ }
70474
+ const field = parent2.getFields()[head.name.value];
70475
+ if (!field) {
70476
+ throw new HoudiniError({
70477
+ filepath,
70478
+ message: `Could not find definition of ${head.name.value} in ${parent2.toString()}`
70479
+ });
70480
+ }
70481
+ return getRootType(field.type);
70482
+ }
70483
+ function definitionFromAncestors(ancestors) {
70484
+ let parents = [...ancestors];
70485
+ parents.shift();
70486
+ let definition = parents.shift();
70487
+ while (Array.isArray(definition) && definition) {
70488
+ definition = parents.shift();
70489
+ }
70490
+ return { parents, definition };
70491
+ }
70492
+ function formatErrors(e2, afterError) {
70493
+ const errors = Array.isArray(e2) ? e2 : [e2];
70494
+ for (const error of errors) {
70495
+ if ("filepath" in error && error.filepath) {
70496
+ const relative2 = relative(process.cwd(), error.filepath);
70497
+ console.error(`\u274C Encountered error in ${relative2}`);
70498
+ if (error.message) {
70499
+ console.error(error.message);
70500
+ }
70501
+ } else {
70502
+ console.error(`\u274C ${error.message}`);
70503
+ if ("description" in error && error.description) {
70504
+ console.error(`${error.description}`);
70505
+ }
70506
+ }
70507
+ afterError?.(e2);
70508
+ }
70509
+ }
70510
+ function unwrapType(config2, type, wrappers = [], convertRuntimeScalars) {
70511
+ if (type.kind === "NonNullType") {
70512
+ return unwrapType(config2, type.type, [TypeWrapper.NonNull, ...wrappers]);
70513
+ }
70514
+ if (type instanceof graphql2.GraphQLNonNull) {
70515
+ return unwrapType(config2, type.ofType, [TypeWrapper.NonNull, ...wrappers]);
70516
+ }
70517
+ if (wrappers[0] !== TypeWrapper.NonNull) {
70518
+ wrappers.unshift(TypeWrapper.Nullable);
70519
+ }
70520
+ if (type.kind === "ListType") {
70521
+ return unwrapType(config2, type.type, [TypeWrapper.List, ...wrappers]);
70522
+ }
70523
+ if (type instanceof graphql2.GraphQLList) {
70524
+ return unwrapType(config2, type.ofType, [TypeWrapper.List, ...wrappers]);
70525
+ }
70526
+ if (convertRuntimeScalars && config2.configFile.features?.runtimeScalars?.[type.name.value]) {
70527
+ type = config2.schema.getType(
70528
+ config2.configFile.features?.runtimeScalars?.[type.name.value].type
70529
+ );
70530
+ }
70531
+ const namedType = config2.schema.getType(type.name.value || type.name);
70532
+ if (!namedType) {
70533
+ throw new Error("Unknown type: " + type.name.value || type.name);
70534
+ }
70535
+ return { type: namedType, wrappers };
70536
+ }
70537
+ function wrapType({
70538
+ type,
70539
+ wrappers
70540
+ }) {
70541
+ const head = wrappers[0];
70542
+ const tail = wrappers.slice(1);
70543
+ let kind = graphql2.Kind.NAMED_TYPE;
70544
+ if (head === TypeWrapper.List) {
70545
+ kind = graphql2.Kind.LIST_TYPE;
70546
+ } else if (head === TypeWrapper.NonNull) {
70547
+ kind = graphql2.Kind.NON_NULL_TYPE;
70548
+ }
70549
+ if (kind === "NamedType") {
70550
+ return {
70551
+ kind,
70552
+ name: {
70553
+ kind: graphql2.Kind.NAME,
70554
+ value: type.name
70555
+ }
70556
+ };
70557
+ }
70558
+ return {
70559
+ kind,
70560
+ type: wrapType({ type, wrappers: tail })
70561
+ };
70562
+ }
70563
+ var TypeWrapper = /* @__PURE__ */ ((TypeWrapper2) => {
70564
+ TypeWrapper2["Nullable"] = "Nullable";
70565
+ TypeWrapper2["List"] = "List";
70566
+ TypeWrapper2["NonNull"] = "NonNull";
70567
+ return TypeWrapper2;
70568
+ })(TypeWrapper || {});
70569
+
70570
+ // src/lib/parse.ts
70571
+ var import_parser = __toESM(require_lib6(), 1);
70572
+ var import_recast = __toESM(require_main2(), 1);
70573
+
70574
+ // src/lib/deepMerge.ts
70575
+ var import_deepmerge = __toESM(require_cjs(), 1);
70576
+ function deepMerge2(filepath, ...targets) {
70577
+ try {
70578
+ if (targets.length === 1) {
70579
+ return targets[0];
70580
+ } else if (targets.length === 2) {
70581
+ return (0, import_deepmerge.default)(targets[0], targets[1], {
70582
+ arrayMerge: (source, update) => [...new Set(source.concat(update))]
70583
+ });
70584
+ }
70585
+ return deepMerge2(filepath, targets[0], deepMerge2(filepath, ...targets.slice(1)));
70586
+ } catch (e2) {
70587
+ throw new HoudiniError({
70588
+ filepath,
70589
+ message: "could not merge: " + JSON.stringify(targets, null, 4),
70590
+ description: e2.message
70591
+ });
70592
+ }
70593
+ }
70594
+
70595
+ // src/lib/parse.ts
70596
+ function parseJS(str, config2) {
70597
+ const defaultConfig = {
70598
+ plugins: [
70599
+ "typescript",
70600
+ "importAssertions",
70601
+ "decorators-legacy",
70602
+ "explicitResourceManagement"
70603
+ ],
70604
+ sourceType: "module"
70605
+ };
70606
+ return (0, import_parser.parse)(str || "", config2 ? deepMerge2("", defaultConfig, config2) : defaultConfig).program;
70607
+ }
70608
+ async function printJS(script, options) {
70609
+ if (options?.pretty) {
70610
+ return (0, import_recast.prettyPrint)(script, options);
70611
+ } else {
70612
+ return (0, import_recast.print)(script, options);
70613
+ }
70614
+ }
70615
+
70616
+ // src/lib/router/manifest.ts
70617
+ async function load_manifest(args) {
70618
+ const manifest = await walk_routes({
70619
+ config: args.config,
70620
+ url: "/",
70621
+ filepath: args.config.routesDir,
70622
+ project: {
70623
+ component_fields: {},
70624
+ pages: {},
70625
+ layouts: {},
70626
+ page_queries: {},
70627
+ layout_queries: {},
70628
+ artifacts: [],
70629
+ local_schema: false,
70630
+ local_yoga: false
70631
+ },
70632
+ queries: [],
70633
+ layouts: [],
70634
+ variables: {}
70635
+ });
70636
+ if (args.includeArtifacts) {
70637
+ try {
70638
+ for (const artifactPath of await readdir2(args.config.artifactDirectory)) {
70639
+ if (!artifactPath.endsWith(".js") || artifactPath === "index.js") {
70640
+ continue;
70641
+ }
70642
+ manifest.artifacts.push(artifactPath.substring(0, artifactPath.length - 3));
70643
+ }
70644
+ } catch {
70645
+ }
70646
+ }
70647
+ try {
70648
+ await stat(args.config.localApiDir);
70649
+ for (const child of await readdir2(args.config.localApiDir, { withFileTypes: true })) {
70650
+ const name = child.isDirectory() ? child.name : parse3(child.name).name;
70651
+ if (name === "+schema") {
70652
+ manifest.local_schema = true;
70653
+ } else if (name === "+yoga") {
70654
+ manifest.local_yoga = true;
70655
+ }
70656
+ }
70657
+ } catch {
70658
+ }
70659
+ return manifest;
70660
+ }
70661
+ async function walk_routes(args) {
70662
+ const directory_contents = await readdir2(args.filepath, {
70663
+ withFileTypes: true
70664
+ });
70665
+ const variables = { ...args.variables };
70666
+ let newLayouts = args.layouts;
70667
+ let newLayoutQueries = args.queries;
70668
+ let layout = null;
70669
+ let layoutQuery = null;
70670
+ let pageQuery = null;
70671
+ const [
70672
+ [layoutQueryPath, layoutQueryContents],
70673
+ [layoutViewPath, layoutViewContents],
70674
+ [pageQueryPath, pageQueryContents],
70675
+ [pageViewPath, pageViewContents]
70676
+ ] = await Promise.all([
70677
+ read_layoutQuery(args.filepath),
70678
+ read_layoutView(args.filepath),
70679
+ read_pageQuery(args.filepath),
70680
+ read_pageView(args.filepath)
70681
+ ]);
70682
+ if (layoutQueryContents) {
70683
+ layoutQuery = await add_query({
70684
+ path: layoutQueryPath,
70685
+ config: args.config,
70686
+ url: args.url,
70687
+ project: args.project,
70688
+ type: "layout",
70689
+ contents: layoutQueryContents,
70690
+ variables
70691
+ });
70692
+ newLayoutQueries = [...args.queries, layoutQuery.name];
70693
+ }
70694
+ if (layoutViewContents) {
70695
+ layout = await add_view({
70696
+ url: args.url,
70697
+ path: layoutViewPath,
70698
+ project: args.project,
70699
+ type: "layout",
70700
+ contents: layoutViewContents,
70701
+ layouts: args.layouts,
70702
+ queries: newLayoutQueries,
70703
+ config: args.config,
70704
+ variables
70705
+ });
70706
+ newLayouts = [...args.layouts, page_id(layout.url)];
70707
+ }
70708
+ if (pageQueryContents) {
70709
+ pageQuery = await add_query({
70710
+ path: pageQueryPath,
70711
+ config: args.config,
70712
+ url: args.url,
70713
+ project: args.project,
70714
+ type: "page",
70715
+ contents: pageQueryContents,
70716
+ variables
70717
+ });
70718
+ }
70719
+ if (pageViewContents) {
70720
+ await add_view({
70721
+ path: pageViewPath,
70722
+ url: args.url.substring(0, args.url.length - 1) || "/",
70723
+ project: args.project,
70724
+ type: "page",
70725
+ contents: pageViewContents,
70726
+ layouts: newLayouts,
70727
+ queries: pageQuery ? [...newLayoutQueries, pageQuery.name] : newLayoutQueries,
70728
+ config: args.config,
70729
+ variables
70730
+ });
70731
+ }
70732
+ await Promise.all(
70733
+ directory_contents.map((dir) => {
70734
+ if (!dir.isDirectory()) {
70735
+ return;
70736
+ }
70737
+ return walk_routes({
70738
+ ...args,
70739
+ filepath: join2(args.filepath, dir.name),
70740
+ url: `${args.url}${dir.name}/`,
70741
+ queries: newLayoutQueries,
70742
+ layouts: newLayouts,
70743
+ variables
70744
+ });
70745
+ })
70746
+ );
70747
+ return args.project;
70748
+ }
70749
+ async function add_view(args) {
70750
+ const target = args.type === "page" ? args.project.pages : args.project.layouts;
70751
+ const queries = await extractQueries(args.contents);
70752
+ const missing_queries = queries.filter((query2) => !args.queries.includes(query2));
70753
+ if (missing_queries.length > 0) {
70754
+ throw {
70755
+ message: `Unknown queries in ${args.path}: ${missing_queries.join(", ")}`
70756
+ };
70757
+ }
70758
+ const id = page_id(args.url);
70759
+ target[id] = {
70760
+ id,
70761
+ queries,
70762
+ url: args.url,
70763
+ layouts: args.layouts,
70764
+ path: relative(args.config.projectRoot, args.path),
70765
+ query_options: args.queries,
70766
+ params: Object.fromEntries(
70767
+ parse_page_pattern(args.url).params.map((param) => [
70768
+ param.name,
70769
+ args.variables[param.name] ?? null
70770
+ ])
70771
+ )
70772
+ };
70773
+ return target[id];
70774
+ }
70775
+ async function add_query(args) {
70776
+ const parsed = graphql3.parse(args.contents);
70777
+ const query2 = parsed.definitions.find(
70778
+ (def) => def.kind === "OperationDefinition" && def.operation === "query"
70779
+ );
70780
+ if (!query2?.name) {
70781
+ throw new Error("No query found");
70782
+ }
70783
+ let loading = false;
70784
+ await graphql3.visit(parsed, {
70785
+ Directive(node) {
70786
+ if (node.name.value === args.config.loadingDirective) {
70787
+ loading = true;
70788
+ }
70481
70789
  }
70482
70790
  });
70483
70791
  const queryVariables = Object.fromEntries(
@@ -70492,7 +70800,7 @@ async function add_query(args) {
70492
70800
  Object.assign(args.variables, queryVariables);
70493
70801
  const target = args.type === "page" ? args.project.page_queries : args.project.layout_queries;
70494
70802
  target[page_id(args.url)] = {
70495
- path: path_exports.relative(args.config.routesDir, args.path),
70803
+ path: relative(args.config.routesDir, args.path),
70496
70804
  name: query2.name.value,
70497
70805
  url: args.url,
70498
70806
  loading,
@@ -70567,7 +70875,7 @@ async function extractQueries(source) {
70567
70875
  }
70568
70876
 
70569
70877
  // src/lib/router/server.ts
70570
- var graphql3 = __toESM(require("graphql"), 1);
70878
+ var graphql4 = __toESM(require("graphql"), 1);
70571
70879
  var import_node_path3 = __toESM(require("node:path"), 1);
70572
70880
 
70573
70881
  // src/runtime/lib/flatten.ts
@@ -72916,14 +73224,14 @@ function isSecondaryBuild() {
72916
73224
  async function buildLocalSchema(config2) {
72917
73225
  const { build } = await import("vite");
72918
73226
  const schema = import_node_path3.default.join(config2.localApiDir, "+schema");
72919
- const outDir = conventions_exports.temp_dir(config2, "schema");
73227
+ const outDir = temp_dir(config2, "schema");
72920
73228
  process.env.HOUDINI_SECONDARY_BUILD = "true";
72921
73229
  try {
72922
- await fs_exports.remove(import_node_path3.default.join(outDir, "assets", "schema.js"));
73230
+ await remove(import_node_path3.default.join(outDir, "assets", "schema.js"));
72923
73231
  } catch {
72924
73232
  }
72925
73233
  try {
72926
- await fs_exports.mkdir(outDir);
73234
+ await mkdir(outDir);
72927
73235
  } catch {
72928
73236
  }
72929
73237
  await build({
@@ -72955,14 +73263,14 @@ async function loadLocalSchema(config2) {
72955
73263
  }
72956
73264
  try {
72957
73265
  const { default: schema } = await import(import_node_path3.default.join(
72958
- conventions_exports.temp_dir(config2, "schema"),
73266
+ temp_dir(config2, "schema"),
72959
73267
  `schema.js?${Date.now().valueOf()}}`
72960
73268
  ));
72961
73269
  return schema;
72962
73270
  } catch (e2) {
72963
73271
  const message = "message" in e2 ? e2.message : e2;
72964
73272
  console.error("\u26A0\uFE0F Failed to load local schema: ", message);
72965
- return new graphql3.GraphQLSchema({});
73273
+ return new graphql4.GraphQLSchema({});
72966
73274
  }
72967
73275
  }
72968
73276
 
@@ -73038,7 +73346,7 @@ var Config = class {
73038
73346
  persistedQueriesPath
73039
73347
  } = this.configFile;
73040
73348
  if (typeof schema === "string") {
73041
- this.schema = graphql4.buildSchema(schema);
73349
+ this.schema = graphql5.buildSchema(schema);
73042
73350
  } else {
73043
73351
  this.schema = schema;
73044
73352
  }
@@ -73186,7 +73494,7 @@ var Config = class {
73186
73494
  set newSchema(value) {
73187
73495
  this.schemaString = value;
73188
73496
  if (value) {
73189
- this.#newSchemaInstance = graphql4.buildSchema(value);
73497
+ this.#newSchemaInstance = graphql5.buildSchema(value);
73190
73498
  } else {
73191
73499
  this.#newSchemaInstance = null;
73192
73500
  }
@@ -73276,21 +73584,21 @@ var Config = class {
73276
73584
  }
73277
73585
  documentName(document) {
73278
73586
  const operation = document.definitions.find(
73279
- ({ kind }) => kind === graphql4.Kind.OPERATION_DEFINITION
73587
+ ({ kind }) => kind === graphql5.Kind.OPERATION_DEFINITION
73280
73588
  );
73281
73589
  if (operation) {
73282
73590
  if (!operation.name) {
73283
- throw new Error("encountered operation with no name: " + graphql4.print(document));
73591
+ throw new Error("encountered operation with no name: " + graphql5.print(document));
73284
73592
  }
73285
73593
  return operation.name.value;
73286
73594
  }
73287
73595
  const fragmentDefinitions = document.definitions.filter(
73288
- ({ kind }) => kind === graphql4.Kind.FRAGMENT_DEFINITION
73596
+ ({ kind }) => kind === graphql5.Kind.FRAGMENT_DEFINITION
73289
73597
  );
73290
73598
  if (fragmentDefinitions.length) {
73291
73599
  return fragmentDefinitions[0].name.value;
73292
73600
  }
73293
- throw new Error("Could not generate artifact name for document: " + graphql4.print(document));
73601
+ throw new Error("Could not generate artifact name for document: " + graphql5.print(document));
73294
73602
  }
73295
73603
  isSelectionScalar(type) {
73296
73604
  return ["String", "Boolean", "Float", "ID", "Int"].concat(Object.keys(this.scalars || {})).includes(type);
@@ -73310,8 +73618,8 @@ var Config = class {
73310
73618
  relative(process.cwd(), filepath).replaceAll(sep2, "_").replace(".ts", ".js")
73311
73619
  );
73312
73620
  }
73313
- excludeFile(filepath) {
73314
- if (this.exclude.length > 0 && this.exclude.some((pattern) => (0, import_minimatch8.default)(filepath, pattern))) {
73621
+ excludeFile(filepath, { root = this.projectRoot }) {
73622
+ if (this.exclude.length > 0 && this.exclude.some((pattern) => (0, import_minimatch8.default)(filepath, join2(root, pattern)))) {
73315
73623
  return true;
73316
73624
  }
73317
73625
  for (const plugin2 of this.plugins) {
@@ -73340,7 +73648,7 @@ var Config = class {
73340
73648
  if (!included && !this.include.some((pattern) => (0, import_minimatch8.default)(filepath, join2(root, pattern)))) {
73341
73649
  return false;
73342
73650
  }
73343
- return !this.excludeFile(filepath);
73651
+ return !this.excludeFile(filepath, { root });
73344
73652
  }
73345
73653
  pluginRuntimeDirectory(name) {
73346
73654
  return join2(this.pluginDirectory(name), "runtime");
@@ -73500,10 +73808,10 @@ var Config = class {
73500
73808
  localDocumentData(document) {
73501
73809
  let paginated = false;
73502
73810
  let componentFields3 = [];
73503
- const typeInfo = new graphql4.TypeInfo(this.schema);
73504
- graphql4.visit(
73811
+ const typeInfo = new graphql5.TypeInfo(this.schema);
73812
+ graphql5.visit(
73505
73813
  document,
73506
- graphql4.visitWithTypeInfo(typeInfo, {
73814
+ graphql5.visitWithTypeInfo(typeInfo, {
73507
73815
  Directive: (node) => {
73508
73816
  if ([this.paginateDirective].includes(node.name.value)) {
73509
73817
  paginated = true;
@@ -73815,291 +74123,64 @@ async function pluginPath(plugin_name, config_path) {
73815
74123
  throw new Error("");
73816
74124
  }
73817
74125
  return join2(pluginDirectory, packageJSON.exports["."].import);
73818
- } catch {
73819
- const err = new Error(
73820
- `Could not find plugin: ${plugin_name}. Are you sure its installed? If so, please open a ticket on GitHub.`
73821
- );
73822
- throw err;
73823
- }
73824
- }
73825
- function findModule(pkg = "houdini", currentLocation) {
73826
- const pathEndingBy = ["node_modules", pkg];
73827
- let locationFound = join2(currentLocation, ...pathEndingBy);
73828
- let previousLocation = "";
73829
- const backFolder = [];
73830
- while (previousLocation !== locationFound && !existsSync(locationFound)) {
73831
- previousLocation = locationFound;
73832
- backFolder.push("../");
73833
- locationFound = join2(currentLocation, ...backFolder, ...pathEndingBy);
73834
- }
73835
- if (previousLocation === locationFound) {
73836
- throw new Error("Could not find any node_modules/houdini folder");
73837
- }
73838
- return locationFound;
73839
- }
73840
- async function loadSchemaFile(schemaPath) {
73841
- if (isAbsolute(schemaPath)) {
73842
- const relPath = relative(process.cwd(), schemaPath);
73843
- const error = new Error(
73844
- `Invalid config value: 'schemaPath' must now be passed as a relative directory. Please change its value to "./${relPath}".`
73845
- );
73846
- error.stack = "";
73847
- throw error;
73848
- }
73849
- if (glob2.hasMagic(schemaPath)) {
73850
- const sourceFiles = await glob2(schemaPath);
73851
- return mergeSchemas({
73852
- typeDefs: await Promise.all(
73853
- sourceFiles.map(async (filepath) => await readFile(filepath))
73854
- )
73855
- });
73856
- }
73857
- try {
73858
- await stat(schemaPath);
73859
- } catch {
73860
- throw new HoudiniError({
73861
- message: `Schema file does not exist! Create it using houdini pull-schema`
73862
- });
73863
- }
73864
- const contents = await readFile(schemaPath);
73865
- if (schemaPath.endsWith("gql") || schemaPath.endsWith("graphql") || schemaPath.endsWith("graphqls")) {
73866
- return graphql4.buildSchema(contents);
73867
- }
73868
- const jsonContents = JSON.parse(contents);
73869
- if (jsonContents.data) {
73870
- return graphql4.buildClientSchema(jsonContents.data);
73871
- }
73872
- return graphql4.buildClientSchema(jsonContents);
73873
- }
73874
- var emptySchema = graphql4.buildSchema("type Query { hello: String }");
73875
- var defaultDirectives = emptySchema.getDirectives().map((dir) => dir.name);
73876
-
73877
- // src/lib/graphql.ts
73878
- var graphql5 = __toESM(require("graphql"), 1);
73879
- var import_node_crypto = __toESM(require("node:crypto"), 1);
73880
- function getRootType(type) {
73881
- if (graphql5.isNonNullType(type)) {
73882
- return getRootType(type.ofType);
73883
- }
73884
- if (graphql5.isListType(type)) {
73885
- return getRootType(type.ofType);
73886
- }
73887
- return type;
73888
- }
73889
- function hashOriginal({ document }) {
73890
- return hashDocument(document.originalString);
73891
- }
73892
- function hashRaw({ document }) {
73893
- return hashDocument(document.artifact?.raw);
73894
- }
73895
- function hashDocument(str) {
73896
- return import_node_crypto.default.createHash("sha256").update(str || "").digest("hex");
73897
- }
73898
- function parentField(ancestors) {
73899
- return walkParentField([...ancestors].sort(() => -1));
73900
- }
73901
- function walkParentField(ancestors) {
73902
- let head = ancestors.shift();
73903
- if (Array.isArray(head) || head.kind === "SelectionSet") {
73904
- return walkParentField(ancestors);
73905
- }
73906
- return head;
73907
- }
73908
- function parentTypeFromAncestors(schema, filepath, ancestors) {
73909
- const parents = [...ancestors];
73910
- parents.reverse();
73911
- return walkAncestors(schema, filepath, parents);
73912
- }
73913
- function walkAncestors(schema, filepath, ancestors) {
73914
- let head = ancestors.shift();
73915
- if (Array.isArray(head)) {
73916
- return walkAncestors(schema, filepath, ancestors);
73917
- }
73918
- if (!head) {
73919
- throw new HoudiniError({ filepath, message: "Could not figure out type of field" });
73920
- }
73921
- if (head.kind === "OperationDefinition") {
73922
- const operationType = {
73923
- query: schema.getQueryType(),
73924
- mutation: schema.getMutationType(),
73925
- subscription: schema.getSubscriptionType()
73926
- }[head.operation];
73927
- if (!operationType) {
73928
- throw new HoudiniError({ filepath, message: "Could not find operation type" });
73929
- }
73930
- return operationType;
73931
- }
73932
- if (head.kind === "FragmentDefinition") {
73933
- const result = schema.getType(head.typeCondition.name.value);
73934
- if (!result) {
73935
- throw new HoudiniError({
73936
- filepath,
73937
- message: `Could not find definition for ${head.typeCondition.name.value} in the schema`
73938
- });
73939
- }
73940
- return result;
73941
- }
73942
- if (head.kind === "FragmentSpread") {
73943
- throw new Error("How the hell did this happen?");
73944
- }
73945
- const parent2 = walkAncestors(schema, filepath, ancestors);
73946
- if (head.kind === "InlineFragment") {
73947
- if (!head.typeCondition) {
73948
- return parent2;
73949
- }
73950
- const wrapper = schema.getType(head.typeCondition.name.value);
73951
- if (!wrapper) {
73952
- throw new HoudiniError({
73953
- filepath,
73954
- message: "Could not find type with name: " + head.typeCondition.name.value
73955
- });
73956
- }
73957
- return wrapper;
73958
- }
73959
- if (head.kind === "SelectionSet") {
73960
- return parent2;
73961
- }
73962
- const field = parent2.getFields()[head.name.value];
73963
- if (!field) {
73964
- throw new HoudiniError({
73965
- filepath,
73966
- message: `Could not find definition of ${head.name.value} in ${parent2.toString()}`
73967
- });
73968
- }
73969
- return getRootType(field.type);
73970
- }
73971
- function definitionFromAncestors(ancestors) {
73972
- let parents = [...ancestors];
73973
- parents.shift();
73974
- let definition = parents.shift();
73975
- while (Array.isArray(definition) && definition) {
73976
- definition = parents.shift();
73977
- }
73978
- return { parents, definition };
73979
- }
73980
- function formatErrors(e2, afterError) {
73981
- const errors = Array.isArray(e2) ? e2 : [e2];
73982
- for (const error of errors) {
73983
- if ("filepath" in error && error.filepath) {
73984
- const relative2 = relative(process.cwd(), error.filepath);
73985
- console.error(`\u274C Encountered error in ${relative2}`);
73986
- if (error.message) {
73987
- console.error(error.message);
73988
- }
73989
- } else {
73990
- console.error(`\u274C ${error.message}`);
73991
- if ("description" in error && error.description) {
73992
- console.error(`${error.description}`);
73993
- }
73994
- }
73995
- afterError?.(e2);
73996
- }
73997
- }
73998
- function unwrapType(config2, type, wrappers = [], convertRuntimeScalars) {
73999
- if (type.kind === "NonNullType") {
74000
- return unwrapType(config2, type.type, [TypeWrapper.NonNull, ...wrappers]);
74001
- }
74002
- if (type instanceof graphql5.GraphQLNonNull) {
74003
- return unwrapType(config2, type.ofType, [TypeWrapper.NonNull, ...wrappers]);
74004
- }
74005
- if (wrappers[0] !== TypeWrapper.NonNull) {
74006
- wrappers.unshift(TypeWrapper.Nullable);
74007
- }
74008
- if (type.kind === "ListType") {
74009
- return unwrapType(config2, type.type, [TypeWrapper.List, ...wrappers]);
74010
- }
74011
- if (type instanceof graphql5.GraphQLList) {
74012
- return unwrapType(config2, type.ofType, [TypeWrapper.List, ...wrappers]);
74013
- }
74014
- if (convertRuntimeScalars && config2.configFile.features?.runtimeScalars?.[type.name.value]) {
74015
- type = config2.schema.getType(
74016
- config2.configFile.features?.runtimeScalars?.[type.name.value].type
74126
+ } catch {
74127
+ const err = new Error(
74128
+ `Could not find plugin: ${plugin_name}. Are you sure its installed? If so, please open a ticket on GitHub.`
74017
74129
  );
74130
+ throw err;
74018
74131
  }
74019
- const namedType = config2.schema.getType(type.name.value || type.name);
74020
- if (!namedType) {
74021
- throw new Error("Unknown type: " + type.name.value || type.name);
74022
- }
74023
- return { type: namedType, wrappers };
74024
74132
  }
74025
- function wrapType({
74026
- type,
74027
- wrappers
74028
- }) {
74029
- const head = wrappers[0];
74030
- const tail = wrappers.slice(1);
74031
- let kind = graphql5.Kind.NAMED_TYPE;
74032
- if (head === TypeWrapper.List) {
74033
- kind = graphql5.Kind.LIST_TYPE;
74034
- } else if (head === TypeWrapper.NonNull) {
74035
- kind = graphql5.Kind.NON_NULL_TYPE;
74133
+ function findModule(pkg = "houdini", currentLocation) {
74134
+ const pathEndingBy = ["node_modules", pkg];
74135
+ let locationFound = join2(currentLocation, ...pathEndingBy);
74136
+ let previousLocation = "";
74137
+ const backFolder = [];
74138
+ while (previousLocation !== locationFound && !existsSync(locationFound)) {
74139
+ previousLocation = locationFound;
74140
+ backFolder.push("../");
74141
+ locationFound = join2(currentLocation, ...backFolder, ...pathEndingBy);
74036
74142
  }
74037
- if (kind === "NamedType") {
74038
- return {
74039
- kind,
74040
- name: {
74041
- kind: graphql5.Kind.NAME,
74042
- value: type.name
74043
- }
74044
- };
74143
+ if (previousLocation === locationFound) {
74144
+ throw new Error("Could not find any node_modules/houdini folder");
74045
74145
  }
74046
- return {
74047
- kind,
74048
- type: wrapType({ type, wrappers: tail })
74049
- };
74146
+ return locationFound;
74050
74147
  }
74051
- var TypeWrapper = /* @__PURE__ */ ((TypeWrapper2) => {
74052
- TypeWrapper2["Nullable"] = "Nullable";
74053
- TypeWrapper2["List"] = "List";
74054
- TypeWrapper2["NonNull"] = "NonNull";
74055
- return TypeWrapper2;
74056
- })(TypeWrapper || {});
74057
-
74058
- // src/lib/parse.ts
74059
- var import_parser = __toESM(require_lib6(), 1);
74060
- var import_recast = __toESM(require_main2(), 1);
74061
-
74062
- // src/lib/deepMerge.ts
74063
- var import_deepmerge = __toESM(require_cjs(), 1);
74064
- function deepMerge2(filepath, ...targets) {
74148
+ async function loadSchemaFile(schemaPath) {
74149
+ if (isAbsolute(schemaPath)) {
74150
+ const relPath = relative(process.cwd(), schemaPath);
74151
+ const error = new Error(
74152
+ `Invalid config value: 'schemaPath' must now be passed as a relative directory. Please change its value to "./${relPath}".`
74153
+ );
74154
+ error.stack = "";
74155
+ throw error;
74156
+ }
74157
+ if (glob2.hasMagic(schemaPath)) {
74158
+ const sourceFiles = await glob2(schemaPath);
74159
+ return mergeSchemas({
74160
+ typeDefs: await Promise.all(
74161
+ sourceFiles.map(async (filepath) => await readFile(filepath))
74162
+ )
74163
+ });
74164
+ }
74065
74165
  try {
74066
- if (targets.length === 1) {
74067
- return targets[0];
74068
- } else if (targets.length === 2) {
74069
- return (0, import_deepmerge.default)(targets[0], targets[1], {
74070
- arrayMerge: (source, update) => [...new Set(source.concat(update))]
74071
- });
74072
- }
74073
- return deepMerge2(filepath, targets[0], deepMerge2(filepath, ...targets.slice(1)));
74074
- } catch (e2) {
74166
+ await stat(schemaPath);
74167
+ } catch {
74075
74168
  throw new HoudiniError({
74076
- filepath,
74077
- message: "could not merge: " + JSON.stringify(targets, null, 4),
74078
- description: e2.message
74169
+ message: `Schema file does not exist! Create it using houdini pull-schema`
74079
74170
  });
74080
74171
  }
74081
- }
74082
-
74083
- // src/lib/parse.ts
74084
- function parseJS(str, config2) {
74085
- const defaultConfig = {
74086
- plugins: [
74087
- "typescript",
74088
- "importAssertions",
74089
- "decorators-legacy",
74090
- "explicitResourceManagement"
74091
- ],
74092
- sourceType: "module"
74093
- };
74094
- return (0, import_parser.parse)(str || "", config2 ? deepMerge2("", defaultConfig, config2) : defaultConfig).program;
74095
- }
74096
- async function printJS(script, options) {
74097
- if (options?.pretty) {
74098
- return (0, import_recast.prettyPrint)(script, options);
74099
- } else {
74100
- return (0, import_recast.print)(script, options);
74172
+ const contents = await readFile(schemaPath);
74173
+ if (schemaPath.endsWith("gql") || schemaPath.endsWith("graphql") || schemaPath.endsWith("graphqls")) {
74174
+ return graphql5.buildSchema(contents);
74101
74175
  }
74176
+ const jsonContents = JSON.parse(contents);
74177
+ if (jsonContents.data) {
74178
+ return graphql5.buildClientSchema(jsonContents.data);
74179
+ }
74180
+ return graphql5.buildClientSchema(jsonContents);
74102
74181
  }
74182
+ var emptySchema = graphql5.buildSchema("type Query { hello: String }");
74183
+ var defaultDirectives = emptySchema.getDirectives().map((dir) => dir.name);
74103
74184
 
74104
74185
  // src/lib/imports.ts
74105
74186
  var recast = __toESM(require_main2(), 1);
@@ -74160,85 +74241,6 @@ async function cleanupFiles(pathFolder, listOfObj) {
74160
74241
  return allFilesNotInList;
74161
74242
  }
74162
74243
 
74163
- // src/runtime/router/match.ts
74164
- var param_pattern = /^(\[)?(\.\.\.)?(\w+)(?:=(\w+))?(\])?$/;
74165
- function parse_page_pattern(id) {
74166
- const params = [];
74167
- const pattern = id === "/" ? /^\/$/ : new RegExp(
74168
- `^${get_route_segments(id).map((segment) => {
74169
- const rest_match = /^\[\.\.\.(\w+)(?:=(\w+))?\]$/.exec(segment);
74170
- if (rest_match) {
74171
- params.push({
74172
- name: rest_match[1],
74173
- matcher: rest_match[2],
74174
- optional: false,
74175
- rest: true,
74176
- chained: true
74177
- });
74178
- return "(?:/(.*))?";
74179
- }
74180
- const optional_match = /^\[\[(\w+)(?:=(\w+))?\]\]$/.exec(segment);
74181
- if (optional_match) {
74182
- params.push({
74183
- name: optional_match[1],
74184
- matcher: optional_match[2],
74185
- optional: true,
74186
- rest: false,
74187
- chained: true
74188
- });
74189
- return "(?:/([^/]+))?";
74190
- }
74191
- if (!segment) {
74192
- return;
74193
- }
74194
- const parts = segment.split(/\[(.+?)\](?!\])/);
74195
- const result = parts.map((content, i2) => {
74196
- if (i2 % 2) {
74197
- if (content.startsWith("x+")) {
74198
- return escape3(
74199
- String.fromCharCode(parseInt(content.slice(2), 16))
74200
- );
74201
- }
74202
- if (content.startsWith("u+")) {
74203
- return escape3(
74204
- String.fromCharCode(
74205
- ...content.slice(2).split("-").map((code) => parseInt(code, 16))
74206
- )
74207
- );
74208
- }
74209
- const match2 = param_pattern.exec(content);
74210
- if (!match2) {
74211
- throw new Error(
74212
- `Invalid param: ${content}. Params and matcher names can only have underscores and alphanumeric characters.`
74213
- );
74214
- }
74215
- const [, is_optional, is_rest, name, matcher] = match2;
74216
- params.push({
74217
- name,
74218
- matcher,
74219
- optional: !!is_optional,
74220
- rest: !!is_rest,
74221
- chained: is_rest ? i2 === 1 && parts[0] === "" : false
74222
- });
74223
- return is_rest ? "(.*?)" : is_optional ? "([^/]*)?" : "([^/]+?)";
74224
- }
74225
- return escape3(content);
74226
- }).join("");
74227
- return "/" + result;
74228
- }).join("")}/?$`
74229
- );
74230
- return { pattern, params, page_id: id };
74231
- }
74232
- function affects_path(segment) {
74233
- return !/^\([^)]+\)$/.test(segment);
74234
- }
74235
- function get_route_segments(route) {
74236
- return route.slice(1).split("/").filter(affects_path);
74237
- }
74238
- function escape3(str) {
74239
- return str.normalize().replace(/[[\]]/g, "\\$&").replace(/%/g, "%25").replace(/\//g, "%2[Ff]").replace(/\?/g, "%3[Ff]").replace(/#/g, "%23").replace(/[.*+?^${}()|\\]/g, "\\$&");
74240
- }
74241
-
74242
74244
  // src/lib/typescript.ts
74243
74245
  var graphql6 = __toESM(require("graphql"), 1);
74244
74246
  var recast2 = __toESM(require_main2(), 1);
@@ -74308,18 +74310,18 @@ function scalarPropertyValue(config2, filepath, missingScalars, target, body, fi
74308
74310
  return AST3.tsNeverKeyword();
74309
74311
  }
74310
74312
  const component = config2.componentFields[field.parent][field.field];
74311
- const sourcePathRelative = path_exports.relative(
74312
- path_exports.join(config2.projectRoot, "src"),
74313
+ const sourcePathRelative = relative(
74314
+ join2(config2.projectRoot, "src"),
74313
74315
  component.filepath
74314
74316
  );
74315
- let sourcePathParsed = path_exports.parse(sourcePathRelative);
74316
- let sourcePath = path_exports.join(sourcePathParsed.dir, sourcePathParsed.name);
74317
+ let sourcePathParsed = parse3(sourcePathRelative);
74318
+ let sourcePath = join2(sourcePathParsed.dir, sourcePathParsed.name);
74317
74319
  const localImport = ensureImports({
74318
74320
  config: config2,
74319
74321
  body,
74320
74322
  import: "__component__" + component.fragment,
74321
- sourceModule: path_exports.join(
74322
- path_exports.relative(path_exports.dirname(filepath), config2.projectRoot),
74323
+ sourceModule: join2(
74324
+ relative(dirname(filepath), config2.projectRoot),
74323
74325
  "src",
74324
74326
  sourcePath
74325
74327
  )
@@ -74385,9 +74387,9 @@ function scalarPropertyValue(config2, filepath, missingScalars, target, body, fi
74385
74387
  }
74386
74388
  }
74387
74389
  async function writeTsConfig(config2) {
74388
- await fs_exports.mkdirp(config2.rootDir);
74389
- await fs_exports.writeFile(
74390
- path_exports.join(config2.rootDir, "tsconfig.json"),
74390
+ await mkdirp(config2.rootDir);
74391
+ await writeFile(
74392
+ join2(config2.rootDir, "tsconfig.json"),
74391
74393
  JSON.stringify(
74392
74394
  {
74393
74395
  compilerOptions: {
@@ -75281,12 +75283,12 @@ function stripLoc(value) {
75281
75283
 
75282
75284
  // src/codegen/transforms/collectDefinitions.ts
75283
75285
  var graphql8 = __toESM(require("graphql"), 1);
75284
- var import_graphql32 = require("graphql");
75286
+ var import_graphql33 = require("graphql");
75285
75287
  async function includeFragmentDefinitions(config2, documents) {
75286
75288
  const fragments = collectDefinitions(config2, documents);
75287
75289
  for (const [index, { name, document, filename }] of documents.entries()) {
75288
75290
  const operation = document.definitions.find(
75289
- (def) => def.kind === import_graphql32.Kind.OPERATION_DEFINITION || def.kind === "FragmentDefinition"
75291
+ (def) => def.kind === import_graphql33.Kind.OPERATION_DEFINITION || def.kind === "FragmentDefinition"
75290
75292
  );
75291
75293
  if (!operation) {
75292
75294
  continue;
@@ -77282,6 +77284,16 @@ async function generatePluginIndex({
77282
77284
  }
77283
77285
 
77284
77286
  // src/codegen/generators/runtime/pluginRuntime.ts
77287
+ function moduleStatments(config2) {
77288
+ const importStatement = config2.module === "commonjs" ? importDefaultFrom : (where, as) => `import ${as} from '${where}'`;
77289
+ const exportDefaultStatement = config2.module === "commonjs" ? exportDefault : (as) => `export default ${as}`;
77290
+ const exportStarStatement = config2.module === "commonjs" ? exportStarFrom : (where) => `export * from '${where}'`;
77291
+ return {
77292
+ importStatement,
77293
+ exportDefaultStatement,
77294
+ exportStarStatement
77295
+ };
77296
+ }
77285
77297
  async function generatePluginRuntimes({
77286
77298
  config: config2,
77287
77299
  docs
@@ -77297,7 +77309,7 @@ async function generatePluginRuntimes({
77297
77309
  return;
77298
77310
  }
77299
77311
  try {
77300
- await fs_exports.stat(runtime_path);
77312
+ await stat(runtime_path);
77301
77313
  } catch {
77302
77314
  throw new HoudiniError({
77303
77315
  message: "Cannot find runtime to generate for " + plugin2.name,
@@ -77309,13 +77321,13 @@ async function generatePluginRuntimes({
77309
77321
  if (transformMap && typeof transformMap === "function") {
77310
77322
  transformMap = transformMap(docs, { config: config2 });
77311
77323
  }
77312
- await fs_exports.mkdirp(pluginDir);
77313
- await fs_exports.recursiveCopy(
77324
+ await mkdirp(pluginDir);
77325
+ await recursiveCopy(
77314
77326
  runtime_path,
77315
77327
  pluginDir,
77316
77328
  Object.fromEntries(
77317
77329
  Object.entries(transformMap).map(([key, value]) => [
77318
- path_exports.join(runtime_path, key),
77330
+ join2(runtime_path, key),
77319
77331
  (content) => value({
77320
77332
  config: config2,
77321
77333
  content,
@@ -77362,21 +77374,21 @@ async function runtimeGenerator(config2, docs) {
77362
77374
  exportStarStatement: exportStar
77363
77375
  } = moduleStatments(config2);
77364
77376
  await Promise.all([
77365
- fs_exports.recursiveCopy(config2.runtimeSource, config2.runtimeDirectory, {
77366
- [path_exports.join(config2.runtimeSource, "lib", "constants.js")]: (content) => {
77377
+ recursiveCopy(config2.runtimeSource, config2.runtimeDirectory, {
77378
+ [join2(config2.runtimeSource, "lib", "constants.js")]: (content) => {
77367
77379
  return content.replace("SITE_URL", siteURL);
77368
77380
  },
77369
- [path_exports.join(config2.runtimeSource, "imports", "pluginConfig.js")]: (content) => {
77381
+ [join2(config2.runtimeSource, "imports", "pluginConfig.js")]: (content) => {
77370
77382
  return injectConfig({ config: config2, importStatement, exportStatement, content });
77371
77383
  },
77372
- [path_exports.join(config2.runtimeSource, "imports", "config.js")]: (content) => {
77373
- const configFilePath = path_exports.join(config2.runtimeDirectory, "imports", "config.js");
77374
- const relativePath = path_exports.relative(path_exports.dirname(configFilePath), config2.filepath);
77384
+ [join2(config2.runtimeSource, "imports", "config.js")]: (content) => {
77385
+ const configFilePath = join2(config2.runtimeDirectory, "imports", "config.js");
77386
+ const relativePath = relative(dirname(configFilePath), config2.filepath);
77375
77387
  return `${importStatement(relativePath, "config")}
77376
77388
  ${exportStatement("config")}
77377
77389
  `;
77378
77390
  },
77379
- [path_exports.join(config2.runtimeSource, "client", "plugins", "injectedPlugins.js")]: (content) => injectPlugins({ config: config2, content, importStatement, exportStatement })
77391
+ [join2(config2.runtimeSource, "client", "plugins", "injectedPlugins.js")]: (content) => injectPlugins({ config: config2, content, importStatement, exportStatement })
77380
77392
  }),
77381
77393
  generatePluginRuntimes({
77382
77394
  config: config2,
@@ -77386,16 +77398,6 @@ ${exportStatement("config")}
77386
77398
  ]);
77387
77399
  await generateGraphqlReturnTypes(config2, docs);
77388
77400
  }
77389
- function moduleStatments(config2) {
77390
- const importStatement = config2.module === "commonjs" ? importDefaultFrom : (where, as) => `import ${as} from '${where}'`;
77391
- const exportDefaultStatement = config2.module === "commonjs" ? exportDefault : (as) => `export default ${as}`;
77392
- const exportStarStatement = config2.module === "commonjs" ? exportStarFrom : (where) => `export * from '${where}'`;
77393
- return {
77394
- importStatement,
77395
- exportDefaultStatement,
77396
- exportStarStatement
77397
- };
77398
- }
77399
77401
 
77400
77402
  // src/codegen/generators/typescript/documentTypes.ts
77401
77403
  var recast11 = __toESM(require_main2(), 1);
@@ -78878,7 +78880,7 @@ async function writeIndexFile2(config2, docs) {
78878
78880
  }
78879
78881
 
78880
78882
  // ../../node_modules/.pnpm/@graphql-tools+utils@10.0.6_graphql@15.5.0/node_modules/@graphql-tools/utils/esm/helpers.js
78881
- var import_graphql33 = require("graphql");
78883
+ var import_graphql34 = require("graphql");
78882
78884
  function compareStrings2(a, b) {
78883
78885
  if (String(a) < String(b)) {
78884
78886
  return -1;
@@ -78914,7 +78916,7 @@ function isSome2(input) {
78914
78916
  }
78915
78917
 
78916
78918
  // ../../node_modules/.pnpm/@graphql-tools+utils@10.0.6_graphql@15.5.0/node_modules/@graphql-tools/utils/esm/inspect.js
78917
- var import_graphql34 = require("graphql");
78919
+ var import_graphql35 = require("graphql");
78918
78920
  var MAX_RECURSIVE_DEPTH2 = 3;
78919
78921
  function inspect2(value) {
78920
78922
  return formatValue2(value, []);
@@ -78932,7 +78934,7 @@ function formatValue2(value, seenValues) {
78932
78934
  }
78933
78935
  }
78934
78936
  function formatError2(value) {
78935
- if (value instanceof import_graphql34.GraphQLError) {
78937
+ if (value instanceof import_graphql35.GraphQLError) {
78936
78938
  return value.toString();
78937
78939
  }
78938
78940
  return `${value.name}: ${value.message};
@@ -79015,43 +79017,43 @@ function getDirectivesInExtensions2(node, pathToDirectivesInExtensions = ["direc
79015
79017
  }
79016
79018
 
79017
79019
  // ../../node_modules/.pnpm/@graphql-tools+utils@10.0.6_graphql@15.5.0/node_modules/@graphql-tools/utils/esm/print-schema-with-directives.js
79018
- var import_graphql38 = require("graphql");
79020
+ var import_graphql39 = require("graphql");
79019
79021
 
79020
79022
  // ../../node_modules/.pnpm/@graphql-tools+utils@10.0.6_graphql@15.5.0/node_modules/@graphql-tools/utils/esm/astFromType.js
79021
- var import_graphql35 = require("graphql");
79023
+ var import_graphql36 = require("graphql");
79022
79024
  function astFromType2(type) {
79023
- if ((0, import_graphql35.isNonNullType)(type)) {
79025
+ if ((0, import_graphql36.isNonNullType)(type)) {
79024
79026
  const innerType = astFromType2(type.ofType);
79025
- if (innerType.kind === import_graphql35.Kind.NON_NULL_TYPE) {
79027
+ if (innerType.kind === import_graphql36.Kind.NON_NULL_TYPE) {
79026
79028
  throw new Error(`Invalid type node ${inspect2(type)}. Inner type of non-null type cannot be a non-null type.`);
79027
79029
  }
79028
79030
  return {
79029
- kind: import_graphql35.Kind.NON_NULL_TYPE,
79031
+ kind: import_graphql36.Kind.NON_NULL_TYPE,
79030
79032
  type: innerType
79031
79033
  };
79032
- } else if ((0, import_graphql35.isListType)(type)) {
79034
+ } else if ((0, import_graphql36.isListType)(type)) {
79033
79035
  return {
79034
- kind: import_graphql35.Kind.LIST_TYPE,
79036
+ kind: import_graphql36.Kind.LIST_TYPE,
79035
79037
  type: astFromType2(type.ofType)
79036
79038
  };
79037
79039
  }
79038
79040
  return {
79039
- kind: import_graphql35.Kind.NAMED_TYPE,
79041
+ kind: import_graphql36.Kind.NAMED_TYPE,
79040
79042
  name: {
79041
- kind: import_graphql35.Kind.NAME,
79043
+ kind: import_graphql36.Kind.NAME,
79042
79044
  value: type.name
79043
79045
  }
79044
79046
  };
79045
79047
  }
79046
79048
 
79047
79049
  // ../../node_modules/.pnpm/@graphql-tools+utils@10.0.6_graphql@15.5.0/node_modules/@graphql-tools/utils/esm/astFromValue.js
79048
- var import_graphql37 = require("graphql");
79050
+ var import_graphql38 = require("graphql");
79049
79051
 
79050
79052
  // ../../node_modules/.pnpm/@graphql-tools+utils@10.0.6_graphql@15.5.0/node_modules/@graphql-tools/utils/esm/astFromValueUntyped.js
79051
- var import_graphql36 = require("graphql");
79053
+ var import_graphql37 = require("graphql");
79052
79054
  function astFromValueUntyped2(value) {
79053
79055
  if (value === null) {
79054
- return { kind: import_graphql36.Kind.NULL };
79056
+ return { kind: import_graphql37.Kind.NULL };
79055
79057
  }
79056
79058
  if (value === void 0) {
79057
79059
  return null;
@@ -79064,7 +79066,7 @@ function astFromValueUntyped2(value) {
79064
79066
  valuesNodes.push(itemNode);
79065
79067
  }
79066
79068
  }
79067
- return { kind: import_graphql36.Kind.LIST, values: valuesNodes };
79069
+ return { kind: import_graphql37.Kind.LIST, values: valuesNodes };
79068
79070
  }
79069
79071
  if (typeof value === "object") {
79070
79072
  const fieldNodes = [];
@@ -79073,26 +79075,26 @@ function astFromValueUntyped2(value) {
79073
79075
  const ast = astFromValueUntyped2(fieldValue);
79074
79076
  if (ast) {
79075
79077
  fieldNodes.push({
79076
- kind: import_graphql36.Kind.OBJECT_FIELD,
79077
- name: { kind: import_graphql36.Kind.NAME, value: fieldName },
79078
+ kind: import_graphql37.Kind.OBJECT_FIELD,
79079
+ name: { kind: import_graphql37.Kind.NAME, value: fieldName },
79078
79080
  value: ast
79079
79081
  });
79080
79082
  }
79081
79083
  }
79082
- return { kind: import_graphql36.Kind.OBJECT, fields: fieldNodes };
79084
+ return { kind: import_graphql37.Kind.OBJECT, fields: fieldNodes };
79083
79085
  }
79084
79086
  if (typeof value === "boolean") {
79085
- return { kind: import_graphql36.Kind.BOOLEAN, value };
79087
+ return { kind: import_graphql37.Kind.BOOLEAN, value };
79086
79088
  }
79087
79089
  if (typeof value === "bigint") {
79088
- return { kind: import_graphql36.Kind.INT, value: String(value) };
79090
+ return { kind: import_graphql37.Kind.INT, value: String(value) };
79089
79091
  }
79090
79092
  if (typeof value === "number" && isFinite(value)) {
79091
79093
  const stringNum = String(value);
79092
- return integerStringRegExp2.test(stringNum) ? { kind: import_graphql36.Kind.INT, value: stringNum } : { kind: import_graphql36.Kind.FLOAT, value: stringNum };
79094
+ return integerStringRegExp2.test(stringNum) ? { kind: import_graphql37.Kind.INT, value: stringNum } : { kind: import_graphql37.Kind.FLOAT, value: stringNum };
79093
79095
  }
79094
79096
  if (typeof value === "string") {
79095
- return { kind: import_graphql36.Kind.STRING, value };
79097
+ return { kind: import_graphql37.Kind.STRING, value };
79096
79098
  }
79097
79099
  throw new TypeError(`Cannot convert value to AST: ${value}.`);
79098
79100
  }
@@ -79100,20 +79102,20 @@ var integerStringRegExp2 = /^-?(?:0|[1-9][0-9]*)$/;
79100
79102
 
79101
79103
  // ../../node_modules/.pnpm/@graphql-tools+utils@10.0.6_graphql@15.5.0/node_modules/@graphql-tools/utils/esm/astFromValue.js
79102
79104
  function astFromValue2(value, type) {
79103
- if ((0, import_graphql37.isNonNullType)(type)) {
79105
+ if ((0, import_graphql38.isNonNullType)(type)) {
79104
79106
  const astValue = astFromValue2(value, type.ofType);
79105
- if (astValue?.kind === import_graphql37.Kind.NULL) {
79107
+ if (astValue?.kind === import_graphql38.Kind.NULL) {
79106
79108
  return null;
79107
79109
  }
79108
79110
  return astValue;
79109
79111
  }
79110
79112
  if (value === null) {
79111
- return { kind: import_graphql37.Kind.NULL };
79113
+ return { kind: import_graphql38.Kind.NULL };
79112
79114
  }
79113
79115
  if (value === void 0) {
79114
79116
  return null;
79115
79117
  }
79116
- if ((0, import_graphql37.isListType)(type)) {
79118
+ if ((0, import_graphql38.isListType)(type)) {
79117
79119
  const itemType = type.ofType;
79118
79120
  if (isIterableObject(value)) {
79119
79121
  const valuesNodes = [];
@@ -79123,11 +79125,11 @@ function astFromValue2(value, type) {
79123
79125
  valuesNodes.push(itemNode);
79124
79126
  }
79125
79127
  }
79126
- return { kind: import_graphql37.Kind.LIST, values: valuesNodes };
79128
+ return { kind: import_graphql38.Kind.LIST, values: valuesNodes };
79127
79129
  }
79128
79130
  return astFromValue2(value, itemType);
79129
79131
  }
79130
- if ((0, import_graphql37.isInputObjectType)(type)) {
79132
+ if ((0, import_graphql38.isInputObjectType)(type)) {
79131
79133
  if (!isObjectLike(value)) {
79132
79134
  return null;
79133
79135
  }
@@ -79136,24 +79138,24 @@ function astFromValue2(value, type) {
79136
79138
  const fieldValue = astFromValue2(value[field.name], field.type);
79137
79139
  if (fieldValue) {
79138
79140
  fieldNodes.push({
79139
- kind: import_graphql37.Kind.OBJECT_FIELD,
79140
- name: { kind: import_graphql37.Kind.NAME, value: field.name },
79141
+ kind: import_graphql38.Kind.OBJECT_FIELD,
79142
+ name: { kind: import_graphql38.Kind.NAME, value: field.name },
79141
79143
  value: fieldValue
79142
79144
  });
79143
79145
  }
79144
79146
  }
79145
- return { kind: import_graphql37.Kind.OBJECT, fields: fieldNodes };
79147
+ return { kind: import_graphql38.Kind.OBJECT, fields: fieldNodes };
79146
79148
  }
79147
- if ((0, import_graphql37.isLeafType)(type)) {
79149
+ if ((0, import_graphql38.isLeafType)(type)) {
79148
79150
  const serialized = type.serialize(value);
79149
79151
  if (serialized == null) {
79150
79152
  return null;
79151
79153
  }
79152
- if ((0, import_graphql37.isEnumType)(type)) {
79153
- return { kind: import_graphql37.Kind.ENUM, value: serialized };
79154
+ if ((0, import_graphql38.isEnumType)(type)) {
79155
+ return { kind: import_graphql38.Kind.ENUM, value: serialized };
79154
79156
  }
79155
79157
  if (type.name === "ID" && typeof serialized === "string" && integerStringRegExp3.test(serialized)) {
79156
- return { kind: import_graphql37.Kind.INT, value: serialized };
79158
+ return { kind: import_graphql38.Kind.INT, value: serialized };
79157
79159
  }
79158
79160
  return astFromValueUntyped2(serialized);
79159
79161
  }
@@ -79209,36 +79211,36 @@ function getDocumentNodeFromSchema2(schema, options = {}) {
79209
79211
  const definitions = schemaNode != null ? [schemaNode] : [];
79210
79212
  const directives = schema.getDirectives();
79211
79213
  for (const directive of directives) {
79212
- if ((0, import_graphql38.isSpecifiedDirective)(directive)) {
79214
+ if ((0, import_graphql39.isSpecifiedDirective)(directive)) {
79213
79215
  continue;
79214
79216
  }
79215
79217
  definitions.push(astFromDirective2(directive, schema, pathToDirectivesInExtensions));
79216
79218
  }
79217
79219
  for (const typeName in typesMap) {
79218
79220
  const type = typesMap[typeName];
79219
- const isPredefinedScalar = (0, import_graphql38.isSpecifiedScalarType)(type);
79220
- const isIntrospection = (0, import_graphql38.isIntrospectionType)(type);
79221
+ const isPredefinedScalar = (0, import_graphql39.isSpecifiedScalarType)(type);
79222
+ const isIntrospection = (0, import_graphql39.isIntrospectionType)(type);
79221
79223
  if (isPredefinedScalar || isIntrospection) {
79222
79224
  continue;
79223
79225
  }
79224
- if ((0, import_graphql38.isObjectType)(type)) {
79226
+ if ((0, import_graphql39.isObjectType)(type)) {
79225
79227
  definitions.push(astFromObjectType2(type, schema, pathToDirectivesInExtensions));
79226
- } else if ((0, import_graphql38.isInterfaceType)(type)) {
79228
+ } else if ((0, import_graphql39.isInterfaceType)(type)) {
79227
79229
  definitions.push(astFromInterfaceType2(type, schema, pathToDirectivesInExtensions));
79228
- } else if ((0, import_graphql38.isUnionType)(type)) {
79230
+ } else if ((0, import_graphql39.isUnionType)(type)) {
79229
79231
  definitions.push(astFromUnionType2(type, schema, pathToDirectivesInExtensions));
79230
- } else if ((0, import_graphql38.isInputObjectType)(type)) {
79232
+ } else if ((0, import_graphql39.isInputObjectType)(type)) {
79231
79233
  definitions.push(astFromInputObjectType2(type, schema, pathToDirectivesInExtensions));
79232
- } else if ((0, import_graphql38.isEnumType)(type)) {
79234
+ } else if ((0, import_graphql39.isEnumType)(type)) {
79233
79235
  definitions.push(astFromEnumType2(type, schema, pathToDirectivesInExtensions));
79234
- } else if ((0, import_graphql38.isScalarType)(type)) {
79236
+ } else if ((0, import_graphql39.isScalarType)(type)) {
79235
79237
  definitions.push(astFromScalarType2(type, schema, pathToDirectivesInExtensions));
79236
79238
  } else {
79237
79239
  throw new Error(`Unknown type ${type}.`);
79238
79240
  }
79239
79241
  }
79240
79242
  return {
79241
- kind: import_graphql38.Kind.DOCUMENT,
79243
+ kind: import_graphql39.Kind.DOCUMENT,
79242
79244
  definitions
79243
79245
  };
79244
79246
  }
@@ -79273,7 +79275,7 @@ function astFromSchema2(schema, pathToDirectivesInExtensions) {
79273
79275
  operationTypeDefinitionNode.type = rootTypeAST;
79274
79276
  } else {
79275
79277
  operationTypeMap.set(operationTypeNode, {
79276
- kind: import_graphql38.Kind.OPERATION_TYPE_DEFINITION,
79278
+ kind: import_graphql39.Kind.OPERATION_TYPE_DEFINITION,
79277
79279
  operation: operationTypeNode,
79278
79280
  type: rootTypeAST
79279
79281
  });
@@ -79286,12 +79288,12 @@ function astFromSchema2(schema, pathToDirectivesInExtensions) {
79286
79288
  return null;
79287
79289
  }
79288
79290
  const schemaNode = {
79289
- kind: operationTypes != null ? import_graphql38.Kind.SCHEMA_DEFINITION : import_graphql38.Kind.SCHEMA_EXTENSION,
79291
+ kind: operationTypes != null ? import_graphql39.Kind.SCHEMA_DEFINITION : import_graphql39.Kind.SCHEMA_EXTENSION,
79290
79292
  operationTypes,
79291
79293
  directives
79292
79294
  };
79293
79295
  schemaNode.description = schema.astNode?.description ?? schema.description != null ? {
79294
- kind: import_graphql38.Kind.STRING,
79296
+ kind: import_graphql39.Kind.STRING,
79295
79297
  value: schema.description,
79296
79298
  block: true
79297
79299
  } : void 0;
@@ -79299,19 +79301,19 @@ function astFromSchema2(schema, pathToDirectivesInExtensions) {
79299
79301
  }
79300
79302
  function astFromDirective2(directive, schema, pathToDirectivesInExtensions) {
79301
79303
  return {
79302
- kind: import_graphql38.Kind.DIRECTIVE_DEFINITION,
79304
+ kind: import_graphql39.Kind.DIRECTIVE_DEFINITION,
79303
79305
  description: directive.astNode?.description ?? (directive.description ? {
79304
- kind: import_graphql38.Kind.STRING,
79306
+ kind: import_graphql39.Kind.STRING,
79305
79307
  value: directive.description
79306
79308
  } : void 0),
79307
79309
  name: {
79308
- kind: import_graphql38.Kind.NAME,
79310
+ kind: import_graphql39.Kind.NAME,
79309
79311
  value: directive.name
79310
79312
  },
79311
79313
  arguments: directive.args?.map((arg) => astFromArg2(arg, schema, pathToDirectivesInExtensions)),
79312
79314
  repeatable: directive.isRepeatable,
79313
79315
  locations: directive.locations?.map((location) => ({
79314
- kind: import_graphql38.Kind.NAME,
79316
+ kind: import_graphql39.Kind.NAME,
79315
79317
  value: location
79316
79318
  })) || []
79317
79319
  };
@@ -79361,14 +79363,14 @@ function getDeprecatableDirectiveNodes2(entity, schema, pathToDirectivesInExtens
79361
79363
  }
79362
79364
  function astFromArg2(arg, schema, pathToDirectivesInExtensions) {
79363
79365
  return {
79364
- kind: import_graphql38.Kind.INPUT_VALUE_DEFINITION,
79366
+ kind: import_graphql39.Kind.INPUT_VALUE_DEFINITION,
79365
79367
  description: arg.astNode?.description ?? (arg.description ? {
79366
- kind: import_graphql38.Kind.STRING,
79368
+ kind: import_graphql39.Kind.STRING,
79367
79369
  value: arg.description,
79368
79370
  block: true
79369
79371
  } : void 0),
79370
79372
  name: {
79371
- kind: import_graphql38.Kind.NAME,
79373
+ kind: import_graphql39.Kind.NAME,
79372
79374
  value: arg.name
79373
79375
  },
79374
79376
  type: astFromType2(arg.type),
@@ -79378,14 +79380,14 @@ function astFromArg2(arg, schema, pathToDirectivesInExtensions) {
79378
79380
  }
79379
79381
  function astFromObjectType2(type, schema, pathToDirectivesInExtensions) {
79380
79382
  return {
79381
- kind: import_graphql38.Kind.OBJECT_TYPE_DEFINITION,
79383
+ kind: import_graphql39.Kind.OBJECT_TYPE_DEFINITION,
79382
79384
  description: type.astNode?.description ?? (type.description ? {
79383
- kind: import_graphql38.Kind.STRING,
79385
+ kind: import_graphql39.Kind.STRING,
79384
79386
  value: type.description,
79385
79387
  block: true
79386
79388
  } : void 0),
79387
79389
  name: {
79388
- kind: import_graphql38.Kind.NAME,
79390
+ kind: import_graphql39.Kind.NAME,
79389
79391
  value: type.name
79390
79392
  },
79391
79393
  fields: Object.values(type.getFields()).map((field) => astFromField2(field, schema, pathToDirectivesInExtensions)),
@@ -79395,14 +79397,14 @@ function astFromObjectType2(type, schema, pathToDirectivesInExtensions) {
79395
79397
  }
79396
79398
  function astFromInterfaceType2(type, schema, pathToDirectivesInExtensions) {
79397
79399
  const node = {
79398
- kind: import_graphql38.Kind.INTERFACE_TYPE_DEFINITION,
79400
+ kind: import_graphql39.Kind.INTERFACE_TYPE_DEFINITION,
79399
79401
  description: type.astNode?.description ?? (type.description ? {
79400
- kind: import_graphql38.Kind.STRING,
79402
+ kind: import_graphql39.Kind.STRING,
79401
79403
  value: type.description,
79402
79404
  block: true
79403
79405
  } : void 0),
79404
79406
  name: {
79405
- kind: import_graphql38.Kind.NAME,
79407
+ kind: import_graphql39.Kind.NAME,
79406
79408
  value: type.name
79407
79409
  },
79408
79410
  fields: Object.values(type.getFields()).map((field) => astFromField2(field, schema, pathToDirectivesInExtensions)),
@@ -79415,14 +79417,14 @@ function astFromInterfaceType2(type, schema, pathToDirectivesInExtensions) {
79415
79417
  }
79416
79418
  function astFromUnionType2(type, schema, pathToDirectivesInExtensions) {
79417
79419
  return {
79418
- kind: import_graphql38.Kind.UNION_TYPE_DEFINITION,
79420
+ kind: import_graphql39.Kind.UNION_TYPE_DEFINITION,
79419
79421
  description: type.astNode?.description ?? (type.description ? {
79420
- kind: import_graphql38.Kind.STRING,
79422
+ kind: import_graphql39.Kind.STRING,
79421
79423
  value: type.description,
79422
79424
  block: true
79423
79425
  } : void 0),
79424
79426
  name: {
79425
- kind: import_graphql38.Kind.NAME,
79427
+ kind: import_graphql39.Kind.NAME,
79426
79428
  value: type.name
79427
79429
  },
79428
79430
  directives: getDirectiveNodes2(type, schema, pathToDirectivesInExtensions),
@@ -79431,14 +79433,14 @@ function astFromUnionType2(type, schema, pathToDirectivesInExtensions) {
79431
79433
  }
79432
79434
  function astFromInputObjectType2(type, schema, pathToDirectivesInExtensions) {
79433
79435
  return {
79434
- kind: import_graphql38.Kind.INPUT_OBJECT_TYPE_DEFINITION,
79436
+ kind: import_graphql39.Kind.INPUT_OBJECT_TYPE_DEFINITION,
79435
79437
  description: type.astNode?.description ?? (type.description ? {
79436
- kind: import_graphql38.Kind.STRING,
79438
+ kind: import_graphql39.Kind.STRING,
79437
79439
  value: type.description,
79438
79440
  block: true
79439
79441
  } : void 0),
79440
79442
  name: {
79441
- kind: import_graphql38.Kind.NAME,
79443
+ kind: import_graphql39.Kind.NAME,
79442
79444
  value: type.name
79443
79445
  },
79444
79446
  fields: Object.values(type.getFields()).map((field) => astFromInputField2(field, schema, pathToDirectivesInExtensions)),
@@ -79447,14 +79449,14 @@ function astFromInputObjectType2(type, schema, pathToDirectivesInExtensions) {
79447
79449
  }
79448
79450
  function astFromEnumType2(type, schema, pathToDirectivesInExtensions) {
79449
79451
  return {
79450
- kind: import_graphql38.Kind.ENUM_TYPE_DEFINITION,
79452
+ kind: import_graphql39.Kind.ENUM_TYPE_DEFINITION,
79451
79453
  description: type.astNode?.description ?? (type.description ? {
79452
- kind: import_graphql38.Kind.STRING,
79454
+ kind: import_graphql39.Kind.STRING,
79453
79455
  value: type.description,
79454
79456
  block: true
79455
79457
  } : void 0),
79456
79458
  name: {
79457
- kind: import_graphql38.Kind.NAME,
79459
+ kind: import_graphql39.Kind.NAME,
79458
79460
  value: type.name
79459
79461
  },
79460
79462
  values: Object.values(type.getValues()).map((value) => astFromEnumValue2(value, schema, pathToDirectivesInExtensions)),
@@ -79472,14 +79474,14 @@ function astFromScalarType2(type, schema, pathToDirectivesInExtensions) {
79472
79474
  directives.push(makeDirectiveNode2("specifiedBy", specifiedByArgs));
79473
79475
  }
79474
79476
  return {
79475
- kind: import_graphql38.Kind.SCALAR_TYPE_DEFINITION,
79477
+ kind: import_graphql39.Kind.SCALAR_TYPE_DEFINITION,
79476
79478
  description: type.astNode?.description ?? (type.description ? {
79477
- kind: import_graphql38.Kind.STRING,
79479
+ kind: import_graphql39.Kind.STRING,
79478
79480
  value: type.description,
79479
79481
  block: true
79480
79482
  } : void 0),
79481
79483
  name: {
79482
- kind: import_graphql38.Kind.NAME,
79484
+ kind: import_graphql39.Kind.NAME,
79483
79485
  value: type.name
79484
79486
  },
79485
79487
  directives
@@ -79487,14 +79489,14 @@ function astFromScalarType2(type, schema, pathToDirectivesInExtensions) {
79487
79489
  }
79488
79490
  function astFromField2(field, schema, pathToDirectivesInExtensions) {
79489
79491
  return {
79490
- kind: import_graphql38.Kind.FIELD_DEFINITION,
79492
+ kind: import_graphql39.Kind.FIELD_DEFINITION,
79491
79493
  description: field.astNode?.description ?? (field.description ? {
79492
- kind: import_graphql38.Kind.STRING,
79494
+ kind: import_graphql39.Kind.STRING,
79493
79495
  value: field.description,
79494
79496
  block: true
79495
79497
  } : void 0),
79496
79498
  name: {
79497
- kind: import_graphql38.Kind.NAME,
79499
+ kind: import_graphql39.Kind.NAME,
79498
79500
  value: field.name
79499
79501
  },
79500
79502
  arguments: field.args.map((arg) => astFromArg2(arg, schema, pathToDirectivesInExtensions)),
@@ -79504,14 +79506,14 @@ function astFromField2(field, schema, pathToDirectivesInExtensions) {
79504
79506
  }
79505
79507
  function astFromInputField2(field, schema, pathToDirectivesInExtensions) {
79506
79508
  return {
79507
- kind: import_graphql38.Kind.INPUT_VALUE_DEFINITION,
79509
+ kind: import_graphql39.Kind.INPUT_VALUE_DEFINITION,
79508
79510
  description: field.astNode?.description ?? (field.description ? {
79509
- kind: import_graphql38.Kind.STRING,
79511
+ kind: import_graphql39.Kind.STRING,
79510
79512
  value: field.description,
79511
79513
  block: true
79512
79514
  } : void 0),
79513
79515
  name: {
79514
- kind: import_graphql38.Kind.NAME,
79516
+ kind: import_graphql39.Kind.NAME,
79515
79517
  value: field.name
79516
79518
  },
79517
79519
  type: astFromType2(field.type),
@@ -79521,21 +79523,21 @@ function astFromInputField2(field, schema, pathToDirectivesInExtensions) {
79521
79523
  }
79522
79524
  function astFromEnumValue2(value, schema, pathToDirectivesInExtensions) {
79523
79525
  return {
79524
- kind: import_graphql38.Kind.ENUM_VALUE_DEFINITION,
79526
+ kind: import_graphql39.Kind.ENUM_VALUE_DEFINITION,
79525
79527
  description: value.astNode?.description ?? (value.description ? {
79526
- kind: import_graphql38.Kind.STRING,
79528
+ kind: import_graphql39.Kind.STRING,
79527
79529
  value: value.description,
79528
79530
  block: true
79529
79531
  } : void 0),
79530
79532
  name: {
79531
- kind: import_graphql38.Kind.NAME,
79533
+ kind: import_graphql39.Kind.NAME,
79532
79534
  value: value.name
79533
79535
  },
79534
79536
  directives: getDeprecatableDirectiveNodes2(value, schema, pathToDirectivesInExtensions)
79535
79537
  };
79536
79538
  }
79537
79539
  function makeDeprecatedDirective2(deprecationReason) {
79538
- return makeDirectiveNode2("deprecated", { reason: deprecationReason }, import_graphql38.GraphQLDeprecatedDirective);
79540
+ return makeDirectiveNode2("deprecated", { reason: deprecationReason }, import_graphql39.GraphQLDeprecatedDirective);
79539
79541
  }
79540
79542
  function makeDirectiveNode2(name, args, directive) {
79541
79543
  const directiveArguments = [];
@@ -79547,9 +79549,9 @@ function makeDirectiveNode2(name, args, directive) {
79547
79549
  const value = astFromValue2(argValue, arg.type);
79548
79550
  if (value) {
79549
79551
  directiveArguments.push({
79550
- kind: import_graphql38.Kind.ARGUMENT,
79552
+ kind: import_graphql39.Kind.ARGUMENT,
79551
79553
  name: {
79552
- kind: import_graphql38.Kind.NAME,
79554
+ kind: import_graphql39.Kind.NAME,
79553
79555
  value: argName
79554
79556
  },
79555
79557
  value
@@ -79563,9 +79565,9 @@ function makeDirectiveNode2(name, args, directive) {
79563
79565
  const value = astFromValueUntyped2(argValue);
79564
79566
  if (value) {
79565
79567
  directiveArguments.push({
79566
- kind: import_graphql38.Kind.ARGUMENT,
79568
+ kind: import_graphql39.Kind.ARGUMENT,
79567
79569
  name: {
79568
- kind: import_graphql38.Kind.NAME,
79570
+ kind: import_graphql39.Kind.NAME,
79569
79571
  value: argName
79570
79572
  },
79571
79573
  value
@@ -79574,9 +79576,9 @@ function makeDirectiveNode2(name, args, directive) {
79574
79576
  }
79575
79577
  }
79576
79578
  return {
79577
- kind: import_graphql38.Kind.DIRECTIVE,
79579
+ kind: import_graphql39.Kind.DIRECTIVE,
79578
79580
  name: {
79579
- kind: import_graphql38.Kind.NAME,
79581
+ kind: import_graphql39.Kind.NAME,
79580
79582
  value: name
79581
79583
  },
79582
79584
  arguments: directiveArguments
@@ -79599,7 +79601,7 @@ function makeDirectiveNodes2(schema, directiveValues) {
79599
79601
  }
79600
79602
 
79601
79603
  // ../../node_modules/.pnpm/@graphql-tools+utils@10.0.6_graphql@15.5.0/node_modules/@graphql-tools/utils/esm/comments.js
79602
- var import_graphql39 = require("graphql");
79604
+ var import_graphql40 = require("graphql");
79603
79605
  var MAX_LINE_LENGTH2 = 80;
79604
79606
  var commentsRegistry2 = {};
79605
79607
  function resetComments2() {
@@ -79844,7 +79846,7 @@ var printDocASTReducerWithComments2 = Object.keys(printDocASTReducer2).reduce((p
79844
79846
  }
79845
79847
  }), {});
79846
79848
  function printWithComments2(ast) {
79847
- return (0, import_graphql39.visit)(ast, printDocASTReducerWithComments2);
79849
+ return (0, import_graphql40.visit)(ast, printDocASTReducerWithComments2);
79848
79850
  }
79849
79851
  function isFieldDefinitionNode2(node) {
79850
79852
  return node.kind === "FieldDefinition";
@@ -79863,7 +79865,7 @@ function getLeadingCommentBlock2(node) {
79863
79865
  }
79864
79866
  const comments = [];
79865
79867
  let token = loc.startToken.prev;
79866
- while (token != null && token.kind === import_graphql39.TokenKind.COMMENT && token.next != null && token.prev != null && token.line + 1 === token.next.line && token.line !== token.prev.line) {
79868
+ while (token != null && token.kind === import_graphql40.TokenKind.COMMENT && token.next != null && token.prev != null && token.line + 1 === token.next.line && token.line !== token.prev.line) {
79867
79869
  const value = String(token.value);
79868
79870
  comments.push(value);
79869
79871
  token = token.prev;
@@ -79915,9 +79917,9 @@ function isBlank2(str) {
79915
79917
  }
79916
79918
 
79917
79919
  // ../../node_modules/.pnpm/@graphql-tools+utils@10.0.6_graphql@15.5.0/node_modules/@graphql-tools/utils/esm/isDocumentNode.js
79918
- var import_graphql40 = require("graphql");
79920
+ var import_graphql41 = require("graphql");
79919
79921
  function isDocumentNode2(object) {
79920
- return object && typeof object === "object" && "kind" in object && object.kind === import_graphql40.Kind.DOCUMENT;
79922
+ return object && typeof object === "object" && "kind" in object && object.kind === import_graphql41.Kind.DOCUMENT;
79921
79923
  }
79922
79924
 
79923
79925
  // ../../node_modules/.pnpm/@graphql-tools+merge@9.0.0_graphql@15.5.0/node_modules/@graphql-tools/merge/esm/typedefs-mergers/arguments.js
@@ -79941,7 +79943,7 @@ function deduplicateArguments2(args, config2) {
79941
79943
  }
79942
79944
 
79943
79945
  // ../../node_modules/.pnpm/@graphql-tools+merge@9.0.0_graphql@15.5.0/node_modules/@graphql-tools/merge/esm/typedefs-mergers/directives.js
79944
- var import_graphql41 = require("graphql");
79946
+ var import_graphql42 = require("graphql");
79945
79947
  function directiveAlreadyExists2(directivesArr, otherDirective) {
79946
79948
  return !!directivesArr.find((directive) => directive.name.value === otherDirective.name.value);
79947
79949
  }
@@ -80001,11 +80003,11 @@ function mergeDirectives2(d1 = [], d2 = [], config2, directives) {
80001
80003
  return result;
80002
80004
  }
80003
80005
  function validateInputs2(node, existingNode) {
80004
- const printedNode = (0, import_graphql41.print)({
80006
+ const printedNode = (0, import_graphql42.print)({
80005
80007
  ...node,
80006
80008
  description: void 0
80007
80009
  });
80008
- const printedExistingNode = (0, import_graphql41.print)({
80010
+ const printedExistingNode = (0, import_graphql42.print)({
80009
80011
  ...existingNode,
80010
80012
  description: void 0
80011
80013
  });
@@ -80072,7 +80074,7 @@ function mergeEnumValues2(first, second, config2, directives) {
80072
80074
  }
80073
80075
 
80074
80076
  // ../../node_modules/.pnpm/@graphql-tools+merge@9.0.0_graphql@15.5.0/node_modules/@graphql-tools/merge/esm/typedefs-mergers/enum.js
80075
- var import_graphql42 = require("graphql");
80077
+ var import_graphql43 = require("graphql");
80076
80078
  function mergeEnum2(e1, e2, config2, directives) {
80077
80079
  if (e2) {
80078
80080
  return {
@@ -80086,33 +80088,33 @@ function mergeEnum2(e1, e2, config2, directives) {
80086
80088
  }
80087
80089
  return config2?.convertExtensions ? {
80088
80090
  ...e1,
80089
- kind: import_graphql42.Kind.ENUM_TYPE_DEFINITION
80091
+ kind: import_graphql43.Kind.ENUM_TYPE_DEFINITION
80090
80092
  } : e1;
80091
80093
  }
80092
80094
 
80093
80095
  // ../../node_modules/.pnpm/@graphql-tools+merge@9.0.0_graphql@15.5.0/node_modules/@graphql-tools/merge/esm/typedefs-mergers/utils.js
80094
- var import_graphql43 = require("graphql");
80096
+ var import_graphql44 = require("graphql");
80095
80097
  function isStringTypes2(types19) {
80096
80098
  return typeof types19 === "string";
80097
80099
  }
80098
80100
  function isSourceTypes2(types19) {
80099
- return types19 instanceof import_graphql43.Source;
80101
+ return types19 instanceof import_graphql44.Source;
80100
80102
  }
80101
80103
  function extractType2(type) {
80102
80104
  let visitedType = type;
80103
- while (visitedType.kind === import_graphql43.Kind.LIST_TYPE || visitedType.kind === "NonNullType") {
80105
+ while (visitedType.kind === import_graphql44.Kind.LIST_TYPE || visitedType.kind === "NonNullType") {
80104
80106
  visitedType = visitedType.type;
80105
80107
  }
80106
80108
  return visitedType;
80107
80109
  }
80108
80110
  function isWrappingTypeNode2(type) {
80109
- return type.kind !== import_graphql43.Kind.NAMED_TYPE;
80111
+ return type.kind !== import_graphql44.Kind.NAMED_TYPE;
80110
80112
  }
80111
80113
  function isListTypeNode2(type) {
80112
- return type.kind === import_graphql43.Kind.LIST_TYPE;
80114
+ return type.kind === import_graphql44.Kind.LIST_TYPE;
80113
80115
  }
80114
80116
  function isNonNullTypeNode2(type) {
80115
- return type.kind === import_graphql43.Kind.NON_NULL_TYPE;
80117
+ return type.kind === import_graphql44.Kind.NON_NULL_TYPE;
80116
80118
  }
80117
80119
  function printTypeNode2(type) {
80118
80120
  if (isListTypeNode2(type)) {
@@ -80215,7 +80217,7 @@ function safeChangeForFieldType2(oldType, newType, ignoreNullability = false) {
80215
80217
  }
80216
80218
 
80217
80219
  // ../../node_modules/.pnpm/@graphql-tools+merge@9.0.0_graphql@15.5.0/node_modules/@graphql-tools/merge/esm/typedefs-mergers/input-type.js
80218
- var import_graphql44 = require("graphql");
80220
+ var import_graphql45 = require("graphql");
80219
80221
  function mergeInputType2(node, existingNode, config2, directives) {
80220
80222
  if (existingNode) {
80221
80223
  try {
@@ -80233,12 +80235,12 @@ function mergeInputType2(node, existingNode, config2, directives) {
80233
80235
  }
80234
80236
  return config2?.convertExtensions ? {
80235
80237
  ...node,
80236
- kind: import_graphql44.Kind.INPUT_OBJECT_TYPE_DEFINITION
80238
+ kind: import_graphql45.Kind.INPUT_OBJECT_TYPE_DEFINITION
80237
80239
  } : node;
80238
80240
  }
80239
80241
 
80240
80242
  // ../../node_modules/.pnpm/@graphql-tools+merge@9.0.0_graphql@15.5.0/node_modules/@graphql-tools/merge/esm/typedefs-mergers/interface.js
80241
- var import_graphql45 = require("graphql");
80243
+ var import_graphql46 = require("graphql");
80242
80244
 
80243
80245
  // ../../node_modules/.pnpm/@graphql-tools+merge@9.0.0_graphql@15.5.0/node_modules/@graphql-tools/merge/esm/typedefs-mergers/merge-named-type-array.js
80244
80246
  function alreadyExists2(arr, other) {
@@ -80271,15 +80273,15 @@ function mergeInterface2(node, existingNode, config2, directives) {
80271
80273
  }
80272
80274
  return config2?.convertExtensions ? {
80273
80275
  ...node,
80274
- kind: import_graphql45.Kind.INTERFACE_TYPE_DEFINITION
80276
+ kind: import_graphql46.Kind.INTERFACE_TYPE_DEFINITION
80275
80277
  } : node;
80276
80278
  }
80277
80279
 
80278
80280
  // ../../node_modules/.pnpm/@graphql-tools+merge@9.0.0_graphql@15.5.0/node_modules/@graphql-tools/merge/esm/typedefs-mergers/merge-nodes.js
80279
- var import_graphql50 = require("graphql");
80281
+ var import_graphql51 = require("graphql");
80280
80282
 
80281
80283
  // ../../node_modules/.pnpm/@graphql-tools+merge@9.0.0_graphql@15.5.0/node_modules/@graphql-tools/merge/esm/typedefs-mergers/type.js
80282
- var import_graphql46 = require("graphql");
80284
+ var import_graphql47 = require("graphql");
80283
80285
  function mergeType2(node, existingNode, config2, directives) {
80284
80286
  if (existingNode) {
80285
80287
  try {
@@ -80298,12 +80300,12 @@ function mergeType2(node, existingNode, config2, directives) {
80298
80300
  }
80299
80301
  return config2?.convertExtensions ? {
80300
80302
  ...node,
80301
- kind: import_graphql46.Kind.OBJECT_TYPE_DEFINITION
80303
+ kind: import_graphql47.Kind.OBJECT_TYPE_DEFINITION
80302
80304
  } : node;
80303
80305
  }
80304
80306
 
80305
80307
  // ../../node_modules/.pnpm/@graphql-tools+merge@9.0.0_graphql@15.5.0/node_modules/@graphql-tools/merge/esm/typedefs-mergers/scalar.js
80306
- var import_graphql47 = require("graphql");
80308
+ var import_graphql48 = require("graphql");
80307
80309
  function mergeScalar2(node, existingNode, config2, directives) {
80308
80310
  if (existingNode) {
80309
80311
  return {
@@ -80316,31 +80318,31 @@ function mergeScalar2(node, existingNode, config2, directives) {
80316
80318
  }
80317
80319
  return config2?.convertExtensions ? {
80318
80320
  ...node,
80319
- kind: import_graphql47.Kind.SCALAR_TYPE_DEFINITION
80321
+ kind: import_graphql48.Kind.SCALAR_TYPE_DEFINITION
80320
80322
  } : node;
80321
80323
  }
80322
80324
 
80323
80325
  // ../../node_modules/.pnpm/@graphql-tools+merge@9.0.0_graphql@15.5.0/node_modules/@graphql-tools/merge/esm/typedefs-mergers/union.js
80324
- var import_graphql48 = require("graphql");
80326
+ var import_graphql49 = require("graphql");
80325
80327
  function mergeUnion2(first, second, config2, directives) {
80326
80328
  if (second) {
80327
80329
  return {
80328
80330
  name: first.name,
80329
80331
  description: first["description"] || second["description"],
80330
80332
  directives: mergeDirectives2(first.directives, second.directives, config2, directives),
80331
- kind: config2?.convertExtensions || first.kind === "UnionTypeDefinition" || second.kind === "UnionTypeDefinition" ? import_graphql48.Kind.UNION_TYPE_DEFINITION : import_graphql48.Kind.UNION_TYPE_EXTENSION,
80333
+ kind: config2?.convertExtensions || first.kind === "UnionTypeDefinition" || second.kind === "UnionTypeDefinition" ? import_graphql49.Kind.UNION_TYPE_DEFINITION : import_graphql49.Kind.UNION_TYPE_EXTENSION,
80332
80334
  loc: first.loc,
80333
80335
  types: mergeNamedTypeArray2(first.types, second.types, config2)
80334
80336
  };
80335
80337
  }
80336
80338
  return config2?.convertExtensions ? {
80337
80339
  ...first,
80338
- kind: import_graphql48.Kind.UNION_TYPE_DEFINITION
80340
+ kind: import_graphql49.Kind.UNION_TYPE_DEFINITION
80339
80341
  } : first;
80340
80342
  }
80341
80343
 
80342
80344
  // ../../node_modules/.pnpm/@graphql-tools+merge@9.0.0_graphql@15.5.0/node_modules/@graphql-tools/merge/esm/typedefs-mergers/schema-def.js
80343
- var import_graphql49 = require("graphql");
80345
+ var import_graphql50 = require("graphql");
80344
80346
  var DEFAULT_OPERATION_TYPE_NAME_MAP2 = {
80345
80347
  query: "Query",
80346
80348
  mutation: "Mutation",
@@ -80359,7 +80361,7 @@ function mergeOperationTypes2(opNodeList = [], existingOpNodeList = []) {
80359
80361
  function mergeSchemaDefs2(node, existingNode, config2, directives) {
80360
80362
  if (existingNode) {
80361
80363
  return {
80362
- kind: node.kind === import_graphql49.Kind.SCHEMA_DEFINITION || existingNode.kind === import_graphql49.Kind.SCHEMA_DEFINITION ? import_graphql49.Kind.SCHEMA_DEFINITION : import_graphql49.Kind.SCHEMA_EXTENSION,
80364
+ kind: node.kind === import_graphql50.Kind.SCHEMA_DEFINITION || existingNode.kind === import_graphql50.Kind.SCHEMA_DEFINITION ? import_graphql50.Kind.SCHEMA_DEFINITION : import_graphql50.Kind.SCHEMA_EXTENSION,
80363
80365
  description: node["description"] || existingNode["description"],
80364
80366
  directives: mergeDirectives2(node.directives, existingNode.directives, config2, directives),
80365
80367
  operationTypes: mergeOperationTypes2(node.operationTypes, existingNode.operationTypes)
@@ -80367,7 +80369,7 @@ function mergeSchemaDefs2(node, existingNode, config2, directives) {
80367
80369
  }
80368
80370
  return config2?.convertExtensions ? {
80369
80371
  ...node,
80370
- kind: import_graphql49.Kind.SCHEMA_DEFINITION
80372
+ kind: import_graphql50.Kind.SCHEMA_DEFINITION
80371
80373
  } : node;
80372
80374
  }
80373
80375
 
@@ -80391,36 +80393,36 @@ function mergeGraphQLNodes2(nodes, config2, directives = {}) {
80391
80393
  delete mergedResultMap[name];
80392
80394
  } else {
80393
80395
  switch (nodeDefinition.kind) {
80394
- case import_graphql50.Kind.OBJECT_TYPE_DEFINITION:
80395
- case import_graphql50.Kind.OBJECT_TYPE_EXTENSION:
80396
+ case import_graphql51.Kind.OBJECT_TYPE_DEFINITION:
80397
+ case import_graphql51.Kind.OBJECT_TYPE_EXTENSION:
80396
80398
  mergedResultMap[name] = mergeType2(nodeDefinition, mergedResultMap[name], config2, directives);
80397
80399
  break;
80398
- case import_graphql50.Kind.ENUM_TYPE_DEFINITION:
80399
- case import_graphql50.Kind.ENUM_TYPE_EXTENSION:
80400
+ case import_graphql51.Kind.ENUM_TYPE_DEFINITION:
80401
+ case import_graphql51.Kind.ENUM_TYPE_EXTENSION:
80400
80402
  mergedResultMap[name] = mergeEnum2(nodeDefinition, mergedResultMap[name], config2, directives);
80401
80403
  break;
80402
- case import_graphql50.Kind.UNION_TYPE_DEFINITION:
80403
- case import_graphql50.Kind.UNION_TYPE_EXTENSION:
80404
+ case import_graphql51.Kind.UNION_TYPE_DEFINITION:
80405
+ case import_graphql51.Kind.UNION_TYPE_EXTENSION:
80404
80406
  mergedResultMap[name] = mergeUnion2(nodeDefinition, mergedResultMap[name], config2, directives);
80405
80407
  break;
80406
- case import_graphql50.Kind.SCALAR_TYPE_DEFINITION:
80407
- case import_graphql50.Kind.SCALAR_TYPE_EXTENSION:
80408
+ case import_graphql51.Kind.SCALAR_TYPE_DEFINITION:
80409
+ case import_graphql51.Kind.SCALAR_TYPE_EXTENSION:
80408
80410
  mergedResultMap[name] = mergeScalar2(nodeDefinition, mergedResultMap[name], config2, directives);
80409
80411
  break;
80410
- case import_graphql50.Kind.INPUT_OBJECT_TYPE_DEFINITION:
80411
- case import_graphql50.Kind.INPUT_OBJECT_TYPE_EXTENSION:
80412
+ case import_graphql51.Kind.INPUT_OBJECT_TYPE_DEFINITION:
80413
+ case import_graphql51.Kind.INPUT_OBJECT_TYPE_EXTENSION:
80412
80414
  mergedResultMap[name] = mergeInputType2(nodeDefinition, mergedResultMap[name], config2, directives);
80413
80415
  break;
80414
- case import_graphql50.Kind.INTERFACE_TYPE_DEFINITION:
80415
- case import_graphql50.Kind.INTERFACE_TYPE_EXTENSION:
80416
+ case import_graphql51.Kind.INTERFACE_TYPE_DEFINITION:
80417
+ case import_graphql51.Kind.INTERFACE_TYPE_EXTENSION:
80416
80418
  mergedResultMap[name] = mergeInterface2(nodeDefinition, mergedResultMap[name], config2, directives);
80417
80419
  break;
80418
- case import_graphql50.Kind.DIRECTIVE_DEFINITION:
80420
+ case import_graphql51.Kind.DIRECTIVE_DEFINITION:
80419
80421
  mergedResultMap[name] = mergeDirective2(nodeDefinition, mergedResultMap[name]);
80420
80422
  break;
80421
80423
  }
80422
80424
  }
80423
- } else if (nodeDefinition.kind === import_graphql50.Kind.SCHEMA_DEFINITION || nodeDefinition.kind === import_graphql50.Kind.SCHEMA_EXTENSION) {
80425
+ } else if (nodeDefinition.kind === import_graphql51.Kind.SCHEMA_DEFINITION || nodeDefinition.kind === import_graphql51.Kind.SCHEMA_EXTENSION) {
80424
80426
  mergedResultMap[schemaDefSymbol2] = mergeSchemaDefs2(nodeDefinition, mergedResultMap[schemaDefSymbol2], config2);
80425
80427
  }
80426
80428
  }
@@ -80428,11 +80430,11 @@ function mergeGraphQLNodes2(nodes, config2, directives = {}) {
80428
80430
  }
80429
80431
 
80430
80432
  // ../../node_modules/.pnpm/@graphql-tools+merge@9.0.0_graphql@15.5.0/node_modules/@graphql-tools/merge/esm/typedefs-mergers/merge-typedefs.js
80431
- var import_graphql51 = require("graphql");
80433
+ var import_graphql52 = require("graphql");
80432
80434
  function mergeTypeDefs2(typeSource, config2) {
80433
80435
  resetComments2();
80434
80436
  const doc = {
80435
- kind: import_graphql51.Kind.DOCUMENT,
80437
+ kind: import_graphql52.Kind.DOCUMENT,
80436
80438
  definitions: mergeGraphQLTypes2(typeSource, {
80437
80439
  useSchemaDefinition: true,
80438
80440
  forceSchemaDefinition: false,
@@ -80459,14 +80461,14 @@ function visitTypeSources2(typeSource, options, allDirectives = [], allNodes = [
80459
80461
  for (const type of typeSource) {
80460
80462
  visitTypeSources2(type, options, allDirectives, allNodes, visitedTypeSources);
80461
80463
  }
80462
- } else if ((0, import_graphql51.isSchema)(typeSource)) {
80464
+ } else if ((0, import_graphql52.isSchema)(typeSource)) {
80463
80465
  const documentNode = getDocumentNodeFromSchema2(typeSource, options);
80464
80466
  visitTypeSources2(documentNode.definitions, options, allDirectives, allNodes, visitedTypeSources);
80465
80467
  } else if (isStringTypes2(typeSource) || isSourceTypes2(typeSource)) {
80466
- const documentNode = (0, import_graphql51.parse)(typeSource, options);
80468
+ const documentNode = (0, import_graphql52.parse)(typeSource, options);
80467
80469
  visitTypeSources2(documentNode.definitions, options, allDirectives, allNodes, visitedTypeSources);
80468
- } else if (typeof typeSource === "object" && (0, import_graphql51.isDefinitionNode)(typeSource)) {
80469
- if (typeSource.kind === import_graphql51.Kind.DIRECTIVE_DEFINITION) {
80470
+ } else if (typeof typeSource === "object" && (0, import_graphql52.isDefinitionNode)(typeSource)) {
80471
+ if (typeSource.kind === import_graphql52.Kind.DIRECTIVE_DEFINITION) {
80470
80472
  allDirectives.push(typeSource);
80471
80473
  } else {
80472
80474
  allNodes.push(typeSource);
@@ -80486,7 +80488,7 @@ function mergeGraphQLTypes2(typeSource, config2) {
80486
80488
  const mergedNodes = mergeGraphQLNodes2(allNodes, config2, mergedDirectives);
80487
80489
  if (config2?.useSchemaDefinition) {
80488
80490
  const schemaDef = mergedNodes[schemaDefSymbol2] || {
80489
- kind: import_graphql51.Kind.SCHEMA_DEFINITION,
80491
+ kind: import_graphql52.Kind.SCHEMA_DEFINITION,
80490
80492
  operationTypes: []
80491
80493
  };
80492
80494
  const operationTypes = schemaDef.operationTypes;
@@ -80497,9 +80499,9 @@ function mergeGraphQLTypes2(typeSource, config2) {
80497
80499
  const existingPossibleRootType = mergedNodes[possibleRootTypeName];
80498
80500
  if (existingPossibleRootType != null && existingPossibleRootType.name != null) {
80499
80501
  operationTypes.push({
80500
- kind: import_graphql51.Kind.OPERATION_TYPE_DEFINITION,
80502
+ kind: import_graphql52.Kind.OPERATION_TYPE_DEFINITION,
80501
80503
  type: {
80502
- kind: import_graphql51.Kind.NAMED_TYPE,
80504
+ kind: import_graphql52.Kind.NAMED_TYPE,
80503
80505
  name: existingPossibleRootType.name
80504
80506
  },
80505
80507
  operation: opTypeDefNodeType
@@ -80513,15 +80515,15 @@ function mergeGraphQLTypes2(typeSource, config2) {
80513
80515
  }
80514
80516
  if (config2?.forceSchemaDefinition && !mergedNodes[schemaDefSymbol2]?.operationTypes?.length) {
80515
80517
  mergedNodes[schemaDefSymbol2] = {
80516
- kind: import_graphql51.Kind.SCHEMA_DEFINITION,
80518
+ kind: import_graphql52.Kind.SCHEMA_DEFINITION,
80517
80519
  operationTypes: [
80518
80520
  {
80519
- kind: import_graphql51.Kind.OPERATION_TYPE_DEFINITION,
80521
+ kind: import_graphql52.Kind.OPERATION_TYPE_DEFINITION,
80520
80522
  operation: "query",
80521
80523
  type: {
80522
- kind: import_graphql51.Kind.NAMED_TYPE,
80524
+ kind: import_graphql52.Kind.NAMED_TYPE,
80523
80525
  name: {
80524
- kind: import_graphql51.Kind.NAME,
80526
+ kind: import_graphql52.Kind.NAME,
80525
80527
  value: "Query"
80526
80528
  }
80527
80529
  }