@oapiex/sdk-kit 0.1.2 → 0.1.3

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.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { _ as CountryCodeRestricted, a as InitOptions, c as Response, d as UnifiedResponse, f as UserConfig, g as CountryCode, h as XGenericObject, i as ErrorResponse, l as ResponseStatus, m as ValidationErrorResponse, n as AuthResponse, o as NormalPagination, p as ValidationError, r as CursorPagination, s as PageInfoMeta, t as AuthErrorResponse, u as SuccessResponse, v as CurrencyCode } from "./index-BYtse_Mh.cjs";
1
+ import { A as CurrencyCode, C as UserConfig, D as XGenericObject, E as ValidationErrorResponse, O as CountryCode, S as UnifiedResponse, T as ValidationError, _ as OAuth2AuthConfig, a as AuthErrorResponse, b as ResponseStatus, c as BasicAuthConfig, d as CustomAuthConfig, f as Environment, g as NormalPagination, h as InitOptions, i as AuthConfig, k as CountryCodeRestricted, l as BearerAuthConfig, m as HttpMethod, n as AccessValidationResult, o as AuthRequestConfig, p as ErrorResponse, r as ApiKeyAuthConfig, s as AuthResponse, t as AccessValidationConfigUpdate, u as CursorPagination, v as PageInfoMeta, w as UserUrls, x as SuccessResponse, y as Response } from "./index-JjhthUpt.cjs";
2
2
  import * as axios0 from "axios";
3
3
  import { RawAxiosRequestHeaders } from "axios";
4
4
 
@@ -17,12 +17,36 @@ interface RuntimeSdkParameterManifest {
17
17
  accessor: string;
18
18
  in: 'query' | 'header' | 'path';
19
19
  required: boolean;
20
+ description?: string;
21
+ }
22
+ interface RuntimeSdkSecurityRequirementSchemeManifest {
23
+ name: string;
24
+ scopes: string[];
25
+ }
26
+ interface RuntimeSdkSecurityRequirementManifest {
27
+ schemes: RuntimeSdkSecurityRequirementSchemeManifest[];
28
+ }
29
+ interface RuntimeSdkSecuritySchemeManifest {
30
+ name: string;
31
+ helperName: string;
32
+ description?: string;
33
+ type: 'http' | 'apiKey' | 'oauth2' | 'openIdConnect';
34
+ authType: 'bearer' | 'basic' | 'apiKey' | 'oauth2';
35
+ scheme?: string;
36
+ bearerFormat?: string;
37
+ in?: 'header' | 'query' | 'cookie';
38
+ parameterName?: string;
39
+ openIdConnectUrl?: string;
40
+ scopes?: string[];
20
41
  }
