houdini 1.2.12 → 1.2.14

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.
Files changed (51) hide show
  1. package/build/adapter/index.d.ts +3 -0
  2. package/build/adapter-cjs/index.js +33 -0
  3. package/build/adapter-esm/index.js +9 -0
  4. package/build/cmd/init.d.ts +1 -0
  5. package/build/cmd-cjs/index.js +53 -48
  6. package/build/cmd-esm/index.js +51 -46
  7. package/build/codegen-cjs/index.js +23 -25
  8. package/build/codegen-esm/index.js +23 -24
  9. package/build/lib/index.d.ts +3 -1
  10. package/build/{router → lib/router}/conventions.d.ts +3 -5
  11. package/build/{router → lib/router}/index.d.ts +1 -1
  12. package/build/{router → lib/router}/manifest.d.ts +2 -2
  13. package/build/{router → lib/router}/server.d.ts +2 -2
  14. package/build/{router → lib/router}/types.d.ts +2 -1
  15. package/build/lib/types.d.ts +1 -1
  16. package/build/lib-cjs/index.js +148 -32
  17. package/build/lib-esm/index.js +142 -29
  18. package/build/runtime/lib/types.d.ts +1 -1
  19. package/build/runtime/router/match.d.ts +38 -0
  20. package/build/runtime/router/server.d.ts +22 -25
  21. package/build/runtime/router/session.d.ts +22 -0
  22. package/build/runtime/router/types.d.ts +23 -0
  23. package/build/runtime-cjs/lib/types.d.ts +1 -1
  24. package/build/runtime-cjs/lib/types.js +2 -0
  25. package/build/runtime-cjs/router/match.d.ts +38 -0
  26. package/build/runtime-cjs/router/match.js +149 -0
  27. package/build/runtime-cjs/router/server.d.ts +22 -25
  28. package/build/runtime-cjs/router/server.js +71 -49
  29. package/build/runtime-cjs/router/session.d.ts +22 -0
  30. package/build/runtime-cjs/router/session.js +77 -0
  31. package/build/runtime-cjs/router/types.d.ts +23 -0
  32. package/build/runtime-cjs/router/types.js +16 -0
  33. package/build/runtime-esm/lib/types.d.ts +1 -1
  34. package/build/runtime-esm/lib/types.js +1 -0
  35. package/build/runtime-esm/router/match.d.ts +38 -0
  36. package/build/runtime-esm/router/match.js +122 -0
  37. package/build/runtime-esm/router/server.d.ts +22 -25
  38. package/build/runtime-esm/router/server.js +64 -47
  39. package/build/runtime-esm/router/session.d.ts +22 -0
  40. package/build/runtime-esm/router/session.js +52 -0
  41. package/build/runtime-esm/router/types.d.ts +23 -0
  42. package/build/runtime-esm/router/types.js +0 -0
  43. package/build/test-cjs/index.js +27 -25
  44. package/build/test-esm/index.js +27 -24
  45. package/build/vite-cjs/index.js +40 -46
  46. package/build/vite-esm/index.js +39 -44
  47. package/package.json +10 -9
  48. package/build/router-cjs/index.js +0 -57736
  49. package/build/router-esm/index.js +0 -57726
  50. /package/build/{router-cjs → adapter-cjs}/package.json +0 -0
  51. /package/build/{router-esm → adapter-esm}/package.json +0 -0
@@ -0,0 +1,3 @@
1
+ import type { serverAdapterFactory as createAdapter } from '../runtime/router/server';
2
+ export declare const endpoint: string;
3
+ export declare let createServerAdapter: (args: Omit<Parameters<typeof createAdapter>[0], 'on_render' | 'manifest' | 'yoga' | 'schema' | 'graphqlEndpoint'>) => ReturnType<typeof createAdapter>;
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/adapter/index.tsx
21
+ var adapter_exports = {};
22
+ __export(adapter_exports, {
23
+ createServerAdapter: () => createServerAdapter,
24
+ endpoint: () => endpoint
25
+ });
26
+ module.exports = __toCommonJS(adapter_exports);
27
+ var endpoint = "";
28
+ var createServerAdapter;
29
+ // Annotate the CommonJS export names for ESM import in node:
30
+ 0 && (module.exports = {
31
+ createServerAdapter,
32
+ endpoint
33
+ });
@@ -0,0 +1,9 @@
1
+ import { createRequire as conflict_free } from 'module'; const require = conflict_free(import.meta.url);
2
+
3
+ // src/adapter/index.tsx
4
+ var endpoint = "";
5
+ var createServerAdapter;
6
+ export {
7
+ createServerAdapter,
8
+ endpoint
9
+ };
@@ -1,4 +1,5 @@
1
1
  export declare function init(_path: string | undefined, args: {
2
2
  headers?: string[];
3
+ yes?: boolean;
3
4
  }): Promise<void>;
