@rytass/bpm-core-nestjs-module 0.1.9 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/CHANGELOG.md +82 -0
  2. package/README.md +64 -2
  3. package/package.json +2 -2
  4. package/src/lib/database/migration-runner.js +2 -0
  5. package/src/lib/database/migration-runner.js.map +1 -1
  6. package/src/lib/database/reconcile-legacy-migrations.d.ts +13 -0
  7. package/src/lib/database/reconcile-legacy-migrations.js +70 -0
  8. package/src/lib/database/reconcile-legacy-migrations.js.map +1 -0
  9. package/src/lib/form/dto/form-definition.input.d.ts +5 -0
  10. package/src/lib/form/dto/form-definition.input.js +24 -1
  11. package/src/lib/form/dto/form-definition.input.js.map +1 -1
  12. package/src/lib/form/form.mutations.d.ts +2 -2
  13. package/src/lib/form/form.mutations.js +6 -5
  14. package/src/lib/form/form.mutations.js.map +1 -1
  15. package/src/lib/form/form.service.d.ts +20 -6
  16. package/src/lib/form/form.service.js +129 -80
  17. package/src/lib/form/form.service.js.map +1 -1
  18. package/src/lib/migrations/0000000014000-notification-resolution.d.ts +6 -0
  19. package/src/lib/migrations/0000000014000-notification-resolution.js +30 -0
  20. package/src/lib/migrations/0000000014000-notification-resolution.js.map +1 -0
  21. package/src/lib/migrations/0000000015000-backfill-stale-notification-resolution.d.ts +15 -0
  22. package/src/lib/migrations/0000000015000-backfill-stale-notification-resolution.js +37 -0
  23. package/src/lib/migrations/0000000015000-backfill-stale-notification-resolution.js.map +1 -0
  24. package/src/lib/migrations/0000000016000-archive-parallel-form-drafts.d.ts +15 -0
  25. package/src/lib/migrations/0000000016000-archive-parallel-form-drafts.js +34 -0
  26. package/src/lib/migrations/0000000016000-archive-parallel-form-drafts.js.map +1 -0
  27. package/src/lib/migrations/index.d.ts +3 -0
  28. package/src/lib/migrations/index.js +9 -0
  29. package/src/lib/migrations/index.js.map +1 -1
  30. package/src/lib/notification/notification.entity.d.ts +9 -1
  31. package/src/lib/notification/notification.entity.js +27 -0
  32. package/src/lib/notification/notification.entity.js.map +1 -1
  33. package/src/lib/notification/notification.enums.d.ts +14 -0
  34. package/src/lib/notification/notification.enums.js +19 -1
  35. package/src/lib/notification/notification.enums.js.map +1 -1
  36. package/src/lib/notification/notification.service.d.ts +26 -0
  37. package/src/lib/notification/notification.service.js +62 -0
  38. package/src/lib/notification/notification.service.js.map +1 -1
  39. package/src/lib/template/compose-approval-template.object.d.ts +11 -0
  40. package/src/lib/template/compose-approval-template.object.js +36 -0
  41. package/src/lib/template/compose-approval-template.object.js.map +1 -0
  42. package/src/lib/template/compose-template.mutations.d.ts +8 -0
  43. package/src/lib/template/compose-template.mutations.js +32 -0
  44. package/src/lib/template/compose-template.mutations.js.map +1 -0
  45. package/src/lib/template/dto/compose-approval-template.input.d.ts +17 -0
  46. package/src/lib/template/dto/compose-approval-template.input.js +99 -0
  47. package/src/lib/template/dto/compose-approval-template.input.js.map +1 -0
  48. package/src/lib/template/index.d.ts +2 -0
  49. package/src/lib/template/index.js +2 -0
  50. package/src/lib/template/index.js.map +1 -1
  51. package/src/lib/template/template.module.js +9 -1
  52. package/src/lib/template/template.module.js.map +1 -1
  53. package/src/lib/template/template.service.d.ts +25 -6
  54. package/src/lib/template/template.service.js +216 -83
  55. package/src/lib/template/template.service.js.map +1 -1
  56. package/src/lib/workflow-engine/workflow-engine.service.js +37 -0
  57. package/src/lib/workflow-engine/workflow-engine.service.js.map +1 -1
