@hexclave/next 1.0.70 → 1.0.71
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/dist/{admin-app-impl-DFjllAVr.d.ts → admin-app-impl-CBilzmOK.d.ts} +43 -3
- package/dist/admin-app-impl-CBilzmOK.d.ts.map +1 -0
- package/dist/clickmap/clickmap-core.d.ts +1 -1
- package/dist/clickmap/index.d.ts +1 -1
- package/dist/{client-app-CE8FTKgO.d.ts → client-app-DlKeB4SB.d.ts} +41 -2
- package/dist/client-app-DlKeB4SB.d.ts.map +1 -0
- package/dist/components/selected-team-switcher.d.ts +1 -1
- package/dist/components/team-icon.d.ts +1 -1
- package/dist/components/team-switcher.d.ts +1 -1
- package/dist/components-page/account-settings/payments/payments-page.d.ts +1 -1
- package/dist/components-page/account-settings/teams/leave-team-section.d.ts +1 -1
- package/dist/components-page/account-settings/teams/team-api-keys-section.d.ts +1 -1
- package/dist/components-page/account-settings/teams/team-display-name-section.d.ts +1 -1
- package/dist/components-page/account-settings/teams/team-member-invitation-section.d.ts +1 -1
- package/dist/components-page/account-settings/teams/team-member-list-section.d.ts +1 -1
- package/dist/components-page/account-settings/teams/team-page.d.ts +1 -1
- package/dist/components-page/account-settings/teams/team-profile-image-section.d.ts +1 -1
- package/dist/components-page/account-settings/teams/team-profile-user-section.d.ts +1 -1
- package/dist/components-page/hexclave-handler-client.d.ts +1 -1
- package/dist/components-page/hexclave-handler.d.ts +1 -1
- package/dist/dev-tool/dev-tool-core.d.ts +1 -1
- package/dist/dev-tool/index.d.ts +1 -1
- package/dist/esm/generated/quetzal-translations.d.ts +2 -2
- package/dist/esm/lib/hexclave-app/apps/implementations/admin-app-impl.d.ts +40 -0
- package/dist/esm/lib/hexclave-app/apps/implementations/admin-app-impl.d.ts.map +1 -1
- package/dist/esm/lib/hexclave-app/apps/implementations/admin-app-impl.js +102 -0
- package/dist/esm/lib/hexclave-app/apps/implementations/admin-app-impl.js.map +1 -1
- package/dist/esm/lib/hexclave-app/apps/implementations/common.js +2 -2
- package/dist/esm/lib/hexclave-app/apps/implementations/server-app-impl.d.ts +1 -1
- package/dist/esm/lib/hexclave-app/apps/interfaces/admin-app.d.ts +41 -2
- package/dist/esm/lib/hexclave-app/apps/interfaces/admin-app.d.ts.map +1 -1
- package/dist/esm/lib/hexclave-app/apps/interfaces/admin-app.js.map +1 -1
- package/dist/esm/lib/hexclave-app/index.d.ts +2 -1
- package/dist/esm/lib/hexclave-app/workflows.d.ts +125 -0
- package/dist/esm/lib/hexclave-app/workflows.d.ts.map +1 -0
- package/dist/esm/lib/hexclave-app/workflows.js +110 -0
- package/dist/esm/lib/hexclave-app/workflows.js.map +1 -0
- package/dist/esm/lib/hexclave-app/workflows.test.d.ts +1 -0
- package/dist/esm/lib/hexclave-app/workflows.test.js +25 -0
- package/dist/esm/lib/hexclave-app/workflows.test.js.map +1 -0
- package/dist/generated/quetzal-translations.d.ts +1 -1
- package/dist/{hexclave-provider-CVCzN4xG.d.ts → hexclave-provider-DzhHCfqq.d.ts} +3 -3
- package/dist/{hexclave-provider-CVCzN4xG.d.ts.map → hexclave-provider-DzhHCfqq.d.ts.map} +1 -1
- package/dist/{hooks-BNF4UvGF.d.ts → hooks-nHRIrxA9.d.ts} +2 -2
- package/dist/{hooks-BNF4UvGF.d.ts.map → hooks-nHRIrxA9.d.ts.map} +1 -1
- package/dist/{index-g1JoVgIu.d.ts → index-CsExJ_pK.d.ts} +2 -2
- package/dist/{index-g1JoVgIu.d.ts.map → index-CsExJ_pK.d.ts.map} +1 -1
- package/dist/index.d.ts +6 -5
- package/dist/lib/hexclave-app/apps/implementations/admin-app-impl.d.ts +1 -1
- package/dist/lib/hexclave-app/apps/implementations/admin-app-impl.js +102 -0
- package/dist/lib/hexclave-app/apps/implementations/admin-app-impl.js.map +1 -1
- package/dist/lib/hexclave-app/apps/implementations/client-app-impl.d.ts +1 -1
- package/dist/lib/hexclave-app/apps/implementations/common.js +2 -2
- package/dist/lib/hexclave-app/apps/implementations/index.d.ts +1 -1
- package/dist/lib/hexclave-app/apps/implementations/server-app-impl.d.ts +1 -1
- package/dist/lib/hexclave-app/apps/index.d.ts +1 -1
- package/dist/lib/hexclave-app/apps/interfaces/admin-app.d.ts +3 -2
- package/dist/lib/hexclave-app/apps/interfaces/admin-app.js.map +1 -1
- package/dist/lib/hexclave-app/apps/interfaces/client-app.d.ts +1 -1
- package/dist/lib/hexclave-app/apps/interfaces/server-app.d.ts +1 -1
- package/dist/lib/hexclave-app/index.d.ts +3 -2
- package/dist/lib/hexclave-app/projects/index.d.ts +1 -1
- package/dist/lib/hexclave-app/teams/index.d.ts +1 -1
- package/dist/lib/hexclave-app/users/index.d.ts +1 -1
- package/dist/lib/hexclave-app/workflows.d.ts +2 -0
- package/dist/lib/hexclave-app/workflows.js +116 -0
- package/dist/lib/hexclave-app/workflows.js.map +1 -0
- package/dist/lib/hexclave-app/workflows.test.d.ts +1 -0
- package/dist/lib/hexclave-app/workflows.test.js +24 -0
- package/dist/lib/hexclave-app/workflows.test.js.map +1 -0
- package/dist/lib/hooks.d.ts +1 -1
- package/dist/providers/hexclave-context.d.ts +1 -1
- package/dist/providers/hexclave-provider-client.d.ts +1 -1
- package/dist/providers/hexclave-provider.d.ts +1 -1
- package/dist/providers/translation-provider.d.ts +1 -1
- package/dist/pushed-config-error-overlay/index.d.ts +1 -1
- package/dist/{quetzal-translations-DVNj-zsr.d.ts → quetzal-translations-BT1HrUsA.d.ts} +3 -3
- package/dist/{quetzal-translations-DVNj-zsr.d.ts.map → quetzal-translations-BT1HrUsA.d.ts.map} +1 -1
- package/dist/{translation-provider-DPFkLbrw.d.ts → translation-provider-C1wy92m_.d.ts} +2 -2
- package/dist/{translation-provider-DPFkLbrw.d.ts.map → translation-provider-C1wy92m_.d.ts.map} +1 -1
- package/dist/workflows-DEb7pIuQ.d.ts +125 -0
- package/dist/workflows-DEb7pIuQ.d.ts.map +1 -0
- package/package.json +4 -4
- package/src/lib/hexclave-app/apps/implementations/admin-app-impl.ts +123 -0
- package/src/lib/hexclave-app/apps/interfaces/admin-app.ts +19 -0
- package/src/lib/hexclave-app/index.ts +15 -0
- package/src/lib/hexclave-app/workflows.test.ts +28 -0
- package/src/lib/hexclave-app/workflows.ts +245 -0
- package/dist/admin-app-impl-DFjllAVr.d.ts.map +0 -1
- package/dist/client-app-CE8FTKgO.d.ts.map +0 -1
package/dist/{quetzal-translations-DVNj-zsr.d.ts.map → quetzal-translations-BT1HrUsA.d.ts.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quetzal-translations-
|
|
1
|
+
{"version":3,"file":"quetzal-translations-BT1HrUsA.d.ts","names":[],"sources":["../src/generated/quetzal-translations.ts"],"mappings":";cAUa,WAAA,EAAW,GAAA;AAAA,cAqTX,cAAA,EAAc,GAAA,mIAAA,GAAA,66qBAAA,GAAA,usnBAAA,GAAA,iyrBAAA,GAAA,g+qBAAA,GAAA,8srBAAA,GAAA,2trBAAA,GAAA,41pBAAA,GAAA,m3eAAA,GAAA,oreAAA,GAAA,swpBAAA,GAAA,+0qBAAA,GAAA,8wbAAA,GAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as quetzalLocales } from "./quetzal-translations-
|
|
1
|
+
import { n as quetzalLocales } from "./quetzal-translations-BT1HrUsA.js";
|
|
2
2
|
|
|
3
3
|
//#region src/providers/translation-provider.d.ts
|
|
4
4
|
declare function TranslationProvider({
|
|
@@ -12,4 +12,4 @@ declare function TranslationProvider({
|
|
|
12
12
|
}): import("react/jsx-runtime").JSX.Element;
|
|
13
13
|
//#endregion
|
|
14
14
|
export { TranslationProvider as t };
|
|
15
|
-
//# sourceMappingURL=translation-provider-
|
|
15
|
+
//# sourceMappingURL=translation-provider-C1wy92m_.d.ts.map
|
package/dist/{translation-provider-DPFkLbrw.d.ts.map → translation-provider-C1wy92m_.d.ts.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translation-provider-
|
|
1
|
+
{"version":3,"file":"translation-provider-C1wy92m_.d.ts","names":[],"sources":["../src/providers/translation-provider.tsx"],"mappings":";;;iBAQgB,mBAAA;EAAsB,IAAA;EAAM,oBAAA;EAAsB;AAAA;EAChE,IAAA,EAAM,UAAA,QAAkB,cAAA,CAAe,GAAA;EACvC,oBAAA,GAAuB,MAAA;EACvB,QAAA,EAAU,KAAA,CAAM,SAAA;AAAA,gCACjB,GAAA,CAAA,OAAA"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { WorkflowDivergenceDiagnosticJson, WorkflowRunDetailsJson, WorkflowRunJson, WorkflowSummaryJson, WorkflowSyncResultJson, WorkflowVersionJson } from "@hexclave/shared/dist/interface/workflows";
|
|
2
|
+
|
|
3
|
+
//#region src/lib/hexclave-app/workflows.d.ts
|
|
4
|
+
type AdminWorkflowTrigger = {
|
|
5
|
+
type: "event";
|
|
6
|
+
eventType: string;
|
|
7
|
+
} | {
|
|
8
|
+
type: "schedule";
|
|
9
|
+
cron: string;
|
|
10
|
+
timezone: string;
|
|
11
|
+
};
|
|
12
|
+
type AdminWorkflow = {
|
|
13
|
+
id: string;
|
|
14
|
+
displayName: string;
|
|
15
|
+
latestVersion: number;
|
|
16
|
+
triggers: AdminWorkflowTrigger[];
|
|
17
|
+
stats: {
|
|
18
|
+
activeRuns: number;
|
|
19
|
+
sleepingRuns: number;
|
|
20
|
+
failed7d: number;
|
|
21
|
+
runVolume14d: number[];
|
|
22
|
+
};
|
|
23
|
+
createdAtMillis: number;
|
|
24
|
+
lastDeployedAtMillis: number;
|
|
25
|
+
};
|
|
26
|
+
type AdminWorkflowRunState = "queued" | "running" | "sleeping" | "completed" | "failed" | "canceled";
|
|
27
|
+
type AdminWorkflowDivergenceDiagnostic = {
|
|
28
|
+
reason: WorkflowDivergenceDiagnosticJson["reason"];
|
|
29
|
+
suspendedStepKey: string | null;
|
|
30
|
+
foundStepKey: string | null;
|
|
31
|
+
consumedStepKeys: string[];
|
|
32
|
+
unconsumedStepKeys: string[];
|
|
33
|
+
details: string;
|
|
34
|
+
};
|
|
35
|
+
type AdminWorkflowRun = {
|
|
36
|
+
id: string;
|
|
37
|
+
workflowId: string;
|
|
38
|
+
runKey: string | null;
|
|
39
|
+
state: AdminWorkflowRunState;
|
|
40
|
+
version: number;
|
|
41
|
+
triggerType: string;
|
|
42
|
+
triggerSummary: string;
|
|
43
|
+
currentStepId: string | null;
|
|
44
|
+
stepsRecorded: number;
|
|
45
|
+
errorSummary: string | null;
|
|
46
|
+
failureKind: "user" | "platform" | null;
|
|
47
|
+
lastUpgradeDivergence: AdminWorkflowDivergenceDiagnostic | null;
|
|
48
|
+
createdAtMillis: number;
|
|
49
|
+
completedAtMillis: number | null;
|
|
50
|
+
nextWakeAtMillis: number | null;
|
|
51
|
+
};
|
|
52
|
+
type AdminWorkflowStep = {
|
|
53
|
+
stepKey: string;
|
|
54
|
+
stepId: string;
|
|
55
|
+
kind: "run" | "sleep";
|
|
56
|
+
result: unknown;
|
|
57
|
+
resultSizeBytes: number;
|
|
58
|
+
attempts: number;
|
|
59
|
+
executedAtVersion: number;
|
|
60
|
+
elapsedMs: number | null;
|
|
61
|
+
createdAtMillis: number;
|
|
62
|
+
};
|
|
63
|
+
type AdminWorkflowStepAttempt = {
|
|
64
|
+
stepKey: string;
|
|
65
|
+
stepId: string; /** 0 for the original execution; incremented by each manual retry of the run. */
|
|
66
|
+
retryEpoch: number;
|
|
67
|
+
attempt: number;
|
|
68
|
+
outcome: "succeeded" | "failed";
|
|
69
|
+
error: {
|
|
70
|
+
name: string;
|
|
71
|
+
message: string;
|
|
72
|
+
stack?: string;
|
|
73
|
+
} | null;
|
|
74
|
+
failureKind: "user" | "platform" | null;
|
|
75
|
+
logs: string | null;
|
|
76
|
+
startedAtMillis: number;
|
|
77
|
+
finishedAtMillis: number;
|
|
78
|
+
};
|
|
79
|
+
type AdminWorkflowRunDetails = AdminWorkflowRun & {
|
|
80
|
+
triggerPayload: unknown;
|
|
81
|
+
steps: AdminWorkflowStep[];
|
|
82
|
+
stepAttempts: AdminWorkflowStepAttempt[];
|
|
83
|
+
};
|
|
84
|
+
type AdminWorkflowVersion = {
|
|
85
|
+
workflowId: string;
|
|
86
|
+
version: number;
|
|
87
|
+
sourceHash: string;
|
|
88
|
+
source: string;
|
|
89
|
+
runtimeEnvVersion: string;
|
|
90
|
+
isLatest: boolean;
|
|
91
|
+
inFlightRuns: number;
|
|
92
|
+
createdAtMillis: number;
|
|
93
|
+
};
|
|
94
|
+
type AdminWorkflowSyncResult = {
|
|
95
|
+
workflowId: string;
|
|
96
|
+
version: number;
|
|
97
|
+
created: boolean;
|
|
98
|
+
inFlightRunsOnOlderVersions: number;
|
|
99
|
+
};
|
|
100
|
+
type AdminWorkflowUpgradeResult = {
|
|
101
|
+
upgradedCount: number;
|
|
102
|
+
skipped: {
|
|
103
|
+
runId: string;
|
|
104
|
+
runKey: string | null;
|
|
105
|
+
fromVersion: number;
|
|
106
|
+
diagnostic: AdminWorkflowDivergenceDiagnostic;
|
|
107
|
+
}[];
|
|
108
|
+
};
|
|
109
|
+
type AdminWorkflowRunsFilter = {
|
|
110
|
+
state?: AdminWorkflowRunState;
|
|
111
|
+
version?: number;
|
|
112
|
+
runKey?: string;
|
|
113
|
+
cursor?: string;
|
|
114
|
+
limit?: number; /** Include each run's memoized steps and attempt history. */
|
|
115
|
+
includeState?: boolean;
|
|
116
|
+
};
|
|
117
|
+
declare function adminWorkflowFromCrud(crud: WorkflowSummaryJson): AdminWorkflow;
|
|
118
|
+
declare function adminWorkflowRunFromCrud(crud: WorkflowRunJson): AdminWorkflowRun;
|
|
119
|
+
declare function isWorkflowRunDetailsJson(crud: WorkflowRunJson): crud is WorkflowRunDetailsJson;
|
|
120
|
+
declare function adminWorkflowRunDetailsFromCrud(crud: WorkflowRunDetailsJson): AdminWorkflowRunDetails;
|
|
121
|
+
declare function adminWorkflowVersionFromCrud(crud: WorkflowVersionJson): AdminWorkflowVersion;
|
|
122
|
+
declare function adminWorkflowSyncResultFromCrud(crud: WorkflowSyncResultJson): AdminWorkflowSyncResult;
|
|
123
|
+
//#endregion
|
|
124
|
+
export { adminWorkflowVersionFromCrud as _, AdminWorkflowRunState as a, AdminWorkflowStepAttempt as c, AdminWorkflowUpgradeResult as d, AdminWorkflowVersion as f, adminWorkflowSyncResultFromCrud as g, adminWorkflowRunFromCrud as h, AdminWorkflowRunDetails as i, AdminWorkflowSyncResult as l, adminWorkflowRunDetailsFromCrud as m, AdminWorkflowDivergenceDiagnostic as n, AdminWorkflowRunsFilter as o, adminWorkflowFromCrud as p, AdminWorkflowRun as r, AdminWorkflowStep as s, AdminWorkflow as t, AdminWorkflowTrigger as u, isWorkflowRunDetailsJson as v };
|
|
125
|
+
//# sourceMappingURL=workflows-DEb7pIuQ.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflows-DEb7pIuQ.d.ts","names":[],"sources":["../src/lib/hexclave-app/workflows.ts"],"mappings":";;;KAiBY,oBAAA;EACN,IAAA;EAAe,SAAA;AAAA;EACf,IAAA;EAAkB,IAAA;EAAc,QAAA;AAAA;AAAA,KAE1B,aAAA;EACV,EAAA;EACA,WAAA;EACA,aAAA;EACA,QAAA,EAAU,oBAAoB;EAC9B,KAAA;IACE,UAAA;IACA,YAAA;IACA,QAAA;IACA,YAAA;EAAA;EAEF,eAAA;EACA,oBAAA;AAAA;AAAA,KAGU,qBAAA;AAAA,KAEA,iCAAA;EACV,MAAA,EAAQ,gCAAgC;EACxC,gBAAA;EACA,YAAA;EACA,gBAAA;EACA,kBAAA;EACA,OAAA;AAAA;AAAA,KAGU,gBAAA;EACV,EAAA;EACA,UAAA;EACA,MAAA;EACA,KAAA,EAAO,qBAAA;EACP,OAAA;EACA,WAAA;EACA,cAAA;EACA,aAAA;EACA,aAAA;EACA,YAAA;EACA,WAAA;EACA,qBAAA,EAAuB,iCAAiC;EACxD,eAAA;EACA,iBAAA;EACA,gBAAA;AAAA;AAAA,KAGU,iBAAA;EACV,OAAA;EACA,MAAA;EACA,IAAA;EACA,MAAA;EACA,eAAA;EACA,QAAA;EACA,iBAAA;EACA,SAAA;EACA,eAAA;AAAA;AAAA,KAGU,wBAAA;EACV,OAAA;EACA,MAAA,UAvBA;EAyBA,UAAA;EACA,OAAA;EACA,OAAA;EACA,KAAA;IAAS,IAAA;IAAc,OAAA;IAAiB,KAAA;EAAA;EACxC,WAAA;EACA,IAAA;EACA,eAAA;EACA,gBAAA;AAAA;AAAA,KAGU,uBAAA,GAA0B,gBAAA;EACpC,cAAA;EACA,KAAA,EAAO,iBAAA;EACP,YAAA,EAAc,wBAAA;AAAA;AAAA,KAGJ,oBAAA;EACV,UAAA;EACA,OAAA;EACA,UAAA;EACA,MAAA;EACA,iBAAA;EACA,QAAA;EACA,YAAA;EACA,eAAA;AAAA;AAAA,KAGU,uBAAA;EACV,UAAA;EACA,OAAA;EACA,OAAA;EACA,2BAAA;AAAA;AAAA,KAGU,0BAAA;EACV,aAAA;EACA,OAAA;IACE,KAAA;IACA,MAAA;IACA,WAAA;IACA,UAAA,EAAY,iCAAiC;EAAA;AAAA;AAAA,KAIrC,uBAAA;EACV,KAAA,GAAQ,qBAAqB;EAC7B,OAAA;EACA,MAAA;EACA,MAAA;EACA,KAAA,WApCsC;EAsCtC,YAAA;AAAA;AAAA,iBAGc,qBAAA,CAAsB,IAAA,EAAM,mBAAA,GAAsB,aAAa;AAAA,iBA+B/D,wBAAA,CAAyB,IAAA,EAAM,eAAA,GAAkB,gBAAgB;AAAA,iBAoBjE,wBAAA,CAAyB,IAAA,EAAM,eAAA,GAAkB,IAAA,IAAQ,sBAAsB;AAAA,iBAQ/E,+BAAA,CAAgC,IAAA,EAAM,sBAAA,GAAyB,uBAAuB;AAAA,iBA8BtF,4BAAA,CAA6B,IAAA,EAAM,mBAAA,GAAsB,oBAAoB;AAAA,iBAa7E,+BAAA,CAAgC,IAAA,EAAM,sBAAA,GAAyB,uBAAuB"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"//": "THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY UNLESS YOU ALSO EDIT THE CORRESPONDING FILE IN packages/template (FOR package.json FILES, PLEASE EDIT package-template.json)",
|
|
3
3
|
"name": "@hexclave/next",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.71",
|
|
5
5
|
"repository": "https://github.com/hexclave/hexclave",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"main": "./dist/index.js",
|
|
@@ -74,9 +74,9 @@
|
|
|
74
74
|
"tailwindcss-animate": "^1.0.7",
|
|
75
75
|
"rrweb": "^1.1.3",
|
|
76
76
|
"yup": "^1.7.1",
|
|
77
|
-
"@hexclave/sc": "1.0.
|
|
78
|
-
"@hexclave/shared": "1.0.
|
|
79
|
-
"@hexclave/ui": "1.0.
|
|
77
|
+
"@hexclave/sc": "1.0.71",
|
|
78
|
+
"@hexclave/shared": "1.0.71",
|
|
79
|
+
"@hexclave/ui": "1.0.71"
|
|
80
80
|
},
|
|
81
81
|
"peerDependencies": {
|
|
82
82
|
"@types/react": ">=18.0.0",
|
|
@@ -26,6 +26,7 @@ import { AdminProjectPermission, AdminProjectPermissionDefinition, AdminProjectP
|
|
|
26
26
|
import type { PlanUsage } from "../../plan-usage";
|
|
27
27
|
import { AdminOwnedProject, AdminProject, AdminProjectUpdateOptions, PushConfigOptions, adminProjectUpdateOptionsToCrud } from "../../projects";
|
|
28
28
|
import type { AdminSessionReplay, AdminSessionReplayChunk, ListSessionReplayChunksOptions, ListSessionReplayChunksResult, ListSessionReplaysOptions, ListSessionReplaysResult, SessionReplayAllEventsResult } from "../../session-replays";
|
|
29
|
+
import { AdminWorkflow, AdminWorkflowRun, AdminWorkflowRunDetails, AdminWorkflowRunsFilter, AdminWorkflowSyncResult, AdminWorkflowUpgradeResult, AdminWorkflowVersion, adminWorkflowFromCrud, adminWorkflowRunDetailsFromCrud, adminWorkflowRunFromCrud, adminWorkflowSyncResultFromCrud, adminWorkflowVersionFromCrud, isWorkflowRunDetailsJson } from "../../workflows";
|
|
29
30
|
import { ManagedEmailProviderListItem, ManagedEmailProviderSetupResult, ManagedEmailProviderStatus, EmailOutboxUpdateOptions, StackAdminApp, StackAdminAppConstructorOptions } from "../interfaces/admin-app";
|
|
30
31
|
import { clientVersion, createCache, getDefaultExtraRequestHeaders, getDefaultProjectId, getDefaultPublishableClientKey, getDefaultSecretServerKey, getDefaultSuperSecretAdminKey, resolveApiUrls, resolveConstructorOptions } from "./common";
|
|
31
32
|
import { _HexclaveServerAppImplIncomplete } from "./server-app-impl";
|
|
@@ -99,6 +100,9 @@ export class _HexclaveAdminAppImplIncomplete<HasTokenStore extends boolean, Proj
|
|
|
99
100
|
private readonly _adminEmailDraftsCache = createCache(async () => {
|
|
100
101
|
return await this._interface.listInternalEmailDrafts();
|
|
101
102
|
});
|
|
103
|
+
private readonly _adminWorkflowsCache = createCache(async () => {
|
|
104
|
+
return await this._interface.listWorkflows();
|
|
105
|
+
});
|
|
102
106
|
private readonly _adminTeamPermissionDefinitionsCache = createCache(async () => {
|
|
103
107
|
return await this._interface.listTeamPermissionDefinitions();
|
|
104
108
|
});
|
|
@@ -517,6 +521,10 @@ export class _HexclaveAdminAppImplIncomplete<HasTokenStore extends boolean, Proj
|
|
|
517
521
|
}));
|
|
518
522
|
}, [crud]);
|
|
519
523
|
}
|
|
524
|
+
useWorkflows(): AdminWorkflow[] {
|
|
525
|
+
const crud = useAsyncCache(this._adminWorkflowsCache, [], "adminApp.useWorkflows()");
|
|
526
|
+
return useMemo(() => crud.map(adminWorkflowFromCrud), [crud]);
|
|
527
|
+
}
|
|
520
528
|
async listEmailThemes(): Promise<{ id: string, displayName: string }[]> {
|
|
521
529
|
const crud = Result.orThrow(await this._adminEmailThemesCache.getOrWait([], "write-only"));
|
|
522
530
|
return crud.map((theme) => ({
|
|
@@ -535,6 +543,121 @@ export class _HexclaveAdminAppImplIncomplete<HasTokenStore extends boolean, Proj
|
|
|
535
543
|
}));
|
|
536
544
|
}
|
|
537
545
|
|
|
546
|
+
// ─── Workflows (internal-project gated; see the Workflows v1 spec) ───────
|
|
547
|
+
|
|
548
|
+
async listWorkflows(): Promise<AdminWorkflow[]> {
|
|
549
|
+
const crud = Result.orThrow(await this._adminWorkflowsCache.getOrWait([], "write-only"));
|
|
550
|
+
return crud.map(adminWorkflowFromCrud);
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
async createWorkflow(options: { id: string, displayName?: string, source: string }): Promise<AdminWorkflowSyncResult> {
|
|
554
|
+
const result = await this._interface.createWorkflow({
|
|
555
|
+
id: options.id,
|
|
556
|
+
display_name: options.displayName,
|
|
557
|
+
source: options.source,
|
|
558
|
+
});
|
|
559
|
+
await this._adminWorkflowsCache.refresh([]);
|
|
560
|
+
return adminWorkflowSyncResultFromCrud(result);
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
async updateWorkflowSource(workflowId: string, source: string): Promise<AdminWorkflowSyncResult> {
|
|
564
|
+
const result = await this._interface.updateWorkflowSource(workflowId, source);
|
|
565
|
+
await this._adminWorkflowsCache.refresh([]);
|
|
566
|
+
return adminWorkflowSyncResultFromCrud(result);
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
async deleteWorkflow(workflowId: string): Promise<void> {
|
|
570
|
+
await this._interface.deleteWorkflow(workflowId);
|
|
571
|
+
await this._adminWorkflowsCache.refresh([]);
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
async listWorkflowVersions(workflowId: string): Promise<AdminWorkflowVersion[]> {
|
|
575
|
+
return (await this._interface.listWorkflowVersions(workflowId)).map(adminWorkflowVersionFromCrud);
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
async listWorkflowRuns(workflowId: string, filter: AdminWorkflowRunsFilter & { includeState: true }): Promise<{ runs: AdminWorkflowRunDetails[], nextCursor: string | null }>;
|
|
579
|
+
async listWorkflowRuns(workflowId: string, filter?: AdminWorkflowRunsFilter): Promise<{ runs: AdminWorkflowRun[], nextCursor: string | null }>;
|
|
580
|
+
async listWorkflowRuns(workflowId: string, filter: AdminWorkflowRunsFilter = {}): Promise<{ runs: AdminWorkflowRun[], nextCursor: string | null }> {
|
|
581
|
+
if (filter.includeState === true) {
|
|
582
|
+
const result = await this._interface.listWorkflowRuns(workflowId, {
|
|
583
|
+
state: filter.state,
|
|
584
|
+
version: filter.version,
|
|
585
|
+
run_key: filter.runKey,
|
|
586
|
+
cursor: filter.cursor,
|
|
587
|
+
limit: filter.limit,
|
|
588
|
+
include_state: true,
|
|
589
|
+
});
|
|
590
|
+
return {
|
|
591
|
+
runs: result.runs.map((run) => adminWorkflowRunDetailsFromCrud(
|
|
592
|
+
isWorkflowRunDetailsJson(run)
|
|
593
|
+
? run
|
|
594
|
+
: throwErr("Workflow runs response omitted state after include_state=true"),
|
|
595
|
+
)),
|
|
596
|
+
nextCursor: result.next_cursor,
|
|
597
|
+
};
|
|
598
|
+
}
|
|
599
|
+
const result = await this._interface.listWorkflowRuns(workflowId, {
|
|
600
|
+
state: filter.state,
|
|
601
|
+
version: filter.version,
|
|
602
|
+
run_key: filter.runKey,
|
|
603
|
+
cursor: filter.cursor,
|
|
604
|
+
limit: filter.limit,
|
|
605
|
+
});
|
|
606
|
+
return {
|
|
607
|
+
runs: result.runs.map(adminWorkflowRunFromCrud),
|
|
608
|
+
nextCursor: result.next_cursor,
|
|
609
|
+
};
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
async getWorkflowRun(runId: string): Promise<AdminWorkflowRunDetails> {
|
|
613
|
+
return adminWorkflowRunDetailsFromCrud(await this._interface.getWorkflowRun(runId));
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
async cancelWorkflowRuns(workflowId: string, filter: { runKey?: string, runId?: string, state?: "queued" | "running" | "sleeping", version?: number } = {}): Promise<{ canceledCount: number }> {
|
|
617
|
+
const result = await this._interface.cancelWorkflowRuns(workflowId, {
|
|
618
|
+
run_key: filter.runKey,
|
|
619
|
+
run_id: filter.runId,
|
|
620
|
+
state: filter.state,
|
|
621
|
+
version: filter.version,
|
|
622
|
+
});
|
|
623
|
+
await this._adminWorkflowsCache.refresh([]);
|
|
624
|
+
return { canceledCount: result.canceled_count };
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
async upgradeWorkflowRuns(workflowId: string, options: { toVersion: number, runKey?: string, fromVersion?: number }): Promise<AdminWorkflowUpgradeResult> {
|
|
628
|
+
const result = await this._interface.upgradeWorkflowRuns(workflowId, {
|
|
629
|
+
to_version: options.toVersion,
|
|
630
|
+
run_key: options.runKey,
|
|
631
|
+
from_version: options.fromVersion,
|
|
632
|
+
});
|
|
633
|
+
return {
|
|
634
|
+
upgradedCount: result.upgraded_count,
|
|
635
|
+
skipped: result.skipped.map((skip) => ({
|
|
636
|
+
runId: skip.run_id,
|
|
637
|
+
runKey: skip.run_key,
|
|
638
|
+
fromVersion: skip.from_version,
|
|
639
|
+
diagnostic: {
|
|
640
|
+
reason: skip.diagnostic.reason,
|
|
641
|
+
suspendedStepKey: skip.diagnostic.suspended_step_key,
|
|
642
|
+
foundStepKey: skip.diagnostic.found_step_key,
|
|
643
|
+
consumedStepKeys: skip.diagnostic.consumed_step_keys,
|
|
644
|
+
unconsumedStepKeys: skip.diagnostic.unconsumed_step_keys,
|
|
645
|
+
details: skip.diagnostic.details,
|
|
646
|
+
},
|
|
647
|
+
})),
|
|
648
|
+
};
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
async retryWorkflowRun(runId: string): Promise<void> {
|
|
652
|
+
await this._interface.retryWorkflowRun(runId);
|
|
653
|
+
await this._adminWorkflowsCache.refresh([]);
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
async sendWorkflowEvent(name: string, data?: unknown): Promise<{ eventId: string }> {
|
|
657
|
+
const result = await this._interface.sendWorkflowEvent(name, data ?? null);
|
|
658
|
+
return { eventId: result.event_id };
|
|
659
|
+
}
|
|
660
|
+
|
|
538
661
|
async listEmailDrafts(): Promise<{ id: string, displayName: string, themeId: string | undefined | false, tsxSource: string, sentAt: Date | null }[]> {
|
|
539
662
|
const crud = Result.orThrow(await this._adminEmailDraftsCache.getOrWait([], "write-only"));
|
|
540
663
|
return crud.map((draft) => ({
|
|
@@ -14,6 +14,7 @@ import { InternalApiKey, InternalApiKeyCreateOptions, InternalApiKeyFirstView }
|
|
|
14
14
|
import { AdminProjectPermission, AdminProjectPermissionDefinition, AdminProjectPermissionDefinitionCreateOptions, AdminProjectPermissionDefinitionUpdateOptions, AdminTeamPermission, AdminTeamPermissionDefinition, AdminTeamPermissionDefinitionCreateOptions, AdminTeamPermissionDefinitionUpdateOptions } from "../../permissions";
|
|
15
15
|
import type { PlanUsage } from "../../plan-usage";
|
|
16
16
|
import { AdminProject } from "../../projects";
|
|
17
|
+
import type { AdminWorkflow, AdminWorkflowRun, AdminWorkflowRunDetails, AdminWorkflowRunsFilter, AdminWorkflowSyncResult, AdminWorkflowUpgradeResult, AdminWorkflowVersion } from "../../workflows";
|
|
17
18
|
import { _HexclaveAdminAppImpl } from "../implementations";
|
|
18
19
|
import { StackServerApp, StackServerAppConstructorOptions } from "./server-app";
|
|
19
20
|
|
|
@@ -60,6 +61,7 @@ export type ManagedEmailProviderListItem = {
|
|
|
60
61
|
|
|
61
62
|
import type { AdminSessionReplay, ListSessionReplayChunksOptions, ListSessionReplayChunksResult, ListSessionReplaysOptions, ListSessionReplaysResult, SessionReplayAllEventsResult } from "../../session-replays";
|
|
62
63
|
export type { AdminSessionReplay, AdminSessionReplayChunk, ListSessionReplaysOptions, ListSessionReplaysResult, ListSessionReplayChunksOptions, ListSessionReplayChunksResult, SessionReplayAllEventsResult } from "../../session-replays";
|
|
64
|
+
export type { AdminWorkflow, AdminWorkflowDivergenceDiagnostic, AdminWorkflowRun, AdminWorkflowRunDetails, AdminWorkflowRunsFilter, AdminWorkflowRunState, AdminWorkflowStep, AdminWorkflowStepAttempt, AdminWorkflowSyncResult, AdminWorkflowTrigger, AdminWorkflowUpgradeResult, AdminWorkflowVersion } from "../../workflows";
|
|
63
65
|
|
|
64
66
|
|
|
65
67
|
/** @deprecated Use `HexclaveAdminAppConstructorOptions` from the `@hexclave/*` package instead — same symbol, new brand name. See https://docs.hexclave.com/migration. */
|
|
@@ -84,6 +86,7 @@ export type StackAdminApp<HasTokenStore extends boolean = boolean, ProjectId ext
|
|
|
84
86
|
& AsyncStoreProperty<"emailPreviewWithEditableMarkers", [{ themeId?: string | null | false, themeTsxSource?: string, templateId?: string, templateTsxSource?: string, editableSource?: 'template' | 'theme' | 'both' }], { html: string, editableRegions?: Record<string, unknown> }, false> // THIS_LINE_PLATFORM react-like
|
|
85
87
|
& AsyncStoreProperty<"emailTemplates", [], { id: string, displayName: string, themeId?: string, tsxSource: string }[], true>
|
|
86
88
|
& AsyncStoreProperty<"emailDrafts", [], { id: string, displayName: string, themeId: string | undefined | false, tsxSource: string, sentAt: Date | null }[], true>
|
|
89
|
+
& AsyncStoreProperty<"workflows", [], AdminWorkflow[], true>
|
|
87
90
|
& AsyncStoreProperty<"stripeAccountInfo", [], { account_id: string, charges_enabled: boolean, details_submitted: boolean, payouts_enabled: boolean } | null, false>
|
|
88
91
|
& AsyncStoreProperty<
|
|
89
92
|
"transactions",
|
|
@@ -141,6 +144,22 @@ export type StackAdminApp<HasTokenStore extends boolean = boolean, ProjectId ext
|
|
|
141
144
|
createEmailTemplate(displayName: string): Promise<{ id: string }>,
|
|
142
145
|
deleteEmailTemplate(id: string): Promise<void>,
|
|
143
146
|
|
|
147
|
+
// Workflows (internal-project gated; see the Workflows v1 spec). The
|
|
148
|
+
// management verbs live on the admin app only in v1.
|
|
149
|
+
createWorkflow(options: { id: string, displayName?: string, source: string }): Promise<AdminWorkflowSyncResult>,
|
|
150
|
+
updateWorkflowSource(workflowId: string, source: string): Promise<AdminWorkflowSyncResult>,
|
|
151
|
+
deleteWorkflow(workflowId: string): Promise<void>,
|
|
152
|
+
listWorkflowVersions(workflowId: string): Promise<AdminWorkflowVersion[]>,
|
|
153
|
+
listWorkflowRuns: {
|
|
154
|
+
(workflowId: string, filter: AdminWorkflowRunsFilter & { includeState: true }): Promise<{ runs: AdminWorkflowRunDetails[], nextCursor: string | null }>,
|
|
155
|
+
(workflowId: string, filter?: AdminWorkflowRunsFilter): Promise<{ runs: AdminWorkflowRun[], nextCursor: string | null }>,
|
|
156
|
+
},
|
|
157
|
+
getWorkflowRun(runId: string): Promise<AdminWorkflowRunDetails>,
|
|
158
|
+
cancelWorkflowRuns(workflowId: string, filter?: { runKey?: string, runId?: string, state?: "queued" | "running" | "sleeping", version?: number }): Promise<{ canceledCount: number }>,
|
|
159
|
+
upgradeWorkflowRuns(workflowId: string, options: { toVersion: number, runKey?: string, fromVersion?: number }): Promise<AdminWorkflowUpgradeResult>,
|
|
160
|
+
retryWorkflowRun(runId: string): Promise<void>,
|
|
161
|
+
sendWorkflowEvent(name: string, data?: unknown): Promise<{ eventId: string }>,
|
|
162
|
+
|
|
144
163
|
setupPayments(): Promise<{ url: string }>,
|
|
145
164
|
createStripeWidgetAccountSession(): Promise<{ client_secret: string }>,
|
|
146
165
|
getPaymentMethodConfigs(): Promise<{ configId: string, methods: Array<{ id: string, name: string, enabled: boolean, available: boolean, overridable: boolean }> } | null>,
|
|
@@ -45,6 +45,21 @@ export type {
|
|
|
45
45
|
EmailOutboxUpdateOptions
|
|
46
46
|
} from "./apps/interfaces/admin-app";
|
|
47
47
|
|
|
48
|
+
export type {
|
|
49
|
+
AdminWorkflow,
|
|
50
|
+
AdminWorkflowDivergenceDiagnostic,
|
|
51
|
+
AdminWorkflowRun,
|
|
52
|
+
AdminWorkflowRunDetails,
|
|
53
|
+
AdminWorkflowRunsFilter,
|
|
54
|
+
AdminWorkflowRunState,
|
|
55
|
+
AdminWorkflowStep,
|
|
56
|
+
AdminWorkflowStepAttempt,
|
|
57
|
+
AdminWorkflowSyncResult,
|
|
58
|
+
AdminWorkflowTrigger,
|
|
59
|
+
AdminWorkflowUpgradeResult,
|
|
60
|
+
AdminWorkflowVersion
|
|
61
|
+
} from "./workflows";
|
|
62
|
+
|
|
48
63
|
export type {
|
|
49
64
|
ProjectConfig
|
|
50
65
|
} from "./project-configs";
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
|
|
2
|
+
//===========================================
|
|
3
|
+
// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY UNLESS YOU ALSO EDIT THE CORRESPONDING FILE IN packages/template
|
|
4
|
+
//===========================================
|
|
5
|
+
import type { WorkflowVersionJson } from "@hexclave/shared/dist/interface/workflows";
|
|
6
|
+
import { describe, expect, it } from "vitest";
|
|
7
|
+
import { adminWorkflowVersionFromCrud } from "./workflows";
|
|
8
|
+
|
|
9
|
+
describe("adminWorkflowVersionFromCrud", () => {
|
|
10
|
+
it("preserves the deployment source hash", () => {
|
|
11
|
+
const version: WorkflowVersionJson = {
|
|
12
|
+
workflow_id: "daily-report",
|
|
13
|
+
version: 3,
|
|
14
|
+
source: "export default 1",
|
|
15
|
+
source_hash: "0123456789abcdef",
|
|
16
|
+
runtime_env_version: "v1",
|
|
17
|
+
is_latest: true,
|
|
18
|
+
in_flight_runs: 2,
|
|
19
|
+
created_at_millis: 1234,
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
expect(adminWorkflowVersionFromCrud(version)).toMatchObject({
|
|
23
|
+
workflowId: "daily-report",
|
|
24
|
+
version: 3,
|
|
25
|
+
sourceHash: "0123456789abcdef",
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
});
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
|
|
2
|
+
//===========================================
|
|
3
|
+
// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY UNLESS YOU ALSO EDIT THE CORRESPONDING FILE IN packages/template
|
|
4
|
+
//===========================================
|
|
5
|
+
import type {
|
|
6
|
+
WorkflowDivergenceDiagnosticJson,
|
|
7
|
+
WorkflowRunDetailsJson,
|
|
8
|
+
WorkflowRunJson,
|
|
9
|
+
WorkflowSummaryJson,
|
|
10
|
+
WorkflowSyncResultJson,
|
|
11
|
+
WorkflowVersionJson,
|
|
12
|
+
} from "@hexclave/shared/dist/interface/workflows";
|
|
13
|
+
|
|
14
|
+
// SDK-side (camelCase) types + converters for the workflows admin surface.
|
|
15
|
+
// The wire types live in @hexclave/shared/dist/interface/workflows; these
|
|
16
|
+
// mirror them 1:1 so the dashboard never touches snake_case.
|
|
17
|
+
|
|
18
|
+
export type AdminWorkflowTrigger =
|
|
19
|
+
| { type: "event", eventType: string }
|
|
20
|
+
| { type: "schedule", cron: string, timezone: string };
|
|
21
|
+
|
|
22
|
+
export type AdminWorkflow = {
|
|
23
|
+
id: string,
|
|
24
|
+
displayName: string,
|
|
25
|
+
latestVersion: number,
|
|
26
|
+
triggers: AdminWorkflowTrigger[],
|
|
27
|
+
stats: {
|
|
28
|
+
activeRuns: number,
|
|
29
|
+
sleepingRuns: number,
|
|
30
|
+
failed7d: number,
|
|
31
|
+
runVolume14d: number[],
|
|
32
|
+
},
|
|
33
|
+
createdAtMillis: number,
|
|
34
|
+
lastDeployedAtMillis: number,
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export type AdminWorkflowRunState = "queued" | "running" | "sleeping" | "completed" | "failed" | "canceled";
|
|
38
|
+
|
|
39
|
+
export type AdminWorkflowDivergenceDiagnostic = {
|
|
40
|
+
reason: WorkflowDivergenceDiagnosticJson["reason"],
|
|
41
|
+
suspendedStepKey: string | null,
|
|
42
|
+
foundStepKey: string | null,
|
|
43
|
+
consumedStepKeys: string[],
|
|
44
|
+
unconsumedStepKeys: string[],
|
|
45
|
+
details: string,
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export type AdminWorkflowRun = {
|
|
49
|
+
id: string,
|
|
50
|
+
workflowId: string,
|
|
51
|
+
runKey: string | null,
|
|
52
|
+
state: AdminWorkflowRunState,
|
|
53
|
+
version: number,
|
|
54
|
+
triggerType: string,
|
|
55
|
+
triggerSummary: string,
|
|
56
|
+
currentStepId: string | null,
|
|
57
|
+
stepsRecorded: number,
|
|
58
|
+
errorSummary: string | null,
|
|
59
|
+
failureKind: "user" | "platform" | null,
|
|
60
|
+
lastUpgradeDivergence: AdminWorkflowDivergenceDiagnostic | null,
|
|
61
|
+
createdAtMillis: number,
|
|
62
|
+
completedAtMillis: number | null,
|
|
63
|
+
nextWakeAtMillis: number | null,
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export type AdminWorkflowStep = {
|
|
67
|
+
stepKey: string,
|
|
68
|
+
stepId: string,
|
|
69
|
+
kind: "run" | "sleep",
|
|
70
|
+
result: unknown,
|
|
71
|
+
resultSizeBytes: number,
|
|
72
|
+
attempts: number,
|
|
73
|
+
executedAtVersion: number,
|
|
74
|
+
elapsedMs: number | null,
|
|
75
|
+
createdAtMillis: number,
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export type AdminWorkflowStepAttempt = {
|
|
79
|
+
stepKey: string,
|
|
80
|
+
stepId: string,
|
|
81
|
+
/** 0 for the original execution; incremented by each manual retry of the run. */
|
|
82
|
+
retryEpoch: number,
|
|
83
|
+
attempt: number,
|
|
84
|
+
outcome: "succeeded" | "failed",
|
|
85
|
+
error: { name: string, message: string, stack?: string } | null,
|
|
86
|
+
failureKind: "user" | "platform" | null,
|
|
87
|
+
logs: string | null,
|
|
88
|
+
startedAtMillis: number,
|
|
89
|
+
finishedAtMillis: number,
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
export type AdminWorkflowRunDetails = AdminWorkflowRun & {
|
|
93
|
+
triggerPayload: unknown,
|
|
94
|
+
steps: AdminWorkflowStep[],
|
|
95
|
+
stepAttempts: AdminWorkflowStepAttempt[],
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
export type AdminWorkflowVersion = {
|
|
99
|
+
workflowId: string,
|
|
100
|
+
version: number,
|
|
101
|
+
sourceHash: string,
|
|
102
|
+
source: string,
|
|
103
|
+
runtimeEnvVersion: string,
|
|
104
|
+
isLatest: boolean,
|
|
105
|
+
inFlightRuns: number,
|
|
106
|
+
createdAtMillis: number,
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
export type AdminWorkflowSyncResult = {
|
|
110
|
+
workflowId: string,
|
|
111
|
+
version: number,
|
|
112
|
+
created: boolean,
|
|
113
|
+
inFlightRunsOnOlderVersions: number,
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
export type AdminWorkflowUpgradeResult = {
|
|
117
|
+
upgradedCount: number,
|
|
118
|
+
skipped: {
|
|
119
|
+
runId: string,
|
|
120
|
+
runKey: string | null,
|
|
121
|
+
fromVersion: number,
|
|
122
|
+
diagnostic: AdminWorkflowDivergenceDiagnostic,
|
|
123
|
+
}[],
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
export type AdminWorkflowRunsFilter = {
|
|
127
|
+
state?: AdminWorkflowRunState,
|
|
128
|
+
version?: number,
|
|
129
|
+
runKey?: string,
|
|
130
|
+
cursor?: string,
|
|
131
|
+
limit?: number,
|
|
132
|
+
/** Include each run's memoized steps and attempt history. */
|
|
133
|
+
includeState?: boolean,
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
export function adminWorkflowFromCrud(crud: WorkflowSummaryJson): AdminWorkflow {
|
|
137
|
+
return {
|
|
138
|
+
id: crud.id,
|
|
139
|
+
displayName: crud.display_name,
|
|
140
|
+
latestVersion: crud.latest_version,
|
|
141
|
+
triggers: crud.triggers.map((trigger) => trigger.type === "event"
|
|
142
|
+
? { type: "event", eventType: trigger.event_type }
|
|
143
|
+
: { type: "schedule", cron: trigger.cron, timezone: trigger.timezone }),
|
|
144
|
+
stats: {
|
|
145
|
+
activeRuns: crud.stats.active_runs,
|
|
146
|
+
sleepingRuns: crud.stats.sleeping_runs,
|
|
147
|
+
failed7d: crud.stats.failed_7d,
|
|
148
|
+
runVolume14d: crud.stats.run_volume_14d,
|
|
149
|
+
},
|
|
150
|
+
createdAtMillis: crud.created_at_millis,
|
|
151
|
+
lastDeployedAtMillis: crud.last_deployed_at_millis,
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
function adminDivergenceFromCrud(crud: WorkflowDivergenceDiagnosticJson | null): AdminWorkflowDivergenceDiagnostic | null {
|
|
156
|
+
if (crud == null) return null;
|
|
157
|
+
return {
|
|
158
|
+
reason: crud.reason,
|
|
159
|
+
suspendedStepKey: crud.suspended_step_key,
|
|
160
|
+
foundStepKey: crud.found_step_key,
|
|
161
|
+
consumedStepKeys: crud.consumed_step_keys,
|
|
162
|
+
unconsumedStepKeys: crud.unconsumed_step_keys,
|
|
163
|
+
details: crud.details,
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export function adminWorkflowRunFromCrud(crud: WorkflowRunJson): AdminWorkflowRun {
|
|
168
|
+
return {
|
|
169
|
+
id: crud.id,
|
|
170
|
+
workflowId: crud.workflow_id,
|
|
171
|
+
runKey: crud.run_key,
|
|
172
|
+
state: crud.state,
|
|
173
|
+
version: crud.version,
|
|
174
|
+
triggerType: crud.trigger_type,
|
|
175
|
+
triggerSummary: crud.trigger_summary,
|
|
176
|
+
currentStepId: crud.current_step_id,
|
|
177
|
+
stepsRecorded: crud.steps_recorded,
|
|
178
|
+
errorSummary: crud.error_summary,
|
|
179
|
+
failureKind: crud.failure_kind,
|
|
180
|
+
lastUpgradeDivergence: adminDivergenceFromCrud(crud.last_upgrade_divergence),
|
|
181
|
+
createdAtMillis: crud.created_at_millis,
|
|
182
|
+
completedAtMillis: crud.completed_at_millis,
|
|
183
|
+
nextWakeAtMillis: crud.next_wake_at_millis,
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
export function isWorkflowRunDetailsJson(crud: WorkflowRunJson): crud is WorkflowRunDetailsJson {
|
|
188
|
+
return "trigger_payload" in crud
|
|
189
|
+
&& "steps" in crud
|
|
190
|
+
&& Array.isArray(crud.steps)
|
|
191
|
+
&& "step_attempts" in crud
|
|
192
|
+
&& Array.isArray(crud.step_attempts);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
export function adminWorkflowRunDetailsFromCrud(crud: WorkflowRunDetailsJson): AdminWorkflowRunDetails {
|
|
196
|
+
return {
|
|
197
|
+
...adminWorkflowRunFromCrud(crud),
|
|
198
|
+
triggerPayload: crud.trigger_payload,
|
|
199
|
+
steps: crud.steps.map((step) => ({
|
|
200
|
+
stepKey: step.step_key,
|
|
201
|
+
stepId: step.step_id,
|
|
202
|
+
kind: step.kind,
|
|
203
|
+
result: step.result,
|
|
204
|
+
resultSizeBytes: step.result_size_bytes,
|
|
205
|
+
attempts: step.attempts,
|
|
206
|
+
executedAtVersion: step.executed_at_version,
|
|
207
|
+
elapsedMs: step.elapsed_ms,
|
|
208
|
+
createdAtMillis: step.created_at_millis,
|
|
209
|
+
})),
|
|
210
|
+
stepAttempts: crud.step_attempts.map((attempt) => ({
|
|
211
|
+
stepKey: attempt.step_key,
|
|
212
|
+
stepId: attempt.step_id,
|
|
213
|
+
retryEpoch: attempt.retry_epoch,
|
|
214
|
+
attempt: attempt.attempt,
|
|
215
|
+
outcome: attempt.outcome,
|
|
216
|
+
error: attempt.error,
|
|
217
|
+
failureKind: attempt.failure_kind,
|
|
218
|
+
logs: attempt.logs,
|
|
219
|
+
startedAtMillis: attempt.started_at_millis,
|
|
220
|
+
finishedAtMillis: attempt.finished_at_millis,
|
|
221
|
+
})),
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
export function adminWorkflowVersionFromCrud(crud: WorkflowVersionJson): AdminWorkflowVersion {
|
|
226
|
+
return {
|
|
227
|
+
workflowId: crud.workflow_id,
|
|
228
|
+
version: crud.version,
|
|
229
|
+
sourceHash: crud.source_hash,
|
|
230
|
+
source: crud.source,
|
|
231
|
+
runtimeEnvVersion: crud.runtime_env_version,
|
|
232
|
+
isLatest: crud.is_latest,
|
|
233
|
+
inFlightRuns: crud.in_flight_runs,
|
|
234
|
+
createdAtMillis: crud.created_at_millis,
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
export function adminWorkflowSyncResultFromCrud(crud: WorkflowSyncResultJson): AdminWorkflowSyncResult {
|
|
239
|
+
return {
|
|
240
|
+
workflowId: crud.workflow_id,
|
|
241
|
+
version: crud.version,
|
|
242
|
+
created: crud.created,
|
|
243
|
+
inFlightRunsOnOlderVersions: crud.in_flight_runs_on_older_versions,
|
|
244
|
+
};
|
|
245
|
+
}
|