4
5
  export declare function finale_logs(package_manager: 'npm' | 'yarn' | 'pnpm'): void;
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { createRequire as conflict_free } from 'module'; const require = conflict_free(import.meta.url);
2
+
3
3
  "use strict";
4
4
  var __create = Object.create;
5
5
  var __defProp = Object.defineProperty;
@@ -67733,7 +67733,7 @@ var LogLevel = {
67733
67733
 
67734
67734
  // src/lib/config.ts
67735
67735
  var import_meta = {};
67736
- var currentDir = global.__dirname || dirname((0, import_node_url2.fileURLToPath)(import_meta.url));
67736
+ var currentDir = dirname((0, import_node_url2.fileURLToPath)(import_meta.url));
67737
67737
  var Config = class {
67738
67738
  filepath;
67739
67739
  rootDir;
@@ -69062,16 +69062,16 @@ async function find_graphql(config2, parsedScript, walker) {
69062
69062
  });
69063
69063
  }
69064
69064
 
69065
- // src/router/manifest.ts
69065
+ // src/lib/router/manifest.ts
69066
69066
  var t2 = __toESM(require_lib6(), 1);
69067
69067
  var graphql5 = __toESM(require("graphql"), 1);
69068
69068
 
69069
- // src/router/server.ts
69069
+ // src/lib/router/server.ts
69070
69070
  var import_node_path2 = __toESM(require("node:path"), 1);
