@holo-js/adapter-next 0.3.16 → 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/runtime.d.ts +118 -10
- package/dist/runtime.mjs +3 -10
- package/package.json +15 -15
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<
|
|
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,
|
|
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 {
|
|
6
|
-
|
|
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
|
|
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.
|
|
3
|
+
"version": "0.3.17",
|
|
4
4
|
"description": "Holo-JS Framework - Next.js adapter",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -43,16 +43,16 @@
|
|
|
43
43
|
"test": "vitest --run"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@holo-js/adapter-shared": "
|
|
47
|
-
"@holo-js/config": "
|
|
48
|
-
"@holo-js/core": "
|
|
49
|
-
"@holo-js/validation": "
|
|
46
|
+
"@holo-js/adapter-shared": "catalog:",
|
|
47
|
+
"@holo-js/config": "catalog:",
|
|
48
|
+
"@holo-js/core": "catalog:",
|
|
49
|
+
"@holo-js/validation": "catalog:"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
|
-
"@holo-js/forms": "
|
|
53
|
-
"@holo-js/realtime": "
|
|
54
|
-
"next": "
|
|
55
|
-
"react": "
|
|
52
|
+
"@holo-js/forms": "catalog:",
|
|
53
|
+
"@holo-js/realtime": "catalog:",
|
|
54
|
+
"next": "catalog:",
|
|
55
|
+
"react": "catalog:"
|
|
56
56
|
},
|
|
57
57
|
"peerDependenciesMeta": {
|
|
58
58
|
"@holo-js/forms": {
|
|
@@ -63,12 +63,12 @@
|
|
|
63
63
|
}
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
|
-
"@holo-js/realtime": "
|
|
67
|
-
"@types/node": "
|
|
68
|
-
"next": "
|
|
69
|
-
"tsup": "
|
|
70
|
-
"typescript": "
|
|
71
|
-
"vitest": "
|
|
66
|
+
"@holo-js/realtime": "catalog:",
|
|
67
|
+
"@types/node": "catalog:",
|
|
68
|
+
"next": "catalog:",
|
|
69
|
+
"tsup": "catalog:",
|
|
70
|
+
"typescript": "catalog:",
|
|
71
|
+
"vitest": "catalog:"
|
|
72
72
|
},
|
|
73
73
|
"engines": {
|
|
74
74
|
"node": "^22.12.0 || ^24.0.0 || ^26.0.0"
|