houdini 2.0.0-next.5 → 2.0.0-next.6

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.
@@ -89212,12 +89212,12 @@ async function packageJSON(targetPath, frameworkInfo) {
89212
89212
  }
89213
89213
  packageJSON2.devDependencies = {
89214
89214
  ...packageJSON2.devDependencies,
89215
- houdini: "^2.0.0-next.5"
89215
+ houdini: "^2.0.0-next.6"
89216
89216
  };
89217
89217
  if (frameworkInfo.framework === "svelte" || frameworkInfo.framework === "kit") {
89218
89218
  packageJSON2.devDependencies = {
89219
89219
  ...packageJSON2.devDependencies,
89220
- "houdini-svelte": "^3.0.0-next.8"
89220
+ "houdini-svelte": "^3.0.0-next.9"
89221
89221
  };
89222
89222
  } else {
89223
89223
  throw new Error(`Unmanaged framework: "${JSON.stringify(frameworkInfo)}"`);
@@ -89216,12 +89216,12 @@ async function packageJSON(targetPath, frameworkInfo) {
89216
89216
  }
89217
89217
  packageJSON2.devDependencies = {
89218
89218
  ...packageJSON2.devDependencies,
89219
- houdini: "^2.0.0-next.5"
89219
+ houdini: "^2.0.0-next.6"
89220
89220
  };
89221
89221
  if (frameworkInfo.framework === "svelte" || frameworkInfo.framework === "kit") {
89222
89222
  packageJSON2.devDependencies = {
89223
89223
  ...packageJSON2.devDependencies,
89224
- "houdini-svelte": "^3.0.0-next.8"
89224
+ "houdini-svelte": "^3.0.0-next.9"
89225
89225
  };
89226
89226
  } else {
89227
89227
  throw new Error(`Unmanaged framework: "${JSON.stringify(frameworkInfo)}"`);
@@ -73407,7 +73407,8 @@ async function load_manifest(args) {
73407
73407
  const name = child.isDirectory() ? child.name : parse3(child.name).name;
73408
73408
  if (name === "+schema") {
73409
73409
  manifest.local_schema = true;
73410
- } else if (name === "+yoga") {
73410
+ }
73411
+ if (name === "+yoga") {
73411
73412
  manifest.local_yoga = true;
73412
73413
  }
73413
73414
  }
@@ -77424,7 +77425,7 @@ var HoudiniClient = class {
77424
77425
  }
77425
77426
  this.throwOnError_operations = throwOnError2?.operations ?? [];
77426
77427
  let serverPort = globalThis.process?.env?.HOUDINI_PORT ?? "5173";
77427
- this.url = url ?? (globalThis.window ? "" : `https://localhost:${serverPort}`) + localApiEndpoint(getCurrentConfig());
77428
+ this.url = url ?? (globalThis.window ? "" : `http://localhost:${serverPort}`) + localApiEndpoint(getCurrentConfig());
77428
77429
  this.throwOnError = throwOnError2;
77429
77430
  this.fetchParams = fetchParams2;
77430
77431
  this.pipeline = pipeline2;
@@ -73318,7 +73318,8 @@ async function load_manifest(args) {
73318
73318
  const name = child.isDirectory() ? child.name : parse3(child.name).name;
73319
73319
  if (name === "+schema") {
73320
73320
  manifest.local_schema = true;
73321
- } else if (name === "+yoga") {
73321
+ }
73322
+ if (name === "+yoga") {
73322
73323
  manifest.local_yoga = true;
73323
73324
  }
73324
73325
  }
@@ -77335,7 +77336,7 @@ var HoudiniClient = class {
77335
77336
  }
77336
77337
  this.throwOnError_operations = throwOnError2?.operations ?? [];
77337
77338
  let serverPort = globalThis.process?.env?.HOUDINI_PORT ?? "5173";
77338
- this.url = url ?? (globalThis.window ? "" : `https://localhost:${serverPort}`) + localApiEndpoint(getCurrentConfig());
77339
+ this.url = url ?? (globalThis.window ? "" : `http://localhost:${serverPort}`) + localApiEndpoint(getCurrentConfig());
77339
77340
  this.throwOnError = throwOnError2;
77340
77341
  this.fetchParams = fetchParams2;
77341
77342
  this.pipeline = pipeline2;
@@ -29,13 +29,13 @@ export declare function parse(str: string, options?: {
29
29
  *
30
30
  */
31
31
  export declare function serialize(name: string, val: string, options: {
32
- encode: boolean;
33
- maxAge: number;
34
- domain: string;
35
- path: string;
36
- expires: Date;
37
- httpOnly: boolean;
38
- priority: string | number;
39
- secure: boolean;
40
- sameSite: string | boolean;
32
+ encode?: boolean;
33
+ maxAge?: number;
34
+ domain?: string;
35
+ path?: string;
36
+ expires?: Date;
37
+ httpOnly?: boolean;
38
+ priority?: string | number;
39
+ secure?: boolean;
40
+ sameSite?: string | boolean;
41
41
  }): string;
@@ -1,5 +1,5 @@
1
1
  import { createServerAdapter as createAdapter } from '@whatwg-node/server';
2
- import { type GraphQLSchema } from 'graphql';
2
+ import type { GraphQLSchema } from 'graphql';
3
3
  import { createYoga } from 'graphql-yoga';
4
4
  import type { HoudiniClient } from '../client';
5
5
  import type { RouterManifest, RouterPageManifest, YogaServerOptions } from './types';
@@ -17,5 +17,6 @@ export type ServerResponse = {
17
17
  redirect(url: string, status?: number): void;
18
18
  set_header(name: string, value: string): void;
19
19
  };
20
+ export declare const session_cookie_name = "__houdini__";
20
21
  export declare function get_session(req: Headers, secrets: string[]): Promise<App.Session>;
21
22
  export {};
@@ -76,7 +76,7 @@ class HoudiniClient {
76
76
  }
77
77
  this.throwOnError_operations = throwOnError?.operations ?? [];
78
78
  let serverPort = globalThis.process?.env?.HOUDINI_PORT ?? "5173";
79
- this.url = url ?? (globalThis.window ? "" : `https://localhost:${serverPort}`) + (0, import_lib.localApiEndpoint)((0, import_lib.getCurrentConfig)());
79
+ this.url = url ?? (globalThis.window ? "" : `http://localhost:${serverPort}`) + (0, import_lib.localApiEndpoint)((0, import_lib.getCurrentConfig)());
80
80
  this.throwOnError = throwOnError;
81
81
  this.fetchParams = fetchParams;
82
82
  this.pipeline = pipeline;
@@ -29,13 +29,13 @@ export declare function parse(str: string, options?: {
29
29
  *
30
30
  */
31
31
  export declare function serialize(name: string, val: string, options: {
32
- encode: boolean;
33
- maxAge: number;
34
- domain: string;
35
- path: string;
36
- expires: Date;
37
- httpOnly: boolean;
38
- priority: string | number;
39
- secure: boolean;
40
- sameSite: string | boolean;
32
+ encode?: boolean;
33
+ maxAge?: number;
34
+ domain?: string;
35
+ path?: string;
36
+ expires?: Date;
37
+ httpOnly?: boolean;
38
+ priority?: string | number;
39
+ secure?: boolean;
40
+ sameSite?: string | boolean;
41
41
  }): string;
@@ -76,7 +76,7 @@ function serialize(name, val, options) {
76
76
  throw new TypeError("argument val is invalid");
77
77
  }
78
78
  let str = name + "=" + value;
79
- if (opt.maxAge !== null) {
79
+ if (opt.maxAge) {
80
80
  let maxAge = opt.maxAge - 0;
81
81
  if (Number.isNaN(maxAge) || !isFinite(maxAge)) {
82
82
  throw new TypeError("option maxAge is invalid");
@@ -1,5 +1,5 @@
1
1
  import { createServerAdapter as createAdapter } from '@whatwg-node/server';
2
- import { type GraphQLSchema } from 'graphql';
2
+ import type { GraphQLSchema } from 'graphql';
3
3
  import { createYoga } from 'graphql-yoga';
4
4
  import type { HoudiniClient } from '../client';
5
5
  import type { RouterManifest, RouterPageManifest, YogaServerOptions } from './types';
@@ -23,9 +23,9 @@ __export(server_exports, {
23
23
  });
24
24
  module.exports = __toCommonJS(server_exports);
25
25
  var import_server = require("@whatwg-node/server");
26
- var import_graphql = require("graphql");
27
26
  var import_graphql_yoga = require("graphql-yoga");
28
27
  var import_config = require("../lib/config");
28
+ var import_cookies = require("./cookies");
29
29
  var import_match = require("./match");
30
30
  var import_session = require("./session");
31
31
  const config_file = (0, import_config.getCurrentConfig)();
@@ -44,19 +44,29 @@ function _serverHandler({
44
44
  yoga = (0, import_graphql_yoga.createYoga)({
45
45
  schema,
46
46
  landingPage: !production,
47
- graphqlEndpoint
47
+ graphqlEndpoint,
48
+ context: async (request) => await (0, import_session.get_session)(request.headers, session_keys)
48
49
  });
49
50
  }
50
51
  client.componentCache = componentCache;
51
52
  if (schema) {
52
53
  client.registerProxy(graphqlEndpoint, async ({ query, variables, session }) => {
53
- const parsed = (0, import_graphql.parse)(query);
54
- return await (0, import_graphql.execute)({
55
- schema,
56
- document: parsed,
57
- contextValue: session,
58
- variableValues: variables
59
- });
54
+ const response = await yoga(
55
+ new Request(`http://localhost/${graphqlEndpoint}`, {
56
+ method: "POST",
57
+ headers: {
58
+ "Content-Type": "application/json",
59
+ Cookie: (0, import_cookies.serialize)(import_session.session_cookie_name, JSON.stringify(session ?? {}), {
60
+ httpOnly: true
61
+ })
62
+ },
63
+ body: JSON.stringify({
64
+ query,
65
+ variables
66
+ })
67
+ })
68
+ );
69
+ return await response.json();
60
70
  });
61
71
  }
62
72
  return async (request) => {
@@ -17,5 +17,6 @@ export type ServerResponse = {
17
17
  redirect(url: string, status?: number): void;
18
18
  set_header(name: string, value: string): void;
19
19
  };
20
+ export declare const session_cookie_name = "__houdini__";
20
21
  export declare function get_session(req: Headers, secrets: string[]): Promise<App.Session>;
21
22
  export {};
@@ -19,7 +19,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
19
19
  var session_exports = {};
20
20
  __export(session_exports, {
21
21
  get_session: () => get_session,
22
- handle_request: () => handle_request
22
+ handle_request: () => handle_request,
23
+ session_cookie_name: () => session_cookie_name
23
24
  });
24
25
  module.exports = __toCommonJS(session_exports);
25
26
  var import_cookies = require("./cookies");
@@ -91,5 +92,6 @@ async function get_session(req, secrets) {
91
92
  // Annotate the CommonJS export names for ESM import in node:
92
93
  0 && (module.exports = {
93
94
  get_session,
94
- handle_request
95
+ handle_request,
96
+ session_cookie_name
95
97
  });
@@ -45,7 +45,7 @@ class HoudiniClient {
45
45
  }
46
46
  this.throwOnError_operations = throwOnError?.operations ?? [];
47
47
  let serverPort = globalThis.process?.env?.HOUDINI_PORT ?? "5173";
48
- this.url = url ?? (globalThis.window ? "" : `https://localhost:${serverPort}`) + localApiEndpoint(getCurrentConfig());
48
+ this.url = url ?? (globalThis.window ? "" : `http://localhost:${serverPort}`) + localApiEndpoint(getCurrentConfig());
49
49
  this.throwOnError = throwOnError;
50
50
  this.fetchParams = fetchParams;
51
51
  this.pipeline = pipeline;
@@ -29,13 +29,13 @@ export declare function parse(str: string, options?: {
29
29
  *
30
30
  */
31
31
  export declare function serialize(name: string, val: string, options: {
32
- encode: boolean;
33
- maxAge: number;
34
- domain: string;
35
- path: string;
36
- expires: Date;
37
- httpOnly: boolean;
38
- priority: string | number;
39
- secure: boolean;
40
- sameSite: string | boolean;
32
+ encode?: boolean;
33
+ maxAge?: number;
34
+ domain?: string;
35
+ path?: string;
36
+ expires?: Date;
37
+ httpOnly?: boolean;
38
+ priority?: string | number;
39
+ secure?: boolean;
40
+ sameSite?: string | boolean;
41
41
  }): string;
@@ -52,7 +52,7 @@ function serialize(name, val, options) {
52
52
  throw new TypeError("argument val is invalid");
53
53
  }
54
54
  let str = name + "=" + value;
55
- if (opt.maxAge !== null) {
55
+ if (opt.maxAge) {
56
56
  let maxAge = opt.maxAge - 0;
57
57
  if (Number.isNaN(maxAge) || !isFinite(maxAge)) {
58
58
  throw new TypeError("option maxAge is invalid");
@@ -1,5 +1,5 @@
1
1
  import { createServerAdapter as createAdapter } from '@whatwg-node/server';
2
- import { type GraphQLSchema } from 'graphql';
2
+ import type { GraphQLSchema } from 'graphql';
3
3
  import { createYoga } from 'graphql-yoga';
4
4
  import type { HoudiniClient } from '../client';
5
5
  import type { RouterManifest, RouterPageManifest, YogaServerOptions } from './types';
@@ -1,9 +1,9 @@
1
1
  import { createServerAdapter as createAdapter } from "@whatwg-node/server";
2
- import { parse, execute } from "graphql";
3
2
  import { createYoga } from "graphql-yoga";
4
3
  import { localApiSessionKeys, localApiEndpoint, getCurrentConfig } from "../lib/config";
4
+ import { serialize as encodeCookie } from "./cookies";
5
5
  import { find_match } from "./match";
6
- import { get_session, handle_request } from "./session";
6
+ import { get_session, handle_request, session_cookie_name } from "./session";
7
7
  const config_file = getCurrentConfig();
8
8
  const session_keys = localApiSessionKeys(config_file);
9
9
  function _serverHandler({
@@ -20,19 +20,29 @@ function _serverHandler({
20
20
  yoga = createYoga({
21
21
  schema,
22
22
  landingPage: !production,
23
- graphqlEndpoint
23
+ graphqlEndpoint,
24
+ context: async (request) => await get_session(request.headers, session_keys)
24
25
  });
25
26
  }
26
27
  client.componentCache = componentCache;
27
28
  if (schema) {
28
29
  client.registerProxy(graphqlEndpoint, async ({ query, variables, session }) => {
29
- const parsed = parse(query);
30
- return await execute({
31
- schema,
32
- document: parsed,
33
- contextValue: session,
34
- variableValues: variables
35
- });
30
+ const response = await yoga(
31
+ new Request(`http://localhost/${graphqlEndpoint}`, {
32
+ method: "POST",
33
+ headers: {
34
+ "Content-Type": "application/json",
35
+ Cookie: encodeCookie(session_cookie_name, JSON.stringify(session ?? {}), {
36
+ httpOnly: true
37
+ })
38
+ },
39
+ body: JSON.stringify({
40
+ query,
41
+ variables
42
+ })
43
+ })
44
+ );
45
+ return await response.json();
36
46
  });
37
47
  }
38
48
  return async (request) => {
@@ -17,5 +17,6 @@ export type ServerResponse = {
17
17
  redirect(url: string, status?: number): void;
18
18
  set_header(name: string, value: string): void;
19
19
  };
20
+ export declare const session_cookie_name = "__houdini__";
20
21
  export declare function get_session(req: Headers, secrets: string[]): Promise<App.Session>;
21
22
  export {};
@@ -66,5 +66,6 @@ async function get_session(req, secrets) {
66
66
  }
67
67
  export {
68
68
  get_session,
69
- handle_request
69
+ handle_request,
70
+ session_cookie_name
70
71
  };
@@ -73026,7 +73026,8 @@ async function load_manifest(args) {
73026
73026
  const name = child.isDirectory() ? child.name : parse3(child.name).name;
73027
73027
  if (name === "+schema") {
73028
73028
  manifest.local_schema = true;
73029
- } else if (name === "+yoga") {
73029
+ }
73030
+ if (name === "+yoga") {
73030
73031
  manifest.local_yoga = true;
73031
73032
  }
73032
73033
  }
@@ -73019,7 +73019,8 @@ async function load_manifest(args) {
73019
73019
  const name = child.isDirectory() ? child.name : parse3(child.name).name;
73020
73020
  if (name === "+schema") {
73021
73021
  manifest.local_schema = true;
73022
- } else if (name === "+yoga") {
73022
+ }
73023
+ if (name === "+yoga") {
73023
73024
  manifest.local_yoga = true;
73024
73025
  }
73025
73026
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "houdini",
3
- "version": "2.0.0-next.5",
3
+ "version": "2.0.0-next.6",
4
4
  "description": "The disappearing GraphQL clients",
5
5
  "keywords": [
6
6
  "typescript",