@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.
Files changed (137) hide show
  1. package/dist/auth/NowSDKAuthenticationHandler.d.ts +3 -3
  2. package/dist/auth/NowSDKAuthenticationHandler.js +6 -3
  3. package/dist/auth/NowSDKAuthenticationHandler.js.map +1 -1
  4. package/dist/comm/http/HTTPRequest.d.ts +2 -0
  5. package/dist/comm/http/RequestHandler.d.ts +1 -0
  6. package/dist/comm/http/RequestHandler.js +49 -15
  7. package/dist/comm/http/RequestHandler.js.map +1 -1
  8. package/dist/comm/http/ServiceNowProcessorRequest.d.ts +3 -0
  9. package/dist/comm/http/ServiceNowProcessorRequest.js +7 -4
  10. package/dist/comm/http/ServiceNowProcessorRequest.js.map +1 -1
  11. package/dist/index.d.ts +13 -3
  12. package/dist/index.js +13 -3
  13. package/dist/index.js.map +1 -1
  14. package/dist/sn/Application.d.ts +1 -0
  15. package/dist/sn/Application.js +26 -0
  16. package/dist/sn/Application.js.map +1 -1
  17. package/dist/sn/IServiceNowInstance.d.ts +1 -1
  18. package/dist/sn/ProgressWorker.d.ts +33 -0
  19. package/dist/sn/ProgressWorker.js +24 -0
  20. package/dist/sn/ProgressWorker.js.map +1 -0
  21. package/dist/sn/ServiceNowInstance.d.ts +2 -2
  22. package/dist/sn/ServiceNowInstance.js.map +1 -1
  23. package/dist/sn/amb/AMBClient.d.ts +66 -0
  24. package/dist/sn/amb/AMBClient.js +358 -0
  25. package/dist/sn/amb/AMBClient.js.map +1 -0
  26. package/dist/sn/amb/AMBConstants.d.ts +8 -0
  27. package/dist/sn/amb/AMBConstants.js +10 -0
  28. package/dist/sn/amb/AMBConstants.js.map +1 -0
  29. package/dist/sn/amb/AuthenticatedWebSocket.d.ts +25 -0
  30. package/dist/sn/amb/AuthenticatedWebSocket.js +56 -0
  31. package/dist/sn/amb/AuthenticatedWebSocket.js.map +1 -0
  32. package/dist/sn/amb/Channel.d.ts +67 -0
  33. package/dist/sn/amb/Channel.js +212 -0
  34. package/dist/sn/amb/Channel.js.map +1 -0
  35. package/dist/sn/amb/ChannelListener.d.ts +31 -0
  36. package/dist/sn/amb/ChannelListener.js +60 -0
  37. package/dist/sn/amb/ChannelListener.js.map +1 -0
  38. package/dist/sn/amb/ChannelRedirect.d.ts +13 -0
  39. package/dist/sn/amb/ChannelRedirect.js +50 -0
  40. package/dist/sn/amb/ChannelRedirect.js.map +1 -0
  41. package/dist/sn/amb/CrossClientChannel.d.ts +4 -0
  42. package/dist/sn/amb/CrossClientChannel.js +14 -0
  43. package/dist/sn/amb/CrossClientChannel.js.map +1 -0
  44. package/dist/sn/amb/EventManager.d.ts +13 -0
  45. package/dist/sn/amb/EventManager.js +40 -0
  46. package/dist/sn/amb/EventManager.js.map +1 -0
  47. package/dist/sn/amb/FunctionQueue.d.ts +53 -0
  48. package/dist/sn/amb/FunctionQueue.js +95 -0
  49. package/dist/sn/amb/FunctionQueue.js.map +1 -0
  50. package/dist/sn/amb/GraphQLSubscriptionExtension.d.ts +12 -0
  51. package/dist/sn/amb/GraphQLSubscriptionExtension.js +31 -0
  52. package/dist/sn/amb/GraphQLSubscriptionExtension.js.map +1 -0
  53. package/dist/sn/amb/Helper.d.ts +5 -0
  54. package/dist/sn/amb/Helper.js +6 -0
  55. package/dist/sn/amb/Helper.js.map +1 -0
  56. package/dist/sn/amb/MessageClient.d.ts +73 -0
  57. package/dist/sn/amb/MessageClient.js +154 -0
  58. package/dist/sn/amb/MessageClient.js.map +1 -0
  59. package/dist/sn/amb/MessageClientBuilder.d.ts +24 -0
  60. package/dist/sn/amb/MessageClientBuilder.js +95 -0
  61. package/dist/sn/amb/MessageClientBuilder.js.map +1 -0
  62. package/dist/sn/amb/Properties.d.ts +16 -0
  63. package/dist/sn/amb/Properties.js +32 -0
  64. package/dist/sn/amb/Properties.js.map +1 -0
  65. package/dist/sn/amb/ServerConnection.d.ts +132 -0
  66. package/dist/sn/amb/ServerConnection.js +579 -0
  67. package/dist/sn/amb/ServerConnection.js.map +1 -0
  68. package/dist/sn/amb/SessionExtension.d.ts +8 -0
  69. package/dist/sn/amb/SessionExtension.js +20 -0
  70. package/dist/sn/amb/SessionExtension.js.map +1 -0
  71. package/dist/sn/amb/SubscriptionCommandSender.d.ts +60 -0
  72. package/dist/sn/amb/SubscriptionCommandSender.js +222 -0
  73. package/dist/sn/amb/SubscriptionCommandSender.js.map +1 -0
  74. package/dist/sn/amb/TokenManagementExtension.d.ts +20 -0
  75. package/dist/sn/amb/TokenManagementExtension.js +90 -0
  76. package/dist/sn/amb/TokenManagementExtension.js.map +1 -0
  77. package/dist/sn/amb/XMLHttpRequest.d.ts +31 -0
  78. package/dist/sn/amb/XMLHttpRequest.js +287 -0
  79. package/dist/sn/amb/XMLHttpRequest.js.map +1 -0
  80. package/dist/sn/amb/cometd-nodejs-client.d.ts +1 -0
  81. package/dist/sn/amb/cometd-nodejs-client.js +84 -0
  82. package/dist/sn/amb/cometd-nodejs-client.js.map +1 -0
  83. package/dist/sn/amb/index.d.ts +19 -0
  84. package/dist/sn/amb/index.js +20 -0
  85. package/dist/sn/amb/index.js.map +1 -0
  86. package/dist/sn/application/AppRepoApplication.d.ts +166 -0
  87. package/dist/sn/application/AppRepoApplication.js +167 -0
  88. package/dist/sn/application/AppRepoApplication.js.map +1 -0
  89. package/dist/sn/application/ApplicationDetailModel.d.ts +71 -0
  90. package/dist/sn/application/ApplicationDetailModel.js +72 -0
  91. package/dist/sn/application/ApplicationDetailModel.js.map +1 -0
  92. package/dist/sn/application/ApplicationManager.d.ts +117 -0
  93. package/dist/sn/application/ApplicationManager.js +251 -0
  94. package/dist/sn/application/ApplicationManager.js.map +1 -0
  95. package/dist/sn/application/BatchDefinition.d.ts +16 -0
  96. package/dist/sn/application/BatchDefinition.js +60 -0
  97. package/dist/sn/application/BatchDefinition.js.map +1 -0
  98. package/dist/sn/application/BatchInstallation.d.ts +8 -0
  99. package/dist/sn/application/BatchInstallation.js +20 -0
  100. package/dist/sn/application/BatchInstallation.js.map +1 -0
  101. package/dist/sn/application/CompanyApplications.d.ts +234 -0
  102. package/dist/sn/application/CompanyApplications.js +91 -0
  103. package/dist/sn/application/CompanyApplications.js.map +1 -0
  104. package/dist/sn/atf/ATFTest.d.ts +27 -0
  105. package/dist/sn/atf/ATFTest.js +3 -0
  106. package/dist/sn/atf/ATFTest.js.map +1 -0
  107. package/dist/sn/atf/ATFTestExecutor.d.ts +115 -0
  108. package/dist/sn/atf/ATFTestExecutor.js +239 -0
  109. package/dist/sn/atf/ATFTestExecutor.js.map +1 -0
  110. package/dist/sn/atf/ATFTestStep.d.ts +0 -0
  111. package/dist/sn/atf/ATFTestStep.js +1 -0
  112. package/dist/sn/atf/ATFTestStep.js.map +1 -0
  113. package/dist/sn/atf/ATFTestSuite.d.ts +0 -0
  114. package/dist/sn/atf/ATFTestSuite.js +1 -0
  115. package/dist/sn/atf/ATFTestSuite.js.map +1 -0
  116. package/dist/sn/atf/TestFactory.d.ts +2 -0
  117. package/dist/sn/atf/TestFactory.js +3 -0
  118. package/dist/sn/atf/TestFactory.js.map +1 -0
  119. package/dist/sn/atf/TestStepFactory.d.ts +0 -0
  120. package/dist/sn/atf/TestStepFactory.js +1 -0
  121. package/dist/sn/atf/TestStepFactory.js.map +1 -0
  122. package/dist/sn/atf/TestSuiteFactory.d.ts +0 -0
  123. package/dist/sn/atf/TestSuiteFactory.js +1 -0
  124. package/dist/sn/atf/TestSuiteFactory.js.map +1 -0
  125. package/dist/sn/syslog/SyslogReader.d.ts +113 -0
  126. package/dist/sn/syslog/SyslogReader.js +369 -0
  127. package/dist/sn/syslog/SyslogReader.js.map +1 -0
  128. package/dist/sn/syslog/SyslogRecord.d.ts +86 -0
  129. package/dist/sn/syslog/SyslogRecord.js +2 -0
  130. package/dist/sn/syslog/SyslogRecord.js.map +1 -0
  131. package/package.json +8 -9
  132. package/dist/comm/http/CookieStore.d.ts +0 -8
  133. package/dist/comm/http/CookieStore.js +0 -21
  134. package/dist/comm/http/CookieStore.js.map +0 -1
  135. package/dist/comm/http/CookieStoreFactory.d.ts +0 -5
  136. package/dist/comm/http/CookieStoreFactory.js +0 -11
  137. package/dist/comm/http/CookieStoreFactory.js.map +0 -1
