@abyss-project/console 14.0.0 → 14.2.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/CHANGELOG.md +53 -36
- package/dist/types/enum/workflow.enum.d.ts +2 -1
- package/dist/types/enum/workflow.enum.js +1 -0
- package/dist/types/enum/workflow.enum.js.map +1 -1
- package/dist/types/interface/api/responses/report.admin.response.d.ts +2 -0
- package/dist/types/interface/api/responses/workflow.admin.response.d.ts +4 -0
- package/dist/types/interface/api/responses/workflow.response.d.ts +3 -0
- package/dist/types/interface/api/responses/workflow.response.js.map +1 -1
- package/dist/types/interface/models/workflow-execution.model.d.ts +2 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +1 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/workflow-credit.utils.d.ts +20 -0
- package/dist/utils/workflow-credit.utils.js +69 -0
- package/dist/utils/workflow-credit.utils.js.map +1 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,36 +1,53 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
## 14.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
- `
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
- **BREAKING** — `
|
|
28
|
-
- `
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 14.2.0
|
|
4
|
+
|
|
5
|
+
Automation credits, worst-case cost (#686).
|
|
6
|
+
|
|
7
|
+
- `computeWorkflowMaxCreditCost` now follows the engine: the execution starts on the first START connection by order only, and after each step runs a single connection, the first by order whose expression holds. The worst case is the most expensive candidate, not the sum of the children as before: a step with several outgoing connections no longer adds them up. A disabled step costs 0 and the engine moves on, except a disabled `FILTER`, which ends the execution.
|
|
8
|
+
- `IWorkflowCreditStructure` is extended additively: `steps[].isEnabled?` (default true), `connections[].order?` and `connections[].expression?`. `null` or an empty `expression` always matches, so the connections ranked after it are ignored; an omitted `expression` means unknown and keeps every connection as a candidate (a safe over-estimate). The new `IWorkflowCreditConnection` names the connection shape.
|
|
9
|
+
|
|
10
|
+
## 14.1.0
|
|
11
|
+
|
|
12
|
+
Automation credits per organisation plan (#686, ADR-0198).
|
|
13
|
+
|
|
14
|
+
- `WorkflowExecutionStatus.QUOTA_EXCEEDED`: an execution refused because the organisation used up its `CONSOLE_WORKFLOW_CREDITS_MONTH`. The row keeps its cause in `error`, has no step execution, is final and is never retried. A consumer with an exhaustive `switch` on the status must handle it.
|
|
15
|
+
- `IWorkflowExecution.creditCost: number | null`: the credits of the steps that actually ran, written when the execution reaches a final status, and `null` before that or when nothing ran. `IWorkflowExecution.overQuota: boolean`: started past the quota under the critical alert exemption (a `MONITOR_ALERT_RULE` trigger on `INCIDENT_OPENED` of a `CRITICAL` incident).
|
|
16
|
+
- `ITriggerMonitorAlertRuleWorkflowAdminData.refusedForQuota: { workflowId, executionId }[]`: the workflows refused for credits by a Monitor alert-rule delivery, with their `QUOTA_EXCEEDED` execution, which is also listed in `workflowExecutions`.
|
|
17
|
+
- `quotaExceeded: number` on `IWorkflowExecutionStats`, `IWorkflowExecutionTimeSeriesBucket`, `IProjectWorkflowAnalyticsPerWorkflow` and `IWorkflowExecutionsByPeriod`, and `quotaExceededExecutions: number` on `IWorkflowReportMetrics`: the per-status counts add up to `total` again. `successRate` is unchanged, `completed / (completed + failed)`: a refusal is neither a success nor a failure. These fields are required, so code that builds these objects (mocks, fixtures) must add them.
|
|
18
|
+
- Credit cost helpers: `WORKFLOW_STEP_CREDIT_COST` (per step type: `FILTER`, `SWITCH` and `SLEEP` 0, `ACTION` 1, `CODE` 5), `computeWorkflowCreditCost` (cost of the executed steps), `computeWorkflowMaxCreditCost` (worst case over the paths of a structure) and `IWorkflowCreditStructure`.
|
|
19
|
+
|
|
20
|
+
## 14.0.0
|
|
21
|
+
|
|
22
|
+
- **BREAKING** — `sdk.project.activate` (`activateProject`) is removed, with `IActivateProjectParams`, `IActivateProjectData` and `IActivateProjectResponse`, and the API route `POST /project/:projectId/activate` (#244). Console now activates at first use: the first call of a member who holds `FULL_ACCESS` or a Console permission creates the project row, and `GET /project/:projectId` no longer answers 404 `notFound` for a project that was never used.
|
|
23
|
+
|
|
24
|
+
## 13.0.0
|
|
25
|
+
|
|
26
|
+
- **BREAKING** — `ISecretAccess.token` and `IVariableAccess.token` are removed (#244): the API stores only a SHA-256 of each bearer token and no longer lists it. The token in clear comes once, as `token` on `ICreateSecretAccessData`, `IRegenerateTokenSecretAccessData`, `ICreateVariableAccessData` and `IRegenerateTokenVariableAccessData`.
|
|
27
|
+
- **BREAKING** — `ipToNumber` is removed from the CIDR utilities, which now compare IPv4 and IPv6 with `ipaddr.js` (new dependency).
|
|
28
|
+
- The access-log models carry `projectId` and the names of the secret, variable and access they record; `IRunAccessLogPurgeCronResponse` describes the retention cron.
|
|
29
|
+
- A trigger read by a member without `WORKFLOW_UPDATE` comes without `config.signatureSecret` nor `config.secretToken` (the token of its public URL), and a serialized `IWorkflowWebhook` shows its sensitive header values as `***`. The execution contexts (`IWorkflowExecution.context`) no longer carry either.
|
|
30
|
+
|
|
31
|
+
## 10.0.0
|
|
32
|
+
|
|
33
|
+
- **BREAKING** — `COMMERCIAL_SECTION` is removed, with the `constants/well-known-ids.constants` module that held it and the `uuid` dependency that only served it. It exported deterministic v5 ids "so they match between the seeder and consuming services" (#352), and no consuming service was ever written: the two seeders that produced the matching rows were deleted in 61468f3, and a search across abyss-console, abyss-main and abyss-tools finds no importer in source. Nothing in the ecosystem imports it — but it was published, so removing it is a rupture for anything built against 9.x that we do not compile ourselves, and it takes a major. The rows it addressed are deleted by the API migration `20260916100000-internal-ticket-section-organization-not-null`, which also makes `internalTicketSections."organizationId"` `NOT NULL` (#387).
|
|
34
|
+
|
|
35
|
+
## 9.1.0
|
|
36
|
+
|
|
37
|
+
- `IInternalTicketApproval.adminGroupId: string | null` — approvals sharing it form one admin group (#473): the first admin who decides settles it, and the API withdraws the others' pending rows in the same transaction. Null on every other approval.
|
|
38
|
+
- `IInternalTicketApprovalRule.approverOrganizationAdmins: boolean` — the rule addresses the organization's admins instead of `approverUserId`, which is kept as the record of the member it named.
|
|
39
|
+
- `InternalTicketActivityType.APPROVAL_REASSIGNED` with `IApprovalReassignedActivityData` (`fromUserId`, `toUserIds`, `previousApprovalId`, optional `adminGroupId`) — a departed member's pending approval handed to the admins. `adminGroupId` is absent, and `toUserIds` empty, when every admin was already waiting on the ticket.
|
|
40
|
+
- `InternalTicketApprovalWithdrawalReason.ADMIN_GROUP_DECIDED`, and the optional `reason` and `decidedApprovalId` on `IApprovalWithdrawnActivityData` — set when an approval was closed because another admin of its group decided first. Columns added by the API migration `20260915180000-internal-ticket-approval-admin-group`.
|
|
41
|
+
|
|
42
|
+
## 9.0.0
|
|
43
|
+
|
|
44
|
+
- **BREAKING** — `InternalTicketActivityType.BOARD_CARD_CREATED` and `IBoardCardCreatedActivityData` are removed. Linking a card never created one: the activity is now `BOARD_CARD_LINKED`, and unlinking writes `BOARD_CARD_UNLINKED`. Both carry `IBoardCardLinkedActivityData` (`boardId: string | null`, `boardCardId: string`); `boardId` is `null` only on rows migrated from `BOARD_CARD_CREATED` whose ticket no longer holds that card. Existing rows are rewritten by the API migration `20260915140000-internal-ticket-board-card-activity-types`.
|
|
45
|
+
- `InternalTicketRefusal.BOARD_CARD_LINKED_TO_ANOTHER_TICKET` — answered with a 409 when the card already tracks another ticket (previously an untranslated 500).
|
|
46
|
+
|
|
47
|
+
## 1.0.80
|
|
48
|
+
|
|
49
|
+
- chore(deps): bump `axios` floor from `^1.6.0` to `^1.13.6` to align with the rest of the Abyss workspace (security advisories CVE-2023-45857 / CVE-2024-39338) and pick up the `AxiosHeaders` API. SDK surface unchanged. The legacy `defaults.headers.common[...]` API still used by `AbyssConsoleCore.setConfig` remains supported across this range; end-to-end auth-header propagation continues to be exercised by the consuming `apps/api` integration suite (no functional change observed).
|
|
50
|
+
|
|
51
|
+
## 1.0.79
|
|
52
|
+
|
|
53
|
+
- Previous baseline.
|
|
@@ -96,7 +96,8 @@ export declare enum WorkflowExecutionStatus {
|
|
|
96
96
|
RUNNING = "RUNNING",
|
|
97
97
|
COMPLETED = "COMPLETED",
|
|
98
98
|
FAILED = "FAILED",
|
|
99
|
-
CANCELLED = "CANCELLED"
|
|
99
|
+
CANCELLED = "CANCELLED",
|
|
100
|
+
QUOTA_EXCEEDED = "QUOTA_EXCEEDED"
|
|
100
101
|
}
|
|
101
102
|
export declare enum WebhookDirection {
|
|
102
103
|
INCOMING = "INCOMING",
|
|
@@ -109,6 +109,7 @@ var WorkflowExecutionStatus;
|
|
|
109
109
|
WorkflowExecutionStatus["COMPLETED"] = "COMPLETED";
|
|
110
110
|
WorkflowExecutionStatus["FAILED"] = "FAILED";
|
|
111
111
|
WorkflowExecutionStatus["CANCELLED"] = "CANCELLED";
|
|
112
|
+
WorkflowExecutionStatus["QUOTA_EXCEEDED"] = "QUOTA_EXCEEDED";
|
|
112
113
|
})(WorkflowExecutionStatus || (exports.WorkflowExecutionStatus = WorkflowExecutionStatus = {}));
|
|
113
114
|
var WebhookDirection;
|
|
114
115
|
(function (WebhookDirection) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow.enum.js","sourceRoot":"","sources":["../../../src/types/enum/workflow.enum.ts"],"names":[],"mappings":";;;AAAA,IAAY,cAKX;AALD,WAAY,cAAc;IACxB,iCAAe,CAAA;IACf,mCAAiB,CAAA;IACjB,mCAAiB,CAAA;IACjB,u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AA;IACnC,qEAAuC,CAAA;IACvC,uDAAyB,CAAA;IACzB,iEAAmC,CAAA;IACnC,6EAA+C,CAAA;AACjD,CAAC,EANW,0BAA0B,0CAA1B,0BAA0B,QAMrC;AAMD,IAAY,4BAIX;AAJD,WAAY,4BAA4B;IACtC,iDAAiB,CAAA;IACjB,+DAA+B,CAAA;IAC/B,iEAAiC,CAAA;AACnC,CAAC,EAJW,4BAA4B,4CAA5B,4BAA4B,QAIvC;AAED,IAAY,gBAEX;AAFD,WAAY,gBAAgB;IAC1B,mEAA+C,CAAA;AACjD,CAAC,EAFW,gBAAgB,gCAAhB,gBAAgB,QAE3B;AAED,IAAY,gBAMX;AAND,WAAY,gBAAgB;IAC1B,qCAAiB,CAAA;IACjB,mCAAe,CAAA;IACf,qCAAiB,CAAA;IACjB,qCAAiB,CAAA;IACjB,iCAAa,CAAA;AACf,CAAC,EANW,gBAAgB,gCAAhB,gBAAgB,QAM3B;AAED,IAAY,kBAMX;AAND,WAAY,kBAAkB;IAC5B,mDAA6B,CAAA;IAC7B,6DAAuC,CAAA;IACvC,2DAAqC,CAAA;IACrC,+DAAyC,CAAA;IACzC,mEAA6C,CAAA;AAC/C,CAAC,EANW,kBAAkB,kCAAlB,kBAAkB,QAM7B;AAED,IAAY,kBAMX;AAND,WAAY,kBAAkB;IAC5B,yCAAmB,CAAA;IACnB,yCAAmB,CAAA;IACnB,6CAAuB,CAAA;IACvB,uCAAiB,CAAA;IACjB,yCAAmB,CAAA;AACrB,CAAC,EANW,kBAAkB,kCAAlB,kBAAkB,QAM7B;AAED,IAAY,
|
|
1
|
+
{"version":3,"file":"workflow.enum.js","sourceRoot":"","sources":["../../../src/types/enum/workflow.enum.ts"],"names":[],"mappings":";;;AAAA,IAAY,cAKX;AALD,WAAY,cAAc;IACxB,iCAAe,CAAA;IACf,mCAAiB,CAAA;IACjB,mCAAiB,CAAA;IACjB,uCAAqB,CAAA;AACvB,CAAC,EALW,cAAc,8BAAd,cAAc,QAKzB;AAED,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gBAAgB,QAG3B;AAED,IAAY,aAKX;AALD,WAAY,aAAa;IACvB,oCAAmB,CAAA;IACnB,oCAAmB,CAAA;IACnB,kCAAiB,CAAA;IACjB,sCAAqB,CAAA;AACvB,CAAC,EALW,aAAa,6BAAb,aAAa,QAKxB;AAED,IAAY,cAgBX;AAhBD,WAAY,cAAc;IACxB,mCAAiB,CAAA;IACjB,2CAAyB,CAAA;IACzB,uCAAqB,CAAA;IACrB,+CAA6B,CAAA;IAC7B,6CAA2B,CAAA;IAC3B,yCAAuB,CAAA;IACvB,+CAA6B,CAAA;IAC7B,yCAAuB,CAAA;IACvB,iEAA+C,CAAA;IAC/C,2DAAyC,CAAA;IACzC,2BAAS,CAAA;IACT,mCAAiB,CAAA;IACjB,uCAAqB,CAAA;IACrB,+CAA6B,CAAA;IAC7B,iDAA+B,CAAA;AACjC,CAAC,EAhBW,cAAc,8BAAd,cAAc,QAgBzB;AAED,IAAY,uBAOX;AAPD,WAAY,uBAAuB;IACjC,4CAAiB,CAAA;IACjB,oDAAyB,CAAA;IACzB,gDAAqB,CAAA;IACrB,wDAA6B,CAAA;IAC7B,wDAA6B,CAAA;IAC7B,kDAAuB,CAAA;AACzB,CAAC,EAPW,uBAAuB,uCAAvB,uBAAuB,QAOlC;AAED,IAAY,UAQX;AARD,WAAY,UAAU;IACpB,yBAAW,CAAA;IACX,2BAAa,CAAA;IACb,yBAAW,CAAA;IACX,6BAAe,CAAA;IACf,+BAAiB,CAAA;IACjB,2BAAa,CAAA;IACb,iCAAmB,CAAA;AACrB,CAAC,EARW,UAAU,0BAAV,UAAU,QAQrB"}
|
|
@@ -6,6 +6,7 @@ export interface IWorkflowExecutionsByPeriod {
|
|
|
6
6
|
completed: number;
|
|
7
7
|
failed: number;
|
|
8
8
|
cancelled: number;
|
|
9
|
+
quotaExceeded: number;
|
|
9
10
|
}
|
|
10
11
|
export interface IInternalTicketReportMetrics {
|
|
11
12
|
total: number;
|
|
@@ -34,6 +35,7 @@ export interface IWorkflowReportMetrics {
|
|
|
34
35
|
completedExecutions: number;
|
|
35
36
|
failedExecutions: number;
|
|
36
37
|
cancelledExecutions: number;
|
|
38
|
+
quotaExceededExecutions: number;
|
|
37
39
|
successRate: number | null;
|
|
38
40
|
averageDurationMs: number | null;
|
|
39
41
|
executionsByPeriod: IWorkflowExecutionsByPeriod[];
|
|
@@ -45,6 +45,10 @@ export interface ITriggerUserDeclineProjectWorkflowAdminData {
|
|
|
45
45
|
export type ITriggerUserDeclineProjectWorkflowAdminResponse = IResponse<ITriggerUserDeclineProjectWorkflowAdminData>;
|
|
46
46
|
export interface ITriggerMonitorAlertRuleWorkflowAdminData {
|
|
47
47
|
workflowExecutions: IWorkflowExecution[];
|
|
48
|
+
refusedForQuota: {
|
|
49
|
+
workflowId: string;
|
|
50
|
+
executionId: string;
|
|
51
|
+
}[];
|
|
48
52
|
}
|
|
49
53
|
export type ITriggerMonitorAlertRuleWorkflowAdminResponse = IResponse<ITriggerMonitorAlertRuleWorkflowAdminData>;
|
|
50
54
|
export interface ITriggerFormSubmissionWorkflowAdminData {
|
|
@@ -66,6 +66,7 @@ export interface IWorkflowExecutionStats {
|
|
|
66
66
|
completed: number;
|
|
67
67
|
failed: number;
|
|
68
68
|
cancelled: number;
|
|
69
|
+
quotaExceeded: number;
|
|
69
70
|
averageDurationMs: number | null;
|
|
70
71
|
successRate: number | null;
|
|
71
72
|
}
|
|
@@ -83,6 +84,7 @@ export interface IWorkflowExecutionTimeSeriesBucket {
|
|
|
83
84
|
completed: number;
|
|
84
85
|
failed: number;
|
|
85
86
|
cancelled: number;
|
|
87
|
+
quotaExceeded: number;
|
|
86
88
|
running: number;
|
|
87
89
|
pending: number;
|
|
88
90
|
avgDurationMs: number | null;
|
|
@@ -98,6 +100,7 @@ export interface IProjectWorkflowAnalyticsPerWorkflow {
|
|
|
98
100
|
completed: number;
|
|
99
101
|
failed: number;
|
|
100
102
|
cancelled: number;
|
|
103
|
+
quotaExceeded: number;
|
|
101
104
|
avgDurationMs: number | null;
|
|
102
105
|
successRate: number | null;
|
|
103
106
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow.response.js","sourceRoot":"","sources":["../../../../../src/types/interface/api/responses/workflow.response.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"workflow.response.js","sourceRoot":"","sources":["../../../../../src/types/interface/api/responses/workflow.response.ts"],"names":[],"mappings":";;;AAwOA,IAAY,yBAUX;AAVD,WAAY,yBAAyB;IACnC,oEAAuC,CAAA;IACvC,oEAAuC,CAAA;IACvC,wEAA2C,CAAA;IAC3C,kEAAqC,CAAA;IACrC,wEAA2C,CAAA;IAC3C,0DAA6B,CAAA;IAC7B,8DAAiC,CAAA;IACjC,wDAA2B,CAAA;IAC3B,0DAA6B,CAAA;AAC/B,CAAC,EAVW,yBAAyB,yCAAzB,yBAAyB,QAUpC"}
|
|
@@ -16,6 +16,8 @@ export interface IWorkflowExecution {
|
|
|
16
16
|
context: Record<string, any>;
|
|
17
17
|
metadata: Record<string, any> | null;
|
|
18
18
|
retryNumber: number;
|
|
19
|
+
creditCost: number | null;
|
|
20
|
+
overQuota: boolean;
|
|
19
21
|
parentExecutionId: string | null;
|
|
20
22
|
createdAt?: Date;
|
|
21
23
|
updatedAt?: Date;
|
package/dist/utils/index.d.ts
CHANGED
package/dist/utils/index.js
CHANGED
|
@@ -23,4 +23,5 @@ __exportStar(require("./internal-ticket-artifact-rules.utils"), exports);
|
|
|
23
23
|
__exportStar(require("./internal-ticket-artifact-value.utils"), exports);
|
|
24
24
|
__exportStar(require("./internal-ticket-approval.utils"), exports);
|
|
25
25
|
__exportStar(require("./internal-ticket-view.utils"), exports);
|
|
26
|
+
__exportStar(require("./workflow-credit.utils"), exports);
|
|
26
27
|
//# sourceMappingURL=index.js.map
|
package/dist/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,+DAA6C;AAC7C,8CAA4B;AAC5B,kDAAgC;AAChC,iEAA+C;AAC/C,yEAAuD;AACvD,yEAAuD;AACvD,mEAAiD;AACjD,+DAA6C"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,+DAA6C;AAC7C,8CAA4B;AAC5B,kDAAgC;AAChC,iEAA+C;AAC/C,yEAAuD;AACvD,yEAAuD;AACvD,mEAAiD;AACjD,+DAA6C;AAC7C,0DAAwC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { WorkflowStepType } from '../types/enum/workflow.enum';
|
|
2
|
+
export declare const WORKFLOW_STEP_CREDIT_COST: Readonly<Record<WorkflowStepType, number>>;
|
|
3
|
+
export declare const computeWorkflowCreditCost: (steps: {
|
|
4
|
+
type: WorkflowStepType;
|
|
5
|
+
}[]) => number;
|
|
6
|
+
export interface IWorkflowCreditStructure {
|
|
7
|
+
steps: {
|
|
8
|
+
id: string;
|
|
9
|
+
type: WorkflowStepType;
|
|
10
|
+
isEnabled?: boolean;
|
|
11
|
+
}[];
|
|
12
|
+
connections: IWorkflowCreditConnection[];
|
|
13
|
+
}
|
|
14
|
+
export interface IWorkflowCreditConnection {
|
|
15
|
+
fromStepId: string | null;
|
|
16
|
+
toStepId: string | null;
|
|
17
|
+
order?: number;
|
|
18
|
+
expression?: string | null;
|
|
19
|
+
}
|
|
20
|
+
export declare const computeWorkflowMaxCreditCost: (structure: IWorkflowCreditStructure) => number;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.computeWorkflowMaxCreditCost = exports.computeWorkflowCreditCost = exports.WORKFLOW_STEP_CREDIT_COST = void 0;
|
|
4
|
+
const workflow_enum_1 = require("../types/enum/workflow.enum");
|
|
5
|
+
exports.WORKFLOW_STEP_CREDIT_COST = Object.freeze({
|
|
6
|
+
[workflow_enum_1.WorkflowStepType.FILTER]: 0,
|
|
7
|
+
[workflow_enum_1.WorkflowStepType.SWITCH]: 0,
|
|
8
|
+
[workflow_enum_1.WorkflowStepType.SLEEP]: 0,
|
|
9
|
+
[workflow_enum_1.WorkflowStepType.ACTION]: 1,
|
|
10
|
+
[workflow_enum_1.WorkflowStepType.CODE]: 5,
|
|
11
|
+
});
|
|
12
|
+
const computeWorkflowCreditCost = (steps) => steps.reduce((total, step) => total + exports.WORKFLOW_STEP_CREDIT_COST[step.type], 0);
|
|
13
|
+
exports.computeWorkflowCreditCost = computeWorkflowCreditCost;
|
|
14
|
+
const byOrder = (a, b) => (a.order ?? 0) - (b.order ?? 0);
|
|
15
|
+
const alwaysMatches = (connection) => connection.expression === null || connection.expression?.trim() === '';
|
|
16
|
+
const computeWorkflowMaxCreditCost = (structure) => {
|
|
17
|
+
const stepsById = new Map(structure.steps.map((step) => [step.id, step]));
|
|
18
|
+
const entryConnection = structure.connections
|
|
19
|
+
.filter((connection) => connection.fromStepId === null)
|
|
20
|
+
.sort(byOrder)[0];
|
|
21
|
+
if (!entryConnection || entryConnection.toStepId === null) {
|
|
22
|
+
return 0;
|
|
23
|
+
}
|
|
24
|
+
const outgoing = new Map();
|
|
25
|
+
for (const connection of structure.connections) {
|
|
26
|
+
if (connection.fromStepId !== null) {
|
|
27
|
+
outgoing.set(connection.fromStepId, [
|
|
28
|
+
...(outgoing.get(connection.fromStepId) ?? []),
|
|
29
|
+
connection,
|
|
30
|
+
]);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
const candidatesByStepId = new Map();
|
|
34
|
+
for (const [stepId, connections] of outgoing) {
|
|
35
|
+
const candidates = [];
|
|
36
|
+
for (const connection of [...connections].sort(byOrder)) {
|
|
37
|
+
candidates.push(connection.toStepId);
|
|
38
|
+
if (alwaysMatches(connection)) {
|
|
39
|
+
break;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
candidatesByStepId.set(stepId, candidates);
|
|
43
|
+
}
|
|
44
|
+
const memo = new Map();
|
|
45
|
+
const visiting = new Set();
|
|
46
|
+
const costFrom = (stepId) => {
|
|
47
|
+
const step = stepsById.get(stepId);
|
|
48
|
+
if (!step || visiting.has(stepId)) {
|
|
49
|
+
return 0;
|
|
50
|
+
}
|
|
51
|
+
const known = memo.get(stepId);
|
|
52
|
+
if (known !== undefined) {
|
|
53
|
+
return known;
|
|
54
|
+
}
|
|
55
|
+
const isEnabled = step.isEnabled !== false;
|
|
56
|
+
let total = 0;
|
|
57
|
+
if (isEnabled || step.type !== workflow_enum_1.WorkflowStepType.FILTER) {
|
|
58
|
+
visiting.add(stepId);
|
|
59
|
+
const downstream = Math.max(0, ...(candidatesByStepId.get(stepId) ?? []).map((toStepId) => toStepId === null ? 0 : costFrom(toStepId)));
|
|
60
|
+
visiting.delete(stepId);
|
|
61
|
+
total = (isEnabled ? exports.WORKFLOW_STEP_CREDIT_COST[step.type] : 0) + downstream;
|
|
62
|
+
}
|
|
63
|
+
memo.set(stepId, total);
|
|
64
|
+
return total;
|
|
65
|
+
};
|
|
66
|
+
return costFrom(entryConnection.toStepId);
|
|
67
|
+
};
|
|
68
|
+
exports.computeWorkflowMaxCreditCost = computeWorkflowMaxCreditCost;
|
|
69
|
+
//# sourceMappingURL=workflow-credit.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow-credit.utils.js","sourceRoot":"","sources":["../../src/utils/workflow-credit.utils.ts"],"names":[],"mappings":";;;AAAA,+DAA+D;AAMlD,QAAA,yBAAyB,GAA+C,MAAM,CAAC,MAAM,CAAC;IACjG,CAAC,gCAAgB,CAAC,MAAM,CAAC,EAAE,CAAC;IAC5B,CAAC,gCAAgB,CAAC,MAAM,CAAC,EAAE,CAAC;IAC5B,CAAC,gCAAgB,CAAC,KAAK,CAAC,EAAE,CAAC;IAC3B,CAAC,gC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