@miragon/pulse-engine-core 0.0.0-bootstrap.0 → 0.25.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/LICENSE +21 -0
- package/dist/activities.d.ts +31 -0
- package/dist/activities.d.ts.map +1 -0
- package/dist/activities.js +62 -0
- package/dist/activities.js.map +1 -0
- package/dist/advance-plan.d.ts +21 -0
- package/dist/advance-plan.d.ts.map +1 -0
- package/dist/advance-plan.js +192 -0
- package/dist/advance-plan.js.map +1 -0
- package/dist/conditions.d.ts +66 -0
- package/dist/conditions.d.ts.map +1 -0
- package/dist/conditions.js +119 -0
- package/dist/conditions.js.map +1 -0
- package/dist/dates.d.ts +59 -0
- package/dist/dates.d.ts.map +1 -0
- package/dist/dates.js +189 -0
- package/dist/dates.js.map +1 -0
- package/dist/durations.d.ts +4 -0
- package/dist/durations.d.ts.map +1 -0
- package/dist/durations.js +10 -0
- package/dist/durations.js.map +1 -0
- package/dist/engine-status.d.ts +57 -0
- package/dist/engine-status.d.ts.map +1 -0
- package/dist/engine-status.js +193 -0
- package/dist/engine-status.js.map +1 -0
- package/dist/errors.d.ts +101 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +18 -0
- package/dist/errors.js.map +1 -0
- package/dist/filters.d.ts +53 -0
- package/dist/filters.d.ts.map +1 -0
- package/dist/filters.js +74 -0
- package/dist/filters.js.map +1 -0
- package/dist/findings.d.ts +46 -0
- package/dist/findings.d.ts.map +1 -0
- package/dist/findings.js +105 -0
- package/dist/findings.js.map +1 -0
- package/dist/incident-recovery.d.ts +35 -0
- package/dist/incident-recovery.d.ts.map +1 -0
- package/dist/incident-recovery.js +24 -0
- package/dist/incident-recovery.js.map +1 -0
- package/dist/index.d.ts +36 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +33 -0
- package/dist/index.js.map +1 -0
- package/dist/inspect.d.ts +34 -0
- package/dist/inspect.d.ts.map +1 -0
- package/dist/inspect.js +247 -0
- package/dist/inspect.js.map +1 -0
- package/dist/next.d.ts +26 -0
- package/dist/next.d.ts.map +1 -0
- package/dist/next.js +83 -0
- package/dist/next.js.map +1 -0
- package/dist/operations.d.ts +9 -0
- package/dist/operations.d.ts.map +1 -0
- package/dist/operations.js +41 -0
- package/dist/operations.js.map +1 -0
- package/dist/poll.d.ts +24 -0
- package/dist/poll.d.ts.map +1 -0
- package/dist/poll.js +29 -0
- package/dist/poll.js.map +1 -0
- package/dist/port.d.ts +95 -0
- package/dist/port.d.ts.map +1 -0
- package/dist/port.js +113 -0
- package/dist/port.js.map +1 -0
- package/dist/records.d.ts +27 -0
- package/dist/records.d.ts.map +1 -0
- package/dist/records.js +58 -0
- package/dist/records.js.map +1 -0
- package/dist/requests.d.ts +24 -0
- package/dist/requests.d.ts.map +1 -0
- package/dist/requests.js +35 -0
- package/dist/requests.js.map +1 -0
- package/dist/retry-plan.d.ts +62 -0
- package/dist/retry-plan.d.ts.map +1 -0
- package/dist/retry-plan.js +140 -0
- package/dist/retry-plan.js.map +1 -0
- package/dist/root-cause.d.ts +17 -0
- package/dist/root-cause.d.ts.map +1 -0
- package/dist/root-cause.js +35 -0
- package/dist/root-cause.js.map +1 -0
- package/dist/select.d.ts +16 -0
- package/dist/select.d.ts.map +1 -0
- package/dist/select.js +133 -0
- package/dist/select.js.map +1 -0
- package/dist/snapshot.d.ts +12 -0
- package/dist/snapshot.d.ts.map +1 -0
- package/dist/snapshot.js +134 -0
- package/dist/snapshot.js.map +1 -0
- package/dist/sorting.d.ts +20 -0
- package/dist/sorting.d.ts.map +1 -0
- package/dist/sorting.js +17 -0
- package/dist/sorting.js.map +1 -0
- package/dist/status.d.ts +91 -0
- package/dist/status.d.ts.map +1 -0
- package/dist/status.js +222 -0
- package/dist/status.js.map +1 -0
- package/dist/testing/fake-port.d.ts +31 -0
- package/dist/testing/fake-port.d.ts.map +1 -0
- package/dist/testing/fake-port.js +50 -0
- package/dist/testing/fake-port.js.map +1 -0
- package/dist/testing/fixture.d.ts +39 -0
- package/dist/testing/fixture.d.ts.map +1 -0
- package/dist/testing/fixture.js +288 -0
- package/dist/testing/fixture.js.map +1 -0
- package/dist/testing/index.d.ts +23 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +23 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/testing/inspect-routes.d.ts +12 -0
- package/dist/testing/inspect-routes.d.ts.map +1 -0
- package/dist/testing/inspect-routes.js +63 -0
- package/dist/testing/inspect-routes.js.map +1 -0
- package/dist/testing/status.d.ts +18 -0
- package/dist/testing/status.d.ts.map +1 -0
- package/dist/testing/status.js +12 -0
- package/dist/testing/status.js.map +1 -0
- package/dist/testing/waits.d.ts +60 -0
- package/dist/testing/waits.d.ts.map +1 -0
- package/dist/testing/waits.js +53 -0
- package/dist/testing/waits.js.map +1 -0
- package/dist/timeline.d.ts +9 -0
- package/dist/timeline.d.ts.map +1 -0
- package/dist/timeline.js +63 -0
- package/dist/timeline.js.map +1 -0
- package/dist/tree.d.ts +19 -0
- package/dist/tree.d.ts.map +1 -0
- package/dist/tree.js +61 -0
- package/dist/tree.js.map +1 -0
- package/dist/types.d.ts +254 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +6 -0
- package/dist/types.js.map +1 -0
- package/dist/util.d.ts +26 -0
- package/dist/util.d.ts.map +1 -0
- package/dist/util.js +44 -0
- package/dist/util.js.map +1 -0
- package/dist/variable-writes.d.ts +32 -0
- package/dist/variable-writes.d.ts.map +1 -0
- package/dist/variable-writes.js +113 -0
- package/dist/variable-writes.js.map +1 -0
- package/dist/variables.d.ts +28 -0
- package/dist/variables.d.ts.map +1 -0
- package/dist/variables.js +64 -0
- package/dist/variables.js.map +1 -0
- package/dist/waits.d.ts +11 -0
- package/dist/waits.d.ts.map +1 -0
- package/dist/waits.js +253 -0
- package/dist/waits.js.map +1 -0
- package/package.json +47 -5
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Query filters. Two engine behaviours turn a plausible filter into a silent
|
|
3
|
+
* no-op, so the tools never forward a filter value as given:
|
|
4
|
+
*
|
|
5
|
+
* - Boolean filters are TRUE-ONLY: `true` narrows the result, `false` is
|
|
6
|
+
* IGNORED (HTTP 200, no filter): neither a negation nor a 400. A forwarded
|
|
7
|
+
* `suspended=false` would return the suspended instances to a caller who
|
|
8
|
+
* asked for the opposite. Flags go out only when `true`; where the engine
|
|
9
|
+
* has the complementary flag (active/suspended, finished/unfinished, …), a
|
|
10
|
+
* `false` is sent as `true` on the other side instead.
|
|
11
|
+
* - `…Like` filters are SQL LIKE patterns: without a `%` they match the whole
|
|
12
|
+
* value exactly, so "substring" search silently became an exact match.
|
|
13
|
+
*/
|
|
14
|
+
/** A true-only engine flag: `true` stays, `false`/absent is not sent at all. */
|
|
15
|
+
export declare function trueOnly(flag: boolean | undefined): true | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Two complementary true-only flags, e.g. `active`/`suspended`: each is sent
|
|
18
|
+
* when it is `true` OR its complement is `false`.
|
|
19
|
+
*
|
|
20
|
+
* A pair that asks for both states or neither (`true`/`true`,
|
|
21
|
+
* `false`/`false`) throws a RangeError (a tool error). The engine has no
|
|
22
|
+
* honest answer to it: active/suspended (process instances, jobs) and
|
|
23
|
+
* withRetriesLeft/noRetriesLeft (external tasks) set ONE query field, so the
|
|
24
|
+
* engine keeps the flag it applies last and returns one state as if it were
|
|
25
|
+
* the filtered result; the separate-field pairs return nothing.
|
|
26
|
+
*/
|
|
27
|
+
export declare function complementaryFlags<A extends string, B extends string>(flags: Partial<Record<A | B, boolean>>, first: A, second: B): Partial<Record<A | B, true>>;
|
|
28
|
+
/**
|
|
29
|
+
* A `…Like` filter value: wrapped in `%` (a substring match) unless the
|
|
30
|
+
* caller already placed a wildcard; empty/absent sends nothing.
|
|
31
|
+
*/
|
|
32
|
+
export declare function engineLike(value: string | undefined): string | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* A comma-list `…In` filter from single and list inputs (`processDefinitionKey`
|
|
35
|
+
* + `processDefinitionKeyIn`), de-duplicated; nothing sent when both are empty.
|
|
36
|
+
*/
|
|
37
|
+
export declare function engineKeyList(...parts: (string | readonly string[] | undefined)[]): string | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* A search box over process instances, matching what a list names an instance
|
|
40
|
+
* by: its business key as a substring OR its whole id. The engine has no LIKE
|
|
41
|
+
* on ids (`processInstanceIds` matches whole ids only), so a pasted id is
|
|
42
|
+
* found and a fragment of one is not. Sent as ONE nested OR query of the POST
|
|
43
|
+
* `/process-instance` (and `/count`) body, which the engine ANDs with the
|
|
44
|
+
* other filters; a blank term sends nothing. The term is trimmed: a pasted
|
|
45
|
+
* id with a trailing space would match nothing.
|
|
46
|
+
*/
|
|
47
|
+
export declare function engineInstanceSearch(term: string | undefined): {
|
|
48
|
+
orQueries?: {
|
|
49
|
+
businessKeyLike: string;
|
|
50
|
+
processInstanceIds: string[];
|
|
51
|
+
}[];
|
|
52
|
+
};
|
|
53
|
+
//# sourceMappingURL=filters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filters.d.ts","sourceRoot":"","sources":["../src/filters.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,gFAAgF;AAChF,wBAAgB,QAAQ,CAAC,IAAI,EAAE,OAAO,GAAG,SAAS,GAAG,IAAI,GAAG,SAAS,CAEpE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,EACnE,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC,EACtC,KAAK,EAAE,CAAC,EACR,MAAM,EAAE,CAAC,GACR,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,CAAC,CAU9B;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAGxE;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,GAAG,KAAK,EAAE,CAAC,MAAM,GAAG,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC,EAAE,sBAGjF;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG;IAC9D,SAAS,CAAC,EAAE;QAAE,eAAe,EAAE,MAAM,CAAC;QAAC,kBAAkB,EAAE,MAAM,EAAE,CAAA;KAAE,EAAE,CAAA;CACxE,CAMA"}
|
package/dist/filters.js
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Query filters. Two engine behaviours turn a plausible filter into a silent
|
|
3
|
+
* no-op, so the tools never forward a filter value as given:
|
|
4
|
+
*
|
|
5
|
+
* - Boolean filters are TRUE-ONLY: `true` narrows the result, `false` is
|
|
6
|
+
* IGNORED (HTTP 200, no filter): neither a negation nor a 400. A forwarded
|
|
7
|
+
* `suspended=false` would return the suspended instances to a caller who
|
|
8
|
+
* asked for the opposite. Flags go out only when `true`; where the engine
|
|
9
|
+
* has the complementary flag (active/suspended, finished/unfinished, …), a
|
|
10
|
+
* `false` is sent as `true` on the other side instead.
|
|
11
|
+
* - `…Like` filters are SQL LIKE patterns: without a `%` they match the whole
|
|
12
|
+
* value exactly, so "substring" search silently became an exact match.
|
|
13
|
+
*/
|
|
14
|
+
/** A true-only engine flag: `true` stays, `false`/absent is not sent at all. */
|
|
15
|
+
export function trueOnly(flag) {
|
|
16
|
+
return flag === true ? true : undefined;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Two complementary true-only flags, e.g. `active`/`suspended`: each is sent
|
|
20
|
+
* when it is `true` OR its complement is `false`.
|
|
21
|
+
*
|
|
22
|
+
* A pair that asks for both states or neither (`true`/`true`,
|
|
23
|
+
* `false`/`false`) throws a RangeError (a tool error). The engine has no
|
|
24
|
+
* honest answer to it: active/suspended (process instances, jobs) and
|
|
25
|
+
* withRetriesLeft/noRetriesLeft (external tasks) set ONE query field, so the
|
|
26
|
+
* engine keeps the flag it applies last and returns one state as if it were
|
|
27
|
+
* the filtered result; the separate-field pairs return nothing.
|
|
28
|
+
*/
|
|
29
|
+
export function complementaryFlags(flags, first, second) {
|
|
30
|
+
const wanted = {};
|
|
31
|
+
if (flags[first] === true || flags[second] === false)
|
|
32
|
+
wanted[first] = true;
|
|
33
|
+
if (flags[second] === true || flags[first] === false)
|
|
34
|
+
wanted[second] = true;
|
|
35
|
+
if (wanted[first] && wanted[second]) {
|
|
36
|
+
throw new RangeError(`${first}: ${flags[first]} and ${second}: ${flags[second]} contradict each other — pass one of them (false selects the other state), or neither for both states.`);
|
|
37
|
+
}
|
|
38
|
+
return wanted;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* A `…Like` filter value: wrapped in `%` (a substring match) unless the
|
|
42
|
+
* caller already placed a wildcard; empty/absent sends nothing.
|
|
43
|
+
*/
|
|
44
|
+
export function engineLike(value) {
|
|
45
|
+
if (!value)
|
|
46
|
+
return undefined;
|
|
47
|
+
return value.includes("%") ? value : `%${value}%`;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* A comma-list `…In` filter from single and list inputs (`processDefinitionKey`
|
|
51
|
+
* + `processDefinitionKeyIn`), de-duplicated; nothing sent when both are empty.
|
|
52
|
+
*/
|
|
53
|
+
export function engineKeyList(...parts) {
|
|
54
|
+
const values = [...new Set(parts.flat().filter((value) => !!value))];
|
|
55
|
+
return values.length > 0 ? values.join(",") : undefined;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* A search box over process instances, matching what a list names an instance
|
|
59
|
+
* by: its business key as a substring OR its whole id. The engine has no LIKE
|
|
60
|
+
* on ids (`processInstanceIds` matches whole ids only), so a pasted id is
|
|
61
|
+
* found and a fragment of one is not. Sent as ONE nested OR query of the POST
|
|
62
|
+
* `/process-instance` (and `/count`) body, which the engine ANDs with the
|
|
63
|
+
* other filters; a blank term sends nothing. The term is trimmed: a pasted
|
|
64
|
+
* id with a trailing space would match nothing.
|
|
65
|
+
*/
|
|
66
|
+
export function engineInstanceSearch(term) {
|
|
67
|
+
const value = term?.trim();
|
|
68
|
+
if (!value)
|
|
69
|
+
return {};
|
|
70
|
+
return {
|
|
71
|
+
orQueries: [{ businessKeyLike: engineLike(value) ?? value, processInstanceIds: [value] }],
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=filters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filters.js","sourceRoot":"","sources":["../src/filters.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,gFAAgF;AAChF,MAAM,UAAU,QAAQ,CAAC,IAAyB;IAChD,OAAO,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAA;AACzC,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,kBAAkB,CAChC,KAAsC,EACtC,KAAQ,EACR,MAAS;IAET,MAAM,MAAM,GAAiC,EAAE,CAAA;IAC/C,IAAI,KAAK,CAAC,KAAK,CAAC,KAAK,IAAI,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,KAAK;QAAE,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,CAAA;IAC1E,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,IAAI,IAAI,KAAK,CAAC,KAAK,CAAC,KAAK,KAAK;QAAE,MAAM,CAAC,MAAM,CAAC,GAAG,IAAI,CAAA;IAC3E,IAAI,MAAM,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;QACpC,MAAM,IAAI,UAAU,CAClB,GAAG,KAAK,KAAK,KAAK,CAAC,KAAK,CAAC,QAAQ,MAAM,KAAK,KAAK,CAAC,MAAM,CAAC,wGAAwG,CAClK,CAAA;IACH,CAAC;IACD,OAAO,MAAM,CAAA;AACf,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,KAAyB;IAClD,IAAI,CAAC,KAAK;QAAE,OAAO,SAAS,CAAA;IAC5B,OAAO,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,GAAG,CAAA;AACnD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,GAAG,KAAiD;IAChF,MAAM,MAAM,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC,CAAC,KAAK,EAAmB,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;IACrF,OAAO,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;AACzD,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,oBAAoB,CAAC,IAAwB;IAG3D,MAAM,KAAK,GAAG,IAAI,EAAE,IAAI,EAAE,CAAA;IAC1B,IAAI,CAAC,KAAK;QAAE,OAAO,EAAE,CAAA;IACrB,OAAO;QACL,SAAS,EAAE,CAAC,EAAE,eAAe,EAAE,UAAU,CAAC,KAAK,CAAC,IAAI,KAAK,EAAE,kBAAkB,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC;KAC1F,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The findings of the status triage: pure rules over the aggregated status, each naming its next
|
|
3
|
+
* step, and the overall status (the highest severity, else `ok`).
|
|
4
|
+
*/
|
|
5
|
+
import { type Rec } from "./records.js";
|
|
6
|
+
import type { GroupStep, IncidentGroup, JobStatus, TopicStatus } from "./status.js";
|
|
7
|
+
export type Severity = "warning" | "critical";
|
|
8
|
+
export type EngineStatus = "ok" | Severity;
|
|
9
|
+
/**
|
|
10
|
+
* What to look at for a finding: the step of its incident group, the overdue jobs, the unlocked
|
|
11
|
+
* tasks or the expired locks of a topic, the deployed definitions.
|
|
12
|
+
*/
|
|
13
|
+
export type FindingStep = GroupStep | {
|
|
14
|
+
readonly action: "listOverdueJobs";
|
|
15
|
+
} | {
|
|
16
|
+
readonly action: "listUnlockedTasks";
|
|
17
|
+
readonly topic: string;
|
|
18
|
+
} | {
|
|
19
|
+
readonly action: "listExpiredLocks";
|
|
20
|
+
readonly topic: string;
|
|
21
|
+
} | {
|
|
22
|
+
readonly action: "listDefinitions";
|
|
23
|
+
};
|
|
24
|
+
/** `N`: the next step, structured (`FindingStep`) or the text a caller renders from it. */
|
|
25
|
+
export interface Finding<N = FindingStep> {
|
|
26
|
+
readonly severity: Severity;
|
|
27
|
+
readonly code: string;
|
|
28
|
+
readonly message: string;
|
|
29
|
+
readonly next: N;
|
|
30
|
+
}
|
|
31
|
+
export interface FindingInput {
|
|
32
|
+
readonly jobs: JobStatus;
|
|
33
|
+
/** The incident groups shown; their findings carry the group's next step on. */
|
|
34
|
+
readonly incidents: readonly IncidentGroup[];
|
|
35
|
+
readonly externalTasks: readonly TopicStatus[];
|
|
36
|
+
readonly batches: readonly Rec[];
|
|
37
|
+
/** Named process definition keys without a deployed definition. */
|
|
38
|
+
readonly unknownKeys?: readonly string[];
|
|
39
|
+
readonly staleAfterMs: number;
|
|
40
|
+
readonly now: number;
|
|
41
|
+
}
|
|
42
|
+
/** Every finding, critical first, then by code and message; incident findings carry their group's step. */
|
|
43
|
+
export declare function findings(input: FindingInput): Finding[];
|
|
44
|
+
/** The highest severity of the findings, else `ok`. */
|
|
45
|
+
export declare function engineStatus(list: readonly Pick<Finding<unknown>, "severity">[]): EngineStatus;
|
|
46
|
+
//# sourceMappingURL=findings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"findings.d.ts","sourceRoot":"","sources":["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M,EAAE,CAAA;IACxC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;IAC7B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CACrB;AAwFD,2GAA2G;AAC3G,wBAAgB,QAAQ,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,EAAE,CAavD;AAED,uDAAuD;AACvD,wBAAgB,YAAY,CAAC,IAAI,EAAE,SAAS,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,UAAU,CAAC,EAAE,GAAG,YAAY,CAE9F"}
|
package/dist/findings.js
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The findings of the status triage: pure rules over the aggregated status, each naming its next
|
|
3
|
+
* step, and the overall status (the highest severity, else `ok`).
|
|
4
|
+
*/
|
|
5
|
+
import { formatDuration } from "./durations.js";
|
|
6
|
+
import { engineTime } from "./dates.js";
|
|
7
|
+
import { amount, compareText, field, str } from "./records.js";
|
|
8
|
+
import { compact } from "./util.js";
|
|
9
|
+
function plural(count, word) {
|
|
10
|
+
return `${count} ${word}${count === 1 ? "" : "s"}`;
|
|
11
|
+
}
|
|
12
|
+
function overdueJobs(input) {
|
|
13
|
+
const { overdue, oldestReadySince } = input.jobs;
|
|
14
|
+
if (overdue === 0)
|
|
15
|
+
return [];
|
|
16
|
+
const since = oldestReadySince === undefined ? "" : ` (oldest since ${oldestReadySince})`;
|
|
17
|
+
return [
|
|
18
|
+
{
|
|
19
|
+
severity: "critical",
|
|
20
|
+
code: "JOBS_OVERDUE",
|
|
21
|
+
message: `${plural(overdue, "executable job")} ${overdue === 1 ? "has" : "have"} waited longer than ${formatDuration(input.staleAfterMs)}${since}: is the job executor running?`,
|
|
22
|
+
next: { action: "listOverdueJobs" },
|
|
23
|
+
},
|
|
24
|
+
];
|
|
25
|
+
}
|
|
26
|
+
function where(group) {
|
|
27
|
+
return group.processDefinitionKey === ""
|
|
28
|
+
? `job definition ${group.jobDefinitionId ?? "(unknown)"}`
|
|
29
|
+
: `${group.processDefinitionKey}/${group.activityId}`;
|
|
30
|
+
}
|
|
31
|
+
function incidentFindings(input) {
|
|
32
|
+
return input.incidents.map((group) => ({
|
|
33
|
+
severity: "warning",
|
|
34
|
+
code: "INCIDENTS",
|
|
35
|
+
message: `${plural(group.count, `${group.type} incident`)} at ${where(group)}: ${group.rootCause ?? group.message}`,
|
|
36
|
+
next: group.next,
|
|
37
|
+
}));
|
|
38
|
+
}
|
|
39
|
+
function workerFindings(input) {
|
|
40
|
+
const threshold = input.now - input.staleAfterMs;
|
|
41
|
+
return input.externalTasks.flatMap((topic) => {
|
|
42
|
+
const findings = [];
|
|
43
|
+
const oldest = engineTime(topic.oldestWaitingSince);
|
|
44
|
+
if (topic.waiting > 0 && topic.locked === 0 && oldest !== undefined && oldest < threshold) {
|
|
45
|
+
findings.push({
|
|
46
|
+
severity: "warning",
|
|
47
|
+
code: "NO_WORKER",
|
|
48
|
+
message: `topic ${topic.topic}: ${plural(topic.waiting, "task")} wait since ${topic.oldestWaitingSince ?? ""}, none is locked: is a worker subscribed?`,
|
|
49
|
+
next: { action: "listUnlockedTasks", topic: topic.topic },
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
const expired = engineTime(topic.oldestLockExpiredAt);
|
|
53
|
+
if (topic.lockExpired > 0 && expired !== undefined && expired < threshold) {
|
|
54
|
+
findings.push({
|
|
55
|
+
severity: "warning",
|
|
56
|
+
code: "LOCK_EXPIRED",
|
|
57
|
+
message: `topic ${topic.topic}: ${plural(topic.lockExpired, "task")} with an expired lock (the oldest since ${topic.oldestLockExpiredAt ?? ""}): a worker crashed or exceeded its lock`,
|
|
58
|
+
next: { action: "listExpiredLocks", topic: topic.topic },
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
return findings;
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
function batchFindings(input) {
|
|
65
|
+
return input.batches.flatMap((batch) => {
|
|
66
|
+
const failed = amount(batch, "failedJobs");
|
|
67
|
+
if (failed === 0)
|
|
68
|
+
return [];
|
|
69
|
+
const jobDefinitionId = str(batch, "batchJobDefinitionId");
|
|
70
|
+
return [
|
|
71
|
+
{
|
|
72
|
+
severity: "warning",
|
|
73
|
+
code: "BATCH_FAILURES",
|
|
74
|
+
message: `batch ${field(batch, "id")} (${field(batch, "type")}): ${plural(failed, "failed job")}`,
|
|
75
|
+
next: { action: "listFailedJobs", ...compact({ jobDefinitionId }) },
|
|
76
|
+
},
|
|
77
|
+
];
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
function keyFindings(input) {
|
|
81
|
+
return (input.unknownKeys ?? []).map((key) => ({
|
|
82
|
+
severity: "warning",
|
|
83
|
+
code: "UNKNOWN_KEY",
|
|
84
|
+
message: `process definition key ${key} is not deployed`,
|
|
85
|
+
next: { action: "listDefinitions" },
|
|
86
|
+
}));
|
|
87
|
+
}
|
|
88
|
+
const SEVERITY_ORDER = ["critical", "warning"];
|
|
89
|
+
/** Every finding, critical first, then by code and message; incident findings carry their group's step. */
|
|
90
|
+
export function findings(input) {
|
|
91
|
+
return [
|
|
92
|
+
...overdueJobs(input),
|
|
93
|
+
...incidentFindings(input),
|
|
94
|
+
...workerFindings(input),
|
|
95
|
+
...batchFindings(input),
|
|
96
|
+
...keyFindings(input),
|
|
97
|
+
].toSorted((left, right) => SEVERITY_ORDER.indexOf(left.severity) - SEVERITY_ORDER.indexOf(right.severity) ||
|
|
98
|
+
compareText(left.code, right.code) ||
|
|
99
|
+
compareText(left.message, right.message));
|
|
100
|
+
}
|
|
101
|
+
/** The highest severity of the findings, else `ok`. */
|
|
102
|
+
export function engineStatus(list) {
|
|
103
|
+
return list[0]?.severity ?? "ok";
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=findings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"findings.js","sourceRoot":"","sources":["../src/findings.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,cAAc,E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B;IACtC,OAAO,CAAC,KAAK,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAW,EAAE,CAAC,CAAC;QACtD,QAAQ,EAAE,SAAS;QACnB,IAAI,EAAE,aAAa;QACnB,OAAO,EAAE,0BAA0B,GAAG,kBAAkB;QACxD,IAAI,EAAE,EAAE,MAAM,EAAE,iBAAiB,EAAE;KACpC,CAAC,CAAC,CAAA;AACL,CAAC;AAED,MAAM,cAAc,GAAwB,CAAC,UAAU,EAAE,SAAS,CAAC,CAAA;AAEnE,2GAA2G;AAC3G,MAAM,UAAU,QAAQ,CAAC,KAAmB;IAC1C,OAAO;QACL,GAAG,WAAW,CAAC,KAAK,CAAC;QACrB,GAAG,gBAAgB,CAAC,KAAK,CAAC;QAC1B,GAAG,cAAc,CAAC,KAAK,CAAC;QACxB,GAAG,aAAa,CAAC,KAAK,CAAC;QACvB,GAAG,WAAW,CAAC,KAAK,CAAC;KACtB,CAAC,QAAQ,CACR,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CACd,cAAc,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,cAAc,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC;QAC9E,WAAW,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC;QAClC,WAAW,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,CAC3C,CAAA;AACH,CAAC;AAED,uDAAuD;AACvD,MAAM,UAAU,YAAY,CAAC,IAAmD;IAC9E,OAAO,IAAI,CAAC,CAAC,CAAC,EAAE,QAAQ,IAAI,IAAI,CAAA;AAClC,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Incident recovery. `DELETE /incident/{id}` (resolve) refuses the two
|
|
3
|
+
* BUILT-IN incident types with a 400 "Cannot resolve an incident of type …",
|
|
4
|
+
* in CIB seven, Camunda 7 and Operaton alike. Those incidents go away when
|
|
5
|
+
* their cause is retried: a `failedJob` through the job's retries, a
|
|
6
|
+
* `failedExternalTask` through the external task's retries. The incident's
|
|
7
|
+
* `configuration` names that job / external task. Only custom incident types
|
|
8
|
+
* (raised via the API) are resolved.
|
|
9
|
+
*/
|
|
10
|
+
/** The incident types the engine raises itself: never resolvable, only retried. */
|
|
11
|
+
export declare const BUILT_IN_INCIDENT_TYPES: readonly ["failedJob", "failedExternalTask"];
|
|
12
|
+
/**
|
|
13
|
+
* What clears an incident:
|
|
14
|
+
* - `resolve` (a custom incident): resolve it (`DELETE /incident/{id}`);
|
|
15
|
+
* - `retry-job`: set the retries of the job `jobId`;
|
|
16
|
+
* - `retry-external-task`: set the retries of the external task `externalTaskId`;
|
|
17
|
+
* - `none` (a built-in incident without a `configuration`): one propagated
|
|
18
|
+
* from a called instance, cleared by retrying its ROOT-CAUSE incident.
|
|
19
|
+
*/
|
|
20
|
+
export type IncidentRecovery = {
|
|
21
|
+
action: "resolve";
|
|
22
|
+
} | {
|
|
23
|
+
action: "retry-job";
|
|
24
|
+
jobId: string;
|
|
25
|
+
} | {
|
|
26
|
+
action: "retry-external-task";
|
|
27
|
+
externalTaskId: string;
|
|
28
|
+
} | {
|
|
29
|
+
action: "none";
|
|
30
|
+
};
|
|
31
|
+
export declare function incidentRecovery(incident: {
|
|
32
|
+
incidentType?: string | null | undefined;
|
|
33
|
+
configuration?: string | null | undefined;
|
|
34
|
+
}): IncidentRecovery;
|
|
35
|
+
//# sourceMappingURL=incident-recovery.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"incident-recovery.d.ts","sourceRoot":"","sources":["../src/incident-recovery.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,mFAAmF;AACnF,eAAO,MAAM,uBAAuB,8CAA+C,CAAA;AAEnF;;;;;;;GAOG;AACH,MAAM,MAAM,gBAAgB,GACxB;IAAE,MAAM,EAAE,SAAS,CAAA;CAAE,GACrB;IAAE,MAAM,EAAE,WAAW,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACtC;IAAE,MAAM,EAAE,qBAAqB,CAAC;IAAC,cAAc,EAAE,MAAM,CAAA;CAAE,GACzD;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,CAAA;AAEtB,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE;IACzC,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;IACxC,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;CAC1C,GAAG,gBAAgB,CAWnB"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Incident recovery. `DELETE /incident/{id}` (resolve) refuses the two
|
|
3
|
+
* BUILT-IN incident types with a 400 "Cannot resolve an incident of type …",
|
|
4
|
+
* in CIB seven, Camunda 7 and Operaton alike. Those incidents go away when
|
|
5
|
+
* their cause is retried: a `failedJob` through the job's retries, a
|
|
6
|
+
* `failedExternalTask` through the external task's retries. The incident's
|
|
7
|
+
* `configuration` names that job / external task. Only custom incident types
|
|
8
|
+
* (raised via the API) are resolved.
|
|
9
|
+
*/
|
|
10
|
+
/** The incident types the engine raises itself: never resolvable, only retried. */
|
|
11
|
+
export const BUILT_IN_INCIDENT_TYPES = ["failedJob", "failedExternalTask"];
|
|
12
|
+
export function incidentRecovery(incident) {
|
|
13
|
+
// An empty configuration names nothing, like an absent one.
|
|
14
|
+
const target = incident.configuration === "" ? null : (incident.configuration ?? null);
|
|
15
|
+
switch (incident.incidentType) {
|
|
16
|
+
case "failedJob":
|
|
17
|
+
return target ? { action: "retry-job", jobId: target } : { action: "none" };
|
|
18
|
+
case "failedExternalTask":
|
|
19
|
+
return target ? { action: "retry-external-task", externalTaskId: target } : { action: "none" };
|
|
20
|
+
default:
|
|
21
|
+
return { action: "resolve" };
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=incident-recovery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"incident-recovery.js","sourceRoot":"","sources":["../src/incident-recovery.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,mFAAmF;AACnF,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,WAAW,EAAE,oBAAoB,CAAU,CAAA;AAgBnF,MAAM,UAAU,gBAAgB,CAAC,QAGhC;IACC,4DAA4D;IAC5D,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,aAAa,IAAI,IAAI,CAAC,CAAA;IACtF,QAAQ,QAAQ,CAAC,YAAY,EAAE,CAAC;QAC9B,KAAK,WAAW;YACd,OAAO,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAA;QAC7E,KAAK,oBAAoB;YACvB,OAAO,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAA;QAChG;YACE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,CAAA;IAChC,CAAC;AACH,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @miragon/pulse-engine-core: the workflow domain of the Camunda 7 REST API family (Operaton,
|
|
3
|
+
* CIB seven, Camunda 7), and the one home of its pure engine REST rules (dates, filters,
|
|
4
|
+
* sorting, variable writes and typing, incident recovery, root causes, raw variable reads, the
|
|
5
|
+
* missing resource). Runs on a caller's `EnginePort`; returns data and throws
|
|
6
|
+
* `WorkflowError` reasons, and names no command, flag or tool: next steps and error reasons are
|
|
7
|
+
* structured, the caller words them. The pure rules behind these functions that only tests reach
|
|
8
|
+
* are exported from `@miragon/pulse-engine-core/testing`.
|
|
9
|
+
*/
|
|
10
|
+
export { type EngineFailure, type EnginePort, type EngineTransport, type ListResult, type OperationInput, type PlannedRequest, type PlannedWrite, type Query, createEnginePort, PARALLEL, Slots, } from "./port.js";
|
|
11
|
+
export { type IdRequest, listByIds, queryInput } from "./requests.js";
|
|
12
|
+
export { isWorkflowError, WorkflowError, type WorkflowErrorReason } from "./errors.js";
|
|
13
|
+
export { amount, compareText, compareTime, definitionKeyOf, field, num, type Rec, records, str, } from "./records.js";
|
|
14
|
+
export { type DateInputReading, earliestEngineDate, ENGINE_DATE_INPUT_FORMS, engineDateInput, engineDateMillis, engineTime, isEngineDateInput, latestEngineDate, OFFSET_REQUIRED, toEngineDate, toOptionalEngineDate, UTC_WITHOUT_OFFSET, } from "./dates.js";
|
|
15
|
+
export { engineSorting } from "./sorting.js";
|
|
16
|
+
export { complementaryFlags, engineInstanceSearch, engineKeyList, engineLike, trueOnly, } from "./filters.js";
|
|
17
|
+
export { autoTypedValue, type EngineVariableInput, toEngineVariable, toEngineVariables, } from "./variable-writes.js";
|
|
18
|
+
export { RAW_VARIABLES } from "./variables.js";
|
|
19
|
+
export { incidentRecovery, type IncidentRecovery } from "./incident-recovery.js";
|
|
20
|
+
export { mapLimit } from "./util.js";
|
|
21
|
+
export { formatDuration } from "./durations.js";
|
|
22
|
+
export { rootCause, rootCauseLine } from "./root-cause.js";
|
|
23
|
+
export type { AdvanceInput, AdvanceOption, Candidate, ChildView, DefinitionView, EndedInstance, IncidentCause, IncidentView, InstanceData, InstanceState, InstanceView, ItemStep, ItemWait, NextStep, Selection, TimelineEntry, TimelineIncident, TreeNode, TypedValue, WaitKind, Waited, WaitState, } from "./types.js";
|
|
24
|
+
export { checkSelection, selectInstance, selectionRequests } from "./select.js";
|
|
25
|
+
export { type InspectOptions, inspectInstance, instanceRequests, loadInstance, loadView, MAX_STACKTRACE_LINES, } from "./inspect.js";
|
|
26
|
+
export { activeTree, type InstanceTree } from "./tree.js";
|
|
27
|
+
export { waitId } from "./waits.js";
|
|
28
|
+
export { byActivity, isAdvanceable, isSuspendedJob, itemStep } from "./next.js";
|
|
29
|
+
export type { DefinitionStatus, GroupStep, IncidentGroup, JobStatus, TopicStatus, } from "./status.js";
|
|
30
|
+
export type { EngineStatus, Finding, FindingStep, Severity } from "./findings.js";
|
|
31
|
+
export { readStatus, type StatusData, type StatusDeps, type StatusOptions, statusRequests, } from "./engine-status.js";
|
|
32
|
+
export { type Condition, conditionLabel, decide, EXECUTABLE, type Measurement, measure, parseCondition, type Probe, type Verdict, } from "./conditions.js";
|
|
33
|
+
export { poll, type PollResult, type PollTiming } from "./poll.js";
|
|
34
|
+
export { checkRetryCount, executeWrite, missingRoots, type PlanEntry, planRetry, retriesWrite, type RetryFilter, retryEffect, type RetryMode, retryMode, retryPlanView, type SkipStep, } from "./retry-plan.js";
|
|
35
|
+
export { advanceSteps, checkAdvanceInput, checkLock, checkOptions, checkSuspended, chooseWait, } from "./advance-plan.js";
|
|
36
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,KAAK,EACV,gBAAgB,EAChB,QAAQ,EACR,KAAK,GACN,MAAM,WAAW,CAAA;AAClB,OAAO,EAAE,KAAK,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AACrE,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,KAAK,mBAAmB,EAAE,MAAM,aAAa,CAAA;AACtF,OAAO,EACL,MAAM,EACN,WAAW,EACX,WAAW,EAC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family (Operaton,
|
|
3
|
+
* CIB seven, Camunda 7), and the one home of its pure engine REST rules (dates, filters,
|
|
4
|
+
* sorting, variable writes and typing, incident recovery, root causes, raw variable reads, the
|
|
5
|
+
* missing resource). Runs on a caller's `EnginePort`; returns data and throws
|
|
6
|
+
* `WorkflowError` reasons, and names no command, flag or tool: next steps and error reasons are
|
|
7
|
+
* structured, the caller words them. The pure rules behind these functions that only tests reach
|
|
8
|
+
* are exported from `@miragon/pulse-engine-core/testing`.
|
|
9
|
+
*/
|
|
10
|
+
export { createEnginePort, PARALLEL, Slots, } from "./port.js";
|
|
11
|
+
export { listByIds, queryInput } from "./requests.js";
|
|
12
|
+
export { isWorkflowError, WorkflowError } from "./errors.js";
|
|
13
|
+
export { amount, compareText, compareTime, definitionKeyOf, field, num, records, str, } from "./records.js";
|
|
14
|
+
export { earliestEngineDate, ENGINE_DATE_INPUT_FORMS, engineDateInput, engineDateMillis, engineTime, isEngineDateInput, latestEngineDate, OFFSET_REQUIRED, toEngineDate, toOptionalEngineDate, UTC_WITHOUT_OFFSET, } from "./dates.js";
|
|
15
|
+
export { engineSorting } from "./sorting.js";
|
|
16
|
+
export { complementaryFlags, engineInstanceSearch, engineKeyList, engineLike, trueOnly, } from "./filters.js";
|
|
17
|
+
export { autoTypedValue, toEngineVariable, toEngineVariables, } from "./variable-writes.js";
|
|
18
|
+
export { RAW_VARIABLES } from "./variables.js";
|
|
19
|
+
export { incidentRecovery } from "./incident-recovery.js";
|
|
20
|
+
export { mapLimit } from "./util.js";
|
|
21
|
+
export { formatDuration } from "./durations.js";
|
|
22
|
+
export { rootCause, rootCauseLine } from "./root-cause.js";
|
|
23
|
+
export { checkSelection, selectInstance, selectionRequests } from "./select.js";
|
|
24
|
+
export { inspectInstance, instanceRequests, loadInstance, loadView, MAX_STACKTRACE_LINES, } from "./inspect.js";
|
|
25
|
+
export { activeTree } from "./tree.js";
|
|
26
|
+
export { waitId } from "./waits.js";
|
|
27
|
+
export { byActivity, isAdvanceable, isSuspendedJob, itemStep } from "./next.js";
|
|
28
|
+
export { readStatus, statusRequests, } from "./engine-status.js";
|
|
29
|
+
export { conditionLabel, decide, EXECUTABLE, measure, parseCondition, } from "./conditions.js";
|
|
30
|
+
export { poll } from "./poll.js";
|
|
31
|
+
export { checkRetryCount, executeWrite, missingRoots, planRetry, retriesWrite, retryEffect, retryMode, retryPlanView, } from "./retry-plan.js";
|
|
32
|
+
export { advanceSteps, checkAdvanceInput, checkLock, checkOptions, checkSuspended, chooseWait, } from "./advance-plan.js";
|
|
33
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EASL,gBAAgB,EAChB,QAAQ,EACR,KAAK,GACN,MAAM,WAAW,CAAA;AAClB,OAAO,EAAkB,SAAS,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AACrE,OAAO,EAAE,eAAe,EAAE,aAAa,EAA4B,MAAM,aAAa,CAAA;AACtF,OAAO,EACL,MAAM,EACN,WAAW,EACX,WAAW,EACX,eAAe,EACf,KAAK,EACL,GAAG,EAEH,OAAO,EACP,GAAG,GACJ,MAAM,cAAc,CAAA;AACrB,OAAO,EAEL,kBAAkB,EAClB,uBAAuB,EACvB,eAAe,EACf,gBAAgB,EAChB,UAAU,EACV,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EACf,YAAY,EACZ,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAC5C,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,aAAa,EACb,UAAU,EACV,QAAQ,GACT,MAAM,cAAc,CAAA;AACrB,OAAO,EACL,cAAc,EAEd,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAC9C,OAAO,EAAE,gBAAgB,EAAyB,MAAM,wBAAwB,CAAA;AAChF,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAC/C,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAyB1D,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAC/E,OAAO,EAEL,eAAe,EACf,gBAAgB,EAChB,YAAY,EACZ,QAAQ,EACR,oBAAoB,GACrB,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,UAAU,EAAqB,MAAM,WAAW,CAAA;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AACnC,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAS/E,OAAO,EACL,UAAU,EAIV,cAAc,GACf,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAEL,cAAc,EACd,MAAM,EACN,UAAU,EAEV,OAAO,EACP,cAAc,GAGf,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAAE,IAAI,EAAoC,MAAM,WAAW,CAAA;AAClE,OAAO,EACL,eAAe,EACf,YAAY,EACZ,YAAY,EAEZ,SAAS,EACT,YAAY,EAEZ,WAAW,EAEX,SAAS,EACT,aAAa,GAEd,MAAM,iBAAiB,CAAA;AACxB,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,SAAS,EACT,YAAY,EACZ,cAAc,EACd,UAAU,GACX,MAAM,mBAAmB,CAAA"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Inspect: where a process instance waits and why. Loads the rounds of requests (instance, tree,
|
|
3
|
+
* wait states, root causes) and assembles the instance view.
|
|
4
|
+
*/
|
|
5
|
+
import { type EnginePort, type PlannedRequest } from "./port.js";
|
|
6
|
+
import { type Rec } from "./records.js";
|
|
7
|
+
import type { EndedInstance, IncidentCause, InstanceView, Selection } from "./types.js";
|
|
8
|
+
export interface InspectOptions {
|
|
9
|
+
readonly variables: boolean;
|
|
10
|
+
readonly history: boolean;
|
|
11
|
+
readonly stacktrace: boolean;
|
|
12
|
+
}
|
|
13
|
+
/** A stack trace an instance view carries is cut after this many lines. */
|
|
14
|
+
export declare const MAX_STACKTRACE_LINES = 200;
|
|
15
|
+
/** The first round for an id: runtime and history record. */
|
|
16
|
+
export declare function instanceRequests(id: string): PlannedRequest[];
|
|
17
|
+
/**
|
|
18
|
+
* The root cause of an incident: from the stacktrace of a failed job or the error details of a
|
|
19
|
+
* failed external task, else the incident message; with `stacktrace` also the (first 200) lines.
|
|
20
|
+
*/
|
|
21
|
+
export declare function incidentCause(port: EnginePort, incident: Rec, stacktrace: boolean): Promise<IncidentCause>;
|
|
22
|
+
/**
|
|
23
|
+
* The instance view of `id`; `instance-missing` when neither runtime nor history know it. An instance that
|
|
24
|
+
* ends while the rounds run (a job executor finished it) is loaded once more, then as ended.
|
|
25
|
+
*/
|
|
26
|
+
export declare function loadInstance(port: EnginePort, id: string, options: InspectOptions, attempts?: number): Promise<InstanceView>;
|
|
27
|
+
/**
|
|
28
|
+
* The view after a write: an instance that ended without a history record (history level none)
|
|
29
|
+
* is `{id, state: "ENDED"}` instead of `instance-missing`.
|
|
30
|
+
*/
|
|
31
|
+
export declare function loadView(port: EnginePort, id: string, options: InspectOptions): Promise<InstanceView | EndedInstance>;
|
|
32
|
+
/** Inspect: the selected instance's view (selection rules and errors as `selectInstance`'s). */
|
|
33
|
+
export declare function inspectInstance(port: EnginePort, selection: Selection, options: InspectOptions): Promise<InstanceView>;
|
|
34
|
+
//# sourceMappingURL=inspect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inspect.d.ts","sourceRoot":"","sources":["../src/inspect.ts"],"names":[],"mappings":"AAAA;;;GAGG;A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