@@ -0,0 +1,287 @@
1
+ /* eslint-disable @typescript-eslint/ban-types */
2
+ /*
3
+ * Copyright (c) 2017 the original author or authors.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ var _a;
18
+ import * as httpc from "node:http";
19
+ import * as https from "node:https";
20
+ import * as httpcProxyAgent from "http-proxy-agent";
21
+ import * as httpsProxyAgent from "https-proxy-agent";
22
+ // Bare minimum XMLHttpRequest implementation that works with CometD.
23
+ export class XMLHttpRequest {
24
+ static UNSENT = 0;
25
+ static OPENED = 1;
26
+ static HEADERS_RECEIVED = 2;
27
+ static LOADING = 3;
28
+ static DONE = 4;
29
+ // Fields shared by all XMLHttpRequest instances.
30
+ agentOptions = {
31
+ keepAlive: true
32
+ };
33
+ agentc = new httpc.Agent(this.agentOptions);
34
+ agents = new https.Agent(this.agentOptions);
35
+ #options;
36
+ #localCookies = {};
37
+ #config;
38
+ #request;
39
+ #readyState = _a.UNSENT;
40
+ #responseText = "";
41
+ #status = 0;
42
+ #statusText = "";
43
+ onload = null;
44
+ onerror = null;
45
+ context = null;
46
+ constructor(options) {
47
+ this.#options = options || {};
48
+ }
49
+ get readyState() {
50
+ return this.#readyState;
51
+ }
52
+ get responseText() {
53
+ return this.#responseText;
54
+ }
55
+ get status() {
56
+ return this.#status;
57
+ }
58
+ get statusText() {
59
+ return this.#statusText;
60
+ }
61
+ open(method, uri) {
62
+ this.#config = uri instanceof URL ? uri : new URL(uri);
63
+ this.#config.agent = this.chooseAgent(this.#config);
64
+ this.#config.method = method;
65
+ this.#config.headers = {};
66
+ this.#readyState = _a.OPENED;
67
+ }
68
+ setRequestHeader(name, value) {
69
+ if (/^cookie$/i.test(name)) {
70
+ this.storeCookie(value);
71
+ }
72
+ else {
73
+ this.#config.headers[name] = value;
74
+ }
75
+ }
76
+ send(data) {
77
+ this.retrieveServerCookies(this.context, this.#config, (x, cookies) => {
78
+ const cookies1 = x ? "" : cookies.join("; ");
79
+ const cookies2 = this.retrieveCookies().join("; ");
80
+ const delim = (cookies1 && cookies2) ? "; " : "";
81
+ const allCookies = cookies1 + delim + cookies2;
82
+ if (allCookies) {
83
+ this.#config.headers["Cookie"] = allCookies;
84
+ }
85
+ const http = this.secure(this.#config) ? https : httpc;
86
+ this.#request = http.request(this.#config, response => {
87
+ let success = false;
88
+ this.#status = response.statusCode;
89
+ this.#statusText = response.statusMessage;
90
+ this.#readyState = _a.HEADERS_RECEIVED;
91
+ const setCookies = [];
92
+ const headers = response.headers;
93
+ for (const name in headers) {
94
+ if (headers.hasOwnProperty(name)) {
95
+ if (/^set-cookie$/i.test(name)) {
96
+ const header = headers[name];
97
+ // eslint-disable-next-line prefer-spread
98
+ setCookies.push.apply(setCookies, header);
99
+ }
100
+ }
101
+ }
102
+ this.asyncForEach(setCookies, 0, (element, callback) => {
103
+ this.storeServerCookie(this.#config, element, callback);
104
+ }, () => {
105
+ response.on("data", chunk => {
106
+ this.#readyState = _a.LOADING;
107
+ this.#responseText += chunk;
108
+ });
109
+ response.on("end", () => {
110
+ success = true;
111
+ this.#readyState = _a.DONE;
112
+ if (this.onload) {
113
+ this.onload();
114
+ }
115
+ });
116
+ response.on("close", () => {
117
+ if (!success) {
118
+ this.#readyState = _a.DONE;
119
+ if (this.onerror) {
120
+ this.onerror();
121
+ }
122
+ }
123
+ });
124
+ });
125
+ });
126
+ ["abort", "aborted", "error"].forEach(event => {
127
+ this.#request.on(event, (x) => {
128
+ this.#readyState = _a.DONE;
129
+ if (x) {
130
+ const error = x.message;
131
+ if (error) {
132
+ this.#statusText = error;
133
+ }
134
+ }
135
+ if (this.onerror) {
136
+ this.onerror(x);
137
+ }
138
+ });
139
+ });
140
+ if (data) {
141
+ this.#request.write(data);
142
+ }
143
+ this.#request.end();
144
+ });
145
+ }
146
+ abort() {
147
+ if (this.#request) {
148
+ this.#request.abort();
149
+ }
150
+ }
151
+ storeCookie(value) {
152
+ const host = this.#config.hostname;
153
+ let jar = this.#localCookies[host];
154
+ if (jar === undefined) {
155
+ this.#localCookies[host] = jar = {};
156
+ }
157
+ const cookies = value.split(";");
158
+ for (let i = 0; i < cookies.length; ++i) {
159
+ const cookie = cookies[i].trim();
160
+ const equal = cookie.indexOf("=");
161
+ if (equal > 0) {
162
+ jar[cookie.substring(0, equal)] = cookie;
163
+ }
164
+ }
165
+ }
166
+ retrieveCookies() {
167
+ const cookies = [];
168
+ const jar = this.#localCookies[this.#config.hostname];
169
+ if (jar) {
170
+ for (const name in jar) {
171
+ if (jar.hasOwnProperty(name)) {
172
+ cookies.push(jar[name]);
173
+ }
174
+ }
175
+ }
176
+ return cookies;
177
+ }
178
+ chooseAgent(serverURI) {
179
+ const serverHostPort = serverURI.host;
180
+ const proxy = this.#options && this.#options.httpProxy && this.#options.httpProxy.uri;
181
+ if (proxy) {
182
+ let isIncluded = true;
183
+ const includes = this.#options.httpProxy.includes;
184
+ if (includes && Array.isArray(includes)) {
185
+ isIncluded = false;
186
+ for (let i = 0; i < includes.length; ++i) {
187
+ if (new RegExp(includes[i]).test(serverHostPort)) {
188
+ isIncluded = true;
189
+ break;
190
+ }
191
+ }
192
+ }
193
+ if (isIncluded) {
194
+ const excludes = this.#options.httpProxy.excludes;
195
+ if (excludes && Array.isArray(excludes)) {
196
+ for (let e = 0; e < excludes.length; ++e) {
197
+ if (new RegExp(excludes[e]).test(serverHostPort)) {
198
+ isIncluded = false;
199
+ break;
200
+ }
201
+ }
202
+ }
203
+ }
204
+ if (isIncluded) {
205
+ this.debug("proxying", serverURI.href, "via", proxy);
206
+ const agentOpts = Object.assign({}, this.agentOptions);
207
+ return this.secure(serverURI) ? new httpsProxyAgent.HttpsProxyAgent(proxy, agentOpts) : new httpcProxyAgent.HttpProxyAgent(proxy, agentOpts);
208
+ }
209
+ }
210
+ return this.secure(serverURI) ? this.agents : this.agentc;
211
+ }
212
+ storeServerCookie(uri, header, callback) {
213
+ if (this.#options && this.#options.cookies && this.#options.cookies.storeCookie) {
214
+ this.#options.cookies.storeCookie(uri, header, callback);
215
+ }
216
+ else {
217
+ const host = uri.hostname;
218
+ let jar = this.#options.globalCookies[host];
219
+ if (jar === undefined) {
220
+ this.#options.globalCookies[host] = jar = {};
221
+ }
222
+ const parts = header.split(";");
223
+ // Ignore domain, path, expiration, etc.
224
+ const nameValue = parts[0].trim();
225
+ const equal = nameValue.indexOf("=");
226
+ if (equal > 0) {
227
+ const name = nameValue.substring(0, equal);
228
+ jar[name] = nameValue;
229
+ }
230
+ callback();
231
+ }
232
+ }
233
+ retrieveServerCookies(context, uri, callback) {
234
+ if (this.#options && this.#options.cookies && this.#options.cookies.retrieveCookies) {
235
+ this.#options.cookies.retrieveCookies(context, uri, callback);
236
+ }
237
+ else {
238
+ let globalCookies = context && context.cookieStore;
239
+ if (!globalCookies) {
240
+ globalCookies = this.#options.globalCookies;
241
+ }
242
+ const cookies = [];
243
+ const jar = globalCookies[uri.hostname];
244
+ if (jar) {
245
+ for (const name in jar) {
246
+ if (jar.hasOwnProperty(name)) {
247
+ cookies.push(jar[name]);
248
+ }
249
+ }
250
+ }
251
+ callback(null, cookies);
252
+ }
253
+ }
254
+ asyncForEach(array, index, operation, callback) {
255
+ while (index < array.length) {
256
+ let complete = false;
257
+ let proceed = false;
258
+ operation(array[index], () => {
259
+ complete = true;
260
+ if (proceed) {
261
+ ++index;
262
+ this.asyncForEach(array, index, operation, callback);
263
+ }
264
+ });
265
+ if (complete) {
266
+ ++index;
267
+ }
268
+ else {
269
+ proceed = true;
270
+ break;
271
+ }
272
+ }
273
+ if (index === array.length) {
274
+ callback();
275
+ }
276
+ }
277
+ secure(uri) {
278
+ return /^https/i.test(uri.protocol);
279
+ }
280
+ debug(...args) {
281
+ if (this.#options.logLevel === "debug") {
282
+ console.log.apply(this, Array.from(args));
283
+ }
284
+ }
285
+ }
286
+ _a = XMLHttpRequest;
287
+ //# sourceMappingURL=XMLHttpRequest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"XMLHttpRequest.js","sourceRoot":"","sources":["../../../src/sn/amb/XMLHttpRequest.ts"],"names":[],"mappings":"AAAA,iDAAiD;AACjD;;;;;;;;;;;;;;GAcG;;AAEH,OAAO,KAAK,KAAK,MAAM,WAAW,CAAC;AACnC,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,eAAe,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,eAAe,MAAM,mBAAmB,CAAC;AAErD,qEAAqE;AACrE,MAAM,OAAO,cAAc;IACvB,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;IAClB,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;IAClB,MAAM,CAAC,gBAAgB,GAAG,CAAC,CAAC;IAC5B,MAAM,CAAC,OAAO,GAAG,CAAC,CAAC;IACnB,MAAM,CAAC,IAAI,GAAG,CAAC,CAAC;IAEhB,iDAAiD;IACzC,YAAY,GAAO;QACvB,SAAS,EAAE,IAAI;KAClB,CAAC;IACM,MAAM,GAAO,IAAI,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAChD,MAAM,GAAO,IAAI,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAExD,QAAQ,CAAK;IACb,aAAa,GAAO,EAAE,CAAC;IACvB,OAAO,CAAK;IACZ,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ACV,EAAE,KAAK,CAAC;oBACR,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;gBACzD,CAAC;YACL,CAAC,CAAC,CAAC;YACH,IAAI,QAAQ,EAAE,CAAC;gBACX,EAAE,KAAK,CAAC;YACZ,CAAC;iBAAM,CAAC;gBACJ,OAAO,GAAG,IAAI,CAAC;gBACf,MAAM;YACV,CAAC;QACL,CAAC;QACD,IAAI,KAAK,KAAK,KAAK,CAAC,MAAM,EAAE,CAAC;YACzB,QAAQ,EAAE,CAAC;QACf,CAAC;IACL,CAAC;IAEO,MAAM,CAAC,GAAO;QAClB,OAAO,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACxC,CAAC;IAEO,KAAK,CAAC,GAAG,IAAU;QACvB,IAAI,IAAI,CAAC,QAAQ,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC;YACrC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QAC9C,CAAC;IACL,CAAC"}
@@ -0,0 +1 @@
1
+ export declare function adapt(options?: any): any;
@@ -0,0 +1,84 @@
1
+ /* eslint-disable @typescript-eslint/ban-types */
2
+ /*
3
+ * Copyright (c) 2017 the original author or authors.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { XMLHttpRequest } from "./XMLHttpRequest.js";
18
+ import * as ws from "ws";
19
+ import { Logger } from "../../util/Logger.js";
20
+ export function adapt(options) {
21
+ const logger = new Logger("cometd");
22
+ const p = global;
23
+ let window = p["window"];
24
+ if (!window) {
25
+ window = {
26
+ location: {
27
+ pathname: "",
28
+ protocol: "",
29
+ host: ""
30
+ },
31
+ self: window
32
+ };
33
+ }
34
+ window.cometdLogger = logger;
35
+ //window.self = {};
36
+ window.addEventListener = function (name, callback) {
37
+ window.cometdLogger.info("Event Fired: " + name, { name: name, callback: callback });
38
+ };
39
+ window.setTimeout = setTimeout;
40
+ window.clearTimeout = clearTimeout;
41
+ window.console = {};
42
+ window.console.warn = function (...args) {
43
+ window.cometdLogger.addWarnMessage("COMETD", args);
44
+ };
45
+ window.console.debug = function (...args) {
46
+ window.cometdLogger.debug("COMETD", args);
47
+ };
48
+ window.console.info = function (...args) {
49
+ window.cometdLogger.addErrorMessage("COMETD", args);
50
+ };
51
+ window.console.error = function (...args) {
52
+ window.cometdLogger.addInfoMessage("COMETD", args);
53
+ };
54
+ options = options || {};
55
+ options.globalCookies = {};
56
+ window.XMLHttpRequest = class extends XMLHttpRequest {
57
+ constructor() {
58
+ super(options);
59
+ }
60
+ };
61
+ // Create a WebSocket class that supports cookies
62
+ // Store cookies globally so WebSocket constructor can access them
63
+ window._wsOptions = options;
64
+ window.WebSocket = class extends ws.WebSocket {
65
+ constructor(url, protocols) {
66
+ const wsOptions = {};
67
+ // Get cookies from window options if available
68
+ if (window._wsOptions && window._wsOptions.cookies) {
69
+ wsOptions.headers = {
70
+ 'Cookie': window._wsOptions.cookies,
71
+ 'Origin': url.replace(/^wss?:\/\//, 'https://').replace(/\/amb.*$/, '')
72
+ };
73
+ window.cometdLogger.debug("WebSocket connecting with cookies", {
74
+ url,
75
+ cookieLength: window._wsOptions.cookies.length
76
+ });
77
+ }
78
+ super(url, protocols, wsOptions);
79
+ }
80
+ };
81
+ p["window"] = window;
82
+ return window;
83
+ }
84
+ //# sourceMappingURL=cometd-nodejs-client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cometd-nod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OAAO,CAAC,MAAM;iBACjD,CAAC,CAAC;YACP,CAAC;YAED,KAAK,CAAC,GAAG,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;QACrC,CAAC;KACJ,CAAC;IAEF,CAAC,CAAC,QAAQ,CAAC,GAAG,MAAM,CAAC;IAErB,OAAO,MAAM,CAAC;AAClB,CAAC"}
@@ -0,0 +1,19 @@
1
+ export * from './AMBClient.js';
2
+ export * from './AMBConstants.js';
3
+ export * from './Channel.js';
4
+ export * from './ChannelListener.js';
5
+ export * from './ChannelRedirect.js';
6
+ export * from './cometd-nodejs-client.js';
7
+ export * from './CrossClientChannel.js';
8
+ export * from './EventManager.js';
9
+ export * from './FunctionQueue.js';
10
+ export * from './GraphQLSubscriptionExtension.js';
11
+ export * from './Helper.js';
12
+ export * from './MessageClient.js';
13
+ export * from './MessageClientBuilder.js';
14
+ export * from './Properties.js';
15
+ export * from './ServerConnection.js';
16
+ export * from './SessionExtension.js';
17
+ export * from './SubscriptionCommandSender.js';
18
+ export * from './TokenManagementExtension.js';
19
+ export * from './XMLHttpRequest.js';
@@ -0,0 +1,20 @@
1
+ export * from './AMBClient.js';
2
+ export * from './AMBConstants.js';
3
+ export * from './Channel.js';
4
+ export * from './ChannelListener.js';
5
+ export * from './ChannelRedirect.js';
6
+ export * from './cometd-nodejs-client.js';
7
+ export * from './CrossClientChannel.js';
8
+ export * from './EventManager.js';
9
+ export * from './FunctionQueue.js';
10
+ export * from './GraphQLSubscriptionExtension.js';
11
+ export * from './Helper.js';
12
+ export * from './MessageClient.js';
13
+ export * from './MessageClientBuilder.js';
14
+ export * from './Properties.js';
15
+ export * from './ServerConnection.js';
16
+ export * from './SessionExtension.js';
17
+ export * from './SubscriptionCommandSender.js';
18
+ export * from './TokenManagementExtension.js';
19
+ export * from './XMLHttpRequest.js';
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/sn/amb/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,kBAAkB,CAAC"}
@@ -0,0 +1,166 @@
1
+ import { ServiceNowInstance } from "../ServiceNowInstance.js";
2
+ import { ProgressResult } from "../ProgressWorker.js";
3
+ /**
4
+ * AppRepoApplication class for managing application repository operations
5
+ * Provides methods to install applications from and publish applications to
6
+ * a company's ServiceNow application repository using the CI/CD API
7
+ */
8
+ export declare class AppRepoApplication {
9
+ private readonly APP_REPO_INSTALL_API_URL;
10
+ private readonly APP_REPO_PUBLISH_API_URL;
11
+ private readonly PROGRESS_API_URL;
12
+ private readonly DEFAULT_TIMEOUT;
13
+ private readonly DEFAULT_POLL_INTERVAL;
14
+ private _logger;
15
+ private _req;
16
+ private _instance;
17
+ constructor(instance: ServiceNowInstance);
18
+ /**
19
+ * Installs an application from the application repository
20
+ * @param request AppRepoInstallRequest containing installation parameters
21
+ * @returns Promise<AppRepoInstallResponse> Installation response with progress information
22
+ */
23
+ installFromAppRepo(request: AppRepoInstallRequest): Promise<AppRepoInstallResponse>;
24
+ /**
25
+ * Installs an application from the app repository and waits for completion
26
+ * @param request AppRepoInstallRequest containing installation parameters
27
+ * @param pollIntervalMs Polling interval in milliseconds (default: 5000)
28
+ * @param timeoutMs Timeout in milliseconds (default: 30 minutes)
29
+ * @returns Promise<AppRepoOperationResult> Final operation result
30
+ */
31
+ installFromAppRepoAndWait(request: AppRepoInstallRequest, pollIntervalMs?: number, timeoutMs?: number): Promise<AppRepoOperationResult>;
32
+ /**
33
+ * Publishes an application to the application repository
34
+ * @param request AppRepoPublishRequest containing publish parameters
35
+ * @returns Promise<AppRepoPublishResponse> Publish response with progress information
36
+ */
37
+ publishToAppRepo(request: AppRepoPublishRequest): Promise<AppRepoPublishResponse>;
38
+ /**
39
+ * Publishes an application to the app repository and waits for completion
40
+ * @param request AppRepoPublishRequest containing publish parameters
41
+ * @param pollIntervalMs Polling interval in milliseconds (default: 5000)
42
+ * @param timeoutMs Timeout in milliseconds (default: 30 minutes)
43
+ * @returns Promise<AppRepoOperationResult> Final operation result
44
+ */
45
+ publishToAppRepoAndWait(request: AppRepoPublishRequest, pollIntervalMs?: number, timeoutMs?: number): Promise<AppRepoOperationResult>;
46
+ /**
47
+ * Gets the current progress of an app repo operation
48
+ * @param progressId Progress ID from the operation response
49
+ * @returns Promise<ProgressResult> Current progress information
50
+ */
51
+ getProgress(progressId: string): Promise<ProgressResult>;
52
+ /**
53
+ * Waits for an app repo operation to complete
54
+ * @param progressId Progress ID to monitor
55
+ * @param pollIntervalMs Polling interval in milliseconds
56
+ * @param timeoutMs Timeout in milliseconds
57
+ * @returns Promise<AppRepoOperationResult> Final operation result
58
+ */
59
+ private waitForCompletion;
60
+ }
61
+ /**
62
+ * Request parameters for installing an application from the app repository
63
+ */
64
+ export interface AppRepoInstallRequest {
65
+ /** Required: Scope name of the application to install */
66
+ scope: string;
67
+ /** Required: Sys ID of the application in the repository */
68
+ sys_id: string;
69
+ /** Optional: Version of the application to install */
70
+ version?: string;
71
+ /** Optional: Whether to automatically upgrade the base application if required (default: false) */
72
+ auto_upgrade_base_app?: boolean;
73
+ /** Optional: Version of the base application to upgrade to */
74
+ base_app_version?: string;
75
+ }
76
+ /**
77
+ * Request parameters for publishing an application to the app repository
78
+ */
79
+ export interface AppRepoPublishRequest {
80
+ /** Required: Scope name of the application to publish */
81
+ scope: string;
82
+ /** Required: Sys ID of the application to publish */
83
+ sys_id: string;
84
+ /** Optional: Version number for the published application */
85
+ version?: string;
86
+ /** Optional: Developer notes for this version */
87
+ dev_notes?: string;
88
+ }
89
+ /**
90
+ * Response from app repo install operation
91
+ */
92
+ export interface AppRepoInstallResponse {
93
+ /** Links to related resources */
94
+ links: {
95
+ progress: {
96
+ id: string;
97
+ url: string;
98
+ };
99
+ };
100
+ /** Status code of the operation */
101
+ status: string;
102
+ /** Human-readable status label */
103
+ status_label: string;
104
+ /** Additional status message */
105
+ status_message: string;
106
+ /** Detailed status information */
107
+ status_detail: string;
108
+ /** Error message if operation failed */
109
+ error: string;
110
+ /** Percentage of completion (0-100) */
111
+ percent_complete: number;
112
+ }
113
+ /**
114
+ * Response from app repo publish operation
115
+ */
116
+ export interface AppRepoPublishResponse {
117
+ /** Links to related resources */
118
+ links: {
119
+ progress: {
120
+ id: string;
121
+ url: string;
122
+ };
123
+ };
124
+ /** Status code of the operation */
125
+ status: string;
126
+ /** Human-readable status label */
127
+ status_label: string;
128
+ /** Additional status message */
129
+ status_message: string;
130
+ /** Detailed status information */
131
+ status_detail: string;
132
+ /** Error message if operation failed */
133
+ error: string;
134
+ /** Percentage of completion (0-100) */
135
+ percent_complete: number;
136
+ }
137
+ /**
138
+ * Final result of an app repo operation after completion
139
+ */
140
+ export interface AppRepoOperationResult {
141
+ /** Whether the operation completed successfully */
142
+ success: boolean;
143
+ /** Status code */
144
+ status: string;
145
+ /** Status label */
146
+ status_label: string;
147
+ /** Status message */
148
+ status_message: string;
149
+ /** Detailed status */
150
+ status_detail: string;
151
+ /** Error message if any */
152
+ error: string;
153
+ /** Final completion percentage */
154
+ percent_complete: number;
155
+ /** Links to related resources */
156
+ links: {
157
+ progress: {
158
+ id: string;
159
+ url: string;
160
+ };
161
+ results?: {
162
+ id: string;
163
+ url: string;
164
+ };
165
+ };
166
+ }