@sonisoft/now-sdk-ext-core 6.1.0 → 6.3.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/README.md +48 -0
- package/dist/comm/http/HTTPRequest.d.ts +2 -0
- package/dist/comm/http/RequestHandler.js +11 -5
- package/dist/comm/http/RequestHandler.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/sn/flow/FlowManager.d.ts +127 -5
- package/dist/sn/flow/FlowManager.js +421 -4
- package/dist/sn/flow/FlowManager.js.map +1 -1
- package/dist/sn/flow/FlowModels.d.ts +178 -0
- package/dist/sn/transaction/ClusterTransactionManager.d.ts +24 -0
- package/dist/sn/transaction/ClusterTransactionManager.js +264 -0
- package/dist/sn/transaction/ClusterTransactionManager.js.map +1 -0
- package/dist/sn/transaction/ClusterTransactionModels.d.ts +35 -0
- package/dist/sn/transaction/ClusterTransactionModels.js +2 -0
- package/dist/sn/transaction/ClusterTransactionModels.js.map +1 -0
- package/package.json +1 -1
|
@@ -260,6 +260,184 @@ export interface ProcessFlowTestPayload {
|
|
|
260
260
|
outputMap: Record<string, string>;
|
|
261
261
|
runOnThread: boolean;
|
|
262
262
|
}
|
|
263
|
+
/**
|
|
264
|
+
* Artifact types whose design-time definition can be retrieved.
|
|
265
|
+
*
|
|
266
|
+
* Flows and subflows are served by the same endpoint and are distinguished by
|
|
267
|
+
* the `type` field ServiceNow reports in the payload; actions are served by the
|
|
268
|
+
* action-type endpoints.
|
|
269
|
+
*/
|
|
270
|
+
export type FlowDesignArtifactType = 'flow' | 'subflow';
|
|
271
|
+
/**
|
|
272
|
+
* Stable, machine-readable reason for a definition retrieval failure.
|
|
273
|
+
*
|
|
274
|
+
* The ProcessFlow design-time routes are observed Workflow Studio APIs rather
|
|
275
|
+
* than a documented public REST contract, so callers should branch on this
|
|
276
|
+
* rather than on message text.
|
|
277
|
+
*/
|
|
278
|
+
export type FlowDefinitionFailureReason =
|
|
279
|
+
/** The supplied identifier was blank or was not a 32-character hex sys_id. */
|
|
280
|
+
'invalid_identifier'
|
|
281
|
+
/** The artifact exists but is not the type the called operation retrieves. */
|
|
282
|
+
| 'type_mismatch'
|
|
283
|
+
/** ServiceNow reported no such artifact (or returned an empty payload for it). */
|
|
284
|
+
| 'not_found'
|
|
285
|
+
/** The session is not permitted to read the artifact. */
|
|
286
|
+
| 'permission_denied'
|
|
287
|
+
/** ServiceNow answered, but its response carried an error code/message. */
|
|
288
|
+
| 'api_error'
|
|
289
|
+
/** ServiceNow answered with a body that did not match the expected wrapper. */
|
|
290
|
+
| 'malformed_response'
|
|
291
|
+
/** The request itself failed (transport error, or an unclassified HTTP status). */
|
|
292
|
+
| 'request_failed';
|
|
293
|
+
/** Options common to every design-time definition retrieval. */
|
|
294
|
+
export interface FlowDefinitionOptions {
|
|
295
|
+
/**
|
|
296
|
+
* Scope sys_id or scope name sent as `sysparm_transaction_scope`.
|
|
297
|
+
* Optional; ServiceNow resolves the artifact's own scope when omitted.
|
|
298
|
+
*/
|
|
299
|
+
scope?: string;
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* Light, stable projection of a flow/subflow definition.
|
|
303
|
+
*
|
|
304
|
+
* Deliberately small: the full payload stays available and untouched on
|
|
305
|
+
* `definition`, because ServiceNow evolves that schema between families and
|
|
306
|
+
* normalising it here would make family upgrades breaking.
|
|
307
|
+
*/
|
|
308
|
+
export interface FlowArtifactSummary {
|
|
309
|
+
/** sys_id of the flow or subflow */
|
|
310
|
+
sysId: string;
|
|
311
|
+
/** Display name */
|
|
312
|
+
name: string;
|
|
313
|
+
/** Internal (scriptable) name */
|
|
314
|
+
internalName: string;
|
|
315
|
+
/** Description text, empty string when unset */
|
|
316
|
+
description: string;
|
|
317
|
+
/** Scope sys_id */
|
|
318
|
+
scope: string;
|
|
319
|
+
/** Scope name, e.g. "global" */
|
|
320
|
+
scopeName: string;
|
|
321
|
+
/** Publication status, e.g. "published", "draft" */
|
|
322
|
+
status: string;
|
|
323
|
+
/** Whether the artifact is active */
|
|
324
|
+
active: boolean;
|
|
325
|
+
/** Number of trigger instances (always 0 for a subflow) */
|
|
326
|
+
triggerCount: number;
|
|
327
|
+
/** Number of action instances */
|
|
328
|
+
actionCount: number;
|
|
329
|
+
/** Number of nested subflow instances */
|
|
330
|
+
subflowCount: number;
|
|
331
|
+
/** Number of flow logic instances (if/else, for-each, etc.) */
|
|
332
|
+
flowLogicCount: number;
|
|
333
|
+
/** Number of declared inputs */
|
|
334
|
+
inputCount: number;
|
|
335
|
+
/** Number of declared outputs */
|
|
336
|
+
outputCount: number;
|
|
337
|
+
}
|
|
338
|
+
/** Result of retrieving a flow or subflow design-time definition. */
|
|
339
|
+
export interface FlowArtifactDefinitionResult {
|
|
340
|
+
/** Whether the definition was retrieved */
|
|
341
|
+
success: boolean;
|
|
342
|
+
/** The sys_id that was requested (trimmed) */
|
|
343
|
+
sysId: string;
|
|
344
|
+
/**
|
|
345
|
+
* Artifact type as reported by ServiceNow, when it is one this library
|
|
346
|
+
* recognises. Never inferred from the operation that was called.
|
|
347
|
+
*/
|
|
348
|
+
artifactType?: FlowDesignArtifactType;
|
|
349
|
+
/**
|
|
350
|
+
* Raw `type` value ServiceNow reported. Populated whenever the response
|
|
351
|
+
* carried one, including values this library does not recognise.
|
|
352
|
+
*/
|
|
353
|
+
reportedType?: string;
|
|
354
|
+
/**
|
|
355
|
+
* The complete, JSON-serializable definition payload exactly as ServiceNow
|
|
356
|
+
* returned it. Pass straight to `JSON.stringify`.
|
|
357
|
+
*/
|
|
358
|
+
definition?: Record<string, unknown>;
|
|
359
|
+
/** Convenience projection of the most commonly used definition fields */
|
|
360
|
+
summary?: FlowArtifactSummary;
|
|
361
|
+
/** Actionable failure description; never contains a response body */
|
|
362
|
+
errorMessage?: string;
|
|
363
|
+
/** Machine-readable failure classification */
|
|
364
|
+
failureReason?: FlowDefinitionFailureReason;
|
|
365
|
+
/** Numeric error code reported by the processflow API, when present */
|
|
366
|
+
errorCode?: number;
|
|
367
|
+
}
|
|
368
|
+
/** Light projection of one step instance within an action definition. */
|
|
369
|
+
export interface ActionStepSummary {
|
|
370
|
+
/** sys_id of the step instance */
|
|
371
|
+
stepId: string;
|
|
372
|
+
/** Execution order as reported by ServiceNow */
|
|
373
|
+
order: number;
|
|
374
|
+
/** Step label, e.g. "Script step" */
|
|
375
|
+
label: string;
|
|
376
|
+
/** Step type name, e.g. "Script" */
|
|
377
|
+
stepTypeName: string;
|
|
378
|
+
/** sys_id of the step type */
|
|
379
|
+
stepTypeId: string;
|
|
380
|
+
}
|
|
381
|
+
/** Light, stable projection of an action definition. */
|
|
382
|
+
export interface ActionDefinitionSummary {
|
|
383
|
+
/** sys_id of the action type */
|
|
384
|
+
sysId: string;
|
|
385
|
+
/** Display name */
|
|
386
|
+
name: string;
|
|
387
|
+
/** Internal (scriptable) name */
|
|
388
|
+
internalName: string;
|
|
389
|
+
/** Description text, empty string when unset */
|
|
390
|
+
description: string;
|
|
391
|
+
/** Scope sys_id */
|
|
392
|
+
scope: string;
|
|
393
|
+
/** Scope name, e.g. "global" */
|
|
394
|
+
scopeName: string;
|
|
395
|
+
/** Publication state, e.g. "published", "draft" */
|
|
396
|
+
state: string;
|
|
397
|
+
/** Whether the action is active */
|
|
398
|
+
active: boolean;
|
|
399
|
+
/** Number of declared inputs */
|
|
400
|
+
inputCount: number;
|
|
401
|
+
/** Number of declared outputs */
|
|
402
|
+
outputCount: number;
|
|
403
|
+
/** Number of step instances */
|
|
404
|
+
stepCount: number;
|
|
405
|
+
/** Ordered step projections, ascending by `order` */
|
|
406
|
+
steps: ActionStepSummary[];
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
* Result of retrieving a complete action design-time definition.
|
|
410
|
+
*
|
|
411
|
+
* A complete action needs two reads — metadata and step instances — so both are
|
|
412
|
+
* returned through this one contract. `success` is true only when both parts
|
|
413
|
+
* were retrieved.
|
|
414
|
+
*/
|
|
415
|
+
export interface ActionDefinitionResult {
|
|
416
|
+
/** Whether the complete definition was retrieved */
|
|
417
|
+
success: boolean;
|
|
418
|
+
/** The sys_id that was requested (trimmed) */
|
|
419
|
+
sysId: string;
|
|
420
|
+
/** Always 'action' on success; absent on failure */
|
|
421
|
+
artifactType?: 'action';
|
|
422
|
+
/**
|
|
423
|
+
* Raw action-type metadata exactly as ServiceNow returned it
|
|
424
|
+
* (`GET /api/now/processflow/action/action_types/{id}`).
|
|
425
|
+
*/
|
|
426
|
+
metadata?: Record<string, unknown>;
|
|
427
|
+
/**
|
|
428
|
+
* Raw step instances exactly as ServiceNow returned them
|
|
429
|
+
* (`GET .../step_instances`), sorted ascending by `order`.
|
|
430
|
+
*/
|
|
431
|
+
steps?: Array<Record<string, unknown>>;
|
|
432
|
+
/** Convenience projection of metadata plus ordered steps */
|
|
433
|
+
summary?: ActionDefinitionSummary;
|
|
434
|
+
/** Actionable failure description; never contains a response body */
|
|
435
|
+
errorMessage?: string;
|
|
436
|
+
/** Machine-readable failure classification */
|
|
437
|
+
failureReason?: FlowDefinitionFailureReason;
|
|
438
|
+
/** Numeric error code reported by the processflow API, when present */
|
|
439
|
+
errorCode?: number;
|
|
440
|
+
}
|
|
263
441
|
/**
|
|
264
442
|
* Options for copying a flow into a target scoped application via the ProcessFlow REST API.
|
|
265
443
|
*/
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ServiceNowInstance } from "../ServiceNowInstance.js";
|
|
2
|
+
import { ClusterTransaction, GetTransactionsOptions, KillTransactionOptions, KillTransactionResult } from "./ClusterTransactionModels.js";
|
|
3
|
+
export declare class ClusterTransactionManager {
|
|
4
|
+
private _req;
|
|
5
|
+
private _killActionSysId?;
|
|
6
|
+
private _xmlParser;
|
|
7
|
+
constructor(instance: ServiceNowInstance);
|
|
8
|
+
getTransactions(options?: GetTransactionsOptions): Promise<ClusterTransaction[]>;
|
|
9
|
+
killTransaction(sysId: string, options?: KillTransactionOptions): Promise<KillTransactionResult>;
|
|
10
|
+
private waitForCollection;
|
|
11
|
+
private parseProgress;
|
|
12
|
+
private readTransactionList;
|
|
13
|
+
private parseTransactionList;
|
|
14
|
+
private resolveKillActionSysId;
|
|
15
|
+
private canExecuteAction;
|
|
16
|
+
private validateActionSysId;
|
|
17
|
+
private responseText;
|
|
18
|
+
private requireNonNegativeNumber;
|
|
19
|
+
private requirePositiveInteger;
|
|
20
|
+
private delay;
|
|
21
|
+
private throwIfAborted;
|
|
22
|
+
private sanitizeError;
|
|
23
|
+
private cellText;
|
|
24
|
+
}
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
|
2
|
+
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
3
|
+
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
|
4
|
+
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
|
5
|
+
import { XMLParser } from "fast-xml-parser";
|
|
6
|
+
import { DOMParser } from "@xmldom/xmldom";
|
|
7
|
+
import { ServiceNowRequest } from "../../comm/http/ServiceNowRequest.js";
|
|
8
|
+
import { InvalidParameterException } from "../../exception/InvalidParameterException.js";
|
|
9
|
+
import { READ_ONLY } from "../../policy/PolicyTypes.js";
|
|
10
|
+
import { redactMessage, stripSecretsFromError } from "../../util/redact.js";
|
|
11
|
+
const SYS_ID = /^[0-9a-f]{32}$/i;
|
|
12
|
+
const TRANSACTION_FIELDS = [
|
|
13
|
+
"node_id", "user", "age", "url", "type", "foreground", "thread", "state",
|
|
14
|
+
"query_count", "acl_time", "br_count", "br_time", "business_rule", "db_time", "event_count",
|
|
15
|
+
];
|
|
16
|
+
export class ClusterTransactionManager {
|
|
17
|
+
_req;
|
|
18
|
+
_killActionSysId;
|
|
19
|
+
_xmlParser = new XMLParser({ ignoreAttributes: false, attributeNamePrefix: "" });
|
|
20
|
+
constructor(instance) {
|
|
21
|
+
this._req = new ServiceNowRequest(instance);
|
|
22
|
+
}
|
|
23
|
+
async getTransactions(options = {}) {
|
|
24
|
+
const pollIntervalMs = this.requireNonNegativeNumber(options.pollIntervalMs, 1000, "pollIntervalMs");
|
|
25
|
+
const timeoutMs = this.requireNonNegativeNumber(options.timeoutMs, 60000, "timeoutMs");
|
|
26
|
+
const limit = this.requirePositiveInteger(options.limit, 1000, "limit");
|
|
27
|
+
try {
|
|
28
|
+
this.throwIfAborted(options.signal);
|
|
29
|
+
const initialize = await this._req.get({
|
|
30
|
+
method: "GET", path: "/loading_transactions.do", headers: null,
|
|
31
|
+
query: null, body: null, requires: READ_ONLY, responseFormat: "text",
|
|
32
|
+
});
|
|
33
|
+
const page = this.responseText(initialize.data);
|
|
34
|
+
const executionMatch = /\bvar\s+executionID\s*=\s*(['"])(.*?)\1\s*;/.exec(page);
|
|
35
|
+
if (!executionMatch) {
|
|
36
|
+
throw new Error("Could not parse the collection execution id from /loading_transactions.do");
|
|
37
|
+
}
|
|
38
|
+
const executionId = executionMatch[2];
|
|
39
|
+
if (executionId && executionId !== "null") {
|
|
40
|
+
if (!SYS_ID.test(executionId)) {
|
|
41
|
+
throw new Error("The collection execution id from /loading_transactions.do was invalid");
|
|
42
|
+
}
|
|
43
|
+
await this.waitForCollection(executionId, pollIntervalMs, timeoutMs, options.signal);
|
|
44
|
+
}
|
|
45
|
+
return await this.readTransactionList(options.query, limit);
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
throw this.sanitizeError(error);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
async killTransaction(sysId, options = {}) {
|
|
52
|
+
if (typeof sysId !== "string" || !SYS_ID.test(sysId.trim())) {
|
|
53
|
+
throw new InvalidParameterException("A transaction sysId must be a 32-character hexadecimal value");
|
|
54
|
+
}
|
|
55
|
+
const transactionSysId = sysId.trim();
|
|
56
|
+
try {
|
|
57
|
+
const actionSysId = options.killActionSysId
|
|
58
|
+
? this.validateActionSysId(options.killActionSysId)
|
|
59
|
+
: await this.resolveKillActionSysId();
|
|
60
|
+
const security = await this._req.post({
|
|
61
|
+
method: "POST", path: "/xmlhttp.do", headers: null, query: null, body: null,
|
|
62
|
+
requires: READ_ONLY, responseFormat: "text",
|
|
63
|
+
fields: {
|
|
64
|
+
sysparm_processor: "AJAXActionSecurity", sysparm_scope: "global",
|
|
65
|
+
sys_target: "v_cluster_transaction", sys_action: actionSysId,
|
|
66
|
+
sysparm_checked_items: transactionSysId, sysparm_target: "v_cluster_transaction",
|
|
67
|
+
sysparm_synch: "true",
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
if (!this.canExecuteAction(this.responseText(security.data), actionSysId, transactionSysId)) {
|
|
71
|
+
throw new Error("The Kill action is unavailable or was not authorized for the selected transaction");
|
|
72
|
+
}
|
|
73
|
+
const session = await this._req.getUserSession();
|
|
74
|
+
if (!session?.userToken) {
|
|
75
|
+
throw new Error("An authenticated ServiceNow session token is required to kill a transaction");
|
|
76
|
+
}
|
|
77
|
+
const result = await this._req.post({
|
|
78
|
+
method: "POST", path: "/v_cluster_transaction_list.do", headers: null,
|
|
79
|
+
query: null, body: null,
|
|
80
|
+
fields: {
|
|
81
|
+
sys_target: "v_cluster_transaction", sys_action: actionSysId,
|
|
82
|
+
sys_is_list: "true", sysparm_checked_items: transactionSysId,
|
|
83
|
+
sysparm_ck: session.userToken, sysparm_query: "",
|
|
84
|
+
sysparm_referring_url: "v_cluster_transaction_list.do",
|
|
85
|
+
},
|
|
86
|
+
});
|
|
87
|
+
const body = this.responseText(result.data);
|
|
88
|
+
if (/login\.do|Security constraints prevent access/i.test(body)) {
|
|
89
|
+
throw new Error("ServiceNow did not accept the transaction kill request");
|
|
90
|
+
}
|
|
91
|
+
return { accepted: true, sysId: transactionSysId };
|
|
92
|
+
}
|
|
93
|
+
catch (error) {
|
|
94
|
+
throw this.sanitizeError(error);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
async waitForCollection(executionId, pollIntervalMs, timeoutMs, signal) {
|
|
98
|
+
const startedAt = Date.now();
|
|
99
|
+
let last = {};
|
|
100
|
+
while (true) {
|
|
101
|
+
this.throwIfAborted(signal);
|
|
102
|
+
if (Date.now() - startedAt >= timeoutMs) {
|
|
103
|
+
throw new Error(`Transaction collection timed out after ${timeoutMs} ms (last state ${last.state ?? "unknown"}, ${last.percent_complete ?? "unknown"}%)`);
|
|
104
|
+
}
|
|
105
|
+
const response = await this._req.post({
|
|
106
|
+
method: "POST", path: "/xmlhttp.do", headers: null, query: null, body: null,
|
|
107
|
+
requires: READ_ONLY,
|
|
108
|
+
fields: {
|
|
109
|
+
sysparm_processor: "AJAXProgressStatusChecker", sysparm_name: "getStatus",
|
|
110
|
+
sysparm_scope: "global", sysparm_execution_id: executionId,
|
|
111
|
+
},
|
|
112
|
+
});
|
|
113
|
+
last = this.parseProgress(this.responseText(response.data));
|
|
114
|
+
if (last.state === "2")
|
|
115
|
+
return;
|
|
116
|
+
if (last.state !== "0" && last.state !== "1") {
|
|
117
|
+
const detail = last.detail_message || last.message || "no platform detail was provided";
|
|
118
|
+
throw new Error(`Transaction collection failed: ${detail}`);
|
|
119
|
+
}
|
|
120
|
+
await this.delay(pollIntervalMs, signal);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
parseProgress(xml) {
|
|
124
|
+
try {
|
|
125
|
+
const parsed = this._xmlParser.parse(xml);
|
|
126
|
+
const answer = parsed?.xml?.answer;
|
|
127
|
+
if (typeof answer !== "string")
|
|
128
|
+
throw new Error();
|
|
129
|
+
const status = JSON.parse(answer);
|
|
130
|
+
if (!status || typeof status !== "object" || typeof status.state !== "string")
|
|
131
|
+
throw new Error();
|
|
132
|
+
return status;
|
|
133
|
+
}
|
|
134
|
+
catch {
|
|
135
|
+
throw new Error("Could not parse the AJAXProgressStatusChecker response");
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
async readTransactionList(query, limit) {
|
|
139
|
+
// A live Table API probe was unavailable during implementation, so use the captured,
|
|
140
|
+
// stable list-2 structure. Keeping this behind one method preserves the planned seam.
|
|
141
|
+
const response = await this._req.get({
|
|
142
|
+
method: "GET", path: "/v_cluster_transaction_list.do", headers: null, body: null,
|
|
143
|
+
requires: READ_ONLY, responseFormat: "text",
|
|
144
|
+
query: { sysparm_query: query ?? "", sysparm_limit: limit },
|
|
145
|
+
});
|
|
146
|
+
return this.parseTransactionList(this.responseText(response.data), limit);
|
|
147
|
+
}
|
|
148
|
+
parseTransactionList(html, limit) {
|
|
149
|
+
try {
|
|
150
|
+
const columns = [...html.matchAll(/<th\b[^>]*\bname=["']([^"']+)["'][^>]*\bglide_type=["'][^"']*["'][^>]*>/gi)]
|
|
151
|
+
.map((match) => match[1])
|
|
152
|
+
.filter((name) => TRANSACTION_FIELDS.includes(name));
|
|
153
|
+
if (columns.length !== TRANSACTION_FIELDS.length || !TRANSACTION_FIELDS.every((field) => columns.includes(field))) {
|
|
154
|
+
throw new Error();
|
|
155
|
+
}
|
|
156
|
+
const records = [];
|
|
157
|
+
const rows = html.matchAll(/<tr\b[^>]*\bsys_id=["']([0-9a-f]{32})["'][^>]*>([\s\S]*?)<\/tr>/gi);
|
|
158
|
+
for (const row of rows) {
|
|
159
|
+
const cells = [...row[2].matchAll(/<td\b[^>]*>([\s\S]*?)<\/td>/gi)]
|
|
160
|
+
.map((cell) => this.cellText(cell[1]));
|
|
161
|
+
// List-2 rows surround the data with selection/icon and trailing spacer cells.
|
|
162
|
+
const dataCells = cells.length === columns.length ? cells : cells.slice(2, 2 + columns.length);
|
|
163
|
+
if (dataCells.length !== columns.length)
|
|
164
|
+
throw new Error();
|
|
165
|
+
const record = { sys_id: row[1] };
|
|
166
|
+
columns.forEach((column, index) => { record[column] = dataCells[index] ?? ""; });
|
|
167
|
+
records.push(record);
|
|
168
|
+
if (records.length >= limit)
|
|
169
|
+
break;
|
|
170
|
+
}
|
|
171
|
+
return records;
|
|
172
|
+
}
|
|
173
|
+
catch {
|
|
174
|
+
throw new Error("Could not parse /v_cluster_transaction_list.do transaction rows");
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
async resolveKillActionSysId() {
|
|
178
|
+
if (this._killActionSysId)
|
|
179
|
+
return this._killActionSysId;
|
|
180
|
+
const response = await this._req.get({
|
|
181
|
+
method: "GET", path: "/api/now/table/sys_ui_action", headers: { Accept: "application/json" },
|
|
182
|
+
body: null,
|
|
183
|
+
query: {
|
|
184
|
+
sysparm_query: "table=v_cluster_transaction^active=true^name=Kill",
|
|
185
|
+
sysparm_fields: "sys_id,name", sysparm_limit: 2, sysparm_display_value: "false",
|
|
186
|
+
},
|
|
187
|
+
});
|
|
188
|
+
const candidates = (response.bodyObject ?? response.data)?.result;
|
|
189
|
+
if (!Array.isArray(candidates) || candidates.length !== 1 || !SYS_ID.test(candidates[0].sys_id)) {
|
|
190
|
+
const names = Array.isArray(candidates) ? candidates.map((candidate) => candidate.name).filter(Boolean) : [];
|
|
191
|
+
const detail = names.length ? ` Candidates: ${names.join(", ")}.` : "";
|
|
192
|
+
throw new Error(`Could not uniquely resolve the Kill UI action.${detail} Supply killActionSysId to override it.`);
|
|
193
|
+
}
|
|
194
|
+
this._killActionSysId = candidates[0].sys_id;
|
|
195
|
+
return this._killActionSysId;
|
|
196
|
+
}
|
|
197
|
+
canExecuteAction(xml, actionSysId, transactionSysId) {
|
|
198
|
+
try {
|
|
199
|
+
const parsed = this._xmlParser.parse(xml);
|
|
200
|
+
const action = parsed?.xml?.[`action_${actionSysId}`];
|
|
201
|
+
const keys = Array.isArray(action?.key) ? action.key : action?.key ? [action.key] : [];
|
|
202
|
+
return keys.some((key) => String(key.can_execute) === "true" && key.sys_id === transactionSysId);
|
|
203
|
+
}
|
|
204
|
+
catch {
|
|
205
|
+
return false;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
validateActionSysId(value) {
|
|
209
|
+
const actionSysId = typeof value === "string" ? value.trim() : "";
|
|
210
|
+
if (!SYS_ID.test(actionSysId)) {
|
|
211
|
+
throw new InvalidParameterException("killActionSysId must be a 32-character hexadecimal value");
|
|
212
|
+
}
|
|
213
|
+
return actionSysId;
|
|
214
|
+
}
|
|
215
|
+
responseText(data) {
|
|
216
|
+
if (typeof data === "string")
|
|
217
|
+
return data;
|
|
218
|
+
if (data instanceof String)
|
|
219
|
+
return data.toString();
|
|
220
|
+
throw new Error("ServiceNow returned an unexpected response type");
|
|
221
|
+
}
|
|
222
|
+
requireNonNegativeNumber(value, fallback, name) {
|
|
223
|
+
const result = value ?? fallback;
|
|
224
|
+
if (!Number.isFinite(result) || result < 0)
|
|
225
|
+
throw new InvalidParameterException(`${name} must be a non-negative number`);
|
|
226
|
+
return result;
|
|
227
|
+
}
|
|
228
|
+
requirePositiveInteger(value, fallback, name) {
|
|
229
|
+
const result = value ?? fallback;
|
|
230
|
+
if (!Number.isInteger(result) || result <= 0)
|
|
231
|
+
throw new InvalidParameterException(`${name} must be a positive integer`);
|
|
232
|
+
return result;
|
|
233
|
+
}
|
|
234
|
+
delay(ms, signal) {
|
|
235
|
+
return new Promise((resolve, reject) => {
|
|
236
|
+
const onAbort = () => {
|
|
237
|
+
clearTimeout(timer);
|
|
238
|
+
reject(new Error("Transaction collection was aborted"));
|
|
239
|
+
};
|
|
240
|
+
const timer = setTimeout(() => {
|
|
241
|
+
signal?.removeEventListener("abort", onAbort);
|
|
242
|
+
resolve();
|
|
243
|
+
}, ms);
|
|
244
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
throwIfAborted(signal) {
|
|
248
|
+
if (signal?.aborted)
|
|
249
|
+
throw new Error("Transaction collection was aborted");
|
|
250
|
+
}
|
|
251
|
+
sanitizeError(error) {
|
|
252
|
+
if (error instanceof Error)
|
|
253
|
+
error.message = redactMessage(error.message);
|
|
254
|
+
return stripSecretsFromError(error);
|
|
255
|
+
}
|
|
256
|
+
cellText(value) {
|
|
257
|
+
const document = new DOMParser().parseFromString(`<root>${value.replace(/ /gi, " ")}</root>`, "application/xml");
|
|
258
|
+
if (document.getElementsByTagName("parsererror").length > 0) {
|
|
259
|
+
throw new Error("Could not parse a transaction list cell");
|
|
260
|
+
}
|
|
261
|
+
return document.documentElement.textContent?.trim() ?? "";
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
//# sourceMappingURL=ClusterTransactionManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ClusterTransactionManager.js","sourceRoot":"","sources":["../../../src/sn/transaction/ClusterTransactionManager.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,+DAA+D;AAC/D,wDAAwD;AACxD,sDAAsD;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,yBAAyB,EAAE,MAAM,2CAA2C,CAAC;AAEtF,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAqBzE,MAAM,MAAM,GAAG,iBAAiB,CAAC;AACjC,MAAM,kBAAkB,GAAG;IACvB,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAE,OAAO;IACxE,aAAa,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,eAAe,EAAE,SAAS,EAAE,aAAa;CACrF,CAAC;AAEX,MAAM,OAAO,yBAAyB;IAC1B,IAAI,CAAoB;IACxB,gBAAgB,CAAU;IAC1B,UAAU,GAAG,IAAI,SAAS,CAAC,EAAE,gBAAgB,EAAE,KAAK,EAAE,mBAAmB,EAAE,EAAE,EAAE,CAAC,CAAC;IAEzF,YAAmB,QAA4B;QAC3C,IAAI,CAAC,IAAI,GAAG,IAAI,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IAChD,CAAC;IAEM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usterTransaction {
|
|
3
|
+
sys_id: string;
|
|
4
|
+
node_id: string;
|
|
5
|
+
user: string;
|
|
6
|
+
age: string;
|
|
7
|
+
url: string;
|
|
8
|
+
type: string;
|
|
9
|
+
foreground: string;
|
|
10
|
+
thread: string;
|
|
11
|
+
/** The transaction state, unrelated to the collection progress state. */
|
|
12
|
+
state: string;
|
|
13
|
+
query_count: string;
|
|
14
|
+
acl_time: string;
|
|
15
|
+
br_count: string;
|
|
16
|
+
br_time: string;
|
|
17
|
+
business_rule: string;
|
|
18
|
+
db_time: string;
|
|
19
|
+
event_count: string;
|
|
20
|
+
}
|
|
21
|
+
export interface GetTransactionsOptions {
|
|
22
|
+
pollIntervalMs?: number;
|
|
23
|
+
timeoutMs?: number;
|
|
24
|
+
query?: string;
|
|
25
|
+
limit?: number;
|
|
26
|
+
signal?: AbortSignal;
|
|
27
|
+
}
|
|
28
|
+
export interface KillTransactionOptions {
|
|
29
|
+
/** Override for instances whose Kill UI action cannot be resolved automatically. */
|
|
30
|
+
killActionSysId?: string;
|
|
31
|
+
}
|
|
32
|
+
export interface KillTransactionResult {
|
|
33
|
+
accepted: boolean;
|
|
34
|
+
sysId: string;
|
|
35
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ClusterTransactionModels.js","sourceRoot":"","sources":["../../../src/sn/transaction/ClusterTransactionModels.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sonisoft/now-sdk-ext-core",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.3.0",
|
|
4
4
|
"description": "Comprehensive TypeScript library extending ServiceNow SDK with application management, ATF testing, real-time log monitoring, AMB event subscriptions, and automation tools",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"servicenow",
|