@holo-js/adapter-next 0.3.15 → 0.3.17

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.
package/dist/client.d.ts CHANGED
@@ -1,12 +1,13 @@
1
- import { FormSchema, InferFormData } from '@holo-js/forms';
1
+ import { InferFormData } from '@holo-js/forms';
2
+ import { ValidationSchema } from '@holo-js/validation';
2
3
  import { UseFormOptions, ClientSubmitContext, ClientSubmitResult, UseFormResult, InferFormFieldTree } from '@holo-js/forms/internal/client';
3
- export { ClientSubmitContext, ClientSubmitResult, FormFieldState, FormFieldTree, UseFormOptions, UseFormResult, ValidateOnMode } from '@holo-js/forms/internal/client';
4
+ export { ClientCsrfOptions, ClientSubmitContext, ClientSubmitResult, FormFieldState, FormFieldTree, FormRequestCredentials, UseFormOptions, UseFormResult, ValidateOnMode } from '@holo-js/forms/internal/client';
4
5
 
5
6
  declare function isNextRedirectError(error: unknown): boolean;
6
7
  declare function createSubmitterBridge<TData, TSuccess>(optionsRef: {
7
8
  current: UseFormOptions<TData, TSuccess> | undefined;
8
9
  }, onHttpError: (error: Error) => void): (context: ClientSubmitContext<TData>) => Promise<ClientSubmitResult<TData, TSuccess> | void> | ClientSubmitResult<TData, TSuccess> | void;
