@strivacity/sdk-angular 3.0.2 → 4.0.0-beta.0
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/CHANGELOG.md +7 -0
- package/README.md +1991 -609
- package/dist/README.md +1991 -609
- package/dist/fesm2022/strivacity-sdk-angular-src-server.mjs +221 -0
- package/dist/fesm2022/strivacity-sdk-angular-src-server.mjs.map +1 -0
- package/dist/fesm2022/strivacity-sdk-angular-src-types.mjs +6 -0
- package/dist/fesm2022/strivacity-sdk-angular-src-types.mjs.map +1 -0
- package/dist/fesm2022/strivacity-sdk-angular.mjs +284 -498
- package/dist/fesm2022/strivacity-sdk-angular.mjs.map +1 -1
- package/dist/types/strivacity-sdk-angular-src-server.d.ts +82 -0
- package/dist/types/strivacity-sdk-angular-src-types.d.ts +41 -0
- package/dist/types/strivacity-sdk-angular.d.ts +147 -0
- package/eslint.config.mjs +31 -0
- package/ng-package.json +3 -3
- package/package.json +29 -11
- package/project.json +33 -0
- package/src/index.ts +8 -0
- package/src/lib/services/auth.service.ts +131 -0
- package/src/lib/services/index.ts +2 -0
- package/src/lib/services/native-login.service.ts +172 -0
- package/src/lib/storages.ts +12 -0
- package/src/lib/utils.ts +39 -0
- package/src/server/errors.ts +1 -0
- package/src/server/index.ts +6 -0
- package/src/server/ng-package.json +6 -0
- package/src/server/sdk.ts +113 -0
- package/src/server/session.ts +30 -0
- package/src/server/storages.ts +25 -0
- package/src/server/types.ts +32 -0
- package/src/server/utils.ts +74 -0
- package/src/types/index.ts +47 -0
- package/src/types/ng-package.json +6 -0
- package/testing/setup.ts +10 -0
- package/testing/tests/auth.service.spec.ts +236 -0
- package/testing/tests/index.spec.ts +193 -0
- package/testing/tests/native-login.service.spec.ts +311 -0
- package/testing/tests/server/errors.spec.ts +14 -0
- package/testing/tests/server/sdk.spec.ts +197 -0
- package/testing/tests/server/session.spec.ts +52 -0
- package/testing/tests/server/storages.spec.ts +58 -0
- package/testing/tests/server/utils.spec.ts +112 -0
- package/testing/tests/storages.spec.ts +31 -0
- package/testing/tests/utils.spec.ts +24 -0
- package/testing/utils/testbed.ts +26 -0
- package/tsconfig.lib.json +13 -0
- package/tsconfig.lib.prod.json +9 -0
- package/tsconfig.spec.json +8 -0
- package/vite.config.mts +11 -0
- package/dist/index.d.ts +0 -5
- package/dist/lib/components/login-renderer.component.d.ts +0 -38
- package/dist/lib/components/widget-renderer.component.d.ts +0 -16
- package/dist/lib/services/auth.service.d.ts +0 -93
- package/dist/lib/services/widget.service.d.ts +0 -25
- package/dist/lib/strivacity-auth.module.d.ts +0 -10
- package/dist/lib/utils/helpers.d.ts +0 -16
- package/dist/lib/utils/types.d.ts +0 -41
- package/dist/public-api.d.ts +0 -16
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
export * from '@strivacity/sdk-core/utils/errors';
|
|
2
|
+
import { Router } from 'express';
|
|
3
|
+
import { createBaseServerSDK } from '@strivacity/sdk-core/server';
|
|
4
|
+
import { Readable } from 'node:stream';
|
|
5
|
+
export * from '@strivacity/sdk-core/utils';
|
|
6
|
+
import { makeStateKey, provideAppInitializer, inject, REQUEST, TransferState } from '@angular/core';
|
|
7
|
+
import { createSessionIdCookieStorage as createSessionIdCookieStorage$1 } from '@strivacity/sdk-core/storages/server';
|
|
8
|
+
export * from '@strivacity/sdk-core/storages';
|
|
9
|
+
export * from '@strivacity/sdk-core/types';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Converts an incoming Express request (or an already-standard `Request`, e.g. Angular's SSR `REQUEST` token) into a standard Web `Request`.
|
|
13
|
+
*
|
|
14
|
+
* @param {AngularServerRequest} req - The incoming request.
|
|
15
|
+
* @returns {Request} The equivalent Web `Request` object.
|
|
16
|
+
*/
|
|
17
|
+
function toWebRequest(req) {
|
|
18
|
+
if (req instanceof Request) {
|
|
19
|
+
return req;
|
|
20
|
+
}
|
|
21
|
+
const url = new URL(req.originalUrl, `${req.protocol}://${req.get('host')}`);
|
|
22
|
+
const headers = new Headers();
|
|
23
|
+
for (const [key, value] of Object.entries(req.headers)) {
|
|
24
|
+
if (value === undefined) {
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
27
|
+
for (const v of Array.isArray(value) ? value : [value]) {
|
|
28
|
+
headers.append(key, v);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
const hasBody = req.method !== 'GET' && req.method !== 'HEAD';
|
|
32
|
+
return new Request(url, {
|
|
33
|
+
method: req.method,
|
|
34
|
+
headers,
|
|
35
|
+
...(hasBody ? { body: Readable.toWeb(req), duplex: 'half' } : {}),
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Writes a standard Web `Response` (built by the shared server SDK core) onto the Express response.
|
|
40
|
+
*
|
|
41
|
+
* @param {Response} response - The `Response` to write.
|
|
42
|
+
* @param {ExpressResponse} res - The Express response to write to.
|
|
43
|
+
*/
|
|
44
|
+
async function applyResponse(response, res) {
|
|
45
|
+
res.status(response.status);
|
|
46
|
+
for (const [key, value] of response.headers.entries()) {
|
|
47
|
+
if (key.toLowerCase() === 'set-cookie') {
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
res.setHeader(key, value);
|
|
51
|
+
}
|
|
52
|
+
const setCookies = response.headers.getSetCookie();
|
|
53
|
+
if (setCookies.length) {
|
|
54
|
+
res.setHeader('set-cookie', setCookies);
|
|
55
|
+
}
|
|
56
|
+
if (!response.body) {
|
|
57
|
+
res.end();
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
await new Promise((resolve, reject) => {
|
|
61
|
+
Readable.fromWeb(response.body)
|
|
62
|
+
.pipe(res)
|
|
63
|
+
.on('finish', resolve)
|
|
64
|
+
.on('error', reject);
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function getRouteHandlers(base) {
|
|
69
|
+
const router = Router();
|
|
70
|
+
router.get('/login', async (req, res, next) => {
|
|
71
|
+
try {
|
|
72
|
+
const response = await base.handleLogin(req);
|
|
73
|
+
await applyResponse(response, res);
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
next(error);
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
router.get('/register', async (req, res, next) => {
|
|
80
|
+
try {
|
|
81
|
+
const response = await base.handleRegister(req);
|
|
82
|
+
await applyResponse(response, res);
|
|
83
|
+
}
|
|
84
|
+
catch (error) {
|
|
85
|
+
next(error);
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
router.get('/callback', async (req, res, next) => {
|
|
89
|
+
try {
|
|
90
|
+
const response = await base.handleCallback(req);
|
|
91
|
+
await applyResponse(response, res);
|
|
92
|
+
}
|
|
93
|
+
catch (error) {
|
|
94
|
+
next(error);
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
router.get('/refresh', async (req, res, next) => {
|
|
98
|
+
try {
|
|
99
|
+
const response = await base.handleRefresh(req);
|
|
100
|
+
await applyResponse(response, res);
|
|
101
|
+
}
|
|
102
|
+
catch (error) {
|
|
103
|
+
next(error);
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
router.get('/revoke', async (req, res, next) => {
|
|
107
|
+
try {
|
|
108
|
+
const response = await base.handleRevoke(req);
|
|
109
|
+
await applyResponse(response, res);
|
|
110
|
+
}
|
|
111
|
+
catch (error) {
|
|
112
|
+
next(error);
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
router.get('/entry', async (req, res, next) => {
|
|
116
|
+
try {
|
|
117
|
+
const response = await base.handleEntry(req);
|
|
118
|
+
await applyResponse(response, res);
|
|
119
|
+
}
|
|
120
|
+
catch (error) {
|
|
121
|
+
next(error);
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
router.get('/logout', async (req, res, next) => {
|
|
125
|
+
try {
|
|
126
|
+
const response = await base.handleLogout(req);
|
|
127
|
+
await applyResponse(response, res);
|
|
128
|
+
}
|
|
129
|
+
catch (error) {
|
|
130
|
+
next(error);
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
router.post('/backchannel-logout', async (req, res, next) => {
|
|
134
|
+
try {
|
|
135
|
+
const response = await base.handleBackChannelLogout(req);
|
|
136
|
+
await applyResponse(response, res);
|
|
137
|
+
}
|
|
138
|
+
catch (error) {
|
|
139
|
+
next(error);
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
return router;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Creates the server-side Strivacity SDK: an Express router exposing the auth endpoints and session helpers that can be reused elsewhere on the server.
|
|
146
|
+
*
|
|
147
|
+
* @param {AngularServerSDKInitConfig} initConfig - The SDK configuration options.
|
|
148
|
+
* @returns {AngularServerSDK} The server-side SDK instance.
|
|
149
|
+
*/
|
|
150
|
+
function createServerSDK(initConfig) {
|
|
151
|
+
const base = createBaseServerSDK({
|
|
152
|
+
toRequest: (req) => toWebRequest(req),
|
|
153
|
+
}, initConfig);
|
|
154
|
+
return {
|
|
155
|
+
get options() {
|
|
156
|
+
return base.options;
|
|
157
|
+
},
|
|
158
|
+
handlers: getRouteHandlers(base),
|
|
159
|
+
getSession: (req) => base.getSession(req),
|
|
160
|
+
updateSession: (session, req) => base.updateSession(session, req),
|
|
161
|
+
refreshSession: (req) => base.refreshSession(req),
|
|
162
|
+
revokeSession: (req) => base.revokeSession(req),
|
|
163
|
+
getEntrySession: (entryUrl) => base.getEntrySession(entryUrl),
|
|
164
|
+
completeLogin: (params, req) => base.completeLogin(params, req),
|
|
165
|
+
logout: (postLogoutRedirectUri, req) => base.logout(postLogoutRedirectUri, req),
|
|
166
|
+
handleLogin: (req) => base.handleLogin(req),
|
|
167
|
+
handleRegister: (req) => base.handleRegister(req),
|
|
168
|
+
handleCallback: (req) => base.handleCallback(req),
|
|
169
|
+
handleRefresh: (req) => base.handleRefresh(req),
|
|
170
|
+
handleRevoke: (req) => base.handleRevoke(req),
|
|
171
|
+
handleEntry: (req) => base.handleEntry(req),
|
|
172
|
+
handleLogout: (req) => base.handleLogout(req),
|
|
173
|
+
handleBackChannelLogout: (req) => base.handleBackChannelLogout(req),
|
|
174
|
+
handler: (req) => base.handler(req),
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
const SESSION_TRANSFER_KEY = makeStateKey('sty.session');
|
|
179
|
+
/**
|
|
180
|
+
* Loads the current session from the encrypted cookie storage (using Angular's `REQUEST` token) before the app
|
|
181
|
+
* renders, and hands it over to the client through `TransferState`, so `StrivacityAuthService` can hydrate without
|
|
182
|
+
* an extra round-trip or a loading flash.
|
|
183
|
+
*
|
|
184
|
+
* Add this to the server-only `ApplicationConfig` (e.g. `app.config.server.ts`), alongside `provideServerRendering()`.
|
|
185
|
+
*
|
|
186
|
+
* @param {AngularServerSDK | undefined} serverSdk - The server SDK instance created via `createServerSDK()`, or `undefined` when server-side sessions aren't configured (a no-op in that case).
|
|
187
|
+
* @returns {EnvironmentProviders} The providers to add to the server `ApplicationConfig`.
|
|
188
|
+
*/
|
|
189
|
+
function provideStrivacityServerSession(serverSdk) {
|
|
190
|
+
return provideAppInitializer(async () => {
|
|
191
|
+
const request = inject(REQUEST);
|
|
192
|
+
if (!request || !serverSdk) {
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
const transferState = inject(TransferState);
|
|
196
|
+
const session = await serverSdk.getSession(request);
|
|
197
|
+
transferState.set(SESSION_TRANSFER_KEY, session);
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Creates a session storage that puts a random unique id value cookie on the client and keeping the actual session data in the given `storage`.
|
|
203
|
+
*
|
|
204
|
+
* @param {SDKStorage} storage - The storage used to persist session data, keyed by a randomly generated session id.
|
|
205
|
+
* @param {SessionIdCookieStorageOptions} [options] - Options for the session ID cookie, including default cookie attributes and a UUID generator function.
|
|
206
|
+
* @param {Partial<ServerCookieOptions>} [options.defaultCookieOptions] - Default cookie attributes for the session ID cookie.
|
|
207
|
+
* @param {() => string} [options.uuidGenerator] - Function to generate a new UUID for the session ID. Defaults to `() => crypto.randomUUID()`.
|
|
208
|
+
* @returns {ServerStorage} An object implementing the ServerStorage interface for managing sessions indexed by a session-id cookie.
|
|
209
|
+
*/
|
|
210
|
+
function createSessionIdCookieStorage(storage, options) {
|
|
211
|
+
return createSessionIdCookieStorage$1({
|
|
212
|
+
toRequest: (req) => toWebRequest(req),
|
|
213
|
+
}, storage, options);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Generated bundle index. Do not edit.
|
|
218
|
+
*/
|
|
219
|
+
|
|
220
|
+
export { SESSION_TRANSFER_KEY, applyResponse, createServerSDK, createSessionIdCookieStorage, provideStrivacityServerSession, toWebRequest };
|
|
221
|
+
//# sourceMappingURL=strivacity-sdk-angular-src-server.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"strivacity-sdk-angular-src-server.mjs","sources":["../../src/server/utils.ts","../../src/server/sdk.ts","../../src/server/session.ts","../../src/server/storages.ts","../../src/server/strivacity-sdk-angular-src-server.ts"],"sourcesContent":["import type { Response as ExpressResponse } from 'express';\nimport type { AngularServerRequest } from './types';\nimport { Readable } from 'node:stream';\n\nexport * from '@strivacity/sdk-core/utils';\n\n/**\n * Converts an incoming Express request (or an already-standard `Request`, e.g. Angular's SSR `REQUEST` token) into a standard Web `Request`.\n *\n * @param {AngularServerRequest} req - The incoming request.\n * @returns {Request} The equivalent Web `Request` object.\n */\nexport function toWebRequest(req: AngularServerRequest): Request {\n\tif (req instanceof Request) {\n\t\treturn req;\n\t}\n\n\tconst url = new URL(req.originalUrl, `${req.protocol}://${req.get('host')}`);\n\tconst headers = new Headers();\n\n\tfor (const [key, value] of Object.entries(req.headers)) {\n\t\tif (value === undefined) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tfor (const v of Array.isArray(value) ? value : [value]) {\n\t\t\theaders.append(key, v);\n\t\t}\n\t}\n\n\tconst hasBody = req.method !== 'GET' && req.method !== 'HEAD';\n\n\treturn new Request(url, {\n\t\tmethod: req.method,\n\t\theaders,\n\t\t...(hasBody ? { body: Readable.toWeb(req), duplex: 'half' } : {}),\n\t} as RequestInit);\n}\n\n/**\n * Writes a standard Web `Response` (built by the shared server SDK core) onto the Express response.\n *\n * @param {Response} response - The `Response` to write.\n * @param {ExpressResponse} res - The Express response to write to.\n */\nexport async function applyResponse(response: Response, res: ExpressResponse): Promise<void> {\n\tres.status(response.status);\n\n\tfor (const [key, value] of response.headers.entries()) {\n\t\tif (key.toLowerCase() === 'set-cookie') {\n\t\t\tcontinue;\n\t\t}\n\n\t\tres.setHeader(key, value);\n\t}\n\n\tconst setCookies = response.headers.getSetCookie();\n\n\tif (setCookies.length) {\n\t\tres.setHeader('set-cookie', setCookies);\n\t}\n\n\tif (!response.body) {\n\t\tres.end();\n\t\treturn;\n\t}\n\n\tawait new Promise<void>((resolve, reject) => {\n\t\tReadable.fromWeb(response.body as Parameters<typeof Readable.fromWeb>[0])\n\t\t\t.pipe(res)\n\t\t\t.on('finish', resolve)\n\t\t\t.on('error', reject);\n\t});\n}\n","import type { AngularServerRequest, AngularServerSDK, AngularServerSDKInitConfig } from './types';\nimport { Router } from 'express';\nimport { createBaseServerSDK } from '@strivacity/sdk-core/server';\nimport { applyResponse, toWebRequest } from './utils';\n\nfunction getRouteHandlers(base: ReturnType<typeof createBaseServerSDK<AngularServerRequest | undefined>>): Router {\n\tconst router = Router();\n\n\trouter.get('/login', async (req, res, next) => {\n\t\ttry {\n\t\t\tconst response = await base.handleLogin(req);\n\t\t\tawait applyResponse(response, res);\n\t\t} catch (error) {\n\t\t\tnext(error);\n\t\t}\n\t});\n\trouter.get('/register', async (req, res, next) => {\n\t\ttry {\n\t\t\tconst response = await base.handleRegister(req);\n\t\t\tawait applyResponse(response, res);\n\t\t} catch (error) {\n\t\t\tnext(error);\n\t\t}\n\t});\n\trouter.get('/callback', async (req, res, next) => {\n\t\ttry {\n\t\t\tconst response = await base.handleCallback(req);\n\t\t\tawait applyResponse(response, res);\n\t\t} catch (error) {\n\t\t\tnext(error);\n\t\t}\n\t});\n\trouter.get('/refresh', async (req, res, next) => {\n\t\ttry {\n\t\t\tconst response = await base.handleRefresh(req);\n\t\t\tawait applyResponse(response, res);\n\t\t} catch (error) {\n\t\t\tnext(error);\n\t\t}\n\t});\n\trouter.get('/revoke', async (req, res, next) => {\n\t\ttry {\n\t\t\tconst response = await base.handleRevoke(req);\n\t\t\tawait applyResponse(response, res);\n\t\t} catch (error) {\n\t\t\tnext(error);\n\t\t}\n\t});\n\trouter.get('/entry', async (req, res, next) => {\n\t\ttry {\n\t\t\tconst response = await base.handleEntry(req);\n\t\t\tawait applyResponse(response, res);\n\t\t} catch (error) {\n\t\t\tnext(error);\n\t\t}\n\t});\n\trouter.get('/logout', async (req, res, next) => {\n\t\ttry {\n\t\t\tconst response = await base.handleLogout(req);\n\t\t\tawait applyResponse(response, res);\n\t\t} catch (error) {\n\t\t\tnext(error);\n\t\t}\n\t});\n\trouter.post('/backchannel-logout', async (req, res, next) => {\n\t\ttry {\n\t\t\tconst response = await base.handleBackChannelLogout(req);\n\t\t\tawait applyResponse(response, res);\n\t\t} catch (error) {\n\t\t\tnext(error);\n\t\t}\n\t});\n\n\treturn router;\n}\n\n/**\n * Creates the server-side Strivacity SDK: an Express router exposing the auth endpoints and session helpers that can be reused elsewhere on the server.\n *\n * @param {AngularServerSDKInitConfig} initConfig - The SDK configuration options.\n * @returns {AngularServerSDK} The server-side SDK instance.\n */\nexport function createServerSDK(initConfig: AngularServerSDKInitConfig): AngularServerSDK {\n\tconst base = createBaseServerSDK<AngularServerRequest | undefined>(\n\t\t{\n\t\t\ttoRequest: (req) => toWebRequest(req as AngularServerRequest),\n\t\t},\n\t\tinitConfig,\n\t);\n\n\treturn {\n\t\tget options() {\n\t\t\treturn base.options;\n\t\t},\n\t\thandlers: getRouteHandlers(base),\n\t\tgetSession: (req) => base.getSession(req),\n\t\tupdateSession: (session, req) => base.updateSession(session, req),\n\t\trefreshSession: (req) => base.refreshSession(req),\n\t\trevokeSession: (req) => base.revokeSession(req),\n\t\tgetEntrySession: (entryUrl) => base.getEntrySession(entryUrl),\n\t\tcompleteLogin: (params, req) => base.completeLogin(params, req),\n\t\tlogout: (postLogoutRedirectUri, req) => base.logout(postLogoutRedirectUri, req),\n\t\thandleLogin: (req) => base.handleLogin(req),\n\t\thandleRegister: (req) => base.handleRegister(req),\n\t\thandleCallback: (req) => base.handleCallback(req),\n\t\thandleRefresh: (req) => base.handleRefresh(req),\n\t\thandleRevoke: (req) => base.handleRevoke(req),\n\t\thandleEntry: (req) => base.handleEntry(req),\n\t\thandleLogout: (req) => base.handleLogout(req),\n\t\thandleBackChannelLogout: (req) => base.handleBackChannelLogout(req),\n\t\thandler: (req) => base.handler(req),\n\t};\n}\n","import type { EnvironmentProviders } from '@angular/core';\nimport type { AngularServerSDK, SessionData } from './types';\nimport { REQUEST, TransferState, inject, makeStateKey, provideAppInitializer } from '@angular/core';\n\nexport const SESSION_TRANSFER_KEY = makeStateKey<SessionData | null>('sty.session');\n\n/**\n * Loads the current session from the encrypted cookie storage (using Angular's `REQUEST` token) before the app\n * renders, and hands it over to the client through `TransferState`, so `StrivacityAuthService` can hydrate without\n * an extra round-trip or a loading flash.\n *\n * Add this to the server-only `ApplicationConfig` (e.g. `app.config.server.ts`), alongside `provideServerRendering()`.\n *\n * @param {AngularServerSDK | undefined} serverSdk - The server SDK instance created via `createServerSDK()`, or `undefined` when server-side sessions aren't configured (a no-op in that case).\n * @returns {EnvironmentProviders} The providers to add to the server `ApplicationConfig`.\n */\nexport function provideStrivacityServerSession(serverSdk: AngularServerSDK | undefined): EnvironmentProviders {\n\treturn provideAppInitializer(async () => {\n\t\tconst request = inject(REQUEST);\n\n\t\tif (!request || !serverSdk) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst transferState = inject(TransferState);\n\t\tconst session = await serverSdk.getSession(request);\n\n\t\ttransferState.set(SESSION_TRANSFER_KEY, session);\n\t});\n}\n","import type { ServerStorage, AngularServerRequest } from './types';\nimport type { SDKStorage, SessionIdCookieStorageOptions } from '@strivacity/sdk-core/types';\nimport { createSessionIdCookieStorage as createSessionIdCookieStorageBase } from '@strivacity/sdk-core/storages/server';\nimport { toWebRequest } from './utils';\n\nexport * from '@strivacity/sdk-core/storages';\n\n/**\n * Creates a session storage that puts a random unique id value cookie on the client and keeping the actual session data in the given `storage`.\n *\n * @param {SDKStorage} storage - The storage used to persist session data, keyed by a randomly generated session id.\n * @param {SessionIdCookieStorageOptions} [options] - Options for the session ID cookie, including default cookie attributes and a UUID generator function.\n * @param {Partial<ServerCookieOptions>} [options.defaultCookieOptions] - Default cookie attributes for the session ID cookie.\n * @param {() => string} [options.uuidGenerator] - Function to generate a new UUID for the session ID. Defaults to `() => crypto.randomUUID()`.\n * @returns {ServerStorage} An object implementing the ServerStorage interface for managing sessions indexed by a session-id cookie.\n */\nexport function createSessionIdCookieStorage(storage: SDKStorage, options?: SessionIdCookieStorageOptions): ServerStorage {\n\treturn createSessionIdCookieStorageBase<AngularServerRequest>(\n\t\t{\n\t\t\ttoRequest: (req) => toWebRequest(req),\n\t\t},\n\t\tstorage,\n\t\toptions,\n\t);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["createSessionIdCookieStorageBase"],"mappings":";;;;;;;;;;AAMA;;;;;AAKG;AACG,SAAU,YAAY,CAAC,GAAyB,EAAA;AACrD,IAAA,IAAI,GAAG,YAAY,OAAO,EAAE;AAC3B,QAAA,OAAO,GAAG;IACX;IAEA,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,WAAW,EAAE,CAAA,EAAG,GAAG,CAAC,QAAQ,CAAA,GAAA,EAAM,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA,CAAE,CAAC;AAC5E,IAAA,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE;AAE7B,IAAA,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,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C,OAAO,CAAC;AAEnD,QAAA,aAAa,CAAC,GAAG,CAAC,oBAAoB,EAAE,OAAO,CAAC;AACjD,IAAA,CAAC,CAAC;AACH;;ACtBA;;;;;;;;AAQG;AACG,SAAU,4BAA4B,CAAC,OAAmB,EAAE,OAAuC,EAAA;AACxG,IAAA,OAAOA,8BAAgC,CACtC;QACC,SAAS,EAAE,CAAC,GAAG,KAAK,YAAY,CAAC,GAAG,CAAC;AACrC,KAAA,EACD,OAAO,EACP,OAAO,CACP;AACF;;ACxBA;;AAEG;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"strivacity-sdk-angular-src-types.mjs","sources":["../../src/types/strivacity-sdk-angular-src-types.ts"],"sourcesContent":["/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;AAAA;;AAEG"}
|