hierarchical-approval 1.6.0 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +82 -0
- package/README.md +61 -0
- package/dist/{ApprovalEngine-CyZJDbjP.d.ts → ApprovalEngine-CElfKXOA.d.ts} +99 -9
- package/dist/{ApprovalEngine-SI-IRUMY.d.cts → ApprovalEngine-cI4LP2Mx.d.cts} +99 -9
- package/dist/{IAuditAdapter-wfOcN3Zf.d.ts → IAuditAdapter-DDV4Rf9F.d.ts} +1 -1
- package/dist/{IAuditAdapter-Cr0dLoVP.d.cts → IAuditAdapter-UJNdJanq.d.cts} +1 -1
- package/dist/{IAuthorizationPolicy-BHybAsq5.d.cts → IAuthorizationPolicy-CFJ-gXKl.d.ts} +2 -2
- package/dist/{IAuthorizationPolicy-CdvoZsGC.d.ts → IAuthorizationPolicy-CN6LAaKg.d.cts} +2 -2
- package/dist/{IMetricsAdapter-JZVK3QUq.d.cts → IMetricsAdapter-DWq8IFaf.d.cts} +1 -1
- package/dist/{IMetricsAdapter-JZVK3QUq.d.ts → IMetricsAdapter-DWq8IFaf.d.ts} +1 -1
- package/dist/{INotificationAdapter-Cn-LNPtD.d.cts → INotificationAdapter-Dv_MuYwS.d.ts} +12 -2
- package/dist/{INotificationAdapter-Cyo0cvXU.d.ts → INotificationAdapter-Dy2d0JKy.d.cts} +12 -2
- package/dist/{IOperationMiddleware-DrJy9UtL.d.cts → IOperationMiddleware-DGG-guxK.d.cts} +1 -1
- package/dist/{IOperationMiddleware-rx7XAPrW.d.ts → IOperationMiddleware-DWYXVuJD.d.ts} +1 -1
- package/dist/{IStorageAdapter-Dz8jrIAK.d.cts → IStorageAdapter-CRSfnH8U.d.cts} +1 -1
- package/dist/{IStorageAdapter-CXRyeUOK.d.ts → IStorageAdapter-DMa5VNNz.d.ts} +1 -1
- package/dist/adapters/MemoryAdapter.d.cts +2 -2
- package/dist/adapters/MemoryAdapter.d.ts +2 -2
- package/dist/adapters/PostgresAdapter.cjs +13 -4
- package/dist/adapters/PostgresAdapter.cjs.map +1 -1
- package/dist/adapters/PostgresAdapter.d.cts +2 -2
- package/dist/adapters/PostgresAdapter.d.ts +2 -2
- package/dist/adapters/PostgresAdapter.js +13 -4
- package/dist/adapters/PostgresAdapter.js.map +1 -1
- package/dist/index.cjs +297 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -9
- package/dist/index.d.ts +9 -9
- package/dist/index.js +297 -4
- package/dist/index.js.map +1 -1
- package/dist/{instance-SA0BU-Gb.d.cts → instance-BE0uJmg3.d.cts} +27 -2
- package/dist/{instance-SA0BU-Gb.d.ts → instance-BE0uJmg3.d.ts} +27 -2
- package/dist/nestjs.cjs +297 -4
- package/dist/nestjs.cjs.map +1 -1
- package/dist/nestjs.d.cts +8 -8
- package/dist/nestjs.d.ts +8 -8
- package/dist/nestjs.js +297 -4
- package/dist/nestjs.js.map +1 -1
- package/dist/plugins/audit.d.cts +2 -2
- package/dist/plugins/audit.d.ts +2 -2
- package/dist/plugins/metrics.cjs +2 -0
- package/dist/plugins/metrics.cjs.map +1 -1
- package/dist/plugins/metrics.d.cts +1 -1
- package/dist/plugins/metrics.d.ts +1 -1
- package/dist/plugins/metrics.js +2 -0
- package/dist/plugins/metrics.js.map +1 -1
- package/dist/plugins/notify.d.cts +2 -2
- package/dist/plugins/notify.d.ts +2 -2
- package/dist/plugins/resilience.d.cts +3 -3
- package/dist/plugins/resilience.d.ts +3 -3
- package/dist/plugins/tracing.d.cts +2 -2
- package/dist/plugins/tracing.d.ts +2 -2
- package/dist/plugins/webhook.d.cts +2 -2
- package/dist/plugins/webhook.d.ts +2 -2
- package/dist/testing.cjs +297 -4
- package/dist/testing.cjs.map +1 -1
- package/dist/testing.d.cts +8 -8
- package/dist/testing.d.ts +8 -8
- package/dist/testing.js +297 -4
- package/dist/testing.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,88 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
|
7
7
|
|
|
8
8
|
_Nothing yet._
|
|
9
9
|
|
|
10
|
+
## [1.8.0] - 2026-09-04
|
|
11
|
+
|
|
12
|
+
### Added — `transferApprovals()`
|
|
13
|
+
|
|
14
|
+
- **Move every pending approval assigned to one person over to another.**
|
|
15
|
+
Someone leaves, changes team, or goes on long-term leave, and their queue has
|
|
16
|
+
to go somewhere. Doing it by hand meant finding every open instance first —
|
|
17
|
+
across parallel branches, where one person can hold several open levels on the
|
|
18
|
+
same document — and missing one left an approval that could never complete.
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
await engine.transferApprovals({
|
|
22
|
+
fromApprover: 'alice',
|
|
23
|
+
toApprover: 'bob',
|
|
24
|
+
transferredBy: 'workflow-admin',
|
|
25
|
+
reason: 'Alice left the company',
|
|
26
|
+
documentType: 'purchase_order', // optional
|
|
27
|
+
dryRun: true, // see what would move first
|
|
28
|
+
});
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Each move goes through `reassign()`, so every guard, audit entry, event and
|
|
32
|
+
authorization check that applies to a single reassignment applies here too.
|
|
33
|
+
The sweep is deliberately **not atomic**: it reports per-instance failures
|
|
34
|
+
rather than rolling back, because a partial transfer is the useful outcome —
|
|
35
|
+
what can move should move, and what cannot is named for a human to look at.
|
|
36
|
+
|
|
37
|
+
New exports: `TransferResult`, `TransferApprovalsOptions`.
|
|
38
|
+
|
|
39
|
+
### Fixed — `delegate()` and `reassign()` could not reach an upper parallel branch
|
|
40
|
+
|
|
41
|
+
- **Both resolved the level via `currentLevelInstance`**, which names only the
|
|
42
|
+
lowest-numbered open level. Inside a parallel group they therefore always
|
|
43
|
+
acted on the lowest branch: an approver could not hand off their own
|
|
44
|
+
upper-branch work, and an administrator reassigning a departing user silently
|
|
45
|
+
moved the wrong branch — or failed, because that person was not an approver on
|
|
46
|
+
the branch being targeted. Introduced with parallel groups in 1.0.0; sequential
|
|
47
|
+
templates were never affected.
|
|
48
|
+
|
|
49
|
+
Both now resolve against the approver actually being moved, and take an
|
|
50
|
+
optional `level` to disambiguate when one person holds more than one open
|
|
51
|
+
branch — matching what `approve()` and `reject()` already did.
|
|
52
|
+
|
|
53
|
+
## [1.7.0] - 2026-09-04
|
|
54
|
+
|
|
55
|
+
### Added — attachment references
|
|
56
|
+
|
|
57
|
+
- **`addAttachment()` / `removeAttachment()` attach supporting evidence to an
|
|
58
|
+
approval** — a quote PDF, a signed contract, a screenshot of a system of
|
|
59
|
+
record. Approvers had nowhere to put the document their decision rested on, so
|
|
60
|
+
it lived in an email thread the audit trail never saw.
|
|
61
|
+
|
|
62
|
+
```ts
|
|
63
|
+
await engine.addAttachment(id, {
|
|
64
|
+
actorId: 'buyer-1',
|
|
65
|
+
name: 'quote.pdf',
|
|
66
|
+
uri: 's3://procurement/quotes/q-1.pdf',
|
|
67
|
+
contentType: 'application/pdf',
|
|
68
|
+
sizeBytes: 48_120,
|
|
69
|
+
});
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
- **References only, never bytes.** Approval documents belong in the object
|
|
73
|
+
store or DMS the organisation already runs, which handles retention, virus
|
|
74
|
+
scanning and access control far better than an approval table could; copying
|
|
75
|
+
them here would make the audit database the largest and least governed copy of
|
|
76
|
+
them. Removing detaches the reference and never deletes from the underlying
|
|
77
|
+
store.
|
|
78
|
+
|
|
79
|
+
- **The audit trail keeps what was removed** — name and URI are recorded on the
|
|
80
|
+
`attachment_removed` entry, so the record still shows an approver saw evidence
|
|
81
|
+
that is no longer listed. Dropping that would let the trail imply a decision
|
|
82
|
+
was made on less than it was.
|
|
83
|
+
|
|
84
|
+
- Persisted across all four PostgreSQL sites (schema, `migrate()`,
|
|
85
|
+
insert, update, and read-back), with `addedAt` revived as a `Date`. An
|
|
86
|
+
instance with no attachments reads back as `undefined` rather than `[]`,
|
|
87
|
+
keeping the round-trip shape identical to `MemoryAdapter`.
|
|
88
|
+
|
|
89
|
+
New exports: `Attachment`, `AttachmentEvent`, `AddAttachmentOptions`,
|
|
90
|
+
`RemoveAttachmentOptions`. `ApprovalInstance` gains `attachments`.
|
|
91
|
+
|
|
10
92
|
## [1.6.0] - 2026-09-04
|
|
11
93
|
|
|
12
94
|
### Fixed — PostgresAdapter silently dropped most instance updates
|
package/README.md
CHANGED
|
@@ -399,6 +399,67 @@ engine.registerConditionOperator('between', (actual, expected) => {
|
|
|
399
399
|
});
|
|
400
400
|
```
|
|
401
401
|
|
|
402
|
+
### Transferring a person's queue
|
|
403
|
+
|
|
404
|
+
Someone leaves, changes team, or goes on long-term leave, and their open
|
|
405
|
+
approvals have to go somewhere:
|
|
406
|
+
|
|
407
|
+
```ts
|
|
408
|
+
const result = await engine.transferApprovals({
|
|
409
|
+
fromApprover: 'alice',
|
|
410
|
+
toApprover: 'bob',
|
|
411
|
+
transferredBy: 'workflow-admin',
|
|
412
|
+
reason: 'Alice left the company',
|
|
413
|
+
documentType: 'purchase_order', // optional scoping
|
|
414
|
+
dryRun: true, // see what would move first
|
|
415
|
+
});
|
|
416
|
+
// { transferred: [{ instanceId, level, documentId }], failed: [...], scanned, dryRun }
|
|
417
|
+
```
|
|
418
|
+
|
|
419
|
+
Each move goes through `reassign()`, so every guard, audit entry, event and
|
|
420
|
+
authorization check that applies to a single reassignment applies here too —
|
|
421
|
+
there is no bulk short-cut around them. Inside a parallel group each open branch
|
|
422
|
+
is moved separately, since one person can hold several open levels on the same
|
|
423
|
+
document.
|
|
424
|
+
|
|
425
|
+
The sweep is **not atomic**: it reports per-instance failures rather than rolling
|
|
426
|
+
back. A partial transfer is the useful outcome — the approvals that can move
|
|
427
|
+
should move, and the ones that cannot are named so a human can look at them.
|
|
428
|
+
|
|
429
|
+
### Attachments
|
|
430
|
+
|
|
431
|
+
Attach supporting evidence — a quote PDF, a signed contract, a screenshot of a
|
|
432
|
+
system of record:
|
|
433
|
+
|
|
434
|
+
```ts
|
|
435
|
+
const withQuote = await engine.addAttachment(instance.id, {
|
|
436
|
+
actorId: 'buyer-1',
|
|
437
|
+
name: 'quote.pdf',
|
|
438
|
+
uri: 's3://procurement/quotes/q-1.pdf', // a reference, not bytes
|
|
439
|
+
contentType: 'application/pdf',
|
|
440
|
+
sizeBytes: 48_120,
|
|
441
|
+
});
|
|
442
|
+
|
|
443
|
+
await engine.removeAttachment(instance.id, {
|
|
444
|
+
actorId: 'buyer-1',
|
|
445
|
+
attachmentId: withQuote.attachments[0].id,
|
|
446
|
+
reason: 'superseded by revised quote',
|
|
447
|
+
});
|
|
448
|
+
```
|
|
449
|
+
|
|
450
|
+
**The engine stores references, never bytes.** Approval documents belong in the
|
|
451
|
+
object store or DMS you already run, which handles retention, virus scanning and
|
|
452
|
+
access control far better than an approval table could — copying them here would
|
|
453
|
+
make the audit database the largest and least governed copy of them.
|
|
454
|
+
|
|
455
|
+
Removing detaches the reference; it never deletes from the underlying store,
|
|
456
|
+
which is the DMS's call. The audit entry keeps the name and URI of what was
|
|
457
|
+
removed, so the trail still shows an approver saw evidence that is no longer
|
|
458
|
+
listed.
|
|
459
|
+
|
|
460
|
+
Emits `approval:attachment_added` / `approval:attachment_removed`. Allowed on
|
|
461
|
+
any non-terminal instance, subject to your authorization policy.
|
|
462
|
+
|
|
402
463
|
### Asking the submitter a question
|
|
403
464
|
|
|
404
465
|
Approvers routinely need one fact before they can decide. `requestInfo()` puts
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { I as IStorageAdapter, P as PaginationOpts, a as PaginatedResult, b as InstanceFilter, C as CursorPaginationOpts, c as CursorPaginatedResult } from './IStorageAdapter-
|
|
2
|
-
import {
|
|
3
|
-
import { I as INotificationAdapter, b as ApprovalEventName, a as ApprovalEventMap } from './INotificationAdapter-
|
|
1
|
+
import { I as IStorageAdapter, P as PaginationOpts, a as PaginatedResult, b as InstanceFilter, C as CursorPaginationOpts, c as CursorPaginatedResult } from './IStorageAdapter-DMa5VNNz.js';
|
|
2
|
+
import { l as ConditionExpression, p as ResolverFn, g as ApprovalTemplateConfig, A as ApprovalTemplate, k as AuditContext, a as ApprovalInstance, e as ApprovalMode, b as AuditEntry } from './instance-BE0uJmg3.js';
|
|
3
|
+
import { I as INotificationAdapter, b as ApprovalEventName, a as ApprovalEventMap } from './INotificationAdapter-Dv_MuYwS.js';
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
import { L as Logger } from './Logger-BplhlU7l.js';
|
|
6
6
|
import { C as Clock } from './Clock-3FnOczFJ.js';
|
|
7
|
-
import { I as IOperationMiddleware, a as ApprovalError } from './IOperationMiddleware-
|
|
8
|
-
import { I as IAuditAdapter } from './IAuditAdapter-
|
|
9
|
-
import { I as IMetricsAdapter } from './IMetricsAdapter-
|
|
7
|
+
import { I as IOperationMiddleware, a as ApprovalError } from './IOperationMiddleware-DWYXVuJD.js';
|
|
8
|
+
import { I as IAuditAdapter } from './IAuditAdapter-DDV4Rf9F.js';
|
|
9
|
+
import { I as IMetricsAdapter } from './IMetricsAdapter-DWq8IFaf.js';
|
|
10
10
|
import { I as ISchedulerAdapter } from './ISchedulerAdapter-DKv_QjVN.js';
|
|
11
|
-
import { I as IAuthorizationPolicy } from './IAuthorizationPolicy-
|
|
11
|
+
import { I as IAuthorizationPolicy } from './IAuthorizationPolicy-CFJ-gXKl.js';
|
|
12
12
|
|
|
13
13
|
declare const SubmitOptionsSchema: z.ZodObject<{
|
|
14
14
|
templateName: z.ZodString;
|
|
@@ -42,12 +42,14 @@ declare const DelegateOptionsSchema: z.ZodObject<{
|
|
|
42
42
|
toApprover: z.ZodString;
|
|
43
43
|
reason: z.ZodString;
|
|
44
44
|
until: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
45
|
+
level: z.ZodOptional<z.ZodNumber>;
|
|
45
46
|
}, z.core.$strip>;
|
|
46
47
|
declare const ReassignOptionsSchema: z.ZodObject<{
|
|
47
48
|
reassignedBy: z.ZodString;
|
|
48
49
|
fromApprover: z.ZodString;
|
|
49
50
|
toApprover: z.ZodString;
|
|
50
51
|
reason: z.ZodString;
|
|
52
|
+
level: z.ZodOptional<z.ZodNumber>;
|
|
51
53
|
}, z.core.$strip>;
|
|
52
54
|
declare const CancelOptionsSchema: z.ZodObject<{
|
|
53
55
|
cancelledBy: z.ZodString;
|
|
@@ -78,6 +80,27 @@ declare const ProvideInfoOptionsSchema: z.ZodObject<{
|
|
|
78
80
|
respondedBy: z.ZodString;
|
|
79
81
|
response: z.ZodString;
|
|
80
82
|
}, z.core.$strip>;
|
|
83
|
+
declare const AddAttachmentOptionsSchema: z.ZodObject<{
|
|
84
|
+
actorId: z.ZodString;
|
|
85
|
+
name: z.ZodString;
|
|
86
|
+
uri: z.ZodString;
|
|
87
|
+
contentType: z.ZodOptional<z.ZodString>;
|
|
88
|
+
sizeBytes: z.ZodOptional<z.ZodNumber>;
|
|
89
|
+
}, z.core.$strip>;
|
|
90
|
+
declare const RemoveAttachmentOptionsSchema: z.ZodObject<{
|
|
91
|
+
actorId: z.ZodString;
|
|
92
|
+
attachmentId: z.ZodString;
|
|
93
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
94
|
+
}, z.core.$strip>;
|
|
95
|
+
declare const TransferApprovalsOptionsSchema: z.ZodObject<{
|
|
96
|
+
fromApprover: z.ZodString;
|
|
97
|
+
toApprover: z.ZodString;
|
|
98
|
+
transferredBy: z.ZodString;
|
|
99
|
+
reason: z.ZodString;
|
|
100
|
+
documentType: z.ZodOptional<z.ZodString>;
|
|
101
|
+
dryRun: z.ZodDefault<z.ZodBoolean>;
|
|
102
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
103
|
+
}, z.core.$strip>;
|
|
81
104
|
declare const UpdateDataOptionsSchema: z.ZodObject<{
|
|
82
105
|
updatedBy: z.ZodString;
|
|
83
106
|
data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
@@ -101,6 +124,9 @@ type OverrideOptions = z.infer<typeof OverrideOptionsSchema>;
|
|
|
101
124
|
type UpdateDataOptions = z.infer<typeof UpdateDataOptionsSchema>;
|
|
102
125
|
type RequestInfoOptions = z.infer<typeof RequestInfoOptionsSchema>;
|
|
103
126
|
type ProvideInfoOptions = z.infer<typeof ProvideInfoOptionsSchema>;
|
|
127
|
+
type AddAttachmentOptions = z.infer<typeof AddAttachmentOptionsSchema>;
|
|
128
|
+
type RemoveAttachmentOptions = z.infer<typeof RemoveAttachmentOptionsSchema>;
|
|
129
|
+
type TransferApprovalsOptions = z.infer<typeof TransferApprovalsOptionsSchema>;
|
|
104
130
|
|
|
105
131
|
/**
|
|
106
132
|
* Computes deadline dates from a number of days. The default engine behaviour
|
|
@@ -132,7 +158,7 @@ interface WeekendCalendarOptions {
|
|
|
132
158
|
*/
|
|
133
159
|
declare function weekendCalendar(options?: WeekendCalendarOptions): BusinessCalendar;
|
|
134
160
|
|
|
135
|
-
type IdGeneratorPrefix = 'inst' | 'tpl';
|
|
161
|
+
type IdGeneratorPrefix = 'inst' | 'tpl' | 'att';
|
|
136
162
|
type IdGeneratorFn = (prefix: IdGeneratorPrefix) => string;
|
|
137
163
|
declare const defaultIdGenerator: IdGeneratorFn;
|
|
138
164
|
|
|
@@ -240,6 +266,24 @@ interface BulkResult {
|
|
|
240
266
|
}>;
|
|
241
267
|
total: number;
|
|
242
268
|
}
|
|
269
|
+
/** Outcome of a {@link ApprovalEngine.transferApprovals} sweep. */
|
|
270
|
+
interface TransferResult {
|
|
271
|
+
/** One entry per level actually moved (an instance can hold the approver on several open branches). */
|
|
272
|
+
transferred: Array<{
|
|
273
|
+
instanceId: string;
|
|
274
|
+
level: number;
|
|
275
|
+
documentId: string;
|
|
276
|
+
}>;
|
|
277
|
+
/** Instances that could not be moved, with the reason. */
|
|
278
|
+
failed: Array<{
|
|
279
|
+
instanceId: string;
|
|
280
|
+
error: ApprovalError;
|
|
281
|
+
}>;
|
|
282
|
+
/** Instances examined. */
|
|
283
|
+
scanned: number;
|
|
284
|
+
/** True when nothing was written. */
|
|
285
|
+
dryRun: boolean;
|
|
286
|
+
}
|
|
243
287
|
interface ApprovalStatistics {
|
|
244
288
|
/** Total instances matching the filter (across all statuses). */
|
|
245
289
|
total: number;
|
|
@@ -490,6 +534,30 @@ declare class ApprovalEngine {
|
|
|
490
534
|
* by being held.
|
|
491
535
|
*/
|
|
492
536
|
private extendDeadlinesBy;
|
|
537
|
+
/**
|
|
538
|
+
* Attach supporting evidence to an approval — a quote PDF, a signed contract,
|
|
539
|
+
* a screenshot of a system of record.
|
|
540
|
+
*
|
|
541
|
+
* Stores a **reference**, never bytes. Approval documents belong in the object
|
|
542
|
+
* store or DMS the organisation already runs, which handles retention, virus
|
|
543
|
+
* scanning and access control far better than an approval table could;
|
|
544
|
+
* copying them here would make the audit database the largest and least
|
|
545
|
+
* governed copy of them.
|
|
546
|
+
*
|
|
547
|
+
* Allowed on any non-terminal instance, by anyone the authorization policy
|
|
548
|
+
* permits: the submitter adding a missing quote and an approver adding the
|
|
549
|
+
* note that justifies their decision are both ordinary.
|
|
550
|
+
*/
|
|
551
|
+
addAttachment(instanceId: string, raw: AddAttachmentOptions, auditCtx?: AuditContext): Promise<ApprovalInstance>;
|
|
552
|
+
/**
|
|
553
|
+
* Detach a reference from an approval.
|
|
554
|
+
*
|
|
555
|
+
* The audit entry keeps the name and URI of what was removed, so the record
|
|
556
|
+
* still shows an approver saw evidence that is no longer listed — dropping
|
|
557
|
+
* that would let the trail imply a decision was made on less than it was.
|
|
558
|
+
* Nothing is deleted from the underlying store; that is the DMS's call.
|
|
559
|
+
*/
|
|
560
|
+
removeAttachment(instanceId: string, raw: RemoveAttachmentOptions, auditCtx?: AuditContext): Promise<ApprovalInstance>;
|
|
493
561
|
/** Add a comment to an instance without approving or rejecting. */
|
|
494
562
|
addComment(instanceId: string, raw: AddCommentOptions, auditCtx?: AuditContext): Promise<void>;
|
|
495
563
|
/** Resubmit a rejected instance, creating a new linked instance from level 1. */
|
|
@@ -501,6 +569,28 @@ declare class ApprovalEngine {
|
|
|
501
569
|
/** Emergency bypass — completes the instance as 'approved', skipping remaining levels. Requires template.allowOverride = true. */
|
|
502
570
|
override(instanceId: string, raw: OverrideOptions, auditCtx?: AuditContext): Promise<ApprovalInstance>;
|
|
503
571
|
/** Approve multiple instances in one call. Never throws — failures collected in result.failed. */
|
|
572
|
+
/**
|
|
573
|
+
* Move every pending approval assigned to one person over to another.
|
|
574
|
+
*
|
|
575
|
+
* Someone leaves, changes team, or goes on long-term leave, and their queue
|
|
576
|
+
* has to go somewhere. Doing it by hand means finding every open instance
|
|
577
|
+
* first — across parallel branches, where one person can hold several open
|
|
578
|
+
* levels on the same document — and missing one leaves an approval that can
|
|
579
|
+
* never complete.
|
|
580
|
+
*
|
|
581
|
+
* Each move goes through {@link reassign}, so every guard, audit entry, event
|
|
582
|
+
* and authorization check that applies to a single reassignment applies here
|
|
583
|
+
* too. There is no bulk short-cut around them.
|
|
584
|
+
*
|
|
585
|
+
* The sweep is **not atomic**: it reassigns one level at a time and reports
|
|
586
|
+
* per-instance failures rather than rolling back. A partial transfer is the
|
|
587
|
+
* useful outcome — the approvals that could move should move, and the ones
|
|
588
|
+
* that could not are named so a human can look at them.
|
|
589
|
+
*
|
|
590
|
+
* @param raw - Who is moving to whom, and why.
|
|
591
|
+
* @returns What moved, what did not, and why. With `dryRun` nothing is written.
|
|
592
|
+
*/
|
|
593
|
+
transferApprovals(raw: TransferApprovalsOptions, auditCtx?: AuditContext): Promise<TransferResult>;
|
|
504
594
|
bulkApprove(instanceIds: string[], raw: ApproveOptions, auditCtx?: AuditContext): Promise<BulkResult>;
|
|
505
595
|
/** Reject multiple instances in one call. Never throws — failures collected in result.failed. */
|
|
506
596
|
bulkReject(instanceIds: string[], raw: RejectOptions, auditCtx?: AuditContext): Promise<BulkResult>;
|
|
@@ -614,4 +704,4 @@ declare class ApprovalEngine {
|
|
|
614
704
|
private runExternalAudit;
|
|
615
705
|
}
|
|
616
706
|
|
|
617
|
-
export { type AddCommentOptions as A, type BulkResult as B, type CanApproveResult as C, type DelegateOptions as D, type EscalateOptions as E, type HealthResult as H, type IdGeneratorFn as I, type OrgProvider as O, type PreviewChainLevel as P, type ReassignOptions as R, type SubmitOptions as S, type UpdateDataOptions as U, type ValidationResult as V, type WeekendCalendarOptions as W, ApprovalEngine as a, type ApprovalEngineOptions as b, type ApprovalStatistics as c, type ApproveOptions as d, type ApproverResolverFn as e, type BusinessCalendar as f, type CancelOptions as g, type ConditionOperatorFn as h, type CycleTimeStats as i, type IdempotencyKeyFn as j, type OutOfOfficeProvider as k, type OverrideOptions as l, type PreviewResult as m, type ProvideInfoOptions as n, type RejectOptions as o, type RequestInfoOptions as p, type ResubmitOptions as q, type RetryPolicy as r, defaultIdGenerator as s, toComparableNumber as t, validateConditionExpression as v, weekendCalendar as w };
|
|
707
|
+
export { type AddCommentOptions as A, type BulkResult as B, type CanApproveResult as C, type DelegateOptions as D, type EscalateOptions as E, type HealthResult as H, type IdGeneratorFn as I, type OrgProvider as O, type PreviewChainLevel as P, type ReassignOptions as R, type SubmitOptions as S, type TransferResult as T, type UpdateDataOptions as U, type ValidationResult as V, type WeekendCalendarOptions as W, ApprovalEngine as a, type ApprovalEngineOptions as b, type ApprovalStatistics as c, type ApproveOptions as d, type ApproverResolverFn as e, type BusinessCalendar as f, type CancelOptions as g, type ConditionOperatorFn as h, type CycleTimeStats as i, type IdempotencyKeyFn as j, type OutOfOfficeProvider as k, type OverrideOptions as l, type PreviewResult as m, type ProvideInfoOptions as n, type RejectOptions as o, type RequestInfoOptions as p, type ResubmitOptions as q, type RetryPolicy as r, defaultIdGenerator as s, toComparableNumber as t, validateConditionExpression as v, weekendCalendar as w };
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { I as IStorageAdapter, P as PaginationOpts, a as PaginatedResult, b as InstanceFilter, C as CursorPaginationOpts, c as CursorPaginatedResult } from './IStorageAdapter-
|
|
2
|
-
import {
|
|
3
|
-
import { I as INotificationAdapter, b as ApprovalEventName, a as ApprovalEventMap } from './INotificationAdapter-
|
|
1
|
+
import { I as IStorageAdapter, P as PaginationOpts, a as PaginatedResult, b as InstanceFilter, C as CursorPaginationOpts, c as CursorPaginatedResult } from './IStorageAdapter-CRSfnH8U.cjs';
|
|
2
|
+
import { l as ConditionExpression, p as ResolverFn, g as ApprovalTemplateConfig, A as ApprovalTemplate, k as AuditContext, a as ApprovalInstance, e as ApprovalMode, b as AuditEntry } from './instance-BE0uJmg3.cjs';
|
|
3
|
+
import { I as INotificationAdapter, b as ApprovalEventName, a as ApprovalEventMap } from './INotificationAdapter-Dy2d0JKy.cjs';
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
import { L as Logger } from './Logger-BplhlU7l.cjs';
|
|
6
6
|
import { C as Clock } from './Clock-3FnOczFJ.cjs';
|
|
7
|
-
import { I as IOperationMiddleware, a as ApprovalError } from './IOperationMiddleware-
|
|
8
|
-
import { I as IAuditAdapter } from './IAuditAdapter-
|
|
9
|
-
import { I as IMetricsAdapter } from './IMetricsAdapter-
|
|
7
|
+
import { I as IOperationMiddleware, a as ApprovalError } from './IOperationMiddleware-DGG-guxK.cjs';
|
|
8
|
+
import { I as IAuditAdapter } from './IAuditAdapter-UJNdJanq.cjs';
|
|
9
|
+
import { I as IMetricsAdapter } from './IMetricsAdapter-DWq8IFaf.cjs';
|
|
10
10
|
import { I as ISchedulerAdapter } from './ISchedulerAdapter-DKv_QjVN.cjs';
|
|
11
|
-
import { I as IAuthorizationPolicy } from './IAuthorizationPolicy-
|
|
11
|
+
import { I as IAuthorizationPolicy } from './IAuthorizationPolicy-CN6LAaKg.cjs';
|
|
12
12
|
|
|
13
13
|
declare const SubmitOptionsSchema: z.ZodObject<{
|
|
14
14
|
templateName: z.ZodString;
|
|
@@ -42,12 +42,14 @@ declare const DelegateOptionsSchema: z.ZodObject<{
|
|
|
42
42
|
toApprover: z.ZodString;
|
|
43
43
|
reason: z.ZodString;
|
|
44
44
|
until: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
45
|
+
level: z.ZodOptional<z.ZodNumber>;
|
|
45
46
|
}, z.core.$strip>;
|
|
46
47
|
declare const ReassignOptionsSchema: z.ZodObject<{
|
|
47
48
|
reassignedBy: z.ZodString;
|
|
48
49
|
fromApprover: z.ZodString;
|
|
49
50
|
toApprover: z.ZodString;
|
|
50
51
|
reason: z.ZodString;
|
|
52
|
+
level: z.ZodOptional<z.ZodNumber>;
|
|
51
53
|
}, z.core.$strip>;
|
|
52
54
|
declare const CancelOptionsSchema: z.ZodObject<{
|
|
53
55
|
cancelledBy: z.ZodString;
|
|
@@ -78,6 +80,27 @@ declare const ProvideInfoOptionsSchema: z.ZodObject<{
|
|
|
78
80
|
respondedBy: z.ZodString;
|
|
79
81
|
response: z.ZodString;
|
|
80
82
|
}, z.core.$strip>;
|
|
83
|
+
declare const AddAttachmentOptionsSchema: z.ZodObject<{
|
|
84
|
+
actorId: z.ZodString;
|
|
85
|
+
name: z.ZodString;
|
|
86
|
+
uri: z.ZodString;
|
|
87
|
+
contentType: z.ZodOptional<z.ZodString>;
|
|
88
|
+
sizeBytes: z.ZodOptional<z.ZodNumber>;
|
|
89
|
+
}, z.core.$strip>;
|
|
90
|
+
declare const RemoveAttachmentOptionsSchema: z.ZodObject<{
|
|
91
|
+
actorId: z.ZodString;
|
|
92
|
+
attachmentId: z.ZodString;
|
|
93
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
94
|
+
}, z.core.$strip>;
|
|
95
|
+
declare const TransferApprovalsOptionsSchema: z.ZodObject<{
|
|
96
|
+
fromApprover: z.ZodString;
|
|
97
|
+
toApprover: z.ZodString;
|
|
98
|
+
transferredBy: z.ZodString;
|
|
99
|
+
reason: z.ZodString;
|
|
100
|
+
documentType: z.ZodOptional<z.ZodString>;
|
|
101
|
+
dryRun: z.ZodDefault<z.ZodBoolean>;
|
|
102
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
103
|
+
}, z.core.$strip>;
|
|
81
104
|
declare const UpdateDataOptionsSchema: z.ZodObject<{
|
|
82
105
|
updatedBy: z.ZodString;
|
|
83
106
|
data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
@@ -101,6 +124,9 @@ type OverrideOptions = z.infer<typeof OverrideOptionsSchema>;
|
|
|
101
124
|
type UpdateDataOptions = z.infer<typeof UpdateDataOptionsSchema>;
|
|
102
125
|
type RequestInfoOptions = z.infer<typeof RequestInfoOptionsSchema>;
|
|
103
126
|
type ProvideInfoOptions = z.infer<typeof ProvideInfoOptionsSchema>;
|
|
127
|
+
type AddAttachmentOptions = z.infer<typeof AddAttachmentOptionsSchema>;
|
|
128
|
+
type RemoveAttachmentOptions = z.infer<typeof RemoveAttachmentOptionsSchema>;
|
|
129
|
+
type TransferApprovalsOptions = z.infer<typeof TransferApprovalsOptionsSchema>;
|
|
104
130
|
|
|
105
131
|
/**
|
|
106
132
|
* Computes deadline dates from a number of days. The default engine behaviour
|
|
@@ -132,7 +158,7 @@ interface WeekendCalendarOptions {
|
|
|
132
158
|
*/
|
|
133
159
|
declare function weekendCalendar(options?: WeekendCalendarOptions): BusinessCalendar;
|
|
134
160
|
|
|
135
|
-
type IdGeneratorPrefix = 'inst' | 'tpl';
|
|
161
|
+
type IdGeneratorPrefix = 'inst' | 'tpl' | 'att';
|
|
136
162
|
type IdGeneratorFn = (prefix: IdGeneratorPrefix) => string;
|
|
137
163
|
declare const defaultIdGenerator: IdGeneratorFn;
|
|
138
164
|
|
|
@@ -240,6 +266,24 @@ interface BulkResult {
|
|
|
240
266
|
}>;
|
|
241
267
|
total: number;
|
|
242
268
|
}
|
|
269
|
+
/** Outcome of a {@link ApprovalEngine.transferApprovals} sweep. */
|
|
270
|
+
interface TransferResult {
|
|
271
|
+
/** One entry per level actually moved (an instance can hold the approver on several open branches). */
|
|
272
|
+
transferred: Array<{
|
|
273
|
+
instanceId: string;
|
|
274
|
+
level: number;
|
|
275
|
+
documentId: string;
|
|
276
|
+
}>;
|
|
277
|
+
/** Instances that could not be moved, with the reason. */
|
|
278
|
+
failed: Array<{
|
|
279
|
+
instanceId: string;
|
|
280
|
+
error: ApprovalError;
|
|
281
|
+
}>;
|
|
282
|
+
/** Instances examined. */
|
|
283
|
+
scanned: number;
|
|
284
|
+
/** True when nothing was written. */
|
|
285
|
+
dryRun: boolean;
|
|
286
|
+
}
|
|
243
287
|
interface ApprovalStatistics {
|
|
244
288
|
/** Total instances matching the filter (across all statuses). */
|
|
245
289
|
total: number;
|
|
@@ -490,6 +534,30 @@ declare class ApprovalEngine {
|
|
|
490
534
|
* by being held.
|
|
491
535
|
*/
|
|
492
536
|
private extendDeadlinesBy;
|
|
537
|
+
/**
|
|
538
|
+
* Attach supporting evidence to an approval — a quote PDF, a signed contract,
|
|
539
|
+
* a screenshot of a system of record.
|
|
540
|
+
*
|
|
541
|
+
* Stores a **reference**, never bytes. Approval documents belong in the object
|
|
542
|
+
* store or DMS the organisation already runs, which handles retention, virus
|
|
543
|
+
* scanning and access control far better than an approval table could;
|
|
544
|
+
* copying them here would make the audit database the largest and least
|
|
545
|
+
* governed copy of them.
|
|
546
|
+
*
|
|
547
|
+
* Allowed on any non-terminal instance, by anyone the authorization policy
|
|
548
|
+
* permits: the submitter adding a missing quote and an approver adding the
|
|
549
|
+
* note that justifies their decision are both ordinary.
|
|
550
|
+
*/
|
|
551
|
+
addAttachment(instanceId: string, raw: AddAttachmentOptions, auditCtx?: AuditContext): Promise<ApprovalInstance>;
|
|
552
|
+
/**
|
|
553
|
+
* Detach a reference from an approval.
|
|
554
|
+
*
|
|
555
|
+
* The audit entry keeps the name and URI of what was removed, so the record
|
|
556
|
+
* still shows an approver saw evidence that is no longer listed — dropping
|
|
557
|
+
* that would let the trail imply a decision was made on less than it was.
|
|
558
|
+
* Nothing is deleted from the underlying store; that is the DMS's call.
|
|
559
|
+
*/
|
|
560
|
+
removeAttachment(instanceId: string, raw: RemoveAttachmentOptions, auditCtx?: AuditContext): Promise<ApprovalInstance>;
|
|
493
561
|
/** Add a comment to an instance without approving or rejecting. */
|
|
494
562
|
addComment(instanceId: string, raw: AddCommentOptions, auditCtx?: AuditContext): Promise<void>;
|
|
495
563
|
/** Resubmit a rejected instance, creating a new linked instance from level 1. */
|
|
@@ -501,6 +569,28 @@ declare class ApprovalEngine {
|
|
|
501
569
|
/** Emergency bypass — completes the instance as 'approved', skipping remaining levels. Requires template.allowOverride = true. */
|
|
502
570
|
override(instanceId: string, raw: OverrideOptions, auditCtx?: AuditContext): Promise<ApprovalInstance>;
|
|
503
571
|
/** Approve multiple instances in one call. Never throws — failures collected in result.failed. */
|
|
572
|
+
/**
|
|
573
|
+
* Move every pending approval assigned to one person over to another.
|
|
574
|
+
*
|
|
575
|
+
* Someone leaves, changes team, or goes on long-term leave, and their queue
|
|
576
|
+
* has to go somewhere. Doing it by hand means finding every open instance
|
|
577
|
+
* first — across parallel branches, where one person can hold several open
|
|
578
|
+
* levels on the same document — and missing one leaves an approval that can
|
|
579
|
+
* never complete.
|
|
580
|
+
*
|
|
581
|
+
* Each move goes through {@link reassign}, so every guard, audit entry, event
|
|
582
|
+
* and authorization check that applies to a single reassignment applies here
|
|
583
|
+
* too. There is no bulk short-cut around them.
|
|
584
|
+
*
|
|
585
|
+
* The sweep is **not atomic**: it reassigns one level at a time and reports
|
|
586
|
+
* per-instance failures rather than rolling back. A partial transfer is the
|
|
587
|
+
* useful outcome — the approvals that could move should move, and the ones
|
|
588
|
+
* that could not are named so a human can look at them.
|
|
589
|
+
*
|
|
590
|
+
* @param raw - Who is moving to whom, and why.
|
|
591
|
+
* @returns What moved, what did not, and why. With `dryRun` nothing is written.
|
|
592
|
+
*/
|
|
593
|
+
transferApprovals(raw: TransferApprovalsOptions, auditCtx?: AuditContext): Promise<TransferResult>;
|
|
504
594
|
bulkApprove(instanceIds: string[], raw: ApproveOptions, auditCtx?: AuditContext): Promise<BulkResult>;
|
|
505
595
|
/** Reject multiple instances in one call. Never throws — failures collected in result.failed. */
|
|
506
596
|
bulkReject(instanceIds: string[], raw: RejectOptions, auditCtx?: AuditContext): Promise<BulkResult>;
|
|
@@ -614,4 +704,4 @@ declare class ApprovalEngine {
|
|
|
614
704
|
private runExternalAudit;
|
|
615
705
|
}
|
|
616
706
|
|
|
617
|
-
export { type AddCommentOptions as A, type BulkResult as B, type CanApproveResult as C, type DelegateOptions as D, type EscalateOptions as E, type HealthResult as H, type IdGeneratorFn as I, type OrgProvider as O, type PreviewChainLevel as P, type ReassignOptions as R, type SubmitOptions as S, type UpdateDataOptions as U, type ValidationResult as V, type WeekendCalendarOptions as W, ApprovalEngine as a, type ApprovalEngineOptions as b, type ApprovalStatistics as c, type ApproveOptions as d, type ApproverResolverFn as e, type BusinessCalendar as f, type CancelOptions as g, type ConditionOperatorFn as h, type CycleTimeStats as i, type IdempotencyKeyFn as j, type OutOfOfficeProvider as k, type OverrideOptions as l, type PreviewResult as m, type ProvideInfoOptions as n, type RejectOptions as o, type RequestInfoOptions as p, type ResubmitOptions as q, type RetryPolicy as r, defaultIdGenerator as s, toComparableNumber as t, validateConditionExpression as v, weekendCalendar as w };
|
|
707
|
+
export { type AddCommentOptions as A, type BulkResult as B, type CanApproveResult as C, type DelegateOptions as D, type EscalateOptions as E, type HealthResult as H, type IdGeneratorFn as I, type OrgProvider as O, type PreviewChainLevel as P, type ReassignOptions as R, type SubmitOptions as S, type TransferResult as T, type UpdateDataOptions as U, type ValidationResult as V, type WeekendCalendarOptions as W, ApprovalEngine as a, type ApprovalEngineOptions as b, type ApprovalStatistics as c, type ApproveOptions as d, type ApproverResolverFn as e, type BusinessCalendar as f, type CancelOptions as g, type ConditionOperatorFn as h, type CycleTimeStats as i, type IdempotencyKeyFn as j, type OutOfOfficeProvider as k, type OverrideOptions as l, type PreviewResult as m, type ProvideInfoOptions as n, type RejectOptions as o, type RequestInfoOptions as p, type ResubmitOptions as q, type RetryPolicy as r, defaultIdGenerator as s, toComparableNumber as t, validateConditionExpression as v, weekendCalendar as w };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a as ApprovalInstance, d as ApprovalLevelInstance } from './instance-
|
|
1
|
+
import { a as ApprovalInstance, d as ApprovalLevelInstance } from './instance-BE0uJmg3.js';
|
|
2
2
|
|
|
3
3
|
interface AuthorizationContext {
|
|
4
|
-
operation: 'submit' | 'approve' | 'reject' | 'delegate' | 'reassign' | 'cancel' | 'escalate' | 'override' | 'resubmit' | 'addComment' | 'updateData' | 'requestInfo' | 'provideInfo';
|
|
4
|
+
operation: 'submit' | 'approve' | 'reject' | 'delegate' | 'reassign' | 'cancel' | 'escalate' | 'override' | 'resubmit' | 'addComment' | 'updateData' | 'requestInfo' | 'provideInfo' | 'addAttachment' | 'removeAttachment';
|
|
5
5
|
actorId: string;
|
|
6
6
|
instance: Readonly<ApprovalInstance>;
|
|
7
7
|
level?: Readonly<ApprovalLevelInstance>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a as ApprovalInstance, d as ApprovalLevelInstance } from './instance-
|
|
1
|
+
import { a as ApprovalInstance, d as ApprovalLevelInstance } from './instance-BE0uJmg3.cjs';
|
|
2
2
|
|
|
3
3
|
interface AuthorizationContext {
|
|
4
|
-
operation: 'submit' | 'approve' | 'reject' | 'delegate' | 'reassign' | 'cancel' | 'escalate' | 'override' | 'resubmit' | 'addComment' | 'updateData' | 'requestInfo' | 'provideInfo';
|
|
4
|
+
operation: 'submit' | 'approve' | 'reject' | 'delegate' | 'reassign' | 'cancel' | 'escalate' | 'override' | 'resubmit' | 'addComment' | 'updateData' | 'requestInfo' | 'provideInfo' | 'addAttachment' | 'removeAttachment';
|
|
5
5
|
actorId: string;
|
|
6
6
|
instance: Readonly<ApprovalInstance>;
|
|
7
7
|
level?: Readonly<ApprovalLevelInstance>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
type MetricName = 'approval.submitted' | 'approval.approved' | 'approval.rejected' | 'approval.cancelled' | 'approval.expired' | 'approval.sla_breached' | 'approval.escalated' | 'approval.reassigned' | 'approval.overridden' | 'approval.data_updated' | 'approval.reminded' | 'approval.info_requested' | 'approval.info_provided' | 'approval.conflict_retry' | 'approval.operation_duration_ms';
|
|
1
|
+
type MetricName = 'approval.submitted' | 'approval.approved' | 'approval.rejected' | 'approval.cancelled' | 'approval.expired' | 'approval.sla_breached' | 'approval.escalated' | 'approval.reassigned' | 'approval.overridden' | 'approval.data_updated' | 'approval.reminded' | 'approval.info_requested' | 'approval.info_provided' | 'approval.attachment_added' | 'approval.attachment_removed' | 'approval.conflict_retry' | 'approval.operation_duration_ms';
|
|
2
2
|
interface IMetricsAdapter {
|
|
3
3
|
/** Increment a counter. Synchronous — never awaited. */
|
|
4
4
|
increment(metric: MetricName, labels?: Record<string, string>): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
type MetricName = 'approval.submitted' | 'approval.approved' | 'approval.rejected' | 'approval.cancelled' | 'approval.expired' | 'approval.sla_breached' | 'approval.escalated' | 'approval.reassigned' | 'approval.overridden' | 'approval.data_updated' | 'approval.reminded' | 'approval.info_requested' | 'approval.info_provided' | 'approval.conflict_retry' | 'approval.operation_duration_ms';
|
|
1
|
+
type MetricName = 'approval.submitted' | 'approval.approved' | 'approval.rejected' | 'approval.cancelled' | 'approval.expired' | 'approval.sla_breached' | 'approval.escalated' | 'approval.reassigned' | 'approval.overridden' | 'approval.data_updated' | 'approval.reminded' | 'approval.info_requested' | 'approval.info_provided' | 'approval.attachment_added' | 'approval.attachment_removed' | 'approval.conflict_retry' | 'approval.operation_duration_ms';
|
|
2
2
|
interface IMetricsAdapter {
|
|
3
3
|
/** Increment a counter. Synchronous — never awaited. */
|
|
4
4
|
increment(metric: MetricName, labels?: Record<string, string>): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as ApprovalInstance, b as AuditEntry } from './instance-
|
|
1
|
+
import { a as ApprovalInstance, b as AuditEntry } from './instance-BE0uJmg3.js';
|
|
2
2
|
|
|
3
3
|
interface ApprovalEvent {
|
|
4
4
|
instanceId: string;
|
|
@@ -104,6 +104,14 @@ interface InfoProvidedEvent extends ApprovalEvent {
|
|
|
104
104
|
/** The approvers waiting again now that the question is answered. */
|
|
105
105
|
recipients: string[];
|
|
106
106
|
}
|
|
107
|
+
/** Emitted when supporting evidence is attached to or removed from an approval. */
|
|
108
|
+
interface AttachmentEvent extends ApprovalEvent {
|
|
109
|
+
actorId: string;
|
|
110
|
+
attachmentId: string;
|
|
111
|
+
name: string;
|
|
112
|
+
uri: string;
|
|
113
|
+
level?: number;
|
|
114
|
+
}
|
|
107
115
|
interface ApprovalEventMap {
|
|
108
116
|
'approval:submitted': SubmittedEvent;
|
|
109
117
|
'approval:approved': ApprovedEvent;
|
|
@@ -122,6 +130,8 @@ interface ApprovalEventMap {
|
|
|
122
130
|
'approval:reminder': ReminderEvent;
|
|
123
131
|
'approval:info_requested': InfoRequestedEvent;
|
|
124
132
|
'approval:info_provided': InfoProvidedEvent;
|
|
133
|
+
'approval:attachment_added': AttachmentEvent;
|
|
134
|
+
'approval:attachment_removed': AttachmentEvent;
|
|
125
135
|
}
|
|
126
136
|
type ApprovalEventName = keyof ApprovalEventMap;
|
|
127
137
|
interface HistoryEntry extends AuditEntry {
|
|
@@ -145,4 +155,4 @@ interface INotificationAdapter {
|
|
|
145
155
|
notify(event: NotificationEvent): Promise<void>;
|
|
146
156
|
}
|
|
147
157
|
|
|
148
|
-
export type { ApprovalEvent as A, CancelledEvent as C, DataUpdatedEvent as D, EscalatedEvent as E, HistoryEntry as H, INotificationAdapter as I, LevelAdvancedEvent as L, NotificationEvent as N, OverriddenEvent as O, ReassignedEvent as R, SlaBreachedEvent as S, ApprovalEventMap as a, ApprovalEventName as b, ApprovedEvent as c,
|
|
158
|
+
export type { ApprovalEvent as A, CancelledEvent as C, DataUpdatedEvent as D, EscalatedEvent as E, HistoryEntry as H, INotificationAdapter as I, LevelAdvancedEvent as L, NotificationEvent as N, OverriddenEvent as O, ReassignedEvent as R, SlaBreachedEvent as S, ApprovalEventMap as a, ApprovalEventName as b, ApprovedEvent as c, AttachmentEvent as d, DelegatedEvent as e, ExpiredEvent as f, InfoProvidedEvent as g, InfoRequestedEvent as h, RejectedEvent as i, ReminderEvent as j, ResubmittedEvent as k, SubmittedEvent as l };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as ApprovalInstance, b as AuditEntry } from './instance-
|
|
1
|
+
import { a as ApprovalInstance, b as AuditEntry } from './instance-BE0uJmg3.cjs';
|
|
2
2
|
|
|
3
3
|
interface ApprovalEvent {
|
|
4
4
|
instanceId: string;
|
|
@@ -104,6 +104,14 @@ interface InfoProvidedEvent extends ApprovalEvent {
|
|
|
104
104
|
/** The approvers waiting again now that the question is answered. */
|
|
105
105
|
recipients: string[];
|
|
106
106
|
}
|
|
107
|
+
/** Emitted when supporting evidence is attached to or removed from an approval. */
|
|
108
|
+
interface AttachmentEvent extends ApprovalEvent {
|
|
109
|
+
actorId: string;
|
|
110
|
+
attachmentId: string;
|
|
111
|
+
name: string;
|
|
112
|
+
uri: string;
|
|
113
|
+
level?: number;
|
|
114
|
+
}
|
|
107
115
|
interface ApprovalEventMap {
|
|
108
116
|
'approval:submitted': SubmittedEvent;
|
|
109
117
|
'approval:approved': ApprovedEvent;
|
|
@@ -122,6 +130,8 @@ interface ApprovalEventMap {
|
|
|
122
130
|
'approval:reminder': ReminderEvent;
|
|
123
131
|
'approval:info_requested': InfoRequestedEvent;
|
|
124
132
|
'approval:info_provided': InfoProvidedEvent;
|
|
133
|
+
'approval:attachment_added': AttachmentEvent;
|
|
134
|
+
'approval:attachment_removed': AttachmentEvent;
|
|
125
135
|
}
|
|
126
136
|
type ApprovalEventName = keyof ApprovalEventMap;
|
|
127
137
|
interface HistoryEntry extends AuditEntry {
|
|
@@ -145,4 +155,4 @@ interface INotificationAdapter {
|
|
|
145
155
|
notify(event: NotificationEvent): Promise<void>;
|
|
146
156
|
}
|
|
147
157
|
|
|
148
|
-
export type { ApprovalEvent as A, CancelledEvent as C, DataUpdatedEvent as D, EscalatedEvent as E, HistoryEntry as H, INotificationAdapter as I, LevelAdvancedEvent as L, NotificationEvent as N, OverriddenEvent as O, ReassignedEvent as R, SlaBreachedEvent as S, ApprovalEventMap as a, ApprovalEventName as b, ApprovedEvent as c,
|
|
158
|
+
export type { ApprovalEvent as A, CancelledEvent as C, DataUpdatedEvent as D, EscalatedEvent as E, HistoryEntry as H, INotificationAdapter as I, LevelAdvancedEvent as L, NotificationEvent as N, OverriddenEvent as O, ReassignedEvent as R, SlaBreachedEvent as S, ApprovalEventMap as a, ApprovalEventName as b, ApprovedEvent as c, AttachmentEvent as d, DelegatedEvent as e, ExpiredEvent as f, InfoProvidedEvent as g, InfoRequestedEvent as h, RejectedEvent as i, ReminderEvent as j, ResubmittedEvent as k, SubmittedEvent as l };
|