package/CHANGELOG.md CHANGED
@@ -9,6 +9,88 @@ 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.2.0 — 2026-06-04
13
+
14
+ ### Breaking
15
+
16
+ - **`forkFormDefinition` is removed** from `FormService` and from the
17
+ GraphQL schema. Form definitions no longer keep a DRAFT version in
18
+ parallel with a published one: before the first publish the single
19
+ draft is updated in place; after publishing, every save publishes a
20
+ brand-new version directly. Callers that previously chained
21
+ `forkFormDefinition` → `updateFormDefinitionDraft` →
22
+ `publishFormDefinitionVersion` should call the new
23
+ `publishFormDefinitionContent` mutation instead.
24
+ - **Parallel drafts are archived by migration.** Migration
25
+ `ArchiveParallelFormDrafts0000000016000` marks every DRAFT version
26
+ whose definition already has a published current version as
27
+ `ARCHIVED`. Their content is preserved in the version history but is
28
+ no longer editable.
29
+ - **`updateFormDefinitionDraft` is now only valid before the first
30
+ publish.** It still rejects non-DRAFT versions with a 409, and after
31
+ this release a published definition never has a DRAFT version to
32
+ update.
33
+
34
+ ### Added
35
+
36
+ - **`publishFormDefinitionContent(input, publishedByMemberId?, manager?)`**
37
+ (service + GraphQL mutation + `PublishFormDefinitionContentInput`):
38
+ publishes the given schema/uiSchema as the current version atomically.
39
+ Before the first publish it updates the in-place draft and publishes
40
+ it; afterwards it creates and publishes a brand-new version
41
+ (version + 1). Content identical to the current published version is
42
+ a no-op that returns the current version.
43
+ - **`composeApprovalTemplateWithForm`** (service + GraphQL mutation +
44
+ `ComposeApprovalTemplateWithFormInput` / result object): creates or
45
+ updates a form definition and an approval template draft in one
46
+ transaction, optionally publishing both. Published forms bind through
47
+ `publishFormDefinitionContent`; never-published forms keep their
48
+ in-place draft until publish.
49
+ - **Notification resolution lifecycle.** Actionable task notifications
50
+ (`TASK_ASSIGNED` / `TASK_TRANSFERRED`) now carry a
51
+ `resolution` (`APPROVED` / `REJECTED` / `RETURNED` / `TRANSFERRED` /
52
+ `SUPERSEDED`) and `resolvedAt`. The workflow engine resolves them on
53
+ task decisions and transfers (`NotificationService.resolveTaskNotifications`),
54
+ and migration `BackfillStaleNotificationResolution0000000015000`
55
+ backfills rows created before the wiring existed.
56
+ - **Legacy migration-name reconciliation.**
57
+ `reconcileLegacyMigrationNames(dataSource)` renames stale rows in the
58
+ TypeORM migrations table on boot so renumbered migration classes are
59
+ not re-run against existing databases.
60
+ - Migrations `0000000014000-notification-resolution`,
61
+ `0000000015000-backfill-stale-notification-resolution`, and
62
+ `0000000016000-archive-parallel-form-drafts` — `BPM_CORE_MIGRATIONS`
63
+ now lists 17 classes.
64
+
65
+ ### Why a minor
66
+
67
+ Removes `forkFormDefinition` and retires the parallel-draft model —
68
+ breaking under 0.x SemVer conventions (0.1.x → 0.2.0).
69
+
70
+ ## 0.1.10 — 2026-05-28
71
+
72
+ ### Documentation
73
+
74
+ - **Pattern A response status contract table** added — explicit success
75
+ / auth-fail / validation-fail HTTP status codes for `/auth/login`,
76
+ `/auth/me`, `/auth/logout`. Also notes that `roles` and `permissions`
77
+ must be arrays (not `null`/`undefined`), and shows the
78
+ `projectMemberToApiMember` skeleton mapping `ApiMember.email: string`
79
+ (not `string | null`).
80
+ - **"Concrete wiring" snippet** for the recommended same-database
81
+ separate-schema option B: dual `TypeOrmModule.forRootAsync` with
82
+ `name: 'bpm'` so the host's existing connection and BPM's stay
83
+ isolated. Also shows handing `typeormConnectionName: 'bpm'` to
84
+ `BPMRootModule.forRootAsync`.
85
+ - **`createBPMMemberBaseResolverProvider<HostMember>` generic** added
86
+ to the README example with a callout about why omitting it causes
87
+ TS to infer `unknown`.
88
+ - "Current version" line refreshed to `0.1.10`.
89
+
90
+ ### Why a patch
91
+
92
+ Documentation only.
93
+
12
94
  ## 0.1.9 — 2026-05-28
