@rytass/bpm-core-nestjs-module 0.6.0 → 0.9.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.
Files changed (126) hide show
  1. package/CHANGELOG.md +133 -0
  2. package/README.md +60 -1
  3. package/package.json +17 -3
  4. package/src/index.d.ts +2 -0
  5. package/src/index.js +2 -0
  6. package/src/index.js.map +1 -1
  7. package/src/lib/bpm/bpm-root.module.d.ts +33 -0
  8. package/src/lib/bpm/bpm-root.module.js +20 -0
  9. package/src/lib/bpm/bpm-root.module.js.map +1 -1
  10. package/src/lib/calendar/business-calendar.provider.d.ts +11 -0
  11. package/src/lib/calendar/business-calendar.provider.js +20 -0
  12. package/src/lib/calendar/business-calendar.provider.js.map +1 -0
  13. package/src/lib/calendar/business-calendar.token.d.ts +38 -0
  14. package/src/lib/calendar/business-calendar.token.js +5 -0
  15. package/src/lib/calendar/business-calendar.token.js.map +1 -0
  16. package/src/lib/calendar/calendar.module.d.ts +22 -0
  17. package/src/lib/calendar/calendar.module.js +33 -0
  18. package/src/lib/calendar/calendar.module.js.map +1 -0
  19. package/src/lib/calendar/index.d.ts +5 -0
  20. package/src/lib/calendar/index.js +9 -0
  21. package/src/lib/calendar/index.js.map +1 -0
  22. package/src/lib/calendar/sla-schedule.service.d.ts +33 -0
  23. package/src/lib/calendar/sla-schedule.service.js +94 -0
  24. package/src/lib/calendar/sla-schedule.service.js.map +1 -0
  25. package/src/lib/calendar/weekday-business-calendar.d.ts +15 -0
  26. package/src/lib/calendar/weekday-business-calendar.js +28 -0
  27. package/src/lib/calendar/weekday-business-calendar.js.map +1 -0
  28. package/src/lib/common/iso-duration.d.ts +11 -0
  29. package/src/lib/common/iso-duration.js +13 -4
  30. package/src/lib/common/iso-duration.js.map +1 -1
  31. package/src/lib/form/form-schema.validator.js +177 -10
  32. package/src/lib/form/form-schema.validator.js.map +1 -1
  33. package/src/lib/form/form.service.d.ts +19 -1
  34. package/src/lib/form/form.service.js +56 -6
  35. package/src/lib/form/form.service.js.map +1 -1
  36. package/src/lib/form-data-source/form-data-source-value-resolver.service.d.ts +16 -0
  37. package/src/lib/form-data-source/form-data-source-value-resolver.service.js +401 -0
  38. package/src/lib/form-data-source/form-data-source-value-resolver.service.js.map +1 -0
  39. package/src/lib/form-data-source/form-data-source.errors.d.ts +34 -0
  40. package/src/lib/form-data-source/form-data-source.errors.js +43 -0
  41. package/src/lib/form-data-source/form-data-source.errors.js.map +1 -0
  42. package/src/lib/form-data-source/form-data-source.module.d.ts +9 -0
  43. package/src/lib/form-data-source/form-data-source.module.js +55 -0
  44. package/src/lib/form-data-source/form-data-source.module.js.map +1 -0
  45. package/src/lib/form-data-source/form-data-source.queries.d.ts +57 -0
  46. package/src/lib/form-data-source/form-data-source.queries.js +293 -0
  47. package/src/lib/form-data-source/form-data-source.queries.js.map +1 -0
  48. package/src/lib/form-data-source/form-data-source.service.d.ts +72 -0
  49. package/src/lib/form-data-source/form-data-source.service.js +646 -0
  50. package/src/lib/form-data-source/form-data-source.service.js.map +1 -0
  51. package/src/lib/form-data-source/form-data-source.types.d.ts +88 -0
  52. package/src/lib/form-data-source/form-data-source.types.js +29 -0
  53. package/src/lib/form-data-source/form-data-source.types.js.map +1 -0
  54. package/src/lib/form-data-source/index.d.ts +5 -0
  55. package/src/lib/form-data-source/index.js +9 -0
  56. package/src/lib/form-data-source/index.js.map +1 -0
  57. package/src/lib/migrations/0000000018000-notification-archive.d.ts +6 -0
  58. package/src/lib/migrations/0000000018000-notification-archive.js +28 -0
  59. package/src/lib/migrations/0000000018000-notification-archive.js.map +1 -0
  60. package/src/lib/migrations/0000000019000-approval-template-activation.d.ts +6 -0
  61. package/src/lib/migrations/0000000019000-approval-template-activation.js +29 -0
  62. package/src/lib/migrations/0000000019000-approval-template-activation.js.map +1 -0
  63. package/src/lib/migrations/0000000020000-form-data-option-snapshots.d.ts +6 -0
  64. package/src/lib/migrations/0000000020000-form-data-option-snapshots.js +22 -0
  65. package/src/lib/migrations/0000000020000-form-data-option-snapshots.js.map +1 -0
  66. package/src/lib/migrations/index.d.ts +3 -0
  67. package/src/lib/migrations/index.js +9 -0
  68. package/src/lib/migrations/index.js.map +1 -1
  69. package/src/lib/notification/index.d.ts +3 -0
  70. package/src/lib/notification/index.js +3 -0
  71. package/src/lib/notification/index.js.map +1 -1
  72. package/src/lib/notification/notification-observer.token.d.ts +52 -0
  73. package/src/lib/notification/notification-observer.token.js +5 -0
  74. package/src/lib/notification/notification-observer.token.js.map +1 -0
  75. package/src/lib/notification/notification-options.d.ts +10 -0
  76. package/src/lib/notification/notification-options.js +19 -0
  77. package/src/lib/notification/notification-options.js.map +1 -1
  78. package/src/lib/notification/notification.entity.d.ts +11 -0
  79. package/src/lib/notification/notification.entity.js +17 -0
  80. package/src/lib/notification/notification.entity.js.map +1 -1
  81. package/src/lib/notification/notification.enums.d.ts +13 -0
  82. package/src/lib/notification/notification.enums.js +14 -1
  83. package/src/lib/notification/notification.enums.js.map +1 -1
  84. package/src/lib/notification/notification.mutations.d.ts +2 -0
  85. package/src/lib/notification/notification.mutations.js +28 -0
  86. package/src/lib/notification/notification.mutations.js.map +1 -1
  87. package/src/lib/notification/notification.queries.d.ts +2 -2
  88. package/src/lib/notification/notification.queries.js +12 -8
  89. package/src/lib/notification/notification.queries.js.map +1 -1
  90. package/src/lib/notification/notification.service.d.ts +42 -2
  91. package/src/lib/notification/notification.service.js +135 -4
  92. package/src/lib/notification/notification.service.js.map +1 -1
  93. package/src/lib/template/approval-template.entity.d.ts +13 -0
  94. package/src/lib/template/approval-template.entity.js +12 -1
  95. package/src/lib/template/approval-template.entity.js.map +1 -1
  96. package/src/lib/template/template.enums.d.ts +5 -0
  97. package/src/lib/template/template.enums.js +10 -1
  98. package/src/lib/template/template.enums.js.map +1 -1
  99. package/src/lib/template/template.mutations.d.ts +2 -0
  100. package/src/lib/template/template.mutations.js +20 -0
  101. package/src/lib/template/template.mutations.js.map +1 -1
  102. package/src/lib/template/template.queries.d.ts +3 -3
  103. package/src/lib/template/template.queries.js +14 -4
  104. package/src/lib/template/template.queries.js.map +1 -1
  105. package/src/lib/template/template.service.d.ts +7 -2
  106. package/src/lib/template/template.service.js +56 -11
  107. package/src/lib/template/template.service.js.map +1 -1
  108. package/src/lib/template/workflow-definition.validator.js +86 -1
  109. package/src/lib/template/workflow-definition.validator.js.map +1 -1
  110. package/src/lib/workflow-engine/approval-instance.entity.d.ts +3 -0
  111. package/src/lib/workflow-engine/approval-instance.entity.js +15 -0
  112. package/src/lib/workflow-engine/approval-instance.entity.js.map +1 -1
  113. package/src/lib/workflow-engine/dto/resubmit-approval-instance.input.d.ts +5 -1
  114. package/src/lib/workflow-engine/dto/resubmit-approval-instance.input.js +6 -2
  115. package/src/lib/workflow-engine/dto/resubmit-approval-instance.input.js.map +1 -1
  116. package/src/lib/workflow-engine/dto/submit-approval-instance.input.d.ts +5 -1
  117. package/src/lib/workflow-engine/dto/submit-approval-instance.input.js +6 -2
  118. package/src/lib/workflow-engine/dto/submit-approval-instance.input.js.map +1 -1
  119. package/src/lib/workflow-engine/workflow-engine.mutations.d.ts +3 -2
  120. package/src/lib/workflow-engine/workflow-engine.mutations.js +8 -6
  121. package/src/lib/workflow-engine/workflow-engine.mutations.js.map +1 -1
  122. package/src/lib/workflow-engine/workflow-engine.service.d.ts +37 -4
  123. package/src/lib/workflow-engine/workflow-engine.service.js +245 -15
  124. package/src/lib/workflow-engine/workflow-engine.service.js.map +1 -1
  125. package/src/lib/workflow-engine/workflow-engine.tokens.d.ts +2 -1
  126. package/src/lib/workflow-engine/workflow-engine.tokens.js.map +1 -1