69071
- var import_vite = require("vite");
69072
69071
  async function loadLocalSchema(config2) {
69072
+ const { build } = await import("vite");
69073
69073
  process.env.HOUDINI_SCHEMA_BUILD = "true";
69074
- await (0, import_vite.build)({
69074
+ await build({
69075
69075
  logLevel: "silent",
69076
69076
  build: {
69077
69077
  outDir: import_node_path2.default.join(config2.rootDir, "temp"),
@@ -70103,9 +70103,11 @@ function serializeValue(value) {
70103
70103
  }
70104
70104
  if (typeof value === "object" && value !== null) {
70105
70105
  return AST4.objectExpression(
70106
- Object.entries(value).filter(([, value2]) => typeof value2 !== "undefined").map(
70107
- ([key, value2]) => AST4.objectProperty(AST4.stringLiteral(key), serializeValue(value2))
70108
- )
70106
+ Object.entries(value).filter(
70107
+ ([key, value2]) => typeof value2 !== "undefined" && key !== "prev" && key !== "next"
70108
+ ).map(([key, val]) => {
70109
+ return AST4.objectProperty(AST4.stringLiteral(key), serializeValue(val));
70110
+ })
70109
70111
  );
70110
70112
  }
70111
70113
  if (typeof value === "string") {
@@ -70652,7 +70654,7 @@ async function paginate(config2, documents) {
70652
70654
  value: "__typename"
70653
70655
  }
70654
70656
  },
70655
- ...(typeConfig?.keys || ["id"]).map((key) => ({
70657
+ ...(typeConfig?.keys || [config2.defaultKeys[0]]).map((key) => ({
70656
70658
  kind: graphql11.Kind.FIELD,
70657
70659
  name: {
70658
70660
  kind: graphql11.Kind.NAME,
@@ -74336,7 +74338,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
74336
74338
  if (missing.length > 0) {
74337
74339
  ctx.reportError(
74338
74340
  new graphql26.GraphQLError(
74339
- "The following arguments are missing from this fragment: " + JSON.stringify(missing)
74341
+ `The following arguments are missing from the "${fragmentName}" fragment: ` + JSON.stringify(missing)
74340
74342
  )
74341
74343
  );
74342
74344
  return;
@@ -74572,7 +74574,7 @@ function nodeDirectives(config2, directives) {
74572
74574
  }
74573
74575
  if (!possibleNodes.includes(definitionType)) {
74574
74576
  ctx.reportError(
74575
- new graphql26.GraphQLError(paginateOnNonNodeMessage(config2, node.name.value))
74577
+ new graphql26.GraphQLError(paginateOnNonNodeMessage(node.name.value))
74576
74578
  );
74577
74579
  }
74578
74580
  }
@@ -74707,45 +74709,45 @@ function getAndVerifyNodeInterface(config2) {
74707
74709
  return null;
74708
74710
  }
74709
74711
  if (!graphql26.isInterfaceType(nodeInterface)) {
74710
- displayInvalidNodeFieldMessage(config2.logLevel);
74712
+ displayInvalidNodeFieldMessage(config2);
74711
74713
  return null;
74712
74714
  }
74713
74715
  const queryType = schema.getQueryType();
74714
74716
  if (!queryType) {
74715
- displayInvalidNodeFieldMessage(config2.logLevel);
74717
+ displayInvalidNodeFieldMessage(config2);
74716
74718
  return null;
74717
74719
  }
74718
74720
  const nodeField = queryType.getFields()["node"];
74719
74721
  if (!nodeField) {
74720
- displayInvalidNodeFieldMessage(config2.logLevel);
74722
+ displayInvalidNodeFieldMessage(config2);
74721
74723
  return null;
74722
74724
  }
74723
74725
  const args = nodeField.args;
74724
74726
  if (args.length === 0) {
74725
- displayInvalidNodeFieldMessage(config2.logLevel);
74727
+ displayInvalidNodeFieldMessage(config2);
74726
74728
  return null;
74727
74729
  }
74728
- const idArg = args.find((arg) => arg.name === "id");
74730
+ const idArg = args.find((arg) => arg.name === config2.defaultKeys[0]);
74729
74731
  if (!idArg) {
74730
- displayInvalidNodeFieldMessage(config2.logLevel);
74732
+ displayInvalidNodeFieldMessage(config2);
74731
74733
  return null;
74732
74734
  }
74733
74735
  const idType = unwrapType(config2, idArg.type);
74734
74736
  if (idType.type.name !== "ID") {
74735
- displayInvalidNodeFieldMessage(config2.logLevel);
74737
+ displayInvalidNodeFieldMessage(config2);
74736
74738
  return null;
74737
74739
  }
74738
74740
  const fieldReturnType = unwrapType(config2, nodeField.type);
74739
74741
  if (fieldReturnType.type.name !== "Node") {
74740
- displayInvalidNodeFieldMessage(config2.logLevel);
74742
+ displayInvalidNodeFieldMessage(config2);
74741
74743
  return null;
74742
74744
  }
74743
74745
  return nodeInterface;
74744
74746
  }
74745
74747
  var nbInvalidNodeFieldMessageDisplayed = 0;
74746
- function displayInvalidNodeFieldMessage(logLevel) {
74748
+ function displayInvalidNodeFieldMessage(config2) {
74747
74749
  if (nbInvalidNodeFieldMessageDisplayed === 0) {
74748
- if (logLevel === LogLevel.Full) {
74750
+ if (config2.logLevel === LogLevel.Full) {
74749
74751
  console.warn(invalidNodeFieldMessage);
74750
74752
  } else {
74751
74753
  console.warn(invalidNodeFieldMessageLight);
@@ -74759,18 +74761,18 @@ var invalidNodeFieldMessage = `\u26A0\uFE0F Your project defines a Node interfa
74759
74761
  If you are trying to provide the Node interface and its field, they must look like the following:
74760
74762
 
74761
74763
  interface Node {
74762
- id: ID!
74764
+ id: ID!
74763
74765
  }
74764
74766
 
74765
74767
  extend type Query {
74766
- node(id: ID!): Node
74768
+ node(id: ID!): Node
74767
74769
  }
74768
74770
 
74769
74771
  For more information, please visit these links:
74770
74772
  - https://graphql.org/learn/global-object-identification/
74771
74773
  - ${siteURL}/guides/caching-data#custom-ids
74772
74774
  `;
74773
- var paginateOnNonNodeMessage = (config2, directiveName) => `It looks like you are trying to use @${directiveName} on a document that does not have a valid type resolver.
74775
+ var paginateOnNonNodeMessage = (directiveName) => `It looks like you are trying to use @${directiveName} on a document that does not have a valid type resolver.
74774
74776
  If this is happening inside of a fragment, make sure that the fragment either implements the Node interface or you
74775
74777
  have defined a resolver entry for the fragment type.
74776
74778
 
@@ -75796,20 +75798,23 @@ async function init2(_path, args) {
75796
75798
  }
75797
75799
  }
75798
75800
  let url = "http://localhost:5173/api/graphql";
75799
- const { is_remote_endpoint } = await $e(
75800
- {
75801
- is_remote_endpoint: () => Q2({
75802
- message: "Will you use a remote GraphQL API?",
75803
- initialValue: true
75804
- })
75805
- },
75806
- {
75807
- onCancel: () => pCancel()
75808
- }
75809
- );
75801
+ let is_remote_endpoint = true;
75802
+ if (!args.yes) {
75803
+ is_remote_endpoint = (await $e(
75804
+ {
75805
+ is_remote_endpoint: () => Q2({
75806
+ message: "Will you use a remote GraphQL API?",
75807
+ initialValue: true
75808
+ })
75809
+ },
75810
+ {
75811
+ onCancel: () => pCancel()
75812
+ }
75813
+ )).is_remote_endpoint;
75814
+ }
75810
75815
  let schemaPath = is_remote_endpoint ? "./schema.graphql" : "path/to/src/lib/**/*.graphql";
75811
75816
  let pullSchema_content = null;
75812
- if (is_remote_endpoint) {
75817
+ if (is_remote_endpoint && !args.yes) {
75813
75818
  let number_of_round = 0;
75814
75819
  let url_and_headers = "";
75815
75820
  while (pullSchema_content === null && number_of_round < 10) {
@@ -75849,7 +75854,7 @@ async function init2(_path, args) {
75849
75854
  if (pullSchema_content === null) {
75850
75855
  pCancel("We couldn't pull the schema. Please check your URL/headers and try again.");
75851
75856
  }
75852
- } else {
75857
+ } else if (!args.yes) {
75853
75858
  const answers = await $e(
75854
75859
  {
75855
75860
  schema_path: () => J2({
@@ -75942,7 +75947,7 @@ function finale_logs(package_manager) {
75942
75947
  )
75943
75948
  );
75944
75949
  }
75945
- var houdiniConfig = async (configPath, schemaPath, module2, frameworkInfo, url) => {
75950
+ async function houdiniConfig(configPath, schemaPath, module2, frameworkInfo, url) {
75946
75951
  const config2 = {};
75947
75952
  if (url !== null) {
75948
75953
  config2.watchSchema = {
@@ -75980,8 +75985,8 @@ module.exports = config
75980
75985
  `;
75981
75986
  await fs_exports.writeFile(configPath, content);
75982
75987
  return false;
75983
- };
75984
- var houdiniClient = async (targetPath, typescript, frameworkInfo, url) => {
75988
+ }
75989
+ async function houdiniClient(targetPath, typescript, frameworkInfo, url) {
75985
75990
  const houdiniClientExt = typescript ? `ts` : `js`;
75986
75991
  const houdiniClientPath = path_exports.join(targetPath, `client.${houdiniClientExt}`);
75987
75992
  const content = `import { HoudiniClient } from '$houdini';
@@ -75991,8 +75996,8 @@ export default new HoudiniClient({
75991
75996
 
75992
75997
  // uncomment this to configure the network call (for things like authentication)
75993
75998
  // for more information, please visit here: https://www.houdinigraphql.com/guides/authentication
75994
- // fetchParams({ session }) {
75995
- // return {
75999
+ // fetchParams({ session }) {
76000
+ // return {
75996
76001
  // headers: {
75997
76002
  // Authentication: \`Bearer \${session.token}\`,
75998
76003
  // }
@@ -76001,7 +76006,7 @@ export default new HoudiniClient({
76001
76006
  })
76002
76007
  `;
76003
76008
  await fs_exports.writeFile(houdiniClientPath, content);
76004
- };
76009
+ }
76005
76010
  async function svelteKitConfig(targetPath, typescript) {
76006
76011
  const svelteMainJsPath = path_exports.join(targetPath, "src", typescript ? "main.ts" : "main.js");
76007
76012
  const newContent = `import client from "./client";
@@ -76091,7 +76096,7 @@ export default defineConfig({
76091
76096
  $houdini: path.resolve('$houdini'),
76092
76097
  },
76093
76098
  },
76094
- })
76099
+ })
76095
76100
  `;
76096
76101
  } else if (frameworkInfo.framework === "kit") {
76097
76102
  content = `import { sveltekit } from '@sveltejs/kit/vite'
@@ -76150,12 +76155,12 @@ async function packageJSON(targetPath, frameworkInfo) {
76150
76155
  }
76151
76156
  packageJSON2.devDependencies = {
76152
76157
  ...packageJSON2.devDependencies,
76153
- houdini: "^1.2.12"
76158
+ houdini: "^1.2.14"
76154
76159
  };
76155
76160
  if (frameworkInfo.framework === "svelte" || frameworkInfo.framework === "kit") {
76156
76161
  packageJSON2.devDependencies = {
76157
76162
  ...packageJSON2.devDependencies,
76158
- "houdini-svelte": "^1.2.12"
76163
+ "houdini-svelte": "^1.2.14"
76159
76164
  };
76160
76165
  } else {
76161
76166
  throw new Error(`Unmanaged framework: "${JSON.stringify(frameworkInfo)}"`);
@@ -76175,7 +76180,7 @@ program2.command("generate").description("generate the application runtime").opt
76175
76180
  program2.command("init").arguments("[path]").usage("[path] [options]").description("initialize a new houdini project").option(
76176
76181
  "-h, --headers <headers...>",
76177
76182
  "header to use when pulling your schema. Should be passed as KEY=VALUE"
76178
- ).action(init2);
76183
+ ).option("-y, --yes", "dont prompt for input. uses default values or empty strings").action(init2);
76179
76184
  program2.command("pull-schema").usage("[options]").description("pull the latest schema from your api").option(
76180
76185
  "-h, --headers <headers...>",
76181
76186
  "headers to use when pulling your schema. Should be passed as KEY=VALUE"
@@ -67738,7 +67738,7 @@ var LogLevel = {
67738
67738
  };
67739
67739
 
67740
67740
  // src/lib/config.ts
67741
- var currentDir = global.__dirname || dirname(fileURLToPath(import.meta.url));
67741
+ var currentDir = dirname(fileURLToPath(import.meta.url));
67742
67742
  var Config = class {
67743
67743
  filepath;
67744
67744
  rootDir;
@@ -69067,14 +69067,14 @@ async function find_graphql(config2, parsedScript, walker) {
69067
69067
  });
69068
69068
  }
69069
69069
 
69070
- // src/router/manifest.ts
69070
+ // src/lib/router/manifest.ts
69071
69071
  var t2 = __toESM(require_lib6(), 1);
69072
69072
  import * as graphql5 from "graphql";
69073
69073
 
69074
- // src/router/server.ts
69074
+ // src/lib/router/server.ts
69075
69075
  import path2 from "node:path";
69076
- import { build } from "vite";
69077
69076
  async function loadLocalSchema(config2) {
69077
+ const { build } = await import("vite");
69078
69078
  process.env.HOUDINI_SCHEMA_BUILD = "true";
69079
69079
  await build({
69080
69080
  logLevel: "silent",
@@ -70108,9 +70108,11 @@ function serializeValue(value) {
70108
70108
  }
70109
70109
  if (typeof value === "object" && value !== null) {
70110
70110
  return AST4.objectExpression(
70111
- Object.entries(value).filter(([, value2]) => typeof value2 !== "undefined").map(
70112
- ([key, value2]) => AST4.objectProperty(AST4.stringLiteral(key), serializeValue(value2))
70113
- )
70111
+ Object.entries(value).filter(
70112
+ ([key, value2]) => typeof value2 !== "undefined" && key !== "prev" && key !== "next"
70113
+ ).map(([key, val]) => {
70114
+ return AST4.objectProperty(AST4.stringLiteral(key), serializeValue(val));
70115
+ })
70114
70116
  );
70115
70117
  }
70116
70118
  if (typeof value === "string") {
@@ -70657,7 +70659,7 @@ async function paginate(config2, documents) {
70657
70659
  value: "__typename"
70658
70660
  }
70659
70661
  },
70660
- ...(typeConfig?.keys || ["id"]).map((key) => ({
70662
+ ...(typeConfig?.keys || [config2.defaultKeys[0]]).map((key) => ({
70661
70663
  kind: graphql11.Kind.FIELD,
70662
70664
  name: {
70663
70665
  kind: graphql11.Kind.NAME,
@@ -74341,7 +74343,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
74341
74343
  if (missing.length > 0) {
74342
74344
  ctx.reportError(
74343
74345
  new graphql26.GraphQLError(
74344
- "The following arguments are missing from this fragment: " + JSON.stringify(missing)
74346
+ `The following arguments are missing from the "${fragmentName}" fragment: ` + JSON.stringify(missing)
74345
74347
  )
74346
74348
  );
74347
74349
  return;
@@ -74577,7 +74579,7 @@ function nodeDirectives(config2, directives) {
74577
74579
  }
74578
74580
  if (!possibleNodes.includes(definitionType)) {
74579
74581
  ctx.reportError(
74580
- new graphql26.GraphQLError(paginateOnNonNodeMessage(config2, node.name.value))
74582
+ new graphql26.GraphQLError(paginateOnNonNodeMessage(node.name.value))
74581
74583
  );
74582
74584
  }
74583
74585
  }
@@ -74712,45 +74714,45 @@ function getAndVerifyNodeInterface(config2) {
74712
74714
  return null;
74713
74715
  }
74714
74716
  if (!graphql26.isInterfaceType(nodeInterface)) {
74715
- displayInvalidNodeFieldMessage(config2.logLevel);
74717
+ displayInvalidNodeFieldMessage(config2);
74716
74718
  return null;
74717
74719
  }
74718
74720
  const queryType = schema.getQueryType();
74719
74721
  if (!queryType) {
74720
- displayInvalidNodeFieldMessage(config2.logLevel);
74722
+ displayInvalidNodeFieldMessage(config2);
74721
74723
  return null;
74722
74724
  }
74723
74725
  const nodeField = queryType.getFields()["node"];
74724
74726
  if (!nodeField) {
74725
- displayInvalidNodeFieldMessage(config2.logLevel);
74727
+ displayInvalidNodeFieldMessage(config2);
74726
74728
  return null;
74727
74729
  }
74728
74730
  const args = nodeField.args;
74729
74731
  if (args.length === 0) {
74730
- displayInvalidNodeFieldMessage(config2.logLevel);
74732
+ displayInvalidNodeFieldMessage(config2);
74731
74733
  return null;
74732
74734
  }
74733
- const idArg = args.find((arg) => arg.name === "id");
74735
+ const idArg = args.find((arg) => arg.name === config2.defaultKeys[0]);
74734
74736
  if (!idArg) {
74735
- displayInvalidNodeFieldMessage(config2.logLevel);
74737
+ displayInvalidNodeFieldMessage(config2);
74736
74738
  return null;
74737
74739
  }
74738
74740
  const idType = unwrapType(config2, idArg.type);
74739
74741
  if (idType.type.name !== "ID") {
74740
- displayInvalidNodeFieldMessage(config2.logLevel);
74742
+ displayInvalidNodeFieldMessage(config2);
74741
74743
  return null;
74742
74744
  }
74743
74745
  const fieldReturnType = unwrapType(config2, nodeField.type);
74744
74746
  if (fieldReturnType.type.name !== "Node") {
74745
- displayInvalidNodeFieldMessage(config2.logLevel);
74747
+ displayInvalidNodeFieldMessage(config2);
74746
74748
  return null;
74747
74749
  }
74748
74750
  return nodeInterface;
74749
74751
  }
74750
74752
  var nbInvalidNodeFieldMessageDisplayed = 0;
74751
- function displayInvalidNodeFieldMessage(logLevel) {
74753
+ function displayInvalidNodeFieldMessage(config2) {
74752
74754
  if (nbInvalidNodeFieldMessageDisplayed === 0) {
74753
- if (logLevel === LogLevel.Full) {
74755
+ if (config2.logLevel === LogLevel.Full) {
74754
74756
  console.warn(invalidNodeFieldMessage);
74755
74757
  } else {
74756
74758
  console.warn(invalidNodeFieldMessageLight);
@@ -74764,18 +74766,18 @@ var invalidNodeFieldMessage = `\u26A0\uFE0F Your project defines a Node interfa
74764
74766
  If you are trying to provide the Node interface and its field, they must look like the following:
74765
74767
 
74766
74768
  interface Node {
74767
- id: ID!
74769
+ id: ID!
74768
74770
  }
74769
74771
 
74770
74772
  extend type Query {
74771
- node(id: ID!): Node
74773
+ node(id: ID!): Node
74772
74774
  }
74773
74775
 
74774
74776
  For more information, please visit these links:
74775
74777
  - https://graphql.org/learn/global-object-identification/
74776
74778
  - ${siteURL}/guides/caching-data#custom-ids
74777
74779
  `;
74778
- var paginateOnNonNodeMessage = (config2, directiveName) => `It looks like you are trying to use @${directiveName} on a document that does not have a valid type resolver.
74780
+ var paginateOnNonNodeMessage = (directiveName) => `It looks like you are trying to use @${directiveName} on a document that does not have a valid type resolver.
74779
74781
  If this is happening inside of a fragment, make sure that the fragment either implements the Node interface or you
74780
74782
  have defined a resolver entry for the fragment type.
74781
74783
 
@@ -75801,20 +75803,23 @@ async function init2(_path, args) {
75801
75803
  }
75802
75804
  }
75803
75805
  let url = "http://localhost:5173/api/graphql";
75804
- const { is_remote_endpoint } = await $e(
75805
- {
75806
- is_remote_endpoint: () => Q2({
75807
- message: "Will you use a remote GraphQL API?",
75808
- initialValue: true
75809
- })
75810
- },
75811
- {
75812
- onCancel: () => pCancel()
75813
- }
75814
- );
75806
+ let is_remote_endpoint = true;
75807
+ if (!args.yes) {
75808
+ is_remote_endpoint = (await $e(
75809
+ {
75810
+ is_remote_endpoint: () => Q2({
75811
+ message: "Will you use a remote GraphQL API?",
75812
+ initialValue: true
75813
+ })
75814
+ },
75815
+ {
75816
+ onCancel: () => pCancel()
75817
+ }
75818
+ )).is_remote_endpoint;
75819
+ }
75815
75820
  let schemaPath = is_remote_endpoint ? "./schema.graphql" : "path/to/src/lib/**/*.graphql";
75816
75821
  let pullSchema_content = null;
75817
- if (is_remote_endpoint) {
75822
+ if (is_remote_endpoint && !args.yes) {
75818
75823
  let number_of_round = 0;
75819
75824
  let url_and_headers = "";
75820
75825
  while (pullSchema_content === null && number_of_round < 10) {
@@ -75854,7 +75859,7 @@ async function init2(_path, args) {
75854
75859
  if (pullSchema_content === null) {
75855
75860
  pCancel("We couldn't pull the schema. Please check your URL/headers and try again.");
75856
75861
  }
75857
- } else {
75862
+ } else if (!args.yes) {
75858
75863
  const answers = await $e(
75859
75864
  {
75860
75865
  schema_path: () => J2({
@@ -75947,7 +75952,7 @@ function finale_logs(package_manager) {
75947
75952
  )
75948
75953
  );
75949
75954
  }
75950
- var houdiniConfig = async (configPath, schemaPath, module, frameworkInfo, url) => {
75955
+ async function houdiniConfig(configPath, schemaPath, module, frameworkInfo, url) {
75951
75956
  const config2 = {};
75952
75957
  if (url !== null) {
75953
75958
  config2.watchSchema = {
@@ -75985,8 +75990,8 @@ module.exports = config
75985
75990
  `;
75986
75991
  await fs_exports.writeFile(configPath, content);
75987
75992
  return false;
75988
- };
75989
- var houdiniClient = async (targetPath, typescript, frameworkInfo, url) => {
75993
+ }
75994
+ async function houdiniClient(targetPath, typescript, frameworkInfo, url) {
75990
75995
  const houdiniClientExt = typescript ? `ts` : `js`;
75991
75996
  const houdiniClientPath = path_exports.join(targetPath, `client.${houdiniClientExt}`);
75992
75997
  const content = `import { HoudiniClient } from '$houdini';
@@ -75996,8 +76001,8 @@ export default new HoudiniClient({
75996
76001
 
75997
76002
  // uncomment this to configure the network call (for things like authentication)
75998
76003
  // for more information, please visit here: https://www.houdinigraphql.com/guides/authentication
75999
- // fetchParams({ session }) {
76000
- // return {
76004
+ // fetchParams({ session }) {
76005
+ // return {
76001
76006
  // headers: {
76002
76007
  // Authentication: \`Bearer \${session.token}\`,
76003
76008
  // }
@@ -76006,7 +76011,7 @@ export default new HoudiniClient({
76006
76011
  })
76007
76012
  `;
76008
76013
  await fs_exports.writeFile(houdiniClientPath, content);
76009
- };
76014
+ }
76010
76015
  async function svelteKitConfig(targetPath, typescript) {
76011
76016
  const svelteMainJsPath = path_exports.join(targetPath, "src", typescript ? "main.ts" : "main.js");
76012
76017
  const newContent = `import client from "./client";
@@ -76096,7 +76101,7 @@ export default defineConfig({
76096
76101
  $houdini: path.resolve('$houdini'),
76097
76102
  },
76098
76103
  },
76099
- })
76104
+ })
76100
76105
  `;
76101
76106
  } else if (frameworkInfo.framework === "kit") {
76102
76107
  content = `import { sveltekit } from '@sveltejs/kit/vite'
@@ -76155,12 +76160,12 @@ async function packageJSON(targetPath, frameworkInfo) {
76155
76160
  }
76156
76161
  packageJSON2.devDependencies = {
76157
76162
  ...packageJSON2.devDependencies,
76158
- houdini: "^1.2.12"
76163
+ houdini: "^1.2.14"
76159
76164
  };
76160
76165
  if (frameworkInfo.framework === "svelte" || frameworkInfo.framework === "kit") {
76161
76166
  packageJSON2.devDependencies = {
76162
76167
  ...packageJSON2.devDependencies,
76163
- "houdini-svelte": "^1.2.12"
76168
+ "houdini-svelte": "^1.2.14"
76164
76169
  };
76165
76170
  } else {
76166
76171
  throw new Error(`Unmanaged framework: "${JSON.stringify(frameworkInfo)}"`);
@@ -76180,7 +76185,7 @@ program2.command("generate").description("generate the application runtime").opt
76180
76185
  program2.command("init").arguments("[path]").usage("[path] [options]").description("initialize a new houdini project").option(
76181
76186
  "-h, --headers <headers...>",
76182
76187
  "header to use when pulling your schema. Should be passed as KEY=VALUE"
76183
- ).action(init2);
76188
+ ).option("-y, --yes", "dont prompt for input. uses default values or empty strings").action(init2);
76184
76189
  program2.command("pull-schema").usage("[options]").description("pull the latest schema from your api").option(
76185
76190
  "-h, --headers <headers...>",
76186
76191
  "headers to use when pulling your schema. Should be passed as KEY=VALUE"