@rytass/bpm-core-nestjs-module 0.17.9 → 0.18.1

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.
Files changed (37) hide show
  1. package/CHANGELOG.md +68 -0
  2. package/README.md +29 -2
  3. package/package.json +2 -2
  4. package/src/lib/delegation/delegation.service.d.ts +41 -1
  5. package/src/lib/delegation/delegation.service.js +147 -23
  6. package/src/lib/delegation/delegation.service.js.map +1 -1
  7. package/src/lib/form/form-org-unit-value.validator.d.ts +21 -0
  8. package/src/lib/form/form-org-unit-value.validator.js +43 -0
  9. package/src/lib/form/form-org-unit-value.validator.js.map +1 -0
  10. package/src/lib/form/form-schema.validator.js +83 -6
  11. package/src/lib/form/form-schema.validator.js.map +1 -1
  12. package/src/lib/notification/notification.service.js +3 -1
  13. package/src/lib/notification/notification.service.js.map +1 -1
  14. package/src/lib/organization/dto/org-unit-option.object.d.ts +13 -0
  15. package/src/lib/organization/dto/org-unit-option.object.js +35 -0
  16. package/src/lib/organization/dto/org-unit-option.object.js.map +1 -0
  17. package/src/lib/organization/index.d.ts +2 -0
  18. package/src/lib/organization/index.js +2 -0
  19. package/src/lib/organization/index.js.map +1 -1
  20. package/src/lib/organization/organization-picker.queries.d.ts +17 -0
  21. package/src/lib/organization/organization-picker.queries.js +50 -0
  22. package/src/lib/organization/organization-picker.queries.js.map +1 -0
  23. package/src/lib/organization/organization.module.js +2 -0
  24. package/src/lib/organization/organization.module.js.map +1 -1
  25. package/src/lib/organization/organization.service.d.ts +17 -0
  26. package/src/lib/organization/organization.service.js +61 -0
  27. package/src/lib/organization/organization.service.js.map +1 -1
  28. package/src/lib/template/template.service.js +73 -4
  29. package/src/lib/template/template.service.js.map +1 -1
  30. package/src/lib/template/workflow-definition.validator.js +58 -8
  31. package/src/lib/template/workflow-definition.validator.js.map +1 -1
  32. package/src/lib/workflow-engine/text-field-pattern-test.d.ts +23 -0
  33. package/src/lib/workflow-engine/text-field-pattern-test.js +75 -0
  34. package/src/lib/workflow-engine/text-field-pattern-test.js.map +1 -0
  35. package/src/lib/workflow-engine/workflow-engine.service.d.ts +59 -0
  36. package/src/lib/workflow-engine/workflow-engine.service.js +386 -41
  37. package/src/lib/workflow-engine/workflow-engine.service.js.map +1 -1
