@sonisoft/now-sdk-ext-core 1.0.0-alpha.30 → 1.0.0-alpha.32
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/auth/AuthenticationHandlerFactory.d.ts +2 -1
- package/dist/auth/AuthenticationHandlerFactory.js +2 -2
- package/dist/auth/AuthenticationHandlerFactory.js.map +1 -1
- package/dist/auth/IAuthenticationHandler.d.ts +5 -4
- package/dist/auth/NowSDKAuthenticationHandler.d.ts +8 -5
- package/dist/auth/NowSDKAuthenticationHandler.js +23 -18
- package/dist/auth/NowSDKAuthenticationHandler.js.map +1 -1
- package/dist/comm/http/HttpResponse.d.ts +7 -14
- package/dist/comm/http/HttpResponse.js +6 -1
- package/dist/comm/http/HttpResponse.js.map +1 -1
- package/dist/comm/http/IHttpResponse.d.ts +7 -2
- package/dist/comm/http/IRequestHandler.d.ts +1 -3
- package/dist/comm/http/RequestHandler.d.ts +4 -13
- package/dist/comm/http/RequestHandler.js +105 -104
- package/dist/comm/http/RequestHandler.js.map +1 -1
- package/dist/comm/http/RequestHandlerFactory.d.ts +1 -2
- package/dist/comm/http/RequestHandlerFactory.js +2 -2
- package/dist/comm/http/RequestHandlerFactory.js.map +1 -1
- package/dist/comm/http/ServiceNowProcessorRequest.d.ts +2 -5
- package/dist/comm/http/ServiceNowProcessorRequest.js +14 -29
- package/dist/comm/http/ServiceNowProcessorRequest.js.map +1 -1
- package/dist/comm/http/ServiceNowRequest.d.ts +11 -12
- package/dist/comm/http/ServiceNowRequest.js +18 -14
- package/dist/comm/http/ServiceNowRequest.js.map +1 -1
- package/dist/comm/http/TableAPIRequest.d.ts +3 -3
- package/dist/comm/http/TableAPIRequest.js.map +1 -1
- package/dist/index.d.ts +1 -4
- package/dist/index.js +1 -4
- package/dist/index.js.map +1 -1
- package/dist/sn/Application.d.ts +18 -0
- package/dist/sn/Application.js +129 -0
- package/dist/sn/Application.js.map +1 -0
- package/dist/sn/IServiceNowInstance.d.ts +1 -0
- package/dist/sn/SNRequestBase.d.ts +4 -4
- package/dist/sn/SNRequestBase.js.map +1 -1
- package/dist/sn/ServiceNowInstance.d.ts +3 -0
- package/dist/sn/ServiceNowInstance.js +7 -0
- package/dist/sn/ServiceNowInstance.js.map +1 -1
- package/dist/sn/user/UserRequest.d.ts +2 -2
- package/dist/sn/user/UserRequest.js.map +1 -1
- package/package.json +12 -12
- package/dist/comm/http/IUserSession.d.ts +0 -8
- package/dist/comm/http/IUserSession.js +0 -2
- package/dist/comm/http/IUserSession.js.map +0 -1
- package/dist/comm/http/UserSession.d.ts +0 -11
- package/dist/comm/http/UserSession.js +0 -24
- package/dist/comm/http/UserSession.js.map +0 -1
- package/dist/now/sdk/auth/CredentialStore.d.ts +0 -2
- package/dist/now/sdk/auth/CredentialStore.js +0 -3
- package/dist/now/sdk/auth/CredentialStore.js.map +0 -1
- package/dist/now/sdk/auth/CredentialWrapper.d.ts +0 -31
- package/dist/now/sdk/auth/CredentialWrapper.js +0 -89
- package/dist/now/sdk/auth/CredentialWrapper.js.map +0 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
|
+
import { ServiceNowInstance } from "../sn/ServiceNowInstance.js";
|
|
1
2
|
import { IAuthenticationHandler } from "./IAuthenticationHandler.js";
|
|
2
3
|
export declare class AuthenticationHandlerFactory {
|
|
3
|
-
static createAuthHandler(): IAuthenticationHandler;
|
|
4
|
+
static createAuthHandler(instance: ServiceNowInstance): IAuthenticationHandler;
|
|
4
5
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { NowSDKAuthenticationHandler } from "./NowSDKAuthenticationHandler.js";
|
|
2
2
|
export class AuthenticationHandlerFactory {
|
|
3
|
-
static createAuthHandler() {
|
|
4
|
-
return new NowSDKAuthenticationHandler();
|
|
3
|
+
static createAuthHandler(instance) {
|
|
4
|
+
return new NowSDKAuthenticationHandler(instance);
|
|
5
5
|
}
|
|
6
6
|
}
|
|
7
7
|
//# sourceMappingURL=AuthenticationHandlerFactory.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthenticationHandlerFactory.js","sourceRoot":"","sources":["../../src/auth/AuthenticationHandlerFactory.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AuthenticationHandlerFactory.js","sourceRoot":"","sources":["../../src/auth/AuthenticationHandlerFactory.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAG5E,MAAM,OAAO,4BAA4B;IAG9B,MAAM,CAAC,iBAAiB,CAAC,QAA2B;QACvD,OAAO,IAAI,2BAA2B,CAAC,QAAQ,CAAC,CAAC;IACrD,CAAC;CACJ"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { ICookieStore } from "../comm/http/ICookieStore.js";
|
|
2
2
|
import { IRequestHandler } from "../comm/http/IRequestHandler.js";
|
|
3
|
-
import { IUserSession } from "../comm/http/IUserSession.js";
|
|
4
3
|
export interface IAuthenticationHandler {
|
|
5
|
-
doLogin(
|
|
4
|
+
doLogin(): any;
|
|
6
5
|
getRequestHandler(): IRequestHandler;
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
setRequestHandler(requestHandler: IRequestHandler): any;
|
|
7
|
+
isLoggedIn(): Boolean;
|
|
8
|
+
setLoggedIn(loggedIn: Boolean): any;
|
|
9
9
|
getToken(): string;
|
|
10
10
|
getCookies(): ICookieStore;
|
|
11
|
+
getSession(): any;
|
|
11
12
|
}
|
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
import { IRequestHandler } from "../comm/http/IRequestHandler.js";
|
|
2
2
|
import { IAuthenticationHandler } from "./IAuthenticationHandler.js";
|
|
3
3
|
import { ICookieStore } from "../comm/http/ICookieStore.js";
|
|
4
|
-
import {
|
|
4
|
+
import { ServiceNowInstance } from "../sn/ServiceNowInstance.js";
|
|
5
5
|
export declare class NowSDKAuthenticationHandler implements IAuthenticationHandler {
|
|
6
6
|
private _requestHandler;
|
|
7
7
|
private _isLoggedIn;
|
|
8
8
|
private _session;
|
|
9
9
|
private _logger;
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
private _instance;
|
|
11
|
+
constructor(instance: ServiceNowInstance);
|
|
12
|
+
doLogin(): Promise<any>;
|
|
12
13
|
private login;
|
|
13
14
|
getRequestHandler(): IRequestHandler;
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
setRequestHandler(requestHandler: IRequestHandler): void;
|
|
16
|
+
isLoggedIn(): Boolean;
|
|
17
|
+
setLoggedIn(loggedIn: Boolean): void;
|
|
16
18
|
getToken(): string;
|
|
17
19
|
getCookies(): ICookieStore;
|
|
20
|
+
getSession(): any;
|
|
18
21
|
}
|
|
@@ -1,43 +1,45 @@
|
|
|
1
1
|
import { Logger } from "../util/Logger.js";
|
|
2
|
-
import {
|
|
3
|
-
import { UserSession } from "../comm/http/UserSession.js";
|
|
2
|
+
import { getSafeUserSession } from "@servicenow/sdk-cli-core/dist/util/sessionToken.js";
|
|
4
3
|
export class NowSDKAuthenticationHandler {
|
|
5
4
|
_requestHandler;
|
|
6
5
|
_isLoggedIn = false;
|
|
7
6
|
_session;
|
|
8
7
|
_logger;
|
|
9
|
-
|
|
8
|
+
_instance;
|
|
9
|
+
constructor(instance) {
|
|
10
10
|
this._logger = new Logger("NowSDKAuthenticationHandler");
|
|
11
|
+
this._instance = instance;
|
|
11
12
|
}
|
|
12
|
-
async doLogin(
|
|
13
|
-
|
|
13
|
+
async doLogin() {
|
|
14
|
+
let session = await this.login();
|
|
14
15
|
this._session = session;
|
|
15
16
|
return session;
|
|
16
17
|
}
|
|
17
|
-
async login(
|
|
18
|
-
let result = null;
|
|
18
|
+
async login() {
|
|
19
19
|
try {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
25
|
-
result = await login(credentials, this._logger);
|
|
26
|
-
//FIXME: This needs to be changed to be a variable host
|
|
27
|
-
if ((await result.cookieJar.getCookies(host)).length > 0) {
|
|
20
|
+
let auth = { credentials: this._instance.credential };
|
|
21
|
+
let session = await getSafeUserSession(auth, this._logger);
|
|
22
|
+
if (session) {
|
|
23
|
+
this._requestHandler.setSession(session);
|
|
28
24
|
this.setLoggedIn(true);
|
|
29
25
|
}
|
|
30
|
-
|
|
31
|
-
|
|
26
|
+
else {
|
|
27
|
+
throw new Error("Unable to login.");
|
|
28
|
+
}
|
|
29
|
+
this._logger.debug("Login Attempt Complete.");
|
|
30
|
+
return session;
|
|
32
31
|
}
|
|
33
32
|
catch (e) {
|
|
34
33
|
this._logger.error("Error during login.", e);
|
|
35
34
|
}
|
|
36
|
-
return
|
|
35
|
+
return null;
|
|
37
36
|
}
|
|
38
37
|
getRequestHandler() {
|
|
39
38
|
return this._requestHandler;
|
|
40
39
|
}
|
|
40
|
+
setRequestHandler(requestHandler) {
|
|
41
|
+
this._requestHandler = requestHandler;
|
|
42
|
+
}
|
|
41
43
|
isLoggedIn() {
|
|
42
44
|
return this._isLoggedIn;
|
|
43
45
|
}
|
|
@@ -50,5 +52,8 @@ export class NowSDKAuthenticationHandler {
|
|
|
50
52
|
getCookies() {
|
|
51
53
|
return this._session.getCookies();
|
|
52
54
|
}
|
|
55
|
+
getSession() {
|
|
56
|
+
return this._session;
|
|
57
|
+
}
|
|
53
58
|
}
|
|
54
59
|
//# sourceMappingURL=NowSDKAuthenticationHandler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NowSDKAuthenticationHandler.js","sourceRoot":"","sources":["../../src/auth/NowSDKAuthenticationHandler.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"NowSDKAuthenticationHandler.js","sourceRoot":"","sources":["../../src/auth/NowSDKAuthenticationHandler.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAKxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,oD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AC,cAA8B;QACnD,IAAI,CAAC,eAAe,GAAG,cAAc,CAAC;IAC1C,CAAC;IAEM,UAAU;QACb,OAAO,IAAI,CAAC,WAAW,CAAC;IAC5B,CAAC;IAEM,WAAW,CAAC,QAAgB;QAC/B,IAAI,CAAC,WAAW,GAAG,QAAQ,CAAC;IAChC,CAAC;IAEM,QAAQ;QACX,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC;IACpC,CAAC;IAEM,UAAU;QACb,OAAO,IAAI,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC;IACtC,CAAC;IAEM,UAAU;QACb,OAAO,IAAI,CAAC,QAAQ,CAAC;IACzB,CAAC;CACJ"}
|
|
@@ -1,20 +1,13 @@
|
|
|
1
|
-
import { AxiosHeaderValue, AxiosResponseHeaders, InternalAxiosRequestConfig } from "axios";
|
|
2
|
-
import { RawAxiosRequestHeaders } from 'axios';
|
|
3
1
|
import { IHttpResponse } from "./IHttpResponse.js";
|
|
4
2
|
export declare class HttpResponse<T> implements IHttpResponse<T> {
|
|
5
|
-
|
|
3
|
+
constructor(bodyObject: T);
|
|
4
|
+
bodyObject?: T;
|
|
5
|
+
data: T;
|
|
6
|
+
body: string;
|
|
6
7
|
status: number;
|
|
7
8
|
statusText: string;
|
|
8
|
-
headers:
|
|
9
|
-
|
|
10
|
-
"Content-Length": AxiosHeaderValue;
|
|
11
|
-
"Content-Encoding": AxiosHeaderValue;
|
|
12
|
-
Server: AxiosHeaderValue;
|
|
13
|
-
"Cache-Control": AxiosHeaderValue;
|
|
14
|
-
} & {
|
|
15
|
-
"set-cookie": string[];
|
|
16
|
-
}>;
|
|
17
|
-
config: InternalAxiosRequestConfig<any>;
|
|
9
|
+
headers: object;
|
|
10
|
+
config: object;
|
|
18
11
|
request?: any;
|
|
19
|
-
|
|
12
|
+
cookies: any[];
|
|
20
13
|
}
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
export class HttpResponse {
|
|
2
|
+
constructor(bodyObject) {
|
|
3
|
+
this.bodyObject = bodyObject;
|
|
4
|
+
}
|
|
5
|
+
bodyObject;
|
|
2
6
|
data;
|
|
7
|
+
body;
|
|
3
8
|
status;
|
|
4
9
|
statusText;
|
|
5
10
|
headers;
|
|
6
11
|
config;
|
|
7
12
|
request;
|
|
8
|
-
|
|
13
|
+
cookies;
|
|
9
14
|
}
|
|
10
15
|
//# sourceMappingURL=HttpResponse.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HttpResponse.js","sourceRoot":"","sources":["../../../src/comm/http/HttpResponse.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"HttpResponse.js","sourceRoot":"","sources":["../../../src/comm/http/HttpResponse.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,YAAY;IAErB,YAAY,UAAa;QACrB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IACjC,CAAC;IAED,UAAU,CAAK;IACf,IAAI,CAAI;IACR,IAAI,CAAS;IACb,MAAM,CAAS;IACf,UAAU,CAAS;IACnB,OAAO,CAAS;IAChB,MAAM,CAAS;IACf,OAAO,CAAO;IACd,OAAO,CAAQ;CAClB"}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
export interface IHttpResponse<T> extends AxiosResponse {
|
|
1
|
+
export interface IHttpResponse<T> {
|
|
3
2
|
bodyObject?: T;
|
|
3
|
+
data: T;
|
|
4
|
+
status: number;
|
|
5
|
+
statusText: string;
|
|
6
|
+
headers: object;
|
|
7
|
+
config: object;
|
|
8
|
+
request?: any;
|
|
4
9
|
}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { HTTPRequest } from "./HTTPRequest.js";
|
|
2
2
|
import { IHttpResponse } from "./IHttpResponse.js";
|
|
3
|
-
import { Cookie } from 'tough-cookie';
|
|
4
3
|
export interface IRequestHandler {
|
|
5
4
|
post<T>(request: HTTPRequest): Promise<IHttpResponse<T>>;
|
|
6
5
|
put<T>(request: HTTPRequest): Promise<IHttpResponse<T>>;
|
|
7
6
|
get<T>(request: HTTPRequest): Promise<IHttpResponse<T>>;
|
|
8
7
|
delete<T>(request: HTTPRequest): Promise<IHttpResponse<T>>;
|
|
9
|
-
|
|
10
|
-
getCookies(): Promise<Cookie[]>;
|
|
8
|
+
setSession(session: any): any;
|
|
11
9
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { AxiosInstance, AxiosResponse, AxiosRequestConfig, RawAxiosRequestHeaders } from 'axios';
|
|
2
1
|
import { HTTPRequest } from './HTTPRequest.js';
|
|
3
2
|
import { IHttpResponse } from './IHttpResponse.js';
|
|
4
3
|
import { IRequestHandler } from './IRequestHandler.js';
|
|
@@ -6,27 +5,19 @@ import { Cookie } from 'tough-cookie';
|
|
|
6
5
|
import { ICookieStore } from './ICookieStore.js';
|
|
7
6
|
import { IAuthenticationHandler } from '../../auth/IAuthenticationHandler.js';
|
|
8
7
|
import { Logger } from '../../util/Logger.js';
|
|
9
|
-
import { IServiceNowInstance } from '../../sn/IServiceNowInstance.js';
|
|
10
8
|
export declare class RequestHandler implements IRequestHandler {
|
|
11
9
|
_logger: Logger;
|
|
12
|
-
_defaultHeaders: RawAxiosRequestHeaders;
|
|
13
|
-
httpClient: AxiosInstance;
|
|
14
10
|
_cookies: Cookie[];
|
|
15
11
|
_cookieStore: ICookieStore;
|
|
16
12
|
_authHandler: IAuthenticationHandler;
|
|
17
|
-
|
|
18
|
-
get snInstance(): IServiceNowInstance;
|
|
19
|
-
set snInstance(value: IServiceNowInstance);
|
|
13
|
+
_session: any;
|
|
20
14
|
/**
|
|
21
15
|
* The Singleton's constructor should always be private to prevent direct
|
|
22
16
|
* construction calls with the `new` operator.
|
|
23
17
|
*/
|
|
24
|
-
constructor(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
getCookieString(): Promise<string>;
|
|
28
|
-
setRequestToken(token: string): void;
|
|
29
|
-
request(config: AxiosRequestConfig): Promise<AxiosResponse<any, any>>;
|
|
18
|
+
constructor(authHandler: IAuthenticationHandler);
|
|
19
|
+
setSession(session: any): void;
|
|
20
|
+
private doRequest;
|
|
30
21
|
post<T>(request: HTTPRequest): Promise<IHttpResponse<T>>;
|
|
31
22
|
put<T>(request: HTTPRequest): Promise<IHttpResponse<T>>;
|
|
32
23
|
get<T>(request: HTTPRequest): Promise<IHttpResponse<T>>;
|
|
@@ -1,71 +1,95 @@
|
|
|
1
|
-
|
|
2
|
-
import axios from 'axios';
|
|
1
|
+
import { HttpResponse } from './HttpResponse.js';
|
|
3
2
|
import { Logger } from '../../util/Logger.js';
|
|
4
|
-
import {
|
|
5
|
-
axios.defaults.withCredentials = true;
|
|
3
|
+
import { makeRequest } from "@servicenow/sdk-cli-core/dist/http/index.js";
|
|
4
|
+
//axios.defaults.withCredentials = true;
|
|
6
5
|
export class RequestHandler {
|
|
7
6
|
_logger = new Logger("RequestHandler");
|
|
8
|
-
_defaultHeaders;
|
|
9
|
-
httpClient;
|
|
7
|
+
//_defaultHeaders:RawAxiosRequestHeaders;
|
|
8
|
+
//httpClient:AxiosInstance;
|
|
10
9
|
_cookies;
|
|
11
10
|
_cookieStore;
|
|
12
11
|
_authHandler;
|
|
13
|
-
|
|
14
|
-
get snInstance() {
|
|
15
|
-
return this._snInstance;
|
|
16
|
-
}
|
|
17
|
-
set snInstance(value) {
|
|
18
|
-
this._snInstance = value;
|
|
19
|
-
}
|
|
12
|
+
_session;
|
|
20
13
|
/**
|
|
21
14
|
* The Singleton's constructor should always be private to prevent direct
|
|
22
15
|
* construction calls with the `new` operator.
|
|
23
16
|
*/
|
|
24
|
-
constructor(
|
|
25
|
-
this.
|
|
26
|
-
this._defaultHeaders = {};
|
|
17
|
+
constructor(authHandler) {
|
|
18
|
+
//this._defaultHeaders = {} as RawAxiosRequestHeaders;
|
|
27
19
|
this._authHandler = authHandler;
|
|
28
20
|
//Need to get the config from the extension info
|
|
29
21
|
//baseURL should be instance URL that was added to settings
|
|
30
22
|
//todo: Updated with settings config
|
|
31
|
-
this.httpClient = axios.create({
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
});
|
|
35
|
-
this.httpClient.defaults.maxRedirects = 0;
|
|
36
|
-
}
|
|
37
|
-
getHttpClient() {
|
|
38
|
-
return this.httpClient;
|
|
23
|
+
// this.httpClient = axios.create({
|
|
24
|
+
// withCredentials: true,
|
|
25
|
+
// baseURL: ExtensionConfiguration.instance.getServiceNowInstanceURL(),
|
|
26
|
+
// });
|
|
27
|
+
// this.httpClient.defaults.maxRedirects = 0;
|
|
39
28
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
return await this._authHandler.getCookies().getCookies(this.snInstance.getHost());
|
|
29
|
+
setSession(session) {
|
|
30
|
+
this._session = session;
|
|
43
31
|
}
|
|
44
|
-
async
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
32
|
+
// public async request(config:AxiosRequestConfig):Promise<AxiosResponse<any,any>>{
|
|
33
|
+
// for(var prop in this._defaultHeaders){
|
|
34
|
+
// if(typeof this._defaultHeaders[prop] !='undefined' && this._defaultHeaders[prop])
|
|
35
|
+
// config.headers[prop] = this._defaultHeaders[prop];
|
|
36
|
+
// }
|
|
37
|
+
// config.headers["Cookie"] = await this.getCookieString();
|
|
38
|
+
// return this.httpClient.request(config);
|
|
39
|
+
// }
|
|
40
|
+
async doRequest(request) {
|
|
41
|
+
let response = null;
|
|
42
|
+
let { config } = await this.getRequestConfig(request);
|
|
43
|
+
this._logger.debug("Retrieved Configuration", { config: config });
|
|
44
|
+
//const { auth, path, params, fields, json, headers: baseHeaders, ...rest } = opts;
|
|
45
|
+
// let opts = {
|
|
46
|
+
// auth: this._session,
|
|
47
|
+
// path: url,
|
|
48
|
+
// rest: { method: request.method }
|
|
49
|
+
// }
|
|
50
|
+
let resp = await makeRequest(config);
|
|
51
|
+
let responseBodyReader = resp.body.getReader();
|
|
52
|
+
let responseBody = await responseBodyReader.read();
|
|
53
|
+
let responseBodyString = new TextDecoder().decode(responseBody.value);
|
|
54
|
+
if (responseBodyString) {
|
|
55
|
+
let data = null;
|
|
56
|
+
try {
|
|
57
|
+
data = JSON.parse(responseBodyString);
|
|
58
|
+
}
|
|
59
|
+
catch (ex) {
|
|
60
|
+
this._logger.error("Error parsing response body.", { error: ex, responseBodyString: responseBodyString });
|
|
61
|
+
data = responseBodyString;
|
|
62
|
+
}
|
|
63
|
+
response = new HttpResponse(data);
|
|
64
|
+
response.data = data;
|
|
54
65
|
}
|
|
55
|
-
|
|
56
|
-
|
|
66
|
+
response.status = resp.status;
|
|
67
|
+
response.statusText = resp.statusText;
|
|
68
|
+
response.headers = {};
|
|
69
|
+
response.cookies = [];
|
|
70
|
+
resp.headers.forEach((value, key) => {
|
|
71
|
+
if (key === "set-cookie") {
|
|
72
|
+
response.cookies.push(value);
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
response.headers[key] = value;
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
//response.headers = resp.headers;
|
|
79
|
+
return response;
|
|
57
80
|
}
|
|
58
81
|
async post(request) {
|
|
59
|
-
|
|
60
|
-
|
|
82
|
+
request.method = "POST";
|
|
83
|
+
// let {config} = await this.getRequestConfig(request);
|
|
84
|
+
// this._logger.debug("Retrieved Configuration", {config:config, url:url});
|
|
61
85
|
let response = null;
|
|
62
86
|
try {
|
|
63
|
-
response = await this.
|
|
64
|
-
this._logger.debug("Http
|
|
87
|
+
const response = await this.doRequest(request);
|
|
88
|
+
this._logger.debug("Http SN POST Response Received", response);
|
|
65
89
|
try {
|
|
66
90
|
if (!((response.data) instanceof String)) {
|
|
67
|
-
|
|
68
|
-
response.bodyObject =
|
|
91
|
+
let rpObj = response.data;
|
|
92
|
+
response.bodyObject = response.data;
|
|
69
93
|
}
|
|
70
94
|
}
|
|
71
95
|
catch (ex) {
|
|
@@ -74,118 +98,95 @@ export class RequestHandler {
|
|
|
74
98
|
return response;
|
|
75
99
|
}
|
|
76
100
|
catch (ex) {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
throw err;
|
|
101
|
+
this._logger.error("Error during POST request.", { error: ex, response: response, request: request });
|
|
102
|
+
throw new Error(ex);
|
|
80
103
|
}
|
|
81
104
|
return null;
|
|
82
105
|
}
|
|
83
106
|
async put(request) {
|
|
84
|
-
|
|
85
|
-
this._logger.debug("Retrieved Configuration", { config: config, url: url });
|
|
107
|
+
request.method = "PUT";
|
|
86
108
|
let response = null;
|
|
87
109
|
try {
|
|
88
|
-
response = await this.
|
|
110
|
+
const response = await this.doRequest(request);
|
|
89
111
|
this._logger.debug("Http PUT Response Received", response);
|
|
90
112
|
try {
|
|
91
113
|
if (!((response.data) instanceof String)) {
|
|
92
|
-
|
|
93
|
-
response.bodyObject =
|
|
114
|
+
let rpObj = response.data;
|
|
115
|
+
response.bodyObject = response.data;
|
|
94
116
|
}
|
|
95
117
|
}
|
|
96
118
|
catch (ex) {
|
|
97
|
-
const err = ex;
|
|
98
|
-
this._logger.error("Error during PUT request.", { err, request });
|
|
99
|
-
throw err;
|
|
100
119
|
//console.log(ex);
|
|
101
120
|
}
|
|
102
121
|
return response;
|
|
103
122
|
}
|
|
104
123
|
catch (ex) {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
throw
|
|
124
|
+
//log error
|
|
125
|
+
//console.log(ex);
|
|
126
|
+
throw new Error(ex);
|
|
108
127
|
}
|
|
128
|
+
return null;
|
|
109
129
|
}
|
|
110
130
|
async get(request) {
|
|
111
|
-
|
|
112
|
-
const { config, url } = await this.getRequestConfig(request);
|
|
113
|
-
this._logger.debug("Retrieved Configuration", { config: config, url: url });
|
|
131
|
+
request.method = "GET";
|
|
114
132
|
let response = null;
|
|
115
133
|
try {
|
|
116
|
-
response = await this.
|
|
117
|
-
this._logger.debug("Http Response Received", response);
|
|
134
|
+
const response = await this.doRequest(request);
|
|
135
|
+
this._logger.debug("Http SN POST Response Received", response);
|
|
118
136
|
try {
|
|
119
137
|
if (!((response.data) instanceof String)) {
|
|
120
|
-
|
|
121
|
-
response.bodyObject =
|
|
138
|
+
let rpObj = response.data;
|
|
139
|
+
response.bodyObject = response.data;
|
|
122
140
|
}
|
|
123
141
|
}
|
|
124
142
|
catch (ex) {
|
|
125
|
-
|
|
126
|
-
this._logger.error("Error setting response.bodyObject.", { error: err, response: response, request: request });
|
|
127
|
-
throw err;
|
|
143
|
+
this._logger.error("Error setting response.bodyObject.", { error: ex, response: response, request: request });
|
|
128
144
|
}
|
|
129
145
|
return response;
|
|
130
146
|
}
|
|
131
147
|
catch (ex) {
|
|
132
|
-
|
|
133
|
-
this._logger.error("Error setting response.bodyObject.", { error: err, response: response, request: request });
|
|
134
|
-
throw err;
|
|
148
|
+
this._logger.error("Error setting response.bodyObject.", { error: ex, response: response, request: request });
|
|
135
149
|
}
|
|
150
|
+
return null;
|
|
136
151
|
}
|
|
137
152
|
async delete(request) {
|
|
138
|
-
|
|
153
|
+
request.method = "DELETE";
|
|
154
|
+
let response = null;
|
|
139
155
|
try {
|
|
140
|
-
const response = await this.
|
|
156
|
+
const response = await this.doRequest(request);
|
|
141
157
|
try {
|
|
142
158
|
if (!((response.data) instanceof String)) {
|
|
143
|
-
|
|
144
|
-
response.bodyObject =
|
|
159
|
+
let rpObj = response.data;
|
|
160
|
+
response.bodyObject = response.data;
|
|
145
161
|
}
|
|
146
162
|
}
|
|
147
163
|
catch (ex) {
|
|
148
|
-
|
|
149
|
-
this._logger.error("Error setting response.bodyObject.", { error: err, response: response, request: request });
|
|
150
|
-
throw err;
|
|
164
|
+
console.log(ex);
|
|
151
165
|
}
|
|
152
166
|
return response;
|
|
153
167
|
}
|
|
154
168
|
catch (ex) {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
throw err;
|
|
169
|
+
//log error
|
|
170
|
+
console.log(ex);
|
|
158
171
|
}
|
|
172
|
+
return null;
|
|
159
173
|
}
|
|
160
174
|
async getRequestConfig(request) {
|
|
161
175
|
const config = {
|
|
162
|
-
|
|
163
|
-
headers: this._defaultHeaders
|
|
176
|
+
auth: this._session,
|
|
164
177
|
};
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
for (const prop in request.headers) {
|
|
168
|
-
if (!isNil(request.headers[prop])) {
|
|
169
|
-
const val = request.headers[prop];
|
|
170
|
-
config.headers[prop] = val;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
config.headers["Cookie"] = await this.getCookieString();
|
|
175
|
-
if (request.query != null) {
|
|
176
|
-
const strQuery = this.getQueryString(request.query);
|
|
177
|
-
if (url.indexOf("?") == -1) {
|
|
178
|
-
url += "?" + strQuery;
|
|
179
|
-
}
|
|
180
|
-
else {
|
|
181
|
-
url += "&" + strQuery;
|
|
182
|
-
}
|
|
178
|
+
if (request.body) {
|
|
179
|
+
config.body = request.body;
|
|
183
180
|
}
|
|
184
|
-
|
|
181
|
+
config.params = request.query;
|
|
182
|
+
config.baseHeaders = request.headers;
|
|
183
|
+
config.path = request.path;
|
|
184
|
+
config.method = request.method;
|
|
185
|
+
return { config: config };
|
|
185
186
|
}
|
|
186
187
|
getQueryString(queryObj) {
|
|
187
188
|
const params = new URLSearchParams();
|
|
188
|
-
for (
|
|
189
|
+
for (var prop in queryObj) {
|
|
189
190
|
params.set(prop, queryObj[prop]);
|
|
190
191
|
}
|
|
191
192
|
return params.toString();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RequestHandler.js","sourceRoot":"","sources":["../../../src/comm/http/RequestHandler.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RequestHandler.js","sourceRoot":"","sources":["../../../src/comm/http/RequestHandler.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAK9C,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,6CAA6C,CAAC;AAG1E,wCA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,CAAC;QAC3B,MAAM,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAE/B,OAAO,EAAC,MAAM,EAAE,MAAM,EAAC,CAAC;IAC5B,CAAC;IAEO,cAAc,CAAC,QAAe;QAElC,MAAM,MAAM,GAAG,IAAI,eAAe,EAAE,CAAC;QAGrC,KAAI,IAAI,IAAI,IAAI,QAAQ,EAAC,CAAC;YACtB,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;QACrC,CAAC;QAED,OAAO,MAAM,CAAC,QAAQ,EAAE,CAAC;QAAA,CAAC;IAC9B,CAAC;CAKJ"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { IAuthenticationHandler } from "../../auth/IAuthenticationHandler.js";
|
|
2
|
-
import { IServiceNowInstance } from "../../sn/IServiceNowInstance.js";
|
|
3
2
|
import { IRequestHandler } from "./IRequestHandler.js";
|
|
4
3
|
export declare class RequestHandlerFactory {
|
|
5
|
-
static createRequestHandler(
|
|
4
|
+
static createRequestHandler(authHandler: IAuthenticationHandler): IRequestHandler;
|
|
6
5
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { RequestHandler } from "./RequestHandler.js";
|
|
2
2
|
export class RequestHandlerFactory {
|
|
3
|
-
static createRequestHandler(
|
|
4
|
-
return new RequestHandler(
|
|
3
|
+
static createRequestHandler(authHandler) {
|
|
4
|
+
return new RequestHandler(authHandler);
|
|
5
5
|
}
|
|
6
6
|
}
|
|
7
7
|
//# sourceMappingURL=RequestHandlerFactory.js.map
|