21
42
  interface RuntimeSdkOperationManifest {
22
43
  path: string;
23
44
  method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
24
45
  methodName: string;
25
46
  summary?: string;
47
+ description?: string;
48
+ requestBodyDescription?: string;
49
+ responseDescription?: string;
26
50
  operationId?: string;
27
51
  responseType: string;
28
52
  inputType: string;
@@ -34,6 +58,7 @@ interface RuntimeSdkOperationManifest {
34
58
  pathParams: RuntimeSdkParameterManifest[];
35
59
  queryParams: RuntimeSdkParameterManifest[];
36
60
  headerParams: RuntimeSdkParameterManifest[];
61
+ security?: RuntimeSdkSecurityRequirementManifest[];
37
62
  }
38
63
  interface RuntimeSdkGroupManifest {
39
64
  className: string;
@@ -42,6 +67,8 @@ interface RuntimeSdkGroupManifest {
42
67
  }
43
68
  interface RuntimeSdkManifest {
44
69
  groups: RuntimeSdkGroupManifest[];
70
+ securitySchemes: RuntimeSdkSecuritySchemeManifest[];
71
+ security?: RuntimeSdkSecurityRequirementManifest[];
45
72
  }
46
73
  interface RuntimeSdkBundle<TApi$1 = unknown> {
47
74
  document: unknown;
@@ -71,16 +98,16 @@ type InferRuntimeSdkApi<TBundle> = '__api' extends keyof TBundle ? TBundle exten
71
98
  declare class Builder {
72
99
  private static baseUrls;
73
100
  /**
74
- * Flutterwave Environment
101
+ * API Environment
75
102
  */
76
- static environment?: 'sandbox' | 'live';
103
+ static environment?: Environment;
77
104
  constructor();
78
105
  /**
79
106
  * Sets the environment for the builder
80
107
  *
81
108
  * @param env
82
109
  */
83
- static setEnvironment(env: 'sandbox' | 'live'): void;
110
+ static setEnvironment(env: Environment): void;
84
111
  /**
85
112
  * Gets the base url based on environment
86
113
  *
@@ -139,6 +166,8 @@ declare class Builder {
139
166
  * @returns
140
167
  */
141
168
  static encryptAES(data: string, token: string, nonce: string): Promise<string>;
169
+ private static normalizeBaseUrl;
170
+ private static normalizeEnvironment;
142
171
  }
143
172
  //#endregion
144
173
  //#region src/Core.d.ts
@@ -154,7 +183,7 @@ declare class Core {
154
183
  */
155
184
  private clientSecret;
156
185
  /**
157
- * Flutterwave Environment
186
+ * API Environment
158
187
  */
159
188
  private environment;
160
189
  private accessValidator?;
@@ -174,7 +203,7 @@ declare class Core {
174
203
  * @param encryptionKey
175
204
  */
176
205
  constructor(clientId?: InitOptions);
177
- constructor(clientId?: string, clientSecret?: string, encryptionKey?: string, env?: 'sandbox' | 'live');
206
+ constructor(clientId?: string, clientSecret?: string, encryptionKey?: string, env?: Environment, config?: Partial<UserConfig>);
178
207
  protected createApi(): BaseApi;
179
208
  /**
180
209
  * Initializes the Core instance
@@ -186,7 +215,8 @@ declare class Core {
186
215
  * @returns
187
216
  */
188
217
  init(clientId?: InitOptions): this;
189
- init(clientId?: string, clientSecret?: string, encryptionKey?: string, env?: 'sandbox' | 'live'): this;
218
+ init(clientId?: string, clientSecret?: string, encryptionKey?: string, env?: Environment, config?: Partial<UserConfig>): this;
219
+ configure(config: Partial<UserConfig>): this;
190
220
  /**
191
221
  * Set the debug level
192
222
  *
@@ -199,13 +229,33 @@ declare class Core {
199
229
  *
200
230
  * @returns
201
231
  */
202
- getEnvironment(): "sandbox" | "live";
232
+ getEnvironment(): Environment;
233
+ /**
234
+ * Get the configured client identifier.
235
+ */
236
+ getClientId(): string;
237
+ /**
238
+ * Get the configured client secret.
239
+ */
240
+ getClientSecret(): string;
241
+ /**
242
+ * Get the current shared SDK config.
243
+ */
244
+ getConfig(): UserConfig;
245
+ /**
246
+ * Replace the active auth strategy.
247
+ */
248
+ setAuth(auth: AuthConfig | AuthConfig[]): this;
249
+ /**
250
+ * Clear any configured auth strategy.
251
+ */
252
+ clearAuth(): this;
203
253
  /**
204
254
  * Set access validator function
205
255
  *
206
256
  * @param validator Function to validate access
207
257
  */
208
- setAccessValidator(validator: (...args: any[]) => Promise<boolean | string>): void;
258
+ setAccessValidator(validator: (core: Core) => AccessValidationResult | Promise<AccessValidationResult>): this;
209
259
  /**
210
260
  * Validates access using the provided access validator function
211
261
  *
@@ -230,6 +280,10 @@ declare class Core {
230
280
  useSdk<TBundle extends RuntimeSdkBundle>(bundle: TBundle): this & {
231
281
  api: BaseApi & InferRuntimeSdkApi<TBundle>;
232
282
  };
283
+ private static normalizeEnvironment;
284
+ private isAuthConfigOrArray;
285
+ private isAuthConfig;
286
+ private isConfigUpdate;
233
287
  }
234
288
  //#endregion
235
289
  //#region src/Exceptions/ForbiddenRequestException.d.ts
@@ -262,7 +316,7 @@ declare class HttpException extends Error {
262
316
  * @param code
263
317
  * @param data
264
318
  */
265
- static fromCode(code: number, data: Required<UnifiedResponse>, parent?: Error): BadRequestException | ForbiddenRequestException | UnauthorizedRequestException | HttpException;
319
+ static fromCode(code: number, data: Required<UnifiedResponse>, parent?: Error): ForbiddenRequestException | BadRequestException | HttpException | UnauthorizedRequestException;
266
320
  }
267
321
  //#endregion
268
322
  //#region src/Apis/BaseApi.d.ts
@@ -376,7 +430,7 @@ declare class Http {
376
430
  /**
377
431
  * Bearer token
378
432
  */
379
- private static bearerToken;
433
+ private static bearerToken?;
380
434
  /**
381
435
  * Debug level
382
436
  */
@@ -409,6 +463,10 @@ declare class Http {
409
463
  * @param token
410
464
  */
411
465
  static setBearerToken(token: string): void;
466
+ static setAuth(auth: AuthConfig | AuthConfig[]): void;
467
+ static setBasicAuth(username: string, password: string): void;
468
+ static setApiKey(name: string, value: string, location?: 'header' | 'query' | 'cookie', prefix?: string): void;
469
+ static clearAuth(): void;
412
470
  setDefaultHeaders(defaults: Record<string, string>): void;
413
471
  getHeaders(): RawAxiosRequestHeaders;
414
472
  getBody(): any;
@@ -430,7 +488,12 @@ declare class Http {
430
488
  * @param params
431
489
  * @returns
432
490
  */
433
- static send<R = any, M extends XGenericObject = XGenericObject>(url: string, method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE', body?: any, headers?: RawAxiosRequestHeaders, params?: XGenericObject): Promise<UnifiedResponse<R, M>>;
491
+ static send<R = any, M extends XGenericObject = XGenericObject>(url: string, method: HttpMethod, body?: any, headers?: RawAxiosRequestHeaders, params?: XGenericObject): Promise<UnifiedResponse<R, M>>;
492
+ private static prepareRequest;
493
+ private static getConfiguredAuth;
494
+ private static applyAuth;
495
+ private static setHeaderIfMissing;
496
+ private static appendCookie;
434
497
  /**
435
498
  * Create an HttpException from status and error
436
499
  *
@@ -439,6 +502,7 @@ declare class Http {
439
502
  * @returns
440
503
  */
441
504
  private static exception;
505
+ private static toHeaderRecord;
442
506
  }
443
507
  //#endregion
444
508
  //#region src/RuntimeSdk.d.ts
@@ -449,6 +513,29 @@ declare const createSdk: <TBundle extends RuntimeSdkBundle>(bundle: TBundle, opt
449
513
  api: BaseApi & InferRuntimeSdkApi<TBundle>;
450
514
  };
451
515
  //#endregion
516
+ //#region src/utilities/AuthCache.d.ts
517
+ interface CachedAuthValue {
518
+ auth: AuthConfig | AuthConfig[];
519
+ expiresAt?: number;
520
+ }
521
+ interface CachedAccessTokenValue {
522
+ token: string;
523
+ tokenType?: string;
524
+ expiresAt?: number;
525
+ expiresInMs?: number;
526
+ expiresInSeconds?: number;
527
+ }
528
+ type AuthCacheLoader = (core: Core) => Promise<CachedAuthValue>;
529
+ type AccessTokenCacheLoader = (core: Core) => Promise<CachedAccessTokenValue>;
530
+ /**
531
+ * Cache any auth payload returned from a loader until it expires.
532
+ */
533
+ declare const createAuthCache: (loader: AuthCacheLoader) => (core: Core) => Promise<AuthConfig | AuthConfig[]>;
534
+ /**
535
+ * Cache bearer or oauth-style access tokens returned from a loader until expiry.
536
+ */
537
+ declare const createAccessTokenCache: (loader: AccessTokenCacheLoader) => (core: Core) => Promise<AuthConfig | AuthConfig[]>;
538
+ //#endregion
452
539
  //#region src/utilities/helpers.d.ts
453
540
  /**
454
541
  * Takes a value like the one prodvided in a destructuring assignment where for instance
@@ -482,6 +569,8 @@ declare const buildUrl: (baseUrl: string, ...endpoint: string[]) => string;
482
569
  declare const defaultConfig: UserConfig;
483
570
  declare let globalConfig: UserConfig;
484
571
  declare const defineConfig: (config: Partial<UserConfig>) => UserConfig;
572
+ declare const getConfig: () => UserConfig;
573
+ declare const resetConfig: () => UserConfig;
485
574
  //#endregion
486
575
  //#region src/utilities/WebhookValidator.d.ts
487
576
  declare class WebhookValidator<Options extends XGenericObject = XGenericObject> {
@@ -524,4 +613,4 @@ declare class WebhookValidator<Options extends XGenericObject = XGenericObject>
524
613
  };
525
614
  }
526
615
  //#endregion
527
- export { AuthErrorResponse, AuthResponse, BadRequestException, BaseApi, Builder, Core, CountryCode, CountryCodeRestricted, CurrencyCode, CursorPagination, ErrorResponse, ForbiddenRequestException, Http, HttpException, InferRuntimeSdkApi, InitOptions, NormalPagination, PageInfoMeta, Response, ResponseStatus, RuntimeSdkBundle, RuntimeSdkGroupManifest, RuntimeSdkManifest, RuntimeSdkOperationManifest, RuntimeSdkParameterManifest, SuccessResponse, UnauthorizedRequestException, UnifiedResponse, UserConfig, ValidationError, ValidationErrorResponse, WebhookValidator, XGenericObject, buildUrl, createRuntimeApi, createSdk, defaultConfig, defineConfig, globalConfig, normalizeValue };
616
+ export { AccessTokenCacheLoader, AccessValidationConfigUpdate, AccessValidationResult, ApiKeyAuthConfig, AuthCacheLoader, AuthConfig, AuthErrorResponse, AuthRequestConfig, AuthResponse, BadRequestException, BaseApi, BasicAuthConfig, BearerAuthConfig, Builder, CachedAccessTokenValue, CachedAuthValue, Core, CountryCode, CountryCodeRestricted, CurrencyCode, CursorPagination, CustomAuthConfig, Environment, ErrorResponse, ForbiddenRequestException, Http, HttpException, HttpMethod, InferRuntimeSdkApi, InitOptions, NormalPagination, OAuth2AuthConfig, PageInfoMeta, Response, ResponseStatus, RuntimeSdkBundle, RuntimeSdkGroupManifest, RuntimeSdkManifest, RuntimeSdkOperationManifest, RuntimeSdkParameterManifest, RuntimeSdkSecurityRequirementManifest, RuntimeSdkSecurityRequirementSchemeManifest, RuntimeSdkSecuritySchemeManifest, SuccessResponse, UnauthorizedRequestException, UnifiedResponse, UserConfig, UserUrls, ValidationError, ValidationErrorResponse, WebhookValidator, XGenericObject, buildUrl, createAccessTokenCache, createAuthCache, createRuntimeApi, createSdk, defaultConfig, defineConfig, getConfig, globalConfig, normalizeValue, resetConfig };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { _ as CountryCodeRestricted, a as InitOptions, c as Response, d as UnifiedResponse, f as UserConfig, g as CountryCode, h as XGenericObject, i as ErrorResponse, l as ResponseStatus, m as ValidationErrorResponse, n as AuthResponse, o as NormalPagination, p as ValidationError, r as CursorPagination, s as PageInfoMeta, t as AuthErrorResponse, u as SuccessResponse, v as CurrencyCode } from "./index-sMTTpEJS.js";
1
+ import { A as CurrencyCode, C as UserConfig, D as XGenericObject, E as ValidationErrorResponse, O as CountryCode, S as UnifiedResponse, T as ValidationError, _ as OAuth2AuthConfig, a as AuthErrorResponse, b as ResponseStatus, c as BasicAuthConfig, d as CustomAuthConfig, f as Environment, g as NormalPagination, h as InitOptions, i as AuthConfig, k as CountryCodeRestricted, l as BearerAuthConfig, m as HttpMethod, n as AccessValidationResult, o as AuthRequestConfig, p as ErrorResponse, r as ApiKeyAuthConfig, s as AuthResponse, t as AccessValidationConfigUpdate, u as CursorPagination, v as PageInfoMeta, w as UserUrls, x as SuccessResponse, y as Response } from "./index-DUI9uPJQ.js";
2
2
  import "dotenv/config";
3
3
  import * as axios0 from "axios";
4
4
  import { RawAxiosRequestHeaders } from "axios";
@@ -18,12 +18,36 @@ interface RuntimeSdkParameterManifest {
18
18
  accessor: string;
19
19
  in: 'query' | 'header' | 'path';
20
20
  required: boolean;
21
+ description?: string;
22
+ }
23
+ interface RuntimeSdkSecurityRequirementSchemeManifest {
24
+ name: string;
25
+ scopes: string[];
26
+ }
27
+ interface RuntimeSdkSecurityRequirementManifest {
28
+ schemes: RuntimeSdkSecurityRequirementSchemeManifest[];
29
+ }
30
+ interface RuntimeSdkSecuritySchemeManifest {
31
+ name: string;
32
+ helperName: string;
33
+ description?: string;
34
+ type: 'http' | 'apiKey' | 'oauth2' | 'openIdConnect';
35
+ authType: 'bearer' | 'basic' | 'apiKey' | 'oauth2';
36
+ scheme?: string;
37
+ bearerFormat?: string;
38
+ in?: 'header' | 'query' | 'cookie';
39
+ parameterName?: string;
40
+ openIdConnectUrl?: string;
41
+ scopes?: string[];
21
42
  }
22
43
  interface RuntimeSdkOperationManifest {
23
44
  path: string;
24
45
  method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
25
46
  methodName: string;
26
47
  summary?: string;
48
+ description?: string;
49
+ requestBodyDescription?: string;
50
+ responseDescription?: string;
27
51
  operationId?: string;
28
52
  responseType: string;
29
53
  inputType: string;
@@ -35,6 +59,7 @@ interface RuntimeSdkOperationManifest {
35
59
  pathParams: RuntimeSdkParameterManifest[];
36
60
  queryParams: RuntimeSdkParameterManifest[];
37
61
  headerParams: RuntimeSdkParameterManifest[];
62
+ security?: RuntimeSdkSecurityRequirementManifest[];
38
63
  }
39
64
  interface RuntimeSdkGroupManifest {
40
65
  className: string;
@@ -43,6 +68,8 @@ interface RuntimeSdkGroupManifest {
43
68
  }
44
69
  interface RuntimeSdkManifest {
45
70
  groups: RuntimeSdkGroupManifest[];
71
+ securitySchemes: RuntimeSdkSecuritySchemeManifest[];
72
+ security?: RuntimeSdkSecurityRequirementManifest[];
46
73
  }
47
74
  interface RuntimeSdkBundle<TApi$1 = unknown> {
48
75
  document: unknown;
@@ -72,16 +99,16 @@ type InferRuntimeSdkApi<TBundle> = '__api' extends keyof TBundle ? TBundle exten
72
99
  declare class Builder {
73
100
  private static baseUrls;
74
101
  /**
75
- * Flutterwave Environment
102
+ * API Environment
76
103
  */
77
- static environment?: 'sandbox' | 'live';
104
+ static environment?: Environment;
78
105
  constructor();
79
106
  /**
80
107
  * Sets the environment for the builder
81
108
  *
82
109
  * @param env
83
110
  */
84
- static setEnvironment(env: 'sandbox' | 'live'): void;
111
+ static setEnvironment(env: Environment): void;
85
112
  /**
86
113
  * Gets the base url based on environment
87
114
  *
@@ -140,6 +167,8 @@ declare class Builder {
140
167
  * @returns
141
168
  */
142
169
  static encryptAES(data: string, token: string, nonce: string): Promise<string>;
170
+ private static normalizeBaseUrl;
171
+ private static normalizeEnvironment;
143
172
  }
144
173
  //#endregion
145
174
  //#region src/Core.d.ts
@@ -155,7 +184,7 @@ declare class Core {
155
184
  */
156
185
  private clientSecret;
157
186
  /**
158
- * Flutterwave Environment
187
+ * API Environment
159
188
  */
160
189
  private environment;
161
190
  private accessValidator?;
@@ -175,7 +204,7 @@ declare class Core {
175
204
  * @param encryptionKey
176
205
  */
177
206
  constructor(clientId?: InitOptions);
178
- constructor(clientId?: string, clientSecret?: string, encryptionKey?: string, env?: 'sandbox' | 'live');
207
+ constructor(clientId?: string, clientSecret?: string, encryptionKey?: string, env?: Environment, config?: Partial<UserConfig>);
179
208
  protected createApi(): BaseApi;
180
209
  /**
181
210
  * Initializes the Core instance
@@ -187,7 +216,8 @@ declare class Core {
187
216
  * @returns
188
217
  */
189
218
  init(clientId?: InitOptions): this;
190
- init(clientId?: string, clientSecret?: string, encryptionKey?: string, env?: 'sandbox' | 'live'): this;
219
+ init(clientId?: string, clientSecret?: string, encryptionKey?: string, env?: Environment, config?: Partial<UserConfig>): this;
220
+ configure(config: Partial<UserConfig>): this;
191
221
  /**
192
222
  * Set the debug level
193
223
  *
@@ -200,13 +230,33 @@ declare class Core {
200
230
  *
201
231
  * @returns
202
232
  */
203
- getEnvironment(): "sandbox" | "live";
233
+ getEnvironment(): Environment;
234
+ /**
235
+ * Get the configured client identifier.
236
+ */
237
+ getClientId(): string;
238
+ /**
239
+ * Get the configured client secret.
240
+ */
241
+ getClientSecret(): string;
242
+ /**
243
+ * Get the current shared SDK config.
244
+ */
245
+ getConfig(): UserConfig;
246
+ /**
247
+ * Replace the active auth strategy.
248
+ */
249
+ setAuth(auth: AuthConfig | AuthConfig[]): this;
250
+ /**
251
+ * Clear any configured auth strategy.
252
+ */
253
+ clearAuth(): this;
204
254
  /**
205
255
  * Set access validator function
206
256
  *
207
257
  * @param validator Function to validate access
208
258
  */
209
- setAccessValidator(validator: (...args: any[]) => Promise<boolean | string>): void;
259
+ setAccessValidator(validator: (core: Core) => AccessValidationResult | Promise<AccessValidationResult>): this;
210
260
  /**
211
261
  * Validates access using the provided access validator function
212
262
  *
@@ -231,6 +281,10 @@ declare class Core {
231
281
  useSdk<TBundle extends RuntimeSdkBundle>(bundle: TBundle): this & {
232
282
  api: BaseApi & InferRuntimeSdkApi<TBundle>;
233
283
  };
284
+ private static normalizeEnvironment;
285
+ private isAuthConfigOrArray;
286
+ private isAuthConfig;
287
+ private isConfigUpdate;
234
288
  }
235
289
  //#endregion
236
290
  //#region src/Exceptions/ForbiddenRequestException.d.ts
@@ -263,7 +317,7 @@ declare class HttpException extends Error {
263
317
  * @param code
264
318
  * @param data
265
319
  */
266
- static fromCode(code: number, data: Required<UnifiedResponse>, parent?: Error): BadRequestException | ForbiddenRequestException | UnauthorizedRequestException | HttpException;
320
+ static fromCode(code: number, data: Required<UnifiedResponse>, parent?: Error): ForbiddenRequestException | BadRequestException | HttpException | UnauthorizedRequestException;
267
321
  }
268
322
  //#endregion
269
323
  //#region src/Apis/BaseApi.d.ts
@@ -377,7 +431,7 @@ declare class Http {
377
431
  /**
378
432
  * Bearer token
379
433
  */
380
- private static bearerToken;
434
+ private static bearerToken?;
381
435
  /**
382
436
  * Debug level
383
437
  */
@@ -410,6 +464,10 @@ declare class Http {
410
464
  * @param token
411
465
  */
412
466
  static setBearerToken(token: string): void;
467
+ static setAuth(auth: AuthConfig | AuthConfig[]): void;
468
+ static setBasicAuth(username: string, password: string): void;
469
+ static setApiKey(name: string, value: string, location?: 'header' | 'query' | 'cookie', prefix?: string): void;
470
+ static clearAuth(): void;
413
471
  setDefaultHeaders(defaults: Record<string, string>): void;
414
472
  getHeaders(): RawAxiosRequestHeaders;
415
473
  getBody(): any;
@@ -431,7 +489,12 @@ declare class Http {
431
489
  * @param params
432
490
  * @returns
433
491
  */
434
- static send<R = any, M extends XGenericObject = XGenericObject>(url: string, method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE', body?: any, headers?: RawAxiosRequestHeaders, params?: XGenericObject): Promise<UnifiedResponse<R, M>>;
492
+ static send<R = any, M extends XGenericObject = XGenericObject>(url: string, method: HttpMethod, body?: any, headers?: RawAxiosRequestHeaders, params?: XGenericObject): Promise<UnifiedResponse<R, M>>;
493
+ private static prepareRequest;
494
+ private static getConfiguredAuth;
495
+ private static applyAuth;
496
+ private static setHeaderIfMissing;
497
+ private static appendCookie;
435
498
  /**
436
499
  * Create an HttpException from status and error
437
500
  *
@@ -440,6 +503,7 @@ declare class Http {
440
503
  * @returns
441
504
  */
442
505
  private static exception;
506
+ private static toHeaderRecord;
443
507
  }
444
508
  //#endregion
445
509
  //#region src/RuntimeSdk.d.ts
@@ -450,6 +514,29 @@ declare const createSdk: <TBundle extends RuntimeSdkBundle>(bundle: TBundle, opt
450
514
  api: BaseApi & InferRuntimeSdkApi<TBundle>;
451
515
  };
452
516
  //#endregion
517
+ //#region src/utilities/AuthCache.d.ts
518
+ interface CachedAuthValue {
519
+ auth: AuthConfig | AuthConfig[];
520
+ expiresAt?: number;
521
+ }
522
+ interface CachedAccessTokenValue {
523
+ token: string;
524
+ tokenType?: string;
525
+ expiresAt?: number;
526
+ expiresInMs?: number;
527
+ expiresInSeconds?: number;
528
+ }
529
+ type AuthCacheLoader = (core: Core) => Promise<CachedAuthValue>;
530
+ type AccessTokenCacheLoader = (core: Core) => Promise<CachedAccessTokenValue>;
531
+ /**
532
+ * Cache any auth payload returned from a loader until it expires.
533
+ */
534
+ declare const createAuthCache: (loader: AuthCacheLoader) => (core: Core) => Promise<AuthConfig | AuthConfig[]>;
535
+ /**
536
+ * Cache bearer or oauth-style access tokens returned from a loader until expiry.
537
+ */
538
+ declare const createAccessTokenCache: (loader: AccessTokenCacheLoader) => (core: Core) => Promise<AuthConfig | AuthConfig[]>;
539
+ //#endregion
453
540
  //#region src/utilities/helpers.d.ts
454
541
  /**
455
542
  * Takes a value like the one prodvided in a destructuring assignment where for instance
@@ -483,6 +570,8 @@ declare const buildUrl: (baseUrl: string, ...endpoint: string[]) => string;
483
570
  declare const defaultConfig: UserConfig;
484
571
  declare let globalConfig: UserConfig;
485
572
  declare const defineConfig: (config: Partial<UserConfig>) => UserConfig;
573
+ declare const getConfig: () => UserConfig;
574
+ declare const resetConfig: () => UserConfig;
486
575
  //#endregion
487
576
  //#region src/utilities/WebhookValidator.d.ts
488
577
  declare class WebhookValidator<Options extends XGenericObject = XGenericObject> {
@@ -525,4 +614,4 @@ declare class WebhookValidator<Options extends XGenericObject = XGenericObject>
525
614
  };
526
615
  }
527
616
  //#endregion
528
- export { AuthErrorResponse, AuthResponse, BadRequestException, BaseApi, Builder, Core, CountryCode, CountryCodeRestricted, CurrencyCode, CursorPagination, ErrorResponse, ForbiddenRequestException, Http, HttpException, InferRuntimeSdkApi, InitOptions, NormalPagination, PageInfoMeta, Response, ResponseStatus, RuntimeSdkBundle, RuntimeSdkGroupManifest, RuntimeSdkManifest, RuntimeSdkOperationManifest, RuntimeSdkParameterManifest, SuccessResponse, UnauthorizedRequestException, UnifiedResponse, UserConfig, ValidationError, ValidationErrorResponse, WebhookValidator, XGenericObject, buildUrl, createRuntimeApi, createSdk, defaultConfig, defineConfig, globalConfig, normalizeValue };
617
+ export { AccessTokenCacheLoader, AccessValidationConfigUpdate, AccessValidationResult, ApiKeyAuthConfig, AuthCacheLoader, AuthConfig, AuthErrorResponse, AuthRequestConfig, AuthResponse, BadRequestException, BaseApi, BasicAuthConfig, BearerAuthConfig, Builder, CachedAccessTokenValue, CachedAuthValue, Core, CountryCode, CountryCodeRestricted, CurrencyCode, CursorPagination, CustomAuthConfig, Environment, ErrorResponse, ForbiddenRequestException, Http, HttpException, HttpMethod, InferRuntimeSdkApi, InitOptions, NormalPagination, OAuth2AuthConfig, PageInfoMeta, Response, ResponseStatus, RuntimeSdkBundle, RuntimeSdkGroupManifest, RuntimeSdkManifest, RuntimeSdkOperationManifest, RuntimeSdkParameterManifest, RuntimeSdkSecurityRequirementManifest, RuntimeSdkSecurityRequirementSchemeManifest, RuntimeSdkSecuritySchemeManifest, SuccessResponse, UnauthorizedRequestException, UnifiedResponse, UserConfig, UserUrls, ValidationError, ValidationErrorResponse, WebhookValidator, XGenericObject, buildUrl, createAccessTokenCache, createAuthCache, createRuntimeApi, createSdk, defaultConfig, defineConfig, getConfig, globalConfig, normalizeValue, resetConfig };