package/CHANGELOG.md CHANGED
@@ -1,3 +1,71 @@
1
+ ## 0.18.1 (2026-11-01)
2
+
3
+ ### 🚀 Features
4
+
5
+ - add form-field and prior-node approver sources ([#132](https://github.com/Rytass/BPMCore/pull/132))
6
+
7
+ ### 🩹 Fixes
8
+
9
+ - **bpm-core-react:** fill timeline rows only from their own decision ([f336c1d](https://github.com/Rytass/BPMCore/commit/f336c1d))
10
+
11
+ ### ❤️ Thank You
12
+
13
+ - Chia Yu Pai @fantasywind
14
+ - Kai-Chieh Yang @coollugi
15
+
16
+ ## 0.18.0 (2026-10-28)
17
+
18
+ ### 🚀 Features
19
+
20
+ - **bpm-core-client:** check text field formats in a Web Worker ([a3c3d65](https://github.com/Rytass/BPMCore/commit/a3c3d65))
21
+ - **bpm-core-react:** name text length and format errors on the case pages ([074d4b9](https://github.com/Rytass/BPMCore/commit/074d4b9))
22
+ - ⚠️ **bpm-core:** enforce text length and format on submit and fill ([c8ec5b3](https://github.com/Rytass/BPMCore/commit/c8ec5b3))
23
+ - **bpm-core:** refuse text formats that cannot be checked ([88635de](https://github.com/Rytass/BPMCore/commit/88635de))
24
+ - ⚠️ **bpm-core:** refuse ANY returns outside the applicant and earlier user tasks ([e6d5af0](https://github.com/Rytass/BPMCore/commit/e6d5af0))
25
+
26
+ ### 🩹 Fixes
27
+
28
+ - **bpm-core:** ask the directory only about delegation rules in scope ([022304e](https://github.com/Rytass/BPMCore/commit/022304e))
29
+ - **bpm-core:** hold service-task text writes to the field's rules ([fcde1df](https://github.com/Rytass/BPMCore/commit/fcde1df))
30
+ - **bpm-core-react:** check formats off the main thread on the case pages ([58a1a9d](https://github.com/Rytass/BPMCore/commit/58a1a9d))
31
+ - **bpm-core:** keep the directory's error out of the delegation refusal ([14ccd0e](https://github.com/Rytass/BPMCore/commit/14ccd0e))
32
+ - **bpm-core:** refuse to dispatch when the delegation directory lookup fails ([8ef8a88](https://github.com/Rytass/BPMCore/commit/8ef8a88))
33
+ - **bpm-core:** stop waiting for a delegation directory lookup after 5 seconds ([c1473c6](https://github.com/Rytass/BPMCore/commit/c1473c6))
34
+ - **shared:** refuse a text pattern whose parentheses close the anchoring early ([330ef06](https://github.com/Rytass/BPMCore/commit/330ef06))
35
+ - **bpm-core:** check the type of a text field whose visibleWhen is false ([b256040](https://github.com/Rytass/BPMCore/commit/b256040))
36
+ - **bpm-core:** keep the task with the principal when the directory lookup fails ([aacccbe](https://github.com/Rytass/BPMCore/commit/aacccbe))
37
+ - **bpm-core:** refuse a table over its row limit before checking its rows ([d22afa7](https://github.com/Rytass/BPMCore/commit/d22afa7))
38
+ - **bpm-core:** charge only matching time to the pattern budget ([eddfb07](https://github.com/Rytass/BPMCore/commit/eddfb07))
39
+ - **bpm-core:** share one pattern time budget per validation pass ([8f81919](https://github.com/Rytass/BPMCore/commit/8f81919))
40
+ - **shared:** refuse every repeated group in a text field pattern ([d0daa77](https://github.com/Rytass/BPMCore/commit/d0daa77))
41
+ - **bpm-core:** run text field patterns under a time limit ([327d0a6](https://github.com/Rytass/BPMCore/commit/327d0a6))
42
+ - **bpm-core:** check the type of a hidden text field with rules ([1282eea](https://github.com/Rytass/BPMCore/commit/1282eea))
43
+ - **bpm-core:** refuse a format on a table column that is not text ([8308db8](https://github.com/Rytass/BPMCore/commit/8308db8))
44
+ - **shared:** refuse repeated alternations whose branches can start alike ([5e6e12e](https://github.com/Rytass/BPMCore/commit/5e6e12e))
45
+ - **bpm-core:** refuse nested text formats and formats on non-text fields ([471222c](https://github.com/Rytass/BPMCore/commit/471222c))
46
+ - **bpm-core:** refuse non-text values and leave approver-filled text to its fill step ([bad4656](https://github.com/Rytass/BPMCore/commit/bad4656))
47
+ - **shared:** keep a later stage that loops back out of the return targets ([86c2fd0](https://github.com/Rytass/BPMCore/commit/86c2fd0))
48
+ - **bpm-core:** skip delegation rules whose agent has been deactivated ([3434b25](https://github.com/Rytass/BPMCore/commit/3434b25))
49
+
50
+ ### 🔥 Performance
51
+
52
+ - **bpm-core:** create the pattern test's vm context on its first run ([cbc8633](https://github.com/Rytass/BPMCore/commit/cbc8633))
53
+ - **bpm-core:** ask the host directory once per node when resolving delegation ([cb62b00](https://github.com/Rytass/BPMCore/commit/cb62b00))
54
+
55
+ ### ⚠️ Breaking Changes
56
+
57
+ - **bpm-core:** enforce text length and format on submit and fill ([c8ec5b3](https://github.com/Rytass/BPMCore/commit/c8ec5b3))
58
+ a text value outside minLength / maxLength, or one that does
59
+ not match pattern, is refused with 400.
60
+ - **bpm-core:** refuse ANY returns outside the applicant and earlier user tasks ([e6d5af0](https://github.com/Rytass/BPMCore/commit/e6d5af0))
61
+ decideTask RETURN with allowedTargets ANY refuses a target
62
+ that is not the start event or a user task upstream of the returning node.
63
+
64
+ ### ❤️ Thank You
65
+
66
+ - Chia Yu Pai @fantasywind
67
+ - Kai-Chieh Yang
68
+
1
69
  ## 0.17.9 (2026-10-27)
2
70
 
3
71
  ### 🚀 Features
package/README.md CHANGED
@@ -701,8 +701,9 @@ export interface BPMMemberResolver {
701
701
  resolveMany(memberIds: readonly string[]): Promise<ReadonlyMap<string, MemberMetadata>>;
702
702
  search?(searchText: string): Promise<readonly MemberMetadata[]>;
703
703
  // Of memberIds, the members the host has deactivated. Backs
704
- // inactiveMembersWithOpenTasks; on a member-base directory, implement
705
- // resolveInactiveMembers instead.
704
+ // inactiveMembersWithOpenTasks and lets delegation skip a deactivated
705
+ // agent; on a member-base directory, implement resolveInactiveMembers
706
+ // instead. Once implemented, dispatch depends on it: see Delegation Rules.
706
707
  resolveInactive?(memberIds: readonly string[]): Promise<readonly MemberMetadata[]>;
707
708
  }
708
709
  ```
@@ -1689,6 +1690,32 @@ A rule's condition may read only these roots: `env`, `form`, `formData`,
1689
1690
  Saving a rule with any other root is refused. Rules saved before that check was
1690
1691
  added are not changed. They still fail when evaluated.
1691
1692
 
1693
+ > Unreleased (PR #127): deactivated agents.
1694
+
1695
+ A rule whose agent the host reports as deactivated is skipped: the next rule of
1696
+ the principal applies, and when none is left the principal keeps the task. In a
1697
+ chain A → B → C where C is deactivated, the task stops at B. BPM asks the
1698
+ optional `resolveInactive` on the member resolver (`resolveInactiveMembers` on a
1699
+ member-base directory) about the agents of the rules whose scope applies to the
1700
+ case — once per node for the first hop of every candidate's chain, and once per
1701
+ further hop that has such a rule. A rule out of scope is never looked up, so a
1702
+ principal none of whose rules apply is never held up by the directory. Every
1703
+ scope is evaluated first; a scope condition that fails to evaluate fails the
1704
+ dispatch only when its rule is the one that would apply. Tasks already assigned
1705
+ to a deactivated agent are not taken back. Without `resolveInactive`, or without
1706
+ the identity module, delegation behaves as before.
1707
+
1708
+ Once a host implements it, dispatch depends on it. When `resolveInactive`
1709
+ throws, or has not answered within 5 seconds, the launch, advance or
1710
+ next-candidate step that needed it fails with a `ServiceUnavailableException`
1711
+ (503) naming the member directory lookup, and its transaction rolls back. The
1712
+ agent ids and the host's own error go to the server log only, never to the
1713
+ caller, since a host error can carry internal details such as the directory's
1714
+ address. A task is never handed to an agent who could not be
1715
+ confirmed active, nor silently left with the principal. Keep the lookup
1716
+ available: during a directory outage, no case can be dispatched to a node where
1717
+ someone has a delegation rule that applies to it.
1718
+
1692
1719
  ## GraphQL Surface
1693
1720
 
1694
1721
  Importing `BPMRootModule` registers GraphQL resolvers for:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rytass/bpm-core-nestjs-module",
3
- "version": "0.17.9",
3
+ "version": "0.18.1",
4
4
  "description": "Embeddable NestJS BPM approval workflow module: workflow engine, approval templates, forms, organization/member contracts, attachments, signatures, notifications, delegation, and TypeORM migrations.",
5
5
  "keywords": [
6
6
  "bpm",
@@ -162,7 +162,7 @@
162
162
  "@nestjs/core": ">=10.0.0",
163
163
  "@nestjs/graphql": ">=12.0.0",
164
164
  "@nestjs/typeorm": ">=10.0.0",
165
- "@rytass/bpm-core-shared": "^0.17.9",
165
+ "@rytass/bpm-core-shared": "^0.18.1",
166
166
  "@rytass/secret-adapter-vault-nestjs": ">=0.4.5",
167
167
  "express": ">=4.0.0",
168
168
  "graphql": ">=16.0.0",
@@ -1,3 +1,4 @@
1
+ import { ModuleRef } from '@nestjs/core';
1
2
  import { Repository } from 'typeorm';
2
3
  import { ConditionService } from '../condition/condition.service';
3
4
  import { CreateDelegationRuleInput, UpdateDelegationRuleInput } from './dto/delegation-rule.input';
@@ -40,7 +41,9 @@ interface ListDelegationRulesOptions {
40
41
  export declare class DelegationService {
41
42
  private readonly delegationRuleRepository;
42
43
  private readonly conditionService;
43
- constructor(delegationRuleRepository: Repository<DelegationRuleEntity>, conditionService: ConditionService);
44
+ private readonly moduleRef?;
45
+ private readonly logger;
46
+ constructor(delegationRuleRepository: Repository<DelegationRuleEntity>, conditionService: ConditionService, moduleRef?: ModuleRef | undefined);
44
47
  listDelegationRules(options?: ListDelegationRulesOptions): Promise<readonly DelegationRuleEntity[]>;
45
48
  countDelegationRules(options?: Pick<ListDelegationRulesOptions, 'agentMemberId' | 'includeInactive' | 'principalMemberId' | 'scopeType' | 'status'>): Promise<number>;
46
49
  createDelegationRule(input: CreateDelegationRuleInput): Promise<DelegationRuleEntity>;
@@ -51,7 +54,44 @@ export declare class DelegationService {
51
54
  readonly revokedByMemberId?: string | null;
52
55
  }): Promise<DelegationRuleEntity>;
53
56
  resolveAssignee(originalAssigneeMemberId: string, context: DelegationResolutionContext, at?: Date): Promise<DelegationResolution>;
57
+ /**
58
+ * {@link resolveAssignee} for every member of `originalAssigneeMemberIds`,
59
+ * in the same order. The first hop of every chain shares one
60
+ * `resolveInactive` call, so a node with many candidates asks the host
61
+ * directory once rather than once per candidate; only a hop beyond the
62
+ * first asks again.
63
+ */
64
+ resolveAssignees(originalAssigneeMemberIds: readonly string[], context: DelegationResolutionContext, at?: Date): Promise<readonly DelegationResolution[]>;
54
65
  private walkDelegationChain;
66
+ /**
67
+ * The principal's rules in force at `at` that can apply in `context`, the
68
+ * applicable one first. Every scope is evaluated up front so the directory is
69
+ * asked only about agents that matter: a principal whose rules are all out
70
+ * of scope never waits on, or is refused by, the host directory.
71
+ */
72
+ private readScopedRules;
73
+ /** The principal's rules in force at `at`, the applicable one first. */
74
+ private readCurrentRules;
75
+ /**
76
+ * Agents of `rules` the host reports as deactivated. Empty when there is no
77
+ * rule to check, or no identity module (or no `resolveInactive` on the host
78
+ * resolver): delegation then behaves as it did before this check existed.
79
+ *
80
+ * When the host directory fails to answer, or has not answered within
81
+ * {@link DIRECTORY_LOOKUP_TIMEOUT_MS}, the dispatch is refused with a
82
+ * `ServiceUnavailableException` that names the directory lookup (the agent
83
+ * ids and the host's error go to the server log only): a task is
84
+ * never handed to an agent who could not be confirmed active, nor quietly
85
+ * left with a principal whose rule says it should move. The launch or
86
+ * advance that needed it rolls back and can be retried.
87
+ */
88
+ private readInactiveAgentIds;
89
+ /**
90
+ * Looked up at call time rather than injected: `IdentityModule` is a dynamic
91
+ * module the root configures with the host's options, so this module cannot
92
+ * import it (same as `WorkflowEngineQueries.readIdentityService`).
93
+ */
94
+ private readIdentityService;
55
95
  private matchesRuleScope;
56
96
  private assertNoActiveCycle;
57
97
  private readRuleOrThrow;
@@ -1,17 +1,39 @@
1
1
  "use strict";
2
+ var DelegationService_1;
2
3
  Object.defineProperty(exports, "__esModule", { value: true });
3
4
  exports.DelegationService = void 0;
4
5
  const tslib_1 = require("tslib");
5
6
  const common_1 = require("@nestjs/common");
7
+ const core_1 = require("@nestjs/core");
8
+ const unknown_element_exception_js_1 = require("@nestjs/core/errors/exceptions/unknown-element.exception.js");
6
9
  const typeorm_1 = require("@nestjs/typeorm");
7
10
  const typeorm_2 = require("typeorm");
8
11
  const condition_service_1 = require("../condition/condition.service");
12
+ const identity_service_1 = require("../identity/identity.service");
9
13
  const delegation_rule_entity_1 = require("./delegation-rule.entity");
10
14
  const delegation_enums_1 = require("./delegation.enums");
11
- let DelegationService = class DelegationService {
12
- constructor(delegationRuleRepository, conditionService) {
15
+ /**
16
+ * How long a delegation waits for the host's `resolveInactive`. Resolution runs
17
+ * inside a launch or advance transaction, so a directory that hangs must not
18
+ * hold its connection and locks: past this it counts as a failed lookup.
19
+ */
20
+ const DIRECTORY_LOOKUP_TIMEOUT_MS = 5_000;
21
+ /** `pending`, or a rejection once `timeoutMs` has passed without an answer. */
22
+ function readWithinTime(pending, timeoutMs) {
23
+ let timeoutId;
24
+ return Promise.race([
25
+ pending,
26
+ new Promise((_resolve, reject) => {
27
+ timeoutId = setTimeout(() => reject(new Error(`no answer within ${timeoutMs} ms`)), timeoutMs);
28
+ }),
29
+ ]).finally(() => clearTimeout(timeoutId));
30
+ }
31
+ let DelegationService = DelegationService_1 = class DelegationService {
32
+ constructor(delegationRuleRepository, conditionService, moduleRef) {
13
33
  this.delegationRuleRepository = delegationRuleRepository;
14
34
  this.conditionService = conditionService;
35
+ this.moduleRef = moduleRef;
36
+ this.logger = new common_1.Logger(DelegationService_1.name);
15
37
  }
16
38
  async listDelegationRules(options = {}) {
17
39
  const isPaginated = typeof options.page === 'number' || typeof options.pageSize === 'number';
@@ -77,26 +99,35 @@ let DelegationService = class DelegationService {
77
99
  }));
78
100
  }
79
101
  async resolveAssignee(originalAssigneeMemberId, context, at = new Date()) {
80
- return this.walkDelegationChain(originalAssigneeMemberId, context, at, new Set([originalAssigneeMemberId]), []);
102
+ const [resolution] = await this.resolveAssignees([originalAssigneeMemberId], context, at);
103
+ return resolution;
81
104
  }
82
- async walkDelegationChain(principalMemberId, context, at, visitedMemberIds, chain) {
83
- const applicableRule = (await this.delegationRuleRepository.find({
84
- // Higher priority wins, as with manager rules; among equal priorities
85
- // the rule created first wins. TypeORM sorts by key order, so
86
- // `priority` has to be the first key — it used to come second and
87
- // only broke ties between rules created in the same instant.
88
- order: {
89
- priority: 'DESC',
90
- createdAt: 'ASC',
91
- },
92
- where: {
93
- principalMemberId,
94
- startAt: (0, typeorm_2.LessThanOrEqual)(at),
95
- status: delegation_enums_1.DelegationRuleStatusEnum.ACTIVE,
96
- },
97
- }))
98
- .filter((rule) => !rule.endAt || rule.endAt.getTime() > at.getTime())
99
- .find((rule) => this.matchesRuleScope(rule, context));
105
+ /**
106
+ * {@link resolveAssignee} for every member of `originalAssigneeMemberIds`,
107
+ * in the same order. The first hop of every chain shares one
108
+ * `resolveInactive` call, so a node with many candidates asks the host
109
+ * directory once rather than once per candidate; only a hop beyond the
110
+ * first asks again.
111
+ */
112
+ async resolveAssignees(originalAssigneeMemberIds, context, at = new Date()) {
113
+ const rulesByPrincipal = await Promise.all(originalAssigneeMemberIds.map((memberId) => this.readScopedRules(memberId, context, at)));
114
+ const inactiveAgentIds = await this.readInactiveAgentIds(rulesByPrincipal.flat().map(({ rule }) => rule));
115
+ return Promise.all(originalAssigneeMemberIds.map((memberId, index) => this.walkDelegationChain(memberId, context, at, new Set([memberId]), [], { inactiveAgentIds, rules: rulesByPrincipal[index] })));
116
+ }
117
+ async walkDelegationChain(principalMemberId, context, at, visitedMemberIds, chain, preloadedHop) {
118
+ const currentRules = preloadedHop?.rules ??
119
+ (await this.readScopedRules(principalMemberId, context, at));
120
+ const inactiveAgentIds = preloadedHop?.inactiveAgentIds ??
121
+ (await this.readInactiveAgentIds(currentRules.map(({ rule }) => rule)));
122
+ // A rule whose agent the host has deactivated no longer applies: handing
123
+ // the task to them would leave it with someone who can no longer sign in.
124
+ const applicable = currentRules.find(({ rule }) => !inactiveAgentIds.has(rule.agentMemberId));
125
+ // A scope condition that failed to evaluate fails the walk only when its
126
+ // rule is the one that would apply, as when scopes were evaluated in turn.
127
+ if (applicable?.scopeError) {
128
+ throw applicable.scopeError.error;
129
+ }
130
+ const applicableRule = applicable?.rule;
100
131
  if (!applicableRule) {
101
132
  return {
102
133
  delegationChain: chain,
@@ -117,6 +148,97 @@ let DelegationService = class DelegationService {
117
148
  ];
118
149
  return this.walkDelegationChain(applicableRule.agentMemberId, context, at, new Set(visitedMemberIds).add(applicableRule.agentMemberId), nextChain);
119
150
  }
151
+ /**
152
+ * The principal's rules in force at `at` that can apply in `context`, the
153
+ * applicable one first. Every scope is evaluated up front so the directory is
154
+ * asked only about agents that matter: a principal whose rules are all out
155
+ * of scope never waits on, or is refused by, the host directory.
156
+ */
157
+ async readScopedRules(principalMemberId, context, at) {
158
+ const rules = await this.readCurrentRules(principalMemberId, at);
159
+ return rules.flatMap((rule) => {
160
+ try {
161
+ return this.matchesRuleScope(rule, context)
162
+ ? [{ rule, scopeError: null }]
163
+ : [];
164
+ }
165
+ catch (error) {
166
+ return [{ rule, scopeError: { error } }];
167
+ }
168
+ });
169
+ }
170
+ /** The principal's rules in force at `at`, the applicable one first. */
171
+ async readCurrentRules(principalMemberId, at) {
172
+ return (await this.delegationRuleRepository.find({
173
+ // Higher priority wins, as with manager rules; among equal priorities
174
+ // the rule created first wins. TypeORM sorts by key order, so
175
+ // `priority` has to be the first key — it used to come second and
176
+ // only broke ties between rules created in the same instant.
177
+ order: {
178
+ priority: 'DESC',
179
+ createdAt: 'ASC',
180
+ },
181
+ where: {
182
+ principalMemberId,
183
+ startAt: (0, typeorm_2.LessThanOrEqual)(at),
184
+ status: delegation_enums_1.DelegationRuleStatusEnum.ACTIVE,
185
+ },
186
+ })).filter((rule) => !rule.endAt || rule.endAt.getTime() > at.getTime());
187
+ }
188
+ /**
189
+ * Agents of `rules` the host reports as deactivated. Empty when there is no
190
+ * rule to check, or no identity module (or no `resolveInactive` on the host
191
+ * resolver): delegation then behaves as it did before this check existed.
192
+ *
193
+ * When the host directory fails to answer, or has not answered within
194
+ * {@link DIRECTORY_LOOKUP_TIMEOUT_MS}, the dispatch is refused with a
195
+ * `ServiceUnavailableException` that names the directory lookup (the agent
196
+ * ids and the host's error go to the server log only): a task is
197
+ * never handed to an agent who could not be confirmed active, nor quietly
198
+ * left with a principal whose rule says it should move. The launch or
199
+ * advance that needed it rolls back and can be retried.
200
+ */
201
+ async readInactiveAgentIds(rules) {
202
+ const identityService = rules.length ? this.readIdentityService() : null;
203
+ if (!identityService) {
204
+ return new Set();
205
+ }
206
+ const agentMemberIds = [
207
+ ...new Set(rules.map((rule) => rule.agentMemberId)),
208
+ ];
209
+ return readWithinTime(identityService.resolveInactiveMembers(agentMemberIds), DIRECTORY_LOOKUP_TIMEOUT_MS).then((inactiveMembers) => new Set(inactiveMembers.map((member) => member.memberId)), (error) => {
210
+ // The host's error and the agent ids stay in the server log: the
211
+ // caller is whoever submitted or approved, and the host's message can
212
+ // carry internal details such as the directory's address.
213
+ this.logger.error(`Member directory lookup (resolveInactive) failed for delegation ` +
214
+ `agents ${agentMemberIds.join(', ')}; nothing was dispatched: ` +
215
+ `${error instanceof Error ? error.message : String(error)}`);
216
+ throw new common_1.ServiceUnavailableException('The member directory lookup (resolveInactive) failed, so it is ' +
217
+ 'not known whether the delegation agents are still active; ' +
218
+ 'nothing was dispatched. Retry once the directory is reachable.', { cause: error });
219
+ });
220
+ }
221
+ /**
222
+ * Looked up at call time rather than injected: `IdentityModule` is a dynamic
223
+ * module the root configures with the host's options, so this module cannot
224
+ * import it (same as `WorkflowEngineQueries.readIdentityService`).
225
+ */
226
+ readIdentityService() {
227
+ if (!this.moduleRef) {
228
+ return null;
229
+ }
230
+ try {
231
+ return this.moduleRef.get(identity_service_1.IdentityService, { strict: false });
232
+ }
233
+ catch (error) {
234
+ // Only "not registered" means no identity module; anything else is a
235
+ // real failure and must not pass for "no deactivated agent".
236
+ if (error instanceof unknown_element_exception_js_1.UnknownElementException) {
237
+ return null;
238
+ }
239
+ throw error;
240
+ }
241
+ }
120
242
  matchesRuleScope(rule, context) {
121
243
  if (rule.scopeType === delegation_enums_1.DelegationScopeTypeEnum.ALL) {
122
244
  return true;
@@ -206,11 +328,13 @@ let DelegationService = class DelegationService {
206
328
  }
207
329
  };
208
330
  exports.DelegationService = DelegationService;
209
- exports.DelegationService = DelegationService = tslib_1.__decorate([
331
+ exports.DelegationService = DelegationService = DelegationService_1 = tslib_1.__decorate([
210
332
  (0, common_1.Injectable)(),
211
333
  tslib_1.__param(0, (0, typeorm_1.InjectRepository)(delegation_rule_entity_1.DelegationRuleEntity)),
334
+ tslib_1.__param(2, (0, common_1.Optional)()),
212
335
  tslib_1.__metadata("design:paramtypes", [typeorm_2.Repository,
213
- condition_service_1.ConditionService])
336
+ condition_service_1.ConditionService,
337
+ core_1.ModuleRef])
214
338
  ], DelegationService);
215
339
  // The only roots a delegation condition can read. Saving a rule checks its CEL
216
340
  // against this list, and the context below is typed by it, so the two cannot
@@ -1 +1 @@
1
- {"version":3,"file":"delegation.service.js","sourceRoot":"","sources":["../../../../../../libs/bpm-core/src/lib/delegation/delegation.service.ts"],"names":[],"mappings":";;;;AAAA,2CAKwB;AACxB,6CAAmD;AACnD,qCAAwE;AACxE,sEAAkE;AAKlE,qEAAgE;AAChE,yDAG4B;AAyCrB,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAC5B,YAEmB,wBAA0D,EAC1D,gBAAkC;QADlC,6BAAwB,GAAxB,wBAAwB,CAAkC;QAC1D,qBAAgB,GAAhB,gBAAgB,CAAkB;IAClD,CAAC;IAEJ,KAAK,CAAC,mBAAmB,CACvB,UAAsC,EAAE;QAExC,MAAM,WAAW,GACf,OAAO,OAAO,CAAC,IAAI,KAAK,QAAQ,IAAI,OAAO,OAAO,CAAC,QAAQ,KAAK,QAAQ,CAAC;QAC3E,MAAM,kBAAkB,GAAG,WAAW;YACpC,CAAC,CAAC,iBAAiB,CAAC,OAAO,CAAC,QAAQ,IAAI,EAAE,CAAC;YAC3C,CAAC,CAAC,SAAS,CAAC;QAEd,OAAO,IAAI,CAAC,wBAAwB,CAAC,IAAI,CAAC;YACxC,oEAAoE;YACpE,KAAK,EAAE;gBACL,QAAQ,EAAE,MAAM;gBAChB,SAAS,EAAE,MAAM;aAClB;YACD,GAAG,CAAC,kBAAkB;gBACpB,CAAC,CAAC;oBACE,IAAI,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AM,EAAE;YACZ,CAAC,CAAC,eAAe;gBACf,CAAC,CAAC,EAAE;gBACJ,CAAC,CAAC,EAAE,MAAM,EAAE,2CAAwB,CAAC,MAAM,EAAE,CAAC;KACnD,CAAC;AACJ,CAAC;AAED,SAAS,aAAa,CAAC,IAAY;IACjC,OAAO,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AACvD,CAAC;AAED,SAAS,iBAAiB,CAAC,QAAgB;IACzC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,QAAQ,IAAI,CAAC,EAAE,CAAC;QACjD,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,OAAO,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;AACjC,CAAC"}
1
+ {"version":3,"file":"delegation.service.js","sourceRoot":"","sources":["../../../../../../libs/bpm-core/src/lib/delegation/delegation.service.ts"],"names":[],"mappings":";;;;;AAAA,2CAQwB;AACxB,uCAAyC;AACzC,8GAAsG;AACtG,6CAAmD;AACnD,qCAAwE;AACxE,sEAAkE;AAClE,mEAA+D;AAK/D,qEAAgE;AAChE,yDAG4B;AA8B5B;;;;GAIG;AACH,MAAM,2BAA2B,GAAG,KAAK,CAAC;AAE1C,+EAA+E;AAC/E,SAAS,cAAc,CACrB,OAAwB,EACxB,SAAiB;IAEjB,IAAI,SAAoD,CAAC;IAEzD,OAAO,OAAO,CAAC,IAAI,CAAC;QAClB,OAAO;QACP,IAAI,OAAO,CAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE;YACtC,SAAS,GAAG,UAAU,CACpB,GAAS,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,oBAAoB,SAAS,KAAK,CAAC,CAAC,EACjE,SAAS,CACV,CAAC;QACJ,CAAC,CAAC;KACH,CAAC,CAAC,OAAO,CAAC,GAAS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E,CAAC;QACjD,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,OAAO,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;AACjC,CAAC"}
@@ -0,0 +1,21 @@
1
+ import { FormFieldDefinition } from '@rytass/bpm-core-shared/form';
2
+ /**
3
+ * Whether `value` is a unit id the engine can use: a non-blank string that is
4
+ * a uuid (trimmed, as the engine does before its lookup). The one predicate
5
+ * behind the submit check and the schema's default-value check.
6
+ */
7
+ export declare function isSubmittableOrgUnitValue(value: unknown): boolean;
8
+ /**
9
+ * Shape errors for the org_unit fields among `fields` (the ones the caller is
10
+ * about to accept). An org unit value is one organization unit id: a non-blank
11
+ * string that is a uuid — the same rule the engine applies before it looks the
12
+ * unit up for a `FORM_ORG_UNIT_MANAGER` node, so a bad value is refused here
13
+ * instead of surfacing as a database error when the node starts.
14
+ *
15
+ * Absent / `null` is "no value" and is left to the required check. Whether the
16
+ * unit exists is deliberately not looked up: the organization directory is the
17
+ * host's, and a unit that stops resolving is a resolver-time concern.
18
+ *
19
+ * Internal helper, not exported from the package index.
20
+ */
21
+ export declare function readSubmittedOrgUnitValueErrors(fields: readonly FormFieldDefinition[], formData: Readonly<Record<string, unknown>>): readonly string[];
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isSubmittableOrgUnitValue = isSubmittableOrgUnitValue;
4
+ exports.readSubmittedOrgUnitValueErrors = readSubmittedOrgUnitValueErrors;
5
+ const class_validator_1 = require("class-validator");
6
+ const form_1 = require("@rytass/bpm-core-shared/form");
7
+ /**
8
+ * Whether `value` is a unit id the engine can use: a non-blank string that is
9
+ * a uuid (trimmed, as the engine does before its lookup). The one predicate
10
+ * behind the submit check and the schema's default-value check.
11
+ */
12
+ function isSubmittableOrgUnitValue(value) {
13
+ return (typeof value === 'string' &&
14
+ (0, form_1.isFormOrgUnitValue)(value) &&
15
+ (0, class_validator_1.isUUID)(value.trim()));
16
+ }
17
+ /**
18
+ * Shape errors for the org_unit fields among `fields` (the ones the caller is
19
+ * about to accept). An org unit value is one organization unit id: a non-blank
20
+ * string that is a uuid — the same rule the engine applies before it looks the
21
+ * unit up for a `FORM_ORG_UNIT_MANAGER` node, so a bad value is refused here
22
+ * instead of surfacing as a database error when the node starts.
23
+ *
24
+ * Absent / `null` is "no value" and is left to the required check. Whether the
25
+ * unit exists is deliberately not looked up: the organization directory is the
26
+ * host's, and a unit that stops resolving is a resolver-time concern.
27
+ *
28
+ * Internal helper, not exported from the package index.
29
+ */
30
+ function readSubmittedOrgUnitValueErrors(fields, formData) {
31
+ return fields.filter(form_1.isOrgUnitFieldDefinition).flatMap((field) => {
32
+ const value = Object.prototype.hasOwnProperty.call(formData, field.fieldKey)
33
+ ? formData[field.fieldKey]
34
+ : undefined;
35
+ if (typeof value === 'undefined' || value === null) {
36
+ return [];
37
+ }
38
+ return isSubmittableOrgUnitValue(value)
39
+ ? []
40
+ : [`formData.${field.fieldKey} must be an organization unit id`];
41
+ });
42
+ }
43
+ //# sourceMappingURL=form-org-unit-value.validator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form-org-unit-value.validator.js","sourceRoot":"","sources":["../../../../../../libs/bpm-core/src/lib/form/form-org-unit-value.validator.ts"],"names":[],"mappings":";;AAYA,8DAMC;AAeD,0EAiBC;AAlDD,qDAAyC;AACzC,uDAIsC;AAEtC;;;;GAIG;AACH,SAAgB,yBAAyB,CAAC,KAAc;IACtD,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,IAAA,yBAAkB,EAAC,KAAK,CAAC;QACzB,IAAA,wBAAM,EAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CACrB,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,SAAgB,+BAA+B,CAC7C,MAAsC,EACtC,QAA2C;IAE3C,OAAO,MAAM,CAAC,MAAM,CAAC,+BAAwB,CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;QAC/D,MAAM,KAAK,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC;YAC1E,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC;YAC1B,CAAC,CAAC,SAAS,CAAC;QAEd,IAAI,OAAO,KAAK,KAAK,WAAW,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;YACnD,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,OAAO,yBAAyB,CAAC,KAAK,CAAC;YACrC,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC,CAAC,YAAY,KAAK,CAAC,QAAQ,kCAAkC,CAAC,CAAC;IACrE,CAAC,CAAC,CAAC;AACL,CAAC"}