@monocloud/auth-node-core 0.1.6 → 0.1.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.
- package/dist/index.d.mts +34 -15
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -14,7 +14,11 @@ interface CookieOptions extends SerializeOptions$1 {}
|
|
|
14
14
|
* @category Types
|
|
15
15
|
*/
|
|
16
16
|
interface IMonoCloudCookieRequest {
|
|
17
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* Retrieves a single cookie value by name.
|
|
19
|
+
*
|
|
20
|
+
* @param name - The name of the cookie to retrieve.
|
|
21
|
+
*/
|
|
18
22
|
getCookie(name: string): Promise<string | undefined>;
|
|
19
23
|
/** Retrieves all cookies from the request. */
|
|
20
24
|
getAllCookies(): Promise<Map<string, string>>;
|
|
@@ -25,7 +29,11 @@ interface IMonoCloudCookieRequest {
|
|
|
25
29
|
* @category Types
|
|
26
30
|
*/
|
|
27
31
|
interface MonoCloudRequest extends IMonoCloudCookieRequest {
|
|
28
|
-
/**
|
|
32
|
+
/**
|
|
33
|
+
* Retrieves a query parameter value by name.
|
|
34
|
+
*
|
|
35
|
+
* @param parameter - The name of the query parameter to retrieve.
|
|
36
|
+
*/
|
|
29
37
|
getQuery(parameter: string): string | string[] | undefined;
|
|
30
38
|
/** Returns the raw request details including method, URL, and body. */
|
|
31
39
|
getRawRequest(): Promise<{
|
|
@@ -40,7 +48,13 @@ interface MonoCloudRequest extends IMonoCloudCookieRequest {
|
|
|
40
48
|
* @category Types
|
|
41
49
|
*/
|
|
42
50
|
interface IMonoCloudCookieResponse {
|
|
43
|
-
/**
|
|
51
|
+
/**
|
|
52
|
+
* Sets a cookie on the response.
|
|
53
|
+
*
|
|
54
|
+
* @param cookieName - The name of the cookie to set.
|
|
55
|
+
* @param value - The value to assign to the cookie.
|
|
56
|
+
* @param options - Serialization options for the cookie.
|
|
57
|
+
*/
|
|
44
58
|
setCookie(cookieName: string, value: string, options: CookieOptions): Promise<void>;
|
|
45
59
|
}
|
|
46
60
|
/**
|
|
@@ -49,9 +63,19 @@ interface IMonoCloudCookieResponse {
|
|
|
49
63
|
* @category Types
|
|
50
64
|
*/
|
|
51
65
|
interface MonoCloudResponse extends IMonoCloudCookieResponse {
|
|
52
|
-
/**
|
|
66
|
+
/**
|
|
67
|
+
* Redirects the client to the specified URL.
|
|
68
|
+
*
|
|
69
|
+
* @param url - The URL to redirect to.
|
|
70
|
+
* @param statusCode - The HTTP status code to use for the redirect.
|
|
71
|
+
*/
|
|
53
72
|
redirect(url: string, statusCode?: number): void;
|
|
54
|
-
/**
|
|
73
|
+
/**
|
|
74
|
+
* Sends a JSON response with an optional status code.
|
|
75
|
+
*
|
|
76
|
+
* @param data - The data to serialize and send as JSON.
|
|
77
|
+
* @param statusCode - The HTTP status code for the response.
|
|
78
|
+
*/
|
|
55
79
|
sendJson(data: any, statusCode?: number): void;
|
|
56
80
|
/** Sends a 404 Not Found response. */
|
|
57
81
|
notFound(): void;
|
|
@@ -166,10 +190,7 @@ interface MonoCloudSessionStore {
|
|
|
166
190
|
*/
|
|
167
191
|
interface MonoCloudCookieOptions {
|
|
168
192
|
/**
|
|
169
|
-
* The cookie name.
|
|
170
|
-
*
|
|
171
|
-
* - Session cookie default: `"session"`
|
|
172
|
-
* - State cookie default: `"state"`
|
|
193
|
+
* The cookie name. Defaults to `"session"` for session cookies and `"state"` for state cookies.
|
|
173
194
|
*/
|
|
174
195
|
name: string;
|
|
175
196
|
/**
|
|
@@ -185,7 +206,7 @@ interface MonoCloudCookieOptions {
|
|
|
185
206
|
/**
|
|
186
207
|
* Indicates whether the cookie is accessible only via HTTP requests. Helps mitigate XSS attacks by preventing client-side JavaScript access.
|
|
187
208
|
*
|
|
188
|
-
*
|
|
209
|
+
* Always enforced as `true` for state cookies.
|
|
189
210
|
*
|
|
190
211
|
* @defaultValue true
|
|
191
212
|
*/
|
|
@@ -204,9 +225,7 @@ interface MonoCloudCookieOptions {
|
|
|
204
225
|
sameSite: SameSiteValues;
|
|
205
226
|
/**
|
|
206
227
|
* Determines whether the cookie persists across browser restarts.
|
|
207
|
-
*
|
|
208
|
-
* - Session cookies default to `true`
|
|
209
|
-
* - State cookies default to `false`
|
|
228
|
+
* Defaults to `true` for session cookies and `false` for state cookies.
|
|
210
229
|
*/
|
|
211
230
|
persistent: boolean;
|
|
212
231
|
}
|
|
@@ -235,8 +254,8 @@ interface MonoCloudSessionOptionsBase {
|
|
|
235
254
|
/**
|
|
236
255
|
* The session lifetime in seconds.
|
|
237
256
|
*
|
|
238
|
-
*
|
|
239
|
-
*
|
|
257
|
+
* With **absolute sessions** (`sliding = false`), this defines the total session lifetime.
|
|
258
|
+
* With **sliding sessions**, this defines the idle timeout before the session expires.
|
|
240
259
|
*
|
|
241
260
|
* @defaultValue 86400 (1 Day)
|
|
242
261
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@monocloud/auth-node-core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"description": "MonoCloud NodeJS Authentication Core SDK",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"monocloud",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"joi": "18.0.2",
|
|
57
57
|
"jose": "6.1.3",
|
|
58
58
|
"uuid": "13.0.0",
|
|
59
|
-
"@monocloud/auth-core": "0.1.
|
|
59
|
+
"@monocloud/auth-core": "0.1.6"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@types/debug": "4.1.12",
|