hierarchical-approval 4.0.2 → 4.0.3
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 +20 -4
- package/dist/{ApprovalEngine-Dqe-rC6K.d.ts → ApprovalEngine-BtgQDr_8.d.ts} +13 -9
- package/dist/{ApprovalEngine-XgGBQLC_.d.cts → ApprovalEngine-Djdw-JzA.d.cts} +13 -9
- package/dist/Clock-D8Qp39q_.d.cts +8 -0
- package/dist/Clock-D8Qp39q_.d.ts +8 -0
- package/dist/{IAuditAdapter-DkbyFFjb.d.ts → IAuditAdapter-C-04ar9A.d.ts} +1 -1
- package/dist/{IAuditAdapter-Dt8qjkQL.d.cts → IAuditAdapter-TT2Xhtu6.d.cts} +1 -1
- package/dist/{IAuthorizationPolicy-eo6glbpE.d.ts → IAuthorizationPolicy-D6tTT3gv.d.cts} +6 -1
- package/dist/{IAuthorizationPolicy-YJ_08Mof.d.cts → IAuthorizationPolicy-wIE1mpTy.d.ts} +6 -1
- package/dist/{IMetricsAdapter-DWq8IFaf.d.cts → IMetricsAdapter-WROxYSXd.d.cts} +1 -0
- package/dist/{IMetricsAdapter-DWq8IFaf.d.ts → IMetricsAdapter-WROxYSXd.d.ts} +1 -0
- package/dist/{INotificationAdapter-BTO9FSKy.d.ts → INotificationAdapter-BcUskJ6z.d.ts} +9 -1
- package/dist/{INotificationAdapter-XbD69gss.d.cts → INotificationAdapter-CBsJDk-Y.d.cts} +9 -1
- package/dist/{IOperationMiddleware-CX7lo4lp.d.ts → IOperationMiddleware-C7ciNnJp.d.ts} +3 -2
- package/dist/{IOperationMiddleware-BBLk8MIz.d.cts → IOperationMiddleware-D3Yelw9R.d.cts} +3 -2
- package/dist/{IStorageAdapter-CdXMggPK.d.ts → IStorageAdapter-CVvNsnnD.d.ts} +7 -1
- package/dist/{IStorageAdapter-Cjw5zDwQ.d.cts → IStorageAdapter-D7cy20uD.d.cts} +7 -1
- package/dist/{Logger-BplhlU7l.d.cts → Logger-hqFbBCtB.d.cts} +7 -0
- package/dist/{Logger-BplhlU7l.d.ts → Logger-hqFbBCtB.d.ts} +7 -0
- package/dist/adapters/MemoryAdapter.d.cts +2 -2
- package/dist/adapters/MemoryAdapter.d.ts +2 -2
- package/dist/adapters/PostgresAdapter.d.cts +2 -2
- package/dist/adapters/PostgresAdapter.d.ts +2 -2
- package/dist/index.cjs +32 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -13
- package/dist/index.d.ts +13 -13
- package/dist/index.js +32 -3
- package/dist/index.js.map +1 -1
- package/dist/{instance-uUQh5XW3.d.cts → instance-Dd1jQizG.d.cts} +19 -0
- package/dist/{instance-uUQh5XW3.d.ts → instance-Dd1jQizG.d.ts} +19 -0
- package/dist/nestjs.cjs +31 -2
- package/dist/nestjs.cjs.map +1 -1
- package/dist/nestjs.d.cts +10 -10
- package/dist/nestjs.d.ts +10 -10
- package/dist/nestjs.js +31 -2
- package/dist/nestjs.js.map +1 -1
- package/dist/plugins/audit.cjs.map +1 -1
- package/dist/plugins/audit.d.cts +3 -3
- package/dist/plugins/audit.d.ts +3 -3
- package/dist/plugins/audit.js.map +1 -1
- package/dist/plugins/metrics.cjs.map +1 -1
- package/dist/plugins/metrics.d.cts +2 -2
- package/dist/plugins/metrics.d.ts +2 -2
- package/dist/plugins/metrics.js.map +1 -1
- package/dist/plugins/notify.cjs.map +1 -1
- package/dist/plugins/notify.d.cts +4 -4
- package/dist/plugins/notify.d.ts +4 -4
- package/dist/plugins/notify.js.map +1 -1
- package/dist/plugins/resilience.cjs.map +1 -1
- package/dist/plugins/resilience.d.cts +5 -5
- package/dist/plugins/resilience.d.ts +5 -5
- package/dist/plugins/resilience.js.map +1 -1
- package/dist/plugins/scheduler.cjs.map +1 -1
- package/dist/plugins/scheduler.d.cts +2 -2
- package/dist/plugins/scheduler.d.ts +2 -2
- package/dist/plugins/scheduler.js.map +1 -1
- package/dist/plugins/tracing.d.cts +2 -2
- package/dist/plugins/tracing.d.ts +2 -2
- package/dist/plugins/webhook.cjs.map +1 -1
- package/dist/plugins/webhook.d.cts +4 -4
- package/dist/plugins/webhook.d.ts +4 -4
- package/dist/plugins/webhook.js.map +1 -1
- package/dist/testing.cjs +31 -2
- package/dist/testing.cjs.map +1 -1
- package/dist/testing.d.cts +10 -10
- package/dist/testing.d.ts +10 -10
- package/dist/testing.js +31 -2
- package/dist/testing.js.map +1 -1
- package/package.json +1 -1
- package/dist/Clock-3FnOczFJ.d.cts +0 -6
- package/dist/Clock-3FnOczFJ.d.ts +0 -6
package/dist/index.d.cts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
export { A as AddCommentOptions, a as ApprovalEngine, b as ApprovalEngineOptions, c as ApprovalStatistics, d as ApproveOptions, e as ApproverResolverFn, f as ApproverWorkload, B as BulkResult, g as BusinessCalendar, h as BusinessHoursCalendarOptions, C as CanApproveResult, i as CancelOptions, j as ChainExplanation, k as ConditionOperatorFn, l as CycleTimeStats, D as DelegateOptions, E as EscalateOptions, m as ExplainedLevel, n as ExplainedRule, o as ExplainedSkip, H as HealthResult, I as IdGeneratorFn, p as IdempotencyKeyFn, q as ImportResult, O as OrgProvider, r as OutOfOfficeProvider, s as OverrideOptions, P as PreviewChainLevel, t as PreviewResult, u as ProvideInfoOptions, v as PurgeResult, R as ReassignOptions, w as RejectOptions, x as RequestInfoOptions, y as ResubmitOptions, z as RetryPolicy, S as SimulatedDecision, F as SimulationResult, G as SimulationStep, J as SubmitOptions, T as TEMPLATE_BUNDLE_VERSION, K as TemplateBundle, L as TransferResult, U as UpdateDataOptions, V as ValidationResult, W as WeekendCalendarOptions, M as businessHoursCalendar, N as defaultIdGenerator, Q as toComparableNumber, X as validateConditionExpression, Y as weekendCalendar } from './ApprovalEngine-
|
|
2
|
-
import { I as IStorageAdapter } from './IStorageAdapter-
|
|
3
|
-
export { c as CursorPaginatedResult, C as CursorPaginationOpts, b as InstanceFilter, a as PaginatedResult, P as PaginationOpts } from './IStorageAdapter-
|
|
4
|
-
import { L as Logger } from './Logger-
|
|
5
|
-
export { n as noopLogger } from './Logger-
|
|
6
|
-
import { C as Clock } from './Clock-
|
|
7
|
-
export { s as systemClock } from './Clock-
|
|
8
|
-
export { A as AuthorizationContext, I as IAuthorizationPolicy } from './IAuthorizationPolicy-
|
|
9
|
-
export { A as ApprovalConflictError, a as ApprovalError, b as ApprovalForbiddenError, c as ApprovalNotFoundError, d as ApprovalTemplateNotFoundError, e as ApprovalValidationError, I as IOperationMiddleware, O as OperationContext } from './IOperationMiddleware-
|
|
1
|
+
export { A as AddCommentOptions, a as ApprovalEngine, b as ApprovalEngineOptions, c as ApprovalStatistics, d as ApproveOptions, e as ApproverResolverFn, f as ApproverWorkload, B as BulkResult, g as BusinessCalendar, h as BusinessHoursCalendarOptions, C as CanApproveResult, i as CancelOptions, j as ChainExplanation, k as ConditionOperatorFn, l as CycleTimeStats, D as DelegateOptions, E as EscalateOptions, m as ExplainedLevel, n as ExplainedRule, o as ExplainedSkip, H as HealthResult, I as IdGeneratorFn, p as IdempotencyKeyFn, q as ImportResult, O as OrgProvider, r as OutOfOfficeProvider, s as OverrideOptions, P as PreviewChainLevel, t as PreviewResult, u as ProvideInfoOptions, v as PurgeResult, R as ReassignOptions, w as RejectOptions, x as RequestInfoOptions, y as ResubmitOptions, z as RetryPolicy, S as SimulatedDecision, F as SimulationResult, G as SimulationStep, J as SubmitOptions, T as TEMPLATE_BUNDLE_VERSION, K as TemplateBundle, L as TransferResult, U as UpdateDataOptions, V as ValidationResult, W as WeekendCalendarOptions, M as businessHoursCalendar, N as defaultIdGenerator, Q as toComparableNumber, X as validateConditionExpression, Y as weekendCalendar } from './ApprovalEngine-Djdw-JzA.cjs';
|
|
2
|
+
import { I as IStorageAdapter } from './IStorageAdapter-D7cy20uD.cjs';
|
|
3
|
+
export { c as CursorPaginatedResult, C as CursorPaginationOpts, b as InstanceFilter, a as PaginatedResult, P as PaginationOpts } from './IStorageAdapter-D7cy20uD.cjs';
|
|
4
|
+
import { L as Logger } from './Logger-hqFbBCtB.cjs';
|
|
5
|
+
export { n as noopLogger } from './Logger-hqFbBCtB.cjs';
|
|
6
|
+
import { C as Clock } from './Clock-D8Qp39q_.cjs';
|
|
7
|
+
export { s as systemClock } from './Clock-D8Qp39q_.cjs';
|
|
8
|
+
export { A as AuthorizationContext, I as IAuthorizationPolicy } from './IAuthorizationPolicy-D6tTT3gv.cjs';
|
|
9
|
+
export { A as ApprovalConflictError, a as ApprovalError, b as ApprovalForbiddenError, c as ApprovalNotFoundError, d as ApprovalTemplateNotFoundError, e as ApprovalValidationError, I as IOperationMiddleware, O as OperationContext } from './IOperationMiddleware-D3Yelw9R.cjs';
|
|
10
10
|
export { MemoryAdapter } from './adapters/MemoryAdapter.cjs';
|
|
11
|
-
export { A as ApprovalEvent, a as ApprovalEventMap, b as ApprovalEventName, c as ApprovedEvent, d as AttachmentEvent, C as CancelledEvent, e as CommentedEvent, D as DataUpdatedEvent, f as DelegatedEvent, E as EscalatedEvent, g as ExpiredEvent, H as HistoryEntry, I as INotificationAdapter, h as InfoProvidedEvent, i as InfoRequestedEvent, L as LevelAdvancedEvent, N as NotificationEvent, O as OverriddenEvent, R as ReassignedEvent, j as RejectedEvent, k as ReminderEvent, l as ResubmittedEvent, S as SlaBreachedEvent, m as SubWorkflowEvent, n as SubmittedEvent } from './INotificationAdapter-
|
|
12
|
-
export { I as IAuditAdapter } from './IAuditAdapter-
|
|
13
|
-
export { I as IMetricsAdapter, M as MetricName } from './IMetricsAdapter-
|
|
11
|
+
export { A as ApprovalEvent, a as ApprovalEventMap, b as ApprovalEventName, c as ApprovedEvent, d as AttachmentEvent, C as CancelledEvent, e as CommentedEvent, D as DataUpdatedEvent, f as DelegatedEvent, E as EscalatedEvent, g as ExpiredEvent, H as HistoryEntry, I as INotificationAdapter, h as InfoProvidedEvent, i as InfoRequestedEvent, L as LevelAdvancedEvent, N as NotificationEvent, O as OverriddenEvent, R as ReassignedEvent, j as RejectedEvent, k as ReminderEvent, l as ResubmittedEvent, S as SlaBreachedEvent, m as SubWorkflowEvent, n as SubmittedEvent } from './INotificationAdapter-CBsJDk-Y.cjs';
|
|
12
|
+
export { I as IAuditAdapter } from './IAuditAdapter-TT2Xhtu6.cjs';
|
|
13
|
+
export { I as IMetricsAdapter, M as MetricName } from './IMetricsAdapter-WROxYSXd.cjs';
|
|
14
14
|
export { I as ISchedulerAdapter } from './ISchedulerAdapter-DKv_QjVN.cjs';
|
|
15
|
-
export { a as ApprovalInstance, c as ApprovalLevelConfig, d as ApprovalLevelInstance, e as ApprovalMode, f as ApprovalStatus, A as ApprovalTemplate, g as ApprovalTemplateConfig, h as ApproverConfig, i as Attachment, j as AuditAction, k as AuditContext, b as AuditEntry, C as Comment, l as Condition, m as ConditionExpression, n as ConditionGroup, o as ConditionOperator, p as ConditionRule, E as EscalationConfig, q as EscalationStep, I as InfoRequest, L as LevelStatus, R as ResolvedApprover, r as ResolverFn, S as SubWorkflowConfig, T as TemplateSnapshot } from './instance-
|
|
15
|
+
export { a as ApprovalInstance, c as ApprovalLevelConfig, d as ApprovalLevelInstance, e as ApprovalMode, f as ApprovalStatus, A as ApprovalTemplate, g as ApprovalTemplateConfig, h as ApproverConfig, i as Attachment, j as AuditAction, k as AuditContext, b as AuditEntry, C as Comment, l as Condition, m as ConditionExpression, n as ConditionGroup, o as ConditionOperator, p as ConditionRule, E as EscalationConfig, q as EscalationStep, I as InfoRequest, L as LevelStatus, R as ResolvedApprover, r as ResolverFn, S as SubWorkflowConfig, T as TemplateSnapshot } from './instance-Dd1jQizG.cjs';
|
|
16
16
|
import 'zod';
|
|
17
17
|
|
|
18
18
|
interface EscalationSchedulerOpts {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
export { A as AddCommentOptions, a as ApprovalEngine, b as ApprovalEngineOptions, c as ApprovalStatistics, d as ApproveOptions, e as ApproverResolverFn, f as ApproverWorkload, B as BulkResult, g as BusinessCalendar, h as BusinessHoursCalendarOptions, C as CanApproveResult, i as CancelOptions, j as ChainExplanation, k as ConditionOperatorFn, l as CycleTimeStats, D as DelegateOptions, E as EscalateOptions, m as ExplainedLevel, n as ExplainedRule, o as ExplainedSkip, H as HealthResult, I as IdGeneratorFn, p as IdempotencyKeyFn, q as ImportResult, O as OrgProvider, r as OutOfOfficeProvider, s as OverrideOptions, P as PreviewChainLevel, t as PreviewResult, u as ProvideInfoOptions, v as PurgeResult, R as ReassignOptions, w as RejectOptions, x as RequestInfoOptions, y as ResubmitOptions, z as RetryPolicy, S as SimulatedDecision, F as SimulationResult, G as SimulationStep, J as SubmitOptions, T as TEMPLATE_BUNDLE_VERSION, K as TemplateBundle, L as TransferResult, U as UpdateDataOptions, V as ValidationResult, W as WeekendCalendarOptions, M as businessHoursCalendar, N as defaultIdGenerator, Q as toComparableNumber, X as validateConditionExpression, Y as weekendCalendar } from './ApprovalEngine-
|
|
2
|
-
import { I as IStorageAdapter } from './IStorageAdapter-
|
|
3
|
-
export { c as CursorPaginatedResult, C as CursorPaginationOpts, b as InstanceFilter, a as PaginatedResult, P as PaginationOpts } from './IStorageAdapter-
|
|
4
|
-
import { L as Logger } from './Logger-
|
|
5
|
-
export { n as noopLogger } from './Logger-
|
|
6
|
-
import { C as Clock } from './Clock-
|
|
7
|
-
export { s as systemClock } from './Clock-
|
|
8
|
-
export { A as AuthorizationContext, I as IAuthorizationPolicy } from './IAuthorizationPolicy-
|
|
9
|
-
export { A as ApprovalConflictError, a as ApprovalError, b as ApprovalForbiddenError, c as ApprovalNotFoundError, d as ApprovalTemplateNotFoundError, e as ApprovalValidationError, I as IOperationMiddleware, O as OperationContext } from './IOperationMiddleware-
|
|
1
|
+
export { A as AddCommentOptions, a as ApprovalEngine, b as ApprovalEngineOptions, c as ApprovalStatistics, d as ApproveOptions, e as ApproverResolverFn, f as ApproverWorkload, B as BulkResult, g as BusinessCalendar, h as BusinessHoursCalendarOptions, C as CanApproveResult, i as CancelOptions, j as ChainExplanation, k as ConditionOperatorFn, l as CycleTimeStats, D as DelegateOptions, E as EscalateOptions, m as ExplainedLevel, n as ExplainedRule, o as ExplainedSkip, H as HealthResult, I as IdGeneratorFn, p as IdempotencyKeyFn, q as ImportResult, O as OrgProvider, r as OutOfOfficeProvider, s as OverrideOptions, P as PreviewChainLevel, t as PreviewResult, u as ProvideInfoOptions, v as PurgeResult, R as ReassignOptions, w as RejectOptions, x as RequestInfoOptions, y as ResubmitOptions, z as RetryPolicy, S as SimulatedDecision, F as SimulationResult, G as SimulationStep, J as SubmitOptions, T as TEMPLATE_BUNDLE_VERSION, K as TemplateBundle, L as TransferResult, U as UpdateDataOptions, V as ValidationResult, W as WeekendCalendarOptions, M as businessHoursCalendar, N as defaultIdGenerator, Q as toComparableNumber, X as validateConditionExpression, Y as weekendCalendar } from './ApprovalEngine-BtgQDr_8.js';
|
|
2
|
+
import { I as IStorageAdapter } from './IStorageAdapter-CVvNsnnD.js';
|
|
3
|
+
export { c as CursorPaginatedResult, C as CursorPaginationOpts, b as InstanceFilter, a as PaginatedResult, P as PaginationOpts } from './IStorageAdapter-CVvNsnnD.js';
|
|
4
|
+
import { L as Logger } from './Logger-hqFbBCtB.js';
|
|
5
|
+
export { n as noopLogger } from './Logger-hqFbBCtB.js';
|
|
6
|
+
import { C as Clock } from './Clock-D8Qp39q_.js';
|
|
7
|
+
export { s as systemClock } from './Clock-D8Qp39q_.js';
|
|
8
|
+
export { A as AuthorizationContext, I as IAuthorizationPolicy } from './IAuthorizationPolicy-wIE1mpTy.js';
|
|
9
|
+
export { A as ApprovalConflictError, a as ApprovalError, b as ApprovalForbiddenError, c as ApprovalNotFoundError, d as ApprovalTemplateNotFoundError, e as ApprovalValidationError, I as IOperationMiddleware, O as OperationContext } from './IOperationMiddleware-C7ciNnJp.js';
|
|
10
10
|
export { MemoryAdapter } from './adapters/MemoryAdapter.js';
|
|
11
|
-
export { A as ApprovalEvent, a as ApprovalEventMap, b as ApprovalEventName, c as ApprovedEvent, d as AttachmentEvent, C as CancelledEvent, e as CommentedEvent, D as DataUpdatedEvent, f as DelegatedEvent, E as EscalatedEvent, g as ExpiredEvent, H as HistoryEntry, I as INotificationAdapter, h as InfoProvidedEvent, i as InfoRequestedEvent, L as LevelAdvancedEvent, N as NotificationEvent, O as OverriddenEvent, R as ReassignedEvent, j as RejectedEvent, k as ReminderEvent, l as ResubmittedEvent, S as SlaBreachedEvent, m as SubWorkflowEvent, n as SubmittedEvent } from './INotificationAdapter-
|
|
12
|
-
export { I as IAuditAdapter } from './IAuditAdapter-
|
|
13
|
-
export { I as IMetricsAdapter, M as MetricName } from './IMetricsAdapter-
|
|
11
|
+
export { A as ApprovalEvent, a as ApprovalEventMap, b as ApprovalEventName, c as ApprovedEvent, d as AttachmentEvent, C as CancelledEvent, e as CommentedEvent, D as DataUpdatedEvent, f as DelegatedEvent, E as EscalatedEvent, g as ExpiredEvent, H as HistoryEntry, I as INotificationAdapter, h as InfoProvidedEvent, i as InfoRequestedEvent, L as LevelAdvancedEvent, N as NotificationEvent, O as OverriddenEvent, R as ReassignedEvent, j as RejectedEvent, k as ReminderEvent, l as ResubmittedEvent, S as SlaBreachedEvent, m as SubWorkflowEvent, n as SubmittedEvent } from './INotificationAdapter-BcUskJ6z.js';
|
|
12
|
+
export { I as IAuditAdapter } from './IAuditAdapter-C-04ar9A.js';
|
|
13
|
+
export { I as IMetricsAdapter, M as MetricName } from './IMetricsAdapter-WROxYSXd.js';
|
|
14
14
|
export { I as ISchedulerAdapter } from './ISchedulerAdapter-DKv_QjVN.js';
|
|
15
|
-
export { a as ApprovalInstance, c as ApprovalLevelConfig, d as ApprovalLevelInstance, e as ApprovalMode, f as ApprovalStatus, A as ApprovalTemplate, g as ApprovalTemplateConfig, h as ApproverConfig, i as Attachment, j as AuditAction, k as AuditContext, b as AuditEntry, C as Comment, l as Condition, m as ConditionExpression, n as ConditionGroup, o as ConditionOperator, p as ConditionRule, E as EscalationConfig, q as EscalationStep, I as InfoRequest, L as LevelStatus, R as ResolvedApprover, r as ResolverFn, S as SubWorkflowConfig, T as TemplateSnapshot } from './instance-
|
|
15
|
+
export { a as ApprovalInstance, c as ApprovalLevelConfig, d as ApprovalLevelInstance, e as ApprovalMode, f as ApprovalStatus, A as ApprovalTemplate, g as ApprovalTemplateConfig, h as ApproverConfig, i as Attachment, j as AuditAction, k as AuditContext, b as AuditEntry, C as Comment, l as Condition, m as ConditionExpression, n as ConditionGroup, o as ConditionOperator, p as ConditionRule, E as EscalationConfig, q as EscalationStep, I as InfoRequest, L as LevelStatus, R as ResolvedApprover, r as ResolverFn, S as SubWorkflowConfig, T as TemplateSnapshot } from './instance-Dd1jQizG.js';
|
|
16
16
|
import 'zod';
|
|
17
17
|
|
|
18
18
|
interface EscalationSchedulerOpts {
|
package/dist/index.js
CHANGED
|
@@ -550,6 +550,7 @@ var TemplateRegistry = class {
|
|
|
550
550
|
delete resolved.removeLevels;
|
|
551
551
|
return resolved;
|
|
552
552
|
}
|
|
553
|
+
/** Register a new template. Throws if a template with this name already exists for the tenant. */
|
|
553
554
|
async define(config) {
|
|
554
555
|
const existing = await this.adapter.getTemplate(this.tenantId, config.name);
|
|
555
556
|
if (existing) {
|
|
@@ -586,11 +587,13 @@ var TemplateRegistry = class {
|
|
|
586
587
|
await this.adapter.saveTemplate(updated);
|
|
587
588
|
return newId;
|
|
588
589
|
}
|
|
590
|
+
/** Fetch a template by name. Throws if no template with this name exists for the tenant. */
|
|
589
591
|
async get(name) {
|
|
590
592
|
const template = await this.adapter.getTemplate(this.tenantId, name);
|
|
591
593
|
if (!template) throw new ApprovalTemplateNotFoundError(name);
|
|
592
594
|
return template;
|
|
593
595
|
}
|
|
596
|
+
/** List every template registered for the tenant. */
|
|
594
597
|
async list() {
|
|
595
598
|
return this.adapter.listTemplates(this.tenantId);
|
|
596
599
|
}
|
|
@@ -630,6 +633,32 @@ var LevelResolver = class {
|
|
|
630
633
|
for (const [name, fn] of this.resolvers) target.register(name, fn);
|
|
631
634
|
for (const [name, fn] of this.approverTypes) target.registerApproverType(name, fn);
|
|
632
635
|
}
|
|
636
|
+
/**
|
|
637
|
+
* Resolve a level's `approvers` config down to a deduplicated list of user
|
|
638
|
+
* ids, applying out-of-office cover last so a substitute never sees a stale
|
|
639
|
+
* approver id.
|
|
640
|
+
*
|
|
641
|
+
* @param approvers - The level's approver configs (`user`, `role`,
|
|
642
|
+
* `dynamic`, or a custom type registered via {@link registerApproverType}).
|
|
643
|
+
* @param submittedBy - Passed through to `dynamic` resolvers and custom
|
|
644
|
+
* approver-type functions as routing context.
|
|
645
|
+
* @param data - The instance's document data, passed through the same way.
|
|
646
|
+
* @param orgProvider - Required to resolve `role` approvers; omit only when
|
|
647
|
+
* the template uses no `role` approvers.
|
|
648
|
+
* @param outOfOffice - Optional cover lookup, consulted after every other
|
|
649
|
+
* approver type has resolved.
|
|
650
|
+
* @param at - The moment out-of-office cover is resolved for. Defaults to
|
|
651
|
+
* now.
|
|
652
|
+
* @param substitutions - Filled with `original -> stand-in` for each
|
|
653
|
+
* approver replaced by out-of-office cover, so the caller can carry
|
|
654
|
+
* anything keyed by the original id (such as a weighted level's vote
|
|
655
|
+
* weight) across to the substitute.
|
|
656
|
+
* @returns The resolved, deduplicated approver ids (post-substitution).
|
|
657
|
+
* @throws {ApprovalValidationError} If no approvers resolve at all, a
|
|
658
|
+
* `role` approver is configured without an `orgProvider`, a `dynamic`
|
|
659
|
+
* approver names a resolver that was never registered, or a custom
|
|
660
|
+
* approver type was never registered.
|
|
661
|
+
*/
|
|
633
662
|
async resolveApprovers(approvers, submittedBy, data, orgProvider, outOfOffice, at, substitutions) {
|
|
634
663
|
const resolved = [];
|
|
635
664
|
for (const approver of approvers) {
|
|
@@ -1041,7 +1070,7 @@ function evaluateConditions(conditions, data) {
|
|
|
1041
1070
|
function assertStatus(instance, expected) {
|
|
1042
1071
|
if (instance.status !== expected) {
|
|
1043
1072
|
throw new ApprovalError(
|
|
1044
|
-
`
|
|
1073
|
+
`Instance "${instance.id}": expected status "${expected}" but got "${instance.status}".`,
|
|
1045
1074
|
"INVALID_STATUS"
|
|
1046
1075
|
);
|
|
1047
1076
|
}
|
|
@@ -1049,7 +1078,7 @@ function assertStatus(instance, expected) {
|
|
|
1049
1078
|
function assertApproverOnLevel(level, approverId) {
|
|
1050
1079
|
if (!level.approverIds.includes(approverId)) {
|
|
1051
1080
|
throw new ApprovalForbiddenError(
|
|
1052
|
-
`User "${approverId}" is not an approver for level ${level.level}.`
|
|
1081
|
+
`User "${approverId}" is not an approver for level ${level.level} ("${level.name}").`
|
|
1053
1082
|
);
|
|
1054
1083
|
}
|
|
1055
1084
|
}
|
|
@@ -5164,7 +5193,7 @@ function businessHoursCalendar(options = {}) {
|
|
|
5164
5193
|
return cursor;
|
|
5165
5194
|
}
|
|
5166
5195
|
throw new Error(
|
|
5167
|
-
|
|
5196
|
+
`businessHoursCalendar: no working day found within 10 years of ${from.toISOString()} \u2014 check weekendDays and holidays.`
|
|
5168
5197
|
);
|
|
5169
5198
|
};
|
|
5170
5199
|
const base = weekendCalendar(options);
|