9
- declare function useForm<TSchema extends FormSchema, TSuccess = unknown>(schemaDefinition: TSchema, options?: UseFormOptions<InferFormData<TSchema>, TSuccess>): UseFormResult<InferFormData<TSchema>, TSuccess, InferFormFieldTree<TSchema>>;
10
+ declare function useForm<TSchema extends ValidationSchema, TSuccess = unknown>(schemaDefinition: TSchema, options?: UseFormOptions<InferFormData<TSchema>, TSuccess>): UseFormResult<InferFormData<TSchema>, TSuccess, InferFormFieldTree<TSchema>>;
10
11
  declare const adapterNextClientInternals: {
11
12
  isNextRedirectError: typeof isNextRedirectError;
12
13
  createSubmitterBridge: typeof createSubmitterBridge;
package/dist/client.mjs CHANGED
@@ -35,7 +35,7 @@ function areEqual(left, right) {
35
35
  return false;
36
36
  }
37
37
  function areOptionsEqual(left, right) {
38
- return left.action === right.action && left.method === right.method && left.validateOn === right.validateOn && Boolean(left.submitter) === Boolean(right.submitter) && areEqual(left.initialValues, right.initialValues) && areEqual(left.initialState, right.initialState);
38
+ return left.action === right.action && left.method === right.method && left.credentials === right.credentials && left.csrf?.endpoint === right.csrf?.endpoint && left.validateOn === right.validateOn && Boolean(left.submitter) === Boolean(right.submitter) && areEqual(left.initialValues, right.initialValues) && areEqual(left.initialState, right.initialState);
39
39
  }
40
40
  function isNextRedirectError(error) {
41
41
  if (!error || typeof error !== "object" && typeof error !== "function" || !("digest" in error)) {
package/dist/config.mjs CHANGED
@@ -45,6 +45,8 @@ var HOLO_TRANSPILED_PACKAGE_SET = new Set(HOLO_TRANSPILED_PACKAGES);
45
45
  var NEXT_AUTH_INTERRUPTS_ENV = "__NEXT_EXPERIMENTAL_AUTH_INTERRUPTS";
46
46
  var CORE_RUNTIME_CHUNK_PATH = /packages[\\/]core[\\/]dist[\\/].+\.mjs$/;
47
47
  var OPTIONAL_RUNTIME_IMPORT_ISSUE = /Module not found: Can't resolve (?:'@holo-js\/storage-s3'|<dynamic>)/;
48
+ var HOLO_RUNTIME_FILESYSTEM_PATH = /(?:packages|node_modules[\\/]@holo-js)[\\/](?:core|kernel|media)[\\/]dist[\\/].+\.mjs$/;
49
+ var DYNAMIC_FILESYSTEM_ACCESS_ISSUE = /Dynamic filesystem access causes tracing of the whole project/;
48
50
  var PACKAGE_DEPENDENCY_FIELDS = [
49
51
  "dependencies",
50
52
  "devDependencies",
@@ -177,6 +179,10 @@ function withHolo(nextConfig = {}) {
177
179
  {
178
180
  path: /next\.config\.(ts|mjs|js)$/,
179
181
  title: /Encountered unexpected file in NFT list/
182
+ },
183
+ {
184
+ path: HOLO_RUNTIME_FILESYSTEM_PATH,
185
+ title: DYNAMIC_FILESYSTEM_ACCESS_ISSUE
180
186
  }
181
187
  ]
182
188
  };
package/dist/runtime.d.ts CHANGED
@@ -2,15 +2,123 @@ import * as _holo_js_core_runtime from '@holo-js/core/runtime';
2
2
  import { CreateHoloOptions } from '@holo-js/core/runtime';
3
3
  import * as _holo_js_config from '@holo-js/config';
4
4
  import { HoloConfigMap, DotPath, HoloConfigValues, ValueAtPath } from '@holo-js/config';
5
+ import { NextRequestLike } from '@holo-js/adapter-shared/next/request-context';
6
+ export { NextRequestLike } from '@holo-js/adapter-shared/next/request-context';
7
+
8
+ interface NormalizedHoloRedisClusterNodeConfig {
9
+ readonly url?: string;
10
+ readonly socketPath?: string;
11
+ readonly host: string;
12
+ readonly port: number;
13
+ }
14
+
15
+ type SessionCookieSameSite = 'lax' | 'strict' | 'none';
16
+ declare module '@holo-js/config' {
17
+ interface HoloConfigRegistry {
18
+ session: NormalizedHoloSessionConfig;
19
+ }
20
+ }
21
+ interface NormalizedHoloSessionCookieConfig {
22
+ readonly name: string;
23
+ readonly path: string;
24
+ readonly domain?: string;
25
+ readonly secure: boolean;
26
+ readonly httpOnly: boolean;
27
+ readonly sameSite: SessionCookieSameSite;
28
+ readonly partitioned: boolean;
29
+ readonly maxAge: number;
30
+ }
31
+ interface NormalizedSessionFileStoreConfig {
32
+ readonly name: string;
33
+ readonly driver: 'file';
34
+ readonly path: string;
35
+ }
36
+ interface NormalizedSessionDatabaseStoreConfig {
37
+ readonly name: string;
38
+ readonly driver: 'database';
39
+ readonly connection: string;
40
+ readonly table: string;
41
+ }
42
+ interface NormalizedSessionRedisStoreConfig {
43
+ readonly name: string;
44
+ readonly driver: 'redis';
45
+ readonly connection: string;
46
+ readonly url?: string;
47
+ readonly clusters?: readonly NormalizedHoloRedisClusterNodeConfig[];
48
+ readonly host: string;
49
+ readonly port: number;
50
+ readonly username?: string;
51
+ readonly password?: string;
52
+ readonly db: number;
53
+ readonly prefix: string;
54
+ }
55
+ type NormalizedSessionStoreConfig = NormalizedSessionFileStoreConfig | NormalizedSessionDatabaseStoreConfig | NormalizedSessionRedisStoreConfig;
56
+ interface NormalizedHoloSessionConfig {
57
+ readonly driver: string;
58
+ readonly stores: Readonly<Record<string, NormalizedSessionStoreConfig>>;
59
+ readonly cookie: NormalizedHoloSessionCookieConfig;
60
+ readonly idleTimeout: number;
61
+ readonly absoluteLifetime: number;
62
+ readonly rememberMeLifetime: number;
63
+ }
64
+
65
+ interface CreateSessionInput {
66
+ readonly store?: string;
67
+ readonly data?: Readonly<Record<string, unknown>>;
68
+ readonly id?: string;
69
+ readonly name?: string;
70
+ readonly value?: Readonly<Record<string, unknown>>;
71
+ }
72
+ interface ReadSessionOptions {
73
+ readonly store?: string;
74
+ }
75
+ interface TouchSessionOptions {
76
+ readonly store?: string;
77
+ }
78
+ interface RotateSessionOptions {
79
+ readonly store?: string;
80
+ readonly newId?: string;
81
+ readonly data?: SessionRecord['data'];
82
+ readonly renewLifetime?: boolean;
83
+ }
84
+ interface RememberTokenOptions {
85
+ readonly store?: string;
86
+ }
87
+ interface SessionRecord {
88
+ readonly id: string;
89
+ readonly store: string;
90
+ readonly data: Readonly<Record<string, unknown>>;
91
+ readonly createdAt: Date;
92
+ readonly lastActivityAt: Date;
93
+ readonly expiresAt: Date;
94
+ readonly rememberTokenHash?: string;
95
+ }
96
+ interface CookieSerializeOptions {
97
+ readonly path?: string;
98
+ readonly domain?: string;
99
+ readonly secure?: boolean;
100
+ readonly httpOnly?: boolean;
101
+ readonly sameSite?: SessionCookieSameSite;
102
+ readonly partitioned?: boolean;
103
+ readonly maxAge?: number;
104
+ readonly expires?: Date;
105
+ }
106
+ interface SessionRuntimeFacade {
107
+ create(input?: CreateSessionInput): Promise<SessionRecord>;
108
+ write(record: SessionRecord): Promise<SessionRecord>;
109
+ read(sessionId: string, options?: ReadSessionOptions): Promise<SessionRecord | null>;
110
+ rotate(sessionId: string, options?: RotateSessionOptions): Promise<SessionRecord>;
111
+ invalidate(sessionId: string, options?: ReadSessionOptions): Promise<void>;
112
+ touch(sessionId: string, options?: TouchSessionOptions): Promise<SessionRecord | null>;
113
+ issueRememberMeToken(sessionId: string, options?: RememberTokenOptions): Promise<string>;
114
+ consumeRememberMeToken(token: string, options?: RememberTokenOptions): Promise<SessionRecord | null>;
115
+ flash(sessionId: string, key: string, value: unknown, options?: ReadSessionOptions): Promise<void>;
116
+ take<TValue = unknown>(sessionId: string, key: string, options?: ReadSessionOptions): Promise<TValue | undefined>;
117
+ cookie(name: string, value: string, options?: CookieSerializeOptions): string;
118
+ sessionCookie(value: string, options?: CookieSerializeOptions): string;
119
+ rememberMeCookie(value: string, options?: CookieSerializeOptions): string;
120
+ }
5
121
 
6
- type NextRequestLike = {
7
- readonly cookies: {
8
- get(name: string): {
9
- readonly value: string;
10
- } | undefined;
11
- };
12
- readonly headers: Headers;
13
- };
14
122
  declare function runWithNextRequest<TValue>(request: NextRequestLike, callback: () => TValue): TValue;
15
123
 
16
124
  type NextHoloRuntimeOptions = CreateHoloOptions & {
@@ -51,7 +159,7 @@ declare function createNextHoloHelpers<TCustom extends HoloConfigMap = HoloConfi
51
159
  registry: _holo_js_core_runtime.GeneratedProjectRegistry | undefined;
52
160
  runtime: _holo_js_core_runtime.HoloRuntime<TCustom>;
53
161
  }>;
54
- getSession(): Promise<_holo_js_core_runtime.HoloSessionRuntimeBinding | undefined>;
162
+ getSession(): Promise<SessionRuntimeFacade | undefined>;
55
163
  getAuth(): Promise<_holo_js_core_runtime.HoloAuthRuntimeBinding | undefined>;
56
164
  useConfig: <TPath extends DotPath<HoloConfigValues<TCustom>>>(path: TPath) => Promise<ValueAtPath<HoloConfigValues<TCustom>, TPath>>;
57
165
  config: <TPath extends DotPath<HoloConfigValues<TCustom>>>(path: TPath) => Promise<ValueAtPath<HoloConfigValues<TCustom>, TPath>>;
@@ -65,4 +173,4 @@ declare const adapterNextRuntimeInternals: {
65
173
  createNextHttpAccessFallbackError: typeof createNextHttpAccessFallbackError;
66
174
  };
67
175
 
68
- export { type NextHoloRuntimeOptions, type NextRequestLike, adapterNextRuntimeInternals, createNextHoloHelpers, createNextRequestContext, runWithNextRequest };
176
+ export { type NextHoloRuntimeOptions, adapterNextRuntimeInternals, createNextHoloHelpers, createNextRequestContext, runWithNextRequest };
package/dist/runtime.mjs CHANGED
@@ -2,17 +2,10 @@
2
2
  import { initializeHolo } from "@holo-js/core/runtime";
3
3
 
4
4
  // src/request-context.ts
5
- import { AsyncLocalStorage } from "async_hooks";
6
- function getNextRequestStore() {
7
- const globals = globalThis;
8
- globals.__holoNextAuthRequestStore ??= new AsyncLocalStorage();
9
- return globals.__holoNextAuthRequestStore;
10
- }
11
- function getCurrentNextRequest() {
12
- return getNextRequestStore().getStore();
13
- }
5
+ import { runWithNextRequest as runWithSharedNextRequest } from "@holo-js/adapter-shared/next/request-context";
6
+ import { getCurrentNextRequest } from "@holo-js/adapter-shared/next/request-context";
14
7
  function runWithNextRequest(request, callback) {
15
- return getNextRequestStore().run(request, () => {
8
+ return runWithSharedNextRequest(request, () => {
16
9
  const runner = globalThis.__holoNextAuthRequestRunner;
17
10
  return runner ? runner(callback) : callback();
18
11
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@holo-js/adapter-next",
3
- "version": "0.3.15",
3
+ "version": "0.3.17",
4
4
  "description": "Holo-JS Framework - Next.js adapter",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -43,15 +43,16 @@
43
43
  "test": "vitest --run"
44
44
  },
45
45
  "dependencies": {
46
- "@holo-js/adapter-shared": "^0.3.15",
47
- "@holo-js/config": "^0.3.15",
48
- "@holo-js/core": "^0.3.15"
46
+ "@holo-js/adapter-shared": "catalog:",
47
+ "@holo-js/config": "catalog:",
48
+ "@holo-js/core": "catalog:",
49
+ "@holo-js/validation": "catalog:"
49
50
  },
50
51
  "peerDependencies": {
51
- "@holo-js/forms": "^0.3.15",
52
- "@holo-js/realtime": "^0.3.15",
53
- "next": "^16.2.4",
54
- "react": "^19.2.6"
52
+ "@holo-js/forms": "catalog:",
53
+ "@holo-js/realtime": "catalog:",
54
+ "next": "catalog:",
55
+ "react": "catalog:"
55
56
  },
56
57
  "peerDependenciesMeta": {
57
58
  "@holo-js/forms": {
@@ -62,14 +63,14 @@
62
63
  }
63
64
  },
64
65
  "devDependencies": {
65
- "@holo-js/realtime": "^0.3.15",
66
- "@types/node": "^22.10.2",
67
- "next": "^16.2.4",
68
- "tsup": "^8.3.5",
69
- "typescript": "^5.7.2",
70
- "vitest": "^4.1.5"
66
+ "@holo-js/realtime": "catalog:",
67
+ "@types/node": "catalog:",
68
+ "next": "catalog:",
69
+ "tsup": "catalog:",
70
+ "typescript": "catalog:",
71
+ "vitest": "catalog:"
71
72
  },
72
73
  "engines": {
73
- "node": ">=22.12.0"
74
+ "node": "^22.12.0 || ^24.0.0 || ^26.0.0"
74
75
  }
75
76
  }