attlaz-client 1.64.0 → 1.65.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.
@@ -1,6 +1,6 @@
1
1
  import { CommandExecutionStatus } from './CommandExecutionStatus.js';
2
2
  export interface CommandExecutionFilter {
3
- status?: CommandExecutionStatus;
4
- type?: string;
3
+ status?: CommandExecutionStatus[];
4
+ type?: string[];
5
5
  requestedBy?: string;
6
6
  }
@@ -0,0 +1,15 @@
1
+ import { FlowRunStatus } from './FlowRunStatus.js';
2
+ /**
3
+ * The authoritative lifecycle of a flow run, as derived server-side from its event history
4
+ * (first-terminal-wins). Unlike FlowRunSummary, which reflects the (eventually-consistent) index
5
+ * projection, this is computed directly from the history and is safe for control-flow decisions
6
+ * such as the worker's "is this run already terminal?" tombstone check.
7
+ */
8
+ export declare class FlowRunLifecycle {
9
+ id: string;
10
+ status: FlowRunStatus;
11
+ requested: Date | null;
12
+ started: Date | null;
13
+ ended: Date | null;
14
+ static parse(rawFlowRunLifecycle: any): FlowRunLifecycle;
15
+ }
@@ -0,0 +1,24 @@
1
+ import { Utils } from '../../Utils.js';
2
+ import { FlowRunStatus } from './FlowRunStatus.js';
3
+ /**
4
+ * The authoritative lifecycle of a flow run, as derived server-side from its event history
5
+ * (first-terminal-wins). Unlike FlowRunSummary, which reflects the (eventually-consistent) index
6
+ * projection, this is computed directly from the history and is safe for control-flow decisions
7
+ * such as the worker's "is this run already terminal?" tombstone check.
8
+ */
9
+ export class FlowRunLifecycle {
10
+ id;
11
+ status;
12
+ requested;
13
+ started;
14
+ ended;
15
+ static parse(rawFlowRunLifecycle) {
16
+ const lifecycle = new FlowRunLifecycle();
17
+ lifecycle.id = rawFlowRunLifecycle.id;
18
+ lifecycle.status = FlowRunStatus.fromString(rawFlowRunLifecycle.status);
19
+ lifecycle.requested = rawFlowRunLifecycle.requested === null || rawFlowRunLifecycle.requested === undefined ? null : Utils.parseRawDate(rawFlowRunLifecycle.requested);
20
+ lifecycle.started = rawFlowRunLifecycle.started === null || rawFlowRunLifecycle.started === undefined ? null : Utils.parseRawDate(rawFlowRunLifecycle.started);
21
+ lifecycle.ended = rawFlowRunLifecycle.ended === null || rawFlowRunLifecycle.ended === undefined ? null : Utils.parseRawDate(rawFlowRunLifecycle.ended);
22
+ return lifecycle;
23
+ }
24
+ }
@@ -9,10 +9,10 @@ export class CommandExecutionEndpoint extends Endpoint {
9
9
  const queryString = new QueryString('/system/command-executions');
10
10
  queryString.addPagination(pagination);
11
11
  if (filter !== null) {
12
- if (filter.status !== undefined) {
12
+ if (filter.status !== undefined && filter.status.length > 0) {
13
13
  queryString.set('status', filter.status);
14
14
  }
15
- if (filter.type !== undefined) {
15
+ if (filter.type !== undefined && filter.type.length > 0) {
16
16
  queryString.set('type', filter.type);
17
17
  }
18
18
  if (filter.requestedBy !== undefined) {
@@ -2,6 +2,7 @@ import { FlowRun } from '../Model/Flow/FlowRun.js';
2
2
  import { FlowRunStatus } from '../Model/Flow/FlowRunStatus.js';
3
3
  import { FlowRunSummary } from '../Model/Flow/FlowRunSummary.js';
4
4
  import { FlowRunHistory } from '../Model/Flow/FlowRunHistory.js';
5
+ import { FlowRunLifecycle } from '../Model/Flow/FlowRunLifecycle.js';
5
6
  import { CollectionResult } from '../Model/Result/CollectionResult.js';
6
7
  import { CursorPagination } from '../Model/Pagination/CursorPagination.js';
7
8
  import { Endpoint } from './Endpoint.js';
@@ -10,5 +11,11 @@ export declare class FlowRunEndpoint extends Endpoint {
10
11
  getFlowRunSummaries(flowId: string, flowRunStatuses?: FlowRunStatus[] | null, pagination?: CursorPagination | null, projectEnvironmentId?: string | null): Promise<CollectionResult<FlowRunSummary>>;
11
12
  getFlowRunSummary(flowRunId: string): Promise<FlowRunSummary | null>;
12
13
  getFlowRunHistory(flowRunId: string): Promise<CollectionResult<FlowRunHistory>>;
14
+ /**
15
+ * Authoritative lifecycle (status derived from history, first-terminal-wins). Prefer this over
16
+ * getFlowRunSummary for control-flow decisions (e.g. the worker tombstone), since the summary
17
+ * reflects the eventually-consistent index projection which can lag the history.
18
+ */
19
+ getFlowRunLifecycle(flowRunId: string): Promise<FlowRunLifecycle | null>;
13
20
  updateFlowRun(flowRunId: string, status: FlowRunStatus, time?: Date | null): Promise<FlowRun>;
14
21
  }
@@ -1,6 +1,7 @@
1
1
  import { FlowRun } from '../Model/Flow/FlowRun.js';
2
2
  import { FlowRunSummary } from '../Model/Flow/FlowRunSummary.js';
3
3
  import { FlowRunHistory } from '../Model/Flow/FlowRunHistory.js';
4
+ import { FlowRunLifecycle } from '../Model/Flow/FlowRunLifecycle.js';
4
5
  import { QueryString } from '../Http/Data/QueryString.js';
5
6
  import { Endpoint } from './Endpoint.js';
6
7
  export class FlowRunEndpoint extends Endpoint {
@@ -62,6 +63,15 @@ export class FlowRunEndpoint extends Endpoint {
62
63
  const result = await this.requestCollection('/flowruns/' + flowRunId + '/history', FlowRunHistory.parse);
63
64
  return result;
64
65
  }
66
+ /**
67
+ * Authoritative lifecycle (status derived from history, first-terminal-wins). Prefer this over
68
+ * getFlowRunSummary for control-flow decisions (e.g. the worker tombstone), since the summary
69
+ * reflects the eventually-consistent index projection which can lag the history.
70
+ */
71
+ async getFlowRunLifecycle(flowRunId) {
72
+ const result = await this.requestObject('/flowruns/' + flowRunId + '/lifecycle', null, FlowRunLifecycle.parse);
73
+ return result.getData();
74
+ }
65
75
  async updateFlowRun(flowRunId, status, time = null) {
66
76
  if (flowRunId.length === 0) {
67
77
  throw new Error('Flow run id cannot be empty');
package/dist/index.d.ts CHANGED
@@ -118,6 +118,7 @@ export { StateAware } from './Model/StateAware.js';
118
118
  export { Flow } from './Model/Flow/Flow.js';
119
119
  export { FlowRun } from './Model/Flow/FlowRun.js';
120
120
  export { FlowRunHistory } from './Model/Flow/FlowRunHistory.js';
121
+ export { FlowRunLifecycle } from './Model/Flow/FlowRunLifecycle.js';
121
122
  export { FlowRunResponse } from './Model/Flow/FlowRunResponse.js';
122
123
  export { FlowRunStatus } from './Model/Flow/FlowRunStatus.js';
123
124
  export { FlowRunSummary } from './Model/Flow/FlowRunSummary.js';
package/dist/index.js CHANGED
@@ -106,6 +106,7 @@ export { State } from './Model/State.js';
106
106
  export { Flow } from './Model/Flow/Flow.js';
107
107
  export { FlowRun } from './Model/Flow/FlowRun.js';
108
108
  export { FlowRunHistory } from './Model/Flow/FlowRunHistory.js';
109
+ export { FlowRunLifecycle } from './Model/Flow/FlowRunLifecycle.js';
109
110
  export { FlowRunResponse } from './Model/Flow/FlowRunResponse.js';
110
111
  export { FlowRunStatus } from './Model/Flow/FlowRunStatus.js';
111
112
  export { FlowRunSummary } from './Model/Flow/FlowRunSummary.js';
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "1.64.0";
1
+ export declare const VERSION = "1.65.0";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = "1.64.0";
1
+ export const VERSION = "1.65.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "attlaz-client",
3
- "version": "1.64.0",
3
+ "version": "1.65.0",
4
4
  "description": "Javascript Client to access Attlaz API",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.js",
@@ -55,7 +55,7 @@
55
55
  "@typescript-eslint/parser": "^8.59.3",
56
56
  "eslint": "^9.39.4",
57
57
  "eslint-config-attlaz-base": "^1.8.0",
58
- "eslint-import-resolver-typescript": "^4.4.4",
58
+ "eslint-import-resolver-typescript": "^4.4.5",
59
59
  "eslint-plugin-import": "^2.32.0",
60
60
  "eslint-plugin-jsdoc": "^62.9.0",
61
61
  "eslint-plugin-prefer-arrow": "^1.2.3",