@sonisoft/now-sdk-ext-core 1.0.0-alpha.32 → 2.0.0-alpha.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.
- package/dist/auth/NowSDKAuthenticationHandler.d.ts +3 -3
- package/dist/auth/NowSDKAuthenticationHandler.js +6 -3
- package/dist/auth/NowSDKAuthenticationHandler.js.map +1 -1
- package/dist/comm/http/HTTPRequest.d.ts +2 -0
- package/dist/comm/http/RequestHandler.d.ts +1 -0
- package/dist/comm/http/RequestHandler.js +49 -15
- package/dist/comm/http/RequestHandler.js.map +1 -1
- package/dist/comm/http/ServiceNowProcessorRequest.d.ts +3 -0
- package/dist/comm/http/ServiceNowProcessorRequest.js +7 -4
- package/dist/comm/http/ServiceNowProcessorRequest.js.map +1 -1
- package/dist/index.d.ts +13 -3
- package/dist/index.js +13 -3
- package/dist/index.js.map +1 -1
- package/dist/sn/Application.d.ts +1 -0
- package/dist/sn/Application.js +26 -0
- package/dist/sn/Application.js.map +1 -1
- package/dist/sn/IServiceNowInstance.d.ts +1 -1
- package/dist/sn/ProgressWorker.d.ts +33 -0
- package/dist/sn/ProgressWorker.js +24 -0
- package/dist/sn/ProgressWorker.js.map +1 -0
- package/dist/sn/ServiceNowInstance.d.ts +2 -2
- package/dist/sn/ServiceNowInstance.js.map +1 -1
- package/dist/sn/amb/AMBClient.d.ts +66 -0
- package/dist/sn/amb/AMBClient.js +358 -0
- package/dist/sn/amb/AMBClient.js.map +1 -0
- package/dist/sn/amb/AMBConstants.d.ts +8 -0
- package/dist/sn/amb/AMBConstants.js +10 -0
- package/dist/sn/amb/AMBConstants.js.map +1 -0
- package/dist/sn/amb/AuthenticatedWebSocket.d.ts +25 -0
- package/dist/sn/amb/AuthenticatedWebSocket.js +56 -0
- package/dist/sn/amb/AuthenticatedWebSocket.js.map +1 -0
- package/dist/sn/amb/Channel.d.ts +67 -0
- package/dist/sn/amb/Channel.js +212 -0
- package/dist/sn/amb/Channel.js.map +1 -0
- package/dist/sn/amb/ChannelListener.d.ts +31 -0
- package/dist/sn/amb/ChannelListener.js +60 -0
- package/dist/sn/amb/ChannelListener.js.map +1 -0
- package/dist/sn/amb/ChannelRedirect.d.ts +13 -0
- package/dist/sn/amb/ChannelRedirect.js +50 -0
- package/dist/sn/amb/ChannelRedirect.js.map +1 -0
- package/dist/sn/amb/CrossClientChannel.d.ts +4 -0
- package/dist/sn/amb/CrossClientChannel.js +14 -0
- package/dist/sn/amb/CrossClientChannel.js.map +1 -0
- package/dist/sn/amb/EventManager.d.ts +13 -0
- package/dist/sn/amb/EventManager.js +40 -0
- package/dist/sn/amb/EventManager.js.map +1 -0
- package/dist/sn/amb/FunctionQueue.d.ts +53 -0
- package/dist/sn/amb/FunctionQueue.js +95 -0
- package/dist/sn/amb/FunctionQueue.js.map +1 -0
- package/dist/sn/amb/GraphQLSubscriptionExtension.d.ts +12 -0
- package/dist/sn/amb/GraphQLSubscriptionExtension.js +31 -0
- package/dist/sn/amb/GraphQLSubscriptionExtension.js.map +1 -0
- package/dist/sn/amb/Helper.d.ts +5 -0
- package/dist/sn/amb/Helper.js +6 -0
- package/dist/sn/amb/Helper.js.map +1 -0
- package/dist/sn/amb/MessageClient.d.ts +73 -0
- package/dist/sn/amb/MessageClient.js +154 -0
- package/dist/sn/amb/MessageClient.js.map +1 -0
- package/dist/sn/amb/MessageClientBuilder.d.ts +24 -0
- package/dist/sn/amb/MessageClientBuilder.js +95 -0
- package/dist/sn/amb/MessageClientBuilder.js.map +1 -0
- package/dist/sn/amb/Properties.d.ts +16 -0
- package/dist/sn/amb/Properties.js +32 -0
- package/dist/sn/amb/Properties.js.map +1 -0
- package/dist/sn/amb/ServerConnection.d.ts +132 -0
- package/dist/sn/amb/ServerConnection.js +579 -0
- package/dist/sn/amb/ServerConnection.js.map +1 -0
- package/dist/sn/amb/SessionExtension.d.ts +8 -0
- package/dist/sn/amb/SessionExtension.js +20 -0
- package/dist/sn/amb/SessionExtension.js.map +1 -0
- package/dist/sn/amb/SubscriptionCommandSender.d.ts +60 -0
- package/dist/sn/amb/SubscriptionCommandSender.js +222 -0
- package/dist/sn/amb/SubscriptionCommandSender.js.map +1 -0
- package/dist/sn/amb/TokenManagementExtension.d.ts +20 -0
- package/dist/sn/amb/TokenManagementExtension.js +90 -0
- package/dist/sn/amb/TokenManagementExtension.js.map +1 -0
- package/dist/sn/amb/XMLHttpRequest.d.ts +31 -0
- package/dist/sn/amb/XMLHttpRequest.js +287 -0
- package/dist/sn/amb/XMLHttpRequest.js.map +1 -0
- package/dist/sn/amb/cometd-nodejs-client.d.ts +1 -0
- package/dist/sn/amb/cometd-nodejs-client.js +84 -0
- package/dist/sn/amb/cometd-nodejs-client.js.map +1 -0
- package/dist/sn/amb/index.d.ts +19 -0
- package/dist/sn/amb/index.js +20 -0
- package/dist/sn/amb/index.js.map +1 -0
- package/dist/sn/application/AppRepoApplication.d.ts +166 -0
- package/dist/sn/application/AppRepoApplication.js +167 -0
- package/dist/sn/application/AppRepoApplication.js.map +1 -0
- package/dist/sn/application/ApplicationDetailModel.d.ts +71 -0
- package/dist/sn/application/ApplicationDetailModel.js +72 -0
- package/dist/sn/application/ApplicationDetailModel.js.map +1 -0
- package/dist/sn/application/ApplicationManager.d.ts +117 -0
- package/dist/sn/application/ApplicationManager.js +251 -0
- package/dist/sn/application/ApplicationManager.js.map +1 -0
- package/dist/sn/application/BatchDefinition.d.ts +16 -0
- package/dist/sn/application/BatchDefinition.js +60 -0
- package/dist/sn/application/BatchDefinition.js.map +1 -0
- package/dist/sn/application/BatchInstallation.d.ts +8 -0
- package/dist/sn/application/BatchInstallation.js +20 -0
- package/dist/sn/application/BatchInstallation.js.map +1 -0
- package/dist/sn/application/CompanyApplications.d.ts +234 -0
- package/dist/sn/application/CompanyApplications.js +91 -0
- package/dist/sn/application/CompanyApplications.js.map +1 -0
- package/dist/sn/atf/ATFTest.d.ts +27 -0
- package/dist/sn/atf/ATFTest.js +3 -0
- package/dist/sn/atf/ATFTest.js.map +1 -0
- package/dist/sn/atf/ATFTestExecutor.d.ts +115 -0
- package/dist/sn/atf/ATFTestExecutor.js +239 -0
- package/dist/sn/atf/ATFTestExecutor.js.map +1 -0
- package/dist/sn/atf/ATFTestStep.d.ts +0 -0
- package/dist/sn/atf/ATFTestStep.js +1 -0
- package/dist/sn/atf/ATFTestStep.js.map +1 -0
- package/dist/sn/atf/ATFTestSuite.d.ts +0 -0
- package/dist/sn/atf/ATFTestSuite.js +1 -0
- package/dist/sn/atf/ATFTestSuite.js.map +1 -0
- package/dist/sn/atf/TestFactory.d.ts +2 -0
- package/dist/sn/atf/TestFactory.js +3 -0
- package/dist/sn/atf/TestFactory.js.map +1 -0
- package/dist/sn/atf/TestStepFactory.d.ts +0 -0
- package/dist/sn/atf/TestStepFactory.js +1 -0
- package/dist/sn/atf/TestStepFactory.js.map +1 -0
- package/dist/sn/atf/TestSuiteFactory.d.ts +0 -0
- package/dist/sn/atf/TestSuiteFactory.js +1 -0
- package/dist/sn/atf/TestSuiteFactory.js.map +1 -0
- package/dist/sn/syslog/SyslogReader.d.ts +113 -0
- package/dist/sn/syslog/SyslogReader.js +369 -0
- package/dist/sn/syslog/SyslogReader.js.map +1 -0
- package/dist/sn/syslog/SyslogRecord.d.ts +86 -0
- package/dist/sn/syslog/SyslogRecord.js +2 -0
- package/dist/sn/syslog/SyslogRecord.js.map +1 -0
- package/package.json +8 -9
- package/dist/comm/http/CookieStore.d.ts +0 -8
- package/dist/comm/http/CookieStore.js +0 -21
- package/dist/comm/http/CookieStore.js.map +0 -1
- package/dist/comm/http/CookieStoreFactory.d.ts +0 -5
- package/dist/comm/http/CookieStoreFactory.js +0 -11
- package/dist/comm/http/CookieStoreFactory.js.map +0 -1
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { Logger } from "../../util/Logger.js";
|
|
2
|
+
import { ServiceNowRequest } from "../../comm/http/ServiceNowRequest.js";
|
|
3
|
+
import { ProgressWorker } from "../ProgressWorker.js";
|
|
4
|
+
/**
|
|
5
|
+
* AppRepoApplication class for managing application repository operations
|
|
6
|
+
* Provides methods to install applications from and publish applications to
|
|
7
|
+
* a company's ServiceNow application repository using the CI/CD API
|
|
8
|
+
*/
|
|
9
|
+
export class AppRepoApplication {
|
|
10
|
+
APP_REPO_INSTALL_API_URL = "/api/sn_cicd/app_repo/install";
|
|
11
|
+
APP_REPO_PUBLISH_API_URL = "/api/sn_cicd/app_repo/publish";
|
|
12
|
+
PROGRESS_API_URL = "/api/sn_cicd/progress/{progressId}";
|
|
13
|
+
DEFAULT_TIMEOUT = 1000 * 60 * 30; // 30 minutes
|
|
14
|
+
DEFAULT_POLL_INTERVAL = 5000; // 5 seconds
|
|
15
|
+
_logger = new Logger("AppRepoApplication");
|
|
16
|
+
_req;
|
|
17
|
+
_instance;
|
|
18
|
+
constructor(instance) {
|
|
19
|
+
this._instance = instance;
|
|
20
|
+
this._req = new ServiceNowRequest(instance);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Installs an application from the application repository
|
|
24
|
+
* @param request AppRepoInstallRequest containing installation parameters
|
|
25
|
+
* @returns Promise<AppRepoInstallResponse> Installation response with progress information
|
|
26
|
+
*/
|
|
27
|
+
async installFromAppRepo(request) {
|
|
28
|
+
const queryParams = {
|
|
29
|
+
scope: request.scope,
|
|
30
|
+
sys_id: request.sys_id
|
|
31
|
+
};
|
|
32
|
+
// Add optional parameters
|
|
33
|
+
if (request.version !== undefined) {
|
|
34
|
+
queryParams.version = request.version;
|
|
35
|
+
}
|
|
36
|
+
if (request.auto_upgrade_base_app !== undefined) {
|
|
37
|
+
queryParams.auto_upgrade_base_app = request.auto_upgrade_base_app;
|
|
38
|
+
}
|
|
39
|
+
if (request.base_app_version !== undefined) {
|
|
40
|
+
queryParams.base_app_version = request.base_app_version;
|
|
41
|
+
}
|
|
42
|
+
const httpRequest = {
|
|
43
|
+
path: this.APP_REPO_INSTALL_API_URL,
|
|
44
|
+
headers: {
|
|
45
|
+
'Accept': 'application/json',
|
|
46
|
+
'Content-Type': 'application/json'
|
|
47
|
+
},
|
|
48
|
+
query: queryParams,
|
|
49
|
+
body: null
|
|
50
|
+
};
|
|
51
|
+
this._logger.info(`Installing application from app repo: ${request.scope} (${request.sys_id})`);
|
|
52
|
+
const resp = await this._req.post(httpRequest);
|
|
53
|
+
if (resp.status === 200 && resp.bodyObject && resp.bodyObject.result) {
|
|
54
|
+
this._logger.info(`App repo install initiated successfully for ${request.scope}`);
|
|
55
|
+
return resp.bodyObject.result;
|
|
56
|
+
}
|
|
57
|
+
throw new Error(`Failed to install application from app repo. Status: ${resp.status}, Response: ${JSON.stringify(resp.bodyObject)}`);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Installs an application from the app repository and waits for completion
|
|
61
|
+
* @param request AppRepoInstallRequest containing installation parameters
|
|
62
|
+
* @param pollIntervalMs Polling interval in milliseconds (default: 5000)
|
|
63
|
+
* @param timeoutMs Timeout in milliseconds (default: 30 minutes)
|
|
64
|
+
* @returns Promise<AppRepoOperationResult> Final operation result
|
|
65
|
+
*/
|
|
66
|
+
async installFromAppRepoAndWait(request, pollIntervalMs = this.DEFAULT_POLL_INTERVAL, timeoutMs = this.DEFAULT_TIMEOUT) {
|
|
67
|
+
const installResponse = await this.installFromAppRepo(request);
|
|
68
|
+
if (!installResponse.links?.progress?.id) {
|
|
69
|
+
throw new Error('No progress ID returned from install operation');
|
|
70
|
+
}
|
|
71
|
+
return await this.waitForCompletion(installResponse.links.progress.id, pollIntervalMs, timeoutMs);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Publishes an application to the application repository
|
|
75
|
+
* @param request AppRepoPublishRequest containing publish parameters
|
|
76
|
+
* @returns Promise<AppRepoPublishResponse> Publish response with progress information
|
|
77
|
+
*/
|
|
78
|
+
async publishToAppRepo(request) {
|
|
79
|
+
const queryParams = {
|
|
80
|
+
scope: request.scope,
|
|
81
|
+
sys_id: request.sys_id
|
|
82
|
+
};
|
|
83
|
+
// Add optional parameters
|
|
84
|
+
if (request.version !== undefined) {
|
|
85
|
+
queryParams.version = request.version;
|
|
86
|
+
}
|
|
87
|
+
if (request.dev_notes !== undefined) {
|
|
88
|
+
queryParams.dev_notes = request.dev_notes;
|
|
89
|
+
}
|
|
90
|
+
const httpRequest = {
|
|
91
|
+
path: this.APP_REPO_PUBLISH_API_URL,
|
|
92
|
+
headers: {
|
|
93
|
+
'Accept': 'application/json',
|
|
94
|
+
'Content-Type': 'application/json'
|
|
95
|
+
},
|
|
96
|
+
query: queryParams,
|
|
97
|
+
body: null
|
|
98
|
+
};
|
|
99
|
+
this._logger.info(`Publishing application to app repo: ${request.scope} (${request.sys_id})`);
|
|
100
|
+
const resp = await this._req.post(httpRequest);
|
|
101
|
+
if (resp.status === 200 && resp.bodyObject && resp.bodyObject.result) {
|
|
102
|
+
this._logger.info(`App repo publish initiated successfully for ${request.scope}`);
|
|
103
|
+
return resp.bodyObject.result;
|
|
104
|
+
}
|
|
105
|
+
throw new Error(`Failed to publish application to app repo. Status: ${resp.status}, Response: ${JSON.stringify(resp.bodyObject)}`);
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Publishes an application to the app repository and waits for completion
|
|
109
|
+
* @param request AppRepoPublishRequest containing publish parameters
|
|
110
|
+
* @param pollIntervalMs Polling interval in milliseconds (default: 5000)
|
|
111
|
+
* @param timeoutMs Timeout in milliseconds (default: 30 minutes)
|
|
112
|
+
* @returns Promise<AppRepoOperationResult> Final operation result
|
|
113
|
+
*/
|
|
114
|
+
async publishToAppRepoAndWait(request, pollIntervalMs = this.DEFAULT_POLL_INTERVAL, timeoutMs = this.DEFAULT_TIMEOUT) {
|
|
115
|
+
const publishResponse = await this.publishToAppRepo(request);
|
|
116
|
+
if (!publishResponse.links?.progress?.id) {
|
|
117
|
+
throw new Error('No progress ID returned from publish operation');
|
|
118
|
+
}
|
|
119
|
+
return await this.waitForCompletion(publishResponse.links.progress.id, pollIntervalMs, timeoutMs);
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Gets the current progress of an app repo operation
|
|
123
|
+
* @param progressId Progress ID from the operation response
|
|
124
|
+
* @returns Promise<ProgressResult> Current progress information
|
|
125
|
+
*/
|
|
126
|
+
async getProgress(progressId) {
|
|
127
|
+
const progressWorker = new ProgressWorker(this._instance);
|
|
128
|
+
return await progressWorker.getProgress(progressId);
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Waits for an app repo operation to complete
|
|
132
|
+
* @param progressId Progress ID to monitor
|
|
133
|
+
* @param pollIntervalMs Polling interval in milliseconds
|
|
134
|
+
* @param timeoutMs Timeout in milliseconds
|
|
135
|
+
* @returns Promise<AppRepoOperationResult> Final operation result
|
|
136
|
+
*/
|
|
137
|
+
async waitForCompletion(progressId, pollIntervalMs, timeoutMs) {
|
|
138
|
+
const startTime = Date.now();
|
|
139
|
+
let progress = await this.getProgress(progressId);
|
|
140
|
+
this._logger.info(`Waiting for operation completion. Progress: ${progress.percent_complete}%`);
|
|
141
|
+
while (progress.percent_complete < 100 && (Date.now() - startTime) < timeoutMs) {
|
|
142
|
+
await new Promise(resolve => setTimeout(resolve, pollIntervalMs));
|
|
143
|
+
progress = await this.getProgress(progressId);
|
|
144
|
+
this._logger.info(`Operation progress: ${progress.percent_complete}% - ${progress.status_label}`);
|
|
145
|
+
}
|
|
146
|
+
if (progress.percent_complete < 100) {
|
|
147
|
+
throw new Error(`Operation timed out after ${timeoutMs}ms`);
|
|
148
|
+
}
|
|
149
|
+
if (progress.error) {
|
|
150
|
+
throw new Error(`Operation failed: ${progress.error}`);
|
|
151
|
+
}
|
|
152
|
+
if (progress.status === "3") { // FAILED status
|
|
153
|
+
throw new Error(`Operation failed: ${progress.status_label} - ${progress.status_message}`);
|
|
154
|
+
}
|
|
155
|
+
return {
|
|
156
|
+
success: progress.status === "2", // SUCCESSFUL status
|
|
157
|
+
status: progress.status,
|
|
158
|
+
status_label: progress.status_label,
|
|
159
|
+
status_message: progress.status_message,
|
|
160
|
+
status_detail: progress.status_detail,
|
|
161
|
+
error: progress.error,
|
|
162
|
+
percent_complete: progress.percent_complete,
|
|
163
|
+
links: progress.links
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
//# sourceMappingURL=AppRepoApplication.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AppRepoApplication.js","sourceRoot":"","sources":["../../../src/sn/application/AppRepoApplication.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAG3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,cAAc,EAAkB,MAAM,mBAAmB,CAAC;AAEnE;;;;GAIG;AACH,MAAM,OAAO,kBAAkB;IACV,wBAAwB,GAAG,+BAA+B,CAAC;IAC3D,wBAAwB,GAAG,+BAA+B,CAAC;IAC3D,gBAAgB,GAAG,oCAAoC,CAAC;IAExD,eAAe,GAAG,IAAI,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,aAAa;IAC/C,qBAAqB,GAAG,IAAI,CAAC,CAAC,YAAY;IAEnD,OAAO,GAAW,IAAI,MAAM,CAAC,oBAAoB,CAAC,CAAC;IACnD,IAAI,CAAoB;IACxB,SAAS,CAAqB;IAEtC,YAAmB,QAA4B;QAC3C,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,IAAI,CAAC,IAAI,GAAG,IAAI,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IAChD,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,kBAAkB,CAAC,OAA8B;QAC1D,MAAM,WAAW,GAAqC;YAClD,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,MAAM,EAAE,OAAO,CAAC,MAAM;SACzB,CAAC;QAEF,0BAA0B;QAC1B,IAAI,OAAO,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;YAChC,WAAW,CAAC,OAAO,GAAG,O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3C,KAAK,EAAE,QAAQ,CAAC,KAAK;SACxB,CAAC;IACN,CAAC;CACJ"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
export declare class ApplicationDetailModelResponse {
|
|
2
|
+
result: ApplicationInstanceDetailModel;
|
|
3
|
+
}
|
|
4
|
+
export declare class ApplicationInstanceDetailModel {
|
|
5
|
+
app_info_on_instance: ApplicationDetailModel;
|
|
6
|
+
}
|
|
7
|
+
export declare class ApplicationDetailModel {
|
|
8
|
+
logo: string;
|
|
9
|
+
short_description: string;
|
|
10
|
+
needs_app_engine_licensing: boolean;
|
|
11
|
+
custom_table_count: string;
|
|
12
|
+
name: string;
|
|
13
|
+
vendor: string;
|
|
14
|
+
vendor_prefix: string;
|
|
15
|
+
link: string;
|
|
16
|
+
scope: string;
|
|
17
|
+
compatibilities: string;
|
|
18
|
+
active: boolean;
|
|
19
|
+
price_type: string;
|
|
20
|
+
lob: string[];
|
|
21
|
+
source: string;
|
|
22
|
+
shared_internally: boolean;
|
|
23
|
+
indicators: string[];
|
|
24
|
+
display_message: string;
|
|
25
|
+
upload_info: string;
|
|
26
|
+
products: string[];
|
|
27
|
+
install_date: string;
|
|
28
|
+
update_date: string;
|
|
29
|
+
version: string;
|
|
30
|
+
version_display: string;
|
|
31
|
+
assigned_version: string;
|
|
32
|
+
latest_version: string;
|
|
33
|
+
latest_version_display: string;
|
|
34
|
+
demo_data: string;
|
|
35
|
+
sys_id: string;
|
|
36
|
+
sys_updated_on: string;
|
|
37
|
+
sys_created_on: string;
|
|
38
|
+
can_edit_in_studio: boolean;
|
|
39
|
+
can_open_in_studio: boolean;
|
|
40
|
+
is_customized_app: boolean;
|
|
41
|
+
can_install_or_upgrade_customization: boolean;
|
|
42
|
+
customized_version_info: unknown;
|
|
43
|
+
is_store_app: boolean;
|
|
44
|
+
store_link: string;
|
|
45
|
+
isSubscriptionApplicable: boolean;
|
|
46
|
+
publish_date_display: string;
|
|
47
|
+
isAppstorePlugin: boolean;
|
|
48
|
+
uninstall_blocked: boolean;
|
|
49
|
+
sys_code: string;
|
|
50
|
+
can_install_or_upgrade: boolean;
|
|
51
|
+
isInstalled: boolean;
|
|
52
|
+
isInstalledAndUpdateAvailable: boolean;
|
|
53
|
+
isCustomizationUpdateAvailable: boolean;
|
|
54
|
+
installed_as_dependency: boolean;
|
|
55
|
+
app_schedule_details: unknown;
|
|
56
|
+
dependencies: unknown;
|
|
57
|
+
contains_plugins: boolean;
|
|
58
|
+
optional_apps_available: boolean;
|
|
59
|
+
install_tracker_id: string;
|
|
60
|
+
versions: unknown[];
|
|
61
|
+
new_guided_setup_id: string;
|
|
62
|
+
upgradeHistoryId: string;
|
|
63
|
+
upgradeDetailsInfo: unknown;
|
|
64
|
+
installationInfo: unknown;
|
|
65
|
+
installedFilesQuery: unknown;
|
|
66
|
+
customizedFilesQuery: unknown;
|
|
67
|
+
userDateFormat: string;
|
|
68
|
+
time_taken: number;
|
|
69
|
+
sys_created_on_display: string;
|
|
70
|
+
sys_updated_on_display: string;
|
|
71
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
export class ApplicationDetailModelResponse {
|
|
2
|
+
result;
|
|
3
|
+
}
|
|
4
|
+
export class ApplicationInstanceDetailModel {
|
|
5
|
+
app_info_on_instance;
|
|
6
|
+
}
|
|
7
|
+
export class ApplicationDetailModel {
|
|
8
|
+
logo;
|
|
9
|
+
short_description;
|
|
10
|
+
needs_app_engine_licensing;
|
|
11
|
+
custom_table_count;
|
|
12
|
+
name;
|
|
13
|
+
vendor;
|
|
14
|
+
vendor_prefix;
|
|
15
|
+
link;
|
|
16
|
+
scope;
|
|
17
|
+
compatibilities;
|
|
18
|
+
active;
|
|
19
|
+
price_type;
|
|
20
|
+
lob;
|
|
21
|
+
source;
|
|
22
|
+
shared_internally;
|
|
23
|
+
indicators;
|
|
24
|
+
display_message;
|
|
25
|
+
upload_info;
|
|
26
|
+
products;
|
|
27
|
+
install_date;
|
|
28
|
+
update_date;
|
|
29
|
+
version;
|
|
30
|
+
version_display;
|
|
31
|
+
assigned_version;
|
|
32
|
+
latest_version;
|
|
33
|
+
latest_version_display;
|
|
34
|
+
demo_data;
|
|
35
|
+
sys_id;
|
|
36
|
+
sys_updated_on;
|
|
37
|
+
sys_created_on;
|
|
38
|
+
can_edit_in_studio;
|
|
39
|
+
can_open_in_studio;
|
|
40
|
+
is_customized_app;
|
|
41
|
+
can_install_or_upgrade_customization;
|
|
42
|
+
customized_version_info;
|
|
43
|
+
is_store_app;
|
|
44
|
+
store_link;
|
|
45
|
+
isSubscriptionApplicable;
|
|
46
|
+
publish_date_display;
|
|
47
|
+
isAppstorePlugin;
|
|
48
|
+
uninstall_blocked;
|
|
49
|
+
sys_code;
|
|
50
|
+
can_install_or_upgrade;
|
|
51
|
+
isInstalled;
|
|
52
|
+
isInstalledAndUpdateAvailable;
|
|
53
|
+
isCustomizationUpdateAvailable;
|
|
54
|
+
installed_as_dependency;
|
|
55
|
+
app_schedule_details;
|
|
56
|
+
dependencies;
|
|
57
|
+
contains_plugins;
|
|
58
|
+
optional_apps_available;
|
|
59
|
+
install_tracker_id;
|
|
60
|
+
versions;
|
|
61
|
+
new_guided_setup_id;
|
|
62
|
+
upgradeHistoryId;
|
|
63
|
+
upgradeDetailsInfo;
|
|
64
|
+
installationInfo;
|
|
65
|
+
installedFilesQuery;
|
|
66
|
+
customizedFilesQuery;
|
|
67
|
+
userDateFormat;
|
|
68
|
+
time_taken;
|
|
69
|
+
sys_created_on_display;
|
|
70
|
+
sys_updated_on_display;
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=ApplicationDetailModel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ApplicationDetailModel.js","sourceRoot":"","sources":["../../../src/sn/application/ApplicationDetailModel.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,8BAA8B;IACvC,MAAM,CAAgC;CACzC;AAED,MAAM,OAAO,8BAA8B;IACvC,oBAAoB,CAAwB;CAC/C;AAG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IACtB,UAAU,CAAQ;IAElB,sBAAsB,CAAQ;IAC9B,sBAAsB,CAAQ;CAgIjC"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { ServiceNowInstance } from "../ServiceNowInstance.js";
|
|
2
|
+
import { Logger } from "../../util/Logger.js";
|
|
3
|
+
import { ServiceNowRequest } from "../../comm/http/ServiceNowRequest.js";
|
|
4
|
+
import { ApplicationDetailModel } from "./ApplicationDetailModel.js";
|
|
5
|
+
import { BatchInstallation } from "./BatchInstallation.js";
|
|
6
|
+
import { BatchDefinition } from "./BatchDefinition.js";
|
|
7
|
+
export declare class ApplicationManager {
|
|
8
|
+
BATCH_API_URL: string;
|
|
9
|
+
APP_DETAILS_API_URL: string;
|
|
10
|
+
APP_UPDATES_LIST_API_URL: string;
|
|
11
|
+
BATCH_INSTALL_TIMEOUT: number;
|
|
12
|
+
_logger: Logger;
|
|
13
|
+
_req: ServiceNowRequest;
|
|
14
|
+
constructor(instance: ServiceNowInstance);
|
|
15
|
+
private _instance;
|
|
16
|
+
installBatch(batchDefinitionPath: string): Promise<boolean>;
|
|
17
|
+
private getInstallableApplicationPackages;
|
|
18
|
+
getApplicationDetails(appID: string): Promise<ApplicationDetailModel>;
|
|
19
|
+
private waitForBatchInstallCompletion;
|
|
20
|
+
private executeBatchInstallRequest;
|
|
21
|
+
private getBatchProgress;
|
|
22
|
+
/**
|
|
23
|
+
* Validates a batch definition file against currently installed applications
|
|
24
|
+
* @param batchDefinitionPath Path to the batch definition JSON file
|
|
25
|
+
* @returns Promise<BatchValidationResult> Validation results for all applications in the batch
|
|
26
|
+
*/
|
|
27
|
+
validateBatchDefinition(batchDefinitionPath: string): Promise<BatchValidationResult>;
|
|
28
|
+
/**
|
|
29
|
+
* Validates a BatchInstallation object against currently installed applications
|
|
30
|
+
* @param batchInstall BatchInstallation object to validate
|
|
31
|
+
* @returns Promise<BatchValidationResult> Validation results for all applications in the batch
|
|
32
|
+
*/
|
|
33
|
+
validateBatchInstallation(batchInstall: BatchInstallation): Promise<BatchValidationResult>;
|
|
34
|
+
/**
|
|
35
|
+
* Validates a single application from a batch definition
|
|
36
|
+
* @param pkg BatchDefinition to validate
|
|
37
|
+
* @returns Promise<ApplicationValidationResult> Validation result for the application
|
|
38
|
+
*/
|
|
39
|
+
validateApplication(pkg: BatchDefinition): Promise<ApplicationValidationResult>;
|
|
40
|
+
/**
|
|
41
|
+
* Checks which applications from a batch definition are currently installed
|
|
42
|
+
* @param batchDefinitionPath Path to the batch definition JSON file
|
|
43
|
+
* @returns Promise<ApplicationValidationResult[]> Array of validation results
|
|
44
|
+
*/
|
|
45
|
+
checkInstalledApplications(batchDefinitionPath: string): Promise<ApplicationValidationResult[]>;
|
|
46
|
+
/**
|
|
47
|
+
* Gets applications that need installation or upgrade from a batch definition
|
|
48
|
+
* @param batchDefinitionPath Path to the batch definition JSON file
|
|
49
|
+
* @returns Promise<ApplicationValidationResult[]> Array of applications needing action
|
|
50
|
+
*/
|
|
51
|
+
getApplicationsNeedingAction(batchDefinitionPath: string): Promise<ApplicationValidationResult[]>;
|
|
52
|
+
/**
|
|
53
|
+
* Compares two version strings
|
|
54
|
+
* @param version1 First version string (e.g., "1.2.3")
|
|
55
|
+
* @param version2 Second version string (e.g., "1.2.4")
|
|
56
|
+
* @returns -1 if version1 < version2, 0 if equal, 1 if version1 > version2
|
|
57
|
+
*/
|
|
58
|
+
private compareVersions;
|
|
59
|
+
}
|
|
60
|
+
export declare class BatchInstallResultResponse {
|
|
61
|
+
result: BatchInstallResult;
|
|
62
|
+
}
|
|
63
|
+
export interface BatchInstallResultLinks {
|
|
64
|
+
progress?: {
|
|
65
|
+
id: string;
|
|
66
|
+
url: string;
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
export declare class BatchInstallResult {
|
|
70
|
+
links: BatchInstallResultLinks;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Represents the validation result for a single application in a batch definition
|
|
74
|
+
*/
|
|
75
|
+
export interface ApplicationValidationResult {
|
|
76
|
+
/** Application sys_id from batch definition */
|
|
77
|
+
id: string;
|
|
78
|
+
/** Application name */
|
|
79
|
+
name?: string;
|
|
80
|
+
/** Requested version from batch definition */
|
|
81
|
+
requested_version: string;
|
|
82
|
+
/** Currently installed version (if any) */
|
|
83
|
+
installed_version?: string;
|
|
84
|
+
/** Whether the application is currently installed */
|
|
85
|
+
isInstalled: boolean;
|
|
86
|
+
/** Whether the installed version matches the requested version */
|
|
87
|
+
isVersionMatch: boolean;
|
|
88
|
+
/** Whether an update is available */
|
|
89
|
+
isUpdateAvailable: boolean;
|
|
90
|
+
/** Whether the application needs to be installed or upgraded */
|
|
91
|
+
needsAction: boolean;
|
|
92
|
+
/** Validation status: 'valid', 'mismatch', 'not_installed', 'update_needed', 'error' */
|
|
93
|
+
validationStatus: 'valid' | 'mismatch' | 'not_installed' | 'update_needed' | 'error';
|
|
94
|
+
/** Any error message if validation failed */
|
|
95
|
+
error?: string;
|
|
96
|
+
/** Full application details if available */
|
|
97
|
+
appDetails?: ApplicationDetailModel;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Represents the validation result for an entire batch definition
|
|
101
|
+
*/
|
|
102
|
+
export interface BatchValidationResult {
|
|
103
|
+
/** Array of validation results for each application */
|
|
104
|
+
applications: ApplicationValidationResult[];
|
|
105
|
+
/** Total number of applications in batch */
|
|
106
|
+
totalApplications: number;
|
|
107
|
+
/** Number of applications already installed with correct version */
|
|
108
|
+
alreadyValid: number;
|
|
109
|
+
/** Number of applications that need installation */
|
|
110
|
+
needsInstallation: number;
|
|
111
|
+
/** Number of applications that need upgrade */
|
|
112
|
+
needsUpgrade: number;
|
|
113
|
+
/** Number of applications with errors during validation */
|
|
114
|
+
errors: number;
|
|
115
|
+
/** Overall validation passed (all apps either valid or can be installed/upgraded) */
|
|
116
|
+
isValid: boolean;
|
|
117
|
+
}
|