@deliverd/sdk 0.3.0 → 0.4.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/README.md +44 -0
- package/dist/dev.d.ts.map +1 -1
- package/dist/dev.js +54 -0
- package/dist/flows.d.ts +98 -0
- package/dist/flows.d.ts.map +1 -0
- package/dist/flows.js +136 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -0
- package/dist/types.d.ts +75 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/dev.ts +64 -1
- package/src/flows.ts +185 -0
- package/src/index.ts +9 -0
- package/src/types.ts +84 -1
package/README.md
CHANGED
|
@@ -161,6 +161,50 @@ await deliverd.publish({ title, content }); // get the work to the people who n
|
|
|
161
161
|
|
|
162
162
|
All five. Each one is a person your agent needs and cannot be.
|
|
163
163
|
|
|
164
|
+
## Flows
|
|
165
|
+
|
|
166
|
+
A job that takes more than one of them is one job, and a firm asking about it
|
|
167
|
+
afterwards asks about the job — not about approvals in October. A flow is the
|
|
168
|
+
thread that ties them together.
|
|
169
|
+
|
|
170
|
+
```ts
|
|
171
|
+
const flow = await deliverd.flows.resume({
|
|
172
|
+
title: "Q3 close",
|
|
173
|
+
externalId: "close_2026_q3", // so a restart extends this one
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
const { answers } = await flow.collect({ title: "Before I start", questions, respondents });
|
|
177
|
+
const outcome = await flow.review({ title: "Draft pack", reportId, reviewers });
|
|
178
|
+
if (outcome.approved) await deliverd.publish({ title, content, flowId: flow.id });
|
|
179
|
+
|
|
180
|
+
await flow.close();
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
`flow.approve()`, `flow.review()` and `flow.collect()` are the same calls as
|
|
184
|
+
the ones above with the flow already named. That is the whole point of the
|
|
185
|
+
handle: a `flowId` passed by hand at four call sites is one that gets left off
|
|
186
|
+
the fifth, and the step is then missing from the history with nothing to say
|
|
187
|
+
so. Publishing takes `flowId` directly, because a report joins a flow when it
|
|
188
|
+
is first created rather than through a handle.
|
|
189
|
+
|
|
190
|
+
It groups and does nothing else. Nothing waits on a flow, nothing is blocked
|
|
191
|
+
by one, and there are no steps to declare in advance — do the work in the
|
|
192
|
+
order you want it done and name the flow as you go.
|
|
193
|
+
|
|
194
|
+
```ts
|
|
195
|
+
flow.allSettled // nothing in it is waiting on anybody right now
|
|
196
|
+
flow.openCount // how many still are
|
|
197
|
+
flow.timeline // every audited step across all of them, in order
|
|
198
|
+
await flow.refresh()
|
|
199
|
+
await flow.close() // say the work is done; it stops taking new members
|
|
200
|
+
await flow.cancel() // call it off; nothing inside it is cancelled
|
|
201
|
+
await deliverd.flows.list({ status: "open" });
|
|
202
|
+
await deliverd.flows.get(id);
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
`allSettled` is a fact about this moment, not a verdict. You may be about to
|
|
206
|
+
add the next step, so nothing closes a flow but you.
|
|
207
|
+
|
|
164
208
|
## Collecting
|
|
165
209
|
|
|
166
210
|
`approve()` asks permission, `review()` asks judgement, and this asks for a
|
package/dist/dev.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../src/dev.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../src/dev.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAwC,MAAM,YAAY,CAAC;AAErF;;;;;;;;;;;;;;;;;;GAkBG;AAEH,MAAM,MAAM,kBAAkB,GAAG,UAAU,GAAG,UAAU,GAAG,SAAS,GAAG,UAAU,CAAC;AAElF,MAAM,WAAW,kBAAkB;IACjC;;;;OAIG;IACH,OAAO,CAAC,EAAE,kBAAkB,GAAG,CAAC,CAAC,OAAO,EAAE,YAAY,KAAK,kBAAkB,CAAC,CAAC;IAC/E,+DAA+D;IAC/D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gDAAgD;IAChD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,qDAAqD;IACrD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,6DAA6D;IAC7D,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAcD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,GAAE,kBAAuB,GAAG,OAAO,UAAU,CAAC,KAAK,CAwT1F"}
|
package/dist/dev.js
CHANGED
|
@@ -11,6 +11,7 @@ export function developmentFetch(options = {}) {
|
|
|
11
11
|
const store = new Map();
|
|
12
12
|
const reviewStore = new Map();
|
|
13
13
|
const collectionStore = new Map();
|
|
14
|
+
const flowStore = new Map();
|
|
14
15
|
return (async (input, init) => {
|
|
15
16
|
const url = new URL(String(input));
|
|
16
17
|
const path = url.pathname.replace(/^\/api\/v1/, "");
|
|
@@ -228,6 +229,59 @@ export function developmentFetch(options = {}) {
|
|
|
228
229
|
collections: externalId ? all.filter((c) => c.externalId === externalId) : all,
|
|
229
230
|
});
|
|
230
231
|
}
|
|
232
|
+
/*
|
|
233
|
+
* Flows in development are real objects with no simulation attached:
|
|
234
|
+
* there is nobody to imagine, and the thing worth exercising offline is
|
|
235
|
+
* that `flow.approve()` reaches the same code as `deliverd.approve()`.
|
|
236
|
+
* Members are not tracked here — the server derives them from rows this
|
|
237
|
+
* store does not keep — so a development flow reports what it knows and
|
|
238
|
+
* does not invent a membership.
|
|
239
|
+
*/
|
|
240
|
+
if (method === "POST" && path === "/flows") {
|
|
241
|
+
const id = `flw_dev_${++counter}`;
|
|
242
|
+
const data = {
|
|
243
|
+
id,
|
|
244
|
+
status: "open",
|
|
245
|
+
url: `https://deliverd.dev/flows/${id}`,
|
|
246
|
+
title: String(body.title ?? "Untitled"),
|
|
247
|
+
description: body.description ?? null,
|
|
248
|
+
externalId: body.externalId ?? null,
|
|
249
|
+
metadata: body.metadata ?? {},
|
|
250
|
+
startedBy: "You (development mode)",
|
|
251
|
+
members: [],
|
|
252
|
+
memberCount: 0,
|
|
253
|
+
openCount: 0,
|
|
254
|
+
allSettled: false,
|
|
255
|
+
timeline: [],
|
|
256
|
+
settledAt: null,
|
|
257
|
+
createdAt: new Date().toISOString(),
|
|
258
|
+
};
|
|
259
|
+
flowStore.set(id, data);
|
|
260
|
+
if (options.log !== false) {
|
|
261
|
+
console.log(`\n \u25B8 Flow started: ${data.title}\n ${data.url}\n`);
|
|
262
|
+
}
|
|
263
|
+
return json(data, 201);
|
|
264
|
+
}
|
|
265
|
+
const flowMatch = /^\/flows\/([^/]+)(\/complete|\/cancel)?$/.exec(path);
|
|
266
|
+
if (flowMatch) {
|
|
267
|
+
const flow = flowStore.get(flowMatch[1]);
|
|
268
|
+
if (!flow) {
|
|
269
|
+
return json({ error: { code: "not_found", message: "No such flow in this development session." } }, 404);
|
|
270
|
+
}
|
|
271
|
+
if (flowMatch[2] === "/complete" || flowMatch[2] === "/cancel") {
|
|
272
|
+
if (flow.status !== "open") {
|
|
273
|
+
return json({ error: { code: "not_open", message: `This flow is already ${flow.status}.` } }, 409);
|
|
274
|
+
}
|
|
275
|
+
flow.status = flowMatch[2] === "/complete" ? "complete" : "cancelled";
|
|
276
|
+
flow.settledAt = new Date().toISOString();
|
|
277
|
+
}
|
|
278
|
+
return json(flow);
|
|
279
|
+
}
|
|
280
|
+
if (method === "GET" && path === "/flows") {
|
|
281
|
+
const externalId = url.searchParams.get("externalId");
|
|
282
|
+
const all = [...flowStore.values()];
|
|
283
|
+
return json({ flows: externalId ? all.filter((f) => f.externalId === externalId) : all });
|
|
284
|
+
}
|
|
231
285
|
return json({
|
|
232
286
|
error: {
|
|
233
287
|
code: "not_in_development_mode",
|
package/dist/flows.d.ts
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import type { HttpClient } from "./http.js";
|
|
2
|
+
import type { CreateFlowInput, FlowData, ListFlowsInput } from "./types.js";
|
|
3
|
+
import type { ApproveOptions, CollectOptions, Decision, ReviewOptions, ReviewOutcome } from "./index.js";
|
|
4
|
+
import type { CollectedAnswers } from "./types.js";
|
|
5
|
+
/**
|
|
6
|
+
* A flow: the thread that ties one job's approvals, reviews, collections and
|
|
7
|
+
* publishes together.
|
|
8
|
+
*
|
|
9
|
+
* The reason it exists in this SDK rather than only in the API is the handle
|
|
10
|
+
* below. An agent doing a multi-step job would otherwise carry a `flowId`
|
|
11
|
+
* through every call and pass it by hand each time — which works right up
|
|
12
|
+
* until one call is written without it, and that step is then missing from
|
|
13
|
+
* the history with nothing to say so. `flow.approve()` cannot forget.
|
|
14
|
+
*
|
|
15
|
+
* It groups and nothing else. Nothing waits on a flow; nothing is blocked by
|
|
16
|
+
* one; there are no steps to declare up front. Do the work in the order you
|
|
17
|
+
* want it done and name the flow as you go.
|
|
18
|
+
*/
|
|
19
|
+
/** The three primitives a flow can start on your behalf, with their real signatures. */
|
|
20
|
+
export interface FlowPrimitives {
|
|
21
|
+
approve(options: ApproveOptions): Promise<Decision>;
|
|
22
|
+
review(options: ReviewOptions): Promise<ReviewOutcome>;
|
|
23
|
+
collect(options: CollectOptions): Promise<CollectedAnswers>;
|
|
24
|
+
}
|
|
25
|
+
export declare class Flow {
|
|
26
|
+
private readonly http;
|
|
27
|
+
private data;
|
|
28
|
+
private readonly client;
|
|
29
|
+
constructor(http: HttpClient, data: FlowData, client: FlowPrimitives);
|
|
30
|
+
get id(): string;
|
|
31
|
+
get status(): FlowData["status"];
|
|
32
|
+
/** The timeline page a person can open. */
|
|
33
|
+
get url(): string;
|
|
34
|
+
get title(): string;
|
|
35
|
+
get members(): FlowData["members"];
|
|
36
|
+
get timeline(): NonNullable<FlowData["timeline"]>;
|
|
37
|
+
get memberCount(): number;
|
|
38
|
+
get openCount(): number;
|
|
39
|
+
get open(): boolean;
|
|
40
|
+
get complete(): boolean;
|
|
41
|
+
get cancelled(): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Nothing in it is waiting on anybody *at this moment*.
|
|
44
|
+
*
|
|
45
|
+
* Not a claim that the job is finished — you may be about to add the next
|
|
46
|
+
* step, and an empty flow is never settled. Branch on it to decide whether
|
|
47
|
+
* to move on; call `complete()` to say the work is over.
|
|
48
|
+
*/
|
|
49
|
+
get allSettled(): boolean;
|
|
50
|
+
toJSON(): FlowData;
|
|
51
|
+
refresh(signal?: AbortSignal): Promise<this>;
|
|
52
|
+
/**
|
|
53
|
+
* Ask permission, inside this flow. Exactly `deliverd.approve()` with the
|
|
54
|
+
* flow already named — which is the point: a `flowId` passed by hand at
|
|
55
|
+
* four call sites is one that gets left off the fifth.
|
|
56
|
+
*/
|
|
57
|
+
approve(options: Omit<ApproveOptions, "flowId">): Promise<Decision>;
|
|
58
|
+
/** Ask for judgement, inside this flow. */
|
|
59
|
+
review(options: Omit<ReviewOptions, "flowId">): Promise<ReviewOutcome>;
|
|
60
|
+
/** Ask for facts, inside this flow. */
|
|
61
|
+
collect(options: Omit<CollectOptions, "flowId">): Promise<CollectedAnswers>;
|
|
62
|
+
/**
|
|
63
|
+
* Say the work is done. It stops taking new members from here.
|
|
64
|
+
*
|
|
65
|
+
* Named `close()` rather than `complete()` so it does not collide with the
|
|
66
|
+
* `complete` getter above, which every other primitive in this SDK also
|
|
67
|
+
* has; `flow.complete` asks, `flow.close()` decides.
|
|
68
|
+
*
|
|
69
|
+
* Allowed with steps still outstanding, and how many is recorded — a flow
|
|
70
|
+
* that could not be closed until every reviewer replied would be one that
|
|
71
|
+
* stayed open for ever.
|
|
72
|
+
*/
|
|
73
|
+
close(signal?: AbortSignal): Promise<this>;
|
|
74
|
+
/** Call it off. The flow and its members stay as evidence; nothing inside is cancelled. */
|
|
75
|
+
cancel(signal?: AbortSignal): Promise<this>;
|
|
76
|
+
}
|
|
77
|
+
export declare class Flows {
|
|
78
|
+
private readonly http;
|
|
79
|
+
private readonly client;
|
|
80
|
+
constructor(http: HttpClient, client: FlowPrimitives);
|
|
81
|
+
create(input: CreateFlowInput, signal?: AbortSignal): Promise<Flow>;
|
|
82
|
+
get(id: string, signal?: AbortSignal): Promise<Flow>;
|
|
83
|
+
list(input?: ListFlowsInput, signal?: AbortSignal): Promise<Flow[]>;
|
|
84
|
+
/** The same job as before, when there was one — so a restart extends it rather than starting a second. */
|
|
85
|
+
findByExternalId(externalId: string, signal?: AbortSignal): Promise<Flow | null>;
|
|
86
|
+
/**
|
|
87
|
+
* The flow for this reference, started if it does not exist yet.
|
|
88
|
+
*
|
|
89
|
+
* What a restartable agent actually wants: one line that is correct on the
|
|
90
|
+
* first run and on the fourth. Without it the caller writes the lookup, the
|
|
91
|
+
* branch and the create by hand, and a crash between the lookup and the
|
|
92
|
+
* create leaves two flows for one job.
|
|
93
|
+
*/
|
|
94
|
+
resume(input: CreateFlowInput & {
|
|
95
|
+
externalId: string;
|
|
96
|
+
}, signal?: AbortSignal): Promise<Flow>;
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=flows.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flows.d.ts","sourceRoot":"","sources":["../src/flows.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,KAAK,EAAE,eAAe,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAO5E,OAAO,KAAK,EACV,cAAc,EACd,cAAc,EACd,QAAQ,EACR,aAAa,EACb,aAAa,EACd,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEnD;;;;;;;;;;;;;GAaG;AAEH,wFAAwF;AACxF,MAAM,WAAW,cAAc;IAC7B,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IACpD,MAAM,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;IACvD,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC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E;;;;;;;;;;OAUG;IACG,KAAK,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAShD,2FAA2F;IACrF,MAAM,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;CAQlD;AAED,qBAAa,KAAK;IAEd,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,MAAM;gBADN,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,cAAc;IAGnC,MAAM,CAAC,KAAK,EAAE,eAAe,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAUnE,GAAG,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IASpD,IAAI,CAAC,KAAK,GAAE,cAAmB,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IAU7E,0GAA0G;IACpG,gBAAgB,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;IAKtF;;;;;;;OAOG;IACG,MAAM,CAAC,KAAK,EAAE,eAAe,GAAG;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;CAKnG"}
|
package/dist/flows.js
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
export class Flow {
|
|
2
|
+
http;
|
|
3
|
+
data;
|
|
4
|
+
client;
|
|
5
|
+
constructor(http, data, client) {
|
|
6
|
+
this.http = http;
|
|
7
|
+
this.data = data;
|
|
8
|
+
this.client = client;
|
|
9
|
+
}
|
|
10
|
+
get id() { return this.data.id; }
|
|
11
|
+
get status() { return this.data.status; }
|
|
12
|
+
/** The timeline page a person can open. */
|
|
13
|
+
get url() { return this.data.url; }
|
|
14
|
+
get title() { return this.data.title; }
|
|
15
|
+
get members() { return this.data.members; }
|
|
16
|
+
get timeline() { return this.data.timeline ?? []; }
|
|
17
|
+
get memberCount() { return this.data.memberCount; }
|
|
18
|
+
get openCount() { return this.data.openCount; }
|
|
19
|
+
get open() { return this.data.status === "open"; }
|
|
20
|
+
get complete() { return this.data.status === "complete"; }
|
|
21
|
+
get cancelled() { return this.data.status === "cancelled"; }
|
|
22
|
+
/**
|
|
23
|
+
* Nothing in it is waiting on anybody *at this moment*.
|
|
24
|
+
*
|
|
25
|
+
* Not a claim that the job is finished — you may be about to add the next
|
|
26
|
+
* step, and an empty flow is never settled. Branch on it to decide whether
|
|
27
|
+
* to move on; call `complete()` to say the work is over.
|
|
28
|
+
*/
|
|
29
|
+
get allSettled() { return this.data.allSettled; }
|
|
30
|
+
toJSON() { return this.data; }
|
|
31
|
+
async refresh(signal) {
|
|
32
|
+
this.data = await this.http.request({
|
|
33
|
+
method: "GET",
|
|
34
|
+
path: `/flows/${this.data.id}`,
|
|
35
|
+
signal,
|
|
36
|
+
});
|
|
37
|
+
return this;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Ask permission, inside this flow. Exactly `deliverd.approve()` with the
|
|
41
|
+
* flow already named — which is the point: a `flowId` passed by hand at
|
|
42
|
+
* four call sites is one that gets left off the fifth.
|
|
43
|
+
*/
|
|
44
|
+
approve(options) {
|
|
45
|
+
return this.client.approve({ ...options, flowId: this.data.id });
|
|
46
|
+
}
|
|
47
|
+
/** Ask for judgement, inside this flow. */
|
|
48
|
+
review(options) {
|
|
49
|
+
return this.client.review({ ...options, flowId: this.data.id });
|
|
50
|
+
}
|
|
51
|
+
/** Ask for facts, inside this flow. */
|
|
52
|
+
collect(options) {
|
|
53
|
+
return this.client.collect({ ...options, flowId: this.data.id });
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Say the work is done. It stops taking new members from here.
|
|
57
|
+
*
|
|
58
|
+
* Named `close()` rather than `complete()` so it does not collide with the
|
|
59
|
+
* `complete` getter above, which every other primitive in this SDK also
|
|
60
|
+
* has; `flow.complete` asks, `flow.close()` decides.
|
|
61
|
+
*
|
|
62
|
+
* Allowed with steps still outstanding, and how many is recorded — a flow
|
|
63
|
+
* that could not be closed until every reviewer replied would be one that
|
|
64
|
+
* stayed open for ever.
|
|
65
|
+
*/
|
|
66
|
+
async close(signal) {
|
|
67
|
+
this.data = await this.http.request({
|
|
68
|
+
method: "POST",
|
|
69
|
+
path: `/flows/${this.data.id}/complete`,
|
|
70
|
+
signal,
|
|
71
|
+
});
|
|
72
|
+
return this;
|
|
73
|
+
}
|
|
74
|
+
/** Call it off. The flow and its members stay as evidence; nothing inside is cancelled. */
|
|
75
|
+
async cancel(signal) {
|
|
76
|
+
this.data = await this.http.request({
|
|
77
|
+
method: "POST",
|
|
78
|
+
path: `/flows/${this.data.id}/cancel`,
|
|
79
|
+
signal,
|
|
80
|
+
});
|
|
81
|
+
return this;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
export class Flows {
|
|
85
|
+
http;
|
|
86
|
+
client;
|
|
87
|
+
constructor(http, client) {
|
|
88
|
+
this.http = http;
|
|
89
|
+
this.client = client;
|
|
90
|
+
}
|
|
91
|
+
async create(input, signal) {
|
|
92
|
+
const data = await this.http.request({
|
|
93
|
+
method: "POST",
|
|
94
|
+
path: "/flows",
|
|
95
|
+
body: input,
|
|
96
|
+
signal,
|
|
97
|
+
});
|
|
98
|
+
return new Flow(this.http, data, this.client);
|
|
99
|
+
}
|
|
100
|
+
async get(id, signal) {
|
|
101
|
+
const data = await this.http.request({
|
|
102
|
+
method: "GET",
|
|
103
|
+
path: `/flows/${id}`,
|
|
104
|
+
signal,
|
|
105
|
+
});
|
|
106
|
+
return new Flow(this.http, data, this.client);
|
|
107
|
+
}
|
|
108
|
+
async list(input = {}, signal) {
|
|
109
|
+
const { flows } = await this.http.request({
|
|
110
|
+
method: "GET",
|
|
111
|
+
path: "/flows",
|
|
112
|
+
query: { status: input.status, externalId: input.externalId, limit: input.limit },
|
|
113
|
+
signal,
|
|
114
|
+
});
|
|
115
|
+
return flows.map((f) => new Flow(this.http, f, this.client));
|
|
116
|
+
}
|
|
117
|
+
/** The same job as before, when there was one — so a restart extends it rather than starting a second. */
|
|
118
|
+
async findByExternalId(externalId, signal) {
|
|
119
|
+
const found = await this.list({ externalId, limit: 1 }, signal);
|
|
120
|
+
return found[0] ?? null;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* The flow for this reference, started if it does not exist yet.
|
|
124
|
+
*
|
|
125
|
+
* What a restartable agent actually wants: one line that is correct on the
|
|
126
|
+
* first run and on the fourth. Without it the caller writes the lookup, the
|
|
127
|
+
* branch and the create by hand, and a crash between the lookup and the
|
|
128
|
+
* create leaves two flows for one job.
|
|
129
|
+
*/
|
|
130
|
+
async resume(input, signal) {
|
|
131
|
+
const existing = await this.findByExternalId(input.externalId, signal);
|
|
132
|
+
if (existing && existing.open)
|
|
133
|
+
return existing;
|
|
134
|
+
return this.create(input, signal);
|
|
135
|
+
}
|
|
136
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { Approvals, type WaitOptions } from "./approvals.js";
|
|
|
3
3
|
import { Comments, Reports } from "./reports.js";
|
|
4
4
|
import { Reviews, type ReviewWaitOptions } from "./reviews.js";
|
|
5
5
|
import { Collections, type CollectWaitOptions } from "./collections.js";
|
|
6
|
+
import { Flows } from "./flows.js";
|
|
6
7
|
import { Webhooks } from "./webhooks.js";
|
|
7
8
|
import { type DevelopmentOptions } from "./dev.js";
|
|
8
9
|
import { type Duration } from "./duration.js";
|
|
@@ -11,6 +12,7 @@ export { Approval, Approvals, POLL_SCHEDULE, type WaitOptions } from "./approval
|
|
|
11
12
|
export { Comments, Reports } from "./reports.js";
|
|
12
13
|
export { Review, Reviews, type ReviewWaitOptions } from "./reviews.js";
|
|
13
14
|
export { Collection, Collections, type CollectWaitOptions } from "./collections.js";
|
|
15
|
+
export { Flow, Flows, type FlowPrimitives } from "./flows.js";
|
|
14
16
|
export { constructEvent, DELIVERY_HEADER, EVENT_HEADER, SIGNATURE_HEADER, TOLERANCE_SECONDS, verifySignature, Webhooks, } from "./webhooks.js";
|
|
15
17
|
export { DeliverdError, DeliverdTimeoutError } from "./errors.js";
|
|
16
18
|
export { DEFAULT_BASE_URL, type ClientOptions } from "./http.js";
|
|
@@ -108,6 +110,7 @@ export declare class Deliverd {
|
|
|
108
110
|
readonly approvals: Approvals;
|
|
109
111
|
readonly reviews: Reviews;
|
|
110
112
|
readonly collections: Collections;
|
|
113
|
+
readonly flows: Flows;
|
|
111
114
|
readonly reports: Reports;
|
|
112
115
|
readonly comments: Comments;
|
|
113
116
|
readonly webhooks: Webhooks;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,aAAa,EAAE,MAAM,WAAW,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAsB,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACjF,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,KAAK,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAoB,KAAK,kBAAkB,EAAE,MAAM,UAAU,CAAC;AACrE,OAAO,EAAc,KAAK,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE1D,OAAO,KAAK,EACV,gBAAgB,EAChB,mBAAmB,EACnB,qBAAqB,EACrB,iBAAiB,EACjB,QAAQ,EACR,kBAAkB,EAClB,aAAa,EACb,aAAa,EAC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IAC5B,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,uDAAuD;IACvD,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;gBAElB,OAAO,GAAE,eAAoB;IA0BzC;;;;;;;;;;OAUG;IACG,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,QAAQ,CAAC;IA0CzD;;;;;;OAMG;IACG,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC;IAKxD;;;;;;;;;;;;;;;;;;;;OAoBG;IACG,MAAM,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;IAoC5D;;;;;;;;;;;;;;;;;;;;;OAqBG;IACG,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAkCjE,gFAAgF;IAChF,OAAO,CAAC,KAAK,EAAE,kBAAkB,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,aAAa,CAAC;CAGjF;AAoBD,eAAO,MAAM,QAAQ,EAAE,QAMrB,CAAC;AAEH,eAAe,QAAQ,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -3,6 +3,7 @@ import { Approvals, FAST_POLL_SCHEDULE } from "./approvals.js";
|
|
|
3
3
|
import { Comments, Reports } from "./reports.js";
|
|
4
4
|
import { Reviews } from "./reviews.js";
|
|
5
5
|
import { Collections } from "./collections.js";
|
|
6
|
+
import { Flows } from "./flows.js";
|
|
6
7
|
import { Webhooks } from "./webhooks.js";
|
|
7
8
|
import { developmentFetch } from "./dev.js";
|
|
8
9
|
import { durationMs } from "./duration.js";
|
|
@@ -10,6 +11,7 @@ export { Approval, Approvals, POLL_SCHEDULE } from "./approvals.js";
|
|
|
10
11
|
export { Comments, Reports } from "./reports.js";
|
|
11
12
|
export { Review, Reviews } from "./reviews.js";
|
|
12
13
|
export { Collection, Collections } from "./collections.js";
|
|
14
|
+
export { Flow, Flows } from "./flows.js";
|
|
13
15
|
export { constructEvent, DELIVERY_HEADER, EVENT_HEADER, SIGNATURE_HEADER, TOLERANCE_SECONDS, verifySignature, Webhooks, } from "./webhooks.js";
|
|
14
16
|
export { DeliverdError, DeliverdTimeoutError } from "./errors.js";
|
|
15
17
|
export { DEFAULT_BASE_URL } from "./http.js";
|
|
@@ -39,6 +41,7 @@ export class Deliverd {
|
|
|
39
41
|
approvals;
|
|
40
42
|
reviews;
|
|
41
43
|
collections;
|
|
44
|
+
flows;
|
|
42
45
|
reports;
|
|
43
46
|
comments;
|
|
44
47
|
webhooks;
|
|
@@ -58,6 +61,12 @@ export class Deliverd {
|
|
|
58
61
|
this.approvals = new Approvals(this.http);
|
|
59
62
|
this.reviews = new Reviews(this.http);
|
|
60
63
|
this.collections = new Collections(this.http);
|
|
64
|
+
/*
|
|
65
|
+
* The handle takes the client so `flow.approve()` is the same call as
|
|
66
|
+
* `deliverd.approve()` with the flow filled in, rather than a second
|
|
67
|
+
* implementation that can drift from it.
|
|
68
|
+
*/
|
|
69
|
+
this.flows = new Flows(this.http, this);
|
|
61
70
|
this.reports = new Reports(this.http);
|
|
62
71
|
this.comments = new Comments(this.http);
|
|
63
72
|
this.webhooks = new Webhooks();
|
package/dist/types.d.ts
CHANGED
|
@@ -72,6 +72,12 @@ export interface CreateApprovalInput {
|
|
|
72
72
|
expiresAt?: string;
|
|
73
73
|
/** Your own reference, returned unchanged and searchable. */
|
|
74
74
|
externalId?: string;
|
|
75
|
+
/**
|
|
76
|
+
* The flow this belongs to, when it is one step of a larger piece of work.
|
|
77
|
+
* Must be an open flow in your organisation. `flow.approve()` and its
|
|
78
|
+
* siblings set this for you.
|
|
79
|
+
*/
|
|
80
|
+
flowId?: string;
|
|
75
81
|
metadata?: Record<string, unknown>;
|
|
76
82
|
}
|
|
77
83
|
/**
|
|
@@ -168,7 +174,7 @@ export interface CommentThread {
|
|
|
168
174
|
}[];
|
|
169
175
|
[key: string]: unknown;
|
|
170
176
|
}
|
|
171
|
-
export type WebhookEventName = "report.published" | "report.updated" | "report.shared" | "report.viewed" | "comment.created" | "access.requested" | "schedule.due" | "publish.held" | "approval.requested" | "approval.approved" | "approval.rejected" | "approval.expired" | "approval.question" | "approval.answered" | "review.requested" | "review.approved" | "review.changes_requested" | "collection.requested" | "collection.completed";
|
|
177
|
+
export type WebhookEventName = "report.published" | "report.updated" | "report.shared" | "report.viewed" | "comment.created" | "access.requested" | "schedule.due" | "publish.held" | "approval.requested" | "approval.approved" | "approval.rejected" | "approval.expired" | "approval.question" | "approval.answered" | "review.requested" | "review.approved" | "review.changes_requested" | "collection.requested" | "collection.completed" | "flow.completed";
|
|
172
178
|
export interface WebhookEvent {
|
|
173
179
|
event: WebhookEventName;
|
|
174
180
|
sentAt: string;
|
|
@@ -204,6 +210,12 @@ export interface CreateReviewInput {
|
|
|
204
210
|
expiresAt?: string;
|
|
205
211
|
/** Your own reference, returned unchanged and searchable. */
|
|
206
212
|
externalId?: string;
|
|
213
|
+
/**
|
|
214
|
+
* The flow this belongs to, when it is one step of a larger piece of work.
|
|
215
|
+
* Must be an open flow in your organisation. `flow.approve()` and its
|
|
216
|
+
* siblings set this for you.
|
|
217
|
+
*/
|
|
218
|
+
flowId?: string;
|
|
207
219
|
metadata?: Record<string, unknown>;
|
|
208
220
|
}
|
|
209
221
|
export interface ReviewerRef {
|
|
@@ -293,6 +305,12 @@ export interface CreateCollectionInput {
|
|
|
293
305
|
/** After this the request closes unanswered. ISO 8601. */
|
|
294
306
|
expiresAt?: string;
|
|
295
307
|
externalId?: string;
|
|
308
|
+
/**
|
|
309
|
+
* The flow this belongs to, when it is one step of a larger piece of work.
|
|
310
|
+
* Must be an open flow in your organisation. `flow.approve()` and its
|
|
311
|
+
* siblings set this for you.
|
|
312
|
+
*/
|
|
313
|
+
flowId?: string;
|
|
296
314
|
metadata?: Record<string, unknown>;
|
|
297
315
|
}
|
|
298
316
|
export interface CollectionQuestion {
|
|
@@ -357,4 +375,60 @@ export interface ListCollectionsInput {
|
|
|
357
375
|
externalId?: string;
|
|
358
376
|
limit?: number;
|
|
359
377
|
}
|
|
378
|
+
export type FlowStatus = "open" | "complete" | "cancelled";
|
|
379
|
+
export type FlowMemberKind = "approval" | "review" | "collection" | "report";
|
|
380
|
+
export interface FlowMember {
|
|
381
|
+
kind: FlowMemberKind;
|
|
382
|
+
id: string;
|
|
383
|
+
title: string;
|
|
384
|
+
/** The member's own status word, which differs by kind. */
|
|
385
|
+
status: string;
|
|
386
|
+
/** Still waiting on somebody. Always false for a report. */
|
|
387
|
+
open: boolean;
|
|
388
|
+
createdAt: string;
|
|
389
|
+
}
|
|
390
|
+
/** One line of the history: what happened, who did it, when. */
|
|
391
|
+
export interface FlowEvent {
|
|
392
|
+
event: string;
|
|
393
|
+
actor: string;
|
|
394
|
+
actorType: string;
|
|
395
|
+
resourceType: string | null;
|
|
396
|
+
resourceId: string | null;
|
|
397
|
+
at: string;
|
|
398
|
+
}
|
|
399
|
+
export interface FlowData {
|
|
400
|
+
id: string;
|
|
401
|
+
status: FlowStatus;
|
|
402
|
+
/** The timeline page a person can open. */
|
|
403
|
+
url: string;
|
|
404
|
+
title: string;
|
|
405
|
+
description: string | null;
|
|
406
|
+
externalId: string | null;
|
|
407
|
+
metadata: Record<string, unknown>;
|
|
408
|
+
startedBy: string;
|
|
409
|
+
members: FlowMember[];
|
|
410
|
+
memberCount: number;
|
|
411
|
+
openCount: number;
|
|
412
|
+
/** Nothing outstanding right now — not a claim that the job is finished. */
|
|
413
|
+
allSettled: boolean;
|
|
414
|
+
/** Present on a single read, absent from a list. */
|
|
415
|
+
timeline?: FlowEvent[];
|
|
416
|
+
settledAt: string | null;
|
|
417
|
+
createdAt: string;
|
|
418
|
+
}
|
|
419
|
+
export interface CreateFlowInput {
|
|
420
|
+
/** What this piece of work is, as the timeline will be titled. */
|
|
421
|
+
title: string;
|
|
422
|
+
/** What it is for, for whoever reads the history a year from now. */
|
|
423
|
+
description?: string;
|
|
424
|
+
workspaceId?: string;
|
|
425
|
+
/** Your own reference. Pass it and use `resume()` so a restart does not start a second flow. */
|
|
426
|
+
externalId?: string;
|
|
427
|
+
metadata?: Record<string, unknown>;
|
|
428
|
+
}
|
|
429
|
+
export interface ListFlowsInput {
|
|
430
|
+
status?: FlowStatus;
|
|
431
|
+
externalId?: string;
|
|
432
|
+
limit?: number;
|
|
433
|
+
}
|
|
360
434
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,UAAU,GAAG,UAAU,GAAG,SAAS,GAAG,WAAW,CAAC;AAC3F,MAAM,MAAM,YAAY,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,UAAU,CAAC;AAElE,2DAA2D;AAC3D,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,IAAI,GAAG,SAAS,GAAG,MAAM,CAAC;IACnC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAED,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,cAAc,CAAC;IACvB,wCAAwC;IACxC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;I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AC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
|
package/package.json
CHANGED
package/src/dev.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ApprovalData, CollectionData, ReviewData } from "./types.js";
|
|
1
|
+
import type { ApprovalData, CollectionData, FlowData, ReviewData } from "./types.js";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Development mode: the whole loop, on your machine, with nobody in it.
|
|
@@ -62,6 +62,7 @@ export function developmentFetch(options: DevelopmentOptions = {}): typeof globa
|
|
|
62
62
|
const store = new Map<string, Stored>();
|
|
63
63
|
const reviewStore = new Map<string, StoredReview>();
|
|
64
64
|
const collectionStore = new Map<string, StoredCollection>();
|
|
65
|
+
const flowStore = new Map<string, FlowData>();
|
|
65
66
|
|
|
66
67
|
return (async (input: string | URL | Request, init?: RequestInit) => {
|
|
67
68
|
const url = new URL(String(input));
|
|
@@ -297,6 +298,68 @@ export function developmentFetch(options: DevelopmentOptions = {}): typeof globa
|
|
|
297
298
|
});
|
|
298
299
|
}
|
|
299
300
|
|
|
301
|
+
/*
|
|
302
|
+
* Flows in development are real objects with no simulation attached:
|
|
303
|
+
* there is nobody to imagine, and the thing worth exercising offline is
|
|
304
|
+
* that `flow.approve()` reaches the same code as `deliverd.approve()`.
|
|
305
|
+
* Members are not tracked here — the server derives them from rows this
|
|
306
|
+
* store does not keep — so a development flow reports what it knows and
|
|
307
|
+
* does not invent a membership.
|
|
308
|
+
*/
|
|
309
|
+
if (method === "POST" && path === "/flows") {
|
|
310
|
+
const id = `flw_dev_${++counter}`;
|
|
311
|
+
const data: FlowData = {
|
|
312
|
+
id,
|
|
313
|
+
status: "open",
|
|
314
|
+
url: `https://deliverd.dev/flows/${id}`,
|
|
315
|
+
title: String(body.title ?? "Untitled"),
|
|
316
|
+
description: (body.description as string | undefined) ?? null,
|
|
317
|
+
externalId: (body.externalId as string | undefined) ?? null,
|
|
318
|
+
metadata: (body.metadata as Record<string, unknown>) ?? {},
|
|
319
|
+
startedBy: "You (development mode)",
|
|
320
|
+
members: [],
|
|
321
|
+
memberCount: 0,
|
|
322
|
+
openCount: 0,
|
|
323
|
+
allSettled: false,
|
|
324
|
+
timeline: [],
|
|
325
|
+
settledAt: null,
|
|
326
|
+
createdAt: new Date().toISOString(),
|
|
327
|
+
};
|
|
328
|
+
flowStore.set(id, data);
|
|
329
|
+
if (options.log !== false) {
|
|
330
|
+
console.log(`\n \u25B8 Flow started: ${data.title}\n ${data.url}\n`);
|
|
331
|
+
}
|
|
332
|
+
return json(data, 201);
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
const flowMatch = /^\/flows\/([^/]+)(\/complete|\/cancel)?$/.exec(path);
|
|
336
|
+
if (flowMatch) {
|
|
337
|
+
const flow = flowStore.get(flowMatch[1]!);
|
|
338
|
+
if (!flow) {
|
|
339
|
+
return json(
|
|
340
|
+
{ error: { code: "not_found", message: "No such flow in this development session." } },
|
|
341
|
+
404
|
|
342
|
+
);
|
|
343
|
+
}
|
|
344
|
+
if (flowMatch[2] === "/complete" || flowMatch[2] === "/cancel") {
|
|
345
|
+
if (flow.status !== "open") {
|
|
346
|
+
return json(
|
|
347
|
+
{ error: { code: "not_open", message: `This flow is already ${flow.status}.` } },
|
|
348
|
+
409
|
|
349
|
+
);
|
|
350
|
+
}
|
|
351
|
+
flow.status = flowMatch[2] === "/complete" ? "complete" : "cancelled";
|
|
352
|
+
flow.settledAt = new Date().toISOString();
|
|
353
|
+
}
|
|
354
|
+
return json(flow);
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
if (method === "GET" && path === "/flows") {
|
|
358
|
+
const externalId = url.searchParams.get("externalId");
|
|
359
|
+
const all = [...flowStore.values()];
|
|
360
|
+
return json({ flows: externalId ? all.filter((f) => f.externalId === externalId) : all });
|
|
361
|
+
}
|
|
362
|
+
|
|
300
363
|
return json(
|
|
301
364
|
{
|
|
302
365
|
error: {
|
package/src/flows.ts
ADDED
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import type { HttpClient } from "./http.js";
|
|
2
|
+
import type { CreateFlowInput, FlowData, ListFlowsInput } from "./types.js";
|
|
3
|
+
/*
|
|
4
|
+
* Type-only, and therefore erased: `index.ts` imports this file at runtime,
|
|
5
|
+
* and a value import back would be a cycle. What the handle needs from the
|
|
6
|
+
* client is its three primitives with their real signatures, so that
|
|
7
|
+
* `flow.approve({…})` is checked exactly as `deliverd.approve({…})` is.
|
|
8
|
+
*/
|
|
9
|
+
import type {
|
|
10
|
+
ApproveOptions,
|
|
11
|
+
CollectOptions,
|
|
12
|
+
Decision,
|
|
13
|
+
ReviewOptions,
|
|
14
|
+
ReviewOutcome,
|
|
15
|
+
} from "./index.js";
|
|
16
|
+
import type { CollectedAnswers } from "./types.js";
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* A flow: the thread that ties one job's approvals, reviews, collections and
|
|
20
|
+
* publishes together.
|
|
21
|
+
*
|
|
22
|
+
* The reason it exists in this SDK rather than only in the API is the handle
|
|
23
|
+
* below. An agent doing a multi-step job would otherwise carry a `flowId`
|
|
24
|
+
* through every call and pass it by hand each time — which works right up
|
|
25
|
+
* until one call is written without it, and that step is then missing from
|
|
26
|
+
* the history with nothing to say so. `flow.approve()` cannot forget.
|
|
27
|
+
*
|
|
28
|
+
* It groups and nothing else. Nothing waits on a flow; nothing is blocked by
|
|
29
|
+
* one; there are no steps to declare up front. Do the work in the order you
|
|
30
|
+
* want it done and name the flow as you go.
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
/** The three primitives a flow can start on your behalf, with their real signatures. */
|
|
34
|
+
export interface FlowPrimitives {
|
|
35
|
+
approve(options: ApproveOptions): Promise<Decision>;
|
|
36
|
+
review(options: ReviewOptions): Promise<ReviewOutcome>;
|
|
37
|
+
collect(options: CollectOptions): Promise<CollectedAnswers>;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export class Flow {
|
|
41
|
+
constructor(
|
|
42
|
+
private readonly http: HttpClient,
|
|
43
|
+
private data: FlowData,
|
|
44
|
+
private readonly client: FlowPrimitives
|
|
45
|
+
) {}
|
|
46
|
+
|
|
47
|
+
get id(): string { return this.data.id; }
|
|
48
|
+
get status(): FlowData["status"] { return this.data.status; }
|
|
49
|
+
/** The timeline page a person can open. */
|
|
50
|
+
get url(): string { return this.data.url; }
|
|
51
|
+
get title(): string { return this.data.title; }
|
|
52
|
+
get members(): FlowData["members"] { return this.data.members; }
|
|
53
|
+
get timeline(): NonNullable<FlowData["timeline"]> { return this.data.timeline ?? []; }
|
|
54
|
+
get memberCount(): number { return this.data.memberCount; }
|
|
55
|
+
get openCount(): number { return this.data.openCount; }
|
|
56
|
+
|
|
57
|
+
get open(): boolean { return this.data.status === "open"; }
|
|
58
|
+
get complete(): boolean { return this.data.status === "complete"; }
|
|
59
|
+
get cancelled(): boolean { return this.data.status === "cancelled"; }
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Nothing in it is waiting on anybody *at this moment*.
|
|
63
|
+
*
|
|
64
|
+
* Not a claim that the job is finished — you may be about to add the next
|
|
65
|
+
* step, and an empty flow is never settled. Branch on it to decide whether
|
|
66
|
+
* to move on; call `complete()` to say the work is over.
|
|
67
|
+
*/
|
|
68
|
+
get allSettled(): boolean { return this.data.allSettled; }
|
|
69
|
+
|
|
70
|
+
toJSON(): FlowData { return this.data; }
|
|
71
|
+
|
|
72
|
+
async refresh(signal?: AbortSignal): Promise<this> {
|
|
73
|
+
this.data = await this.http.request<FlowData>({
|
|
74
|
+
method: "GET",
|
|
75
|
+
path: `/flows/${this.data.id}`,
|
|
76
|
+
signal,
|
|
77
|
+
});
|
|
78
|
+
return this;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Ask permission, inside this flow. Exactly `deliverd.approve()` with the
|
|
83
|
+
* flow already named — which is the point: a `flowId` passed by hand at
|
|
84
|
+
* four call sites is one that gets left off the fifth.
|
|
85
|
+
*/
|
|
86
|
+
approve(options: Omit<ApproveOptions, "flowId">): Promise<Decision> {
|
|
87
|
+
return this.client.approve({ ...options, flowId: this.data.id });
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/** Ask for judgement, inside this flow. */
|
|
91
|
+
review(options: Omit<ReviewOptions, "flowId">): Promise<ReviewOutcome> {
|
|
92
|
+
return this.client.review({ ...options, flowId: this.data.id });
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/** Ask for facts, inside this flow. */
|
|
96
|
+
collect(options: Omit<CollectOptions, "flowId">): Promise<CollectedAnswers> {
|
|
97
|
+
return this.client.collect({ ...options, flowId: this.data.id });
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Say the work is done. It stops taking new members from here.
|
|
102
|
+
*
|
|
103
|
+
* Named `close()` rather than `complete()` so it does not collide with the
|
|
104
|
+
* `complete` getter above, which every other primitive in this SDK also
|
|
105
|
+
* has; `flow.complete` asks, `flow.close()` decides.
|
|
106
|
+
*
|
|
107
|
+
* Allowed with steps still outstanding, and how many is recorded — a flow
|
|
108
|
+
* that could not be closed until every reviewer replied would be one that
|
|
109
|
+
* stayed open for ever.
|
|
110
|
+
*/
|
|
111
|
+
async close(signal?: AbortSignal): Promise<this> {
|
|
112
|
+
this.data = await this.http.request<FlowData>({
|
|
113
|
+
method: "POST",
|
|
114
|
+
path: `/flows/${this.data.id}/complete`,
|
|
115
|
+
signal,
|
|
116
|
+
});
|
|
117
|
+
return this;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/** Call it off. The flow and its members stay as evidence; nothing inside is cancelled. */
|
|
121
|
+
async cancel(signal?: AbortSignal): Promise<this> {
|
|
122
|
+
this.data = await this.http.request<FlowData>({
|
|
123
|
+
method: "POST",
|
|
124
|
+
path: `/flows/${this.data.id}/cancel`,
|
|
125
|
+
signal,
|
|
126
|
+
});
|
|
127
|
+
return this;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export class Flows {
|
|
132
|
+
constructor(
|
|
133
|
+
private readonly http: HttpClient,
|
|
134
|
+
private readonly client: FlowPrimitives
|
|
135
|
+
) {}
|
|
136
|
+
|
|
137
|
+
async create(input: CreateFlowInput, signal?: AbortSignal): Promise<Flow> {
|
|
138
|
+
const data = await this.http.request<FlowData>({
|
|
139
|
+
method: "POST",
|
|
140
|
+
path: "/flows",
|
|
141
|
+
body: input,
|
|
142
|
+
signal,
|
|
143
|
+
});
|
|
144
|
+
return new Flow(this.http, data, this.client);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
async get(id: string, signal?: AbortSignal): Promise<Flow> {
|
|
148
|
+
const data = await this.http.request<FlowData>({
|
|
149
|
+
method: "GET",
|
|
150
|
+
path: `/flows/${id}`,
|
|
151
|
+
signal,
|
|
152
|
+
});
|
|
153
|
+
return new Flow(this.http, data, this.client);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
async list(input: ListFlowsInput = {}, signal?: AbortSignal): Promise<Flow[]> {
|
|
157
|
+
const { flows } = await this.http.request<{ flows: FlowData[] }>({
|
|
158
|
+
method: "GET",
|
|
159
|
+
path: "/flows",
|
|
160
|
+
query: { status: input.status, externalId: input.externalId, limit: input.limit },
|
|
161
|
+
signal,
|
|
162
|
+
});
|
|
163
|
+
return flows.map((f) => new Flow(this.http, f, this.client));
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/** The same job as before, when there was one — so a restart extends it rather than starting a second. */
|
|
167
|
+
async findByExternalId(externalId: string, signal?: AbortSignal): Promise<Flow | null> {
|
|
168
|
+
const found = await this.list({ externalId, limit: 1 }, signal);
|
|
169
|
+
return found[0] ?? null;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* The flow for this reference, started if it does not exist yet.
|
|
174
|
+
*
|
|
175
|
+
* What a restartable agent actually wants: one line that is correct on the
|
|
176
|
+
* first run and on the fourth. Without it the caller writes the lookup, the
|
|
177
|
+
* branch and the create by hand, and a crash between the lookup and the
|
|
178
|
+
* create leaves two flows for one job.
|
|
179
|
+
*/
|
|
180
|
+
async resume(input: CreateFlowInput & { externalId: string }, signal?: AbortSignal): Promise<Flow> {
|
|
181
|
+
const existing = await this.findByExternalId(input.externalId, signal);
|
|
182
|
+
if (existing && existing.open) return existing;
|
|
183
|
+
return this.create(input, signal);
|
|
184
|
+
}
|
|
185
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { Approvals, FAST_POLL_SCHEDULE, type WaitOptions } from "./approvals.js"
|
|
|
3
3
|
import { Comments, Reports } from "./reports.js";
|
|
4
4
|
import { Reviews, type ReviewWaitOptions } from "./reviews.js";
|
|
5
5
|
import { Collections, type CollectWaitOptions } from "./collections.js";
|
|
6
|
+
import { Flows } from "./flows.js";
|
|
6
7
|
import { Webhooks } from "./webhooks.js";
|
|
7
8
|
import { developmentFetch, type DevelopmentOptions } from "./dev.js";
|
|
8
9
|
import { durationMs, type Duration } from "./duration.js";
|
|
@@ -22,6 +23,7 @@ export { Approval, Approvals, POLL_SCHEDULE, type WaitOptions } from "./approval
|
|
|
22
23
|
export { Comments, Reports } from "./reports.js";
|
|
23
24
|
export { Review, Reviews, type ReviewWaitOptions } from "./reviews.js";
|
|
24
25
|
export { Collection, Collections, type CollectWaitOptions } from "./collections.js";
|
|
26
|
+
export { Flow, Flows, type FlowPrimitives } from "./flows.js";
|
|
25
27
|
export {
|
|
26
28
|
constructEvent,
|
|
27
29
|
DELIVERY_HEADER,
|
|
@@ -133,6 +135,7 @@ export class Deliverd {
|
|
|
133
135
|
readonly approvals: Approvals;
|
|
134
136
|
readonly reviews: Reviews;
|
|
135
137
|
readonly collections: Collections;
|
|
138
|
+
readonly flows: Flows;
|
|
136
139
|
readonly reports: Reports;
|
|
137
140
|
readonly comments: Comments;
|
|
138
141
|
readonly webhooks: Webhooks;
|
|
@@ -155,6 +158,12 @@ export class Deliverd {
|
|
|
155
158
|
this.approvals = new Approvals(this.http);
|
|
156
159
|
this.reviews = new Reviews(this.http);
|
|
157
160
|
this.collections = new Collections(this.http);
|
|
161
|
+
/*
|
|
162
|
+
* The handle takes the client so `flow.approve()` is the same call as
|
|
163
|
+
* `deliverd.approve()` with the flow filled in, rather than a second
|
|
164
|
+
* implementation that can drift from it.
|
|
165
|
+
*/
|
|
166
|
+
this.flows = new Flows(this.http, this);
|
|
158
167
|
this.reports = new Reports(this.http);
|
|
159
168
|
this.comments = new Comments(this.http);
|
|
160
169
|
this.webhooks = new Webhooks();
|
package/src/types.ts
CHANGED
|
@@ -78,6 +78,12 @@ export interface CreateApprovalInput {
|
|
|
78
78
|
expiresAt?: string;
|
|
79
79
|
/** Your own reference, returned unchanged and searchable. */
|
|
80
80
|
externalId?: string;
|
|
81
|
+
/**
|
|
82
|
+
* The flow this belongs to, when it is one step of a larger piece of work.
|
|
83
|
+
* Must be an open flow in your organisation. `flow.approve()` and its
|
|
84
|
+
* siblings set this for you.
|
|
85
|
+
*/
|
|
86
|
+
flowId?: string;
|
|
81
87
|
metadata?: Record<string, unknown>;
|
|
82
88
|
}
|
|
83
89
|
|
|
@@ -207,7 +213,8 @@ export type WebhookEventName =
|
|
|
207
213
|
| "review.approved"
|
|
208
214
|
| "review.changes_requested"
|
|
209
215
|
| "collection.requested"
|
|
210
|
-
| "collection.completed"
|
|
216
|
+
| "collection.completed"
|
|
217
|
+
| "flow.completed";
|
|
211
218
|
|
|
212
219
|
export interface WebhookEvent {
|
|
213
220
|
event: WebhookEventName;
|
|
@@ -253,6 +260,12 @@ export interface CreateReviewInput {
|
|
|
253
260
|
expiresAt?: string;
|
|
254
261
|
/** Your own reference, returned unchanged and searchable. */
|
|
255
262
|
externalId?: string;
|
|
263
|
+
/**
|
|
264
|
+
* The flow this belongs to, when it is one step of a larger piece of work.
|
|
265
|
+
* Must be an open flow in your organisation. `flow.approve()` and its
|
|
266
|
+
* siblings set this for you.
|
|
267
|
+
*/
|
|
268
|
+
flowId?: string;
|
|
256
269
|
metadata?: Record<string, unknown>;
|
|
257
270
|
}
|
|
258
271
|
|
|
@@ -361,6 +374,12 @@ export interface CreateCollectionInput {
|
|
|
361
374
|
/** After this the request closes unanswered. ISO 8601. */
|
|
362
375
|
expiresAt?: string;
|
|
363
376
|
externalId?: string;
|
|
377
|
+
/**
|
|
378
|
+
* The flow this belongs to, when it is one step of a larger piece of work.
|
|
379
|
+
* Must be an open flow in your organisation. `flow.approve()` and its
|
|
380
|
+
* siblings set this for you.
|
|
381
|
+
*/
|
|
382
|
+
flowId?: string;
|
|
364
383
|
metadata?: Record<string, unknown>;
|
|
365
384
|
}
|
|
366
385
|
|
|
@@ -426,3 +445,67 @@ export interface ListCollectionsInput {
|
|
|
426
445
|
externalId?: string;
|
|
427
446
|
limit?: number;
|
|
428
447
|
}
|
|
448
|
+
|
|
449
|
+
/* ── Flows ────────────────────────────────────────────────────────────────── */
|
|
450
|
+
|
|
451
|
+
export type FlowStatus = "open" | "complete" | "cancelled";
|
|
452
|
+
export type FlowMemberKind = "approval" | "review" | "collection" | "report";
|
|
453
|
+
|
|
454
|
+
export interface FlowMember {
|
|
455
|
+
kind: FlowMemberKind;
|
|
456
|
+
id: string;
|
|
457
|
+
title: string;
|
|
458
|
+
/** The member's own status word, which differs by kind. */
|
|
459
|
+
status: string;
|
|
460
|
+
/** Still waiting on somebody. Always false for a report. */
|
|
461
|
+
open: boolean;
|
|
462
|
+
createdAt: string;
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
/** One line of the history: what happened, who did it, when. */
|
|
466
|
+
export interface FlowEvent {
|
|
467
|
+
event: string;
|
|
468
|
+
actor: string;
|
|
469
|
+
actorType: string;
|
|
470
|
+
resourceType: string | null;
|
|
471
|
+
resourceId: string | null;
|
|
472
|
+
at: string;
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
export interface FlowData {
|
|
476
|
+
id: string;
|
|
477
|
+
status: FlowStatus;
|
|
478
|
+
/** The timeline page a person can open. */
|
|
479
|
+
url: string;
|
|
480
|
+
title: string;
|
|
481
|
+
description: string | null;
|
|
482
|
+
externalId: string | null;
|
|
483
|
+
metadata: Record<string, unknown>;
|
|
484
|
+
startedBy: string;
|
|
485
|
+
members: FlowMember[];
|
|
486
|
+
memberCount: number;
|
|
487
|
+
openCount: number;
|
|
488
|
+
/** Nothing outstanding right now — not a claim that the job is finished. */
|
|
489
|
+
allSettled: boolean;
|
|
490
|
+
/** Present on a single read, absent from a list. */
|
|
491
|
+
timeline?: FlowEvent[];
|
|
492
|
+
settledAt: string | null;
|
|
493
|
+
createdAt: string;
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
export interface CreateFlowInput {
|
|
497
|
+
/** What this piece of work is, as the timeline will be titled. */
|
|
498
|
+
title: string;
|
|
499
|
+
/** What it is for, for whoever reads the history a year from now. */
|
|
500
|
+
description?: string;
|
|
501
|
+
workspaceId?: string;
|
|
502
|
+
/** Your own reference. Pass it and use `resume()` so a restart does not start a second flow. */
|
|
503
|
+
externalId?: string;
|
|
504
|
+
metadata?: Record<string, unknown>;
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
export interface ListFlowsInput {
|
|
508
|
+
status?: FlowStatus;
|
|
509
|
+
externalId?: string;
|
|
510
|
+
limit?: number;
|
|
511
|
+
}
|