@sanoma-ai/workflows 0.7.1 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +34 -7
- package/dist/apps-list.d.ts +90 -0
- package/dist/apps-list.js +109 -0
- package/dist/apps-list.js.map +1 -0
- package/dist/apps.d.ts +42 -0
- package/dist/apps.js +137 -0
- package/dist/apps.js.map +1 -0
- package/dist/call-workflow.js +5 -6
- package/dist/call-workflow.js.map +1 -1
- package/dist/call.js +6 -3
- package/dist/call.js.map +1 -1
- package/dist/cedar.d.ts +1 -1
- package/dist/cedar.js +6 -4
- package/dist/cedar.js.map +1 -1
- package/dist/change-steps.d.ts +10 -0
- package/dist/change-steps.js +204 -0
- package/dist/change-steps.js.map +1 -0
- package/dist/change-workflow.d.ts +54 -0
- package/dist/change-workflow.js +161 -0
- package/dist/change-workflow.js.map +1 -0
- package/dist/change.d.ts +121 -24
- package/dist/change.js +196 -17
- package/dist/change.js.map +1 -1
- package/dist/claims.d.ts +58 -0
- package/dist/claims.js +27 -0
- package/dist/claims.js.map +1 -0
- package/dist/client.d.ts +92 -0
- package/dist/client.js +268 -6
- package/dist/client.js.map +1 -1
- package/dist/collection.d.ts +6 -1
- package/dist/collection.js +11 -3
- package/dist/collection.js.map +1 -1
- package/dist/config.d.ts +30 -2
- package/dist/config.js +41 -20
- package/dist/config.js.map +1 -1
- package/dist/db.d.ts +12 -0
- package/dist/db.js +15 -0
- package/dist/db.js.map +1 -1
- package/dist/deadlines.d.ts +5 -2
- package/dist/deadlines.js.map +1 -1
- package/dist/define.d.ts +30 -14
- package/dist/define.js +9 -1
- package/dist/define.js.map +1 -1
- package/dist/demo.d.ts +15 -4
- package/dist/demo.js +27 -12
- package/dist/demo.js.map +1 -1
- package/dist/describe.d.ts +16 -2
- package/dist/describe.js +39 -4
- package/dist/describe.js.map +1 -1
- package/dist/direct.d.ts +4 -3
- package/dist/direct.js +7 -4
- package/dist/direct.js.map +1 -1
- package/dist/errors.d.ts +2 -0
- package/dist/errors.js +2 -0
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +7 -5
- package/dist/index.js +6 -3
- package/dist/index.js.map +1 -1
- package/dist/lint.js +19 -5
- package/dist/lint.js.map +1 -1
- package/dist/outline.js +13 -6
- package/dist/outline.js.map +1 -1
- package/dist/paths.d.ts +16 -0
- package/dist/paths.js +54 -2
- package/dist/paths.js.map +1 -1
- package/dist/resources.d.ts +7 -2
- package/dist/resources.js +23 -8
- package/dist/resources.js.map +1 -1
- package/dist/run.d.ts +7 -0
- package/dist/run.js.map +1 -1
- package/dist/sandbox.js +2 -2
- package/dist/sandbox.js.map +1 -1
- package/dist/scenario.d.ts +2 -2
- package/dist/scenario.js +10 -4
- package/dist/scenario.js.map +1 -1
- package/dist/scenarios.d.ts +1 -1
- package/dist/scenarios.js.map +1 -1
- package/dist/sdk.d.ts +1 -1
- package/dist/sdk.js +19 -5
- package/dist/sdk.js.map +1 -1
- package/dist/shared.d.ts +43 -2
- package/dist/shared.js +46 -4
- package/dist/shared.js.map +1 -1
- package/dist/sites.d.ts +26 -5
- package/dist/sites.js +56 -20
- package/dist/sites.js.map +1 -1
- package/dist/source.d.ts +55 -5
- package/dist/source.js +4 -0
- package/dist/source.js.map +1 -1
- package/dist/version.d.ts +8 -0
- package/dist/version.js +21 -13
- package/dist/version.js.map +1 -1
- package/dist/worker.js +50 -3
- package/dist/worker.js.map +1 -1
- package/oxlint.json +2 -2
- package/package.json +1 -1
- package/src/apps-list.ts +119 -0
- package/src/apps.ts +162 -0
- package/src/call-workflow.ts +10 -2
- package/src/call.ts +6 -3
- package/src/cedar.ts +9 -7
- package/src/change-steps.ts +274 -0
- package/src/change-workflow.ts +198 -0
- package/src/change.ts +257 -27
- package/src/claims.ts +79 -0
- package/src/client.ts +320 -4
- package/src/collection.ts +22 -3
- package/src/config.ts +66 -22
- package/src/db.ts +23 -0
- package/src/deadlines.ts +5 -2
- package/src/define.ts +31 -12
- package/src/demo.ts +55 -24
- package/src/describe.ts +67 -4
- package/src/direct.ts +9 -5
- package/src/errors.ts +3 -0
- package/src/index.ts +14 -0
- package/src/lint.ts +20 -5
- package/src/outline.ts +15 -6
- package/src/paths.ts +57 -2
- package/src/resources.ts +27 -9
- package/src/run.ts +5 -0
- package/src/sandbox.ts +2 -5
- package/src/scenario.ts +14 -4
- package/src/scenarios.ts +1 -1
- package/src/sdk.ts +21 -7
- package/src/shared.ts +60 -5
- package/src/sites.ts +70 -24
- package/src/source.ts +50 -5
- package/src/version.ts +25 -16
- package/src/worker.ts +46 -3
package/dist/change.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"change.js","sourceRoot":"","sources":["../src/change.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,eAAe,EAAE,YAAY,EAAe,WAAW,EAAE,MAAM,SAAS,CAAC;AAClF,OAAO,EAAE,OAAO,EAAE,WAAW,EAAiB,IAAI,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,UAAU,EAAiB,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,eAAe,EAAE,YAAY,EAAuB,MAAM,aAAa,CAAC;AAG/G,iGAAiG;AACjG,gGAAgG;AAChG,iGAAiG;AACjG,+EAA+E;AAE/E;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAClC,oFAAoF;IACpF,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAC5B,+FAA+F;IAC/F,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE;IAC9B,uBAAuB;IACvB,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAC7B,mDAAmD;IACnD,QAAQ,EAAE,CAAC,CAAC,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E,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;IACxC,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;IAC7D,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;IACvC,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;CAChE,CAAC,CAAC;AAmEH,sEAAsE;AACtE,MAAM,CAAC,MAAM,OAAO,GAAG,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,gDAAgD,EAAW,CAAC;AAEpH,sDAAsD;AACtD,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,KAAkB,EAAe,EAAE,CAAC,CAAC;IACtE,EAAE,EAAE,KAAK,CAAC,EAAE;IACZ,MAAM,EAAE,EAAE;IACV,KAAK,EAAE,KAAK,CAAC,KAAK;IAClB,GAAG,CAAC,KAAK,CAAC,IAAI,KAAK,SAAS,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC;IACrD,KAAK,EAAE,SAAS;IAChB,IAAI,EAAE,OAAO;CACd,CAAC,CAAC"}
|
package/dist/claims.d.ts
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whose a connector or an app is: Sanoma's own, its vendor's (checked by Sanoma), or anyone's. With
|
|
3
|
+
* no claim, `official` is read from the name (the `@sanoma-ai/` scope, the `Sanoma-AI` owner).
|
|
4
|
+
*/
|
|
5
|
+
export declare const TIERS: readonly ["official", "vendor-verified", "community"];
|
|
6
|
+
export type Tier = (typeof TIERS)[number];
|
|
7
|
+
/** What Sanoma says of a connector package, by its npm name. */
|
|
8
|
+
export interface ConnectorClaim {
|
|
9
|
+
tier: Tier;
|
|
10
|
+
/** Whether Sanoma read its code. */
|
|
11
|
+
reviewed: boolean;
|
|
12
|
+
/** Versions Sanoma blocks. */
|
|
13
|
+
blocked?: string[];
|
|
14
|
+
}
|
|
15
|
+
/** What Sanoma says of an app's source repository, by `<owner>/<repo>` on GitHub. */
|
|
16
|
+
export interface AppClaim {
|
|
17
|
+
tier: Tier;
|
|
18
|
+
/** Whether Sanoma read its code. */
|
|
19
|
+
reviewed: boolean;
|
|
20
|
+
/** Commits Sanoma blocks, by their full id. */
|
|
21
|
+
blocked?: string[];
|
|
22
|
+
/** The solutions it belongs to, by id. */
|
|
23
|
+
solutions: string[];
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* A solution: a kind of customer and the apps that cover their problems, with the one public demo
|
|
27
|
+
* repository (a fictional business of that kind, those apps merged under `apps/`) that a visitor
|
|
28
|
+
* meets it in.
|
|
29
|
+
*/
|
|
30
|
+
export interface SolutionClaim {
|
|
31
|
+
/** The solution's name, as its page heads it. */
|
|
32
|
+
title: string;
|
|
33
|
+
/** The kind of customer it is for, in their words: "property managers". */
|
|
34
|
+
kind: string;
|
|
35
|
+
/** Its apps' source repositories, `<owner>/<repo>`. */
|
|
36
|
+
apps: string[];
|
|
37
|
+
/** Its demo: the company repository, `<owner>/<repo>`, and where it runs once it does. */
|
|
38
|
+
demo: {
|
|
39
|
+
repo: string;
|
|
40
|
+
url?: string;
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
/** Sanoma's claims, each keyed as its kind is named: a package, a repository, a solution's id. */
|
|
44
|
+
export interface Claims {
|
|
45
|
+
connectors: Readonly<Record<string, ConnectorClaim>>;
|
|
46
|
+
apps: Readonly<Record<string, AppClaim>>;
|
|
47
|
+
solutions: Readonly<Record<string, SolutionClaim>>;
|
|
48
|
+
}
|
|
49
|
+
/** Sanoma's claims. Empty until the first outside connector, the first app and the first solution exist. */
|
|
50
|
+
export declare const claims: Claims;
|
|
51
|
+
/** A connector package's tier: its claim's, else official for the `@sanoma-ai/` scope and community otherwise. */
|
|
52
|
+
export declare const connectorTier: (pkg: string, from?: Claims) => Tier;
|
|
53
|
+
/** The claim on the app whose source is `repo` (`<owner>/<repo>`, as GitHub names it, in any case). */
|
|
54
|
+
export declare const appClaim: (repo: string, from?: Claims) => AppClaim | undefined;
|
|
55
|
+
/** The GitHub owner whose repositories are Sanoma's own. */
|
|
56
|
+
export declare const SANOMA_ORG = "Sanoma-AI";
|
|
57
|
+
/** An app source's tier: its claim's, else official for the `Sanoma-AI` owner's and community otherwise. */
|
|
58
|
+
export declare const appTier: (repo: string, from?: Claims) => Tier;
|
package/dist/claims.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// Sanoma's claims: what Sanoma says about connectors and apps that their authors cannot say about
|
|
2
|
+
// their own (the tier, whether Sanoma reviewed it, what it blocks), and the solutions, each a kind
|
|
3
|
+
// of customer with the apps that cover their problems and one demo repository. Data, changed by
|
|
4
|
+
// pull request; `sanoma/claims` re-exports it, so a company and its sites import it statically.
|
|
5
|
+
// Browser-safe: nothing here imports anything. Everything else about a connector or an app is
|
|
6
|
+
// its author's, read from npm or GitHub (`sanoma.apps.list`), never copied here.
|
|
7
|
+
/**
|
|
8
|
+
* Whose a connector or an app is: Sanoma's own, its vendor's (checked by Sanoma), or anyone's. With
|
|
9
|
+
* no claim, `official` is read from the name (the `@sanoma-ai/` scope, the `Sanoma-AI` owner).
|
|
10
|
+
*/
|
|
11
|
+
export const TIERS = ["official", "vendor-verified", "community"];
|
|
12
|
+
/** Sanoma's claims. Empty until the first outside connector, the first app and the first solution exist. */
|
|
13
|
+
export const claims = {
|
|
14
|
+
connectors: {},
|
|
15
|
+
apps: {},
|
|
16
|
+
solutions: {},
|
|
17
|
+
};
|
|
18
|
+
/** A connector package's tier: its claim's, else official for the `@sanoma-ai/` scope and community otherwise. */
|
|
19
|
+
export const connectorTier = (pkg, from = claims) => from.connectors[pkg]?.tier ?? (pkg.startsWith("@sanoma-ai/") ? "official" : "community");
|
|
20
|
+
/** The claim on the app whose source is `repo` (`<owner>/<repo>`, as GitHub names it, in any case). */
|
|
21
|
+
export const appClaim = (repo, from = claims) => Object.entries(from.apps).find(([key]) => key.toLowerCase() === repo.toLowerCase())?.[1];
|
|
22
|
+
/** The GitHub owner whose repositories are Sanoma's own. */
|
|
23
|
+
export const SANOMA_ORG = "Sanoma-AI";
|
|
24
|
+
/** An app source's tier: its claim's, else official for the `Sanoma-AI` owner's and community otherwise. */
|
|
25
|
+
export const appTier = (repo, from = claims) => appClaim(repo, from)?.tier ??
|
|
26
|
+
(repo.toLowerCase().startsWith(`${SANOMA_ORG.toLowerCase()}/`) ? "official" : "community");
|
|
27
|
+
//# sourceMappingURL=claims.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claims.js","sourceRoot":"","sources":["../src/claims.ts"],"names":[],"mappings":"AAAA,kGAAkG;AAClG,mGAAmG;AACnG,gGAAgG;AAChG,gGAAgG;AAChG,8FAA8F;AAC9F,iFAAiF;AAEjF;;;GAGG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,UAAU,EAAE,iBAAiB,EAAE,WAAW,CAAU,CAAC;AA8C3E,4GAA4G;AAC5G,MAAM,CAAC,MAAM,MAAM,GAAW;IAC5B,UAAU,EAAE,EAAE;IACd,IAAI,EAAE,EAAE;IACR,SAAS,EAAE,EAAE;CACd,CAAC;AAEF,kHAAkH;AAClH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,GAAW,EAAE,IAAI,GAAW,MAAM,EAAQ,EAAE,CACxE,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,IAAI,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC;AAE3F,uGAAuG;AACvG,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAE,IAAI,GAAW,MAAM,EAAwB,EAAE,CACpF,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,WAAW,EAAE,KAAK,IAAI,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAE3F,4DAA4D;AAC5D,MAAM,CAAC,MAAM,UAAU,GAAG,WAAW,CAAC;AAEtC,4GAA4G;AAC5G,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,IAAY,EAAE,IAAI,GAAW,MAAM,EAAQ,EAAE,CACnE,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,IAAI;IAC1B,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,GAAG,UAAU,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC"}
|
package/dist/client.d.ts
CHANGED
|
@@ -6,9 +6,11 @@ import { type ResolvedConfig, type SanomaConfig } from "./config.ts";
|
|
|
6
6
|
import { type CredentialStatus } from "./env.ts";
|
|
7
7
|
import { type ApprovalState, Principal, type WorkflowDefinition } from "./define.ts";
|
|
8
8
|
import { type ApplyInput, type ApplyReport } from "./apply.ts";
|
|
9
|
+
import { type ChangeEvent, ChangeInput, type ChangeReport, type ChangeState } from "./change.ts";
|
|
9
10
|
import { type DriftReport } from "./drift.ts";
|
|
10
11
|
import { type LedgerRecord } from "./ledger.ts";
|
|
11
12
|
import { type RunStatus } from "./shared.ts";
|
|
13
|
+
import { type RemoteEvent, type Source } from "./source.ts";
|
|
12
14
|
/** A run's status from DBOS's, and whether it has an approval pending. */
|
|
13
15
|
export declare function runStatus(dbosStatus: string, approvals: readonly ApprovalState[]): RunStatus;
|
|
14
16
|
/** The DBOS statuses the run statuses come from; `running` and `waiting` both come from PENDING. */
|
|
@@ -65,6 +67,25 @@ export interface StartOptions {
|
|
|
65
67
|
*/
|
|
66
68
|
sandbox?: string;
|
|
67
69
|
}
|
|
70
|
+
/** A change as the app shows it: its run, where the change is (`ChangeState`), and how it ended. */
|
|
71
|
+
export interface ChangeView {
|
|
72
|
+
runId: string;
|
|
73
|
+
status: RunStatus;
|
|
74
|
+
startedBy?: Principal;
|
|
75
|
+
/** When the run started, and when its row last changed (epoch ms), as `RunSummary` has them. */
|
|
76
|
+
createdAt: number;
|
|
77
|
+
updatedAt?: number;
|
|
78
|
+
approvals: ApprovalState[];
|
|
79
|
+
/** What the run last published (`CHANGE_EVENT`); `opening`, with no branch yet, before it has. */
|
|
80
|
+
state: ChangeState;
|
|
81
|
+
/** The run's output, once it has finished. */
|
|
82
|
+
report?: ChangeReport;
|
|
83
|
+
}
|
|
84
|
+
/** Which changes `SanomaClient.changes` lists: `open` (not ended) or not, and at most `limit` (20), newest first. */
|
|
85
|
+
export interface ChangesFilter {
|
|
86
|
+
open?: boolean;
|
|
87
|
+
limit?: number;
|
|
88
|
+
}
|
|
68
89
|
/** What `SanomaClient.call` takes besides the operation's id and its input. */
|
|
69
90
|
export interface CallOptions {
|
|
70
91
|
/**
|
|
@@ -92,6 +113,11 @@ export interface ClientOptions {
|
|
|
92
113
|
* `dataStore`.
|
|
93
114
|
*/
|
|
94
115
|
resolved?: ResolvedConfig;
|
|
116
|
+
/**
|
|
117
|
+
* The company's repository, as the worker is given it: what `remoteEvent` acts for (its
|
|
118
|
+
* `origin`) and fetches a draft's new commits into. Without one, `remoteEvent` does nothing.
|
|
119
|
+
*/
|
|
120
|
+
source?: Source;
|
|
95
121
|
}
|
|
96
122
|
/** Talks to the runtime from another process (the app, a script), through the shared Postgres. */
|
|
97
123
|
export declare class SanomaClient {
|
|
@@ -170,6 +196,12 @@ export declare class SanomaClient {
|
|
|
170
196
|
output: unknown;
|
|
171
197
|
at: number;
|
|
172
198
|
} | null>;
|
|
199
|
+
/**
|
|
200
|
+
* Cancels every run of the app that has not ended (queued, running or waiting), as a demo's
|
|
201
|
+
* `reseed` starts afresh: its moments' runs from the last seed would otherwise wait beside the
|
|
202
|
+
* new ones.
|
|
203
|
+
*/
|
|
204
|
+
cancelUnfinished(): Promise<void>;
|
|
173
205
|
/** The run's audit record, in order, from the ledger store. */
|
|
174
206
|
ledger(runId: string): Promise<LedgerRecord[]>;
|
|
175
207
|
/**
|
|
@@ -252,6 +284,66 @@ export declare class SanomaClient {
|
|
|
252
284
|
private builtIn;
|
|
253
285
|
/** The output of a run of the built-in `workflow` once it ends. */
|
|
254
286
|
private reportOf;
|
|
287
|
+
/**
|
|
288
|
+
* Starts the built-in change workflow on the draft `input.id` (`ChangeInput`): its run id is
|
|
289
|
+
* `change:<id>`, or `change:<id>~<n>` once that run has ended (the second `~2`). While a run of
|
|
290
|
+
* the change has not ended, returns its id and starts nothing.
|
|
291
|
+
*/
|
|
292
|
+
openChange(input: ChangeInput, options: StartOptions): Promise<string>;
|
|
293
|
+
/**
|
|
294
|
+
* The changes, newest first, each draft's by its latest run (`change`): `open` ones (not ended)
|
|
295
|
+
* or the others, else all; at most `limit` (20).
|
|
296
|
+
*/
|
|
297
|
+
changes({ open, limit }?: ChangesFilter): Promise<ChangeView[]>;
|
|
298
|
+
/** The change of the draft `id`: its latest run's (`openChange`), or undefined when it has none. */
|
|
299
|
+
change(id: string): Promise<ChangeView | undefined>;
|
|
300
|
+
/**
|
|
301
|
+
* Tells the change of the draft `id` what happened (`ChangeEvent`), as `options.by`: new commits
|
|
302
|
+
* on its branch, a close asked for, or its pull request closed or merged on the host. The event is
|
|
303
|
+
* queued for its latest run, which reads it when it next waits; a pending approval of the merge
|
|
304
|
+
* (Publish, or a hold on it) is withdrawn as `by` (C4's `withdraw`), so a run waiting on it reads
|
|
305
|
+
* the event now. A `close` is refused (`not_approver`) unless `by` may withdraw that approval; the
|
|
306
|
+
* other kinds are facts, so a withdrawal `by` may not make is skipped and the run's merge refuses a
|
|
307
|
+
* head that moved. `run_not_found` when the draft has no change, `run_ended` when its run has ended.
|
|
308
|
+
* With `key`, an event told again under the same key is queued once while the run has not read it.
|
|
309
|
+
*/
|
|
310
|
+
changeEvent(id: string, event: ChangeEvent, options: {
|
|
311
|
+
by: Principal | string;
|
|
312
|
+
key?: string;
|
|
313
|
+
}): Promise<void>;
|
|
314
|
+
/**
|
|
315
|
+
* Does what a host's webhook says happened (`RemoteEvent`, from a remote half's `webhook`) to the
|
|
316
|
+
* company's repository, the `origin` of `ClientOptions.source` (`repositoryOf`); an event of
|
|
317
|
+
* another repository, or with no source, is ignored. A delivery told again does nothing more.
|
|
318
|
+
*
|
|
319
|
+
* - `pushed` to `main`: the checkout follows `main`, then apply on the declared hosts
|
|
320
|
+
* (`ResolvedConfig.hosts`) as `host-check`, as the run `deploy:<head>`, once per head; nothing
|
|
321
|
+
* with no host, nor while a change is merging or deploying, which does both itself.
|
|
322
|
+
* - `pushed` to a draft's branch (`draftOf`) with its change open: the host's commits fetched into
|
|
323
|
+
* the draft (`Source.follow` on its branch), then the change told `commits`, as `by`; nothing
|
|
324
|
+
* when the change or the draft is at that head already (the run's own push), or when the draft
|
|
325
|
+
* cannot fast-forward to it (warned).
|
|
326
|
+
* - `closed` for the open change's pull request: the change told `merged` (with its merge commit)
|
|
327
|
+
* or `closed`, as `by`. The run checks either on the host before it believes it.
|
|
328
|
+
*/
|
|
329
|
+
remoteEvent(event: RemoteEvent, options: {
|
|
330
|
+
by: Principal | string;
|
|
331
|
+
}): Promise<void>;
|
|
332
|
+
/** After a push of `head` to `main` (`remoteEvent`): the checkout follows it, then apply on the declared hosts. */
|
|
333
|
+
private deployPush;
|
|
334
|
+
/** Where each open change is (`ChangeState.phase`), read from what its run last published. */
|
|
335
|
+
private openChangePhases;
|
|
336
|
+
/**
|
|
337
|
+
* Brings `head`, pushed to the draft's `branch` on the host, into the draft: false when it holds
|
|
338
|
+
* it already, or cannot take it (no `follow`, a commit of its own, or one uncommitted: warned).
|
|
339
|
+
*/
|
|
340
|
+
private fetched;
|
|
341
|
+
/** The repository of `ClientOptions.source` on its host (`repositoryOf`); undefined with no source, remote or half for it. */
|
|
342
|
+
private repository;
|
|
343
|
+
/** The runs of the draft `id`'s change, newest first: `change:<id>` and `change:<id>~<n>`. */
|
|
344
|
+
private changeRuns;
|
|
345
|
+
/** A change run's row as the app shows it: its summary, its last `ChangeState` and, once finished, its report. */
|
|
346
|
+
private changeView;
|
|
255
347
|
/**
|
|
256
348
|
* Stores a value for a variable a driver's `env` declares, as `by`, and tells the workers: each
|
|
257
349
|
* loads it into its environment, unless its environment sets the variable itself. Refuses
|
package/dist/client.js
CHANGED
|
@@ -12,13 +12,18 @@ import { dbosClient, lazyPool } from "./db.js";
|
|
|
12
12
|
import { credentialsOf } from "./env.js";
|
|
13
13
|
import { Principal } from "./define.js";
|
|
14
14
|
import { APPLY_WORKFLOW } from "./apply.js";
|
|
15
|
+
import { ADMIN, BASE, ChangeEventSchema, ChangeInput, followBase, initialChangeState, repositoryOf, } from "./change.js";
|
|
15
16
|
import { DRIFT_WORKFLOW } from "./drift.js";
|
|
16
17
|
import { isDirect } from "./direct.js";
|
|
17
|
-
import { ApprovalPendingError, errorCode, errorInfo, NotAdmittedError, parseOrThrow, PolicyDeniedError, SanomaError, } from "./errors.js";
|
|
18
|
+
import { ApprovalPendingError, errorCode, errorInfo, NotAdmittedError, parseOrThrow, PolicyDeniedError, SanomaError, vendorCodeOf, } from "./errors.js";
|
|
18
19
|
import { insertRecord, ownedLedger } from "./ledger.js";
|
|
20
|
+
import { warn } from "./log.js";
|
|
19
21
|
import { allowAll } from "./policy.js";
|
|
20
22
|
import { admit, readPeople } from "./resources.js";
|
|
21
|
-
import { BUILT_IN_WORKFLOWS, CALL_WORKFLOW, DATA_VENDOR, errorMessage, isEnded, isVisitor, refusalOf, SCHEDULE_AGENT, WORKFLOW_ACTION, } from "./shared.js";
|
|
23
|
+
import { BUILT_IN_WORKFLOWS, CALL_WORKFLOW, CHANGE_EVENT, CHANGE_MERGE, CHANGE_TOPIC, CHANGE_WORKFLOW, changeIdOf, DATA_VENDOR, ENDED_STATUSES, errorMessage, HOST_CHECK_AGENT, isEnded, isVisitor, refusalOf, SCHEDULE_AGENT, WORKFLOW_ACTION, } from "./shared.js";
|
|
24
|
+
import { draftOf } from "./source.js";
|
|
25
|
+
/** Whether two references name one repository: a host's names are compared without case. */
|
|
26
|
+
const sameRepo = (a, b) => a.owner.toLowerCase() === b.owner.toLowerCase() && a.name.toLowerCase() === b.name.toLowerCase();
|
|
22
27
|
/** A principal, or its id alone. */
|
|
23
28
|
const PrincipalOrId = z.union([
|
|
24
29
|
z
|
|
@@ -119,9 +124,19 @@ export class SanomaClient {
|
|
|
119
124
|
const parsed = parseOrThrow(workflow.input, input, `The input does not match ${workflow.name}'s schema`);
|
|
120
125
|
const { runId } = options;
|
|
121
126
|
const sandbox = parseOrThrow(z.string().min(1).optional(), options.sandbox, "`sandbox` must be the name of a scenario in the config's `scenarios/`");
|
|
127
|
+
if (workflow.name === CHANGE_WORKFLOW && !isChangeRunOf(parsed.id, runId)) {
|
|
128
|
+
throw new SanomaError("invalid_input", "A change is started with openChange, which names its run", { runId });
|
|
129
|
+
}
|
|
122
130
|
const hold = await this.startHold(workflow.name, parsed, startedBy, runId);
|
|
123
131
|
const args = { input, startedBy, ...(sandbox === undefined ? {} : { sandbox }), ...(hold && { hold }) };
|
|
124
|
-
|
|
132
|
+
// Kept on the run's status row too, so a listing tells sandbox runs apart without its input,
|
|
133
|
+
// and says whom an agent's run is for (DBOS keeps the principal's id and groups itself); a
|
|
134
|
+
// change run's code, so a worker on another version with the same takes it over.
|
|
135
|
+
const attributes = {
|
|
136
|
+
sandbox,
|
|
137
|
+
onBehalfOf: startedBy.onBehalfOf,
|
|
138
|
+
changeCode: workflow.name === CHANGE_WORKFLOW ? this.config.changeCode : undefined,
|
|
139
|
+
};
|
|
125
140
|
this.options.onWrite?.();
|
|
126
141
|
// An id DBOS has already returns that run, unless it is another workflow's, which DBOS refuses.
|
|
127
142
|
const handle = await this.dbos
|
|
@@ -132,9 +147,7 @@ export class SanomaClient {
|
|
|
132
147
|
applicationName: this.config.appName,
|
|
133
148
|
authenticatedUser: startedBy.id,
|
|
134
149
|
authenticatedRoles: startedBy.groups ?? [],
|
|
135
|
-
|
|
136
|
-
// and says whom an agent's run is for (DBOS keeps the principal's id and groups itself).
|
|
137
|
-
...((sandbox !== undefined || onBehalfOf !== undefined) && { attributes: { sandbox, onBehalfOf } }),
|
|
150
|
+
...(Object.values(attributes).some((v) => v !== undefined) && { attributes }),
|
|
138
151
|
}, args)
|
|
139
152
|
.catch((err) => {
|
|
140
153
|
if (runId !== undefined && err instanceof DBOSErrors.DBOSConflictingWorkflowError) {
|
|
@@ -348,6 +361,21 @@ export class SanomaClient {
|
|
|
348
361
|
});
|
|
349
362
|
return row ? { runId: row.workflowID, output: row.output, at: row.updatedAt ?? row.createdAt } : null;
|
|
350
363
|
}
|
|
364
|
+
/**
|
|
365
|
+
* Cancels every run of the app that has not ended (queued, running or waiting), as a demo's
|
|
366
|
+
* `reseed` starts afresh: its moments' runs from the last seed would otherwise wait beside the
|
|
367
|
+
* new ones.
|
|
368
|
+
*/
|
|
369
|
+
async cancelUnfinished() {
|
|
370
|
+
const rows = await this.dbos.listWorkflows({
|
|
371
|
+
status: dbosStatusesOf("queued", "running"),
|
|
372
|
+
applicationName: this.config.appName,
|
|
373
|
+
loadInput: false,
|
|
374
|
+
loadOutput: false,
|
|
375
|
+
});
|
|
376
|
+
if (rows.length)
|
|
377
|
+
await this.dbos.cancelWorkflows(rows.map((r) => r.workflowID));
|
|
378
|
+
}
|
|
351
379
|
/** The run's audit record, in order, from the ledger store. */
|
|
352
380
|
async ledger(runId) {
|
|
353
381
|
await this.mustExist(runId);
|
|
@@ -538,6 +566,229 @@ export class SanomaClient {
|
|
|
538
566
|
// A finished run's report came with its row; else wait for the run.
|
|
539
567
|
return row.status === "SUCCESS" ? row.output : await this.awaitResult(runId, 30_000);
|
|
540
568
|
}
|
|
569
|
+
/**
|
|
570
|
+
* Starts the built-in change workflow on the draft `input.id` (`ChangeInput`): its run id is
|
|
571
|
+
* `change:<id>`, or `change:<id>~<n>` once that run has ended (the second `~2`). While a run of
|
|
572
|
+
* the change has not ended, returns its id and starts nothing.
|
|
573
|
+
*/
|
|
574
|
+
async openChange(input, options) {
|
|
575
|
+
const { id } = parseOrThrow(ChangeInput, input, "Not a change to open");
|
|
576
|
+
const runs = await this.changeRuns(id);
|
|
577
|
+
const open = runs.find((r) => !isEnded(runStatus(r.status, [])));
|
|
578
|
+
if (open)
|
|
579
|
+
return open.workflowID;
|
|
580
|
+
const runId = runs.length ? `${changeRunId(id)}~${runs.length + 1}` : changeRunId(id);
|
|
581
|
+
return this.start(this.config.workflows.get(CHANGE_WORKFLOW), input, { ...options, runId });
|
|
582
|
+
}
|
|
583
|
+
/**
|
|
584
|
+
* The changes, newest first, each draft's by its latest run (`change`): `open` ones (not ended)
|
|
585
|
+
* or the others, else all; at most `limit` (20).
|
|
586
|
+
*/
|
|
587
|
+
async changes({ open, limit = 20 } = {}) {
|
|
588
|
+
const runs = await this.dbos.listWorkflows({
|
|
589
|
+
workflowName: CHANGE_WORKFLOW,
|
|
590
|
+
applicationName: this.config.appName,
|
|
591
|
+
sortDesc: true,
|
|
592
|
+
loadInput: false,
|
|
593
|
+
loadOutput: false,
|
|
594
|
+
});
|
|
595
|
+
// A draft's later run (`~2`) is its change now: an earlier one is neither open nor done.
|
|
596
|
+
const ended = new Set(dbosStatusesOf(...ENDED_STATUSES));
|
|
597
|
+
const ids = [...Map.groupBy(runs, (run) => changeIdOf(run.workflowID)).values()]
|
|
598
|
+
.map(([run]) => run)
|
|
599
|
+
.filter((run) => open === undefined || ended.has(run.status) !== open)
|
|
600
|
+
.slice(0, limit)
|
|
601
|
+
.map((run) => run.workflowID);
|
|
602
|
+
if (ids.length === 0)
|
|
603
|
+
return [];
|
|
604
|
+
const rows = await this.dbos.listWorkflows({ workflowIDs: ids, sortDesc: true, loadInput: true, loadOutput: true });
|
|
605
|
+
return Promise.all(rows.map((row) => this.changeView(row)));
|
|
606
|
+
}
|
|
607
|
+
/** The change of the draft `id`: its latest run's (`openChange`), or undefined when it has none. */
|
|
608
|
+
async change(id) {
|
|
609
|
+
const [row] = await this.changeRuns(id, { load: true });
|
|
610
|
+
return row && this.changeView(row);
|
|
611
|
+
}
|
|
612
|
+
/**
|
|
613
|
+
* Tells the change of the draft `id` what happened (`ChangeEvent`), as `options.by`: new commits
|
|
614
|
+
* on its branch, a close asked for, or its pull request closed or merged on the host. The event is
|
|
615
|
+
* queued for its latest run, which reads it when it next waits; a pending approval of the merge
|
|
616
|
+
* (Publish, or a hold on it) is withdrawn as `by` (C4's `withdraw`), so a run waiting on it reads
|
|
617
|
+
* the event now. A `close` is refused (`not_approver`) unless `by` may withdraw that approval; the
|
|
618
|
+
* other kinds are facts, so a withdrawal `by` may not make is skipped and the run's merge refuses a
|
|
619
|
+
* head that moved. `run_not_found` when the draft has no change, `run_ended` when its run has ended.
|
|
620
|
+
* With `key`, an event told again under the same key is queued once while the run has not read it.
|
|
621
|
+
*/
|
|
622
|
+
async changeEvent(id, event, options) {
|
|
623
|
+
const by = await this.admitted(parseOrThrow(PrincipalOrId, options?.by, '`by` must be a principal, such as "alice" or { id: "alice" }'));
|
|
624
|
+
const given = parseOrThrow(ChangeEventSchema, event, "Not a change event");
|
|
625
|
+
// A close is asked for by whoever asks it, whatever the event names.
|
|
626
|
+
const told = given.kind === "close" ? { kind: "close", by: by.id } : given;
|
|
627
|
+
const [row] = await this.changeRuns(id);
|
|
628
|
+
if (!row)
|
|
629
|
+
throw new SanomaError("run_not_found", `The draft ${id} has no change`, { id });
|
|
630
|
+
const runId = row.workflowID;
|
|
631
|
+
const approvals = await this.approvals(runId);
|
|
632
|
+
const status = runStatus(row.status, approvals);
|
|
633
|
+
if (isEnded(status)) {
|
|
634
|
+
throw new SanomaError("run_ended", `Run ${runId} has ${status}; it takes no more events`, { runId, status });
|
|
635
|
+
}
|
|
636
|
+
const held = approvals.find((a) => a.status === "pending" && a.covers.includes(CHANGE_MERGE));
|
|
637
|
+
// A close is whoever may withdraw Publish's, or with none pending, the starter's or admin's.
|
|
638
|
+
const refusal = withdrawalRefusal(held ?? { approver: { group: ADMIN } }, by, row.authenticatedUser);
|
|
639
|
+
if (refusal !== undefined && told.kind === "close") {
|
|
640
|
+
if (held)
|
|
641
|
+
throw notApprover(runId, held, refusal);
|
|
642
|
+
throw new SanomaError("not_approver", refusal, { runId, reason: refusal });
|
|
643
|
+
}
|
|
644
|
+
this.options.onWrite?.();
|
|
645
|
+
await this.dbos.send(runId, told, CHANGE_TOPIC, options.key);
|
|
646
|
+
if (held && refusal === undefined) {
|
|
647
|
+
await this.withdraw(runId, held.id, WITHDRAWAL[told.kind], { by, timeoutSeconds: 5 }).catch((err) => {
|
|
648
|
+
// Decided or ended meanwhile: the run reads the event when it next waits, if it does.
|
|
649
|
+
if (!["already_decided", "run_ended", "no_pending_approval"].includes(errorCode(err) ?? ""))
|
|
650
|
+
throw err;
|
|
651
|
+
});
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
/**
|
|
655
|
+
* Does what a host's webhook says happened (`RemoteEvent`, from a remote half's `webhook`) to the
|
|
656
|
+
* company's repository, the `origin` of `ClientOptions.source` (`repositoryOf`); an event of
|
|
657
|
+
* another repository, or with no source, is ignored. A delivery told again does nothing more.
|
|
658
|
+
*
|
|
659
|
+
* - `pushed` to `main`: the checkout follows `main`, then apply on the declared hosts
|
|
660
|
+
* (`ResolvedConfig.hosts`) as `host-check`, as the run `deploy:<head>`, once per head; nothing
|
|
661
|
+
* with no host, nor while a change is merging or deploying, which does both itself.
|
|
662
|
+
* - `pushed` to a draft's branch (`draftOf`) with its change open: the host's commits fetched into
|
|
663
|
+
* the draft (`Source.follow` on its branch), then the change told `commits`, as `by`; nothing
|
|
664
|
+
* when the change or the draft is at that head already (the run's own push), or when the draft
|
|
665
|
+
* cannot fast-forward to it (warned).
|
|
666
|
+
* - `closed` for the open change's pull request: the change told `merged` (with its merge commit)
|
|
667
|
+
* or `closed`, as `by`. The run checks either on the host before it believes it.
|
|
668
|
+
*/
|
|
669
|
+
async remoteEvent(event, options) {
|
|
670
|
+
const main = event.kind === "pushed" && event.branch === BASE;
|
|
671
|
+
const id = draftOf(event.branch);
|
|
672
|
+
if (!main && id === undefined)
|
|
673
|
+
return;
|
|
674
|
+
const repository = await this.repository();
|
|
675
|
+
if (!repository || !sameRepo(repository.repo, event.repo))
|
|
676
|
+
return;
|
|
677
|
+
if (main)
|
|
678
|
+
return this.deployPush(repository, event.head);
|
|
679
|
+
const change = await this.change(id);
|
|
680
|
+
if (!change || isEnded(change.status))
|
|
681
|
+
return;
|
|
682
|
+
let told;
|
|
683
|
+
let key;
|
|
684
|
+
if (event.kind === "closed") {
|
|
685
|
+
// A pull request of an earlier change of the draft is not this one's.
|
|
686
|
+
if (event.number !== change.state.pullRequest?.number)
|
|
687
|
+
return;
|
|
688
|
+
told = event.merged && event.sha !== undefined ? { kind: "merged", sha: event.sha } : { kind: "closed" };
|
|
689
|
+
key = `${event.number}:${event.sha ?? "closed"}`;
|
|
690
|
+
}
|
|
691
|
+
else {
|
|
692
|
+
if (change.state.head === event.head || !(await this.fetched(repository, event.branch, event.head)))
|
|
693
|
+
return;
|
|
694
|
+
told = { kind: "commits" };
|
|
695
|
+
key = event.head;
|
|
696
|
+
}
|
|
697
|
+
await this.changeEvent(id, told, { by: options.by, key: `${event.kind}:${event.branch}:${key}` }).catch((err) => {
|
|
698
|
+
// Ended, or gone, since it was read: nothing to tell.
|
|
699
|
+
if (!["run_ended", "run_not_found"].includes(errorCode(err) ?? ""))
|
|
700
|
+
throw err;
|
|
701
|
+
});
|
|
702
|
+
}
|
|
703
|
+
/** After a push of `head` to `main` (`remoteEvent`): the checkout follows it, then apply on the declared hosts. */
|
|
704
|
+
async deployPush({ source }, head) {
|
|
705
|
+
const runId = `deploy:${head}`;
|
|
706
|
+
const [deployed, phases] = await Promise.all([this.run(runId), this.openChangePhases()]);
|
|
707
|
+
if (deployed || phases.some((phase) => phase === "merging" || phase === "deploying"))
|
|
708
|
+
return;
|
|
709
|
+
// First, as a change's deploy does: the hosts, and what apply reads, are then main's.
|
|
710
|
+
const moved = await followBase(this.config.remotes, this.storedSecrets, source);
|
|
711
|
+
if (!("revision" in moved)) {
|
|
712
|
+
// Not on stale files, and nothing recorded as `deploy:<head>`: a redelivery may deploy it.
|
|
713
|
+
warn(`${BASE} was not deployed: the checkout did not follow it: ${"skipped" in moved ? moved.skipped : moved.error}`);
|
|
714
|
+
return;
|
|
715
|
+
}
|
|
716
|
+
const hosts = await this.config.hosts();
|
|
717
|
+
if (hosts.length)
|
|
718
|
+
await this.apply({ only: hosts }, { startedBy: HOST_CHECK_AGENT, runId });
|
|
719
|
+
}
|
|
720
|
+
/** Where each open change is (`ChangeState.phase`), read from what its run last published. */
|
|
721
|
+
async openChangePhases() {
|
|
722
|
+
const rows = await this.dbos.listWorkflows({
|
|
723
|
+
workflowName: CHANGE_WORKFLOW,
|
|
724
|
+
applicationName: this.config.appName,
|
|
725
|
+
status: dbosStatusesOf("queued", "running"),
|
|
726
|
+
loadInput: false,
|
|
727
|
+
loadOutput: false,
|
|
728
|
+
});
|
|
729
|
+
return Promise.all(rows.map(async (r) => (await this.dbos.getEvent(r.workflowID, CHANGE_EVENT, 0))?.phase));
|
|
730
|
+
}
|
|
731
|
+
/**
|
|
732
|
+
* Brings `head`, pushed to the draft's `branch` on the host, into the draft: false when it holds
|
|
733
|
+
* it already, or cannot take it (no `follow`, a commit of its own, or one uncommitted: warned).
|
|
734
|
+
*/
|
|
735
|
+
async fetched({ source, url, host }, branch, head) {
|
|
736
|
+
const local = await Promise.resolve(source.head(branch)).catch(() => undefined);
|
|
737
|
+
if (local === head)
|
|
738
|
+
return false;
|
|
739
|
+
const moved = source.follow
|
|
740
|
+
? await source.follow({ url, token: await host.token(), ref: branch })
|
|
741
|
+
: { skipped: "this repository cannot follow its remote" };
|
|
742
|
+
if ("skipped" in moved) {
|
|
743
|
+
warn(`${branch} did not take the host's commits: ${moved.skipped}`);
|
|
744
|
+
return false;
|
|
745
|
+
}
|
|
746
|
+
return true;
|
|
747
|
+
}
|
|
748
|
+
/** The repository of `ClientOptions.source` on its host (`repositoryOf`); undefined with no source, remote or half for it. */
|
|
749
|
+
async repository() {
|
|
750
|
+
const { source } = this.options;
|
|
751
|
+
if (!source)
|
|
752
|
+
return undefined;
|
|
753
|
+
return repositoryOf(this.config.remotes, this.storedSecrets, source).catch((err) => {
|
|
754
|
+
if (["no_remote", "no_remote_half"].includes(vendorCodeOf(err) ?? ""))
|
|
755
|
+
return undefined;
|
|
756
|
+
throw err;
|
|
757
|
+
});
|
|
758
|
+
}
|
|
759
|
+
/** The runs of the draft `id`'s change, newest first: `change:<id>` and `change:<id>~<n>`. */
|
|
760
|
+
async changeRuns(id, { load = false } = {}) {
|
|
761
|
+
const base = changeRunId(id);
|
|
762
|
+
const rows = await this.dbos.listWorkflows({
|
|
763
|
+
workflow_id_prefix: base,
|
|
764
|
+
workflowName: CHANGE_WORKFLOW,
|
|
765
|
+
applicationName: this.config.appName,
|
|
766
|
+
sortDesc: true,
|
|
767
|
+
loadInput: load,
|
|
768
|
+
loadOutput: load,
|
|
769
|
+
});
|
|
770
|
+
return rows.filter((r) => isChangeRunOf(id, r.workflowID));
|
|
771
|
+
}
|
|
772
|
+
/** A change run's row as the app shows it: its summary, its last `ChangeState` and, once finished, its report. */
|
|
773
|
+
async changeView(row) {
|
|
774
|
+
const [summary, published] = await Promise.all([
|
|
775
|
+
this.summarize(row),
|
|
776
|
+
this.dbos.getEvent(row.workflowID, CHANGE_EVENT, 0),
|
|
777
|
+
]);
|
|
778
|
+
const input = row.input[0].input;
|
|
779
|
+
const state = published ?? initialChangeState(input);
|
|
780
|
+
const { runId, status, startedBy, createdAt, updatedAt, approvals } = summary;
|
|
781
|
+
return {
|
|
782
|
+
runId,
|
|
783
|
+
status,
|
|
784
|
+
...(startedBy && { startedBy }),
|
|
785
|
+
createdAt,
|
|
786
|
+
...(updatedAt !== undefined && { updatedAt }),
|
|
787
|
+
approvals,
|
|
788
|
+
state,
|
|
789
|
+
...(row.status === "SUCCESS" && { report: row.output }),
|
|
790
|
+
};
|
|
791
|
+
}
|
|
541
792
|
/**
|
|
542
793
|
* Stores a value for a variable a driver's `env` declares, as `by`, and tells the workers: each
|
|
543
794
|
* loads it into its environment, unless its environment sets the variable itself. Refuses
|
|
@@ -767,5 +1018,16 @@ const alreadyDecided = (runId, a) => new SanomaError("already_decided", a.status
|
|
|
767
1018
|
...(a.decidedBy === undefined ? {} : { decidedBy: a.decidedBy }),
|
|
768
1019
|
...(a.withdrawnReason === undefined ? {} : { withdrawnReason: a.withdrawnReason }),
|
|
769
1020
|
});
|
|
1021
|
+
/** A change's first run's id: `change:<draft id>`. */
|
|
1022
|
+
const changeRunId = (id) => `change:${id}`;
|
|
1023
|
+
/** True when `runId` is a run of the draft `id`'s change: `change:<id>` or `change:<id>~<n>`. */
|
|
1024
|
+
const isChangeRunOf = (id, runId) => runId !== undefined && changeIdOf(runId) === id;
|
|
1025
|
+
/** Why a change event withdraws the merge's pending approval. */
|
|
1026
|
+
const WITHDRAWAL = {
|
|
1027
|
+
commits: "The change has new commits",
|
|
1028
|
+
close: "The change is being closed",
|
|
1029
|
+
closed: "The pull request was closed on the host",
|
|
1030
|
+
merged: "The pull request was merged on the host",
|
|
1031
|
+
};
|
|
770
1032
|
const notApprover = (runId, a, reason) => new SanomaError("not_approver", `${reason} (${a.id})`, { runId, approvalId: a.id, approver: a.approver, reason });
|
|
771
1033
|
//# sourceMappingURL=client.js.map
|