houdini 1.2.13 → 1.2.15

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 (45) hide show
  1. package/build/adapter/index.d.ts +3 -0
  2. package/build/adapter-cjs/index.js +33 -0
  3. package/build/adapter-cjs/package.json +1 -0
  4. package/build/adapter-esm/index.js +9 -0
  5. package/build/adapter-esm/package.json +1 -0
  6. package/build/cmd-cjs/index.js +19 -19
  7. package/build/cmd-esm/index.js +18 -18
  8. package/build/codegen-cjs/index.js +16 -17
  9. package/build/codegen-esm/index.js +16 -16
  10. package/build/lib/index.d.ts +2 -0
  11. package/build/lib/router/conventions.d.ts +3 -4
  12. package/build/lib/router/index.d.ts +1 -1
  13. package/build/lib/router/types.d.ts +1 -0
  14. package/build/lib-cjs/index.js +142 -22
  15. package/build/lib-esm/index.js +138 -21
  16. package/build/runtime/lib/types.d.ts +1 -1
  17. package/build/runtime/router/match.d.ts +38 -0
  18. package/build/runtime/router/server.d.ts +22 -25
  19. package/build/runtime/router/session.d.ts +22 -0
  20. package/build/runtime/router/types.d.ts +23 -0
  21. package/build/runtime-cjs/lib/types.d.ts +1 -1
  22. package/build/runtime-cjs/lib/types.js +2 -0
  23. package/build/runtime-cjs/router/match.d.ts +38 -0
  24. package/build/runtime-cjs/router/match.js +149 -0
  25. package/build/runtime-cjs/router/server.d.ts +22 -25
  26. package/build/runtime-cjs/router/server.js +71 -49
  27. package/build/runtime-cjs/router/session.d.ts +22 -0
  28. package/build/runtime-cjs/router/session.js +77 -0
  29. package/build/runtime-cjs/router/types.d.ts +23 -0
  30. package/build/runtime-cjs/router/types.js +16 -0
  31. package/build/runtime-esm/lib/types.d.ts +1 -1
  32. package/build/runtime-esm/lib/types.js +1 -0
  33. package/build/runtime-esm/router/match.d.ts +38 -0
  34. package/build/runtime-esm/router/match.js +122 -0
  35. package/build/runtime-esm/router/server.d.ts +22 -25
  36. package/build/runtime-esm/router/server.js +64 -47
  37. package/build/runtime-esm/router/session.d.ts +22 -0
  38. package/build/runtime-esm/router/session.js +52 -0
  39. package/build/runtime-esm/router/types.d.ts +23 -0
  40. package/build/runtime-esm/router/types.js +0 -0
  41. package/build/test-cjs/index.js +16 -17
  42. package/build/test-esm/index.js +16 -16
  43. package/build/vite-cjs/index.js +28 -32
  44. package/build/vite-esm/index.js +28 -31
  45. package/package.json +10 -1
