hierarchical-approval 3.0.0 → 3.2.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 +45 -0
- package/dist/{ApprovalEngine-CCOwhMrs.d.ts → ApprovalEngine-Cslh4Goz.d.ts} +6 -6
- package/dist/{ApprovalEngine-Bfs5BnMm.d.cts → ApprovalEngine-zAgvH_aO.d.cts} +6 -6
- package/dist/{IAuditAdapter-DxdK4UVt.d.cts → IAuditAdapter-BkxGx6TI.d.cts} +1 -1
- package/dist/{IAuditAdapter-B33n15YP.d.ts → IAuditAdapter-udkAnnmu.d.ts} +1 -1
- package/dist/{IAuthorizationPolicy-BzGVzkLJ.d.cts → IAuthorizationPolicy-YQlSwj-8.d.cts} +1 -1
- package/dist/{IAuthorizationPolicy-DOm6KCwI.d.ts → IAuthorizationPolicy-Z4nkX-bu.d.ts} +1 -1
- package/dist/{INotificationAdapter-DMvA4R-c.d.ts → INotificationAdapter-C-PL3Pvp.d.ts} +1 -1
- package/dist/{INotificationAdapter-DFKvGpOp.d.cts → INotificationAdapter-D3PBQE1B.d.cts} +1 -1
- package/dist/{IOperationMiddleware-Nk8Q1Z8o.d.ts → IOperationMiddleware-Cbd05rje.d.ts} +1 -1
- package/dist/{IOperationMiddleware-C8i06wq4.d.cts → IOperationMiddleware-tgJcKzTP.d.cts} +1 -1
- package/dist/{IStorageAdapter-C2QxUwbX.d.ts → IStorageAdapter-CEKfu-U8.d.ts} +1 -1
- package/dist/{IStorageAdapter-C0qeZgs4.d.cts → IStorageAdapter-DUrmnJUs.d.cts} +1 -1
- package/dist/adapters/MemoryAdapter.cjs +3 -3
- package/dist/adapters/MemoryAdapter.cjs.map +1 -1
- package/dist/adapters/MemoryAdapter.d.cts +2 -2
- package/dist/adapters/MemoryAdapter.d.ts +2 -2
- package/dist/adapters/MemoryAdapter.js +3 -3
- package/dist/adapters/MemoryAdapter.js.map +1 -1
- package/dist/adapters/PostgresAdapter.cjs +18 -0
- 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 +18 -0
- package/dist/adapters/PostgresAdapter.js.map +1 -1
- package/dist/index.cjs +6 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -8
- package/dist/index.d.ts +8 -8
- package/dist/index.js +6 -3
- package/dist/index.js.map +1 -1
- package/dist/{instance-BvOyT00S.d.cts → instance-BXHxvTLE.d.cts} +10 -0
- package/dist/{instance-BvOyT00S.d.ts → instance-BXHxvTLE.d.ts} +10 -0
- package/dist/nestjs.cjs +6 -3
- package/dist/nestjs.cjs.map +1 -1
- package/dist/nestjs.d.cts +7 -7
- package/dist/nestjs.d.ts +7 -7
- package/dist/nestjs.js +6 -3
- 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/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 +6 -3
- package/dist/testing.cjs.map +1 -1
- package/dist/testing.d.cts +7 -7
- package/dist/testing.d.ts +7 -7
- package/dist/testing.js +6 -3
- package/dist/testing.js.map +1 -1
- package/package.json +1 -1
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-
|
|
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-zAgvH_aO.cjs';
|
|
2
|
+
import { I as IStorageAdapter } from './IStorageAdapter-DUrmnJUs.cjs';
|
|
3
|
+
export { c as CursorPaginatedResult, C as CursorPaginationOpts, b as InstanceFilter, a as PaginatedResult, P as PaginationOpts } from './IStorageAdapter-DUrmnJUs.cjs';
|
|
4
4
|
import { L as Logger } from './Logger-BplhlU7l.cjs';
|
|
5
5
|
export { n as noopLogger } from './Logger-BplhlU7l.cjs';
|
|
6
6
|
import { C as Clock } from './Clock-3FnOczFJ.cjs';
|
|
7
7
|
export { s as systemClock } from './Clock-3FnOczFJ.cjs';
|
|
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-
|
|
8
|
+
export { A as AuthorizationContext, I as IAuthorizationPolicy } from './IAuthorizationPolicy-YQlSwj-8.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-tgJcKzTP.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-
|
|
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-D3PBQE1B.cjs';
|
|
12
|
+
export { I as IAuditAdapter } from './IAuditAdapter-BkxGx6TI.cjs';
|
|
13
13
|
export { I as IMetricsAdapter, M as MetricName } from './IMetricsAdapter-DWq8IFaf.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-BXHxvTLE.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-
|
|
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-Cslh4Goz.js';
|
|
2
|
+
import { I as IStorageAdapter } from './IStorageAdapter-CEKfu-U8.js';
|
|
3
|
+
export { c as CursorPaginatedResult, C as CursorPaginationOpts, b as InstanceFilter, a as PaginatedResult, P as PaginationOpts } from './IStorageAdapter-CEKfu-U8.js';
|
|
4
4
|
import { L as Logger } from './Logger-BplhlU7l.js';
|
|
5
5
|
export { n as noopLogger } from './Logger-BplhlU7l.js';
|
|
6
6
|
import { C as Clock } from './Clock-3FnOczFJ.js';
|
|
7
7
|
export { s as systemClock } from './Clock-3FnOczFJ.js';
|
|
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-
|
|
8
|
+
export { A as AuthorizationContext, I as IAuthorizationPolicy } from './IAuthorizationPolicy-Z4nkX-bu.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-Cbd05rje.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-
|
|
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-C-PL3Pvp.js';
|
|
12
|
+
export { I as IAuditAdapter } from './IAuditAdapter-udkAnnmu.js';
|
|
13
13
|
export { I as IMetricsAdapter, M as MetricName } from './IMetricsAdapter-DWq8IFaf.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-BXHxvTLE.js';
|
|
16
16
|
import 'zod';
|
|
17
17
|
|
|
18
18
|
interface EscalationSchedulerOpts {
|
package/dist/index.js
CHANGED
|
@@ -194,6 +194,7 @@ function reviveDates(instance) {
|
|
|
194
194
|
if (l.escalationDueAt) level.escalationDueAt = new Date(l.escalationDueAt);
|
|
195
195
|
if (l.delegatedUntil) level.delegatedUntil = new Date(l.delegatedUntil);
|
|
196
196
|
if (l.reminderDueAt) level.reminderDueAt = new Date(l.reminderDueAt);
|
|
197
|
+
if (l.openedAt) level.openedAt = new Date(l.openedAt);
|
|
197
198
|
return level;
|
|
198
199
|
})
|
|
199
200
|
};
|
|
@@ -296,9 +297,8 @@ var MemoryAdapter = class {
|
|
|
296
297
|
}
|
|
297
298
|
async getOverdueInstances(tenantId, asOf, filter = {}) {
|
|
298
299
|
return [...this.instances.values()].filter((i) => {
|
|
299
|
-
if (i.tenantId !== tenantId
|
|
300
|
-
if (filter
|
|
301
|
-
if (filter.submittedBy && i.submittedBy !== filter.submittedBy) return false;
|
|
300
|
+
if (i.tenantId !== tenantId) return false;
|
|
301
|
+
if (!applyFilter(i, { ...filter, status: "pending" })) return false;
|
|
302
302
|
const hasOverdueEscalation = i.levels.some(
|
|
303
303
|
(l) => l.escalationDueAt != null && new Date(l.escalationDueAt) <= asOf
|
|
304
304
|
);
|
|
@@ -4064,6 +4064,7 @@ var ApprovalEngine = class _ApprovalEngine {
|
|
|
4064
4064
|
remindersSent: 0
|
|
4065
4065
|
};
|
|
4066
4066
|
if (opts.open) {
|
|
4067
|
+
level.openedAt = opts.now;
|
|
4067
4068
|
level.escalationDueAt = this.levelEscalationDue(opts.now, cfg, opts.firstRung);
|
|
4068
4069
|
this.scheduleReminder(level, opts.now);
|
|
4069
4070
|
}
|
|
@@ -4106,6 +4107,7 @@ var ApprovalEngine = class _ApprovalEngine {
|
|
|
4106
4107
|
* the ladder no worse off than the single-step behaviour it replaces.
|
|
4107
4108
|
*/
|
|
4108
4109
|
levelOpenedAt(instance, level, fallback) {
|
|
4110
|
+
if (level.openedAt) return new Date(level.openedAt);
|
|
4109
4111
|
for (let i = instance.auditLog.length - 1; i >= 0; i--) {
|
|
4110
4112
|
const entry = instance.auditLog[i];
|
|
4111
4113
|
if (!entry) continue;
|
|
@@ -4226,6 +4228,7 @@ var ApprovalEngine = class _ApprovalEngine {
|
|
|
4226
4228
|
now
|
|
4227
4229
|
);
|
|
4228
4230
|
}
|
|
4231
|
+
lvl.openedAt = now;
|
|
4229
4232
|
lvl.escalationDueAt = this.levelEscalationDue(now, lvl, firstRung);
|
|
4230
4233
|
lvl.escalationStep = 0;
|
|
4231
4234
|
this.scheduleReminder(lvl, now);
|