@decaf-ts/as-graph 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -2
- package/dist/as-graph.cjs +1 -1
- package/dist/as-graph.cjs.map +1 -1
- package/dist/as-graph.js +1 -1
- package/dist/as-graph.js.map +1 -1
- package/lib/cjs/engine/index.cjs +1 -0
- package/lib/cjs/engine/index.cjs.map +1 -1
- package/lib/cjs/engine/loops/ConditionEvaluator.cjs +116 -0
- package/lib/cjs/engine/loops/ConditionEvaluator.cjs.map +1 -0
- package/lib/cjs/engine/loops/GraphConditionEvaluator.cjs +25 -2
- package/lib/cjs/engine/loops/GraphConditionEvaluator.cjs.map +1 -1
- package/lib/cjs/engine/loops/index.cjs +1 -0
- package/lib/cjs/engine/loops/index.cjs.map +1 -1
- package/lib/cjs/engine/runs/GraphRunService.cjs +60 -3
- package/lib/cjs/engine/runs/GraphRunService.cjs.map +1 -1
- package/lib/cjs/engine/runs/InMemoryGraphRunStore.cjs +33 -0
- package/lib/cjs/engine/runs/InMemoryGraphRunStore.cjs.map +1 -1
- package/lib/cjs/engine/runs/ownership.cjs +100 -11
- package/lib/cjs/engine/runs/ownership.cjs.map +1 -1
- package/lib/cjs/engine/services/GraphRunModelService.cjs +16 -0
- package/lib/cjs/engine/services/GraphRunModelService.cjs.map +1 -1
- package/lib/cjs/engine/services/GraphWorkflowService.cjs +122 -4
- package/lib/cjs/engine/services/GraphWorkflowService.cjs.map +1 -1
- package/lib/cjs/nest/graph/GraphRunController.cjs +208 -28
- package/lib/cjs/nest/graph/GraphRunController.cjs.map +1 -1
- package/lib/cjs/nest/graph/GraphWorkflowController.cjs +97 -14
- package/lib/cjs/nest/graph/GraphWorkflowController.cjs.map +1 -1
- package/lib/cjs/nest/graph/servingDates.cjs +53 -0
- package/lib/cjs/nest/graph/servingDates.cjs.map +1 -0
- package/lib/cjs/nest/graph/servingErrors.cjs +65 -0
- package/lib/cjs/nest/graph/servingErrors.cjs.map +1 -0
- package/lib/cjs/node/flow/if/node.cjs +27 -9
- package/lib/cjs/node/flow/if/node.cjs.map +1 -1
- package/lib/cjs/node/flow/loop/until/node.cjs +5 -2
- package/lib/cjs/node/flow/loop/until/node.cjs.map +1 -1
- package/lib/cjs/node/flow/loop/while/node.cjs +8 -2
- package/lib/cjs/node/flow/loop/while/node.cjs.map +1 -1
- package/lib/cjs/node/flow/switch/node.cjs +2 -37
- package/lib/cjs/node/flow/switch/node.cjs.map +1 -1
- package/lib/cjs/ram/GraphRunStore.cjs +14 -0
- package/lib/cjs/ram/GraphRunStore.cjs.map +1 -1
- package/lib/esm/engine/index.js +1 -0
- package/lib/esm/engine/index.js.map +1 -1
- package/lib/esm/engine/loops/ConditionEvaluator.js +108 -0
- package/lib/esm/engine/loops/ConditionEvaluator.js.map +1 -0
- package/lib/esm/engine/loops/GraphConditionEvaluator.js +25 -2
- package/lib/esm/engine/loops/GraphConditionEvaluator.js.map +1 -1
- package/lib/esm/engine/loops/index.js +1 -0
- package/lib/esm/engine/loops/index.js.map +1 -1
- package/lib/esm/engine/runs/GraphRunService.js +61 -4
- package/lib/esm/engine/runs/GraphRunService.js.map +1 -1
- package/lib/esm/engine/runs/InMemoryGraphRunStore.js +33 -0
- package/lib/esm/engine/runs/InMemoryGraphRunStore.js.map +1 -1
- package/lib/esm/engine/runs/ownership.js +97 -11
- package/lib/esm/engine/runs/ownership.js.map +1 -1
- package/lib/esm/engine/services/GraphRunModelService.js +16 -0
- package/lib/esm/engine/services/GraphRunModelService.js.map +1 -1
- package/lib/esm/engine/services/GraphWorkflowService.js +124 -6
- package/lib/esm/engine/services/GraphWorkflowService.js.map +1 -1
- package/lib/esm/nest/graph/GraphExecutionModule.js.map +1 -1
- package/lib/esm/nest/graph/GraphRunController.js +209 -29
- package/lib/esm/nest/graph/GraphRunController.js.map +1 -1
- package/lib/esm/nest/graph/GraphWorkflowController.js +98 -15
- package/lib/esm/nest/graph/GraphWorkflowController.js.map +1 -1
- package/lib/esm/nest/graph/servingDates.js +49 -0
- package/lib/esm/nest/graph/servingDates.js.map +1 -0
- package/lib/esm/nest/graph/servingErrors.js +60 -0
- package/lib/esm/nest/graph/servingErrors.js.map +1 -0
- package/lib/esm/node/flow/if/node.js +27 -9
- package/lib/esm/node/flow/if/node.js.map +1 -1
- package/lib/esm/node/flow/loop/until/node.js +5 -2
- package/lib/esm/node/flow/loop/until/node.js.map +1 -1
- package/lib/esm/node/flow/loop/while/node.js +8 -2
- package/lib/esm/node/flow/loop/while/node.js.map +1 -1
- package/lib/esm/node/flow/switch/node.js +2 -37
- package/lib/esm/node/flow/switch/node.js.map +1 -1
- package/lib/esm/ram/GraphRunStore.js +14 -0
- package/lib/esm/ram/GraphRunStore.js.map +1 -1
- package/lib/esm/shared/graph/document/GraphFlowBuilder.js.map +1 -1
- package/lib/types/engine/index.d.cts +1 -0
- package/lib/types/engine/index.d.mts +1 -0
- package/lib/types/engine/loops/ConditionEvaluator.d.cts +87 -0
- package/lib/types/engine/loops/ConditionEvaluator.d.mts +87 -0
- package/lib/types/engine/loops/GraphConditionEvaluator.d.cts +27 -7
- package/lib/types/engine/loops/GraphConditionEvaluator.d.mts +27 -7
- package/lib/types/engine/loops/index.d.cts +1 -0
- package/lib/types/engine/loops/index.d.mts +1 -0
- package/lib/types/engine/runs/GraphRunService.d.cts +41 -1
- package/lib/types/engine/runs/GraphRunService.d.mts +41 -1
- package/lib/types/engine/runs/InMemoryGraphRunStore.d.cts +29 -0
- package/lib/types/engine/runs/InMemoryGraphRunStore.d.mts +29 -0
- package/lib/types/engine/runs/ownership.d.cts +89 -4
- package/lib/types/engine/runs/ownership.d.mts +89 -4
- package/lib/types/engine/runs/types.d.cts +12 -1
- package/lib/types/engine/runs/types.d.mts +12 -1
- package/lib/types/engine/services/GraphRunModelService.d.cts +13 -0
- package/lib/types/engine/services/GraphRunModelService.d.mts +13 -0
- package/lib/types/engine/services/GraphWorkflowService.d.cts +52 -2
- package/lib/types/engine/services/GraphWorkflowService.d.mts +52 -2
- package/lib/types/engine/types.d.cts +11 -4
- package/lib/types/engine/types.d.mts +11 -4
- package/lib/types/nest/graph/GraphExecutionModule.d.cts +6 -1
- package/lib/types/nest/graph/GraphExecutionModule.d.mts +6 -1
- package/lib/types/nest/graph/GraphRunController.d.cts +69 -14
- package/lib/types/nest/graph/GraphRunController.d.mts +69 -14
- package/lib/types/nest/graph/GraphWorkflowController.d.cts +50 -17
- package/lib/types/nest/graph/GraphWorkflowController.d.mts +50 -17
- package/lib/types/nest/graph/servingDates.d.cts +35 -0
- package/lib/types/nest/graph/servingDates.d.mts +35 -0
- package/lib/types/nest/graph/servingErrors.d.cts +42 -0
- package/lib/types/nest/graph/servingErrors.d.mts +42 -0
- package/lib/types/node/flow/if/node.d.cts +20 -8
- package/lib/types/node/flow/if/node.d.mts +20 -8
- package/lib/types/node/flow/loop/until/node.d.cts +4 -1
- package/lib/types/node/flow/loop/until/node.d.mts +4 -1
- package/lib/types/node/flow/loop/while/node.d.cts +4 -1
- package/lib/types/node/flow/loop/while/node.d.mts +4 -1
- package/lib/types/ram/GraphRunStore.d.cts +12 -0
- package/lib/types/ram/GraphRunStore.d.mts +12 -0
- package/lib/types/shared/graph/document/GraphFlowBuilder.d.cts +5 -5
- package/lib/types/shared/graph/document/GraphFlowBuilder.d.mts +5 -5
- package/lib/types/shared/graph/types.d.cts +8 -1
- package/lib/types/shared/graph/types.d.mts +8 -1
- package/package.json +1 -1
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
* (`GET /graph/runs/:runId`), cancels (`DELETE /graph/runs/:runId`), and
|
|
6
6
|
* replays (`SSE /graph/runs/:runId/events`) graph runs on top of
|
|
7
7
|
* {@link GraphRunService}, enforcing authentication, run limits, and
|
|
8
|
-
* ownership; engine errors surface as `500`
|
|
8
|
+
* ownership; unmapped engine errors surface as a constant generic `500`
|
|
9
|
+
* (the underlying error is logged server-side only) while Nest
|
|
9
10
|
* {@link HttpException}s pass through unchanged.
|
|
10
11
|
*/
|
|
11
12
|
import { MessageEvent } from "@nestjs/common";
|
|
@@ -15,38 +16,46 @@ import { DecafRequestContext } from "@decaf-ts/for-nest";
|
|
|
15
16
|
import type { GraphRunLimits } from "../../shared/graph/index.d.cts";
|
|
16
17
|
import type { GraphExecutionValues } from "../..//index.d.cts";
|
|
17
18
|
import { GraphRunService } from "../..//index.d.cts";
|
|
19
|
+
import { GraphWorkflowService } from "../../engine/services/GraphWorkflowService.d.cts";
|
|
18
20
|
/** DI token for {@link GraphRunControllerOptions}. */
|
|
19
21
|
export declare const GRAPH_RUN_OPTIONS = "GRAPH_RUN_OPTIONS";
|
|
20
22
|
/** Options for the run lifecycle HTTP API (DECAF-50 §4.14–§4.15): authentication mode and run limits. */
|
|
21
23
|
export interface GraphRunControllerOptions {
|
|
22
24
|
/**
|
|
23
25
|
* Whether an authenticated request context is required (default
|
|
24
|
-
* `"required"`, SAA-595 secure-defaults alignment). `"
|
|
25
|
-
*
|
|
26
|
-
*
|
|
26
|
+
* `"required"`, SAA-595 secure-defaults alignment). `"required"` rejects a
|
|
27
|
+
* request with no request context **and** a request whose context carries no
|
|
28
|
+
* resolved owner user with `401` (SAA-93 F2): in a host that installs the
|
|
29
|
+
* request-context machinery a context exists for every request, so gating on
|
|
30
|
+
* context existence alone would admit unauthenticated callers as anonymous.
|
|
31
|
+
* `"optional"` admits anonymous requests for standalone module runs
|
|
32
|
+
* (DECAF-48 §4.15) — pair it with an explicit `allowAnonymousAccess`
|
|
33
|
+
* decision on the run service options.
|
|
27
34
|
*/
|
|
28
35
|
auth?: "required" | "optional";
|
|
29
|
-
/**
|
|
30
|
-
* Explicit DECAF-48 §4.15 standalone tolerance: when `true`, anonymous
|
|
31
|
-
* callers are tolerated on owned runs. Defaults to `false` — ownership
|
|
32
|
-
* checks fail closed for absent identities (SAA-595 F3).
|
|
33
|
-
*/
|
|
34
|
-
allowAnonymousAccess?: boolean;
|
|
35
36
|
/** Run limits forwarded to {@link GraphRunService}. */
|
|
36
37
|
limits?: GraphRunLimits;
|
|
37
38
|
}
|
|
38
39
|
/** Response of `POST /graph/runs`: the queued run's identity and its event/result URLs. */
|
|
39
40
|
export interface GraphRunCreatedResponse {
|
|
41
|
+
/** Queued run's id. */
|
|
40
42
|
runId: string;
|
|
43
|
+
/** Id of the workflow the run executes. */
|
|
41
44
|
workflowId: string;
|
|
45
|
+
/** Constant `"queued"`: the run is scheduled, not yet started. */
|
|
42
46
|
status: "queued";
|
|
47
|
+
/** SSE stream URL for the run's event envelopes. */
|
|
43
48
|
eventsUrl: string;
|
|
49
|
+
/** Read URL for the run's lifecycle state. */
|
|
44
50
|
resultUrl: string;
|
|
45
51
|
}
|
|
46
52
|
/** Request body for creating a run: an inline workflow document or a saved `workflowId`, plus optional inputs. */
|
|
47
53
|
export interface GraphRunRequestBody {
|
|
54
|
+
/** Inline workflow document to execute, when not referencing a saved workflow. */
|
|
48
55
|
workflow?: GraphWorkflowDocument;
|
|
56
|
+
/** Saved workflow id to execute, when no inline document is provided. */
|
|
49
57
|
workflowId?: string;
|
|
58
|
+
/** Optional execution inputs forwarded to the run. */
|
|
50
59
|
inputs?: GraphExecutionValues;
|
|
51
60
|
}
|
|
52
61
|
/**
|
|
@@ -59,16 +68,24 @@ export interface GraphRunRequestBody {
|
|
|
59
68
|
*/
|
|
60
69
|
export declare class GraphRunController {
|
|
61
70
|
private readonly runService;
|
|
71
|
+
private readonly workflowService;
|
|
62
72
|
private readonly requestContext?;
|
|
63
73
|
private readonly options;
|
|
64
|
-
constructor(runService: GraphRunService, requestContext?: DecafRequestContext | undefined, options?: GraphRunControllerOptions);
|
|
74
|
+
constructor(runService: GraphRunService, workflowService: GraphWorkflowService, requestContext?: DecafRequestContext | undefined, options?: GraphRunControllerOptions);
|
|
65
75
|
/**
|
|
66
76
|
* Enforces the configured authentication mode: `auth` defaults to
|
|
67
|
-
* `"required"` (SAA-595 secure-defaults alignment) and rejects
|
|
68
|
-
*
|
|
69
|
-
*
|
|
77
|
+
* `"required"` (SAA-595 secure-defaults alignment) and rejects a request
|
|
78
|
+
* with no request context, or with a context that carries no resolved owner
|
|
79
|
+
* user, with `401` (SAA-93 F2); `"optional"` admits anonymous requests
|
|
80
|
+
* for standalone module runs (DECAF-48 §4.15).
|
|
70
81
|
*/
|
|
71
82
|
private requireAuthenticatedContext;
|
|
83
|
+
/**
|
|
84
|
+
* Resolves the requesting caller's identity from the injected request
|
|
85
|
+
* context via {@link graphWorkflowOwnerOf}; `null` for anonymous callers.
|
|
86
|
+
*
|
|
87
|
+
* @return {string | null} The authenticated owner user, or `null` when absent.
|
|
88
|
+
*/
|
|
72
89
|
private ownerUserOf;
|
|
73
90
|
/**
|
|
74
91
|
* Concurrency-bucket key for the per-caller run cap: the authenticated
|
|
@@ -87,9 +104,34 @@ export declare class GraphRunController {
|
|
|
87
104
|
* else a single shared anonymous bucket (SAA-595 F4, SAA-1950 F7).
|
|
88
105
|
*/
|
|
89
106
|
createRun(body: GraphRunRequestBody): Promise<GraphRunCreatedResponse>;
|
|
107
|
+
/**
|
|
108
|
+
* Lists a workflow's past runs, newest first (DECAF-50 §4.14).
|
|
109
|
+
*
|
|
110
|
+
* The workflow itself is access-checked first (unknown → `404`, foreign
|
|
111
|
+
* owner → `403`), then the persisted `GraphRunModel` rows for that workflow
|
|
112
|
+
* are ownership-filtered and returned as their JSON rows. Each row carries
|
|
113
|
+
* `runId`, `workflowId`, `owner`, `status`, `documentFingerprint`,
|
|
114
|
+
* `inputs`, `result`, `error`, `createdAt`, `updatedAt`, `startedAt` and
|
|
115
|
+
* `finishedAt` (dates as ISO strings; optional members are omitted when
|
|
116
|
+
* unset). The `inputs`/`result`/`error` payload members are served only
|
|
117
|
+
* for rows the caller owns (SAA-93 F1): a caller that may see an
|
|
118
|
+
* owner-less row by the documented owner-less visibility contract but does
|
|
119
|
+
* not own it receives the summary-only projection. Rows whose required
|
|
120
|
+
* dates cannot be projected are skipped per row (SAA-93 F4). Auth follows
|
|
121
|
+
* the controller's configured `auth` mode.
|
|
122
|
+
*
|
|
123
|
+
* @param {string} workflowId - Workflow id path parameter.
|
|
124
|
+
* @return {Promise<Array<Record<string, unknown>>>} The workflow's runs, newest first.
|
|
125
|
+
* @throws {HttpException} The mapped graph-run HTTP error (404 for unknown workflows/runs, 403 for foreign owners, 401 without an authenticated caller).
|
|
126
|
+
*/
|
|
127
|
+
listRuns(workflowId: string): Promise<Record<string, unknown>[]>;
|
|
90
128
|
/**
|
|
91
129
|
* Reads a run and maps it to its HTTP representation.
|
|
92
130
|
*
|
|
131
|
+
* The run's `result`/`error` payload is projected out for a caller that
|
|
132
|
+
* does not own the run (SAA-93 F1): the summary-only projection the list
|
|
133
|
+
* path applies cannot be bypassed by reading the run by id.
|
|
134
|
+
*
|
|
93
135
|
* @param {string} runId - Run id path parameter.
|
|
94
136
|
* @return {Promise<Record<string, unknown>>} The run's HTTP shape.
|
|
95
137
|
* @throws {HttpException} The mapped graph-run HTTP error (404 for unknown runs, 403 for foreign owners).
|
|
@@ -108,11 +150,24 @@ export declare class GraphRunController {
|
|
|
108
150
|
* `afterSequence`, then streams live events until the terminal event type
|
|
109
151
|
* completes the stream.
|
|
110
152
|
*
|
|
153
|
+
* SAA-93 F1: a caller that may see an owner-less run by the documented
|
|
154
|
+
* owner-less visibility contract but does not own it receives envelopes with
|
|
155
|
+
* the `payload`/`error` members projected out, matching the list and
|
|
156
|
+
* single-read projections.
|
|
157
|
+
*
|
|
111
158
|
* @param {string} runId - Run id path parameter.
|
|
112
159
|
* @param {string} [afterSequence] - Sequence number to replay events after.
|
|
113
160
|
* @return {Promise<Observable<MessageEvent>>} The SSE event stream.
|
|
114
161
|
* @throws {HttpException} The mapped graph-run HTTP error (404 for unknown runs, 403 for foreign owners).
|
|
115
162
|
*/
|
|
116
163
|
events(runId: string, afterSequence?: string): Promise<Observable<MessageEvent>>;
|
|
164
|
+
/**
|
|
165
|
+
* Parses the SSE replay cursor: `0` for absent/empty values, otherwise the
|
|
166
|
+
* parsed non-negative integer.
|
|
167
|
+
*
|
|
168
|
+
* @param {string | undefined} afterSequence - Raw `afterSequence` query parameter.
|
|
169
|
+
* @return {number} The sequence number to replay events after.
|
|
170
|
+
* @throws {HttpException} `400` when the value is not a non-negative integer.
|
|
171
|
+
*/
|
|
117
172
|
private parseAfterSequence;
|
|
118
173
|
}
|
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
* (`GET /graph/runs/:runId`), cancels (`DELETE /graph/runs/:runId`), and
|
|
6
6
|
* replays (`SSE /graph/runs/:runId/events`) graph runs on top of
|
|
7
7
|
* {@link GraphRunService}, enforcing authentication, run limits, and
|
|
8
|
-
* ownership; engine errors surface as `500`
|
|
8
|
+
* ownership; unmapped engine errors surface as a constant generic `500`
|
|
9
|
+
* (the underlying error is logged server-side only) while Nest
|
|
9
10
|
* {@link HttpException}s pass through unchanged.
|
|
10
11
|
*/
|
|
11
12
|
import { MessageEvent } from "@nestjs/common";
|
|
@@ -15,38 +16,46 @@ import { DecafRequestContext } from "@decaf-ts/for-nest";
|
|
|
15
16
|
import type { GraphRunLimits } from "../../shared/graph/index.d.mts";
|
|
16
17
|
import type { GraphExecutionValues } from "../..//index.d.mts";
|
|
17
18
|
import { GraphRunService } from "../..//index.d.mts";
|
|
19
|
+
import { GraphWorkflowService } from "../../engine/services/GraphWorkflowService.d.mts";
|
|
18
20
|
/** DI token for {@link GraphRunControllerOptions}. */
|
|
19
21
|
export declare const GRAPH_RUN_OPTIONS = "GRAPH_RUN_OPTIONS";
|
|
20
22
|
/** Options for the run lifecycle HTTP API (DECAF-50 §4.14–§4.15): authentication mode and run limits. */
|
|
21
23
|
export interface GraphRunControllerOptions {
|
|
22
24
|
/**
|
|
23
25
|
* Whether an authenticated request context is required (default
|
|
24
|
-
* `"required"`, SAA-595 secure-defaults alignment). `"
|
|
25
|
-
*
|
|
26
|
-
*
|
|
26
|
+
* `"required"`, SAA-595 secure-defaults alignment). `"required"` rejects a
|
|
27
|
+
* request with no request context **and** a request whose context carries no
|
|
28
|
+
* resolved owner user with `401` (SAA-93 F2): in a host that installs the
|
|
29
|
+
* request-context machinery a context exists for every request, so gating on
|
|
30
|
+
* context existence alone would admit unauthenticated callers as anonymous.
|
|
31
|
+
* `"optional"` admits anonymous requests for standalone module runs
|
|
32
|
+
* (DECAF-48 §4.15) — pair it with an explicit `allowAnonymousAccess`
|
|
33
|
+
* decision on the run service options.
|
|
27
34
|
*/
|
|
28
35
|
auth?: "required" | "optional";
|
|
29
|
-
/**
|
|
30
|
-
* Explicit DECAF-48 §4.15 standalone tolerance: when `true`, anonymous
|
|
31
|
-
* callers are tolerated on owned runs. Defaults to `false` — ownership
|
|
32
|
-
* checks fail closed for absent identities (SAA-595 F3).
|
|
33
|
-
*/
|
|
34
|
-
allowAnonymousAccess?: boolean;
|
|
35
36
|
/** Run limits forwarded to {@link GraphRunService}. */
|
|
36
37
|
limits?: GraphRunLimits;
|
|
37
38
|
}
|
|
38
39
|
/** Response of `POST /graph/runs`: the queued run's identity and its event/result URLs. */
|
|
39
40
|
export interface GraphRunCreatedResponse {
|
|
41
|
+
/** Queued run's id. */
|
|
40
42
|
runId: string;
|
|
43
|
+
/** Id of the workflow the run executes. */
|
|
41
44
|
workflowId: string;
|
|
45
|
+
/** Constant `"queued"`: the run is scheduled, not yet started. */
|
|
42
46
|
status: "queued";
|
|
47
|
+
/** SSE stream URL for the run's event envelopes. */
|
|
43
48
|
eventsUrl: string;
|
|
49
|
+
/** Read URL for the run's lifecycle state. */
|
|
44
50
|
resultUrl: string;
|
|
45
51
|
}
|
|
46
52
|
/** Request body for creating a run: an inline workflow document or a saved `workflowId`, plus optional inputs. */
|
|
47
53
|
export interface GraphRunRequestBody {
|
|
54
|
+
/** Inline workflow document to execute, when not referencing a saved workflow. */
|
|
48
55
|
workflow?: GraphWorkflowDocument;
|
|
56
|
+
/** Saved workflow id to execute, when no inline document is provided. */
|
|
49
57
|
workflowId?: string;
|
|
58
|
+
/** Optional execution inputs forwarded to the run. */
|
|
50
59
|
inputs?: GraphExecutionValues;
|
|
51
60
|
}
|
|
52
61
|
/**
|
|
@@ -59,16 +68,24 @@ export interface GraphRunRequestBody {
|
|
|
59
68
|
*/
|
|
60
69
|
export declare class GraphRunController {
|
|
61
70
|
private readonly runService;
|
|
71
|
+
private readonly workflowService;
|
|
62
72
|
private readonly requestContext?;
|
|
63
73
|
private readonly options;
|
|
64
|
-
constructor(runService: GraphRunService, requestContext?: DecafRequestContext | undefined, options?: GraphRunControllerOptions);
|
|
74
|
+
constructor(runService: GraphRunService, workflowService: GraphWorkflowService, requestContext?: DecafRequestContext | undefined, options?: GraphRunControllerOptions);
|
|
65
75
|
/**
|
|
66
76
|
* Enforces the configured authentication mode: `auth` defaults to
|
|
67
|
-
* `"required"` (SAA-595 secure-defaults alignment) and rejects
|
|
68
|
-
*
|
|
69
|
-
*
|
|
77
|
+
* `"required"` (SAA-595 secure-defaults alignment) and rejects a request
|
|
78
|
+
* with no request context, or with a context that carries no resolved owner
|
|
79
|
+
* user, with `401` (SAA-93 F2); `"optional"` admits anonymous requests
|
|
80
|
+
* for standalone module runs (DECAF-48 §4.15).
|
|
70
81
|
*/
|
|
71
82
|
private requireAuthenticatedContext;
|
|
83
|
+
/**
|
|
84
|
+
* Resolves the requesting caller's identity from the injected request
|
|
85
|
+
* context via {@link graphWorkflowOwnerOf}; `null` for anonymous callers.
|
|
86
|
+
*
|
|
87
|
+
* @return {string | null} The authenticated owner user, or `null` when absent.
|
|
88
|
+
*/
|
|
72
89
|
private ownerUserOf;
|
|
73
90
|
/**
|
|
74
91
|
* Concurrency-bucket key for the per-caller run cap: the authenticated
|
|
@@ -87,9 +104,34 @@ export declare class GraphRunController {
|
|
|
87
104
|
* else a single shared anonymous bucket (SAA-595 F4, SAA-1950 F7).
|
|
88
105
|
*/
|
|
89
106
|
createRun(body: GraphRunRequestBody): Promise<GraphRunCreatedResponse>;
|
|
107
|
+
/**
|
|
108
|
+
* Lists a workflow's past runs, newest first (DECAF-50 §4.14).
|
|
109
|
+
*
|
|
110
|
+
* The workflow itself is access-checked first (unknown → `404`, foreign
|
|
111
|
+
* owner → `403`), then the persisted `GraphRunModel` rows for that workflow
|
|
112
|
+
* are ownership-filtered and returned as their JSON rows. Each row carries
|
|
113
|
+
* `runId`, `workflowId`, `owner`, `status`, `documentFingerprint`,
|
|
114
|
+
* `inputs`, `result`, `error`, `createdAt`, `updatedAt`, `startedAt` and
|
|
115
|
+
* `finishedAt` (dates as ISO strings; optional members are omitted when
|
|
116
|
+
* unset). The `inputs`/`result`/`error` payload members are served only
|
|
117
|
+
* for rows the caller owns (SAA-93 F1): a caller that may see an
|
|
118
|
+
* owner-less row by the documented owner-less visibility contract but does
|
|
119
|
+
* not own it receives the summary-only projection. Rows whose required
|
|
120
|
+
* dates cannot be projected are skipped per row (SAA-93 F4). Auth follows
|
|
121
|
+
* the controller's configured `auth` mode.
|
|
122
|
+
*
|
|
123
|
+
* @param {string} workflowId - Workflow id path parameter.
|
|
124
|
+
* @return {Promise<Array<Record<string, unknown>>>} The workflow's runs, newest first.
|
|
125
|
+
* @throws {HttpException} The mapped graph-run HTTP error (404 for unknown workflows/runs, 403 for foreign owners, 401 without an authenticated caller).
|
|
126
|
+
*/
|
|
127
|
+
listRuns(workflowId: string): Promise<Record<string, unknown>[]>;
|
|
90
128
|
/**
|
|
91
129
|
* Reads a run and maps it to its HTTP representation.
|
|
92
130
|
*
|
|
131
|
+
* The run's `result`/`error` payload is projected out for a caller that
|
|
132
|
+
* does not own the run (SAA-93 F1): the summary-only projection the list
|
|
133
|
+
* path applies cannot be bypassed by reading the run by id.
|
|
134
|
+
*
|
|
93
135
|
* @param {string} runId - Run id path parameter.
|
|
94
136
|
* @return {Promise<Record<string, unknown>>} The run's HTTP shape.
|
|
95
137
|
* @throws {HttpException} The mapped graph-run HTTP error (404 for unknown runs, 403 for foreign owners).
|
|
@@ -108,11 +150,24 @@ export declare class GraphRunController {
|
|
|
108
150
|
* `afterSequence`, then streams live events until the terminal event type
|
|
109
151
|
* completes the stream.
|
|
110
152
|
*
|
|
153
|
+
* SAA-93 F1: a caller that may see an owner-less run by the documented
|
|
154
|
+
* owner-less visibility contract but does not own it receives envelopes with
|
|
155
|
+
* the `payload`/`error` members projected out, matching the list and
|
|
156
|
+
* single-read projections.
|
|
157
|
+
*
|
|
111
158
|
* @param {string} runId - Run id path parameter.
|
|
112
159
|
* @param {string} [afterSequence] - Sequence number to replay events after.
|
|
113
160
|
* @return {Promise<Observable<MessageEvent>>} The SSE event stream.
|
|
114
161
|
* @throws {HttpException} The mapped graph-run HTTP error (404 for unknown runs, 403 for foreign owners).
|
|
115
162
|
*/
|
|
116
163
|
events(runId: string, afterSequence?: string): Promise<Observable<MessageEvent>>;
|
|
164
|
+
/**
|
|
165
|
+
* Parses the SSE replay cursor: `0` for absent/empty values, otherwise the
|
|
166
|
+
* parsed non-negative integer.
|
|
167
|
+
*
|
|
168
|
+
* @param {string | undefined} afterSequence - Raw `afterSequence` query parameter.
|
|
169
|
+
* @return {number} The sequence number to replay events after.
|
|
170
|
+
* @throws {HttpException} `400` when the value is not a non-negative integer.
|
|
171
|
+
*/
|
|
117
172
|
private parseAfterSequence;
|
|
118
173
|
}
|
|
@@ -8,19 +8,16 @@ export declare const GRAPH_WORKFLOW_OPTIONS = "GRAPH_WORKFLOW_OPTIONS";
|
|
|
8
8
|
/** Options for the workflow persistence HTTP API (DECAF-50 §4.10): authentication mode and document resource limits. */
|
|
9
9
|
export interface GraphWorkflowControllerOptions {
|
|
10
10
|
/**
|
|
11
|
-
* `"required"` rejects
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
11
|
+
* `"required"` rejects a request with no request context **and** a request
|
|
12
|
+
* whose context carries no resolved owner user with `401` (SAA-93 F2): in a
|
|
13
|
+
* host that installs the request-context machinery a context exists for every
|
|
14
|
+
* request, so gating on context existence alone would admit unauthenticated
|
|
15
|
+
* callers as anonymous. `"optional"` tolerates anonymous/system callers for
|
|
16
|
+
* standalone module runs (DECAF-48 §4.15) while still enforcing ownership
|
|
17
|
+
* between distinct users — pair it with an explicit `allowAnonymousAccess`
|
|
18
|
+
* decision on the workflow service options.
|
|
16
19
|
*/
|
|
17
20
|
auth?: "required" | "optional";
|
|
18
|
-
/**
|
|
19
|
-
* Explicit DECAF-48 §4.15 standalone tolerance: when `true`, anonymous
|
|
20
|
-
* callers are tolerated on owned workflows. Defaults to `false` —
|
|
21
|
-
* ownership checks fail closed for absent identities (SAA-595 F3).
|
|
22
|
-
*/
|
|
23
|
-
allowAnonymousAccess?: boolean;
|
|
24
21
|
/** Backend-enforced resource limits (DECAF-50 §4.16). */
|
|
25
22
|
limits?: GraphWorkflowDocumentLimits;
|
|
26
23
|
}
|
|
@@ -30,6 +27,15 @@ export interface GraphWorkflowSaveResponse {
|
|
|
30
27
|
name?: string;
|
|
31
28
|
savedAt: string;
|
|
32
29
|
}
|
|
30
|
+
/** One row of `GET /graph/workflows`: the serving summary a workflow list binds to. */
|
|
31
|
+
export interface GraphWorkflowSummary {
|
|
32
|
+
/** Workflow document id (the persistence primary key). */
|
|
33
|
+
workflowId: string;
|
|
34
|
+
/** Display name mirrored from the document, when present. */
|
|
35
|
+
name?: string;
|
|
36
|
+
/** ISO timestamp of the last save/update. */
|
|
37
|
+
updatedAt: string;
|
|
38
|
+
}
|
|
33
39
|
/**
|
|
34
40
|
* Canonical workflow document persistence endpoints (DECAF-50 §4.10):
|
|
35
41
|
*
|
|
@@ -40,9 +46,7 @@ export interface GraphWorkflowSaveResponse {
|
|
|
40
46
|
* legacy persisted snapshots are converted losslessly on the read path.
|
|
41
47
|
* - `POST /graph/workflows/validate` — run boundary validation and return
|
|
42
48
|
* structured issues (`code`, `path`, `nodeId`, `edgeId`, `message`,
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
* @class GraphWorkflowController
|
|
49
|
+
* safe `details`).
|
|
46
50
|
*/
|
|
47
51
|
export declare class GraphWorkflowController {
|
|
48
52
|
private readonly workflowService;
|
|
@@ -51,9 +55,10 @@ export declare class GraphWorkflowController {
|
|
|
51
55
|
constructor(workflowService: GraphWorkflowService, requestContext?: DecafRequestContext | undefined, options?: GraphWorkflowControllerOptions);
|
|
52
56
|
/**
|
|
53
57
|
* Enforces the configured authentication mode: `auth` defaults to
|
|
54
|
-
* `"required"` (SAA-595 secure-defaults alignment) and rejects
|
|
55
|
-
*
|
|
56
|
-
*
|
|
58
|
+
* `"required"` (SAA-595 secure-defaults alignment) and rejects a request
|
|
59
|
+
* with no request context, or with a context that carries no resolved owner
|
|
60
|
+
* user, with `401` (SAA-93 F2); `"optional"` admits anonymous requests
|
|
61
|
+
* for standalone module runs (DECAF-48 §4.15).
|
|
57
62
|
*/
|
|
58
63
|
private requireAuthenticatedContext;
|
|
59
64
|
/**
|
|
@@ -67,6 +72,20 @@ export declare class GraphWorkflowController {
|
|
|
67
72
|
* @throws {HttpException} The mapped graph-workflow HTTP error (400/403/409 per the service contract).
|
|
68
73
|
*/
|
|
69
74
|
saveWorkflow(workflowId: string, body: unknown): Promise<GraphWorkflowSaveResponse>;
|
|
75
|
+
/**
|
|
76
|
+
* Lists the workflows visible to the requesting caller, newest update first.
|
|
77
|
+
*
|
|
78
|
+
* Auth follows the controller's configured `auth` mode (default `"required"`
|
|
79
|
+
* rejects anonymous calls with `401`). The collection is ownership-filtered
|
|
80
|
+
* by {@link GraphWorkflowService.listWorkflows}, so a caller only sees their
|
|
81
|
+
* own plus owner-less (system/standalone) workflows. A row whose `updatedAt`
|
|
82
|
+
* cannot be projected to an ISO string is skipped per row so a single corrupt
|
|
83
|
+
* persisted date never 500s the whole collection (SAA-93 F4).
|
|
84
|
+
*
|
|
85
|
+
* @return {Promise<GraphWorkflowSummary[]>} Visible workflow summaries, newest first.
|
|
86
|
+
* @throws {HttpException} 401 without an authenticated caller.
|
|
87
|
+
*/
|
|
88
|
+
listWorkflows(): Promise<GraphWorkflowSummary[]>;
|
|
70
89
|
/**
|
|
71
90
|
* Returns a workflow's canonical document.
|
|
72
91
|
*
|
|
@@ -83,6 +102,20 @@ export declare class GraphWorkflowController {
|
|
|
83
102
|
* @throws {HttpException} 401 without an authenticated context.
|
|
84
103
|
*/
|
|
85
104
|
validateWorkflow(body: unknown): Promise<GraphWorkflowValidationResult>;
|
|
105
|
+
/**
|
|
106
|
+
* Detects a canonical snapshot wrapper body (`{ document, ... }`): an
|
|
107
|
+
* object carrying a `document` member but no bare document `nodes` member.
|
|
108
|
+
*
|
|
109
|
+
* @param {unknown} body - The raw request body.
|
|
110
|
+
* @return {boolean} `true` when the body should be routed to {@link GraphWorkflowService.saveSnapshot}.
|
|
111
|
+
*/
|
|
86
112
|
private isCanonicalWrapper;
|
|
113
|
+
/**
|
|
114
|
+
* Extracts the bare {@link GraphWorkflowDocument} from a request body,
|
|
115
|
+
* unwrapping a canonical snapshot wrapper when present.
|
|
116
|
+
*
|
|
117
|
+
* @param {unknown} body - The raw request body.
|
|
118
|
+
* @return {GraphWorkflowDocument} The document to validate.
|
|
119
|
+
*/
|
|
87
120
|
private documentOf;
|
|
88
121
|
}
|
|
@@ -8,19 +8,16 @@ export declare const GRAPH_WORKFLOW_OPTIONS = "GRAPH_WORKFLOW_OPTIONS";
|
|
|
8
8
|
/** Options for the workflow persistence HTTP API (DECAF-50 §4.10): authentication mode and document resource limits. */
|
|
9
9
|
export interface GraphWorkflowControllerOptions {
|
|
10
10
|
/**
|
|
11
|
-
* `"required"` rejects
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
11
|
+
* `"required"` rejects a request with no request context **and** a request
|
|
12
|
+
* whose context carries no resolved owner user with `401` (SAA-93 F2): in a
|
|
13
|
+
* host that installs the request-context machinery a context exists for every
|
|
14
|
+
* request, so gating on context existence alone would admit unauthenticated
|
|
15
|
+
* callers as anonymous. `"optional"` tolerates anonymous/system callers for
|
|
16
|
+
* standalone module runs (DECAF-48 §4.15) while still enforcing ownership
|
|
17
|
+
* between distinct users — pair it with an explicit `allowAnonymousAccess`
|
|
18
|
+
* decision on the workflow service options.
|
|
16
19
|
*/
|
|
17
20
|
auth?: "required" | "optional";
|
|
18
|
-
/**
|
|
19
|
-
* Explicit DECAF-48 §4.15 standalone tolerance: when `true`, anonymous
|
|
20
|
-
* callers are tolerated on owned workflows. Defaults to `false` —
|
|
21
|
-
* ownership checks fail closed for absent identities (SAA-595 F3).
|
|
22
|
-
*/
|
|
23
|
-
allowAnonymousAccess?: boolean;
|
|
24
21
|
/** Backend-enforced resource limits (DECAF-50 §4.16). */
|
|
25
22
|
limits?: GraphWorkflowDocumentLimits;
|
|
26
23
|
}
|
|
@@ -30,6 +27,15 @@ export interface GraphWorkflowSaveResponse {
|
|
|
30
27
|
name?: string;
|
|
31
28
|
savedAt: string;
|
|
32
29
|
}
|
|
30
|
+
/** One row of `GET /graph/workflows`: the serving summary a workflow list binds to. */
|
|
31
|
+
export interface GraphWorkflowSummary {
|
|
32
|
+
/** Workflow document id (the persistence primary key). */
|
|
33
|
+
workflowId: string;
|
|
34
|
+
/** Display name mirrored from the document, when present. */
|
|
35
|
+
name?: string;
|
|
36
|
+
/** ISO timestamp of the last save/update. */
|
|
37
|
+
updatedAt: string;
|
|
38
|
+
}
|
|
33
39
|
/**
|
|
34
40
|
* Canonical workflow document persistence endpoints (DECAF-50 §4.10):
|
|
35
41
|
*
|
|
@@ -40,9 +46,7 @@ export interface GraphWorkflowSaveResponse {
|
|
|
40
46
|
* legacy persisted snapshots are converted losslessly on the read path.
|
|
41
47
|
* - `POST /graph/workflows/validate` — run boundary validation and return
|
|
42
48
|
* structured issues (`code`, `path`, `nodeId`, `edgeId`, `message`,
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
* @class GraphWorkflowController
|
|
49
|
+
* safe `details`).
|
|
46
50
|
*/
|
|
47
51
|
export declare class GraphWorkflowController {
|
|
48
52
|
private readonly workflowService;
|
|
@@ -51,9 +55,10 @@ export declare class GraphWorkflowController {
|
|
|
51
55
|
constructor(workflowService: GraphWorkflowService, requestContext?: DecafRequestContext | undefined, options?: GraphWorkflowControllerOptions);
|
|
52
56
|
/**
|
|
53
57
|
* Enforces the configured authentication mode: `auth` defaults to
|
|
54
|
-
* `"required"` (SAA-595 secure-defaults alignment) and rejects
|
|
55
|
-
*
|
|
56
|
-
*
|
|
58
|
+
* `"required"` (SAA-595 secure-defaults alignment) and rejects a request
|
|
59
|
+
* with no request context, or with a context that carries no resolved owner
|
|
60
|
+
* user, with `401` (SAA-93 F2); `"optional"` admits anonymous requests
|
|
61
|
+
* for standalone module runs (DECAF-48 §4.15).
|
|
57
62
|
*/
|
|
58
63
|
private requireAuthenticatedContext;
|
|
59
64
|
/**
|
|
@@ -67,6 +72,20 @@ export declare class GraphWorkflowController {
|
|
|
67
72
|
* @throws {HttpException} The mapped graph-workflow HTTP error (400/403/409 per the service contract).
|
|
68
73
|
*/
|
|
69
74
|
saveWorkflow(workflowId: string, body: unknown): Promise<GraphWorkflowSaveResponse>;
|
|
75
|
+
/**
|
|
76
|
+
* Lists the workflows visible to the requesting caller, newest update first.
|
|
77
|
+
*
|
|
78
|
+
* Auth follows the controller's configured `auth` mode (default `"required"`
|
|
79
|
+
* rejects anonymous calls with `401`). The collection is ownership-filtered
|
|
80
|
+
* by {@link GraphWorkflowService.listWorkflows}, so a caller only sees their
|
|
81
|
+
* own plus owner-less (system/standalone) workflows. A row whose `updatedAt`
|
|
82
|
+
* cannot be projected to an ISO string is skipped per row so a single corrupt
|
|
83
|
+
* persisted date never 500s the whole collection (SAA-93 F4).
|
|
84
|
+
*
|
|
85
|
+
* @return {Promise<GraphWorkflowSummary[]>} Visible workflow summaries, newest first.
|
|
86
|
+
* @throws {HttpException} 401 without an authenticated caller.
|
|
87
|
+
*/
|
|
88
|
+
listWorkflows(): Promise<GraphWorkflowSummary[]>;
|
|
70
89
|
/**
|
|
71
90
|
* Returns a workflow's canonical document.
|
|
72
91
|
*
|
|
@@ -83,6 +102,20 @@ export declare class GraphWorkflowController {
|
|
|
83
102
|
* @throws {HttpException} 401 without an authenticated context.
|
|
84
103
|
*/
|
|
85
104
|
validateWorkflow(body: unknown): Promise<GraphWorkflowValidationResult>;
|
|
105
|
+
/**
|
|
106
|
+
* Detects a canonical snapshot wrapper body (`{ document, ... }`): an
|
|
107
|
+
* object carrying a `document` member but no bare document `nodes` member.
|
|
108
|
+
*
|
|
109
|
+
* @param {unknown} body - The raw request body.
|
|
110
|
+
* @return {boolean} `true` when the body should be routed to {@link GraphWorkflowService.saveSnapshot}.
|
|
111
|
+
*/
|
|
86
112
|
private isCanonicalWrapper;
|
|
113
|
+
/**
|
|
114
|
+
* Extracts the bare {@link GraphWorkflowDocument} from a request body,
|
|
115
|
+
* unwrapping a canonical snapshot wrapper when present.
|
|
116
|
+
*
|
|
117
|
+
* @param {unknown} body - The raw request body.
|
|
118
|
+
* @return {GraphWorkflowDocument} The document to validate.
|
|
119
|
+
*/
|
|
87
120
|
private documentOf;
|
|
88
121
|
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module as-graph/nest/graph/servingDates
|
|
3
|
+
* @summary HTTP-boundary date projection for the graph serving endpoints.
|
|
4
|
+
* @description Projects the `Date` values stored on persisted
|
|
5
|
+
* {@link GraphWorkflowModel} / {@link GraphRunModel} rows to true ISO-8601
|
|
6
|
+
* strings at the HTTP boundary, so every served date is unambiguously
|
|
7
|
+
* machine-readable regardless of the Decaf date format configured on the
|
|
8
|
+
* models (`@date`/`@timestamp` bind a proxy that renders `dd/MM/yyyy
|
|
9
|
+
* HH:mm:ss:S`).
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Converts a persisted `Date` to its ISO-8601 string form (`2026-01-01T12:00:00.000Z`).
|
|
13
|
+
*
|
|
14
|
+
* Used by the serving controllers when projecting persisted rows to their HTTP
|
|
15
|
+
* shape (workflow save/list summaries and run rows), so clients never receive a
|
|
16
|
+
* locale-bound Decaf date rendering. The value is round-tripped through
|
|
17
|
+
* `new Date(value.getTime())` to normalize anything proxy- or model-bound into
|
|
18
|
+
* a plain `Date` before formatting.
|
|
19
|
+
*
|
|
20
|
+
* A corrupt persisted date (`Invalid Date` / non-finite time) returns `undefined`
|
|
21
|
+
* instead of throwing (SAA-93 F4): one bad row must not 500 the whole
|
|
22
|
+
* collection. Callers either omit the optional member or skip the row when a
|
|
23
|
+
* required date is unprojectable.
|
|
24
|
+
*
|
|
25
|
+
* @param {Date | null | undefined} value - The persisted date, or `null`/`undefined` when the member is unset.
|
|
26
|
+
* @return {string | undefined} The ISO-8601 string, or `undefined` when no date was given or the date is invalid.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```ts
|
|
30
|
+
* toIsoDateString(new Date("2026-01-01T12:00:00Z")); // "2026-01-01T12:00:00.000Z"
|
|
31
|
+
* toIsoDateString(null); // undefined
|
|
32
|
+
* toIsoDateString(new Date("nope")); // undefined (corrupt persisted date)
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export declare function toIsoDateString(value: Date | null | undefined): string | undefined;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module as-graph/nest/graph/servingDates
|
|
3
|
+
* @summary HTTP-boundary date projection for the graph serving endpoints.
|
|
4
|
+
* @description Projects the `Date` values stored on persisted
|
|
5
|
+
* {@link GraphWorkflowModel} / {@link GraphRunModel} rows to true ISO-8601
|
|
6
|
+
* strings at the HTTP boundary, so every served date is unambiguously
|
|
7
|
+
* machine-readable regardless of the Decaf date format configured on the
|
|
8
|
+
* models (`@date`/`@timestamp` bind a proxy that renders `dd/MM/yyyy
|
|
9
|
+
* HH:mm:ss:S`).
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Converts a persisted `Date` to its ISO-8601 string form (`2026-01-01T12:00:00.000Z`).
|
|
13
|
+
*
|
|
14
|
+
* Used by the serving controllers when projecting persisted rows to their HTTP
|
|
15
|
+
* shape (workflow save/list summaries and run rows), so clients never receive a
|
|
16
|
+
* locale-bound Decaf date rendering. The value is round-tripped through
|
|
17
|
+
* `new Date(value.getTime())` to normalize anything proxy- or model-bound into
|
|
18
|
+
* a plain `Date` before formatting.
|
|
19
|
+
*
|
|
20
|
+
* A corrupt persisted date (`Invalid Date` / non-finite time) returns `undefined`
|
|
21
|
+
* instead of throwing (SAA-93 F4): one bad row must not 500 the whole
|
|
22
|
+
* collection. Callers either omit the optional member or skip the row when a
|
|
23
|
+
* required date is unprojectable.
|
|
24
|
+
*
|
|
25
|
+
* @param {Date | null | undefined} value - The persisted date, or `null`/`undefined` when the member is unset.
|
|
26
|
+
* @return {string | undefined} The ISO-8601 string, or `undefined` when no date was given or the date is invalid.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```ts
|
|
30
|
+
* toIsoDateString(new Date("2026-01-01T12:00:00Z")); // "2026-01-01T12:00:00.000Z"
|
|
31
|
+
* toIsoDateString(null); // undefined
|
|
32
|
+
* toIsoDateString(new Date("nope")); // undefined (corrupt persisted date)
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export declare function toIsoDateString(value: Date | null | undefined): string | undefined;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Constant generic `500` body served for any unmapped graph serving failure.
|
|
3
|
+
* Deliberately static: no dynamic content, no `e.message`, no `String(e)`.
|
|
4
|
+
*/
|
|
5
|
+
export declare const GRAPH_SERVING_INTERNAL_ERROR_MESSAGE = "Internal server error";
|
|
6
|
+
/** Logger context for the run lifecycle controller's server-side error log. */
|
|
7
|
+
export type GraphServingErrorLoggerContext = "GraphRunController" | "GraphWorkflowController";
|
|
8
|
+
/**
|
|
9
|
+
* Request/run correlation fields attached to a server-side graph serving error
|
|
10
|
+
* log. Only ids the server already resolved are included; the fields are never
|
|
11
|
+
* served to the client.
|
|
12
|
+
*/
|
|
13
|
+
export interface GraphServingErrorCorrelation {
|
|
14
|
+
/** Run id, when the failing operation was scoped to a run. */
|
|
15
|
+
runId?: string;
|
|
16
|
+
/** Workflow id, when the failing operation was scoped to a workflow. */
|
|
17
|
+
workflowId?: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Logs an unmapped graph serving failure server-side, with the request
|
|
21
|
+
* correlation ids and the underlying error message/stack. The client receives the
|
|
22
|
+
* constant generic {@link GRAPH_SERVING_INTERNAL_ERROR_MESSAGE} instead; this log
|
|
23
|
+
* is the only place the underlying error detail is surfaced.
|
|
24
|
+
*
|
|
25
|
+
* The correlation ids are serialized directly into the log message (via
|
|
26
|
+
* `JSON.stringify`) rather than relying solely on the logger's `meta` channel. The
|
|
27
|
+
* default RAW log pattern has no `{meta}` placeholder, so a `meta`-only
|
|
28
|
+
* correlation would never render under default text logging; inlining it keeps the
|
|
29
|
+
* ids visible under any renderer, and JSON escaping preserves the no-log-injection
|
|
30
|
+
* property.
|
|
31
|
+
*
|
|
32
|
+
* The whole body is guarded so a hostile thrown value (e.g. a throwing `toString`
|
|
33
|
+
* on the caught value) or a logging-infrastructure failure can never make this
|
|
34
|
+
* mapper throw; failures are swallowed because Nest's default handler still answers
|
|
35
|
+
* the constant generic `500` fail-securely.
|
|
36
|
+
*
|
|
37
|
+
* @param {GraphServingErrorLoggerContext} context - Logger context for the controller handling the failure.
|
|
38
|
+
* @param {unknown} e - The caught error that was not mapped to a specific HTTP status.
|
|
39
|
+
* @param {GraphServingErrorCorrelation} correlation - Request correlation ids, when known.
|
|
40
|
+
* @return {void}
|
|
41
|
+
*/
|
|
42
|
+
export declare function logUnmappedGraphServingError(context: GraphServingErrorLoggerContext, e: unknown, correlation?: GraphServingErrorCorrelation): void;
|