@rytass/bpm-core-nestjs-module 0.1.10 → 0.3.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 +92 -0
- package/README.md +43 -0
- package/package.json +3 -2
- package/src/lib/database/migration-runner.js +2 -0
- package/src/lib/database/migration-runner.js.map +1 -1
- package/src/lib/database/reconcile-legacy-migrations.d.ts +13 -0
- package/src/lib/database/reconcile-legacy-migrations.js +70 -0
- package/src/lib/database/reconcile-legacy-migrations.js.map +1 -0
- package/src/lib/form/dto/form-definition.input.d.ts +5 -0
- package/src/lib/form/dto/form-definition.input.js +24 -1
- package/src/lib/form/dto/form-definition.input.js.map +1 -1
- package/src/lib/form/form.mutations.d.ts +2 -2
- package/src/lib/form/form.mutations.js +6 -5
- package/src/lib/form/form.mutations.js.map +1 -1
- package/src/lib/form/form.service.d.ts +20 -6
- package/src/lib/form/form.service.js +129 -80
- package/src/lib/form/form.service.js.map +1 -1
- package/src/lib/migrations/0000000014000-notification-resolution.d.ts +6 -0
- package/src/lib/migrations/0000000014000-notification-resolution.js +30 -0
- package/src/lib/migrations/0000000014000-notification-resolution.js.map +1 -0
- package/src/lib/migrations/0000000015000-backfill-stale-notification-resolution.d.ts +15 -0
- package/src/lib/migrations/0000000015000-backfill-stale-notification-resolution.js +37 -0
- package/src/lib/migrations/0000000015000-backfill-stale-notification-resolution.js.map +1 -0
- package/src/lib/migrations/0000000016000-archive-parallel-form-drafts.d.ts +15 -0
- package/src/lib/migrations/0000000016000-archive-parallel-form-drafts.js +34 -0
- package/src/lib/migrations/0000000016000-archive-parallel-form-drafts.js.map +1 -0
- package/src/lib/migrations/0000000017000-adhoc-directives.d.ts +6 -0
- package/src/lib/migrations/0000000017000-adhoc-directives.js +53 -0
- package/src/lib/migrations/0000000017000-adhoc-directives.js.map +1 -0
- package/src/lib/migrations/index.d.ts +4 -0
- package/src/lib/migrations/index.js +12 -0
- package/src/lib/migrations/index.js.map +1 -1
- package/src/lib/notification/notification.entity.d.ts +9 -1
- package/src/lib/notification/notification.entity.js +27 -0
- package/src/lib/notification/notification.entity.js.map +1 -1
- package/src/lib/notification/notification.enums.d.ts +14 -0
- package/src/lib/notification/notification.enums.js +19 -1
- package/src/lib/notification/notification.enums.js.map +1 -1
- package/src/lib/notification/notification.service.d.ts +40 -0
- package/src/lib/notification/notification.service.js +92 -0
- package/src/lib/notification/notification.service.js.map +1 -1
- package/src/lib/template/compose-approval-template.object.d.ts +11 -0
- package/src/lib/template/compose-approval-template.object.js +36 -0
- package/src/lib/template/compose-approval-template.object.js.map +1 -0
- package/src/lib/template/compose-template.mutations.d.ts +8 -0
- package/src/lib/template/compose-template.mutations.js +32 -0
- package/src/lib/template/compose-template.mutations.js.map +1 -0
- package/src/lib/template/dto/compose-approval-template.input.d.ts +17 -0
- package/src/lib/template/dto/compose-approval-template.input.js +99 -0
- package/src/lib/template/dto/compose-approval-template.input.js.map +1 -0
- package/src/lib/template/index.d.ts +2 -0
- package/src/lib/template/index.js +2 -0
- package/src/lib/template/index.js.map +1 -1
- package/src/lib/template/template.module.js +9 -1
- package/src/lib/template/template.module.js.map +1 -1
- package/src/lib/template/template.service.d.ts +25 -6
- package/src/lib/template/template.service.js +216 -83
- package/src/lib/template/template.service.js.map +1 -1
- package/src/lib/workflow-engine/adhoc-directive.entity.d.ts +31 -0
- package/src/lib/workflow-engine/adhoc-directive.entity.js +105 -0
- package/src/lib/workflow-engine/adhoc-directive.entity.js.map +1 -0
- package/src/lib/workflow-engine/adhoc.enums.d.ts +21 -0
- package/src/lib/workflow-engine/adhoc.enums.js +42 -0
- package/src/lib/workflow-engine/adhoc.enums.js.map +1 -0
- package/src/lib/workflow-engine/dto/adhoc-notification.input.d.ts +6 -0
- package/src/lib/workflow-engine/dto/adhoc-notification.input.js +28 -0
- package/src/lib/workflow-engine/dto/adhoc-notification.input.js.map +1 -0
- package/src/lib/workflow-engine/dto/adhoc-target.input.d.ts +16 -0
- package/src/lib/workflow-engine/dto/adhoc-target.input.js +61 -0
- package/src/lib/workflow-engine/dto/adhoc-target.input.js.map +1 -0
- package/src/lib/workflow-engine/index.d.ts +4 -0
- package/src/lib/workflow-engine/index.js +4 -0
- package/src/lib/workflow-engine/index.js.map +1 -1
- package/src/lib/workflow-engine/task.entity.d.ts +5 -0
- package/src/lib/workflow-engine/task.entity.js +21 -0
- package/src/lib/workflow-engine/task.entity.js.map +1 -1
- package/src/lib/workflow-engine/workflow-engine.enums.d.ts +3 -0
- package/src/lib/workflow-engine/workflow-engine.enums.js +3 -0
- package/src/lib/workflow-engine/workflow-engine.enums.js.map +1 -1
- package/src/lib/workflow-engine/workflow-engine.module.js +2 -0
- package/src/lib/workflow-engine/workflow-engine.module.js.map +1 -1
- package/src/lib/workflow-engine/workflow-engine.mutations.d.ts +10 -0
- package/src/lib/workflow-engine/workflow-engine.mutations.js +112 -0
- package/src/lib/workflow-engine/workflow-engine.mutations.js.map +1 -1
- package/src/lib/workflow-engine/workflow-engine.queries.d.ts +2 -0
- package/src/lib/workflow-engine/workflow-engine.queries.js +12 -0
- package/src/lib/workflow-engine/workflow-engine.queries.js.map +1 -1
- package/src/lib/workflow-engine/workflow-engine.service.d.ts +44 -1
- package/src/lib/workflow-engine/workflow-engine.service.js +817 -41
- package/src/lib/workflow-engine/workflow-engine.service.js.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,98 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
9
9
|
Releases are managed by [`nx release`](https://nx.dev/recipes/nx-release) with
|
|
10
10
|
Conventional Commits — see `nx.json` for the release config.
|
|
11
11
|
|
|
12
|
+
## 0.3.0 — 2026-06-06
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
|
|
16
|
+
- **Ad-hoc directives** — stage approvers can attach instance-scoped
|
|
17
|
+
directives that never modify the workflow template:
|
|
18
|
+
- `COUNTERSIGN` (臨時會簽): a parallel ad-hoc task joins the next user
|
|
19
|
+
task; the token only advances once every task on that stage is
|
|
20
|
+
approved.
|
|
21
|
+
- `PRE_APPROVAL` (臨時加簽): a blocking ad-hoc task on the current stage
|
|
22
|
+
with configurable rejection behavior (`REJECT_INSTANCE` /
|
|
23
|
+
`RETURN_TO_ORIGIN`).
|
|
24
|
+
- `STAGE_NOTIFY` / `COMPLETION_NOTIFY`: notify members, positions, org
|
|
25
|
+
units, or webhooks when the stage ends (any outcome) or the instance
|
|
26
|
+
reaches a terminal state.
|
|
27
|
+
- GraphQL surface: mutations `requestAdhocCountersign`,
|
|
28
|
+
`requestAdhocPreApproval`, `configureAdhocStageNotification`,
|
|
29
|
+
`configureAdhocCompletionNotification`, `cancelAdhocDirective`; query
|
|
30
|
+
`adhocDirectives(instanceId)`. Countersign / pre-approval are gated by
|
|
31
|
+
the node's `allowAddSigner` flag.
|
|
32
|
+
- `AdhocDirectiveEntity` (`task_adhoc_directives`) plus ad-hoc columns on
|
|
33
|
+
`tasks`, created by migration `AdhocDirectives0000000017000` (included
|
|
34
|
+
in `BPM_CORE_MIGRATIONS`). Run migrations before serving traffic.
|
|
35
|
+
- Notification recipients of ad-hoc directives gain read access to the
|
|
36
|
+
instance they were notified about.
|
|
37
|
+
- `NotificationService.createAdhocWorkflowNotifications` for ad-hoc
|
|
38
|
+
directive delivery.
|
|
39
|
+
|
|
40
|
+
### Changed
|
|
41
|
+
|
|
42
|
+
- `rejectInstance` now consumes open runtime state (open tokens and tasks,
|
|
43
|
+
including parallel branches and ad-hoc tasks) and supersedes lingering
|
|
44
|
+
actionable notifications, matching the cancel path.
|
|
45
|
+
|
|
46
|
+
## 0.2.0 — 2026-06-04
|
|
47
|
+
|
|
48
|
+
### Breaking
|
|
49
|
+
|
|
50
|
+
- **`forkFormDefinition` is removed** from `FormService` and from the
|
|
51
|
+
GraphQL schema. Form definitions no longer keep a DRAFT version in
|
|
52
|
+
parallel with a published one: before the first publish the single
|
|
53
|
+
draft is updated in place; after publishing, every save publishes a
|
|
54
|
+
brand-new version directly. Callers that previously chained
|
|
55
|
+
`forkFormDefinition` → `updateFormDefinitionDraft` →
|
|
56
|
+
`publishFormDefinitionVersion` should call the new
|
|
57
|
+
`publishFormDefinitionContent` mutation instead.
|
|
58
|
+
- **Parallel drafts are archived by migration.** Migration
|
|
59
|
+
`ArchiveParallelFormDrafts0000000016000` marks every DRAFT version
|
|
60
|
+
whose definition already has a published current version as
|
|
61
|
+
`ARCHIVED`. Their content is preserved in the version history but is
|
|
62
|
+
no longer editable.
|
|
63
|
+
- **`updateFormDefinitionDraft` is now only valid before the first
|
|
64
|
+
publish.** It still rejects non-DRAFT versions with a 409, and after
|
|
65
|
+
this release a published definition never has a DRAFT version to
|
|
66
|
+
update.
|
|
67
|
+
|
|
68
|
+
### Added
|
|
69
|
+
|
|
70
|
+
- **`publishFormDefinitionContent(input, publishedByMemberId?, manager?)`**
|
|
71
|
+
(service + GraphQL mutation + `PublishFormDefinitionContentInput`):
|
|
72
|
+
publishes the given schema/uiSchema as the current version atomically.
|
|
73
|
+
Before the first publish it updates the in-place draft and publishes
|
|
74
|
+
it; afterwards it creates and publishes a brand-new version
|
|
75
|
+
(version + 1). Content identical to the current published version is
|
|
76
|
+
a no-op that returns the current version.
|
|
77
|
+
- **`composeApprovalTemplateWithForm`** (service + GraphQL mutation +
|
|
78
|
+
`ComposeApprovalTemplateWithFormInput` / result object): creates or
|
|
79
|
+
updates a form definition and an approval template draft in one
|
|
80
|
+
transaction, optionally publishing both. Published forms bind through
|
|
81
|
+
`publishFormDefinitionContent`; never-published forms keep their
|
|
82
|
+
in-place draft until publish.
|
|
83
|
+
- **Notification resolution lifecycle.** Actionable task notifications
|
|
84
|
+
(`TASK_ASSIGNED` / `TASK_TRANSFERRED`) now carry a
|
|
85
|
+
`resolution` (`APPROVED` / `REJECTED` / `RETURNED` / `TRANSFERRED` /
|
|
86
|
+
`SUPERSEDED`) and `resolvedAt`. The workflow engine resolves them on
|
|
87
|
+
task decisions and transfers (`NotificationService.resolveTaskNotifications`),
|
|
88
|
+
and migration `BackfillStaleNotificationResolution0000000015000`
|
|
89
|
+
backfills rows created before the wiring existed.
|
|
90
|
+
- **Legacy migration-name reconciliation.**
|
|
91
|
+
`reconcileLegacyMigrationNames(dataSource)` renames stale rows in the
|
|
92
|
+
TypeORM migrations table on boot so renumbered migration classes are
|
|
93
|
+
not re-run against existing databases.
|
|
94
|
+
- Migrations `0000000014000-notification-resolution`,
|
|
95
|
+
`0000000015000-backfill-stale-notification-resolution`, and
|
|
96
|
+
`0000000016000-archive-parallel-form-drafts` — `BPM_CORE_MIGRATIONS`
|
|
97
|
+
now lists 17 classes.
|
|
98
|
+
|
|
99
|
+
### Why a minor
|
|
100
|
+
|
|
101
|
+
Removes `forkFormDefinition` and retires the parallel-draft model —
|
|
102
|
+
breaking under 0.x SemVer conventions (0.1.x → 0.2.0).
|
|
103
|
+
|
|
12
104
|
## 0.1.10 — 2026-05-28
|
|
13
105
|
|
|
14
106
|
### Documentation
|
package/README.md
CHANGED
|
@@ -1282,6 +1282,7 @@ Importing `BPMRootModule` registers GraphQL resolvers for:
|
|
|
1282
1282
|
- Approval templates, template versions, categories, validation, and dry run.
|
|
1283
1283
|
- Workflow instances, tokens, tasks, task candidates, decisions, activity logs,
|
|
1284
1284
|
submit/process/approve/return/cancel/resubmit operations.
|
|
1285
|
+
- Ad-hoc directives — see [Ad-hoc Directives](#ad-hoc-directives) below.
|
|
1285
1286
|
- Delegation rule CRUD and transfer support.
|
|
1286
1287
|
- Notifications, unread counts, preferences, and read status.
|
|
1287
1288
|
- Attachments, signed download URLs, and signed preview URLs.
|
|
@@ -1291,6 +1292,48 @@ The schema is generated by NestJS GraphQL code-first decorators. Configure the
|
|
|
1291
1292
|
host `GraphQLModule` with `autoSchemaFile` if you want NestJS to generate the
|
|
1292
1293
|
schema at runtime.
|
|
1293
1294
|
|
|
1295
|
+
## Ad-hoc Directives
|
|
1296
|
+
|
|
1297
|
+
Stage approvers can attach **instance-scoped** directives to the single
|
|
1298
|
+
approval instance they are deciding — the workflow template is never
|
|
1299
|
+
modified. Four directive types exist (`AdhocDirectiveTypeEnum`):
|
|
1300
|
+
|
|
1301
|
+
| Type | Trigger | Effect |
|
|
1302
|
+
|---|---|---|
|
|
1303
|
+
| `COUNTERSIGN` | Next user task is created | Spawns a parallel ad-hoc task for the target on that stage. The token only advances once the original task **and** every countersign task are approved; a countersigner's rejection rejects the instance. |
|
|
1304
|
+
| `PRE_APPROVAL` | Immediately | Spawns a blocking ad-hoc task on the current stage. `onReject` (`AdhocPreApprovalRejectBehaviorEnum`) chooses `REJECT_INSTANCE` (whole instance rejected) or `RETURN_TO_ORIGIN` (decision handed back to the original approver, re-opening their task if needed). |
|
|
1305
|
+
| `STAGE_NOTIFY` | Current stage ends (approved / rejected / returned) | Notifies the target — members through `NotificationService`, webhooks through `BPM_WORKFLOW_SERVICE_TASK_DISPATCHER`. |
|
|
1306
|
+
| `COMPLETION_NOTIFY` | Instance reaches `APPROVED` / `REJECTED` / `CANCELLED` | Same delivery as `STAGE_NOTIFY`. |
|
|
1307
|
+
|
|
1308
|
+
GraphQL surface: mutations `requestAdhocCountersign(taskId, target, comment?)`,
|
|
1309
|
+
`requestAdhocPreApproval(taskId, target, onReject, comment?)`,
|
|
1310
|
+
`configureAdhocStageNotification(taskId, input)`,
|
|
1311
|
+
`configureAdhocCompletionNotification(taskId, input)`,
|
|
1312
|
+
`cancelAdhocDirective(directiveId)`; query `adhocDirectives(instanceId)`.
|
|
1313
|
+
Every mutation acts as the current auth-context member, who must be the
|
|
1314
|
+
task's assignee or candidate.
|
|
1315
|
+
|
|
1316
|
+
Behavioral contract:
|
|
1317
|
+
|
|
1318
|
+
- Countersign / pre-approval are gated by the node's
|
|
1319
|
+
`UserTaskNodeData.allowAddSigner` flag (template designers opt nodes in);
|
|
1320
|
+
the notification directives have no gate.
|
|
1321
|
+
- `AdhocTargetInput` is polymorphic: `kind` = `MEMBER` (`memberIds`),
|
|
1322
|
+
`POSITION` (`positionId`), `ORG_UNIT_MEMBER` (`orgUnitId`,
|
|
1323
|
+
`includeDescendants?`), or `WEBHOOK` (`webhookUrl`,
|
|
1324
|
+
`webhookHeadersJson?` — notifications only). Member-style signers run
|
|
1325
|
+
through the same delegation pipeline as template-resolved approvers.
|
|
1326
|
+
- Directive lifecycle (`AdhocDirectiveStatusEnum`): `PENDING` → `CONSUMED`
|
|
1327
|
+
when the effect applies, or `CANCELLED` when withdrawn by its creator or
|
|
1328
|
+
dropped by a return / reject / cancel of the instance. Returned instances
|
|
1329
|
+
do not replay flow-affecting directives after resubmission.
|
|
1330
|
+
- Notification recipients gain read access to the instance they were
|
|
1331
|
+
notified about.
|
|
1332
|
+
- Storage: `AdhocDirectiveEntity` (`task_adhoc_directives` table) plus
|
|
1333
|
+
ad-hoc columns on `tasks`, created by migration
|
|
1334
|
+
`AdhocDirectives0000000017000` — included in `BPM_CORE_MIGRATIONS`, so
|
|
1335
|
+
hosts running the bundled migrations pick it up automatically.
|
|
1336
|
+
|
|
1294
1337
|
## Shared Types
|
|
1295
1338
|
|
|
1296
1339
|
Workflow, form, condition, identity, organization, and status contracts live in
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rytass/bpm-core-nestjs-module",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.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",
|
|
@@ -141,7 +141,7 @@
|
|
|
141
141
|
"@nestjs/core": "^11.0.0",
|
|
142
142
|
"@nestjs/graphql": "^13.4.0",
|
|
143
143
|
"@nestjs/typeorm": "^11.0.1",
|
|
144
|
-
"@rytass/bpm-core-shared": "^0.
|
|
144
|
+
"@rytass/bpm-core-shared": "^0.3.0",
|
|
145
145
|
"@rytass/secret-adapter-vault-nestjs": "^0.4.5 || ^0.5.0",
|
|
146
146
|
"express": "^4.0.0 || ^5.0.0",
|
|
147
147
|
"graphql": "^16.0.0",
|
|
@@ -160,6 +160,7 @@
|
|
|
160
160
|
"@rytass/storages": "^0.2.6",
|
|
161
161
|
"@rytass/storages-adapter-local": "^0.2.9",
|
|
162
162
|
"cel-js": "^0.8.2",
|
|
163
|
+
"class-transformer": "^0.5.1",
|
|
163
164
|
"class-validator": "^0.15.1",
|
|
164
165
|
"handlebars": "^4.7.9",
|
|
165
166
|
"nodemailer": "^8.0.7",
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const data_source_1 = require("./data-source");
|
|
4
|
+
const reconcile_legacy_migrations_1 = require("./reconcile-legacy-migrations");
|
|
4
5
|
async function run() {
|
|
5
6
|
const action = process.argv[2] ?? 'run';
|
|
6
7
|
const source = await data_source_1.default;
|
|
@@ -10,6 +11,7 @@ async function run() {
|
|
|
10
11
|
await source.undoLastMigration();
|
|
11
12
|
return;
|
|
12
13
|
}
|
|
14
|
+
await (0, reconcile_legacy_migrations_1.reconcileLegacyMigrationNames)(source);
|
|
13
15
|
await source.runMigrations();
|
|
14
16
|
}
|
|
15
17
|
finally {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migration-runner.js","sourceRoot":"","sources":["../../../../../../libs/bpm-core/src/lib/database/migration-runner.ts"],"names":[],"mappings":";;AAAA,+CAAuC;
|
|
1
|
+
{"version":3,"file":"migration-runner.js","sourceRoot":"","sources":["../../../../../../libs/bpm-core/src/lib/database/migration-runner.ts"],"names":[],"mappings":";;AAAA,+CAAuC;AACvC,+EAA8E;AAE9E,KAAK,UAAU,GAAG;IAChB,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC;IACxC,MAAM,MAAM,GAAG,MAAM,qBAAU,CAAC;IAEhC,MAAM,MAAM,CAAC,UAAU,EAAE,CAAC;IAE1B,IAAI,CAAC;QACH,IAAI,MAAM,KAAK,QAAQ,EAAE,CAAC;YACxB,MAAM,MAAM,CAAC,iBAAiB,EAAE,CAAC;YACjC,OAAO;QACT,CAAC;QAED,MAAM,IAAA,2DAA6B,EAAC,MAAM,CAAC,CAAC;QAC5C,MAAM,MAAM,CAAC,aAAa,EAAE,CAAC;IAC/B,CAAC;YAAS,CAAC;QACT,MAAM,MAAM,CAAC,OAAO,EAAE,CAAC;IACzB,CAAC;AACH,CAAC;AAED,KAAK,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;IAClC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACrB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { DataSource } from 'typeorm';
|
|
2
|
+
/**
|
|
3
|
+
* Rename any legacy-named migration tracking rows to their current class names
|
|
4
|
+
* so `runMigrations()` recognises them as already applied. Idempotent and safe
|
|
5
|
+
* on fresh databases (no `migrations` table yet → no-op) and on
|
|
6
|
+
* already-reconciled databases (target name present → skip).
|
|
7
|
+
*
|
|
8
|
+
* MUST be invoked *before* `DataSource.runMigrations()`, since TypeORM freezes
|
|
9
|
+
* its pending-migration set at the start of that call.
|
|
10
|
+
*
|
|
11
|
+
* @returns the number of tracking rows renamed.
|
|
12
|
+
*/
|
|
13
|
+
export declare function reconcileLegacyMigrationNames(dataSource: DataSource): Promise<number>;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.reconcileLegacyMigrationNames = reconcileLegacyMigrationNames;
|
|
4
|
+
/**
|
|
5
|
+
* Legacy (date-stamped) -> current (sequential) migration class names.
|
|
6
|
+
*
|
|
7
|
+
* Early BPMCore migrations were named with date-based timestamps
|
|
8
|
+
* (`...2026050202000`); they were later renamed to a zero-padded sequential
|
|
9
|
+
* scheme (`...0000000002000`). TypeORM keys idempotency on `migrations.name`,
|
|
10
|
+
* so any database whose `migrations` table still holds the old names would see
|
|
11
|
+
* the renamed classes as *pending* and try to re-run their `up()` — failing on
|
|
12
|
+
* already-existing objects (e.g. duplicate constraints).
|
|
13
|
+
*
|
|
14
|
+
* Each pair maps the exact same migration (same already-applied SQL); only the
|
|
15
|
+
* class name's numeric suffix changed. Reconciling the tracking-table rows is a
|
|
16
|
+
* metadata-only correction — it changes no schema.
|
|
17
|
+
*/
|
|
18
|
+
const LEGACY_MIGRATION_RENAMES = [
|
|
19
|
+
[
|
|
20
|
+
'EnablePostgresExtensions2026043000000',
|
|
21
|
+
'EnablePostgresExtensions0000000000001',
|
|
22
|
+
],
|
|
23
|
+
[
|
|
24
|
+
'IdentityOrganizationFoundation2026043001000',
|
|
25
|
+
'IdentityOrganizationFoundation0000000001000',
|
|
26
|
+
],
|
|
27
|
+
['FormBuilderFoundation2026050202000', 'FormBuilderFoundation0000000002000'],
|
|
28
|
+
[
|
|
29
|
+
'ApprovalTemplateFoundation2026050403000',
|
|
30
|
+
'ApprovalTemplateFoundation0000000003000',
|
|
31
|
+
],
|
|
32
|
+
[
|
|
33
|
+
'WorkflowEngineFoundation2026050404000',
|
|
34
|
+
'WorkflowEngineFoundation0000000004000',
|
|
35
|
+
],
|
|
36
|
+
[
|
|
37
|
+
'ApprovalTemplateCategories2026051208000',
|
|
38
|
+
'ApprovalTemplateCategories0000000008000',
|
|
39
|
+
],
|
|
40
|
+
['TaskCandidates2026051309000', 'TaskCandidates0000000009000'],
|
|
41
|
+
];
|
|
42
|
+
/**
|
|
43
|
+
* Rename any legacy-named migration tracking rows to their current class names
|
|
44
|
+
* so `runMigrations()` recognises them as already applied. Idempotent and safe
|
|
45
|
+
* on fresh databases (no `migrations` table yet → no-op) and on
|
|
46
|
+
* already-reconciled databases (target name present → skip).
|
|
47
|
+
*
|
|
48
|
+
* MUST be invoked *before* `DataSource.runMigrations()`, since TypeORM freezes
|
|
49
|
+
* its pending-migration set at the start of that call.
|
|
50
|
+
*
|
|
51
|
+
* @returns the number of tracking rows renamed.
|
|
52
|
+
*/
|
|
53
|
+
async function reconcileLegacyMigrationNames(dataSource) {
|
|
54
|
+
const tableProbe = (await dataSource.query(`SELECT to_regclass('migrations') AS migrations_table`));
|
|
55
|
+
if (!tableProbe[0]?.migrations_table) {
|
|
56
|
+
return 0;
|
|
57
|
+
}
|
|
58
|
+
return dataSource.transaction(async (manager) => {
|
|
59
|
+
return LEGACY_MIGRATION_RENAMES.reduce(async (countPromise, [legacyName, currentName]) => {
|
|
60
|
+
const count = await countPromise;
|
|
61
|
+
const alreadyCurrent = (await manager.query('SELECT 1 FROM migrations WHERE name = $1 LIMIT 1', [currentName]));
|
|
62
|
+
if (alreadyCurrent.length > 0) {
|
|
63
|
+
return count;
|
|
64
|
+
}
|
|
65
|
+
const result = (await manager.query('UPDATE migrations SET name = $1 WHERE name = $2', [currentName, legacyName]));
|
|
66
|
+
return count + (Number(result[1]) || 0);
|
|
67
|
+
}, Promise.resolve(0));
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=reconcile-legacy-migrations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reconcile-legacy-migrations.js","sourceRoot":"","sources":["../../../../../../libs/bpm-core/src/lib/database/reconcile-legacy-migrations.ts"],"names":[],"mappings":";;AAoDA,sEAkCC;AApFD;;;;;;;;;;;;;GAaG;AACH,MAAM,wBAAwB,GAA6C;IACzE;QACE,uCAAuC;QACvC,uCAAuC;KACxC;IACD;QACE,6CAA6C;QAC7C,6CAA6C;KAC9C;IACD,CAAC,oCAAoC,EAAE,oCAAoC,CAAC;IAC5E;QACE,yCAAyC;QACzC,yCAAyC;KAC1C;IACD;QACE,uCAAuC;QACvC,uCAAuC;KACxC;IACD;QACE,yCAAyC;QACzC,yCAAyC;KAC1C;IACD,CAAC,6BAA6B,EAAE,6BAA6B,CAAC;CAC/D,CAAC;AAEF;;;;;;;;;;GAUG;AACI,KAAK,UAAU,6BAA6B,CACjD,UAAsB;IAEtB,MAAM,UAAU,GAAG,CAAC,MAAM,UAAU,CAAC,KAAK,CACxC,sDAAsD,CACvD,CAA4D,CAAC;IAE9D,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,gBAAgB,EAAE,CAAC;QACrC,OAAO,CAAC,CAAC;IACX,CAAC;IAED,OAAO,UAAU,CAAC,WAAW,CAAC,KAAK,EAAE,OAAO,EAAmB,EAAE;QAC/D,OAAO,wBAAwB,CAAC,MAAM,CACpC,KAAK,EAAE,YAAY,EAAE,CAAC,UAAU,EAAE,WAAW,CAAC,EAAmB,EAAE;YACjE,MAAM,KAAK,GAAG,MAAM,YAAY,CAAC;YACjC,MAAM,cAAc,GAAG,CAAC,MAAM,OAAO,CAAC,KAAK,CACzC,kDAAkD,EAClD,CAAC,WAAW,CAAC,CACd,CAAuB,CAAC;YAEzB,IAAI,cAAc,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC9B,OAAO,KAAK,CAAC;YACf,CAAC;YAED,MAAM,MAAM,GAAG,CAAC,MAAM,OAAO,CAAC,KAAK,CACjC,iDAAiD,EACjD,CAAC,WAAW,EAAE,UAAU,CAAC,CAC1B,CAA+B,CAAC;YAEjC,OAAO,KAAK,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;QAC1C,CAAC,EACD,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CACnB,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -15,6 +15,11 @@ export declare class UpdateFormDefinitionDraftInput {
|
|
|
15
15
|
schemaJson: string;
|
|
16
16
|
uiSchemaJson: string;
|
|
17
17
|
}
|
|
18
|
+
export declare class PublishFormDefinitionContentInput {
|
|
19
|
+
formDefinitionId: string;
|
|
20
|
+
schemaJson: string | null;
|
|
21
|
+
uiSchemaJson: string | null;
|
|
22
|
+
}
|
|
18
23
|
export declare class LintFormSchemaInput {
|
|
19
24
|
schemaJson: string;
|
|
20
25
|
uiSchemaJson: string | null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LintFormSchemaInput = exports.UpdateFormDefinitionDraftInput = exports.UpdateFormDefinitionInput = exports.CreateFormDefinitionInput = void 0;
|
|
3
|
+
exports.LintFormSchemaInput = exports.PublishFormDefinitionContentInput = exports.UpdateFormDefinitionDraftInput = exports.UpdateFormDefinitionInput = exports.CreateFormDefinitionInput = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const graphql_1 = require("@nestjs/graphql");
|
|
6
6
|
const class_validator_1 = require("class-validator");
|
|
@@ -83,6 +83,29 @@ tslib_1.__decorate([
|
|
|
83
83
|
exports.UpdateFormDefinitionDraftInput = UpdateFormDefinitionDraftInput = tslib_1.__decorate([
|
|
84
84
|
(0, graphql_1.InputType)()
|
|
85
85
|
], UpdateFormDefinitionDraftInput);
|
|
86
|
+
let PublishFormDefinitionContentInput = class PublishFormDefinitionContentInput {
|
|
87
|
+
};
|
|
88
|
+
exports.PublishFormDefinitionContentInput = PublishFormDefinitionContentInput;
|
|
89
|
+
tslib_1.__decorate([
|
|
90
|
+
(0, graphql_1.Field)(() => graphql_1.ID),
|
|
91
|
+
(0, class_validator_1.IsUUID)(),
|
|
92
|
+
tslib_1.__metadata("design:type", String)
|
|
93
|
+
], PublishFormDefinitionContentInput.prototype, "formDefinitionId", void 0);
|
|
94
|
+
tslib_1.__decorate([
|
|
95
|
+
(0, graphql_1.Field)(() => String, { nullable: true }),
|
|
96
|
+
(0, class_validator_1.IsOptional)(),
|
|
97
|
+
(0, class_validator_1.IsString)(),
|
|
98
|
+
tslib_1.__metadata("design:type", Object)
|
|
99
|
+
], PublishFormDefinitionContentInput.prototype, "schemaJson", void 0);
|
|
100
|
+
tslib_1.__decorate([
|
|
101
|
+
(0, graphql_1.Field)(() => String, { nullable: true }),
|
|
102
|
+
(0, class_validator_1.IsOptional)(),
|
|
103
|
+
(0, class_validator_1.IsString)(),
|
|
104
|
+
tslib_1.__metadata("design:type", Object)
|
|
105
|
+
], PublishFormDefinitionContentInput.prototype, "uiSchemaJson", void 0);
|
|
106
|
+
exports.PublishFormDefinitionContentInput = PublishFormDefinitionContentInput = tslib_1.__decorate([
|
|
107
|
+
(0, graphql_1.InputType)()
|
|
108
|
+
], PublishFormDefinitionContentInput);
|
|
86
109
|
let LintFormSchemaInput = class LintFormSchemaInput {
|
|
87
110
|
};
|
|
88
111
|
exports.LintFormSchemaInput = LintFormSchemaInput;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-definition.input.js","sourceRoot":"","sources":["../../../../../../../libs/bpm-core/src/lib/form/dto/form-definition.input.ts"],"names":[],"mappings":";;;;AAAA,6CAAuD;AACvD,qDAA+D;AAGxD,IAAM,yBAAyB,GAA/B,MAAM,yBAAyB;CAwBrC,CAAA;AAxBY,8DAAyB;AAGpC;IAFC,IAAA,eAAK,GAAE;IACP,IAAA,0BAAQ,GAAE;;uDACG;AAKd;IAHC,IAAA,eAAK,EAAC,GAAG,EAAE,CAAC,MAAM,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IACvC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;8DACiB;AAK5B;IAHC,IAAA,eAAK,EAAC,GAAG,EAAE,CAAC,MAAM,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IACvC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;oEACuB;AAKlC;IAHC,IAAA,eAAK,EAAC,GAAG,EAAE,CAAC,MAAM,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IACvC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BA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E;IACP,IAAA,0BAAQ,GAAE;;uDACS;AAKpB;IAHC,IAAA,eAAK,EAAC,GAAG,EAAE,CAAC,MAAM,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IACvC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;yDACkB;8BARlB,mBAAmB;IAD/B,IAAA,mBAAS,GAAE;GACC,mBAAmB,CAS/B"}
|
|
1
|
+
{"version":3,"file":"form-definition.input.js","sourceRoot":"","sources":["../../../../../../../libs/bpm-core/src/lib/form/dto/form-definition.input.ts"],"names":[],"mappings":";;;;AAAA,6CAAuD;AACvD,qDAA+D;AAGxD,IAAM,yBAAyB,GAA/B,MAAM,yBAAyB;CAwBrC,CAAA;AAxBY,8DAAyB;AAGpC;IAFC,IAAA,eAAK,GAAE;IACP,IAAA,0BAAQ,GAAE;;uDACG;AAKd;IAHC,IAAA,eAAK,EAAC,GAAG,EAAE,CAAC,MAAM,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IACvC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;8DACiB;AAK5B;IAHC,IAAA,eAAK,EAAC,GAAG,EAAE,CAAC,MAAM,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IACvC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;oEACuB;AAKlC;IAHC,IAAA,eAAK,EAAC,GAAG,EAAE,CAAC,MAAM,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IACvC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;6DACgB;AAK3B;IAHC,IAAA,eAAK,EAAC,GAAG,EAAE,CAAC,MAAM,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IACvC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;+DACkB;oCAvBlB,yBAAyB;IADrC,IAAA,mBAAS,GAAE;GACC,yBAAyB,CAwB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AAA,eAAK,EAAC,GAAG,EAAE,CAAC,MAAM,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IACvC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;uEACkB;4CAblB,iCAAiC;IAD7C,IAAA,mBAAS,GAAE;GACC,iCAAiC,CAc7C;AAGM,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;CAS/B,CAAA;AATY,kDAAmB;AAG9B;IAFC,IAAA,eAAK,GAAE;IACP,IAAA,0BAAQ,GAAE;;uDACS;AAKpB;IAHC,IAAA,eAAK,EAAC,GAAG,EAAE,CAAC,MAAM,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IACvC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;yDACkB;8BARlB,mBAAmB;IAD/B,IAAA,mBAAS,GAAE;GACC,mBAAmB,CAS/B"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { FormDefinitionEntity } from './form-definition.entity';
|
|
2
2
|
import { FormDefinitionVersionEntity } from './form-definition-version.entity';
|
|
3
3
|
import { FormService } from './form.service';
|
|
4
|
-
import { CreateFormDefinitionInput, UpdateFormDefinitionDraftInput, UpdateFormDefinitionInput } from './dto/form-definition.input';
|
|
4
|
+
import { CreateFormDefinitionInput, PublishFormDefinitionContentInput, UpdateFormDefinitionDraftInput, UpdateFormDefinitionInput } from './dto/form-definition.input';
|
|
5
5
|
export declare class FormMutations {
|
|
6
6
|
private readonly formService;
|
|
7
7
|
constructor(formService: FormService);
|
|
8
8
|
createFormDefinition(input: CreateFormDefinitionInput, currentMemberId: string): Promise<FormDefinitionEntity>;
|
|
9
9
|
updateFormDefinition(input: UpdateFormDefinitionInput): Promise<FormDefinitionEntity>;
|
|
10
10
|
updateFormDefinitionDraft(input: UpdateFormDefinitionDraftInput): Promise<FormDefinitionVersionEntity>;
|
|
11
|
-
|
|
11
|
+
publishFormDefinitionContent(input: PublishFormDefinitionContentInput, currentMemberId: string): Promise<FormDefinitionVersionEntity>;
|
|
12
12
|
publishFormDefinitionVersion(versionId: string, _publishedByMemberId: string | null | undefined, currentMemberId: string): Promise<FormDefinitionVersionEntity>;
|
|
13
13
|
rollbackFormDefinitionVersion(versionId: string): Promise<FormDefinitionVersionEntity>;
|
|
14
14
|
}
|
|
@@ -24,8 +24,8 @@ let FormMutations = class FormMutations {
|
|
|
24
24
|
async updateFormDefinitionDraft(input) {
|
|
25
25
|
return this.formService.updateFormDefinitionDraft(input);
|
|
26
26
|
}
|
|
27
|
-
async
|
|
28
|
-
return this.formService.
|
|
27
|
+
async publishFormDefinitionContent(input, currentMemberId) {
|
|
28
|
+
return this.formService.publishFormDefinitionContent(input, currentMemberId);
|
|
29
29
|
}
|
|
30
30
|
async publishFormDefinitionVersion(versionId, _publishedByMemberId, currentMemberId) {
|
|
31
31
|
return this.formService.publishFormDefinitionVersion(versionId, currentMemberId);
|
|
@@ -59,11 +59,12 @@ tslib_1.__decorate([
|
|
|
59
59
|
], FormMutations.prototype, "updateFormDefinitionDraft", null);
|
|
60
60
|
tslib_1.__decorate([
|
|
61
61
|
(0, graphql_1.Mutation)(() => form_definition_version_entity_1.FormDefinitionVersionEntity),
|
|
62
|
-
tslib_1.__param(0, (0, graphql_1.Args)('
|
|
62
|
+
tslib_1.__param(0, (0, graphql_1.Args)('input')),
|
|
63
|
+
tslib_1.__param(1, (0, bpm_auth_1.BPMCurrentMemberId)()),
|
|
63
64
|
tslib_1.__metadata("design:type", Function),
|
|
64
|
-
tslib_1.__metadata("design:paramtypes", [String]),
|
|
65
|
+
tslib_1.__metadata("design:paramtypes", [form_definition_input_1.PublishFormDefinitionContentInput, String]),
|
|
65
66
|
tslib_1.__metadata("design:returntype", Promise)
|
|
66
|
-
], FormMutations.prototype, "
|
|
67
|
+
], FormMutations.prototype, "publishFormDefinitionContent", null);
|
|
67
68
|
tslib_1.__decorate([
|
|
68
69
|
(0, graphql_1.Mutation)(() => form_definition_version_entity_1.FormDefinitionVersionEntity),
|
|
69
70
|
tslib_1.__param(0, (0, graphql_1.Args)('versionId', { type: () => String })),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form.mutations.js","sourceRoot":"","sources":["../../../../../../libs/bpm-core/src/lib/form/form.mutations.ts"],"names":[],"mappings":";;;;AAAA,6CAA2D;AAC3D,0CAAkE;AAClE,qEAAgE;AAChE,qFAA+E;AAC/E,iDAA6C;AAC7C,
|
|
1
|
+
{"version":3,"file":"form.mutations.js","sourceRoot":"","sources":["../../../../../../libs/bpm-core/src/lib/form/form.mutations.ts"],"names":[],"mappings":";;;;AAAA,6CAA2D;AAC3D,0CAAkE;AAClE,qEAAgE;AAChE,qFAA+E;AAC/E,iDAA6C;AAC7C,uEAKqC;AAI9B,IAAM,aAAa,GAAnB,MAAM,aAAa;IACxB,YAA6B,WAAwB;QAAxB,gBAAW,GAAX,WAAW,CAAa;IAAG,CAAC;IAGnD,AAAN,KAAK,CAAC,oBAAoB,CACT,KAAgC,EACzB,eAAuB;QAE7C,OAAO,IAAI,CAAC,WAAW,CAAC,oBAAoB,CAAC;YAC3C,GAAG,KAAK;YACR,iBAAiB,EAAE,eAAe;SACnC,CAAC,CAAC;IACL,CAAC;IAGK,AAAN,KAAK,CAAC,oBAAoB,CACT,KAAgC;QAE/C,OAAO,IAAI,CAAC,WAAW,CAAC,oBAAoB,CAAC,KAAK,CAAC,CAAC;IACtD,CAAC;IAGK,AAAN,KAAK,CAAC,yBAAyB,CACd,KAAqC;QAEpD,OAAO,IAAI,CAAC,WAAW,CAAC,yBAAyB,CAAC,KAAK,CAAC,CAAC;IAC3D,CAAC;IAGK,AAAN,KAAK,CAAC,4BAA4B,CACjB,KAAwC,EACjC,eAAuB;QAE7C,OAAO,IAAI,CAAC,WAAW,CAAC,4BAA4B,CAClD,KAAK,EACL,eAAe,CAChB,CAAC;IACJ,CAAC;IAGK,AAAN,KAAK,CAAC,4BAA4B,CACW,SAAiB,EAE5D,oBAA+C,EACzB,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;;iEAMtB;AAGK;IADL,IAAA,kBAAQ,EAAC,GAAG,EAAE,CAAC,4DAA2B,CAAC;IAEzC,mBAAA,IAAA,cAAI,EAAC,WAAW,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,MAAM,EAAE,CAAC,CAAA;;;;kEAG3C;wBAzDU,aAAa;IAFzB,IAAA,kBAAQ,GAAE;IACV,IAAA,0BAAe,GAAE;6CAE0B,0BAAW;GAD1C,aAAa,CA0DzB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Repository } from 'typeorm';
|
|
1
|
+
import { EntityManager, Repository } from 'typeorm';
|
|
2
2
|
import { FormDefinitionEntity } from './form-definition.entity';
|
|
3
3
|
import { FormDefinitionVersionEntity } from './form-definition-version.entity';
|
|
4
|
-
import { CreateFormDefinitionInput, LintFormSchemaInput, UpdateFormDefinitionDraftInput, UpdateFormDefinitionInput } from './dto/form-definition.input';
|
|
4
|
+
import { CreateFormDefinitionInput, LintFormSchemaInput, PublishFormDefinitionContentInput, UpdateFormDefinitionDraftInput, UpdateFormDefinitionInput } from './dto/form-definition.input';
|
|
5
5
|
import { FormDefinitionListStatusEnum } from './form.enums';
|
|
6
6
|
import { FormSchemaLintResultObject } from './form-schema-lint.object';
|
|
7
7
|
interface ListFormDefinitionsOptions {
|
|
@@ -13,18 +13,32 @@ export declare class FormService {
|
|
|
13
13
|
private readonly formDefinitionRepository;
|
|
14
14
|
private readonly formDefinitionVersionRepository;
|
|
15
15
|
constructor(formDefinitionRepository: Repository<FormDefinitionEntity>, formDefinitionVersionRepository: Repository<FormDefinitionVersionEntity>);
|
|
16
|
-
createFormDefinition(input: CreateFormDefinitionInput): Promise<FormDefinitionEntity>;
|
|
16
|
+
createFormDefinition(input: CreateFormDefinitionInput, manager?: EntityManager): Promise<FormDefinitionEntity>;
|
|
17
|
+
private createFormDefinitionWithManager;
|
|
17
18
|
updateFormDefinition(input: UpdateFormDefinitionInput): Promise<FormDefinitionEntity>;
|
|
18
19
|
listFormDefinitions(options?: ListFormDefinitionsOptions): Promise<readonly FormDefinitionEntity[]>;
|
|
19
20
|
countFormDefinitions(status?: FormDefinitionListStatusEnum): Promise<number>;
|
|
20
21
|
getFormDefinition(id: string): Promise<FormDefinitionEntity>;
|
|
21
22
|
listFormDefinitionVersions(formDefinitionId: string): Promise<readonly FormDefinitionVersionEntity[]>;
|
|
22
23
|
getFormDefinitionVersion(id: string): Promise<FormDefinitionVersionEntity>;
|
|
23
|
-
updateFormDefinitionDraft(input: UpdateFormDefinitionDraftInput): Promise<FormDefinitionVersionEntity>;
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
updateFormDefinitionDraft(input: UpdateFormDefinitionDraftInput, manager?: EntityManager): Promise<FormDefinitionVersionEntity>;
|
|
25
|
+
/**
|
|
26
|
+
* Publishes the given form content as the current version atomically.
|
|
27
|
+
*
|
|
28
|
+
* Form definitions do not keep a draft in parallel with a published
|
|
29
|
+
* version: before the first publish the single draft is updated in place
|
|
30
|
+
* and published; afterwards every save publishes a brand-new version
|
|
31
|
+
* (version + 1) directly. Saving content identical to the current
|
|
32
|
+
* published version is a no-op that returns the current version.
|
|
33
|
+
*/
|
|
34
|
+
publishFormDefinitionContent(input: PublishFormDefinitionContentInput, publishedByMemberId?: string, manager?: EntityManager): Promise<FormDefinitionVersionEntity>;
|
|
35
|
+
findDraftVersion(formDefinitionId: string, manager?: EntityManager): Promise<FormDefinitionVersionEntity | null>;
|
|
36
|
+
publishFormDefinitionVersion(versionId: string, publishedByMemberId?: string, manager?: EntityManager): Promise<FormDefinitionVersionEntity>;
|
|
37
|
+
private publishFormDefinitionVersionWithManager;
|
|
26
38
|
rollbackFormDefinitionVersion(versionId: string): Promise<FormDefinitionVersionEntity>;
|
|
27
39
|
lintFormSchema(input: LintFormSchemaInput): FormSchemaLintResultObject;
|
|
40
|
+
private formDefinitions;
|
|
41
|
+
private formVersions;
|
|
28
42
|
private getFormDefinitionOrThrow;
|
|
29
43
|
private hydrateCurrentVersions;
|
|
30
44
|
private hydrateCurrentVersion;
|