@adsk-platform/httpclient 0.1.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.
@@ -0,0 +1,8 @@
1
+ import { AccessTokenProvider as IAccessTokenProvider, AllowedHostsValidator } from '@microsoft/kiota-abstractions';
2
+ export declare class AccessTokenProvider implements IAccessTokenProvider {
3
+ private getAccessToken;
4
+ constructor(getAccessToken: () => Promise<string>);
5
+ getAuthorizationToken(url?: string, additionalAuthenticationContext?: Record<string, unknown>): Promise<string>;
6
+ getAllowedHostsValidator(): AllowedHostsValidator;
7
+ }
8
+ //# sourceMappingURL=accessTokenProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"accessTokenProvider.d.ts","sourceRoot":"","sources":["../../src/accessTokenProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,IAAI,oBAAoB,EAAE,qBAAqB,EAAsB,MAAM,+BAA+B,CAAC;AACvI,qBAAa,mBAAoB,YAAW,oBAAoB;IAChD,OAAO,CAAC,cAAc;gBAAd,cAAc,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC;IACnD,qBAAqB,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,+BAA+B,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;IAGrH,wBAAwB,IAAI,qBAAqB;CAIpD"}
@@ -0,0 +1,6 @@
1
+ import { HttpClient, FetchRequestAdapter } from '@microsoft/kiota-http-fetchlibrary';
2
+ export declare class HttpClientFactory {
3
+ static create(customFetch?: (request: string, init: RequestInit) => Promise<Response>): HttpClient;
4
+ static createFetchRequestAdapter(getAccessToken: () => Promise<string>, httpClient: HttpClient): FetchRequestAdapter;
5
+ }
6
+ //# sourceMappingURL=httpClientFactory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"httpClientFactory.d.ts","sourceRoot":"","sources":["../../src/httpClientFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAqB,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAIxG,qBAAa,iBAAiB;IAC1B,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,GAAG,UAAU;IAOlG,MAAM,CAAC,yBAAyB,CAAC,cAAc,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,EAAE,UAAU,EAAE,UAAU,GAAG,mBAAmB;CASvH"}
@@ -0,0 +1,2 @@
1
+ export * from './httpClientFactory.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC"}
@@ -0,0 +1,40 @@
1
+ import { RequestOption } from '@microsoft/kiota-abstractions';
2
+ import { Middleware } from '@microsoft/kiota-http-fetchlibrary';
3
+ import { ErrorHandlerOptions } from './options/errorHandlerOptions.js';
4
+ /**
5
+ * Middleware
6
+ * Class for ErrorHandler
7
+ */
8
+ export declare class ErrorHandler implements Middleware {
9
+ private readonly options;
10
+ /**
11
+ *
12
+ * The next middleware in the middleware chain
13
+ */
14
+ next: Middleware | undefined;
15
+ /**
16
+ *
17
+ * To create an instance of ErrorHandler
18
+ * @param [options] - The error handler options value
19
+ * @returns An instance of ErrorHandler
20
+ */
21
+ constructor(options?: ErrorHandlerOptions);
22
+ /**
23
+ * To execute the current middleware
24
+ * @param url - The request url
25
+ * @param requestInit - The request options
26
+ * @param requestOptions - The request options
27
+ * @returns A Promise that resolves to nothing
28
+ */
29
+ execute(url: string, requestInit: RequestInit, requestOptions?: Record<string, RequestOption>): Promise<Response>;
30
+ private isSuccessStatusCode;
31
+ }
32
+ export declare class HttpRequestError extends Error {
33
+ statusCode?: number | undefined;
34
+ constructor(message: string, statusCode?: number | undefined, context?: {
35
+ url: string;
36
+ request: RequestInit;
37
+ response: Response;
38
+ });
39
+ }
40
+ //# sourceMappingURL=errorHandler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errorHandler.d.ts","sourceRoot":"","sources":["../../../src/middleware/errorHandler.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAEnE,OAAO,EAAsC,KAAK,UAAU,EAAE,MAAM,oCAAoC,CAAC;AACzG,OAAO,EAAyB,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAE9F;;;GAGG;AACH,qBAAa,YAAa,YAAW,UAAU;IAcxB,OAAO,CAAC,QAAQ,CAAC,OAAO;IAZ3C;;;OAGG;IACH,IAAI,EAAE,UAAU,GAAG,SAAS,CAAC;IAE7B;;;;;OAKG;gBACiC,OAAO,GAAE,mBAA+C;IAE5F;;;;;;OAMG;IACU,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC;IAqC9H,OAAO,CAAC,mBAAmB;CAG9B;AACD,qBAAa,gBAAiB,SAAQ,KAAK;IAEH,UAAU,CAAC,EAAE,MAAM;gBAA3C,OAAO,EAAE,MAAM,EAAS,UAAU,CAAC,EAAE,MAAM,YAAA,EAAE,OAAO,CAAC,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,WAAW,CAAC;QAAC,QAAQ,EAAE,QAAQ,CAAA;KAAE;CAU/H"}
@@ -0,0 +1,8 @@
1
+ import { RequestOption } from '@microsoft/kiota-abstractions';
2
+ export declare const ErrorHandlerOptionKey = "ErrorHandlerOptionKey";
3
+ export declare class ErrorHandlerOptions implements RequestOption {
4
+ enabled: boolean;
5
+ constructor(enabled?: boolean);
6
+ getKey(): string;
7
+ }
8
+ //# sourceMappingURL=errorHandlerOptions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errorHandlerOptions.d.ts","sourceRoot":"","sources":["../../../../src/middleware/options/errorHandlerOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAEnE,eAAO,MAAM,qBAAqB,0BAA0B,CAAC;AAC7D,qBAAa,mBAAoB,YAAW,aAAa;IAClC,OAAO,EAAE,OAAO;gBAAhB,OAAO,GAAE,OAAc;IAE1C,MAAM,IAAI,MAAM;CAGnB"}
package/package.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "@adsk-platform/httpclient",
3
+ "private": false,
4
+ "version": "0.1.0",
5
+ "author": "duszykf",
6
+ "description": "Resilient HttpClient serving the Adsk Toolkit SDKs",
7
+ "engines": {
8
+ "bun": ">=1.0.0"
9
+ },
10
+ "license": "MIT",
11
+ "scripts": {
12
+ "build": "tsc --noEmit && vite build",
13
+ "prepublishOnly": "bun run build",
14
+ "test": "bun test"
15
+ },
16
+ "type": "module",
17
+ "exports": {
18
+ ".": {
19
+ "types": "./src/index.ts",
20
+ "import": "./_dist/index.es.js",
21
+ "default": "./_dist/index.umd.js"
22
+ }
23
+ },
24
+ "files": [
25
+ "_dist"
26
+ ],
27
+ "dependencies": {
28
+ "@microsoft/kiota-bundle": "^1.0.0-preview.98"
29
+ },
30
+ "devDependencies": {
31
+ "bun-fetch-mock": "1.0.0"
32
+ }
33
+ }