@auth-craft/client 0.1.0 → 0.1.1

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.
Files changed (109) hide show
  1. package/README.md +144 -8
  2. package/dist/core/core.d.ts +72 -0
  3. package/dist/core/core.d.ts.map +1 -0
  4. package/dist/core/core.js +105 -0
  5. package/dist/core/core.js.map +1 -0
  6. package/dist/core/proxy.d.ts +79 -0
  7. package/dist/core/proxy.d.ts.map +1 -0
  8. package/dist/core/proxy.js +99 -0
  9. package/dist/core/proxy.js.map +1 -0
  10. package/dist/index.d.ts +15 -28
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +23 -55
  13. package/dist/index.js.map +1 -1
  14. package/dist/transport/client.d.ts +250 -0
  15. package/dist/transport/client.d.ts.map +1 -0
  16. package/dist/transport/client.js +940 -0
  17. package/dist/transport/client.js.map +1 -0
  18. package/dist/transport/constants.d.ts +9 -0
  19. package/dist/transport/constants.d.ts.map +1 -0
  20. package/dist/transport/constants.js +9 -0
  21. package/dist/transport/constants.js.map +1 -0
  22. package/dist/transport/error-codes.d.ts +41 -0
  23. package/dist/transport/error-codes.d.ts.map +1 -0
  24. package/dist/transport/error-codes.js +38 -0
  25. package/dist/transport/error-codes.js.map +1 -0
  26. package/dist/transport/errors.d.ts +55 -0
  27. package/dist/transport/errors.d.ts.map +1 -0
  28. package/dist/transport/errors.js +55 -0
  29. package/dist/transport/errors.js.map +1 -0
  30. package/dist/transport/helpers.d.ts +135 -0
  31. package/dist/transport/helpers.d.ts.map +1 -0
  32. package/dist/transport/helpers.js +185 -0
  33. package/dist/transport/helpers.js.map +1 -0
  34. package/dist/transport/index.d.ts +22 -0
  35. package/dist/transport/index.d.ts.map +1 -0
  36. package/dist/transport/index.js +32 -0
  37. package/dist/transport/index.js.map +1 -0
  38. package/dist/transport/messages.d.ts +104 -0
  39. package/dist/transport/messages.d.ts.map +1 -0
  40. package/dist/transport/messages.js +24 -0
  41. package/dist/transport/messages.js.map +1 -0
  42. package/dist/transport/provider/create-provider.d.ts +38 -0
  43. package/dist/transport/provider/create-provider.d.ts.map +1 -0
  44. package/dist/transport/provider/create-provider.js +119 -0
  45. package/dist/transport/provider/create-provider.js.map +1 -0
  46. package/dist/transport/provider/parser/body.d.ts +7 -0
  47. package/dist/transport/provider/parser/body.d.ts.map +1 -0
  48. package/dist/transport/provider/parser/body.js +17 -0
  49. package/dist/transport/provider/parser/body.js.map +1 -0
  50. package/dist/transport/provider/parser/cookie.d.ts +8 -0
  51. package/dist/transport/provider/parser/cookie.d.ts.map +1 -0
  52. package/dist/transport/provider/parser/cookie.js +17 -0
  53. package/dist/transport/provider/parser/cookie.js.map +1 -0
  54. package/dist/transport/provider/parser/normalize.d.ts +6 -0
  55. package/dist/transport/provider/parser/normalize.d.ts.map +1 -0
  56. package/dist/transport/provider/parser/normalize.js +21 -0
  57. package/dist/transport/provider/parser/normalize.js.map +1 -0
  58. package/dist/transport/provider/presets.d.ts +31 -0
  59. package/dist/transport/provider/presets.d.ts.map +1 -0
  60. package/dist/transport/provider/presets.js +35 -0
  61. package/dist/transport/provider/presets.js.map +1 -0
  62. package/dist/transport/provider/register-presets.d.ts +10 -0
  63. package/dist/transport/provider/register-presets.d.ts.map +1 -0
  64. package/dist/transport/provider/register-presets.js +32 -0
  65. package/dist/transport/provider/register-presets.js.map +1 -0
  66. package/dist/transport/provider/storage/indexeddb.d.ts +26 -0
  67. package/dist/transport/provider/storage/indexeddb.d.ts.map +1 -0
  68. package/dist/transport/provider/storage/indexeddb.js +72 -0
  69. package/dist/transport/provider/storage/indexeddb.js.map +1 -0
  70. package/dist/transport/provider/strategy/body.d.ts +28 -0
  71. package/dist/transport/provider/strategy/body.d.ts.map +1 -0
  72. package/dist/transport/provider/strategy/body.js +73 -0
  73. package/dist/transport/provider/strategy/body.js.map +1 -0
  74. package/dist/transport/provider/strategy/cookie.d.ts +29 -0
  75. package/dist/transport/provider/strategy/cookie.d.ts.map +1 -0
  76. package/dist/transport/provider/strategy/cookie.js +70 -0
  77. package/dist/transport/provider/strategy/cookie.js.map +1 -0
  78. package/dist/transport/result.d.ts +28 -0
  79. package/dist/transport/result.d.ts.map +1 -0
  80. package/dist/transport/result.js +87 -0
  81. package/dist/transport/result.js.map +1 -0
  82. package/dist/transport/types.d.ts +488 -0
  83. package/dist/transport/types.d.ts.map +1 -0
  84. package/dist/transport/types.js +3 -0
  85. package/dist/transport/types.js.map +1 -0
  86. package/dist/transport/utils/binary.d.ts +20 -0
  87. package/dist/transport/utils/binary.d.ts.map +1 -0
  88. package/dist/transport/utils/binary.js +51 -0
  89. package/dist/transport/utils/binary.js.map +1 -0
  90. package/dist/transport/utils/formdata.d.ts +26 -0
  91. package/dist/transport/utils/formdata.d.ts.map +1 -0
  92. package/dist/transport/utils/formdata.js +77 -0
  93. package/dist/transport/utils/formdata.js.map +1 -0
  94. package/dist/transport/utils/registry.d.ts +26 -0
  95. package/dist/transport/utils/registry.d.ts.map +1 -0
  96. package/dist/transport/utils/registry.js +51 -0
  97. package/dist/transport/utils/registry.js.map +1 -0
  98. package/dist/transport/worker-post.d.ts +44 -0
  99. package/dist/transport/worker-post.d.ts.map +1 -0
  100. package/dist/transport/worker-post.js +104 -0
  101. package/dist/transport/worker-post.js.map +1 -0
  102. package/dist/transport/worker.d.ts +10 -0
  103. package/dist/transport/worker.d.ts.map +1 -0
  104. package/dist/transport/worker.js +421 -0
  105. package/dist/transport/worker.js.map +1 -0
  106. package/dist/types.test-d.js +3 -9
  107. package/dist/types.test-d.js.map +1 -1
  108. package/eslint-isolation.mjs +82 -0
  109. package/package.json +30 -16
