@auth-craft/client 0.2.0 → 0.3.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/README.md +46 -0
- package/dist/core/core.d.ts +17 -4
- package/dist/core/core.d.ts.map +1 -1
- package/dist/core/core.js +7 -3
- package/dist/core/core.js.map +1 -1
- package/dist/core/proxy.d.ts +1 -1
- package/dist/core/proxy.d.ts.map +1 -1
- package/dist/core/proxy.js +1 -1
- package/dist/core/proxy.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/transport/client.d.ts +1 -1
- package/dist/transport/client.d.ts.map +1 -1
- package/dist/transport/client.js +7 -6
- package/dist/transport/client.js.map +1 -1
- package/dist/transport/error-codes.d.ts +18 -18
- package/dist/transport/error-codes.d.ts.map +1 -1
- package/dist/transport/errors.d.ts +1 -1
- package/dist/transport/errors.d.ts.map +1 -1
- package/dist/transport/errors.js +1 -1
- package/dist/transport/errors.js.map +1 -1
- package/dist/transport/helpers.d.ts +1 -1
- package/dist/transport/helpers.d.ts.map +1 -1
- package/dist/transport/index.d.ts +25 -21
- package/dist/transport/index.d.ts.map +1 -1
- package/dist/transport/index.js +19 -16
- package/dist/transport/index.js.map +1 -1
- package/dist/transport/inline-worker.d.ts +7 -1
- package/dist/transport/inline-worker.d.ts.map +1 -1
- package/dist/transport/inline-worker.js +9 -2
- package/dist/transport/inline-worker.js.map +1 -1
- package/dist/transport/messages.d.ts +1 -1
- package/dist/transport/messages.d.ts.map +1 -1
- package/dist/transport/provider/create-provider.d.ts +1 -1
- package/dist/transport/provider/create-provider.d.ts.map +1 -1
- package/dist/transport/provider/create-provider.js +5 -2
- package/dist/transport/provider/create-provider.js.map +1 -1
- package/dist/transport/provider/parser/body.d.ts +1 -1
- package/dist/transport/provider/parser/body.d.ts.map +1 -1
- package/dist/transport/provider/parser/body.js +1 -1
- package/dist/transport/provider/parser/body.js.map +1 -1
- package/dist/transport/provider/parser/cookie.d.ts +1 -1
- package/dist/transport/provider/parser/cookie.d.ts.map +1 -1
- package/dist/transport/provider/parser/cookie.js +1 -1
- package/dist/transport/provider/parser/cookie.js.map +1 -1
- package/dist/transport/provider/presets.d.ts +1 -1
- package/dist/transport/provider/presets.d.ts.map +1 -1
- package/dist/transport/provider/presets.js +6 -6
- package/dist/transport/provider/presets.js.map +1 -1
- package/dist/transport/provider/register-presets.d.ts +1 -1
- package/dist/transport/provider/register-presets.d.ts.map +1 -1
- package/dist/transport/provider/register-presets.js +1 -1
- package/dist/transport/provider/register-presets.js.map +1 -1
- package/dist/transport/provider/storage/indexeddb.d.ts +1 -1
- package/dist/transport/provider/storage/indexeddb.d.ts.map +1 -1
- package/dist/transport/provider/storage/indexeddb.js.map +1 -1
- package/dist/transport/provider/storage/session-hint-channel.d.ts +34 -0
- package/dist/transport/provider/storage/session-hint-channel.d.ts.map +1 -0
- package/dist/transport/provider/storage/session-hint-channel.js +81 -0
- package/dist/transport/provider/storage/session-hint-channel.js.map +1 -0
- package/dist/transport/provider/storage/session-hint.d.ts +65 -0
- package/dist/transport/provider/storage/session-hint.d.ts.map +1 -0
- package/dist/transport/provider/storage/session-hint.js +117 -0
- package/dist/transport/provider/storage/session-hint.js.map +1 -0
- package/dist/transport/provider/strategy/body.d.ts +1 -1
- package/dist/transport/provider/strategy/body.d.ts.map +1 -1
- package/dist/transport/provider/strategy/body.js.map +1 -1
- package/dist/transport/provider/strategy/cookie.d.ts +1 -1
- package/dist/transport/provider/strategy/cookie.d.ts.map +1 -1
- package/dist/transport/provider/strategy/cookie.js.map +1 -1
- package/dist/transport/result.d.ts +1 -1
- package/dist/transport/result.d.ts.map +1 -1
- package/dist/transport/result.js +1 -1
- package/dist/transport/result.js.map +1 -1
- package/dist/transport/types.d.ts +39 -0
- package/dist/transport/types.d.ts.map +1 -1
- package/dist/transport/utils/formdata.d.ts +1 -1
- package/dist/transport/utils/formdata.d.ts.map +1 -1
- package/dist/transport/utils/formdata.js.map +1 -1
- package/dist/transport/utils/registry.d.ts +1 -1
- package/dist/transport/utils/registry.d.ts.map +1 -1
- package/dist/transport/worker-post.d.ts +2 -2
- package/dist/transport/worker-post.d.ts.map +1 -1
- package/dist/transport/worker-post.js +1 -1
- package/dist/transport/worker-post.js.map +1 -1
- package/dist/transport/worker.d.ts +17 -11
- package/dist/transport/worker.d.ts.map +1 -1
- package/dist/transport/worker.js +137 -14
- package/dist/transport/worker.js.map +1 -1
- package/package.json +4 -4
- package/dist/proxy.d.ts +0 -75
- package/dist/proxy.d.ts.map +0 -1
- package/dist/proxy.js +0 -95
- package/dist/proxy.js.map +0 -1
|
@@ -1,22 +1,26 @@
|
|
|
1
|
-
export { createClient, FetchGuardClient } from './client';
|
|
2
|
-
export type { ErrorCode, ErrorCodeKey } from './error-codes';
|
|
3
|
-
export { ERROR_CODES } from './error-codes';
|
|
4
|
-
export { AuthErrors, DomainErrors, GeneralErrors, InitErrors, RequestErrors, } from './errors';
|
|
5
|
-
export { getErrorBody, getErrorMessage, getStatus, hasStatus, isClientError, isNetworkError, isServerError, isSuccess, matchResult, parseJson, } from './helpers';
|
|
6
|
-
export type { MainToWorkerMessage, MessageType, WorkerToMainMessage, } from './messages';
|
|
7
|
-
export { MSG } from './messages';
|
|
8
|
-
export type { ProviderConfig } from './provider/create-provider';
|
|
9
|
-
export { createProvider } from './provider/create-provider';
|
|
10
|
-
export { bodyParser } from './provider/parser/body';
|
|
11
|
-
export { cookieParser } from './provider/parser/cookie';
|
|
12
|
-
export { createBodyProvider, createCookieProvider, } from './provider/presets';
|
|
13
|
-
export type { IndexedDBStorageOptions } from './provider/storage/indexeddb';
|
|
14
|
-
export { createIndexedDBStorage } from './provider/storage/indexeddb';
|
|
15
|
-
export {
|
|
16
|
-
export {
|
|
17
|
-
export {
|
|
18
|
-
export
|
|
19
|
-
export {
|
|
20
|
-
export {
|
|
21
|
-
export {
|
|
1
|
+
export { createClient, FetchGuardClient } from './client.js';
|
|
2
|
+
export type { ErrorCode, ErrorCodeKey } from './error-codes.js';
|
|
3
|
+
export { ERROR_CODES } from './error-codes.js';
|
|
4
|
+
export { AuthErrors, DomainErrors, GeneralErrors, InitErrors, RequestErrors, } from './errors.js';
|
|
5
|
+
export { getErrorBody, getErrorMessage, getStatus, hasStatus, isClientError, isNetworkError, isServerError, isSuccess, matchResult, parseJson, } from './helpers.js';
|
|
6
|
+
export type { MainToWorkerMessage, MessageType, WorkerToMainMessage, } from './messages.js';
|
|
7
|
+
export { MSG } from './messages.js';
|
|
8
|
+
export type { ProviderConfig } from './provider/create-provider.js';
|
|
9
|
+
export { createProvider } from './provider/create-provider.js';
|
|
10
|
+
export { bodyParser } from './provider/parser/body.js';
|
|
11
|
+
export { cookieParser } from './provider/parser/cookie.js';
|
|
12
|
+
export { createBodyProvider, createCookieProvider, } from './provider/presets.js';
|
|
13
|
+
export type { IndexedDBStorageOptions } from './provider/storage/indexeddb.js';
|
|
14
|
+
export { createIndexedDBStorage } from './provider/storage/indexeddb.js';
|
|
15
|
+
export type { SessionHintOptions, SessionHintStore } from './provider/storage/session-hint.js';
|
|
16
|
+
export { createSessionHint } from './provider/storage/session-hint.js';
|
|
17
|
+
export type { SessionHintChannel } from './provider/storage/session-hint-channel.js';
|
|
18
|
+
export { createSessionHintChannel } from './provider/storage/session-hint-channel.js';
|
|
19
|
+
export { bodyStrategy, createBodyStrategy } from './provider/strategy/body.js';
|
|
20
|
+
export { cookieStrategy, createCookieStrategy } from './provider/strategy/cookie.js';
|
|
21
|
+
export { deserializeResult, toResult } from './result.js';
|
|
22
|
+
export type { AuthResult, AuthStrategy, DebugHooks, DedupeConfig, ExchangeTokenOptions, FetchEnvelope, FetchGuardOptions, FetchGuardRequestInit, NetworkErrorDetail, ProviderPresetConfig, RefreshReason, RefreshTokenStorage, RequestMetrics, RetryConfig, SerializedFile, SerializedFormData, SerializedFormDataEntry, SessionHintConfig, StorageErrorCallback, StorageErrorContext, TokenInfo, TokenParser, TokenProvider, TransportResult, WorkerConfig, } from './types.js';
|
|
23
|
+
export { base64ToArrayBuffer, isBinaryContentType, } from './utils/binary.js';
|
|
24
|
+
export { deserializeFormData, isFormData, isSerializedFormData, serializeFormData, } from './utils/formdata.js';
|
|
25
|
+
export { clearProviders, getProvider, hasProvider, listProviders, registerProvider, unregisterProvider, } from './utils/registry.js';
|
|
22
26
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/transport/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/transport/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC7D,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EACL,UAAU,EACV,YAAY,EACZ,aAAa,EACb,UAAU,EACV,aAAa,GACd,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,YAAY,EACZ,eAAe,EACf,SAAS,EACT,SAAS,EACT,aAAa,EACb,cAAc,EACd,aAAa,EACb,SAAS,EACT,WAAW,EACX,SAAS,GACV,MAAM,cAAc,CAAC;AACtB,YAAY,EACV,mBAAmB,EACnB,WAAW,EACX,mBAAmB,GACpB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACpC,YAAY,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAGpE,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B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/dist/transport/index.js
CHANGED
|
@@ -1,32 +1,35 @@
|
|
|
1
1
|
// Main exports
|
|
2
|
-
export { createClient, FetchGuardClient } from './client';
|
|
2
|
+
export { createClient, FetchGuardClient } from './client.js';
|
|
3
3
|
// Error codes for type-safe error matching
|
|
4
|
-
export { ERROR_CODES } from './error-codes';
|
|
4
|
+
export { ERROR_CODES } from './error-codes.js';
|
|
5
5
|
// Organized error definitions
|
|
6
|
-
export { AuthErrors, DomainErrors, GeneralErrors, InitErrors, RequestErrors, } from './errors';
|
|
6
|
+
export { AuthErrors, DomainErrors, GeneralErrors, InitErrors, RequestErrors, } from './errors.js';
|
|
7
7
|
// Helper functions for common Result patterns
|
|
8
|
-
export { getErrorBody, getErrorMessage, getStatus, hasStatus, isClientError, isNetworkError, isServerError, isSuccess, matchResult, parseJson, } from './helpers';
|
|
8
|
+
export { getErrorBody, getErrorMessage, getStatus, hasStatus, isClientError, isNetworkError, isServerError, isSuccess, matchResult, parseJson, } from './helpers.js';
|
|
9
9
|
// Message protocol types (for advanced usage)
|
|
10
|
-
export { MSG } from './messages';
|
|
10
|
+
export { MSG } from './messages.js';
|
|
11
11
|
// Provider factory
|
|
12
|
-
export { createProvider } from './provider/create-provider';
|
|
12
|
+
export { createProvider } from './provider/create-provider.js';
|
|
13
13
|
// Parser modules
|
|
14
|
-
export { bodyParser } from './provider/parser/body';
|
|
15
|
-
export { cookieParser } from './provider/parser/cookie';
|
|
14
|
+
export { bodyParser } from './provider/parser/body.js';
|
|
15
|
+
export { cookieParser } from './provider/parser/cookie.js';
|
|
16
16
|
// Preset providers (recommended)
|
|
17
|
-
export { createBodyProvider, createCookieProvider, } from './provider/presets';
|
|
17
|
+
export { createBodyProvider, createCookieProvider, } from './provider/presets.js';
|
|
18
18
|
// Storage modules
|
|
19
|
-
export { createIndexedDBStorage } from './provider/storage/indexeddb';
|
|
20
|
-
export {
|
|
19
|
+
export { createIndexedDBStorage } from './provider/storage/indexeddb.js';
|
|
20
|
+
export { createSessionHint } from './provider/storage/session-hint.js';
|
|
21
|
+
// Session hint — skip the boot refresh when nobody ever logged in here
|
|
22
|
+
export { createSessionHintChannel } from './provider/storage/session-hint-channel.js';
|
|
23
|
+
export { bodyStrategy, createBodyStrategy } from './provider/strategy/body.js';
|
|
21
24
|
// Strategy modules
|
|
22
|
-
export { cookieStrategy, createCookieStrategy } from './provider/strategy/cookie';
|
|
25
|
+
export { cookieStrategy, createCookieStrategy } from './provider/strategy/cookie.js';
|
|
23
26
|
// Result parser — deserialize a backend ts-micro-result envelope into Result<T>.
|
|
24
27
|
// Used by callJson() and by the contract-driven typed client.
|
|
25
|
-
export { deserializeResult, toResult } from './result';
|
|
28
|
+
export { deserializeResult, toResult } from './result.js';
|
|
26
29
|
// Binary utilities (for decoding binary responses)
|
|
27
|
-
export { base64ToArrayBuffer, isBinaryContentType, } from './utils/binary';
|
|
30
|
+
export { base64ToArrayBuffer, isBinaryContentType, } from './utils/binary.js';
|
|
28
31
|
// FormData utilities (for advanced usage)
|
|
29
|
-
export { deserializeFormData, isFormData, isSerializedFormData, serializeFormData, } from './utils/formdata';
|
|
32
|
+
export { deserializeFormData, isFormData, isSerializedFormData, serializeFormData, } from './utils/formdata.js';
|
|
30
33
|
// Registry utilities
|
|
31
|
-
export { clearProviders, getProvider, hasProvider, listProviders, registerProvider, unregisterProvider, } from './utils/registry';
|
|
34
|
+
export { clearProviders, getProvider, hasProvider, listProviders, registerProvider, unregisterProvider, } from './utils/registry.js';
|
|
32
35
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/transport/index.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/transport/index.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,M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AmB,EACnB,UAAU,EACV,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,qBAAqB,CAAC;AAC7B,qBAAqB;AACrB,OAAO,EACL,cAAc,EACd,WAAW,EACX,WAAW,EACX,aAAa,EACb,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,qBAAqB,CAAC"}
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* token. Use only when that trade-off is acceptable (e.g. httpOnly-cookie auth
|
|
18
18
|
* where the refresh token is not in JS anyway). See `runWorkerLoop`'s doc.
|
|
19
19
|
*/
|
|
20
|
-
import type { MainToWorkerMessage, WorkerToMainMessage } from './messages';
|
|
20
|
+
import type { MainToWorkerMessage, WorkerToMainMessage } from './messages.js';
|
|
21
21
|
/** The subset of the DOM `Worker` interface that `FetchGuardClient` relies on. */
|
|
22
22
|
export interface WorkerLike {
|
|
23
23
|
onmessage: ((event: MessageEvent<WorkerToMainMessage>) => void) | null;
|
|
@@ -34,6 +34,12 @@ export declare class InlineWorker implements WorkerLike {
|
|
|
34
34
|
}) => void) | null;
|
|
35
35
|
/** The loop's host scope: it reads `onmessage` and posts back via `postMessage`. */
|
|
36
36
|
private readonly scope;
|
|
37
|
+
/**
|
|
38
|
+
* Releases loop resources that outlive the message channel (the session-hint
|
|
39
|
+
* BroadcastChannel). A real Worker gets this for free when its realm is torn
|
|
40
|
+
* down; running inline there is no realm to discard, so `terminate()` must.
|
|
41
|
+
*/
|
|
42
|
+
private readonly disposeLoop;
|
|
37
43
|
private terminated;
|
|
38
44
|
constructor();
|
|
39
45
|
/** main → loop */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inline-worker.d.ts","sourceRoot":"","sources":["../../src/transport/inline-worker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"inline-worker.d.ts","sourceRoot":"","sources":["../../src/transport/inline-worker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAG9E,kFAAkF;AAClF,MAAM,WAAW,UAAU;IACzB,SAAS,EAAE,CAAC,CAAC,KAAK,EAAE,YAAY,CAAC,mBAAmB,CAAC,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC;IACvE,OAAO,EAAE,CAAC,CAAC,KAAK,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC;IACvD,WAAW,CAAC,OAAO,EAAE,mBAAmB,EAAE,QAAQ,CAAC,EAAE,YAAY,EAAE,GAAG,IAAI,CAAC;IAC3E,SAAS,IAAI,IAAI,CAAC;CACnB;AAED,qBAAa,YAAa,YAAW,UAAU;IAC7C,SAAS,EAAE,CAAC,CAAC,KAAK,EAAE,YAAY,CAAC,mBAAmB,CAAC,KAAK,IAAI,CAAC,GAAG,IAAI,CAAQ;IAC9E,OAAO,EAAE,CAAC,CAAC,KAAK,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC,GAAG,IAAI,CAAQ;IAE9D,oFAAoF;IACpF,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAkB;IACxC;;;;OAIG;IACH,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAa;IACzC,OAAO,CAAC,UAAU,CAAS;IAE3B,cAaC;IAED,kBAAkB;IAClB,WAAW,CAAC,OAAO,EAAE,mBAAmB,GAAG,IAAI,CAO9C;IAED,SAAS,IAAI,IAAI,CAMhB;IAED,+EAA+E;IAC/E,OAAO,CAAC,OAAO;CAUhB"}
|
|
@@ -17,12 +17,18 @@
|
|
|
17
17
|
* token. Use only when that trade-off is acceptable (e.g. httpOnly-cookie auth
|
|
18
18
|
* where the refresh token is not in JS anyway). See `runWorkerLoop`'s doc.
|
|
19
19
|
*/
|
|
20
|
-
import { runWorkerLoop } from './worker';
|
|
20
|
+
import { runWorkerLoop } from './worker.js';
|
|
21
21
|
export class InlineWorker {
|
|
22
22
|
onmessage = null;
|
|
23
23
|
onerror = null;
|
|
24
24
|
/** The loop's host scope: it reads `onmessage` and posts back via `postMessage`. */
|
|
25
25
|
scope;
|
|
26
|
+
/**
|
|
27
|
+
* Releases loop resources that outlive the message channel (the session-hint
|
|
28
|
+
* BroadcastChannel). A real Worker gets this for free when its realm is torn
|
|
29
|
+
* down; running inline there is no realm to discard, so `terminate()` must.
|
|
30
|
+
*/
|
|
31
|
+
disposeLoop;
|
|
26
32
|
terminated = false;
|
|
27
33
|
constructor() {
|
|
28
34
|
// The loop posts results to the host by calling `scope.postMessage`; route
|
|
@@ -37,7 +43,7 @@ export class InlineWorker {
|
|
|
37
43
|
});
|
|
38
44
|
},
|
|
39
45
|
};
|
|
40
|
-
runWorkerLoop(this.scope);
|
|
46
|
+
this.disposeLoop = runWorkerLoop(this.scope);
|
|
41
47
|
}
|
|
42
48
|
/** main → loop */
|
|
43
49
|
postMessage(message) {
|
|
@@ -51,6 +57,7 @@ export class InlineWorker {
|
|
|
51
57
|
}
|
|
52
58
|
terminate() {
|
|
53
59
|
this.terminated = true;
|
|
60
|
+
this.disposeLoop();
|
|
54
61
|
this.scope.onmessage = null;
|
|
55
62
|
this.onmessage = null;
|
|
56
63
|
this.onerror = null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inline-worker.js","sourceRoot":"","sources":["../../src/transport/inline-worker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,
|
|
1
|
+
{"version":3,"file":"inline-worker.js","sourceRoot":"","sources":["../../src/transport/inline-worker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,EAAE,aAAa,EAAwB,MAAM,aAAa,CAAC;AAUlE,MAAM,OAAO,YAAY;IACvB,SAAS,GAAgE,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,EAAE,EAAE,CAAC;YACP,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,IAAI,CAAC,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;YAC1E,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ErrorDetail, ResultMeta } from 'ts-micro-result';
|
|
2
|
-
import type { AuthResult, FetchEnvelope, FetchGuardRequestInit, ProviderPresetConfig, RefreshReason, WorkerConfig } from './types';
|
|
2
|
+
import type { AuthResult, FetchEnvelope, FetchGuardRequestInit, ProviderPresetConfig, RefreshReason, WorkerConfig } from './types.js';
|
|
3
3
|
/**
|
|
4
4
|
* MESSAGE PAYLOADS - SINGLE SOURCE OF TRUTH
|
|
5
5
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/transport/messages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,KAAK,EACV,UAAU,EACV,aAAa,EACb,qBAAqB,EACrB,oBAAoB,EACpB,aAAa,EACb,YAAY,EACb,MAAM,
|
|
1
|
+
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/transport/messages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,KAAK,EACV,UAAU,EACV,aAAa,EACb,qBAAqB,EACrB,oBAAoB,EACpB,aAAa,EACb,YAAY,EACb,MAAM,YAAY,CAAC;AAEpB;;;;;;;;;;;;;;;;;;GAkBG;AAEH;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,KAAK,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;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,CAAC,CAAA;KAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,SAAS,GAAG,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG;QAAE,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,CAAC;CAC9G,CAAC,MAAM,CAAC,CAAC,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,mBAAmB,CAAC,YAAY,CAAC,CAAC;AACpE,MAAM,MAAM,mBAAmB,GAAG,mBAAmB,CAAC,cAAc,CAAC,CAAC;AAEtE;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,YAAY,CAAC;AAC1C,MAAM,MAAM,UAAU,GAAG,MAAM,cAAc,CAAC;AAC9C,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,UAAU,CAAC;AAEhD;;;GAGG;AACH,eAAO,MAAM,GAAG,EAmBV,EAAE,QAAQ,EAAE,CAAC,IAAI,WAAW,GAAG,CAAC,GAAE,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Result } from 'ts-micro-result';
|
|
2
|
-
import type { AuthStrategy, RefreshTokenStorage, TokenInfo, TokenParser, TokenProvider } from '../types';
|
|
2
|
+
import type { AuthStrategy, RefreshTokenStorage, TokenInfo, TokenParser, TokenProvider } from '../types.js';
|
|
3
3
|
/**
|
|
4
4
|
* Custom auth method type
|
|
5
5
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-provider.d.ts","sourceRoot":"","sources":["../../../src/transport/provider/create-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEvD,OAAO,KAAK,EACV,YAAY,EAEZ,mBAAmB,EACnB,SAAS,EACT,WAAW,EACX,aAAa,EACd,MAAM,
|
|
1
|
+
{"version":3,"file":"create-provider.d.ts","sourceRoot":"","sources":["../../../src/transport/provider/create-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEvD,OAAO,KAAK,EACV,YAAY,EAEZ,mBAAmB,EACnB,SAAS,EACT,WAAW,EACX,aAAa,EACd,MAAM,aAAa,CAAC;AAErB;;GAEG;AACH,KAAK,gBAAgB,GAAG,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;AAE3E;;;;;;;;;;GAUG;AACH,MAAM,WAAW,cAAc;IAC7B,cAAc,CAAC,EAAE,mBAAmB,CAAC;IACrC,MAAM,EAAE,WAAW,CAAC;IACpB,QAAQ,EAAE,YAAY,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;CAClD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,cAAc,GAAG,aAAa,CAoIpE"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { err, ok } from 'ts-micro-result';
|
|
2
|
-
import { AuthErrors, RequestErrors } from '../errors';
|
|
2
|
+
import { AuthErrors, RequestErrors } from '../errors.js';
|
|
3
3
|
/**
|
|
4
4
|
* Factory function to create TokenProvider from modular components
|
|
5
5
|
*
|
|
@@ -55,7 +55,10 @@ export function createProvider(config) {
|
|
|
55
55
|
// body in meta.params (same shape as the HTTP-error branch above) so the
|
|
56
56
|
// proxy's dispatchLogin can deserialize and surface the discriminated
|
|
57
57
|
// login-result instead of an opaque "No access token".
|
|
58
|
-
const body = await response
|
|
58
|
+
const body = await response
|
|
59
|
+
.clone()
|
|
60
|
+
.text()
|
|
61
|
+
.catch(() => '');
|
|
59
62
|
return err(AuthErrors.LoginFailed({ message: 'No access token in response' }), {
|
|
60
63
|
params: { body, status: response.status },
|
|
61
64
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-provider.js","sourceRoot":"","sources":["../../../src/transport/provider/create-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,EAAE,EAAe,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"create-provider.js","sourceRoot":"","sources":["../../../src/transport/provider/create-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,EAAE,EAAe,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAiCzD;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,cAAc,CAAC,MAAsB;IACnD,MAAM,YAAY,GAA+E;QAC/F,KAAK,CAAC,YAAY,CAAC,YAA4B;YAC7C,6DAA6D;YAC7D,IAAI,mBAAmB,GAAG,YAAY,IAAI,IAAI,CAAC;YAC/C,IAAI,mBAAmB,KAAK,IAAI,IAAI,MAAM,CAAC,cAAc,EAAE,CAAC;gBAC1D,mBAAmB,GAAG,MAAM,MAAM,CAAC,cAAc,CAAC,GAAG,EAAE,CAAC;YAC1D,CAAC;YAED,IAAI,CAAC;gBACH,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC;gBAEpE,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;oBACjB,uCAAuC;oBACvC,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;oBACnD,OAAO,GAAG,CAAC,UAAU,CAAC,kBAAkB,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;gBAC7F,CAAC;gBAED,MAAM,SAAS,GAAG,MAAM,MAAM,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,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;oBACrB,OAAO,GAAG,CAAC,UAAU,CAAC,mBAAmB,CAAC,EAAE,OAAO,EAAE,6BAA6B,EAAE,CAAC,CAAC,CAAC;gBACzF,CAAC;gBAED,IAAI,MAAM,CAAC,cAAc,IAAI,SAAS,CAAC,YAAY,EAAE,CAAC;oBACpD,MAAM,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;gBAC1D,CAAC;gBAED,OAAO,EAAE,CAAC,SAAS,CAAC,CAAC;YACvB,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,GAAG,CAAC,aAAa,CAAC,YAAY,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;YACrE,CAAC;QACH,CAAC;KACF,CAAC;IAEF,mCAAmC;IACnC,IAAI,MAAM,CAAC,aAAa,EAAE,CAAC;QACzB,OAAO;YACL,GAAG,YAAY;YACf,GAAG,MAAM,CAAC,aAAa;SACP,CAAC;IACrB,CAAC;IAED,OAAO,YAA6B,CAAC;AACvC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"body.d.ts","sourceRoot":"","sources":["../../../../src/transport/provider/parser/body.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"body.d.ts","sourceRoot":"","sources":["../../../../src/transport/provider/parser/body.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAGlD;;;GAGG;AACH,eAAO,MAAM,UAAU,EAAE,WAUxB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"body.js","sourceRoot":"","sources":["../../../../src/transport/provider/parser/body.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"body.js","sourceRoot":"","sources":["../../../../src/transport/provider/parser/body.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEpD;;;GAGG;AACH,MAAM,CAAC,MAAM,UAAU,GAAgB;IACrC,KAAK,CAAC,KAAK,CAAC,QAAQ;QAClB,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,CAAC;QAC3C,OAAO;YACL,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,WAAW;YAC5B,YAAY,EAAE,IAAI,CAAC,IAAI,CAAC,YAAY;YACpC,SAAS,EAAE,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC;YAClD,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI;SACrB,CAAC;IACJ,CAAC;CACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cookie.d.ts","sourceRoot":"","sources":["../../../../src/transport/provider/parser/cookie.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"cookie.d.ts","sourceRoot":"","sources":["../../../../src/transport/provider/parser/cookie.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAGlD;;;;GAIG;AACH,eAAO,MAAM,YAAY,EAAE,WAS1B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cookie.js","sourceRoot":"","sources":["../../../../src/transport/provider/parser/cookie.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"cookie.js","sourceRoot":"","sources":["../../../../src/transport/provider/parser/cookie.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEpD;;;;GAIG;AACH,MAAM,CAAC,MAAM,YAAY,GAAgB;IACvC,KAAK,CAAC,KAAK,CAAC,QAAQ;QAClB,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,CAAC;QAC3C,OAAO;YACL,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,WAAW;YAC5B,SAAS,EAAE,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC;YAClD,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI;SACrB,CAAC;IACJ,CAAC;CACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"presets.d.ts","sourceRoot":"","sources":["../../../src/transport/provider/presets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"presets.d.ts","sourceRoot":"","sources":["../../../src/transport/provider/presets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAQjD;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE;IAC3C,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACzC,GAAG,aAAa,CAMhB;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE;IACzC,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACzC,GAAG,aAAa,CAMhB"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { createProvider } from './create-provider';
|
|
2
|
-
import { bodyParser } from './parser/body';
|
|
3
|
-
import { cookieParser } from './parser/cookie';
|
|
4
|
-
import { createIndexedDBStorage } from './storage/indexeddb';
|
|
5
|
-
import { createBodyStrategy } from './strategy/body';
|
|
6
|
-
import { createCookieStrategy } from './strategy/cookie';
|
|
1
|
+
import { createProvider } from './create-provider.js';
|
|
2
|
+
import { bodyParser } from './parser/body.js';
|
|
3
|
+
import { cookieParser } from './parser/cookie.js';
|
|
4
|
+
import { createIndexedDBStorage } from './storage/indexeddb.js';
|
|
5
|
+
import { createBodyStrategy } from './strategy/body.js';
|
|
6
|
+
import { createCookieStrategy } from './strategy/cookie.js';
|
|
7
7
|
/**
|
|
8
8
|
* Cookie Provider - uses httpOnly cookies
|
|
9
9
|
* Suitable for SSR and cross-domain authentication
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"presets.js","sourceRoot":"","sources":["../../../src/transport/provider/presets.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"presets.js","sourceRoot":"","sources":["../../../src/transport/provider/presets.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAE5D;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAMpC;IACC,OAAO,cAAc,CAAC;QACpB,cAAc,EAAE,SAAS;QACzB,MAAM,EAAE,YAAY;QACpB,QAAQ,EAAE,oBAAoB,CAAC,MAAM,CAAC;KACvC,CAAC,CAAC;AACL,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAOlC;IACC,OAAO,cAAc,CAAC;QACpB,cAAc,EAAE,sBAAsB,CAAC,cAAc,EAAE,MAAM,CAAC,eAAe,IAAI,cAAc,CAAC;QAChG,MAAM,EAAE,UAAU;QAClB,QAAQ,EAAE,kBAAkB,CAAC,MAAM,CAAC;KACrC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register-presets.d.ts","sourceRoot":"","sources":["../../../src/transport/provider/register-presets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"register-presets.d.ts","sourceRoot":"","sources":["../../../src/transport/provider/register-presets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAGvE;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,oBAAoB,EAC5B,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GACtC,aAAa,CAwBf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register-presets.js","sourceRoot":"","sources":["../../../src/transport/provider/register-presets.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"register-presets.js","sourceRoot":"","sources":["../../../src/transport/provider/register-presets.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAExE;;;;;;GAMG;AACH,MAAM,UAAU,uBAAuB,CACrC,MAA4B,EAC5B,cAAuC;IAEvC,QAAQ,MAAM,CAAC,IAAI,EAAE,CAAC;QACpB,KAAK,aAAa;YAChB,OAAO,oBAAoB,CAAC;gBAC1B,UAAU,EAAE,MAAM,CAAC,UAAU;gBAC7B,QAAQ,EAAE,MAAM,CAAC,QAAQ;gBACzB,SAAS,EAAE,MAAM,CAAC,SAAS;gBAC3B,OAAO,EAAE,MAAM,CAAC,OAAO;gBACvB,cAAc;aACf,CAAC,CAAC;QAEL,KAAK,WAAW;YACd,OAAO,kBAAkB,CAAC;gBACxB,UAAU,EAAE,MAAM,CAAC,UAAU;gBAC7B,QAAQ,EAAE,MAAM,CAAC,QAAQ;gBACzB,SAAS,EAAE,MAAM,CAAC,SAAS;gBAC3B,eAAe,EAAE,MAAM,CAAC,eAAe;gBACvC,OAAO,EAAE,MAAM,CAAC,OAAO;gBACvB,cAAc;aACf,CAAC,CAAC;QAEL;YACE,MAAM,IAAI,KAAK,CAAC,0BAA0B,MAAM,CAAE,MAA6B,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC7F,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"indexeddb.d.ts","sourceRoot":"","sources":["../../../../src/transport/provider/storage/indexeddb.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"indexeddb.d.ts","sourceRoot":"","sources":["../../../../src/transport/provider/storage/indexeddb.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAEhF;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,8CAA8C;IAC9C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,sDAAsD;IACtD,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;;OAIG;IACH,OAAO,CAAC,EAAE,oBAAoB,CAAC;CAChC;AAED;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,GAAE,uBAAuB,GAAG,MAAuB,EAC1D,qBAAqB,CAAC,EAAE,MAAM,GAC7B,mBAAmB,CAmErB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"indexeddb.js","sourceRoot":"","sources":["../../../../src/transport/provider/storage/indexeddb.ts"],"names":[],"mappings":"AAkBA;;;;;;;GAOG;AACH,MAAM,UAAU,sBAAsB,CACpC,
|
|
1
|
+
{"version":3,"file":"indexeddb.js","sourceRoot":"","sources":["../../../../src/transport/provider/storage/indexeddb.ts"],"names":[],"mappings":"AAkBA;;;;;;;GAOG;AACH,MAAM,UAAU,sBAAsB,CACpC,OAAO,GAAqC,cAAc,EAC1D,qBAA8B;IAE9B,8DAA8D;IAC9D,MAAM,MAAM,GACV,OAAO,OAAO,KAAK,QAAQ;QACzB,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,EAAE,qBAAqB,IAAI,cAAc,EAAE,OAAO,EAAE,SAAS,EAAE;QACnG,CAAC,CAAC;YACE,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,cAAc;YACxC,eAAe,EAAE,OAAO,CAAC,eAAe,IAAI,cAAc;YAC1D,OAAO,EAAE,OAAO,CAAC,OAAO;SACzB,CAAC;IAER,MAAM,EAAE,MAAM,EAAE,eAAe,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;IACpD,MAAM,SAAS,GAAG,QAAQ,CAAC;IAE3B,MAAM,MAAM,GAAG,GAAyB,EAAE;QACxC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrC,MAAM,OAAO,GAAG,SAAS,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;YAE1C,OAAO,CAAC,OAAO,GAAG,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YAC9C,OAAO,CAAC,SAAS,GAAG,GAA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,OAAO,MAAM,EAAE,KAAK,IAAI,IAAI,CAAC;YAC/B,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,EAAE,CAAC,KAAc,EAAE,KAAK,CAAC,CAAC;gBACjC,OAAO,IAAI,CAAC;YACd,CAAC;QACH,CAAC;QACD,KAAK,CAAC,GAAG,CAAC,KAAK;YACb,IAAI,CAAC;gBACH,MAAM,EAAE,GAAG,MAAM,MAAM,EAAE,CAAC;gBAC1B,MAAM,WAAW,GAAG,EAAE,CAAC,WAAW,CAAC,CAAC,SAAS,CAAC,EAAE,WAAW,CAAC,CAAC;gBAC7D,MAAM,KAAK,GAAG,WAAW,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;gBAEjD,IAAI,KAAK,EAAE,CAAC;oBACV,MAAM,gBAAgB,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,eAAe,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC;gBACnG,CAAC;qBAAM,CAAC;oBACN,MAAM,gBAAgB,CAAC,KAAK,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,CAAC;gBACxD,CAAC;YACH,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,EAAE,CAAC,KAAc,EAAE,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;YACtD,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cross-tab session-hint sync.
|
|
3
|
+
*
|
|
4
|
+
* The hint in `session-hint.ts` is per-origin durable state, but each tab's
|
|
5
|
+
* worker keeps its own in-memory copy of "did a session plausibly exist". Two
|
|
6
|
+
* tabs therefore drift: log in on tab A and tab B still believes nobody ever
|
|
7
|
+
* logged in here, so it keeps failing fast until it is reloaded.
|
|
8
|
+
*
|
|
9
|
+
* `storage` events would solve this for `localStorage`, but a Worker has no
|
|
10
|
+
* `window` and never receives them. `BroadcastChannel` is the equivalent the
|
|
11
|
+
* Worker *does* have: every worker on the origin — one per tab — can post and
|
|
12
|
+
* receive on a named channel. So a login/logout publishes the new hint and every
|
|
13
|
+
* other tab's worker updates immediately, no reload required.
|
|
14
|
+
*
|
|
15
|
+
* Only the one non-secret bit travels over the channel. Any script on the origin
|
|
16
|
+
* can listen (and, under XSS, publish a forged bit) — which changes nothing,
|
|
17
|
+
* because the hint can only ever cause a request to be *skipped* or *attempted*,
|
|
18
|
+
* never authorize anything. A forged "logged in" costs one rejected refresh.
|
|
19
|
+
*/
|
|
20
|
+
export interface SessionHintChannel {
|
|
21
|
+
/** Tell other tabs the hint changed. */
|
|
22
|
+
publish(hint: boolean): void;
|
|
23
|
+
/** Stop listening and release the channel. */
|
|
24
|
+
close(): void;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Open the sync channel. `onRemoteChange` fires when *another* tab publishes
|
|
28
|
+
* (BroadcastChannel never echoes to the sender, so no self-notification).
|
|
29
|
+
*
|
|
30
|
+
* Returns a no-op channel where BroadcastChannel is unavailable (older runtimes,
|
|
31
|
+
* test environments) — tabs then simply stay independent, as they are today.
|
|
32
|
+
*/
|
|
33
|
+
export declare function createSessionHintChannel(hintKey: string, onRemoteChange: (hint: boolean) => void): SessionHintChannel;
|
|
34
|
+
//# sourceMappingURL=session-hint-channel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-hint-channel.d.ts","sourceRoot":"","sources":["../../../../src/transport/provider/storage/session-hint-channel.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAQH,MAAM,WAAW,kBAAkB;IACjC,wCAAwC;IACxC,OAAO,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAAC;IAC7B,8CAA8C;IAC9C,KAAK,IAAI,IAAI,CAAC;CACf;AAED;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,GAAG,kBAAkB,CAoDrH"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cross-tab session-hint sync.
|
|
3
|
+
*
|
|
4
|
+
* The hint in `session-hint.ts` is per-origin durable state, but each tab's
|
|
5
|
+
* worker keeps its own in-memory copy of "did a session plausibly exist". Two
|
|
6
|
+
* tabs therefore drift: log in on tab A and tab B still believes nobody ever
|
|
7
|
+
* logged in here, so it keeps failing fast until it is reloaded.
|
|
8
|
+
*
|
|
9
|
+
* `storage` events would solve this for `localStorage`, but a Worker has no
|
|
10
|
+
* `window` and never receives them. `BroadcastChannel` is the equivalent the
|
|
11
|
+
* Worker *does* have: every worker on the origin — one per tab — can post and
|
|
12
|
+
* receive on a named channel. So a login/logout publishes the new hint and every
|
|
13
|
+
* other tab's worker updates immediately, no reload required.
|
|
14
|
+
*
|
|
15
|
+
* Only the one non-secret bit travels over the channel. Any script on the origin
|
|
16
|
+
* can listen (and, under XSS, publish a forged bit) — which changes nothing,
|
|
17
|
+
* because the hint can only ever cause a request to be *skipped* or *attempted*,
|
|
18
|
+
* never authorize anything. A forged "logged in" costs one rejected refresh.
|
|
19
|
+
*/
|
|
20
|
+
/** Channel name; per-origin, so include the hint key to keep scopes apart. */
|
|
21
|
+
const CHANNEL_PREFIX = 'authcraft:session-hint';
|
|
22
|
+
/**
|
|
23
|
+
* Open the sync channel. `onRemoteChange` fires when *another* tab publishes
|
|
24
|
+
* (BroadcastChannel never echoes to the sender, so no self-notification).
|
|
25
|
+
*
|
|
26
|
+
* Returns a no-op channel where BroadcastChannel is unavailable (older runtimes,
|
|
27
|
+
* test environments) — tabs then simply stay independent, as they are today.
|
|
28
|
+
*/
|
|
29
|
+
export function createSessionHintChannel(hintKey, onRemoteChange) {
|
|
30
|
+
if (typeof BroadcastChannel === 'undefined') {
|
|
31
|
+
return {
|
|
32
|
+
publish() {
|
|
33
|
+
// no-op
|
|
34
|
+
},
|
|
35
|
+
close() {
|
|
36
|
+
// no-op
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
let channel = null;
|
|
41
|
+
try {
|
|
42
|
+
channel = new BroadcastChannel(`${CHANNEL_PREFIX}:${hintKey}`);
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
// Some embedders expose the constructor but refuse to open it.
|
|
46
|
+
return {
|
|
47
|
+
publish() {
|
|
48
|
+
// no-op
|
|
49
|
+
},
|
|
50
|
+
close() {
|
|
51
|
+
// no-op
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
channel.onmessage = (event) => {
|
|
56
|
+
const hint = event.data?.hint;
|
|
57
|
+
if (typeof hint === 'boolean') {
|
|
58
|
+
onRemoteChange(hint);
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
return {
|
|
62
|
+
publish(hint) {
|
|
63
|
+
try {
|
|
64
|
+
channel?.postMessage({ hint });
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
// A closed/failed channel must never break an auth operation.
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
close() {
|
|
71
|
+
try {
|
|
72
|
+
channel?.close();
|
|
73
|
+
}
|
|
74
|
+
catch {
|
|
75
|
+
// ignore
|
|
76
|
+
}
|
|
77
|
+
channel = null;
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=session-hint-channel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-hint-channel.js","sourceRoot":"","sources":["../../../../src/transport/provider/storage/session-hint-channel.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,8EAA8E;AAC9E,MAAM,cAAc,GAAG,wBAAwB,CAAC;AAYhD;;;;;;GAMG;AACH,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