package/CHANGELOG.md CHANGED
@@ -1,3 +1,66 @@
1
+ ## 0.9.0 (2026-08-17)
2
+
3
+ ### 🚀 Features
4
+
5
+ - **notification:** lift routing fields onto the created event ([e02270b](https://github.com/Rytass/BPMCore/commit/e02270b))
6
+ - **notification:** let a host observe notifications as they are created ([#21](https://github.com/Rytass/BPMCore/pull/21))
7
+ - **shared:** detect a quorum no approver set can ever satisfy ([5671497](https://github.com/Rytass/BPMCore/commit/5671497))
8
+ - **shared:** expose the decision policy to the workflow toolset ([f6152b0](https://github.com/Rytass/BPMCore/commit/f6152b0))
9
+
10
+ ### 🩹 Fixes
11
+
12
+ - ⚠️ **template:** reject deleting a referenced category ([#16](https://github.com/Rytass/BPMCore/pull/16))
13
+ - **template:** let a template actually change category ([#17](https://github.com/Rytass/BPMCore/pull/17))
14
+ - **shared:** keep an approver change from discarding a workable policy ([ea6afbe](https://github.com/Rytass/BPMCore/commit/ea6afbe))
15
+ - **template:** block publishing a deadlocked quorum node ([89ab6a2](https://github.com/Rytass/BPMCore/commit/89ab6a2))
16
+ - **e2e:** poll on the expected value in the quorum threshold sanitiser spec ([099529f](https://github.com/Rytass/BPMCore/commit/099529f))
17
+ - **bpm-core-react:** correct decision-policy panel review findings ([ebf0337](https://github.com/Rytass/BPMCore/commit/ebf0337))
18
+
19
+ ### ⚠️ Breaking Changes
20
+
21
+ - **template:** reject deleting a referenced category ([#16](https://github.com/Rytass/BPMCore/pull/16))
22
+ `deleteApprovalTemplateCategory` now throws
23
+ `BadRequestException` when templates still reference the category, instead
24
+ of deactivating it and reporting success.
25
+ The old behaviour substituted a different operation for the one requested
26
+ and returned the same entity type either way, so a caller could not tell
27
+ that the delete had not happened — nor that `isActive` had been flipped as
28
+ a side effect it never asked for. Downstream, the category vanished from
29
+ groupings because it was now inactive, with nothing to explain why.
30
+ Deactivation is not lost: `deactivateApprovalTemplateCategory(id)` has
31
+ always existed and is unchanged, so the fallback was never the only way to
32
+ reach that state.
33
+ The designer's category screen already wraps the call in try/catch and
34
+ surfaces the message, and it only closes the confirmation dialog on
35
+ success, so the new error reaches the author without a UI change.
36
+ Reported by a consumer on 0.7.0, who had to re-implement the reference
37
+ check ahead of the call to avoid telling users something had been deleted
38
+ when it had not.
39
+ Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
40
+
41
+ ### ❤️ Thank You
42
+
43
+ - Chia Yu Pai @fantasywind
44
+ - Claude Opus 5
45
+ - Kai-Chieh Yang
46
+
47
+ ## 0.7.0 (2026-08-10)
48
+
49
+ ### 🚀 Features
50
+
51
+ - **bpm-core:** lint the new SLA and return-behaviour node fields ([f10c0bb](https://github.com/Rytass/BPMCore/commit/f10c0bb))
52
+ - **bpm-core:** enforce required return comments ([6cb288f](https://github.com/Rytass/BPMCore/commit/6cb288f))
53
+ - **bpm-core:** resolve task SLA due dates through a host business calendar ([3cb9d4d](https://github.com/Rytass/BPMCore/commit/3cb9d4d))
54
+
55
+ ### 🩹 Fixes
56
+
57
+ - **bpm-core:** stop SLA escalation from walking the whole management chain ([f7e4669](https://github.com/Rytass/BPMCore/commit/f7e4669))
58
+
59
+ ### ❤️ Thank You
60
+
61
+ - Chia Yu Pai @fantasywind
62
+ - Claude Opus 5 (1M context)
63
+
1
64
  # Changelog
2
65
 
3
66
  All notable changes to `@rytass/bpm-core-nestjs-module` are documented in this
@@ -6,6 +69,27 @@ file.
6
69
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
7
70
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
8
71
 
72
+ ## Unreleased
73
+
74
+ ### Added
75
+
76
+ - Form schema parsing now supports additive versioned option-source references
77
+ and structural lint for bindings, dependency cycles, and dynamic defaults.
78
+ - Added `FORM_DATA_SOURCE_VALUE_NOT_RESOLVED` so a submitted value that is no
79
+ longer selectable is reported separately from a provider contract breach.
80
+ - Added the host-provided versioned DataSource registry contract, guarded
81
+ GraphQL catalog/preview/runtime queries, provider limits, and stable error
82
+ codes for dynamic form options.
83
+ - Added server-side dynamic option resolution for submit/resubmit, persisted
84
+ option-label snapshots, optimistic revision protection around resubmit, and
85
+ the reversible `form_data_option_snapshot` migration.
86
+ - Resubmit mutations now return the refreshed persisted instance after dynamic
87
+ option resolution and workflow processing, keeping GraphQL JSON accessors in
88
+ sync with the committed form data and option snapshot.
89
+ - GraphQL DataSource input DTOs now carry explicit validation metadata so hosts
90
+ using `ValidationPipe({ forbidUnknownValues: true })` can call preview/runtime
91
+ option queries without bypassing input validation.
92
+
9
93
  Releases are managed by [`nx release`](https://nx.dev/recipes/nx-release) with
10
94
  Conventional Commits — see `nx.json` for the release config.
11
95
 
@@ -24,6 +108,55 @@ Conventional Commits — see `nx.json` for the release config.
24
108
 
25
109
  ### Fixed
26
110
 
111
+ - **Rolling back to an archived version now honours the registry gate.**
112
+ `rollbackFormDefinitionVersion` republished an archived form without checking
113
+ the host registry, so a version referencing a source the host had dropped
114
+ could become current again.
115
+ - **An illegal empty value no longer counts as "cleared".** `''` clears a
116
+ single-select and `[]` clears a multiple one; the mismatched shapes are
117
+ rejected instead of persisting a value the primitive contract forbids.
118
+ - **A corrupt instance form snapshot returns a controlled error.** Snapshot
119
+ readers dereferenced field entries, so `fields: [null]` raised a `TypeError`
120
+ out of submit/resubmit; such a snapshot is now rejected as invalid.
121
+ - **A `SET_FORM_FIELD` service task no longer leaves a wrong option label.**
122
+ Writing into a DataSource-backed field kept the previous option snapshot, so
123
+ instance history rendered the old label next to the new value. The snapshot
124
+ for that field is now dropped (the raw value is shown instead) and the
125
+ activity log records which field was cleared. The service task runs inside the
126
+ write transaction, so re-resolving through the host provider there would
127
+ breach the ADR's transaction boundary.
128
+ - **Clearing a dynamic option now removes its snapshot on resubmit.** A host
129
+ without a registry kept the old label for a field the user had emptied. An
130
+ empty array only clears a `multiple` field; on a single-select it stays an
131
+ illegal value instead of silently dropping the snapshot.
132
+ - **A binding-only preview failure now reports `FORM_DATA_SOURCE_INVALID_BINDING`.**
133
+ Binding lint lines stay prose because they quote a host-chosen parameter name,
134
+ so they carried no code and the preview fell back to `INVALID_DESCRIPTOR` —
135
+ telling the designer to contact an administrator about a binding they could
136
+ fix themselves. The code is now derived from the line shape.
137
+ - **The preview error code now follows the first lint error.** It was picked by
138
+ scanning the error-code list for a substring match, so the reported code
139
+ depended on enum declaration order and would misfire once one code became a
140
+ substring of another. It is now read only from the code-bearing lint shape
141
+ `<path>.dataSource <CODE>`, so prose such as an unbound parameter whose name
142
+ looks like a code is no longer reported as that code.
143
+ - **Publish lint no longer mislabels an unregistered DataSource key.** A key the
144
+ host never registered reported `FORM_DATA_SOURCE_VERSION_MISSING`, telling
145
+ designers to pick another version of a source that no longer exists. It now
146
+ reports `FORM_DATA_SOURCE_MISSING`, matching the runtime query path, and an
147
+ unsupported bounded control is reported once instead of twice.
148
+ - **A host without a DataSource registry can no longer publish or submit
149
+ dynamic option fields — but drafts stay editable.** The registry check runs
150
+ only where a published version is produced, so a draft that references an
151
+ unavailable source is still saved verbatim, as the ADR requires. Both the publish lint and the submit/resubmit
152
+ resolution degraded to no-ops when no registry was provided, so a
153
+ DataSource-backed value could reach the database with nothing able to
154
+ validate it. Both paths now fail with `FORM_DATA_SOURCE_MISSING`; static
155
+ forms are unaffected.
156
+ - **`initiatorMemberId` is no longer a required GraphQL input.** Submit and
157
+ resubmit inputs demanded a value the resolver always replaced with the
158
+ authenticated member id. The field is now optional and deprecated; the engine
159
+ still requires the server-derived id.
27
160
  - **Manager resolution priority now respected.**
28
161
  `resolveManagerResolutionCandidates` previously returned every active
29
162
  resolution regardless of priority. Now it keeps only the top-priority
package/README.md CHANGED
@@ -12,6 +12,13 @@ application owns runtime infrastructure such as GraphQL setup, TypeORM
12
12
  connection setup, auth/session handling, Vault or secret loading, member
13
13
  directory integration, storage adapters, and deployment.
14
14
 
15
+ Form Definition parsing accepts the additive static/DataSource option-source
16
+ shape and performs structural publish lint for source XOR, selection mode,
17
+ direct bindings, duplicate parameters, field references, dependency cycles,
18
+ and dynamic default-value prohibition. Hosts can register versioned DataSources
19
+ through `BPMRootModule`; the runtime validates bindings, bounds provider calls,
20
+ and keeps transport details and credentials out of form JSON.
21
+
15
22
  ## Package Status
16
23
 
17
24
  Current version: `0.1.10`
@@ -121,7 +128,7 @@ import { HostSessionService } from './host-session.service';
121
128
  sortSchema: true,
122
129
  }),
123
130
  }),
124
- BPMRootModule.forRoot({
131
+ BPMRootModule.forRoot({
125
132
  imports: [HostAuthModule],
126
133
  authContextFactory: buildBPMAuthContextFromExecutionContext,
127
134
  memberResolverProvider: {
@@ -375,6 +382,54 @@ configureBPMClient({
375
382
  });
376
383
  ```
377
384
 
385
+ ### Dynamic form option DataSources
386
+
387
+ The host owns the actual ERP, database, or integration-bus implementation. It
388
+ registers one versioned catalog provider; a form stores only the source key,
389
+ version, and field/constant bindings:
390
+
391
+ ```ts
392
+ import {
393
+ BPM_FORM_DATA_SOURCE_REGISTRY,
394
+ BPM_MEMBER_RESOLVER,
395
+ BPMRootModule,
396
+ } from '@rytass/bpm-core-nestjs-module';
397
+ import { HostFormDataSourceRegistry } from './host-form-data-source.registry';
398
+
399
+ BPMRootModule.forRoot({
400
+ formDataSourceRegistryProvider: {
401
+ provide: BPM_FORM_DATA_SOURCE_REGISTRY,
402
+ useClass: HostFormDataSourceRegistry,
403
+ },
404
+ memberResolverProvider: {
405
+ provide: BPM_MEMBER_RESOLVER,
406
+ useClass: HostBPMMemberResolver,
407
+ },
408
+ });
409
+ ```
410
+
411
+ `formDataSources` and `previewFormFieldOptions` are designer-only GraphQL
412
+ queries. `formFieldOptions` is an authenticated runtime query whose source
413
+ reference comes from the server's published form version or returned-instance
414
+ snapshot. Missing registry versions, unsupported controls, incomplete
415
+ bindings, provider failures, and over-limit results return stable DataSource
416
+ error codes.
417
+
418
+ On submit, the engine resolves every selected DataSource-backed value on the
419
+ server and stores the returned labels, source version, binding hash, and
420
+ validation timestamp in `approval_instances.form_data_option_snapshot`. A
421
+ resubmit resolves outside the database transaction, then rechecks the
422
+ instance revision under the transaction lock before writing form data and its
423
+ snapshot atomically. This keeps historical labels readable even when a host
424
+ later removes a registry version, while changed bindings or an `ALWAYS`
425
+ revalidation policy still require a live provider call.
426
+
427
+ The repository wrapper host demonstrates the contract with
428
+ `ApiFormDataSourceRegistry` and the seeded `demo.cost-centers@1` family. Its
429
+ database table and reset ownership remain in `apps/api`; an external host should
430
+ replace that provider through `BPMRootModule.forRoot()` and keep its own source
431
+ data and authorization rules outside the BPM package.
432
+
378
433
  This requires the wrapper host's auth middleware to honor `Authorization`
379
434
  headers (member-base hosts can be configured to do so via
380
435
  `authStrategy: 'jwt'` in addition to `cookieMode: true`).
@@ -811,6 +866,8 @@ BPMRootModule.forRootAsync({
811
866
  | `memberResolverProvider` | required | Provider for `BPM_MEMBER_RESOLVER`. |
812
867
  | `attachmentStorageProvider` | local `.storage/attachments` | Host-provided `@rytass/storages` adapter. |
813
868
  | `workflowServiceTaskDispatcherProvider` | built-in `fetch` dispatcher | Host provider for executable workflow `WEBHOOK` service tasks. |
869
+ | `businessCalendarProvider` | Monday–Friday calendar | Host provider for `BPM_BUSINESS_CALENDAR`, used by `BUSINESS_DAY` SLAs. BPMCore ships no holiday data. |
870
+ | `formDataSourceRegistryProvider` | Empty catalog | Single host provider for versioned Select / AutoComplete / Radio / Checkbox DataSources. |
814
871
  | `attachmentRoutePrefix` | `/attachments` | Drives both the BPM signed URL path and the Nest controller mount path for `AttachmentController`. Must be set at module wiring time (see "Attachment Storage" below). |
815
872
  | `attachmentStorageProviderId` | `local` | Value stored on attachment metadata for the active adapter. |
816
873
  | `attachmentPublicBaseUrl` | `http://localhost:17603` | Public base URL for signed attachment URLs. |
@@ -835,6 +892,7 @@ BPMRootModule.forRootAsync({
835
892
  | `notificationDeliveryRetryBaseDelayMs` | `60000` | Base retry delay multiplied by attempt count. |
836
893
  | `notificationSlaSchedulerEnabled` | `false` | Runs automatic SLA scan loop in this process. |
837
894
  | `notificationSlaScanIntervalMs` | `60000` | SLA scheduler interval. |
895
+ | `notificationSlaBusinessCalendarTimeZone` | `UTC` | IANA zone for the built-in weekday calendar. Ignored when `businessCalendarProvider` is set. |
838
896
  | `notificationSlaTimeoutRemindEnabled` | `true` | Enables SLA timeout `REMIND`. |
839
897
  | `notificationSlaTimeoutAutoApproveEnabled` | `false` | Enables SLA timeout `AUTO_APPROVE`. |
840
898
  | `notificationSlaTimeoutEscalateEnabled` | `false` | Enables SLA timeout `ESCALATE`. |
@@ -1279,6 +1337,7 @@ Importing `BPMRootModule` registers GraphQL resolvers for:
1279
1337
  - Organization units, positions, memberships, manager resolution, and summary.
1280
1338
  - Member profile lookup and member metadata cache inspection.
1281
1339
  - Form definitions and form definition versions.
1340
+ - Form option DataSource catalog, designer preview, and authenticated runtime option queries.
1282
1341
  - Approval templates, template versions, categories, validation, and dry run.
1283
1342
  - Workflow instances, tokens, tasks, task candidates, decisions, activity logs,
1284
1343
  submit/process/approve/return/cancel/resubmit operations.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rytass/bpm-core-nestjs-module",
3
- "version": "0.6.0",
3
+ "version": "0.9.0",
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",
@@ -42,6 +42,9 @@
42
42
  "bpm-auth": [
43
43
  "./src/lib/bpm-auth/index.d.ts"
44
44
  ],
45
+ "calendar": [
46
+ "./src/lib/calendar/index.d.ts"
47
+ ],
45
48
  "condition": [
46
49
  "./src/lib/condition/index.d.ts"
47
50
  ],
@@ -54,6 +57,9 @@
54
57
  "form": [
55
58
  "./src/lib/form/index.d.ts"
56
59
  ],
60
+ "form-data-source": [
61
+ "./src/lib/form-data-source/index.d.ts"
62
+ ],
57
63
  "identity": [
58
64
  "./src/lib/identity/index.d.ts"
59
65
  ],
@@ -91,6 +97,10 @@
91
97
  "types": "./src/lib/bpm-auth/index.d.ts",
92
98
  "default": "./src/lib/bpm-auth/index.js"
93
99
  },
100
+ "./calendar": {
101
+ "types": "./src/lib/calendar/index.d.ts",
102
+ "default": "./src/lib/calendar/index.js"
103
+ },
94
104
  "./database": {
95
105
  "types": "./src/lib/database/index.d.ts",
96
106
  "default": "./src/lib/database/index.js"
@@ -107,6 +117,10 @@
107
117
  "types": "./src/lib/form/index.d.ts",
108
118
  "default": "./src/lib/form/index.js"
109
119
  },
120
+ "./form-data-source": {
121
+ "types": "./src/lib/form-data-source/index.d.ts",
122
+ "default": "./src/lib/form-data-source/index.js"
123
+ },
110
124
  "./identity": {
111
125
  "types": "./src/lib/identity/index.d.ts",
112
126
  "default": "./src/lib/identity/index.js"
@@ -141,8 +155,8 @@
141
155
  "@nestjs/core": "^11.0.0",
142
156
  "@nestjs/graphql": "^13.4.0",
143
157
  "@nestjs/typeorm": "^11.0.1",
144
- "@rytass/bpm-core-shared": "^0.6.0",
145
- "@rytass/secret-adapter-vault-nestjs": "^0.4.5 || ^0.5.0",
158
+ "@rytass/bpm-core-shared": "^0.9.0",
159
+ "@rytass/secret-adapter-vault-nestjs": "^0.4.5 || ^0.5.0 || ^0.6.0",
146
160
  "express": "^4.0.0 || ^5.0.0",
147
161
  "graphql": "^16.0.0",
148
162
  "reflect-metadata": "^0.1.13 || ^0.2.0",
package/src/index.d.ts CHANGED
@@ -1,11 +1,13 @@
1
1
  export * from './lib/attachment';
2
2
  export * from './lib/bpm';
3
3
  export * from './lib/bpm-auth';
4
+ export * from './lib/calendar';
4
5
  export * from './lib/common';
5
6
  export * from './lib/condition';
6
7
  export * from './lib/database';
7
8
  export * from './lib/delegation';
8
9
  export * from './lib/form';
10
+ export * from './lib/form-data-source';
9
11
  export * from './lib/identity';
10
12
  export * from './lib/notification';
11
13
  export * from './lib/organization';
package/src/index.js CHANGED
@@ -4,11 +4,13 @@ const tslib_1 = require("tslib");
4
4
  tslib_1.__exportStar(require("./lib/attachment"), exports);
5
5
  tslib_1.__exportStar(require("./lib/bpm"), exports);
6
6
  tslib_1.__exportStar(require("./lib/bpm-auth"), exports);
7
+ tslib_1.__exportStar(require("./lib/calendar"), exports);
7
8
  tslib_1.__exportStar(require("./lib/common"), exports);
8
9
  tslib_1.__exportStar(require("./lib/condition"), exports);
9
10
  tslib_1.__exportStar(require("./lib/database"), exports);
10
11
  tslib_1.__exportStar(require("./lib/delegation"), exports);
11
12
  tslib_1.__exportStar(require("./lib/form"), exports);
13
+ tslib_1.__exportStar(require("./lib/form-data-source"), exports);
12
14
  tslib_1.__exportStar(require("./lib/identity"), exports);
13
15
  tslib_1.__exportStar(require("./lib/notification"), exports);
14
16
  tslib_1.__exportStar(require("./lib/organization"), exports);
package/src/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/bpm-core/src/index.ts"],"names":[],"mappings":";;;AAAA,2DAAiC;AACjC,oDAA0B;AAC1B,yDAA+B;AAC/B,uDAA6B;AAC7B,0DAAgC;AAChC,yDAA+B;AAC/B,2DAAiC;AACjC,qDAA2B;AAC3B,yDAA+B;AAC/B,6DAAmC;AACnC,6DAAmC;AACnC,0DAAgC;AAChC,yDAA+B;AAC/B,gEAAsC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/bpm-core/src/index.ts"],"names":[],"mappings":";;;AAAA,2DAAiC;AACjC,oDAA0B;AAC1B,yDAA+B;AAC/B,yDAA+B;AAC/B,uDAA6B;AAC7B,0DAAgC;AAChC,yDAA+B;AAC/B,2DAAiC;AACjC,qDAA2B;AAC3B,iEAAuC;AACvC,yDAA+B;AAC/B,6DAAmC;AACnC,6DAAmC;AACnC,0DAAgC;AAChC,yDAA+B;AAC/B,gEAAsC"}
@@ -3,6 +3,8 @@ import { ModuleMetadata } from '@nestjs/common/interfaces';
3
3
  import { BPMRootAttachmentOptions } from '../attachment/attachment-options';
4
4
  import { AttachmentStorage } from '../attachment/attachment-storage.token';
5
5
  import { BPMAuthModuleOptions } from '../bpm-auth/bpm-auth.options';
6
+ import { BPMBusinessCalendar } from '../calendar/business-calendar.token';
7
+ import { BPMFormDataSourceRegistry } from '../form-data-source';
6
8
  import { BPMRootIdentityOptions } from '../identity/identity-options';
7
9
  import { BPMMemberResolver } from '../identity/member-resolver.interface';
8
10
  import { BPMRootNotificationOptions } from '../notification/notification-options';
@@ -27,6 +29,24 @@ export interface BPMRootModuleOptions extends Pick<ModuleMetadata, 'imports'>, B
27
29
  * operations that require authentication will not receive a host session.
28
30
  */
29
31
  readonly authContextFactory?: BPMAuthModuleOptions['contextFactory'];
32
+ /**
33
+ * Host-provided business calendar used by workflow nodes whose SLA opts into
34
+ * `BUSINESS_DAY`.
35
+ *
36
+ * BPMCore ships no national holiday data. When omitted, BPM falls back to a
37
+ * Monday–Friday calendar (see `notificationSlaBusinessCalendarTimeZone`);
38
+ * hosts that need national holidays or make-up working days register their
39
+ * own `BPM_BUSINESS_CALENDAR` provider here.
40
+ */
41
+ readonly businessCalendarProvider?: Provider<BPMBusinessCalendar>;
42
+ /**
43
+ * Host-provided registry containing versioned form option DataSources.
44
+ *
45
+ * The registry is a single provider so a published form reference always
46
+ * resolves against one coherent catalog. When omitted, BPM exposes an
47
+ * empty catalog and keeps existing hosts bootstrap-compatible.
48
+ */
49
+ readonly formDataSourceRegistryProvider?: Provider<BPMFormDataSourceRegistry>;
30
50
  /**
31
51
  * Host-provided member resolver provider.
32
52
  *
@@ -72,6 +92,19 @@ export interface BPMRootModuleAsyncOptions extends Pick<ModuleMetadata, 'imports
72
92
  * use a Nest provider with `useFactory` / `inject` here.
73
93
  */
74
94
  readonly attachmentStorageProvider?: Provider<AttachmentStorage>;
95
+ /**
96
+ * Host-provided business calendar for `BUSINESS_DAY` SLAs.
97
+ *
98
+ * This provider is static at module wiring time. If secrets or a repository
99
+ * are required, use a Nest provider with `useFactory` / `inject` here.
100
+ */
101
+ readonly businessCalendarProvider?: Provider<BPMBusinessCalendar>;
102
+ /**
103
+ * Host-provided versioned form option DataSource registry. This provider is
104
+ * static at module wiring time; secrets and repositories can be injected
105
+ * through its Nest `useFactory`, `useClass`, or `useExisting` definition.
106
+ */
107
+ readonly formDataSourceRegistryProvider?: Provider<BPMFormDataSourceRegistry>;
75
108
  /**
76
109
  * Providers injected into `useFactory`.
77
110
  *
@@ -6,8 +6,10 @@ const tslib_1 = require("tslib");
6
6
  const common_1 = require("@nestjs/common");
7
7
  const attachment_module_1 = require("../attachment/attachment.module");
8
8
  const bpm_auth_module_1 = require("../bpm-auth/bpm-auth.module");
9
+ const calendar_module_1 = require("../calendar/calendar.module");
9
10
  const delegation_module_1 = require("../delegation/delegation.module");
10
11
  const form_module_1 = require("../form/form.module");
12
+ const form_data_source_1 = require("../form-data-source");
11
13
  const identity_module_1 = require("../identity/identity.module");
12
14
  const notification_module_1 = require("../notification/notification.module");
13
15
  const notification_options_module_1 = require("../notification/notification-options.module");
@@ -82,11 +84,13 @@ let BPMRootModule = BPMRootModule_1 = class BPMRootModule {
82
84
  return {
83
85
  exports: [
84
86
  notification_options_module_1.NotificationOptionsModule,
87
+ calendar_module_1.CalendarModule,
85
88
  bpm_auth_module_1.BPMAuthModule,
86
89
  identity_module_1.IdentityModule,
87
90
  organization_module_1.OrganizationModule,
88
91
  attachment_module_1.AttachmentModule,
89
92
  form_module_1.FormModule,
93
+ form_data_source_1.FormDataSourceModule,
90
94
  template_module_1.TemplateModule,
91
95
  delegation_module_1.DelegationModule,
92
96
  notification_module_1.NotificationModule,
@@ -99,6 +103,10 @@ let BPMRootModule = BPMRootModule_1 = class BPMRootModule {
99
103
  inject: options.inject,
100
104
  useFactory: options.useFactory,
101
105
  }),
106
+ calendar_module_1.CalendarModule.forRoot({
107
+ businessCalendarProvider: options.businessCalendarProvider,
108
+ imports: options.imports,
109
+ }),
102
110
  bpm_auth_module_1.BPMAuthModule.forRootAsync(authOptions),
103
111
  identity_module_1.IdentityModule.forRootAsync({
104
112
  imports: options.imports,
@@ -115,6 +123,10 @@ let BPMRootModule = BPMRootModule_1 = class BPMRootModule {
115
123
  useFactory: options.useFactory,
116
124
  }),
117
125
  form_module_1.FormModule,
126
+ form_data_source_1.FormDataSourceModule.forRoot({
127
+ imports: options.imports,
128
+ registryProvider: options.formDataSourceRegistryProvider,
129
+ }),
118
130
  template_module_1.TemplateModule,
119
131
  delegation_module_1.DelegationModule,
120
132
  notification_module_1.NotificationModule,
@@ -139,6 +151,10 @@ exports.BPMRootModule = BPMRootModule = BPMRootModule_1 = tslib_1.__decorate([
139
151
  function createBPMFeatureModules(options) {
140
152
  return [
141
153
  notification_options_module_1.NotificationOptionsModule.forRoot(options),
154
+ calendar_module_1.CalendarModule.forRoot({
155
+ businessCalendarProvider: options.businessCalendarProvider,
156
+ imports: options.imports,
157
+ }),
142
158
  bpm_auth_module_1.BPMAuthModule.forRoot(createBPMAuthModuleOptions(options)),
143
159
  identity_module_1.IdentityModule.forRoot({
144
160
  ...options,
@@ -152,6 +168,10 @@ function createBPMFeatureModules(options) {
152
168
  storageProvider: options.attachmentStorageProvider,
153
169
  }),
154
170
  form_module_1.FormModule,
171
+ form_data_source_1.FormDataSourceModule.forRoot({
172
+ imports: options.imports,
173
+ registryProvider: options.formDataSourceRegistryProvider,
174
+ }),
155
175
  template_module_1.TemplateModule,
156
176
  delegation_module_1.DelegationModule,
157
177
  notification_module_1.NotificationModule,
@@ -1 +1 @@
1
- {"version":3,"file":"bpm-root.module.js","sourceRoot":"","sources":["../../../../../../libs/bpm-core/src/lib/bpm/bpm-root.module.ts"],"names":[],"mappings":";;;;;AAAA,2CAMwB;AAGxB,uEAAmE;AAEnE,iEAA4D;AAK5D,uEAAmE;AACnE,qDAAiD;AAEjD,iEAA6D;AAE7D,6EAAyE;AACzE,6FAAwF;AAExF,6EAAyE;AAEzE,oEAAgE;AAChE,iEAA6D;AAC7D,sFAAiF;AAiIjF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEI,IAAM,aAAa,qBAAnB,MAAM,aAAa;IACxB;;;OAGG;IACH,MAAM,CAAC,OAAO,CAAC,OAA6B;QAC1C,MAAM,cAAc,GAAG,uBAAuB,CAAC,OAAO,CAAC,CAAC;QAExD,OAAO;YACL,OAAO,EAAE,CAAC,GAAG,cAAc,CAAC;YAC5B,OAAO,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC,EAAE,GAAG,cAAc,CAAC;YACxD,MAAM,EAAE,e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gE;IAEhE,OAAO;QACL,cAAc,EAAE,OAAO,CAAC,kBAAkB;KAC3C,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"bpm-root.module.js","sourceRoot":"","sources":["../../../../../../libs/bpm-core/src/lib/bpm/bpm-root.module.ts"],"names":[],"mappings":";;;;;AAAA,2CAMwB;AAGxB,uEAAmE;AAEnE,iEAA4D;AAM5D,iEAA6D;AAC7D,uEAAmE;AACnE,qDAAiD;AACjD,0DAI6B;AAE7B,iEAA6D;AAE7D,6EAAyE;AACzE,6FAAwF;AAExF,6EAAyE;AAEzE,oEAAgE;AAChE,iEAA6D;AAC7D,sFAAiF;AAoKjF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEI,IAAM,aAAa,qBAAnB,MAAM,aAAa;IACxB;;;OAGG;IACH,MAAM,CAAC,OAAO,CAAC,OAA6B;QAC1C,MAAM,cAAc,GAAG,uBAAuB,CAAC,OAAO,CAAC,CAAC;QAExD,OAAO;YACL,OAAO,EAAE,CAAC,GAAG,cAAc,CAAC;YAC5B,OAAO,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC,EAAE,GAAG,cAAc,CAAC;YACxD,MAAM,EAAE,eAAa;SACtB,CAAC;IACJ,CAAC;IAED;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,YAAY,CAAC,OAAkC;QACpD,MAAM,WAAW,GAA8B;YAC7C,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,UAAU,EAAE,KAAK,EACf,GAAG,IAAwB,EACI,EAAE;gBACjC,MAAM,WAAW,GAAG,MAAM,OAAO,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC,CAAC;gBAEtD,OAAO,0BAA0B,CAAC,WAAW,CAAC,CAAC;YACjD,CAAC;SACF,CAAC;QAEF,OAAO;YACL,OAAO,EAAE;gBACP,uDAAyB;gBACzB,gCAAc;gBACd,+BAAa;gBACb,g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CAAC;KACH,CAAC;AACJ,CAAC;AAED,SAAS,0BAA0B,CACjC,OAAgE;IAEhE,OAAO;QACL,cAAc,EAAE,OAAO,CAAC,kBAAkB;KAC3C,CAAC;AACJ,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { Provider } from '@nestjs/common';
2
+ import { BPMBusinessCalendar } from './business-calendar.token';
3
+ /**
4
+ * Default {@link BPMBusinessCalendar} used when the host registers none.
5
+ *
6
+ * Treats Monday–Friday as working days in the time zone configured through
7
+ * `notificationSlaBusinessCalendarTimeZone`, and knows about no holidays. Hosts
8
+ * that need national holidays or make-up working days replace this provider via
9
+ * `BPMRootModule`'s `businessCalendarProvider`.
10
+ */
11
+ export declare const defaultBusinessCalendarProvider: Provider<BPMBusinessCalendar>;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.defaultBusinessCalendarProvider = void 0;
4
+ const notification_options_1 = require("../notification/notification-options");
5
+ const business_calendar_token_1 = require("./business-calendar.token");
6
+ const weekday_business_calendar_1 = require("./weekday-business-calendar");
7
+ /**
8
+ * Default {@link BPMBusinessCalendar} used when the host registers none.
9
+ *
10
+ * Treats Monday–Friday as working days in the time zone configured through
11
+ * `notificationSlaBusinessCalendarTimeZone`, and knows about no holidays. Hosts
12
+ * that need national holidays or make-up working days replace this provider via
13
+ * `BPMRootModule`'s `businessCalendarProvider`.
14
+ */
15
+ exports.defaultBusinessCalendarProvider = {
16
+ inject: [notification_options_1.BPM_NOTIFICATION_OPTIONS],
17
+ provide: business_calendar_token_1.BPM_BUSINESS_CALENDAR,
18
+ useFactory: (options) => new weekday_business_calendar_1.BPMWeekdayBusinessCalendar(options.slaBusinessCalendarTimeZone),
19
+ };
20
+ //# sourceMappingURL=business-calendar.provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"business-calendar.provider.js","sourceRoot":"","sources":["../../../../../../libs/bpm-core/src/lib/calendar/business-calendar.provider.ts"],"names":[],"mappings":";;;AACA,+EAG8C;AAC9C,uEAGmC;AACnC,2EAAyE;AAEzE;;;;;;;GAOG;AACU,QAAA,+BAA+B,GAAkC;IAC5E,MAAM,EAAE,CAAC,+CAAwB,CAAC;IAClC,OAAO,EAAE,+CAAqB;IAC9B,UAAU,EAAE,CACV,OAAuC,EAClB,EAAE,CACvB,IAAI,sDAA0B,CAAC,OAAO,CAAC,2BAA2B,CAAC;CACtE,CAAC"}
@@ -0,0 +1,38 @@
1
+ import { InjectionToken } from '@nestjs/common';
2
+ /**
3
+ * Host-provided business calendar used to resolve `BUSINESS_DAY` SLA due
4
+ * dates.
5
+ *
6
+ * BPMCore deliberately ships **no** national holiday data. A host that needs
7
+ * real working-day semantics (national holidays, make-up working Saturdays,
8
+ * company shutdown days) implements this contract against its own calendar
9
+ * source and registers it through `BPMRootModule`'s `businessCalendarProvider`.
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * BPMRootModule.forRoot({
14
+ * businessCalendarProvider: {
15
+ * provide: BPM_BUSINESS_CALENDAR,
16
+ * useClass: TaiwanBusinessCalendar,
17
+ * },
18
+ * // ...
19
+ * });
20
+ * ```
21
+ */
22
+ export interface BPMBusinessCalendar {
23
+ /**
24
+ * IANA time zone the calendar's dates are expressed in, for example
25
+ * `Asia/Taipei`. BPM converts each instant to a local date in this zone
26
+ * before asking {@link BPMBusinessCalendar.isBusinessDay}, so day boundaries
27
+ * follow the host's calendar rather than the server's locale or UTC.
28
+ */
29
+ readonly timeZone: string;
30
+ /**
31
+ * Answers whether `localDate` is a working day.
32
+ *
33
+ * @param localDate Calendar date in `YYYY-MM-DD` form, already expressed in
34
+ * {@link BPMBusinessCalendar.timeZone}.
35
+ */
36
+ isBusinessDay(localDate: string): boolean | Promise<boolean>;
37
+ }
38
+ export declare const BPM_BUSINESS_CALENDAR: InjectionToken<BPMBusinessCalendar>;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BPM_BUSINESS_CALENDAR = void 0;
4
+ exports.BPM_BUSINESS_CALENDAR = Symbol('BPM_BUSINESS_CALENDAR');
5
+ //# sourceMappingURL=business-calendar.token.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"business-calendar.token.js","sourceRoot":"","sources":["../../../../../../libs/bpm-core/src/lib/calendar/business-calendar.token.ts"],"names":[],"mappings":";;;AAwCa,QAAA,qBAAqB,GAChC,MAAM,CAAC,uBAAuB,CAAC,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { DynamicModule, Provider } from '@nestjs/common';
2
+ import { ModuleMetadata } from '@nestjs/common/interfaces';
3
+ import { BPMBusinessCalendar } from './business-calendar.token';
4
+ export interface CalendarModuleOptions extends Pick<ModuleMetadata, 'imports'> {
5
+ /**
6
+ * Host-provided business calendar. When omitted, BPM falls back to a
7
+ * Monday–Friday calendar with no holiday knowledge.
8
+ *
9
+ * A `useClass` or `useFactory` provider may depend on host services, so the
10
+ * modules exporting them have to be listed in `imports`.
11
+ */
12
+ readonly businessCalendarProvider?: Provider<BPMBusinessCalendar>;
13
+ }
14
+ /**
15
+ * Supplies SLA scheduling to every BPM module.
16
+ *
17
+ * Global because the workflow engine computes due dates while creating tasks
18
+ * and hosts should not have to thread the calendar through each feature module.
19
+ */
20
+ export declare class CalendarModule {
21
+ static forRoot(options?: CalendarModuleOptions): DynamicModule;
22
+ }
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ var CalendarModule_1;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.CalendarModule = void 0;
5
+ const tslib_1 = require("tslib");
6
+ const common_1 = require("@nestjs/common");
7
+ const business_calendar_provider_1 = require("./business-calendar.provider");
8
+ const sla_schedule_service_1 = require("./sla-schedule.service");
9
+ /**
10
+ * Supplies SLA scheduling to every BPM module.
11
+ *
12
+ * Global because the workflow engine computes due dates while creating tasks
13
+ * and hosts should not have to thread the calendar through each feature module.
14
+ */
15
+ let CalendarModule = CalendarModule_1 = class CalendarModule {
16
+ static forRoot(options = {}) {
17
+ return {
18
+ exports: [sla_schedule_service_1.BPMSlaScheduleService],
19
+ imports: options.imports ? [...options.imports] : [],
20
+ module: CalendarModule_1,
21
+ providers: [
22
+ options.businessCalendarProvider ?? business_calendar_provider_1.defaultBusinessCalendarProvider,
23
+ sla_schedule_service_1.BPMSlaScheduleService,
24
+ ],
25
+ };
26
+ }
27
+ };
28
+ exports.CalendarModule = CalendarModule;
29
+ exports.CalendarModule = CalendarModule = CalendarModule_1 = tslib_1.__decorate([
30
+ (0, common_1.Global)(),
31
+ (0, common_1.Module)({})
32
+ ], CalendarModule);
33
+ //# sourceMappingURL=calendar.module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"calendar.module.js","sourceRoot":"","sources":["../../../../../../libs/bpm-core/src/lib/calendar/calendar.module.ts"],"names":[],"mappings":";;;;;AAAA,2CAAyE;AAGzE,6EAA+E;AAC/E,iEAA+D;AAa/D;;;;;GAKG;AAGI,IAAM,cAAc,sBAApB,MAAM,cAAc;IACzB,MAAM,CAAC,OAAO,CAAC,UAAiC,EAAE;QAChD,OAAO;YACL,OAAO,EAAE,CAAC,4CAAqB,CAAC;YAChC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE;YACpD,MAAM,EAAE,gBAAc;YACtB,SAAS,EAAE;gBACT,OAAO,CAAC,wBAAwB,IAAI,4DAA+B;gBACnE,4CAAqB;aACtB;SACF,CAAC;IACJ,CAAC;CACF,CAAA;AAZY,wCAAc;yBAAd,cAAc;IAF1B,IAAA,eAAM,GAAE;IACR,IAAA,eAAM,EAAC,EAAE,CAAC;GACE,cAAc,CAY1B"}
@@ -0,0 +1,5 @@
1
+ export * from './business-calendar.provider';
2
+ export * from './business-calendar.token';
3
+ export * from './calendar.module';
4
+ export * from './sla-schedule.service';
5
+ export * from './weekday-business-calendar';