@sonisoft/now-sdk-ext-core 1.0.0-alpha.30
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/LICENSE +21 -0
- package/README.md +3 -0
- package/dist/auth/AuthenticationHandlerFactory.d.ts +4 -0
- package/dist/auth/AuthenticationHandlerFactory.js +7 -0
- package/dist/auth/AuthenticationHandlerFactory.js.map +1 -0
- package/dist/auth/IAuthenticationHandler.d.ts +11 -0
- package/dist/auth/IAuthenticationHandler.js +2 -0
- package/dist/auth/IAuthenticationHandler.js.map +1 -0
- package/dist/auth/NowSDKAuthenticationHandler.d.ts +18 -0
- package/dist/auth/NowSDKAuthenticationHandler.js +54 -0
- package/dist/auth/NowSDKAuthenticationHandler.js.map +1 -0
- package/dist/comm/http/CookieStore.d.ts +8 -0
- package/dist/comm/http/CookieStore.js +21 -0
- package/dist/comm/http/CookieStore.js.map +1 -0
- package/dist/comm/http/CookieStoreFactory.d.ts +5 -0
- package/dist/comm/http/CookieStoreFactory.js +11 -0
- package/dist/comm/http/CookieStoreFactory.js.map +1 -0
- package/dist/comm/http/HTTPRequest.d.ts +7 -0
- package/dist/comm/http/HTTPRequest.js +4 -0
- package/dist/comm/http/HTTPRequest.js.map +1 -0
- package/dist/comm/http/HttpResponse.d.ts +20 -0
- package/dist/comm/http/HttpResponse.js +10 -0
- package/dist/comm/http/HttpResponse.js.map +1 -0
- package/dist/comm/http/ICookieStore.d.ts +5 -0
- package/dist/comm/http/ICookieStore.js +2 -0
- package/dist/comm/http/ICookieStore.js.map +1 -0
- package/dist/comm/http/IHttpResponse.d.ts +4 -0
- package/dist/comm/http/IHttpResponse.js +2 -0
- package/dist/comm/http/IHttpResponse.js.map +1 -0
- package/dist/comm/http/IRequestHandler.d.ts +11 -0
- package/dist/comm/http/IRequestHandler.js +2 -0
- package/dist/comm/http/IRequestHandler.js.map +1 -0
- package/dist/comm/http/IUserSession.d.ts +8 -0
- package/dist/comm/http/IUserSession.js +2 -0
- package/dist/comm/http/IUserSession.js.map +1 -0
- package/dist/comm/http/RequestHandler.d.ts +36 -0
- package/dist/comm/http/RequestHandler.js +195 -0
- package/dist/comm/http/RequestHandler.js.map +1 -0
- package/dist/comm/http/RequestHandlerFactory.d.ts +6 -0
- package/dist/comm/http/RequestHandlerFactory.js +7 -0
- package/dist/comm/http/RequestHandlerFactory.js.map +1 -0
- package/dist/comm/http/ServiceNowProcessorRequest.d.ts +9 -0
- package/dist/comm/http/ServiceNowProcessorRequest.js +61 -0
- package/dist/comm/http/ServiceNowProcessorRequest.js.map +1 -0
- package/dist/comm/http/ServiceNowRequest.d.ts +21 -0
- package/dist/comm/http/ServiceNowRequest.js +75 -0
- package/dist/comm/http/ServiceNowRequest.js.map +1 -0
- package/dist/comm/http/TableAPIRequest.d.ts +14 -0
- package/dist/comm/http/TableAPIRequest.js +46 -0
- package/dist/comm/http/TableAPIRequest.js.map +1 -0
- package/dist/comm/http/UserSession.d.ts +11 -0
- package/dist/comm/http/UserSession.js +24 -0
- package/dist/comm/http/UserSession.js.map +1 -0
- package/dist/comm/ws/ATFMessageHandler.d.ts +4 -0
- package/dist/comm/ws/ATFMessageHandler.js +5 -0
- package/dist/comm/ws/ATFMessageHandler.js.map +1 -0
- package/dist/constants/Extension.d.ts +1 -0
- package/dist/constants/Extension.js +2 -0
- package/dist/constants/Extension.js.map +1 -0
- package/dist/constants/Files.d.ts +3 -0
- package/dist/constants/Files.js +4 -0
- package/dist/constants/Files.js.map +1 -0
- package/dist/constants/ServiceNow.d.ts +2 -0
- package/dist/constants/ServiceNow.js +3 -0
- package/dist/constants/ServiceNow.js.map +1 -0
- package/dist/encryption/decrypt.d.ts +1 -0
- package/dist/encryption/decrypt.js +10 -0
- package/dist/encryption/decrypt.js.map +1 -0
- package/dist/encryption/encrypt.d.ts +1 -0
- package/dist/encryption/encrypt.js +13 -0
- package/dist/encryption/encrypt.js.map +1 -0
- package/dist/exception/FileException.d.ts +6 -0
- package/dist/exception/FileException.js +15 -0
- package/dist/exception/FileException.js.map +1 -0
- package/dist/exception/FileExistsException.d.ts +2 -0
- package/dist/exception/FileExistsException.js +3 -0
- package/dist/exception/FileExistsException.js.map +1 -0
- package/dist/exception/InvalidParameterException.d.ts +5 -0
- package/dist/exception/InvalidParameterException.js +12 -0
- package/dist/exception/InvalidParameterException.js.map +1 -0
- package/dist/exception/PathException.d.ts +2 -0
- package/dist/exception/PathException.js +3 -0
- package/dist/exception/PathException.js.map +1 -0
- package/dist/index.d.ts +40 -0
- package/dist/index.js +41 -0
- package/dist/index.js.map +1 -0
- package/dist/model/types.d.ts +10 -0
- package/dist/model/types.js +2 -0
- package/dist/model/types.js.map +1 -0
- package/dist/now/sdk/auth/CredentialStore.d.ts +2 -0
- package/dist/now/sdk/auth/CredentialStore.js +3 -0
- package/dist/now/sdk/auth/CredentialStore.js.map +1 -0
- package/dist/now/sdk/auth/CredentialWrapper.d.ts +31 -0
- package/dist/now/sdk/auth/CredentialWrapper.js +89 -0
- package/dist/now/sdk/auth/CredentialWrapper.js.map +1 -0
- package/dist/sn/BackgroundScriptExecutor.d.ts +44 -0
- package/dist/sn/BackgroundScriptExecutor.js +187 -0
- package/dist/sn/BackgroundScriptExecutor.js.map +1 -0
- package/dist/sn/IServiceNowInstance.d.ts +7 -0
- package/dist/sn/IServiceNowInstance.js +2 -0
- package/dist/sn/IServiceNowInstance.js.map +1 -0
- package/dist/sn/SNRequestBase.d.ts +13 -0
- package/dist/sn/SNRequestBase.js +24 -0
- package/dist/sn/SNRequestBase.js.map +1 -0
- package/dist/sn/ServiceNowInstance.d.ts +21 -0
- package/dist/sn/ServiceNowInstance.js +43 -0
- package/dist/sn/ServiceNowInstance.js.map +1 -0
- package/dist/sn/factory/ISNFactory.d.ts +0 -0
- package/dist/sn/factory/ISNFactory.js +1 -0
- package/dist/sn/factory/ISNFactory.js.map +1 -0
- package/dist/sn/factory/SNFactoryBase.d.ts +0 -0
- package/dist/sn/factory/SNFactoryBase.js +1 -0
- package/dist/sn/factory/SNFactoryBase.js.map +1 -0
- package/dist/sn/user/UserRequest.d.ts +7 -0
- package/dist/sn/user/UserRequest.js +32 -0
- package/dist/sn/user/UserRequest.js.map +1 -0
- package/dist/sn/user/factory/UserFactory.d.ts +2 -0
- package/dist/sn/user/factory/UserFactory.js +3 -0
- package/dist/sn/user/factory/UserFactory.js.map +1 -0
- package/dist/sn/user/model/IUser.d.ts +135 -0
- package/dist/sn/user/model/IUser.js +2 -0
- package/dist/sn/user/model/IUser.js.map +1 -0
- package/dist/sn/user/model/User.d.ts +202 -0
- package/dist/sn/user/model/User.js +465 -0
- package/dist/sn/user/model/User.js.map +1 -0
- package/dist/util/AppUtil.d.ts +3 -0
- package/dist/util/AppUtil.js +6 -0
- package/dist/util/AppUtil.js.map +1 -0
- package/dist/util/Logger.d.ts +21 -0
- package/dist/util/Logger.js +84 -0
- package/dist/util/Logger.js.map +1 -0
- package/dist/util/NowStringUtil.d.ts +3 -0
- package/dist/util/NowStringUtil.js +6 -0
- package/dist/util/NowStringUtil.js.map +1 -0
- package/dist/util/utils.d.ts +5 -0
- package/dist/util/utils.js +8 -0
- package/dist/util/utils.js.map +1 -0
- package/package.json +139 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
2
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
3
|
+
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
|
4
|
+
import { ServiceNowRequest } from "../../comm/http/ServiceNowRequest.js";
|
|
5
|
+
import * as qs from 'qs';
|
|
6
|
+
import { XMLParser } from 'fast-xml-parser';
|
|
7
|
+
import { XMLHTTP_PROCESSOR_ENDPOINT } from "../../constants/ServiceNow.js";
|
|
8
|
+
// interface IProcessorResponse{
|
|
9
|
+
// }
|
|
10
|
+
export class ServiceNowProcessorRequest {
|
|
11
|
+
_instance;
|
|
12
|
+
constructor(instance) {
|
|
13
|
+
this._instance = instance;
|
|
14
|
+
}
|
|
15
|
+
_headers = {
|
|
16
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
17
|
+
};
|
|
18
|
+
async execute(processor, processorMethod, scope, processorArgs) {
|
|
19
|
+
let retVal = null;
|
|
20
|
+
const resp = await this.doXmlHttpRequest(processor, processorMethod, scope, processorArgs);
|
|
21
|
+
if (resp.status == 200) {
|
|
22
|
+
const data = resp.data;
|
|
23
|
+
if (typeof data != 'undefined' && data && data.indexOf('answer=') != -1) {
|
|
24
|
+
const options = {
|
|
25
|
+
ignoreAttributes: false,
|
|
26
|
+
attributeNamePrefix: "@_",
|
|
27
|
+
allowBooleanAttributes: true
|
|
28
|
+
};
|
|
29
|
+
const parser = new XMLParser(options);
|
|
30
|
+
const val = parser.parse(data);
|
|
31
|
+
console.log(val);
|
|
32
|
+
if (val.xml) {
|
|
33
|
+
const answer = val.xml["@_answer"];
|
|
34
|
+
retVal = answer;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return retVal;
|
|
39
|
+
}
|
|
40
|
+
async doXmlHttpRequest(processor, processorMethod, scope, processorArgs) {
|
|
41
|
+
let resp = null;
|
|
42
|
+
try {
|
|
43
|
+
const dataObj = {};
|
|
44
|
+
dataObj.sysparm_processor = processor;
|
|
45
|
+
dataObj.sysparm_name = processorMethod;
|
|
46
|
+
dataObj.sysparm_scope = scope;
|
|
47
|
+
for (const prop in processorArgs) {
|
|
48
|
+
dataObj[prop] = processorArgs[prop];
|
|
49
|
+
}
|
|
50
|
+
const data = qs.stringify(dataObj);
|
|
51
|
+
const req = new ServiceNowRequest(this._instance);
|
|
52
|
+
const request = { path: XMLHTTP_PROCESSOR_ENDPOINT, headers: this._headers, query: null, body: data };
|
|
53
|
+
resp = await req.post(request);
|
|
54
|
+
}
|
|
55
|
+
catch (err) {
|
|
56
|
+
console.log(err);
|
|
57
|
+
}
|
|
58
|
+
return resp;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=ServiceNowProcessorRequest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ServiceNowProcessorRequest.js","sourceRoot":"","sources":["../../../src/comm/http/ServiceNowProcessorRequest.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,uDAAuD;AACvD,4DAA4D;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AAEzB,OAAO,EAAc,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAGxD,OAAO,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AAGxE,gCAAgC;AAEhC,IAAI;AAEJ,MAAM,OAAO,0BAA0B;IAE3B,SAAS,CAAqB;IAEtC,YAAmB,QAA4B;QAC3C,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;IAC9B,CAAC;IAEO,QAAQ,GAAU;QACtB,cAAc,EAAC,mCAAmC;KACrD,CAAC;IAEK,KAAK,CAAC,OAAO,CAAC,SAAgB,EAAE,eAAsB,EAAE,KAAY,EAAE,aAAoB;QAC7F,IAAI,MAAM,GAAU,IAAI,CAAC;QACzB,MAAM,IAAI,GAA0B,MAAM,IAAI,CAAC,gBAAgB,CAAC,SAAS,EAAE,eAAe,EAAE,KAAK,EAAE,aAAa,CAAC,CAAC;QAClH,IAAG,IAAI,CAAC,MAAM,IAAI,GAAG,EAAC,CAAC;YACnB,MAAM,IAAI,GAAU,IAAI,CAAC,IAAI,CAAC;YAC9B,IAAG,OAAO,IAAI,IAAI,WAAW,IAAI,IAAI,IAAI,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,EAAC,CAAC;gBACpE,MAAM,OAAO,GAAc;oBACvB,gBAAgB,EAAE,KAAK;oBACvB,mBAAmB,EAAG,IAAI;oBAC1B,sBAAsB,EAAE,IAAI;iBAC/B,CAAC;gBACF,MAAM,MAAM,GAAa,IAAI,SAAS,CAAC,OAAO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D,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { IAuthenticationHandler } from "../../auth/IAuthenticationHandler.js";
|
|
2
|
+
import { IServiceNowInstance } from "../../sn/IServiceNowInstance.js";
|
|
3
|
+
import { HTTPRequest } from "./HTTPRequest.js";
|
|
4
|
+
import { HttpResponse } from "./HttpResponse.js";
|
|
5
|
+
import { IRequestHandler } from "./IRequestHandler.js";
|
|
6
|
+
import { IUserSession } from "./IUserSession.js";
|
|
7
|
+
export declare class ServiceNowRequest {
|
|
8
|
+
_instance: IServiceNowInstance;
|
|
9
|
+
_requestHandler: IRequestHandler;
|
|
10
|
+
auth: IAuthenticationHandler;
|
|
11
|
+
_session: IUserSession;
|
|
12
|
+
constructor(instance: IServiceNowInstance);
|
|
13
|
+
executeRequest<T>(request: HTTPRequest): Promise<HttpResponse<T>>;
|
|
14
|
+
put<T>(request: HTTPRequest): Promise<HttpResponse<T>>;
|
|
15
|
+
post<T>(request: HTTPRequest): Promise<HttpResponse<T>>;
|
|
16
|
+
get<T>(request: HTTPRequest): Promise<HttpResponse<T>>;
|
|
17
|
+
delete<T>(request: HTTPRequest): Promise<HttpResponse<T>>;
|
|
18
|
+
private ensureLoggedIn;
|
|
19
|
+
isLoggedIn(): boolean;
|
|
20
|
+
getAuth(): IAuthenticationHandler;
|
|
21
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { AuthenticationHandlerFactory } from "../../auth/AuthenticationHandlerFactory.js";
|
|
2
|
+
import { RequestHandlerFactory } from "./RequestHandlerFactory.js";
|
|
3
|
+
export class ServiceNowRequest {
|
|
4
|
+
_instance;
|
|
5
|
+
_requestHandler;
|
|
6
|
+
auth;
|
|
7
|
+
_session = null;
|
|
8
|
+
constructor(instance) {
|
|
9
|
+
this.auth = AuthenticationHandlerFactory.createAuthHandler();
|
|
10
|
+
this._requestHandler = RequestHandlerFactory.createRequestHandler(instance, this.auth);
|
|
11
|
+
this._instance = instance;
|
|
12
|
+
}
|
|
13
|
+
async executeRequest(request) {
|
|
14
|
+
let httpMethod = request.method;
|
|
15
|
+
let resp = null;
|
|
16
|
+
if (typeof httpMethod != "undefined" && httpMethod) {
|
|
17
|
+
httpMethod = httpMethod.trim().toLowerCase();
|
|
18
|
+
switch (httpMethod) {
|
|
19
|
+
case "post":
|
|
20
|
+
resp = await this.post(request);
|
|
21
|
+
break;
|
|
22
|
+
case "put":
|
|
23
|
+
resp = await this.put(request);
|
|
24
|
+
break;
|
|
25
|
+
case "get":
|
|
26
|
+
resp = await this.get(request);
|
|
27
|
+
break;
|
|
28
|
+
case "delete":
|
|
29
|
+
resp = await this.delete(request);
|
|
30
|
+
break;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
throw new Error("Method must be populated on HTTPRequest object in order to utlize executeRequest.");
|
|
35
|
+
}
|
|
36
|
+
return resp;
|
|
37
|
+
}
|
|
38
|
+
async put(request) {
|
|
39
|
+
if (!this.isLoggedIn())
|
|
40
|
+
await this.ensureLoggedIn();
|
|
41
|
+
return await this._requestHandler.put(request);
|
|
42
|
+
}
|
|
43
|
+
async post(request) {
|
|
44
|
+
if (!this.isLoggedIn())
|
|
45
|
+
await this.ensureLoggedIn();
|
|
46
|
+
return await this._requestHandler.post(request);
|
|
47
|
+
}
|
|
48
|
+
async get(request) {
|
|
49
|
+
if (!this.isLoggedIn())
|
|
50
|
+
await this.ensureLoggedIn();
|
|
51
|
+
return await this._requestHandler.get(request);
|
|
52
|
+
}
|
|
53
|
+
async delete(request) {
|
|
54
|
+
if (!this.isLoggedIn())
|
|
55
|
+
await this.ensureLoggedIn();
|
|
56
|
+
return await this._requestHandler.delete(request);
|
|
57
|
+
}
|
|
58
|
+
async ensureLoggedIn() {
|
|
59
|
+
//if(!this.isLoggedIn()){
|
|
60
|
+
this._session = await this.auth.doLogin(this._instance.getHost(), this._instance.getUserName(), this._instance.getPassword());
|
|
61
|
+
if (!this.auth.isLoggedIn()) {
|
|
62
|
+
throw new Error("Unable to login.");
|
|
63
|
+
}
|
|
64
|
+
this._requestHandler.setRequestToken(this.auth.getToken());
|
|
65
|
+
//this._requestHandler._defaultHeaders["cookie"] = this.auth.getCookies();
|
|
66
|
+
//}
|
|
67
|
+
}
|
|
68
|
+
isLoggedIn() {
|
|
69
|
+
return this.getAuth().isLoggedIn();
|
|
70
|
+
}
|
|
71
|
+
getAuth() {
|
|
72
|
+
return this.auth;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=ServiceNowRequest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ServiceNowRequest.js","sourceRoot":"","sources":["../../../src/comm/http/ServiceNowRequest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,yCAAyC,CAAC;AAOvF,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAGhE,MAAM,OAAO,iBAAiB;IAE1B,SAAS,CAAqB;IAC9B,eAAe,CAAiB;IAChC,IAAI,CAAwB;IAE5B,QAAQ,GAAgB,IAAI,CAAC;IAE7B,YAAmB,QAA4B;QAC3C,IAAI,CAAC,IAAI,GAAG,4BAA4B,CAAC,iBAAiB,EAAE,CAAC;QAC7D,IAAI,CAAC,eAAe,GAAG,qBAAqB,CAAC,oBAAoB,CAAC,QAAQ,EAAG,IAAI,CAAC,IAAI,CAAC,CAAC;QAExF,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;IAC9B,CAAC;IAEM,KAAK,CAAC,cAAc,CAAI,OAAoB;QAC/C,IAAI,UAAU,GAAU,OAAO,CAAC,MAAM,CAAC;QACvC,IAAI,IAAI,GAAmB,IAAI,CAAC;QAGhC,IAAG,OAAO,UAAU,IAAI,WAAW,IAAI,UAAU,EAAC,CAAC;YAC/C,UAAU,GAAG,UAAU,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;YAE7C,QAAO,U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AU,EAAE;YACjB,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;QAEhC,OAAO,MAAM,IAAI,CAAC,eAAe,CAAC,MAAM,CAAI,OAAO,CAAC,CAAC;IACzD,CAAC;IAGO,KAAK,CAAC,cAAc;QACzB,yBAAyB;QAEhB,IAAI,CAAC,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CACnC,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,EACxB,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,EAC7B,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,CAC9B,CAAC;QAEF,IAAG,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,EAAC,CAAC;YACxB,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;QACxC,CAAC;QAED,IAAI,CAAC,eAAe,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC3D,0EAA0E;QAGlF,GAAG;IACP,CAAC;IAED,UAAU;QACN,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC,UAAU,EAAE,CAAC;IACvC,CAAC;IAEM,OAAO;QACV,OAAO,IAAI,CAAC,IAAI,CAAC;IACrB,CAAC;CAEJ"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { IServiceNowInstance } from "../../sn/IServiceNowInstance.js";
|
|
2
|
+
import { HttpResponse } from "./HttpResponse.js";
|
|
3
|
+
export declare class TableAPIRequest {
|
|
4
|
+
private _headers;
|
|
5
|
+
private _apiBase;
|
|
6
|
+
private _snInstance;
|
|
7
|
+
get snInstance(): IServiceNowInstance;
|
|
8
|
+
set snInstance(value: IServiceNowInstance);
|
|
9
|
+
constructor(instance: IServiceNowInstance);
|
|
10
|
+
get<T>(tableName: string, query: object): Promise<HttpResponse<T>>;
|
|
11
|
+
post<T>(tableName: string, query: object, body: object): Promise<HttpResponse<T>>;
|
|
12
|
+
private _doRequest;
|
|
13
|
+
private replaceVar;
|
|
14
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { ServiceNowRequest } from "./ServiceNowRequest.js";
|
|
2
|
+
export class TableAPIRequest {
|
|
3
|
+
_headers = {
|
|
4
|
+
"Content-Type": "application/json",
|
|
5
|
+
"Accept": "application/json"
|
|
6
|
+
};
|
|
7
|
+
_apiBase = "/api/now/table/{table_name}";
|
|
8
|
+
_snInstance;
|
|
9
|
+
get snInstance() {
|
|
10
|
+
return this._snInstance;
|
|
11
|
+
}
|
|
12
|
+
set snInstance(value) {
|
|
13
|
+
this._snInstance = value;
|
|
14
|
+
}
|
|
15
|
+
constructor(instance) {
|
|
16
|
+
this.snInstance = instance;
|
|
17
|
+
}
|
|
18
|
+
async get(tableName, query) {
|
|
19
|
+
const uri = this.replaceVar(this._apiBase, { table_name: tableName });
|
|
20
|
+
return await this._doRequest(uri, "get", query, null);
|
|
21
|
+
}
|
|
22
|
+
async post(tableName, query, body) {
|
|
23
|
+
const uri = this.replaceVar(this._apiBase, { table_name: tableName });
|
|
24
|
+
return await this._doRequest(uri, "post", query, body);
|
|
25
|
+
}
|
|
26
|
+
async _doRequest(uri, httpMethod, query, bodyData) {
|
|
27
|
+
let resp = null;
|
|
28
|
+
try {
|
|
29
|
+
const req = new ServiceNowRequest(this.snInstance);
|
|
30
|
+
const request = { path: uri, method: httpMethod, headers: this._headers, query: query, body: bodyData };
|
|
31
|
+
resp = await req.executeRequest(request);
|
|
32
|
+
}
|
|
33
|
+
catch (err) {
|
|
34
|
+
console.log(err);
|
|
35
|
+
}
|
|
36
|
+
return resp;
|
|
37
|
+
}
|
|
38
|
+
replaceVar(strBaseString, variables) {
|
|
39
|
+
let strNewString = strBaseString;
|
|
40
|
+
for (const prop in variables) {
|
|
41
|
+
strNewString = strNewString.replace("{" + prop + "}", variables[prop]);
|
|
42
|
+
}
|
|
43
|
+
return strNewString;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
//# sourceMapping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G,IAAI,IAAI,GAAmB,IAAI,CAAC;QAEhC,IAAG,CAAC;YACA,MAAM,GAAG,GAAqB,IAAI,iBAAiB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YAErE,MAAM,OAAO,GAAe,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,IAAI,CAAC,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAC,QAAQ,EAAC,CAAC;YAClH,IAAI,GAAG,MAAM,GAAG,CAAC,cAAc,CAAI,OAAO,CAAC,CAAC;QAChD,CAAC;QAAA,OAAM,GAAG,EAAC,CAAC;YACR,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACrB,CAAC;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;IAGO,UAAU,CAAC,aAAoB,EAAE,SAAgB;QACtD,IAAI,YAAY,GAAU,aAAa,CAAC;QACvC,KAAI,MAAM,IAAI,IAAI,SAAS,EAAC,CAAC;YACzB,YAAY,GAAG,YAAY,CAAC,OAAO,CAAC,GAAG,GAAC,IAAI,GAAC,GAAG,EAAE,SAAS,CAAC,IAAI,CAAW,CAAC,CAAC;QACjF,CAAC;QAED,OAAO,YAAY,CAAC;IACxB,CAAC;CACJ"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { UISession } from "@servicenow/sdk-cli-core";
|
|
2
|
+
import { ICookieStore } from "./ICookieStore.js";
|
|
3
|
+
import { IUserSession } from "./IUserSession.js";
|
|
4
|
+
export declare class UserSession implements IUserSession {
|
|
5
|
+
private _nowSession;
|
|
6
|
+
get nowSession(): UISession;
|
|
7
|
+
set nowSession(value: UISession);
|
|
8
|
+
constructor(session: UISession);
|
|
9
|
+
getCookies(): ICookieStore;
|
|
10
|
+
getToken(): string;
|
|
11
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { CookieStoreFactory } from "./CookieStoreFactory.js";
|
|
2
|
+
import { isNil } from "../../util/utils.js";
|
|
3
|
+
export class UserSession {
|
|
4
|
+
_nowSession;
|
|
5
|
+
get nowSession() {
|
|
6
|
+
return this._nowSession;
|
|
7
|
+
}
|
|
8
|
+
set nowSession(value) {
|
|
9
|
+
this._nowSession = value;
|
|
10
|
+
}
|
|
11
|
+
constructor(session) {
|
|
12
|
+
this._nowSession = session;
|
|
13
|
+
}
|
|
14
|
+
getCookies() {
|
|
15
|
+
if (isNil(this._nowSession.cookieJar)) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
return CookieStoreFactory.createCookieStore(this._nowSession.cookieJar);
|
|
19
|
+
}
|
|
20
|
+
getToken() {
|
|
21
|
+
return this._nowSession.userToken;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=UserSession.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UserSession.js","sourceRoot":"","sources":["../../../src/comm/http/UserSession.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAIzC,MAAM,OAAO,WAAW;IAEZ,WAAW,CAAY;IAC/B,IAAW,UAAU;QACjB,OAAO,IAAI,CAAC,WAAW,CAAC;IAC5B,CAAC;IACD,IAAW,UAAU,CAAC,KAAgB;QAClC,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;IAC7B,CAAC;IAGD,YAAmB,OAAiB;QAChC,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC;IAC/B,CAAC;IAEM,UAAU;QACb,IAAG,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,EAAC,CAAC;YAClC,OAAO,IAAI,CAAC;QAChB,CAAC;QAED,OAAO,kBAAkB,CAAC,iBAAiB,CAAC,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;IAC5E,CAAC;IAEM,QAAQ;QACX,OAAO,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC;IACtC,CAAC;CAEJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ATFMessageHandler.js","sourceRoot":"","sources":["../../../src/comm/ws/ATFMessageHandler.ts"],"names":[],"mappings":"AAGA,MAAM,OAAO,iBAAiB;IAE1B,iBAAiB,CAAC,QAAkB;IAEpC,CAAC;CACJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const EXTENSION_NAME = "sn-atf";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Extension.js","sourceRoot":"","sources":["../../src/constants/Extension.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,cAAc,GAAG,QAAQ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Files.js","sourceRoot":"","sources":["../../src/constants/Files.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG,mBAAmB,CAAC;AAC/C,MAAM,CAAC,MAAM,SAAS,GAAG,iBAAiB,CAAC;AAC3C,MAAM,CAAC,MAAM,UAAU,GAAG,kBAAkB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ServiceNow.js","sourceRoot":"","sources":["../../src/constants/ServiceNow.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,0BAA0B,GAAG,aAAa,CAAC;AACxD,MAAM,CAAC,MAAM,kBAAkB,GAAG,iBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createDecipheriv } from 'crypto';
|
|
2
|
+
const decryptSymmetric = (key, ciphertext, iv, tag) => {
|
|
3
|
+
const decipher = createDecipheriv("aes-256-gcm", Buffer.from(key, 'base64'), Buffer.from(iv, 'base64'));
|
|
4
|
+
decipher.setAuthTag(Buffer.from(tag, 'base64'));
|
|
5
|
+
let plaintext = decipher.update(ciphertext, 'base64', 'utf8');
|
|
6
|
+
plaintext += decipher.final('utf8');
|
|
7
|
+
return plaintext;
|
|
8
|
+
};
|
|
9
|
+
//const plaintext = decryptSymmetric(key, ciphertext, iv, tag);
|
|
10
|
+
//# sourceMappingURL=decrypt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decrypt.js","sourceRoot":"","sources":["../../src/encryption/decrypt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAAC,MAAM,QAAQ,CAAC;AAGxC,MAAM,gBAAgB,GAAG,CAAC,GAAG,EAAE,UAAU,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE;IAClD,MAAM,QAAQ,GAAG,gBAAgB,CAC/B,aAAa,EACb,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,CAAC,EAC1B,MAAM,CAAC,IAAI,CAAC,EAAE,EAAE,QAAQ,CAAC,CAC1B,CAAC;IAEF,QAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC;IAEhD,IAAI,SAAS,GAAG,QAAQ,CAAC,MAAM,CAAC,UAAU,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;IAC9D,SAAS,IAAI,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAEpC,OAAO,SAAS,CAAC;AACnB,CAAC,CAAA;AAED,+DAA+D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { randomBytes, createCipheriv } from 'crypto';
|
|
2
|
+
const encryptSymmetric = (key, plaintext) => {
|
|
3
|
+
const iv = randomBytes(12).toString('base64');
|
|
4
|
+
const cipher = createCipheriv("aes-256-gcm", Buffer.from(key, 'base64'), Buffer.from(iv, 'base64'));
|
|
5
|
+
let ciphertext = cipher.update(plaintext, 'utf8', 'base64');
|
|
6
|
+
ciphertext += cipher.final('base64');
|
|
7
|
+
const tag = cipher.getAuthTag();
|
|
8
|
+
return { ciphertext, tag };
|
|
9
|
+
};
|
|
10
|
+
//const plaintext = "encrypt me";
|
|
11
|
+
//const key = randomBytes(32).toString('base64');
|
|
12
|
+
//const { ciphertext, iv, tag } = encryptSymmetric(key, plaintext);
|
|
13
|
+
//# sourceMappingURL=encrypt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"encrypt.js","sourceRoot":"","sources":["../../src/encryption/encrypt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAIrD,MAAM,gBAAgB,GAAG,CAAC,GAAG,EAAE,SAAS,EAAE,EAAE;IAC1C,MAAM,EAAE,GAAG,WAAW,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAC9C,MAAM,MAAM,GAAG,cAAc,CAC3B,aAAa,EACb,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,CAAC,EAC1B,MAAM,CAAC,IAAI,CAAC,EAAE,EAAE,QAAQ,CAAC,CAC1B,CAAC;IACF,IAAI,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;IAC5D,UAAU,IAAI,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IACrC,MAAM,GAAG,GAAG,MAAM,CAAC,UAAU,EAAE,CAAA;IAE/B,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,CAAA;AAC5B,CAAC,CAAA;AAED,iCAAiC;AACjC,iDAAiD;AAEjD,mEAAmE"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export class FileException extends Error {
|
|
2
|
+
_innerException;
|
|
3
|
+
get innerException() {
|
|
4
|
+
return this._innerException;
|
|
5
|
+
}
|
|
6
|
+
set innerException(value) {
|
|
7
|
+
this._innerException = value;
|
|
8
|
+
}
|
|
9
|
+
constructor(errorMessage, innerException) {
|
|
10
|
+
super(errorMessage);
|
|
11
|
+
if (innerException)
|
|
12
|
+
this.innerException = innerException;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=FileException.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileException.js","sourceRoot":"","sources":["../../src/exception/FileException.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,aAAc,SAAQ,KAAK;IAE5B,eAAe,CAAQ;IAC/B,IAAW,cAAc;QACrB,OAAO,IAAI,CAAC,eAAe,CAAC;IAChC,CAAC;IACD,IAAW,cAAc,CAAC,KAAY;QAClC,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC;IACjC,CAAC;IAED,YAAmB,YAAmB,EAAE,cAAqB;QACzD,KAAK,CAAC,YAAY,CAAC,CAAC;QAEpB,IAAG,cAAc;YACb,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;IAG7C,CAAC;CACJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileExistsException.js","sourceRoot":"","sources":["../../src/exception/FileExistsException.ts"],"names":[],"mappings":"AACA,MAAM,OAAO,mBAAoB,SAAQ,KAAK;CAE7C"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export class InvalidParameterException extends Error {
|
|
2
|
+
_data;
|
|
3
|
+
constructor(errorMessage, data) {
|
|
4
|
+
super(errorMessage);
|
|
5
|
+
if (data)
|
|
6
|
+
this._data = data;
|
|
7
|
+
}
|
|
8
|
+
getData() {
|
|
9
|
+
return this._data;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=InvalidParameterException.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InvalidParameterException.js","sourceRoot":"","sources":["../../src/exception/InvalidParameterException.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,yBAA0B,SAAQ,KAAK;IAExC,KAAK,CAAK;IAClB,YAAmB,YAAmB,EAAE,IAAS;QAC7C,KAAK,CAAC,YAAY,CAAC,CAAC;QACpB,IAAG,IAAI;YACH,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IAC1B,CAAC;IAEM,OAAO;QACV,OAAO,IAAI,CAAC,KAAK,CAAC;IACtB,CAAC;CAEJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PathException.js","sourceRoot":"","sources":["../../src/exception/PathException.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,aAAc,SAAQ,KAAK;CAEvC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export * from './auth/AuthenticationHandlerFactory.js';
|
|
2
|
+
export * from './auth/IAuthenticationHandler.js';
|
|
3
|
+
export * from './auth/NowSDKAuthenticationHandler.js';
|
|
4
|
+
export * from './constants/Extension.js';
|
|
5
|
+
export * from './constants/Files.js';
|
|
6
|
+
export * from './constants/ServiceNow.js';
|
|
7
|
+
export * from './exception/FileException.js';
|
|
8
|
+
export * from './exception/FileExistsException.js';
|
|
9
|
+
export * from './exception/InvalidParameterException.js';
|
|
10
|
+
export * from './exception/PathException.js';
|
|
11
|
+
export * from './model/types.js';
|
|
12
|
+
export * from './sn/BackgroundScriptExecutor.js';
|
|
13
|
+
export * from './sn/IServiceNowInstance.js';
|
|
14
|
+
export * from './sn/ServiceNowInstance.js';
|
|
15
|
+
export * from './sn/SNRequestBase.js';
|
|
16
|
+
export * from './util/AppUtil.js';
|
|
17
|
+
export * from './util/Logger.js';
|
|
18
|
+
export * from './util/NowStringUtil.js';
|
|
19
|
+
export * from './util/utils.js';
|
|
20
|
+
export * from './comm/http/CookieStore.js';
|
|
21
|
+
export * from './comm/http/CookieStoreFactory.js';
|
|
22
|
+
export * from './comm/http/HTTPRequest.js';
|
|
23
|
+
export * from './comm/http/HttpResponse.js';
|
|
24
|
+
export * from './comm/http/ICookieStore.js';
|
|
25
|
+
export * from './comm/http/IHttpResponse.js';
|
|
26
|
+
export * from './comm/http/IRequestHandler.js';
|
|
27
|
+
export * from './comm/http/IUserSession.js';
|
|
28
|
+
export * from './comm/http/RequestHandler.js';
|
|
29
|
+
export * from './comm/http/RequestHandlerFactory.js';
|
|
30
|
+
export * from './comm/http/ServiceNowProcessorRequest.js';
|
|
31
|
+
export * from './comm/http/ServiceNowRequest.js';
|
|
32
|
+
export * from './comm/http/TableAPIRequest.js';
|
|
33
|
+
export * from './comm/http/UserSession.js';
|
|
34
|
+
export * from './comm/ws/ATFMessageHandler.js';
|
|
35
|
+
export * from './sn/user/UserRequest.js';
|
|
36
|
+
export * from './now/sdk/auth/CredentialStore.js';
|
|
37
|
+
export * from './now/sdk/auth/CredentialWrapper.js';
|
|
38
|
+
export * from './sn/user/factory/UserFactory.js';
|
|
39
|
+
export * from './sn/user/model/IUser.js';
|
|
40
|
+
export * from './sn/user/model/User.js';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export * from './auth/AuthenticationHandlerFactory.js';
|
|
2
|
+
export * from './auth/IAuthenticationHandler.js';
|
|
3
|
+
export * from './auth/NowSDKAuthenticationHandler.js';
|
|
4
|
+
export * from './constants/Extension.js';
|
|
5
|
+
export * from './constants/Files.js';
|
|
6
|
+
export * from './constants/ServiceNow.js';
|
|
7
|
+
export * from './exception/FileException.js';
|
|
8
|
+
export * from './exception/FileExistsException.js';
|
|
9
|
+
export * from './exception/InvalidParameterException.js';
|
|
10
|
+
export * from './exception/PathException.js';
|
|
11
|
+
export * from './model/types.js';
|
|
12
|
+
export * from './sn/BackgroundScriptExecutor.js';
|
|
13
|
+
export * from './sn/IServiceNowInstance.js';
|
|
14
|
+
export * from './sn/ServiceNowInstance.js';
|
|
15
|
+
export * from './sn/SNRequestBase.js';
|
|
16
|
+
export * from './util/AppUtil.js';
|
|
17
|
+
export * from './util/Logger.js';
|
|
18
|
+
export * from './util/NowStringUtil.js';
|
|
19
|
+
export * from './util/utils.js';
|
|
20
|
+
export * from './comm/http/CookieStore.js';
|
|
21
|
+
export * from './comm/http/CookieStoreFactory.js';
|
|
22
|
+
export * from './comm/http/HTTPRequest.js';
|
|
23
|
+
export * from './comm/http/HttpResponse.js';
|
|
24
|
+
export * from './comm/http/ICookieStore.js';
|
|
25
|
+
export * from './comm/http/IHttpResponse.js';
|
|
26
|
+
export * from './comm/http/IRequestHandler.js';
|
|
27
|
+
export * from './comm/http/IUserSession.js';
|
|
28
|
+
export * from './comm/http/RequestHandler.js';
|
|
29
|
+
export * from './comm/http/RequestHandlerFactory.js';
|
|
30
|
+
export * from './comm/http/ServiceNowProcessorRequest.js';
|
|
31
|
+
export * from './comm/http/ServiceNowRequest.js';
|
|
32
|
+
export * from './comm/http/TableAPIRequest.js';
|
|
33
|
+
export * from './comm/http/UserSession.js';
|
|
34
|
+
export * from './comm/ws/ATFMessageHandler.js';
|
|
35
|
+
export * from './sn/user/UserRequest.js';
|
|
36
|
+
export * from './now/sdk/auth/CredentialStore.js';
|
|
37
|
+
export * from './now/sdk/auth/CredentialWrapper.js';
|
|
38
|
+
export * from './sn/user/factory/UserFactory.js';
|
|
39
|
+
export * from './sn/user/model/IUser.js';
|
|
40
|
+
export * from './sn/user/model/User.js';
|
|
41
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,wCAAwC,CAAC;AACvD,cAAc,kCAAkC,CAAC;AACjD,cAAc,uCAAuC,CAAC;AACtD,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,oCAAoC,CAAC;AACnD,cAAc,0CAA0C,CAAC;AACzD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kBAAkB,CAAC;AACjC,cAAc,kCAAkC,CAAC;AACjD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,mCAAmC,CAAC;AAClD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,sCAAsC,CAAC;AACrD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,kCAAkC,CAAC;AACjD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,0BAA0B,CAAC;AACzC,cAAc,mCAAmC,CAAC;AAClD,cAAc,qCAAqC,CAAC;AACpD,cAAc,kCAAkC,CAAC;AACjD,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/model/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CredentialStore.js","sourceRoot":"","sources":["../../../../src/now/sdk/auth/CredentialStore.ts"],"names":[],"mappings":"AAGA,MAAM,OAAO,eAAe;CAE3B"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Creds } from '@servicenow/sdk-cli-core';
|
|
2
|
+
import * as sdk_auth from '@servicenow/sdk-cli/dist/auth/index.js';
|
|
3
|
+
export interface CredentialArg extends sdk_auth.StoredCredential {
|
|
4
|
+
isDefault: boolean;
|
|
5
|
+
alias: string;
|
|
6
|
+
auth: string;
|
|
7
|
+
}
|
|
8
|
+
export interface NowAuthArgument {
|
|
9
|
+
_: string | number[];
|
|
10
|
+
alias: string;
|
|
11
|
+
auth: string;
|
|
12
|
+
}
|
|
13
|
+
/***
|
|
14
|
+
* Wraps the functions exposed in @servicenow/sdk-cli/auth/index.ts
|
|
15
|
+
*/
|
|
16
|
+
export declare class CredentialWrapper {
|
|
17
|
+
private _logger;
|
|
18
|
+
private keychain;
|
|
19
|
+
private DEFAULT_ALIAS;
|
|
20
|
+
constructor();
|
|
21
|
+
getStoredCredentials(alias?: string): Promise<Creds>;
|
|
22
|
+
testCredential(username: null, password: null, host: null): Promise<Creds>;
|
|
23
|
+
getStoredCredentialsByAlias(alias?: string): Promise<Creds>;
|
|
24
|
+
getCredentialsTestWrapper(username: null, password: null, host: null): Promise<Creds>;
|
|
25
|
+
validateCredentials(alias: string): Promise<void>;
|
|
26
|
+
storeCredentials(alias: string, isDefault: boolean, host: string, username: string, password: string): Promise<void>;
|
|
27
|
+
updateDefaultCredential(alias: string, defaultCreds?: sdk_auth.StoredCredential): Promise<void>;
|
|
28
|
+
getDefaultCredentials(): Promise<sdk_auth.StoredCredential | undefined>;
|
|
29
|
+
removeCredentials(alias: string): Promise<void>;
|
|
30
|
+
listCredentials(alias: string): Promise<void>;
|
|
31
|
+
}
|