houdini 2.0.0-next.5 → 2.0.0-next.7

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.
@@ -78120,8 +78120,7 @@ var Config = class {
78120
78120
  let {
78121
78121
  schema,
78122
78122
  schemaPath = "./schema.graphql",
78123
- // Hey! If you change this default, please also update it in `/packages/houdini-svelte/src/plugin/fsPatch.ts`
78124
- runtimeDir = "$houdini",
78123
+ runtimeDir = ".houdini",
78125
78124
  exclude = [],
78126
78125
  module: module2 = "esm",
78127
78126
  scalars,
@@ -89212,12 +89211,12 @@ async function packageJSON(targetPath, frameworkInfo) {
89212
89211
  }
89213
89212
  packageJSON2.devDependencies = {
89214
89213
  ...packageJSON2.devDependencies,
89215
- houdini: "^2.0.0-next.5"
89214
+ houdini: "^2.0.0-next.7"
89216
89215
  };
89217
89216
  if (frameworkInfo.framework === "svelte" || frameworkInfo.framework === "kit") {
89218
89217
  packageJSON2.devDependencies = {
89219
89218
  ...packageJSON2.devDependencies,
89220
- "houdini-svelte": "^3.0.0-next.8"
89219
+ "houdini-svelte": "^3.0.0-next.10"
89221
89220
  };
89222
89221
  } else {
89223
89222
  throw new Error(`Unmanaged framework: "${JSON.stringify(frameworkInfo)}"`);
@@ -78124,8 +78124,7 @@ var Config = class {
78124
78124
  let {
78125
78125
  schema,
78126
78126
  schemaPath = "./schema.graphql",
78127
- // Hey! If you change this default, please also update it in `/packages/houdini-svelte/src/plugin/fsPatch.ts`
78128
- runtimeDir = "$houdini",
78127
+ runtimeDir = ".houdini",
78129
78128
  exclude = [],
78130
78129
  module = "esm",
78131
78130
  scalars,
@@ -89216,12 +89215,12 @@ async function packageJSON(targetPath, frameworkInfo) {
89216
89215
  }
89217
89216
  packageJSON2.devDependencies = {
89218
89217
  ...packageJSON2.devDependencies,
89219
- houdini: "^2.0.0-next.5"
89218
+ houdini: "^2.0.0-next.7"
89220
89219
  };
89221
89220
  if (frameworkInfo.framework === "svelte" || frameworkInfo.framework === "kit") {
89222
89221
  packageJSON2.devDependencies = {
89223
89222
  ...packageJSON2.devDependencies,
89224
- "houdini-svelte": "^3.0.0-next.8"
89223
+ "houdini-svelte": "^3.0.0-next.10"
89225
89224
  };
89226
89225
  } else {
89227
89226
  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;
@@ -77875,8 +77876,7 @@ var Config = class {
77875
77876
  let {
77876
77877
  schema,
77877
77878
  schemaPath = "./schema.graphql",
77878
- // Hey! If you change this default, please also update it in `/packages/houdini-svelte/src/plugin/fsPatch.ts`
77879
- runtimeDir = "$houdini",
77879
+ runtimeDir = ".houdini",
77880
77880
  exclude = [],
77881
77881
  module: module2 = "esm",
77882
77882
  scalars,
@@ -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;
@@ -77785,8 +77786,7 @@ var Config = class {
77785
77786
  let {
77786
77787
  schema,
77787
77788
  schemaPath = "./schema.graphql",
77788
- // Hey! If you change this default, please also update it in `/packages/houdini-svelte/src/plugin/fsPatch.ts`
77789
- runtimeDir = "$houdini",
77789
+ runtimeDir = ".houdini",
77790
77790
  exclude = [],
77791
77791
  module = "esm",
77792
77792
  scalars,
@@ -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
  };
@@ -65667,8 +65667,7 @@ var Config = class {
65667
65667
  let {
65668
65668
  schema,
65669
65669
  schemaPath = "./schema.graphql",
65670
- // Hey! If you change this default, please also update it in `/packages/houdini-svelte/src/plugin/fsPatch.ts`
65671
- runtimeDir = "$houdini",
65670
+ runtimeDir = ".houdini",
65672
65671
  exclude = [],
65673
65672
  module: module2 = "esm",
65674
65673
  scalars,
@@ -65663,8 +65663,7 @@ var Config = class {
65663
65663
  let {
65664
65664
  schema,
65665
65665
  schemaPath = "./schema.graphql",
65666
- // Hey! If you change this default, please also update it in `/packages/houdini-svelte/src/plugin/fsPatch.ts`
65667
- runtimeDir = "$houdini",
65666
+ runtimeDir = ".houdini",
65668
65667
  exclude = [],
65669
65668
  module = "esm",
65670
65669
  scalars,
@@ -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
  }
@@ -75771,8 +75772,7 @@ var Config = class {
75771
75772
  let {
75772
75773
  schema,
75773
75774
  schemaPath = "./schema.graphql",
75774
- // Hey! If you change this default, please also update it in `/packages/houdini-svelte/src/plugin/fsPatch.ts`
75775
- runtimeDir = "$houdini",
75775
+ runtimeDir = ".houdini",
75776
75776
  exclude = [],
75777
75777
  module: module2 = "esm",
75778
75778
  scalars,
@@ -85781,7 +85781,7 @@ function Plugin(opts = {}) {
85781
85781
  async hotUpdate({ file, server, modules, timestamp }) {
85782
85782
  const config2 = await getConfig(opts);
85783
85783
  const shouldReact = await shouldReactToFileChange(file, config2);
85784
- const runtimeDir = path_exports.join(config2.projectRoot, config2.runtimeDir ?? "$houdini");
85784
+ const runtimeDir = path_exports.join(config2.projectRoot, config2.runtimeDir ?? ".houdini");
85785
85785
  const isGqlFile = isGraphQLFile(file);
85786
85786
  if (!(shouldReact && (fileDependsOnHoudini(modules, runtimeDir) || isGqlFile))) {
85787
85787
  return modules;
@@ -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
  }
@@ -75763,8 +75764,7 @@ var Config = class {
75763
75764
  let {
75764
75765
  schema,
75765
75766
  schemaPath = "./schema.graphql",
75766
- // Hey! If you change this default, please also update it in `/packages/houdini-svelte/src/plugin/fsPatch.ts`
75767
- runtimeDir = "$houdini",
75767
+ runtimeDir = ".houdini",
75768
75768
  exclude = [],
75769
75769
  module = "esm",
75770
75770
  scalars,
@@ -85773,7 +85773,7 @@ function Plugin(opts = {}) {
85773
85773
  async hotUpdate({ file, server, modules, timestamp }) {
85774
85774
  const config2 = await getConfig(opts);
85775
85775
  const shouldReact = await shouldReactToFileChange(file, config2);
85776
- const runtimeDir = path_exports.join(config2.projectRoot, config2.runtimeDir ?? "$houdini");
85776
+ const runtimeDir = path_exports.join(config2.projectRoot, config2.runtimeDir ?? ".houdini");
85777
85777
  const isGqlFile = isGraphQLFile(file);
85778
85778
  if (!(shouldReact && (fileDependsOnHoudini(modules, runtimeDir) || isGqlFile))) {
85779
85779
  return modules;
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.7",
4
4
  "description": "The disappearing GraphQL clients",
5
5
  "keywords": [
6
6
  "typescript",