13
95
 
14
96
  ### Documentation
package/README.md CHANGED
@@ -14,7 +14,7 @@ directory integration, storage adapters, and deployment.
14
14
 
15
15
  ## Package Status
16
16
 
17
- Current version: `0.1.7`
17
+ Current version: `0.1.10`
18
18
 
19
19
  The package is intended for NestJS backend hosts. It does not include the
20
20
  Next.js backoffice UI and does not provide a production auth system by itself.
@@ -273,6 +273,31 @@ member shape to BPM's expectations, project Casbin roles into the BPM
273
273
  role-literal strings (see "Mapping from a host RBAC system" below),
274
274
  and compute `expiresAt` from the token TTL.
275
275
 
276
+ ```ts
277
+ function projectMemberToApiMember(member: HostMember): ApiMember {
278
+ return {
279
+ memberId: member.id,
280
+ email: member.email ?? '', // ApiMember.email is `string`, not `string | null`
281
+ name: member.name,
282
+ roles: projectHostRolesToBPMRoles(member.roles), // [] if no admin/designer claim
283
+ permissions: [], // optional — return [] if not used
284
+ expiresAt: new Date(Date.now() + JWT_TTL_MS).toISOString(),
285
+ };
286
+ }
287
+ ```
288
+
289
+ Response status contract that BPM's React client expects:
290
+
291
+ | Endpoint | Success | Auth fail | Validation fail |
292
+ |---|---|---|---|
293
+ | `POST /auth/login` | `200` + `ApiMember` JSON, set HTTP-only cookie | `401` | `400` |
294
+ | `GET /auth/me` | `200` + `ApiMember` JSON | `401` (client treats as anonymous, **not error**) | n/a |
295
+ | `POST /auth/logout` | `204` (or `200` with empty body) | `401` ignored — client clears local state anyway | n/a |
296
+
297
+ `roles` and `permissions` MUST be arrays (use `[]` for no claim), not
298
+ `null` or `undefined` — the React client's `member.roles.includes(...)`
299
+ checks would crash otherwise.
300
+
276
301
  #### Pattern B — Run BPM on a separate auth host
277
302
 
278
303
  When BPM lives on its own subdomain (e.g. `bpm.example.com`) separate
@@ -531,7 +556,10 @@ export const hostMemberProviders: readonly Provider[] = [
531
556
  provide: HOST_MEMBER_DIRECTORY,
532
557
  useClass: HostMemberDirectory,
533
558
  },