package/dist/index.d.ts CHANGED
@@ -1,30 +1,21 @@
1
1
  /**
2
- * @auth-craft/client — contract-driven typed client.
2
+ * @auth-craft/client — full contract-driven typed client (all groups).
3
3
  *
4
- * Wires the absorbed transport (FetchGuard) to the shared api-contract, so the
5
- * client's methods are generated from — and type-checked against — the same
6
- * endpoint declarations the backend routes use. No hand-written per-method
7
- * paths/types: a route change in the contract re-types the call sites here.
4
+ * The batteries-included client: wires every contract group (auth, password,
5
+ * verification, session, mfa, oauth, users, tenant) plus the authenticated
6
+ * raw-HTTP escape hatch (`api`). Methods are generated from the shared
7
+ * api-contract, so they can't drift from the backend routes.
8
8
  *
9
- * Module groups mirror the route groups: auth, password, verification, session,
10
- * mfa, oauth, users, tenant. Tenant methods take `{ params: { tenantId }, ... }`
11
- * because the routes are scoped under /tenants/:tenantId/...
9
+ * Built on the scope-agnostic core (transport + lifecycle + `.api` + group
10
+ * factory), re-exported from `@auth-craft/client/core`. If you only need one
11
+ * scope and want to keep other scopes' code out of your bundle/call surface,
12
+ * import `createClientCore` from `@auth-craft/client/core` and wire only the
13
+ * per-group contract subpaths (`@auth-craft/api-contract/auth`, `/tenant`, …).
12
14
  */
13
15
  import { authContract, mfaContract, oauthContract, passwordContract, sessionContract, tenantsContract, usersContract, verificationContract } from '@auth-craft/api-contract';