@@ -0,0 +1,122 @@
1
+ const param_pattern = /^(\[)?(\.\.\.)?(\w+)(?:=(\w+))?(\])?$/;
2
+ function find_match(manifest, current, allowNull = true) {
3
+ let match = null;
4
+ let matchVariables = null;
5
+ for (const page of Object.values(manifest.pages)) {
6
+ const urlMatch = current.match(page.pattern);
7
+ if (!urlMatch) {
8
+ continue;
9
+ }
10
+ match = page;
11
+ matchVariables = exec(urlMatch, page.params) || {};
12
+ break;
13
+ }
14
+ if (!match && !allowNull) {
15
+ throw new Error("404");
16
+ }
17
+ return [match, matchVariables];
18
+ }
19
+ function parse_page_pattern(id) {
20
+ const params = [];
21
+ const pattern = id === "/" ? /^\/$/ : new RegExp(
22
+ `^${get_route_segments(id).map((segment) => {
23
+ const rest_match = /^\[\.\.\.(\w+)(?:=(\w+))?\]$/.exec(segment);
24
+ if (rest_match) {
25
+ params.push({
26
+ name: rest_match[1],
27
+ matcher: rest_match[2],
28
+ optional: false,
29
+ rest: true,
30
+ chained: true
31
+ });
32
+ return "(?:/(.*))?";
33
+ }
34
+ const optional_match = /^\[\[(\w+)(?:=(\w+))?\]\]$/.exec(segment);
35
+ if (optional_match) {
36
+ params.push({
37
+ name: optional_match[1],
38
+ matcher: optional_match[2],
39
+ optional: true,
40
+ rest: false,
41
+ chained: true
42
+ });
43
+ return "(?:/([^/]+))?";
44
+ }
45
+ if (!segment) {
46
+ return;
47
+ }
48
+ const parts = segment.split(/\[(.+?)\](?!\])/);
49
+ const result = parts.map((content, i) => {
50
+ if (i % 2) {
51
+ if (content.startsWith("x+")) {
52
+ return escape(
53
+ String.fromCharCode(parseInt(content.slice(2), 16))
54
+ );
55
+ }
56
+ if (content.startsWith("u+")) {
57
+ return escape(
58
+ String.fromCharCode(
59
+ ...content.slice(2).split("-").map((code) => parseInt(code, 16))
60
+ )
61
+ );
62
+ }
63
+ const match = param_pattern.exec(content);
64
+ if (!match) {
65
+ throw new Error(
66
+ `Invalid param: ${content}. Params and matcher names can only have underscores and alphanumeric characters.`
67
+ );
68
+ }
69
+ const [, is_optional, is_rest, name, matcher] = match;
70
+ params.push({
71
+ name,
72
+ matcher,
73
+ optional: !!is_optional,
74
+ rest: !!is_rest,
75
+ chained: is_rest ? i === 1 && parts[0] === "" : false
76
+ });
77
+ return is_rest ? "(.*?)" : is_optional ? "([^/]*)?" : "([^/]+?)";
78
+ }
79
+ return escape(content);
80
+ }).join("");
81
+ return "/" + result;
82
+ }).join("")}/?$`
83
+ );
84
+ return { pattern, params, page_id: id };
85
+ }
86
+ function affects_path(segment) {
87
+ return !/^\([^)]+\)$/.test(segment);
88
+ }
89
+ function get_route_segments(route) {
90
+ return route.slice(1).split("/").filter(affects_path);
91
+ }
92
+ function exec(match, params) {
93
+ const result = {};
94
+ const values = match.slice(1);
95
+ let buffered = "";
96
+ for (let i = 0; i < params.length; i += 1) {
97
+ const param = params[i];
98
+ let value = values[i];
99
+ if (param.chained && param.rest && buffered) {
100
+ value = value ? buffered + "/" + value : buffered;
101
+ }
102
+ buffered = "";
103
+ if (value === void 0) {
104
+ if (param.rest)
105
+ result[param.name] = "";
106
+ } else {
107
+ result[param.name] = value;
108
+ }
109
+ }
110
+ if (buffered)
111
+ return;
112
+ return result;
113
+ }
114
+ function escape(str) {
115
+ return str.normalize().replace(/[[\]]/g, "\\$&").replace(/%/g, "%25").replace(/\//g, "%2[Ff]").replace(/\?/g, "%3[Ff]").replace(/#/g, "%23").replace(/[.*+?^${}()|\\]/g, "\\$&");
116
+ }
117
+ export {
118
+ exec,
119
+ find_match,
120
+ get_route_segments,
121
+ parse_page_pattern
122
+ };
@@ -1,25 +1,22 @@
1
- import type { ConfigFile } from '../lib';
2
- type ServerHandlerArgs = {
3
- url: string;
4
- config: ConfigFile;
5
- session_keys: string[];
6
- set_header: (key: string, value: string | number | string[]) => void;
7
- get_header: (key: string) => string | number | string[] | undefined;
8
- redirect: (code: number, url: string) => void;
9
- next: () => void;
10
- };
11
- export declare function handle_request(args: ServerHandlerArgs): Promise<void>;
12
- export type Server = {
13
- use(fn: ServerMiddleware): void;
14
- };
15
- export type ServerMiddleware = (req: IncomingRequest, res: ServerResponse, next: () => void) => void;
16
- export type IncomingRequest = {
17
- url?: string;
18
- headers: Headers;
19
- };
20
- export type ServerResponse = {
21
- redirect(url: string, status?: number): void;
22
- set_header(name: string, value: string): void;
23
- };
24
- export declare function get_session(req: Headers, secrets: string[]): Promise<App.Session>;
25
- export {};
1
+ /// <reference types="node" />
2
+ import { createServerAdapter as createAdapter } from '@whatwg-node/server';
3
+ import { type GraphQLSchema } from 'graphql';
4
+ import { createYoga } from 'graphql-yoga';
5
+ import type { IncomingMessage, ServerResponse } from 'node:http';
6
+ import type { RouterManifest, RouterPageManifest, YogaServerOptions } from './types';
7
+ export declare const serverAdapterFactory: <ComponentType>({ schema, yoga, production, manifest, on_render, pipe, assetPrefix, }: {
8
+ schema?: GraphQLSchema | null | undefined;
9
+ yoga?: import("graphql-yoga").YogaServerInstance<Record<string, any>, Record<string, any>> | null | undefined;
10
+ assetPrefix: string;
11
+ production?: boolean | undefined;
12
+ pipe?: ServerResponse<IncomingMessage> | undefined;
13
+ on_render: (args: {
14
+ url: string;
15
+ match: RouterPageManifest<ComponentType> | null;
16
+ manifest: RouterManifest<unknown>;
17
+ session: App.Session;
18
+ pipe?: ServerResponse<IncomingMessage> | undefined;
19
+ }) => Response | Promise<Response>;
20
+ manifest: RouterManifest<ComponentType> | null;
21
+ } & Omit<import("graphql-yoga").YogaServerOptions<Record<string, any>, Record<string, any>>, "schema">) => ReturnType<typeof createAdapter>;
22
+ export type ServerAdapterFactory = typeof serverAdapterFactory;
@@ -1,53 +1,70 @@
1
- import { parse } from "./cookies";
2
- import { decode, encode, verify } from "./jwt";
3
- async function handle_request(args) {
4
- const plugin_config = args.config.router ?? {};
5
- if (plugin_config.auth && "redirect" in plugin_config.auth && args.url.startsWith(plugin_config.auth.redirect)) {
6
- return await redirect_auth(args);
1
+ import { createServerAdapter as createAdapter } from "@whatwg-node/server";
2
+ import { parse, execute } from "graphql";
3
+ import { createYoga } from "graphql-yoga";
4
+ import client from "../../../src/+client";
5
+ import { localApiSessionKeys, localApiEndpoint, getCurrentConfig } from "../lib/config";
6
+ import { find_match } from "./match";
7
+ import { get_session, handle_request } from "./session";
8
+ const config_file = getCurrentConfig();
9
+ const session_keys = localApiSessionKeys(config_file);
10
+ const graphqlEndpoint = localApiEndpoint(config_file);
11
+ const serverAdapterFactory = ({
12
+ schema,
13
+ yoga,
14
+ production,
15
+ manifest,
16
+ on_render,
17
+ pipe,
18
+ assetPrefix
19
+ }) => {
20
+ if (schema && !yoga) {
21
+ yoga = createYoga({
22
+ schema,
23
+ landingPage: !production,
24
+ graphqlEndpoint
25
+ });
7
26
  }
8
- args.next();
9
- }
10
- async function redirect_auth(args) {
11
- const { searchParams } = new URL(args.url, `http://${args.get_header("host")}`);
12
- const { redirectTo, ...session } = Object.fromEntries(searchParams.entries());
13
- await set_session(args, session);
14
- if (redirectTo) {
15
- return args.redirect(302, redirectTo);
27
+ if (schema) {
28
+ client.registerProxy(graphqlEndpoint, async ({ query, variables, session }) => {
29
+ const parsed = parse(query);
30
+ return await execute(schema, parsed, null, session, variables);
31
+ });
16
32
  }
17
- args.next();
18
- }
19
- const session_cookie_name = "__houdini__";
20
- async function set_session(req, value) {
21
- const today = new Date();
22
- const expires = new Date(today.getTime() + 7 * 24 * 60 * 60 * 1e3);
23
- const serialized = await encode(value, req.session_keys[0]);
24
- req.set_header(
25
- "Set-Cookie",
26
- `${session_cookie_name}=${serialized}; Path=/; HttpOnly; Secure; SameSite=Lax; Expires=${expires.toUTCString()} `
27
- );
28
- }
29
- async function get_session(req, secrets) {
30
- const cookies = req.get("cookie");
31
- if (!cookies) {
32
- return {};
33
- }
34
- const cookie = parse(cookies)[session_cookie_name];
35
- if (!cookie) {
36
- return {};
37
- }
38
- for (const secret of secrets) {
39
- if (!await verify(cookie, secret)) {
40
- continue;
33
+ return createAdapter(async (request) => {
34
+ if (!manifest) {
35
+ return new Response(
36
+ "Adapter did not provide the project's manifest. Please open an issue on github.",
37
+ { status: 500 }
38
+ );
41
39
  }
42
- const parsed = decode(cookie);
43
- if (!parsed) {
44
- return {};
40
+ const url = new URL(request.url).pathname;
41
+ if (yoga && url === localApiEndpoint(config_file)) {
42
+ return yoga(request);
45
43
  }
46
- return parsed.payload;
47
- }
48
- return {};
49
- }
44
+ const authResponse = await handle_request({
45
+ url,
46
+ config: config_file,
47
+ session_keys,
48
+ headers: request.headers
49
+ });
50
+ if (authResponse) {
51
+ return authResponse;
52
+ }
53
+ const [match] = find_match(manifest, url);
54
+ const rendered = await on_render({
55
+ url,
56
+ match,
57
+ session: await get_session(request.headers, session_keys),
58
+ manifest,
59
+ pipe
60
+ });
61
+ if (rendered) {
62
+ console.log(url, rendered);
63
+ return rendered;
64
+ }
65
+ return new Response("404", { status: 404 });
66
+ });
67
+ };
50
68
  export {
51
- get_session,
52
- handle_request
69
+ serverAdapterFactory
53
70
  };
@@ -0,0 +1,22 @@
1
+ import type { ConfigFile } from '../lib';
2
+ type ServerHandlerArgs = {
3
+ url: string;
4
+ config: ConfigFile;
5
+ session_keys: string[];
6
+ headers: Headers;
7
+ };
8
+ export declare function handle_request(args: ServerHandlerArgs): Promise<Response | undefined>;
9
+ export type Server = {
10
+ use(fn: ServerMiddleware): void;
11
+ };
12
+ export type ServerMiddleware = (req: IncomingRequest, res: ServerResponse, next: () => void) => void;
13
+ export type IncomingRequest = {
14
+ url?: string;
15
+ headers: Headers;
16
+ };
17
+ export type ServerResponse = {
18
+ redirect(url: string, status?: number): void;
19
+ set_header(name: string, value: string): void;
20
+ };
21
+ export declare function get_session(req: Headers, secrets: string[]): Promise<App.Session>;
22
+ export {};
@@ -0,0 +1,52 @@
1
+ import { parse } from "./cookies";
2
+ import { decode, encode, verify } from "./jwt";
3
+ async function handle_request(args) {
4
+ const plugin_config = args.config.router ?? {};
5
+ if (plugin_config.auth && "redirect" in plugin_config.auth && args.url.startsWith(plugin_config.auth.redirect)) {
6
+ return await redirect_auth(args);
7
+ }
8
+ }
9
+ async function redirect_auth(args) {
10
+ const { searchParams } = new URL(args.url, `http://${args.headers.get("host")}`);
11
+ const { redirectTo, ...session } = Object.fromEntries(searchParams.entries());
12
+ if (redirectTo) {
13
+ const response = Response.redirect(redirectTo, 302);
14
+ await set_session(args, response, session);
15
+ return response;
16
+ }
17
+ }
18
+ const session_cookie_name = "__houdini__";
19
+ async function set_session(req, response, value) {
20
+ const today = new Date();
21
+ const expires = new Date(today.getTime() + 7 * 24 * 60 * 60 * 1e3);
22
+ const serialized = await encode(value, req.session_keys[0]);
23
+ response.headers.set(
24
+ "Set-Cookie",
25
+ `${session_cookie_name}=${serialized}; Path=/; HttpOnly; Secure; SameSite=Lax; Expires=${expires.toUTCString()} `
26
+ );
27
+ }
28
+ async function get_session(req, secrets) {
29
+ const cookies = req.get("cookie");
30
+ if (!cookies) {
31
+ return {};
32
+ }
33
+ const cookie = parse(cookies)[session_cookie_name];
34
+ if (!cookie) {
35
+ return {};
36
+ }
37
+ for (const secret of secrets) {
38
+ if (!await verify(cookie, secret)) {
39
+ continue;
40
+ }
41
+ const parsed = decode(cookie);
42
+ if (!parsed) {
43
+ return {};
44
+ }
45
+ return parsed.payload;
46
+ }
47
+ return {};
48
+ }
49
+ export {
50
+ get_session,
51
+ handle_request
52
+ };
@@ -0,0 +1,23 @@
1
+ import type { QueryArtifact } from '$houdini/runtime/lib/types';
2
+ import type { createYoga } from 'graphql-yoga';
3
+ import type { RouteParam } from './match';
4
+ export type YogaServer = ReturnType<typeof createYoga>;
5
+ export type YogaServerOptions = Parameters<typeof createYoga>[0];
6
+ export type RouterManifest<_ComponentType> = {
7
+ pages: Record<string, RouterPageManifest<_ComponentType>>;
8
+ };
9
+ export type { ServerAdapterFactory } from './server';
10
+ export type RouterPageManifest<_ComponentType> = {
11
+ id: string;
12
+ pattern: RegExp;
13
+ params: RouteParam[];
14
+ documents: Record<string, {
15
+ artifact: () => Promise<{
16
+ default: QueryArtifact;
17
+ }>;
18
+ loading: boolean;
19
+ }>;
20
+ component: () => Promise<{
21
+ default: (props: any) => _ComponentType;
22
+ }>;
23
+ };
File without changes
@@ -1,4 +1,3 @@
1
- import { createRequire as conflict_free } from 'module'; const require = conflict_free(import.meta.url);
2
1
  "use strict";
3
2
  var __create = Object.create;
4
3
  var __defProp = Object.defineProperty;
@@ -57118,7 +57117,7 @@ var LogLevel = {
57118
57117
 
57119
57118
  // src/lib/config.ts
57120
57119
  var import_meta = {};
57121
- var currentDir = global.__dirname || dirname((0, import_node_url.fileURLToPath)(import_meta.url));
57120
+ var currentDir = dirname((0, import_node_url.fileURLToPath)(import_meta.url));
57122
57121
  var Config = class {
57123
57122
  filepath;
57124
57123
  rootDir;
@@ -59538,7 +59537,7 @@ async function paginate(config2, documents) {
59538
59537
  value: "__typename"
59539
59538
  }
59540
59539
  },
59541
- ...(typeConfig?.keys || ["id"]).map((key) => ({
59540
+ ...(typeConfig?.keys || [config2.defaultKeys[0]]).map((key) => ({
59542
59541
  kind: graphql11.Kind.FIELD,
59543
59542
  name: {
59544
59543
  kind: graphql11.Kind.NAME,
@@ -63458,7 +63457,7 @@ function nodeDirectives(config2, directives) {
63458
63457
  }
63459
63458
  if (!possibleNodes.includes(definitionType)) {
63460
63459
  ctx.reportError(
63461
- new graphql26.GraphQLError(paginateOnNonNodeMessage(config2, node.name.value))
63460
+ new graphql26.GraphQLError(paginateOnNonNodeMessage(node.name.value))
63462
63461
  );
63463
63462
  }
63464
63463
  }
@@ -63593,45 +63592,45 @@ function getAndVerifyNodeInterface(config2) {
63593
63592
  return null;
63594
63593
  }
63595
63594
  if (!graphql26.isInterfaceType(nodeInterface)) {
63596
- displayInvalidNodeFieldMessage(config2.logLevel);
63595
+ displayInvalidNodeFieldMessage(config2);
63597
63596
  return null;
63598
63597
  }
63599
63598
  const queryType = schema.getQueryType();
63600
63599
  if (!queryType) {
63601
- displayInvalidNodeFieldMessage(config2.logLevel);
63600
+ displayInvalidNodeFieldMessage(config2);
63602
63601
  return null;
63603
63602
  }
63604
63603
  const nodeField = queryType.getFields()["node"];
63605
63604
  if (!nodeField) {
63606
- displayInvalidNodeFieldMessage(config2.logLevel);
63605
+ displayInvalidNodeFieldMessage(config2);
63607
63606
  return null;
63608
63607
  }
63609
63608
  const args = nodeField.args;
63610
63609
  if (args.length === 0) {
63611
- displayInvalidNodeFieldMessage(config2.logLevel);
63610
+ displayInvalidNodeFieldMessage(config2);
63612
63611
  return null;
63613
63612
  }
63614
- const idArg = args.find((arg) => arg.name === "id");
63613
+ const idArg = args.find((arg) => arg.name === config2.defaultKeys[0]);
63615
63614
  if (!idArg) {
63616
- displayInvalidNodeFieldMessage(config2.logLevel);
63615
+ displayInvalidNodeFieldMessage(config2);
63617
63616
  return null;
63618
63617
  }
63619
63618
  const idType = unwrapType(config2, idArg.type);
63620
63619
  if (idType.type.name !== "ID") {
63621
- displayInvalidNodeFieldMessage(config2.logLevel);
63620
+ displayInvalidNodeFieldMessage(config2);
63622
63621
  return null;
63623
63622
  }
63624
63623
  const fieldReturnType = unwrapType(config2, nodeField.type);
63625
63624
  if (fieldReturnType.type.name !== "Node") {
63626
- displayInvalidNodeFieldMessage(config2.logLevel);
63625
+ displayInvalidNodeFieldMessage(config2);
63627
63626
  return null;
63628
63627
  }
63629
63628
  return nodeInterface;
63630
63629
  }
63631
63630
  var nbInvalidNodeFieldMessageDisplayed = 0;
63632
- function displayInvalidNodeFieldMessage(logLevel) {
63631
+ function displayInvalidNodeFieldMessage(config2) {
63633
63632
  if (nbInvalidNodeFieldMessageDisplayed === 0) {
63634
- if (logLevel === LogLevel.Full) {
63633
+ if (config2.logLevel === LogLevel.Full) {
63635
63634
  console.warn(invalidNodeFieldMessage);
63636
63635
  } else {
63637
63636
  console.warn(invalidNodeFieldMessageLight);
@@ -63645,18 +63644,18 @@ var invalidNodeFieldMessage = `\u26A0\uFE0F Your project defines a Node interfa
63645
63644
  If you are trying to provide the Node interface and its field, they must look like the following:
63646
63645
 
63647
63646
  interface Node {
63648
- id: ID!
63647
+ id: ID!
63649
63648
  }
63650
63649
 
63651
63650
  extend type Query {
63652
- node(id: ID!): Node
63651
+ node(id: ID!): Node
63653
63652
  }
63654
63653
 
63655
63654
  For more information, please visit these links:
63656
63655
  - https://graphql.org/learn/global-object-identification/
63657
63656
  - ${siteURL}/guides/caching-data#custom-ids
63658
63657
  `;
63659
- var paginateOnNonNodeMessage = (config2, directiveName) => `It looks like you are trying to use @${directiveName} on a document that does not have a valid type resolver.
63658
+ var paginateOnNonNodeMessage = (directiveName) => `It looks like you are trying to use @${directiveName} on a document that does not have a valid type resolver.
63660
63659
  If this is happening inside of a fragment, make sure that the fragment either implements the Node interface or you
63661
63660
  have defined a resolver entry for the fragment type.
63662
63661
 
@@ -57113,7 +57113,7 @@ var LogLevel = {
57113
57113
  };
57114
57114
 
57115
57115
  // src/lib/config.ts
57116
- var currentDir = global.__dirname || dirname(fileURLToPath(import.meta.url));
57116
+ var currentDir = dirname(fileURLToPath(import.meta.url));
57117
57117
  var Config = class {
57118
57118
  filepath;
57119
57119
  rootDir;
@@ -59533,7 +59533,7 @@ async function paginate(config2, documents) {
59533
59533
  value: "__typename"
59534
59534
  }
59535
59535
  },
59536
- ...(typeConfig?.keys || ["id"]).map((key) => ({
59536
+ ...(typeConfig?.keys || [config2.defaultKeys[0]]).map((key) => ({
59537
59537
  kind: graphql11.Kind.FIELD,
59538
59538
  name: {
59539
59539
  kind: graphql11.Kind.NAME,
@@ -63453,7 +63453,7 @@ function nodeDirectives(config2, directives) {
63453
63453
  }
63454
63454
  if (!possibleNodes.includes(definitionType)) {
63455
63455
  ctx.reportError(
63456
- new graphql26.GraphQLError(paginateOnNonNodeMessage(config2, node.name.value))
63456
+ new graphql26.GraphQLError(paginateOnNonNodeMessage(node.name.value))
63457
63457
  );
63458
63458
  }
63459
63459
  }
@@ -63588,45 +63588,45 @@ function getAndVerifyNodeInterface(config2) {
63588
63588
  return null;
63589
63589
  }
63590
63590
  if (!graphql26.isInterfaceType(nodeInterface)) {
63591
- displayInvalidNodeFieldMessage(config2.logLevel);
63591
+ displayInvalidNodeFieldMessage(config2);
63592
63592
  return null;
63593
63593
  }
63594
63594
  const queryType = schema.getQueryType();
63595
63595
  if (!queryType) {
63596
- displayInvalidNodeFieldMessage(config2.logLevel);
63596
+ displayInvalidNodeFieldMessage(config2);
63597
63597
  return null;
63598
63598
  }
63599
63599
  const nodeField = queryType.getFields()["node"];
63600
63600
  if (!nodeField) {
63601
- displayInvalidNodeFieldMessage(config2.logLevel);
63601
+ displayInvalidNodeFieldMessage(config2);
63602
63602
  return null;
63603
63603
  }
63604
63604
  const args = nodeField.args;
63605
63605
  if (args.length === 0) {
63606
- displayInvalidNodeFieldMessage(config2.logLevel);
63606
+ displayInvalidNodeFieldMessage(config2);
63607
63607
  return null;
63608
63608
  }
63609
- const idArg = args.find((arg) => arg.name === "id");
63609
+ const idArg = args.find((arg) => arg.name === config2.defaultKeys[0]);
63610
63610
  if (!idArg) {
63611
- displayInvalidNodeFieldMessage(config2.logLevel);
63611
+ displayInvalidNodeFieldMessage(config2);
63612
63612
  return null;
63613
63613
  }
63614
63614
  const idType = unwrapType(config2, idArg.type);
63615
63615
  if (idType.type.name !== "ID") {
63616
- displayInvalidNodeFieldMessage(config2.logLevel);
63616
+ displayInvalidNodeFieldMessage(config2);
63617
63617
  return null;
63618
63618
  }
63619
63619
  const fieldReturnType = unwrapType(config2, nodeField.type);
63620
63620
  if (fieldReturnType.type.name !== "Node") {
63621
- displayInvalidNodeFieldMessage(config2.logLevel);
63621
+ displayInvalidNodeFieldMessage(config2);
63622
63622
  return null;
63623
63623
  }
63624
63624
  return nodeInterface;
63625
63625
  }
63626
63626
  var nbInvalidNodeFieldMessageDisplayed = 0;
63627
- function displayInvalidNodeFieldMessage(logLevel) {
63627
+ function displayInvalidNodeFieldMessage(config2) {
63628
63628
  if (nbInvalidNodeFieldMessageDisplayed === 0) {
63629
- if (logLevel === LogLevel.Full) {
63629
+ if (config2.logLevel === LogLevel.Full) {
63630
63630
  console.warn(invalidNodeFieldMessage);
63631
63631
  } else {
63632
63632
  console.warn(invalidNodeFieldMessageLight);
@@ -63640,18 +63640,18 @@ var invalidNodeFieldMessage = `\u26A0\uFE0F Your project defines a Node interfa
63640
63640
  If you are trying to provide the Node interface and its field, they must look like the following:
63641
63641
 
63642
63642
  interface Node {
63643
- id: ID!
63643
+ id: ID!
63644
63644
  }
63645
63645
 
63646
63646
  extend type Query {
63647
- node(id: ID!): Node
63647
+ node(id: ID!): Node
63648
63648
  }
63649
63649
 
63650
63650
  For more information, please visit these links:
63651
63651
  - https://graphql.org/learn/global-object-identification/
63652
63652
  - ${siteURL}/guides/caching-data#custom-ids
63653
63653
  `;
63654
- var paginateOnNonNodeMessage = (config2, directiveName) => `It looks like you are trying to use @${directiveName} on a document that does not have a valid type resolver.
63654
+ var paginateOnNonNodeMessage = (directiveName) => `It looks like you are trying to use @${directiveName} on a document that does not have a valid type resolver.
63655
63655
  If this is happening inside of a fragment, make sure that the fragment either implements the Node interface or you
63656
63656
  have defined a resolver entry for the fragment type.
63657
63657