hierarchical-approval 4.0.6 → 4.0.7
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 +12 -0
- package/dist/{ApprovalEngine-BnMpoQB2.d.cts → ApprovalEngine-D5ZplHsw.d.cts} +24 -16
- package/dist/{ApprovalEngine-BqKSm1gG.d.ts → ApprovalEngine-sUWBHas4.d.ts} +24 -16
- package/dist/{IAuditAdapter-SNpV2hdt.d.ts → IAuditAdapter-Bg6e0_ME.d.ts} +1 -1
- package/dist/{IAuditAdapter-DR-WIAK6.d.cts → IAuditAdapter-Bv7jIph1.d.cts} +1 -1
- package/dist/{IAuthorizationPolicy-BwYBOQM3.d.cts → IAuthorizationPolicy-D0Phw1c_.d.cts} +1 -1
- package/dist/{IAuthorizationPolicy-BMl0xS-j.d.ts → IAuthorizationPolicy-abLdaLzR.d.ts} +1 -1
- package/dist/{IMetricsAdapter-WROxYSXd.d.cts → IMetricsAdapter-DN9rYsoq.d.cts} +1 -0
- package/dist/{IMetricsAdapter-WROxYSXd.d.ts → IMetricsAdapter-DN9rYsoq.d.ts} +1 -0
- package/dist/{INotificationAdapter-BO6kmkyC.d.cts → INotificationAdapter-D_b-H3bB.d.ts} +5 -1
- package/dist/{INotificationAdapter-DKLEDgAk.d.ts → INotificationAdapter-rBeUKnBa.d.cts} +5 -1
- package/dist/{IOperationMiddleware-CUI6VG6r.d.ts → IOperationMiddleware-BuRYpQdL.d.ts} +1 -1
- package/dist/{IOperationMiddleware-oYhWMKMn.d.cts → IOperationMiddleware-RGAqQ31Q.d.cts} +1 -1
- package/dist/{IStorageAdapter-DN78GD-1.d.ts → IStorageAdapter-Bje_7c62.d.ts} +2 -1
- package/dist/{IStorageAdapter-_PjAgjFA.d.cts → IStorageAdapter-DYFj85oL.d.cts} +2 -1
- package/dist/adapters/MemoryAdapter.d.cts +2 -2
- package/dist/adapters/MemoryAdapter.d.ts +2 -2
- package/dist/adapters/PostgresAdapter.cjs.map +1 -1
- package/dist/adapters/PostgresAdapter.d.cts +3 -2
- package/dist/adapters/PostgresAdapter.d.ts +3 -2
- package/dist/adapters/PostgresAdapter.js.map +1 -1
- package/dist/index.cjs +16 -13
- 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 +16 -13
- package/dist/index.js.map +1 -1
- package/dist/{instance-MWXPSsA6.d.cts → instance-Du-TGRH_.d.cts} +6 -0
- package/dist/{instance-MWXPSsA6.d.ts → instance-Du-TGRH_.d.ts} +6 -0
- package/dist/nestjs.cjs +16 -13
- 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 +16 -13
- 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.d.cts +1 -1
- package/dist/plugins/metrics.d.ts +1 -1
- package/dist/plugins/notify.d.cts +2 -2
- package/dist/plugins/notify.d.ts +2 -2
- package/dist/plugins/resilience.cjs +1 -1
- package/dist/plugins/resilience.cjs.map +1 -1
- package/dist/plugins/resilience.d.cts +3 -3
- package/dist/plugins/resilience.d.ts +3 -3
- package/dist/plugins/resilience.js +1 -1
- package/dist/plugins/resilience.js.map +1 -1
- package/dist/plugins/tracing.cjs.map +1 -1
- package/dist/plugins/tracing.d.cts +3 -2
- package/dist/plugins/tracing.d.ts +3 -2
- package/dist/plugins/tracing.js.map +1 -1
- package/dist/plugins/webhook.d.cts +2 -2
- package/dist/plugins/webhook.d.ts +2 -2
- package/dist/testing.cjs +16 -13
- 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 +16 -13
- package/dist/testing.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,18 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
|
5
5
|
|
|
6
6
|
## [Unreleased]
|
|
7
7
|
|
|
8
|
+
## [4.0.7] - 2026-09-28
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- `RbacAuthorizationPolicy`'s roleProvider-failure denial message now names
|
|
13
|
+
the offending actor id, instead of a message that gave no clue which actor
|
|
14
|
+
triggered the fail-closed denial.
|
|
15
|
+
- `ImportResult` and `PreviewResult`'s array fields are now typed as
|
|
16
|
+
`readonly T[]`, not just `readonly` properties holding a mutable array —
|
|
17
|
+
callers could previously still `push`/`splice` the returned arrays in
|
|
18
|
+
place even though the property itself couldn't be reassigned.
|
|
19
|
+
|
|
8
20
|
## [4.0.6] - 2026-09-26
|
|
9
21
|
|
|
10
22
|
### Fixed
|
|
@@ -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 { m as ConditionExpression, r as ResolverFn, g as ApprovalTemplateConfig, A as ApprovalTemplate, k as AuditContext, a as ApprovalInstance, C as Comment, e as ApprovalMode, f as ApprovalStatus, L as LevelStatus, b as AuditEntry } from './instance-
|
|
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-DYFj85oL.cjs';
|
|
2
|
+
import { m as ConditionExpression, r as ResolverFn, g as ApprovalTemplateConfig, A as ApprovalTemplate, k as AuditContext, a as ApprovalInstance, C as Comment, e as ApprovalMode, f as ApprovalStatus, L as LevelStatus, b as AuditEntry } from './instance-Du-TGRH_.cjs';
|
|
3
|
+
import { I as INotificationAdapter, b as ApprovalEventName, a as ApprovalEventMap } from './INotificationAdapter-rBeUKnBa.cjs';
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
import { L as Logger } from './Logger-hqFbBCtB.cjs';
|
|
6
6
|
import { C as Clock } from './Clock-D8Qp39q_.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-RGAqQ31Q.cjs';
|
|
8
|
+
import { I as IAuditAdapter } from './IAuditAdapter-Bv7jIph1.cjs';
|
|
9
|
+
import { I as IMetricsAdapter } from './IMetricsAdapter-DN9rYsoq.cjs';
|
|
10
10
|
import { I as ISchedulerAdapter } from './ISchedulerAdapter-CLMdBA-5.cjs';
|
|
11
|
-
import { I as IAuthorizationPolicy } from './IAuthorizationPolicy-
|
|
11
|
+
import { I as IAuthorizationPolicy } from './IAuthorizationPolicy-D0Phw1c_.cjs';
|
|
12
12
|
|
|
13
13
|
declare const SubmitOptionsSchema: z.ZodObject<{
|
|
14
14
|
templateName: z.ZodString;
|
|
@@ -302,7 +302,7 @@ interface CanApproveResult {
|
|
|
302
302
|
eligible: boolean;
|
|
303
303
|
reason?: 'not_an_approver' | 'already_acted' | 'self_approval' | 'wrong_status' | 'delegated_away';
|
|
304
304
|
}
|
|
305
|
-
/** One entry in a {@link ApprovalEngine.
|
|
305
|
+
/** One entry in a {@link ApprovalEngine.previewApprovalChain} result, resolved against the given data without persisting anything. */
|
|
306
306
|
interface PreviewChainLevel {
|
|
307
307
|
level: number;
|
|
308
308
|
name: string;
|
|
@@ -310,10 +310,12 @@ interface PreviewChainLevel {
|
|
|
310
310
|
resolvedApprovers: string[];
|
|
311
311
|
mode: ApprovalMode;
|
|
312
312
|
}
|
|
313
|
+
/** Return value of {@link ApprovalEngine.previewApprovalChain}. */
|
|
313
314
|
interface PreviewResult {
|
|
314
|
-
|
|
315
|
+
/** The resolved chain, in level order. */
|
|
316
|
+
readonly levels: readonly PreviewChainLevel[];
|
|
315
317
|
/** Indices (0-based) of conditions that fired for this data. */
|
|
316
|
-
conditionsApplied: number[];
|
|
318
|
+
readonly conditionsApplied: readonly number[];
|
|
317
319
|
}
|
|
318
320
|
/** Where one level in an explained chain came from. */
|
|
319
321
|
interface ExplainedLevel {
|
|
@@ -468,14 +470,14 @@ interface TemplateBundle {
|
|
|
468
470
|
}
|
|
469
471
|
/** Outcome of {@link ApprovalEngine.importTemplates}. */
|
|
470
472
|
interface ImportResult {
|
|
471
|
-
created: string[];
|
|
472
|
-
updated: string[];
|
|
473
|
-
skipped: string[];
|
|
474
|
-
errors:
|
|
473
|
+
readonly created: readonly string[];
|
|
474
|
+
readonly updated: readonly string[];
|
|
475
|
+
readonly skipped: readonly string[];
|
|
476
|
+
readonly errors: readonly Readonly<{
|
|
475
477
|
name: string;
|
|
476
478
|
message: string;
|
|
477
|
-
}
|
|
478
|
-
dryRun: boolean;
|
|
479
|
+
}>[];
|
|
480
|
+
readonly dryRun: boolean;
|
|
479
481
|
}
|
|
480
482
|
/** Outcome of a {@link ApprovalEngine.purgeInstances} sweep. */
|
|
481
483
|
interface PurgeResult {
|
|
@@ -577,6 +579,7 @@ interface RetryPolicy {
|
|
|
577
579
|
}
|
|
578
580
|
/** Derives the idempotency key used to dedupe a {@link ApprovalEngine.submit} call from its tenant and document identity. */
|
|
579
581
|
type IdempotencyKeyFn = (tenantId: string, documentType: string, documentId: string, templateName: string, data: Record<string, unknown>) => string;
|
|
582
|
+
/** Constructor options for {@link ApprovalEngine}. Only `adapter` is required. */
|
|
580
583
|
interface ApprovalEngineOptions {
|
|
581
584
|
adapter: IStorageAdapter;
|
|
582
585
|
tenantId?: string;
|
|
@@ -631,6 +634,11 @@ interface ApprovalEngineOptions {
|
|
|
631
634
|
/** Middleware chain: before/after/onError hooks for every operation. */
|
|
632
635
|
middleware?: IOperationMiddleware[];
|
|
633
636
|
}
|
|
637
|
+
/**
|
|
638
|
+
* Runs multi-level approval workflows against a pluggable {@link IStorageAdapter}:
|
|
639
|
+
* submitting instances against a template, resolving and notifying approvers,
|
|
640
|
+
* recording decisions, and driving escalation, expiry and sub-workflows.
|
|
641
|
+
*/
|
|
634
642
|
declare class ApprovalEngine {
|
|
635
643
|
private readonly opts;
|
|
636
644
|
private readonly bus;
|
|
@@ -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 { m as ConditionExpression, r as ResolverFn, g as ApprovalTemplateConfig, A as ApprovalTemplate, k as AuditContext, a as ApprovalInstance, C as Comment, e as ApprovalMode, f as ApprovalStatus, L as LevelStatus, b as AuditEntry } from './instance-
|
|
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-Bje_7c62.js';
|
|
2
|
+
import { m as ConditionExpression, r as ResolverFn, g as ApprovalTemplateConfig, A as ApprovalTemplate, k as AuditContext, a as ApprovalInstance, C as Comment, e as ApprovalMode, f as ApprovalStatus, L as LevelStatus, b as AuditEntry } from './instance-Du-TGRH_.js';
|
|
3
|
+
import { I as INotificationAdapter, b as ApprovalEventName, a as ApprovalEventMap } from './INotificationAdapter-D_b-H3bB.js';
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
import { L as Logger } from './Logger-hqFbBCtB.js';
|
|
6
6
|
import { C as Clock } from './Clock-D8Qp39q_.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-BuRYpQdL.js';
|
|
8
|
+
import { I as IAuditAdapter } from './IAuditAdapter-Bg6e0_ME.js';
|
|
9
|
+
import { I as IMetricsAdapter } from './IMetricsAdapter-DN9rYsoq.js';
|
|
10
10
|
import { I as ISchedulerAdapter } from './ISchedulerAdapter-CLMdBA-5.js';
|
|
11
|
-
import { I as IAuthorizationPolicy } from './IAuthorizationPolicy-
|
|
11
|
+
import { I as IAuthorizationPolicy } from './IAuthorizationPolicy-abLdaLzR.js';
|
|
12
12
|
|
|
13
13
|
declare const SubmitOptionsSchema: z.ZodObject<{
|
|
14
14
|
templateName: z.ZodString;
|
|
@@ -302,7 +302,7 @@ interface CanApproveResult {
|
|
|
302
302
|
eligible: boolean;
|
|
303
303
|
reason?: 'not_an_approver' | 'already_acted' | 'self_approval' | 'wrong_status' | 'delegated_away';
|
|
304
304
|
}
|
|
305
|
-
/** One entry in a {@link ApprovalEngine.
|
|
305
|
+
/** One entry in a {@link ApprovalEngine.previewApprovalChain} result, resolved against the given data without persisting anything. */
|
|
306
306
|
interface PreviewChainLevel {
|
|
307
307
|
level: number;
|
|
308
308
|
name: string;
|
|
@@ -310,10 +310,12 @@ interface PreviewChainLevel {
|
|
|
310
310
|
resolvedApprovers: string[];
|
|
311
311
|
mode: ApprovalMode;
|
|
312
312
|
}
|
|
313
|
+
/** Return value of {@link ApprovalEngine.previewApprovalChain}. */
|
|
313
314
|
interface PreviewResult {
|
|
314
|
-
|
|
315
|
+
/** The resolved chain, in level order. */
|
|
316
|
+
readonly levels: readonly PreviewChainLevel[];
|
|
315
317
|
/** Indices (0-based) of conditions that fired for this data. */
|
|
316
|
-
conditionsApplied: number[];
|
|
318
|
+
readonly conditionsApplied: readonly number[];
|
|
317
319
|
}
|
|
318
320
|
/** Where one level in an explained chain came from. */
|
|
319
321
|
interface ExplainedLevel {
|
|
@@ -468,14 +470,14 @@ interface TemplateBundle {
|
|
|
468
470
|
}
|
|
469
471
|
/** Outcome of {@link ApprovalEngine.importTemplates}. */
|
|
470
472
|
interface ImportResult {
|
|
471
|
-
created: string[];
|
|
472
|
-
updated: string[];
|
|
473
|
-
skipped: string[];
|
|
474
|
-
errors:
|
|
473
|
+
readonly created: readonly string[];
|
|
474
|
+
readonly updated: readonly string[];
|
|
475
|
+
readonly skipped: readonly string[];
|
|
476
|
+
readonly errors: readonly Readonly<{
|
|
475
477
|
name: string;
|
|
476
478
|
message: string;
|
|
477
|
-
}
|
|
478
|
-
dryRun: boolean;
|
|
479
|
+
}>[];
|
|
480
|
+
readonly dryRun: boolean;
|
|
479
481
|
}
|
|
480
482
|
/** Outcome of a {@link ApprovalEngine.purgeInstances} sweep. */
|
|
481
483
|
interface PurgeResult {
|
|
@@ -577,6 +579,7 @@ interface RetryPolicy {
|
|
|
577
579
|
}
|
|
578
580
|
/** Derives the idempotency key used to dedupe a {@link ApprovalEngine.submit} call from its tenant and document identity. */
|
|
579
581
|
type IdempotencyKeyFn = (tenantId: string, documentType: string, documentId: string, templateName: string, data: Record<string, unknown>) => string;
|
|
582
|
+
/** Constructor options for {@link ApprovalEngine}. Only `adapter` is required. */
|
|
580
583
|
interface ApprovalEngineOptions {
|
|
581
584
|
adapter: IStorageAdapter;
|
|
582
585
|
tenantId?: string;
|
|
@@ -631,6 +634,11 @@ interface ApprovalEngineOptions {
|
|
|
631
634
|
/** Middleware chain: before/after/onError hooks for every operation. */
|
|
632
635
|
middleware?: IOperationMiddleware[];
|
|
633
636
|
}
|
|
637
|
+
/**
|
|
638
|
+
* Runs multi-level approval workflows against a pluggable {@link IStorageAdapter}:
|
|
639
|
+
* submitting instances against a template, resolving and notifying approvers,
|
|
640
|
+
* recording decisions, and driving escalation, expiry and sub-workflows.
|
|
641
|
+
*/
|
|
634
642
|
declare class ApprovalEngine {
|
|
635
643
|
private readonly opts;
|
|
636
644
|
private readonly bus;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { b as AuditEntry, a as ApprovalInstance } from './instance-
|
|
1
|
+
import { b as AuditEntry, a as ApprovalInstance } from './instance-Du-TGRH_.js';
|
|
2
2
|
|
|
3
3
|
/** Secondary write sink for audit entries, alongside the primary storage adapter. */
|
|
4
4
|
interface IAuditAdapter {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { b as AuditEntry, a as ApprovalInstance } from './instance-
|
|
1
|
+
import { b as AuditEntry, a as ApprovalInstance } from './instance-Du-TGRH_.cjs';
|
|
2
2
|
|
|
3
3
|
/** Secondary write sink for audit entries, alongside the primary storage adapter. */
|
|
4
4
|
interface IAuditAdapter {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as ApprovalInstance, d as ApprovalLevelInstance } from './instance-
|
|
1
|
+
import { a as ApprovalInstance, d as ApprovalLevelInstance } from './instance-Du-TGRH_.cjs';
|
|
2
2
|
|
|
3
3
|
interface AuthorizationContext {
|
|
4
4
|
/** The engine method the actor is attempting to call. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as ApprovalInstance, d as ApprovalLevelInstance } from './instance-
|
|
1
|
+
import { a as ApprovalInstance, d as ApprovalLevelInstance } from './instance-Du-TGRH_.js';
|
|
2
2
|
|
|
3
3
|
interface AuthorizationContext {
|
|
4
4
|
/** The engine method the actor is attempting to call. */
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/** Closed set of metric names an {@link IMetricsAdapter} may be called with, namespaced `approval.<verb>`. */
|
|
2
2
|
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';
|
|
3
|
+
/** Sink for engine metrics. Implementations are called synchronously and must not throw. */
|
|
3
4
|
interface IMetricsAdapter {
|
|
4
5
|
/** Increment a counter. Synchronous — never awaited. */
|
|
5
6
|
increment(metric: MetricName, labels?: Record<string, string>): void;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/** Closed set of metric names an {@link IMetricsAdapter} may be called with, namespaced `approval.<verb>`. */
|
|
2
2
|
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';
|
|
3
|
+
/** Sink for engine metrics. Implementations are called synchronously and must not throw. */
|
|
3
4
|
interface IMetricsAdapter {
|
|
4
5
|
/** Increment a counter. Synchronous — never awaited. */
|
|
5
6
|
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-Du-TGRH_.js';
|
|
2
2
|
|
|
3
3
|
/** Common fields carried by every lifecycle event emitted for an approval instance. */
|
|
4
4
|
interface ApprovalEvent {
|
|
@@ -159,6 +159,7 @@ interface CommentedEvent extends ApprovalEvent {
|
|
|
159
159
|
/** Users named in the comment. */
|
|
160
160
|
recipients: string[];
|
|
161
161
|
}
|
|
162
|
+
/** Maps each lifecycle event name to its payload type. Keys are what {@link ApprovalEngine.on} accepts; see {@link ApprovalEventName}. */
|
|
162
163
|
interface ApprovalEventMap {
|
|
163
164
|
'approval:submitted': SubmittedEvent;
|
|
164
165
|
'approval:approved': ApprovedEvent;
|
|
@@ -184,10 +185,12 @@ interface ApprovalEventMap {
|
|
|
184
185
|
'approval:commented': CommentedEvent;
|
|
185
186
|
}
|
|
186
187
|
type ApprovalEventName = keyof ApprovalEventMap;
|
|
188
|
+
/** An {@link AuditEntry} tagged with the instance it belongs to, for callers aggregating history across several instances. */
|
|
187
189
|
interface HistoryEntry extends AuditEntry {
|
|
188
190
|
instanceId: string;
|
|
189
191
|
}
|
|
190
192
|
|
|
193
|
+
/** Normalized envelope passed to {@link INotificationAdapter.notify} for every approval event. */
|
|
191
194
|
interface NotificationEvent {
|
|
192
195
|
/** The event that fired, e.g. `'submitted'`, `'approved'`, `'escalated'`. */
|
|
193
196
|
type: ApprovalEventName;
|
|
@@ -208,6 +211,7 @@ interface NotificationEvent {
|
|
|
208
211
|
/** Event-specific detail, shaped by {@link type}. */
|
|
209
212
|
payload: ApprovalEventMap[ApprovalEventName];
|
|
210
213
|
}
|
|
214
|
+
/** Sink for approval-event notifications (email, Slack, webhooks, ...). */
|
|
211
215
|
interface INotificationAdapter {
|
|
212
216
|
/** Called after every emitted approval event. Must not throw — errors are logged and swallowed. */
|
|
213
217
|
notify(event: NotificationEvent): Promise<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-Du-TGRH_.cjs';
|
|
2
2
|
|
|
3
3
|
/** Common fields carried by every lifecycle event emitted for an approval instance. */
|
|
4
4
|
interface ApprovalEvent {
|
|
@@ -159,6 +159,7 @@ interface CommentedEvent extends ApprovalEvent {
|
|
|
159
159
|
/** Users named in the comment. */
|
|
160
160
|
recipients: string[];
|
|
161
161
|
}
|
|
162
|
+
/** Maps each lifecycle event name to its payload type. Keys are what {@link ApprovalEngine.on} accepts; see {@link ApprovalEventName}. */
|
|
162
163
|
interface ApprovalEventMap {
|
|
163
164
|
'approval:submitted': SubmittedEvent;
|
|
164
165
|
'approval:approved': ApprovedEvent;
|
|
@@ -184,10 +185,12 @@ interface ApprovalEventMap {
|
|
|
184
185
|
'approval:commented': CommentedEvent;
|
|
185
186
|
}
|
|
186
187
|
type ApprovalEventName = keyof ApprovalEventMap;
|
|
188
|
+
/** An {@link AuditEntry} tagged with the instance it belongs to, for callers aggregating history across several instances. */
|
|
187
189
|
interface HistoryEntry extends AuditEntry {
|
|
188
190
|
instanceId: string;
|
|
189
191
|
}
|
|
190
192
|
|
|
193
|
+
/** Normalized envelope passed to {@link INotificationAdapter.notify} for every approval event. */
|
|
191
194
|
interface NotificationEvent {
|
|
192
195
|
/** The event that fired, e.g. `'submitted'`, `'approved'`, `'escalated'`. */
|
|
193
196
|
type: ApprovalEventName;
|
|
@@ -208,6 +211,7 @@ interface NotificationEvent {
|
|
|
208
211
|
/** Event-specific detail, shaped by {@link type}. */
|
|
209
212
|
payload: ApprovalEventMap[ApprovalEventName];
|
|
210
213
|
}
|
|
214
|
+
/** Sink for approval-event notifications (email, Slack, webhooks, ...). */
|
|
211
215
|
interface INotificationAdapter {
|
|
212
216
|
/** Called after every emitted approval event. Must not throw — errors are logged and swallowed. */
|
|
213
217
|
notify(event: NotificationEvent): Promise<void>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as ApprovalInstance } from './instance-
|
|
1
|
+
import { a as ApprovalInstance } from './instance-Du-TGRH_.js';
|
|
2
2
|
|
|
3
3
|
/** Base class for all errors thrown by this library; carries a stable machine-readable `code`. */
|
|
4
4
|
declare class ApprovalError extends Error {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as ApprovalInstance } from './instance-
|
|
1
|
+
import { a as ApprovalInstance } from './instance-Du-TGRH_.cjs';
|
|
2
2
|
|
|
3
3
|
/** Base class for all errors thrown by this library; carries a stable machine-readable `code`. */
|
|
4
4
|
declare class ApprovalError extends Error {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as ApprovalTemplate, a as ApprovalInstance, f as ApprovalStatus, b as AuditEntry } from './instance-
|
|
1
|
+
import { A as ApprovalTemplate, a as ApprovalInstance, f as ApprovalStatus, b as AuditEntry } from './instance-Du-TGRH_.js';
|
|
2
2
|
|
|
3
3
|
/** Offset-based pagination request. */
|
|
4
4
|
interface PaginationOpts {
|
|
@@ -34,6 +34,7 @@ interface CursorPaginatedResult<T> {
|
|
|
34
34
|
/** Whether another page exists in the requested direction. */
|
|
35
35
|
hasMore: boolean;
|
|
36
36
|
}
|
|
37
|
+
/** Query filter for listing/counting instances; every set field narrows the match. */
|
|
37
38
|
interface InstanceFilter {
|
|
38
39
|
/** Match only instances in this status. */
|
|
39
40
|
status?: ApprovalStatus;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as ApprovalTemplate, a as ApprovalInstance, f as ApprovalStatus, b as AuditEntry } from './instance-
|
|
1
|
+
import { A as ApprovalTemplate, a as ApprovalInstance, f as ApprovalStatus, b as AuditEntry } from './instance-Du-TGRH_.cjs';
|
|
2
2
|
|
|
3
3
|
/** Offset-based pagination request. */
|
|
4
4
|
interface PaginationOpts {
|
|
@@ -34,6 +34,7 @@ interface CursorPaginatedResult<T> {
|
|
|
34
34
|
/** Whether another page exists in the requested direction. */
|
|
35
35
|
hasMore: boolean;
|
|
36
36
|
}
|
|
37
|
+
/** Query filter for listing/counting instances; every set field narrows the match. */
|
|
37
38
|
interface InstanceFilter {
|
|
38
39
|
/** Match only instances in this status. */
|
|
39
40
|
status?: ApprovalStatus;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { I as IStorageAdapter, P as PaginationOpts, a as PaginatedResult, b as InstanceFilter, C as CursorPaginationOpts, c as CursorPaginatedResult } from '../IStorageAdapter-
|
|
2
|
-
import { A as ApprovalTemplate, a as ApprovalInstance, b as AuditEntry } from '../instance-
|
|
1
|
+
import { I as IStorageAdapter, P as PaginationOpts, a as PaginatedResult, b as InstanceFilter, C as CursorPaginationOpts, c as CursorPaginatedResult } from '../IStorageAdapter-DYFj85oL.cjs';
|
|
2
|
+
import { A as ApprovalTemplate, a as ApprovalInstance, b as AuditEntry } from '../instance-Du-TGRH_.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* In-process {@link IStorageAdapter} backed by two `Map`s, keyed by
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { I as IStorageAdapter, P as PaginationOpts, a as PaginatedResult, b as InstanceFilter, C as CursorPaginationOpts, c as CursorPaginatedResult } from '../IStorageAdapter-
|
|
2
|
-
import { A as ApprovalTemplate, a as ApprovalInstance, b as AuditEntry } from '../instance-
|
|
1
|
+
import { I as IStorageAdapter, P as PaginationOpts, a as PaginatedResult, b as InstanceFilter, C as CursorPaginationOpts, c as CursorPaginatedResult } from '../IStorageAdapter-Bje_7c62.js';
|
|
2
|
+
import { A as ApprovalTemplate, a as ApprovalInstance, b as AuditEntry } from '../instance-Du-TGRH_.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* In-process {@link IStorageAdapter} backed by two `Map`s, keyed by
|