14
- import { type ContractClient } from './proxy';
15
- export interface AuthCraftClientConfig {
16
- baseUrl: string;
17
- strategy: 'cookie-auth' | 'body-auth';
18
- allowedDomains: string[];
19
- refreshEarlyMs?: number;
20
- defaultHeaders?: Record<string, string>;
21
- workerFactory?: () => Worker;
22
- /** Auth context scope → X-Auth-Context header. */
23
- context?: 'customer' | 'tenant' | 'system';
24
- }
25
- export declare class AuthCraftClient {
26
- private fg;
27
- private readonly config;
16
+ import { ClientCore, type ClientCoreConfig, type ContractClient } from './core/core';
17
+ export type AuthCraftClientConfig = ClientCoreConfig;
18
+ export declare class AuthCraftClient extends ClientCore {
28
19
  auth: ContractClient<typeof authContract>;
29
20
  password: ContractClient<typeof passwordContract>;
30
21
  verification: ContractClient<typeof verificationContract>;
@@ -33,13 +24,9 @@ export declare class AuthCraftClient {
33
24
  oauth: ContractClient<typeof oauthContract>;
34
25
  users: ContractClient<typeof usersContract>;
35
26
  tenant: ContractClient<typeof tenantsContract>;
36
- constructor(config: AuthCraftClientConfig);
37
27
  init(): Promise<void>;
38
- private wireGroups;
39
- buildUrl(path: string): string;
40
- destroy(): void;
41
28
  }
42
29
  export declare function createAuthCraftClient(config: AuthCraftClientConfig): AuthCraftClient;
43
- export { buildClient } from './proxy';
44
- export type { ContractClient, EndpointMethod, AuthResult } from './proxy';
30
+ export type { ApiTransport, AuthResult, ClientCore, ClientCoreConfig, ContractClient, EndpointMethod, } from './core/core';
31
+ export { buildClient } from './core/core';
45
32
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EACL,YAAY,EACZ,WAAW,EACX,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,aAAa,EACb,oBAAoB,EACrB,MAAM,0BAA0B,CAAA;AAEjC,OAAO,EAAe,KAAK,cAAc,EAAE,MAAM,SAAS,CAAA;AAE1D,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,aAAa,GAAG,WAAW,CAAA;IACrC,cAAc,EAAE,MAAM,EAAE,CAAA;IACxB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACvC,aAAa,CAAC,EAAE,MAAM,MAAM,CAAA;IAC5B,kDAAkD;IAClD,OAAO,CAAC,EAAE,UAAU,GAAG,QAAQ,GAAG,QAAQ,CAAA;CAC3C;AAED,qBAAa,eAAe;IAC1B,OAAO,CAAC,EAAE,CAAgC;IAC1C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAuB;IAE9C,IAAI,EAAG,cAAc,CAAC,OAAO,YAAY,CAAC,CAAA;IAC1C,QAAQ,EAAG,cAAc,CAAC,OAAO,gBAAgB,CAAC,CAAA;IAClD,YAAY,EAAG,cAAc,CAAC,OAAO,oBAAoB,CAAC,CAAA;IAC1D,OAAO,EAAG,cAAc,C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C;IACjD,GAAG,EAAG,cAAc,CAAC,OAAO,WAAW,CAAC,CAAC;IACzC,KAAK,EAAG,cAAc,CAAC,OAAO,aAAa,CAAC,CAAC;IAC7C,KAAK,EAAG,cAAc,CAAC,OAAO,aAAa,CAAC,CAAC;IAC7C,MAAM,EAAG,cAAc,CAAC,OAAO,eAAe,CAAC,CAAC;IAE1C,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAW5B;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,qBAAqB,GAAG,eAAe,CAEpF;AAED,YAAY,EACV,YAAY,EACZ,UAAU,EACV,UAAU,EACV,gBAAgB,EAChB,cAAc,EACd,cAAc,GACf,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC"}
package/dist/index.js CHANGED
@@ -1,21 +1,20 @@
1
1
  /**
2
- * @auth-craft/client — contract-driven typed client.
2
+ * @auth-craft/client — full contract-driven typed client (all groups).
3
3
  *
4
- * Wires the absorbed transport (FetchGuard) to the shared api-contract, so the
5
- * client's methods are generated from — and type-checked against — the same
6
- * endpoint declarations the backend routes use. No hand-written per-method
7
- * paths/types: a route change in the contract re-types the call sites here.
4
+ * The batteries-included client: wires every contract group (auth, password,
5
+ * verification, session, mfa, oauth, users, tenant) plus the authenticated
6
+ * raw-HTTP escape hatch (`api`). Methods are generated from the shared
7
+ * api-contract, so they can't drift from the backend routes.
8
8
  *
9
- * Module groups mirror the route groups: auth, password, verification, session,
10
- * mfa, oauth, users, tenant. Tenant methods take `{ params: { tenantId }, ... }`
11
- * because the routes are scoped under /tenants/:tenantId/...
9
+ * Built on the scope-agnostic core (transport + lifecycle + `.api` + group
10
+ * factory), re-exported from `@auth-craft/client/core`. If you only need one
11
+ * scope and want to keep other scopes' code out of your bundle/call surface,
12
+ * import `createClientCore` from `@auth-craft/client/core` and wire only the
13
+ * per-group contract subpaths (`@auth-craft/api-contract/auth`, `/tenant`, …).
12
14
  */
13
- import { authContract, mfaContract, oauthContract, passwordContract, sessionContract, tenantsContract, usersContract, verificationContract } from '@auth-craft/api-contract';
14
- import { createClient } from '@auth-craft/transport';
15
- import { buildClient } from './proxy';
16
- export class AuthCraftClient {
17
- fg = null;
18
- config;
15
+ import { authContract, mfaContract, oauthContract, passwordContract, sessionContract, tenantsContract, usersContract, verificationContract, } from '@auth-craft/api-contract';
16
+ import { ClientCore } from './core/core';
17
+ export class AuthCraftClient extends ClientCore {
19
18
  auth;
20
19
  password;
21
20
  verification;
@@ -24,51 +23,20 @@ export class AuthCraftClient {
24
23
  oauth;
25
24
  users;
26
25
  tenant;
27
- constructor(config) {
28
- this.config = config;
29
- }
30
26
  async init() {
31
- const headers = this.config.context && this.config.context !== 'customer'
32
- ? { ...this.config.defaultHeaders, 'X-Auth-Context': this.config.context }
33
- : this.config.defaultHeaders;
34
- this.fg = createClient({
35
- provider: {
36
- type: this.config.strategy,
37
- refreshUrl: this.buildUrl('/auth/refresh'),
38
- loginUrl: this.buildUrl('/auth/authenticate'),
39
- logoutUrl: this.buildUrl('/auth/logout'),
40
- ...(headers ? { headers } : {})
41
- },
42
- allowedDomains: this.config.allowedDomains,
43
- ...(this.config.refreshEarlyMs !== undefined ? { refreshEarlyMs: this.config.refreshEarlyMs } : {}),
44
- ...(headers ? { defaultHeaders: headers } : {}),
45
- ...(this.config.workerFactory ? { workerFactory: this.config.workerFactory } : {})
46
- });
47
- await this.fg.whenReady();
48
- this.wireGroups(this.fg);
49
- }
50
- wireGroups(fg) {
51
- const url = (p) => this.buildUrl(p);
52
- this.auth = buildClient(fg, authContract, url);
53
- this.password = buildClient(fg, passwordContract, url);
54
- this.verification = buildClient(fg, verificationContract, url);
55
- this.session = buildClient(fg, sessionContract, url);
56
- this.mfa = buildClient(fg, mfaContract, url);
57
- this.oauth = buildClient(fg, oauthContract, url);
58
- this.users = buildClient(fg, usersContract, url);
59
- this.tenant = buildClient(fg, tenantsContract, url);
60
- }
61
- buildUrl(path) {
62
- const p = path.startsWith('/') ? path : `/${path}`;
63
- return `${this.config.baseUrl}${p}`;
64
- }
65
- destroy() {
66
- this.fg?.destroy();
67
- this.fg = null;
27
+ await super.init();
28
+ this.auth = this.group(authContract);
29
+ this.password = this.group(passwordContract);
30
+ this.verification = this.group(verificationContract);
31
+ this.session = this.group(sessionContract);
32
+ this.mfa = this.group(mfaContract);
33
+ this.oauth = this.group(oauthContract);
34
+ this.users = this.group(usersContract);
35
+ this.tenant = this.group(tenantsContract);
68
36
  }
69
37
  }
70
38
  export function createAuthCraftClient(config) {
71
39
  return new AuthCraftClient(config);
72
40
  }
73
- export { buildClient } from './proxy';
41
+ export { buildClient } from './core/core';
74
42
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EACL,YAAY,EACZ,WAAW,EACX,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,aAAa,EACb,oBAAoB,EACrB,MAAM,0BAA0B,CAAA;AACjC,OAAO,EAAE,YAAY,EAAyB,MAAM,uBAAuB,CAAA;AAC3E,OAAO,EAAE,WAAW,EAAuB,MAAM,SAAS,CAAA;AAa1D,MAAM,OAAO,eAAe;IAClB,EAAE,GAA4B,IAAI,CAAA;IACzB,MAAM,CAAuB;IAE9C,IAAI,CAAsC;IAC1C,QAAQ,CAA0C;IAClD,YAAY,CAA8C;IAC1D,OAAO,CAAyC;IAChD,GAAG,CAAqC;IACxC,KAAK,CAAuC;IAC5C,KAAK,CAAuC;IAC5C,MAAM,CAAyC;IAE/C,YAAY,MAA6B;QACvC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAED,KAAK,CAAC,IAAI;QACR,MAAM,OAAO,GACX,IAAI,CAAC,MAAM,CAAC,OAAO,IAAI,IAAI,CAAC,MAAM,CAAC,OAAO,KAAK,UAAU;YACvD,CAAC,CA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AC;AACrC,CAAC;AAUD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC"}
@@ -0,0 +1,250 @@
1
+ import { type Result } from 'ts-micro-result';
2
+ import type { AuthResult, FetchEnvelope, FetchGuardOptions, FetchGuardRequestInit } from './types';
3
+ /**
4
+ * FetchGuard Client - main interface cho việc gọi API thông qua Web Worker
5
+ */
6
+ export declare class FetchGuardClient {
7
+ private worker;
8
+ private messageId;
9
+ private pendingRequests;
10
+ /** Track request URLs for debug hooks */
11
+ private requestUrls;
12
+ /** Track request timing for metrics */
13
+ private requestTimings;
14
+ private authListeners;
15
+ private readyListeners;
16
+ private isReady;
17
+ private requestQueue;
18
+ private activeRequests;
19
+ private readonly maxConcurrent;
20
+ private readonly maxQueueSize;
21
+ private readonly setupTimeout;
22
+ private readonly requestTimeout;
23
+ private setupResolve?;
24
+ private setupReject?;
25
+ private readonly debug?;
26
+ private readonly retry?;
27
+ private readonly dedupe?;
28
+ /** In-flight requests for deduplication */
29
+ private readonly inFlightRequests;
30
+ /** Recent completed requests for time-window deduplication */
31
+ private readonly recentResults;
32
+ constructor(options: FetchGuardOptions);
33
+ /**
34
+ * Initialize worker with config and provider
35
+ */
36
+ private initializeWorker;
37
+ /**
38
+ * Handle worker messages
39
+ */
40
+ private handleWorkerMessage;
41
+ /**
42
+ * Handle worker errors
43
+ */
44
+ private handleWorkerError;
45
+ /**
46
+ * Generate unique message ID
47
+ */
48
+ private generateMessageId;
49
+ /**
50
+ * Make API request with optional deduplication, retry, and AbortSignal support
51
+ *
52
+ * @param url - Full URL to fetch
53
+ * @param options - Request options including optional AbortSignal
54
+ * @returns Result with FetchEnvelope on success, error on failure
55
+ *
56
+ * @example
57
+ * // With AbortSignal
58
+ * const controller = new AbortController()
59
+ * setTimeout(() => controller.abort(), 5000)
60
+ * const result = await api.fetch('/slow', { signal: controller.signal })
61
+ */
62
+ fetch(url: string, options?: FetchGuardRequestInit): Promise<Result<FetchEnvelope>>;
63
+ /**
64
+ * Wrap a promise with AbortSignal support
65
+ */
66
+ private wrapWithAbortSignal;
67
+ /**
68
+ * Fetch with retry logic and AbortSignal support (internal)
69
+ */
70
+ private fetchWithRetryAndSignal;
71
+ /**
72
+ * Generate deduplication key for request
73
+ * Returns null if request should not be deduplicated
74
+ */
75
+ private getDedupeKey;
76
+ /**
77
+ * Apply jitter to a delay value
78
+ * Jitter adds ±(jitter * delay) randomness to prevent thundering herd
79
+ * @param delay - Base delay in milliseconds
80
+ * @param jitter - Jitter factor (0-1)
81
+ * @returns Jittered delay
82
+ */
83
+ private applyJitter;
84
+ /**
85
+ * Default retry condition - only retry on NETWORK_ERROR
86
+ */
87
+ private defaultShouldRetry;
88
+ /**
89
+ * Calculate request metrics from timing data
90
+ */
91
+ private calculateMetrics;
92
+ /**
93
+ * Sleep helper for retry delay
94
+ */
95
+ private sleep;
96
+ /**
97
+ * Sleep with abort signal support
98
+ * Returns true if aborted, false if completed normally
99
+ */
100
+ private sleepWithAbort;
101
+ /**
102
+ * Fetch with id for external cancellation
103
+ * Returns { id, result, cancel }
104
+ * Now uses queue system for sequential processing
105
+ */
106
+ fetchWithId(url: string, options?: FetchGuardRequestInit): {
107
+ id: string;
108
+ result: Promise<Result<FetchEnvelope>>;
109
+ cancel: () => void;
110
+ };
111
+ /**
112
+ * Cancel a pending request by ID
113
+ */
114
+ cancel(id: string): void;
115
+ /**
116
+ * Convenience methods
117
+ */
118
+ get(url: string, options?: Omit<FetchGuardRequestInit, 'method' | 'body'>): Promise<Result<FetchEnvelope>>;
119
+ post(url: string, body?: unknown, options?: Omit<FetchGuardRequestInit, 'method' | 'body'>): Promise<Result<FetchEnvelope>>;
120
+ put(url: string, body?: unknown, options?: Omit<FetchGuardRequestInit, 'method' | 'body'>): Promise<Result<FetchEnvelope>>;
121
+ delete(url: string, options?: Omit<FetchGuardRequestInit, 'method' | 'body'>): Promise<Result<FetchEnvelope>>;
122
+ patch(url: string, body?: unknown, options?: Omit<FetchGuardRequestInit, 'method' | 'body'>): Promise<Result<FetchEnvelope>>;
123
+ /**
124
+ * Typed data-API call.
125
+ *
126
+ * Issues the HTTP request through the Worker (tokens stay isolated) and
127
+ * deserializes the backend's ts-micro-result envelope into a domain
128
+ * `Result<T>` — so callers no longer hand-write "judge status + parse JSON +
129
+ * map errors". This is the entry point the contract-driven typed client uses
130
+ * for `kind: 'data'` endpoints.
131
+ *
132
+ * Auth-lifecycle endpoints (login/refresh/exchange/logout) must NOT use this —
133
+ * they go through login()/exchangeToken()/logout() because they touch the
134
+ * Worker's refresh-token storage.
135
+ */
136
+ callJson<T>(method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE', url: string, body?: unknown, options?: Omit<FetchGuardRequestInit, 'method' | 'body'>): Promise<Result<T>>;
137
+ /**
138
+ * Generic method to call any auth method on provider
139
+ * @param method - Method name (login, logout, loginWithPhone, etc.)
140
+ * @param emitEvent - Whether to emit AUTH_STATE_CHANGED event (default: true)
141
+ * @param args - Arguments to pass to the method
142
+ * @returns Promise<Result<AuthResult>> - Always returns AuthResult
143
+ */
144
+ call(method: string, emitEvent?: boolean, ...args: unknown[]): Promise<Result<AuthResult>>;
145
+ /**
146
+ * Convenience wrapper for login
147
+ * @param payload - Login credentials
148
+ * @param url - Optional URL override
149
+ * @param emitEvent - Whether to emit AUTH_STATE_CHANGED event (default: true)
150
+ */
151
+ login(payload?: unknown, url?: string, emitEvent?: boolean): Promise<Result<AuthResult>>;
152
+ /**
153
+ * Convenience wrapper for logout
154
+ * @param payload - Optional logout payload
155
+ * @param emitEvent - Whether to emit AUTH_STATE_CHANGED event (default: true)
156
+ */
157
+ logout(payload?: unknown, emitEvent?: boolean): Promise<Result<AuthResult>>;
158
+ /**
159
+ * Convenience wrapper for refreshToken
160
+ * @param emitEvent - Whether to emit AUTH_STATE_CHANGED event (default: true)
161
+ */
162
+ refreshToken(emitEvent?: boolean): Promise<Result<AuthResult>>;
163
+ /**
164
+ * Exchange current token for a new one with different context
165
+ *
166
+ * Useful for:
167
+ * - Switching tenants in multi-tenant apps
168
+ * - Changing authorization scope
169
+ * - Impersonating users (admin feature)
170
+ *
171
+ * @param url - URL to call for token exchange
172
+ * @param options - Exchange options (method, payload, headers)
173
+ * @param emitEvent - Whether to emit AUTH_STATE_CHANGED event (default: true)
174
+ *
175
+ * @example
176
+ * // Switch tenant
177
+ * await api.exchangeToken('https://auth.example.com/auth/select-tenant', {
178
+ * payload: { tenantId: 'tenant_123' }
179
+ * })
180
+ *
181
+ * // Change scope with PUT method
182
+ * await api.exchangeToken('https://auth.example.com/auth/switch-context', {
183
+ * method: 'PUT',
184
+ * payload: { scope: 'admin' }
185
+ * })
186
+ *
187
+ * // With custom headers (overrides defaultHeaders)
188
+ * await api.exchangeToken('https://auth.example.com/auth/impersonate', {
189
+ * payload: { userId: 'user_456' },
190
+ * headers: { 'X-Impersonate-Reason': 'support-ticket-123' }
191
+ * })
192
+ */
193
+ exchangeToken(url: string, options?: {
194
+ method?: 'POST' | 'PUT';
195
+ payload?: Record<string, unknown>;
196
+ headers?: Record<string, string>;
197
+ }, emitEvent?: boolean): Promise<Result<AuthResult>>;
198
+ /**
199
+ * Check if worker is ready
200
+ */
201
+ ready(): boolean;
202
+ /**
203
+ * Wait for worker to be ready
204
+ * Returns immediately if already ready
205
+ */
206
+ whenReady(): Promise<void>;
207
+ /**
208
+ * Subscribe to ready event
209
+ * Callback is called immediately if already ready
210
+ */
211
+ onReady(callback: () => void): () => void;
212
+ /**
213
+ * Subscribe to auth state changes
214
+ */
215
+ onAuthStateChanged(cb: (state: AuthResult) => void): () => void;
216
+ /** Send PING and await PONG */
217
+ ping(): Promise<Result<{
218
+ timestamp: number;
219
+ }>>;
220
+ /**
221
+ * Send message through queue system
222
+ * All messages go through queue for sequential processing
223
+ * @param transferables - Optional Transferable objects for zero-copy postMessage
224
+ */
225
+ private sendMessageQueued;
226
+ /**
227
+ * Process message queue with concurrency limit
228
+ *
229
+ * Uses semaphore pattern to allow N concurrent requests.
230
+ * Benefits:
231
+ * - Higher throughput than sequential processing
232
+ * - Backpressure via maxConcurrent limit
233
+ * - Better error isolation (one failure doesn't affect others)
234
+ */
235
+ private processQueue;
236
+ /**
237
+ * Called when a request completes (success or error)
238
+ * Decrements active count and processes next items in queue
239
+ */
240
+ private onRequestComplete;
241
+ /**
242
+ * Cleanup - terminate worker
243
+ */
244
+ destroy(): void;
245
+ }
246
+ /**
247
+ * Factory function to create FetchGuard client
248
+ */
249
+ export declare function createClient(options: FetchGuardOptions): FetchGuardClient;
250
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/transport/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAMvD,OAAO,KAAK,EACV,UAAU,EAGV,aAAa,EACb,iBAAiB,EACjB,qBAAqB,EAMtB,MAAM,SAAS,CAAC;AAsCjB;;GAEG;AACH,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,SAAS,CAAK;IAGtB,OAAO,CAAC,eAAe,CAMnB;IACJ,yCAAyC;IACzC,OAAO,CAAC,WAAW,CAA6B;IAChD,uCAAuC;IACvC,OAAO,CAAC,cAAc,CAAoC;IAC1D,OAAO,CAAC,aAAa,CAA0C;IAC/D,OAAO,CAAC,cAAc,CAAyB;IAC/C,OAAO,CAAC,OAAO,CAAS;IAExB,OAAO,CAAC,YAAY,CAAmB;IACvC,OAAO,CAAC,cAAc,CAAK;IAC3B,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAS;IACvC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAS;IACtC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAS;IACtC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAS;IACxC,OAAO,CAAC,YAAY,CAAC,CAAa;IAClC,OAAO,CAAC,WAAW,CAAC,CAAyB;IAC7C,OAAO,CAAC,QAAQ,CAAC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