nucleus-core-ts 0.10.47 → 0.10.49

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.
@@ -0,0 +1,18 @@
1
+ import type { NodePgDatabase } from 'drizzle-orm/node-postgres';
2
+ /**
3
+ * Is this row currently going through an approval chain?
4
+ *
5
+ * The verification tables address their subject polymorphically — `entity_name`
6
+ * plus `entity_id`, no foreign key — so the database cannot refuse a delete the
7
+ * way `pages.product_id` can. Nothing stopped a row from being removed out from
8
+ * under a running instance, and nothing noticed afterwards: measured on a
9
+ * pharmaceutical-leaflet install, deleting a page version that was awaiting
10
+ * review answered 200, the row went, and the instance stayed `active` with a
11
+ * pending requirement pointing at an id that no longer resolves. The reviewer
12
+ * keeps seeing work they can never finish, for a document that is gone.
13
+ *
14
+ * So the check lives where the delete is. It is deliberately narrow — only an
15
+ * `active` instance blocks; a completed or rejected one is history and must not
16
+ * make a row undeletable forever.
17
+ */
18
+ export declare function activeVerificationExists(db: NodePgDatabase, schemaTables: Record<string, unknown>, entityName: string, entityId: string): Promise<boolean>;
@@ -42,6 +42,11 @@ export declare class VerificationService {
42
42
  * engine's `current_step + 1` walk can actually traverse.
43
43
  */
44
44
  private findStepOrderProblem;
45
+ /**
46
+ * Describes the first notification rule whose `trigger` is not one the engine
47
+ * ever fires, or null when they all are.
48
+ */
49
+ private findUnknownNotificationTrigger;
45
50
  publishFlow(flowId: string): Promise<{
46
51
  success: boolean;
47
52
  message: string;
@@ -28,7 +28,17 @@ export interface VerificationConfig {
28
28
  }
29
29
  export declare const DEFAULT_VERIFICATION_CONFIG: Required<VerificationConfig>;
30
30
  export type VerificationDecision = 'approved' | 'rejected' | 'pending';
31
- export type VerificationTrigger = 'on_flow_started' | 'on_step_reached' | 'on_approved' | 'on_rejected' | 'on_flow_completed';
31
+ /**
32
+ * Every moment the engine actually fires a notification rule at.
33
+ *
34
+ * A runtime list rather than a bare union, because publishFlow has to CHECK a
35
+ * stored trigger against it: the save body types the graph as `t.Array(t.Any())`,
36
+ * so a name outside this set used to be stored and published happily and then
37
+ * never match anything. The type is derived from the list so the two cannot
38
+ * drift apart.
39
+ */
40
+ export declare const VERIFICATION_TRIGGERS: readonly ["on_flow_started", "on_step_reached", "on_approved", "on_rejected", "on_flow_completed"];
41
+ export type VerificationTrigger = (typeof VERIFICATION_TRIGGERS)[number];
32
42
  export type FlowTriggerOn = 'create' | 'update' | 'delete' | 'manual';
33
43
  export type NodeType = 'step' | 'verifier' | 'notification';
34
44
  export type EdgeType = 'default' | 'conditional' | 'success' | 'failure';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nucleus-core-ts",
3
- "version": "0.10.47",
3
+ "version": "0.10.49",
4
4
  "description": "Production-ready, enterprise-grade TypeScript framework for building multi-tenant APIs",
5
5
  "author": "Hidayet Can Özcan <hidayetcan@gmail.com>",
6
6
  "license": "SEE LICENSE IN LICENSE",