@deliverd/sdk 0.3.0 → 0.5.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 +70 -0
- package/dist/dev.d.ts.map +1 -1
- package/dist/dev.js +94 -0
- package/dist/flows.d.ts +106 -0
- package/dist/flows.d.ts.map +1 -0
- package/dist/flows.js +150 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -0
- package/dist/reports.d.ts +10 -1
- package/dist/reports.d.ts.map +1 -1
- package/dist/reports.js +15 -0
- package/dist/types.d.ts +149 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/dev.ts +111 -1
- package/src/flows.ts +200 -0
- package/src/index.ts +9 -0
- package/src/reports.ts +17 -0
- package/src/types.ts +162 -1
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,145 @@ 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
|
+
}
|
|
512
|
+
|
|
513
|
+
/* ── Evidence ─────────────────────────────────────────────────────────────── */
|
|
514
|
+
|
|
515
|
+
export type EvidenceStepKind = "approval" | "review" | "collection" | "report";
|
|
516
|
+
|
|
517
|
+
export interface EvidenceOutcome {
|
|
518
|
+
who: string;
|
|
519
|
+
/** What they said, in the words the step uses: "approved", "answered". */
|
|
520
|
+
said: string;
|
|
521
|
+
note: string | null;
|
|
522
|
+
at: string;
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
export interface EvidenceStep {
|
|
526
|
+
kind: EvidenceStepKind;
|
|
527
|
+
id: string;
|
|
528
|
+
title: string;
|
|
529
|
+
status: string;
|
|
530
|
+
url: string;
|
|
531
|
+
createdAt: string;
|
|
532
|
+
settledAt: string | null;
|
|
533
|
+
requestedBy: string;
|
|
534
|
+
/** Whether an agent asked for this, which is the point of the record. */
|
|
535
|
+
requestedByAgent: boolean;
|
|
536
|
+
asked: string[];
|
|
537
|
+
outcomes: EvidenceOutcome[];
|
|
538
|
+
/** Whatever else the step records: the description, the questions, the answers. */
|
|
539
|
+
detail: Record<string, unknown>;
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
export interface EvidenceEvent {
|
|
543
|
+
at: string;
|
|
544
|
+
event: string;
|
|
545
|
+
actor: string;
|
|
546
|
+
actorType: string;
|
|
547
|
+
/** Which step it happened to, when it happened to one. */
|
|
548
|
+
step: string | null;
|
|
549
|
+
metadata: Record<string, unknown>;
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
export interface EvidencePack {
|
|
553
|
+
packVersion: number;
|
|
554
|
+
generatedAt: string;
|
|
555
|
+
generatedBy: string;
|
|
556
|
+
organisation: { id: string; name: string };
|
|
557
|
+
subject: {
|
|
558
|
+
kind: "flow" | "report";
|
|
559
|
+
id: string;
|
|
560
|
+
title: string;
|
|
561
|
+
url: string;
|
|
562
|
+
status: string;
|
|
563
|
+
startedBy: string;
|
|
564
|
+
startedAt: string;
|
|
565
|
+
};
|
|
566
|
+
summary: {
|
|
567
|
+
steps: number;
|
|
568
|
+
events: number;
|
|
569
|
+
firstEventAt: string | null;
|
|
570
|
+
lastEventAt: string | null;
|
|
571
|
+
};
|
|
572
|
+
steps: EvidenceStep[];
|
|
573
|
+
timeline: EvidenceEvent[];
|
|
574
|
+
/**
|
|
575
|
+
* What the digest does and does not stand for, in the pack's own words.
|
|
576
|
+
*
|
|
577
|
+
* `covers` says it detects a file altered after export. `doesNotCover` says
|
|
578
|
+
* it makes no claim about the database. Both travel with the pack rather
|
|
579
|
+
* than living only in documentation, because a reader who sees a hash and
|
|
580
|
+
* no sentence will assume the stronger one.
|
|
581
|
+
*/
|
|
582
|
+
integrity: {
|
|
583
|
+
algorithm: "sha256";
|
|
584
|
+
digest: string;
|
|
585
|
+
covers: string;
|
|
586
|
+
doesNotCover: string;
|
|
587
|
+
recordsAreInsertOnly: boolean;
|
|
588
|
+
};
|
|
589
|
+
}
|