534
- createBPMMemberBaseResolverProvider({
559
+ createBPMMemberBaseResolverProvider<HostMember>({
560
+ // ^^^^^^^^^^^^ explicit generic is recommended — without it,
561
+ // TS infers `unknown` for the adapter callbacks below and you get
562
+ // "Parameter 'member' implicitly has an 'any' type" errors.
535
563
  adapterOptions: {
536
564
  readEmail: (member): string => member.email,
537
565
  readMemberId: (member): string => member.id,
@@ -910,6 +938,40 @@ BPM's `buildTypeOrmModuleOptions` create **two distinct connections**
910
938
  to the same Postgres cluster with different `schema:` settings — that
911
939
  is the cleanest separation Nest's TypeORM module supports.
912
940
 
941
+ Concrete wiring:
942
+
943
+ ```ts
944
+ // apps/api/src/app/app.module.ts
945
+ @Module({
946
+ imports: [
947
+ // Host's existing TypeORM connection (default name, host's schema).
948
+ TypeOrmModule.forRootAsync({
949
+ imports: [HostVaultModule],
950
+ inject: [HostVaultService],
951
+ useFactory: (vault) => buildHostDataSourceOptions(vault), // schema: 'public'
952
+ }),
953
+ // BPM's own connection (named, separate schema, separate Vault path).
954
+ TypeOrmModule.forRootAsync({
955
+ name: 'bpm', // <-- distinct connection name
956
+ imports: [BPMVaultModule],
957
+ inject: [BPMVaultService],
958
+ useFactory: buildTypeOrmModuleOptions, // reads DB_SCHEMA=bpm_core from Vault
959
+ }),
960
+ // Hand BPM the connection name so its repositories bind to the right pool.
961
+ BPMRootModule.forRootAsync({
962
+ typeormConnectionName: 'bpm',
963
+ // ...
964
+ }),
965
+ ],
966
+ })
967
+ ```
968
+
969
+ If the host runs only one Vault path (e.g. `shuttle/develop`) and you
970
+ want to keep secrets there, expose `bpm_core/*` keys under the host
971
+ path with a prefix and provide a custom factory that reads them — BPM
972
+ doesn't require its own Vault path, only that the secrets are
973
+ available to `buildTypeOrmModuleOptions`.
974
+
913
975
  Vault paths can be split independently: keep `shuttle/develop` for the
914
976
  host and create `bpm_core/develop` for BPM secrets. BPM's helper reads
915
977
  its own path; the host's auth module reads its own. They do not
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rytass/bpm-core-nestjs-module",
3
- "version": "0.1.9",
3
+ "version": "0.2.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.1.9",
144
+ "@rytass/bpm-core-shared": "^0.2.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",
@@ -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;AAEvC,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,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"}
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;;uDAC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yB,CAcrC;AAGM,IAAM,8BAA8B,GAApC,MAAM,8BAA8B;CAY1C,CAAA;AAZY,wEAA8B;AAGzC;IAFC,IAAA,eAAK,EAAC,GAAG,EAAE,CAAC,YAAE,CAAC;IACf,IAAA,wBAAM,GAAE;;iEACU;AAInB;IAFC,IAAA,eAAK,GAAE;IACP,IAAA,0BAAQ,GAAE;;kEACS;AAIpB;IAFC,IAAA,eAAK,GAAE;IACP,IAAA,0BAAQ,GAAE;;oEACW;yCAXX,8BAA8B;IAD1C,IAAA,mBAAS,GAAE;GACC,8BAA8B,CAY1C;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
+ {"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,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,IAAA,eAAK,GAAE;IACP,IAAA,0BAAQ,GAAE;;oEACW;yCAXX,8BAA8B;IAD1C,IAAA,mBAAS,GAAE;GACC,8BAA8B,CAY1C;AAGM,IAAM,iCAAiC,GAAvC,MAAM,iCAAiC;CAc7C,CAAA;AAdY,8EAAiC;AAG5C;IAFC,IAAA,eAAK,EAAC,GAAG,EAAE,CAAC,YAAE,CAAC;IACf,IAAA,wBAAM,GAAE;;2EACiB;AAK1B;IAHC,IAAA,eAAK,EAAC,GAAG,EAAE,CAAC,MAAM,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IACvC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;qEACgB;AAK3B;IAHC,IAAA,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
- forkFormDefinition(formDefinitionId: string): Promise<FormDefinitionVersionEntity>;
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 forkFormDefinition(formDefinitionId) {
28
- return this.formService.forkFormDefinition(formDefinitionId);
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)('formDefinitionId', { type: () => String })),
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, "forkFormDefinition", null);
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,uEAIqC;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,kBAAkB,CAC4B,gBAAwB;QAE1E,OAAO,IAAI,CAAC,WAAW,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,CAAC;IAC/D,CAAC;IAGK,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AE,CAAC,MAAM,EAAE,CAAC,CAAA;IAEnE,mBAAA,IAAA,6BAAkB,GAAE,CAAA;;;;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
- forkFormDefinition(formDefinitionId: string): Promise<FormDefinitionVersionEntity>;
25
- publishFormDefinitionVersion(versionId: string, publishedByMemberId?: string): Promise<FormDefinitionVersionEntity>;
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;