@ossy/platform 3.7.1 → 3.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ossy/platform",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.9.0",
|
|
4
4
|
"description": "Ossy application server runtime",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -45,16 +45,16 @@
|
|
|
45
45
|
"@aws-sdk/util-format-url": "^3.972.17",
|
|
46
46
|
"@modelcontextprotocol/sdk": "^1.12.1",
|
|
47
47
|
"@ossy/config": "^3.0.9",
|
|
48
|
-
"@ossy/event-store": "^3.
|
|
48
|
+
"@ossy/event-store": "^3.8.0",
|
|
49
49
|
"@ossy/locale": "^3.4.0",
|
|
50
|
-
"@ossy/manifest": "^3.
|
|
50
|
+
"@ossy/manifest": "^3.9.0",
|
|
51
51
|
"@ossy/observability": "^3.0.9",
|
|
52
52
|
"@ossy/policies": "^3.0.9",
|
|
53
|
-
"@ossy/schema": "^3.
|
|
53
|
+
"@ossy/schema": "^3.8.0",
|
|
54
54
|
"@ossy/sdk": "^3.5.0",
|
|
55
55
|
"@ossy/tokens": "^3.5.0",
|
|
56
|
-
"@ossy/users": "^3.
|
|
57
|
-
"@ossy/workspaces": "^3.
|
|
56
|
+
"@ossy/users": "^3.8.0",
|
|
57
|
+
"@ossy/workspaces": "^3.9.0",
|
|
58
58
|
"cookie-parser": "^1.4.7",
|
|
59
59
|
"dotenv": ">=16.0.0 <18.0.0",
|
|
60
60
|
"express": ">=5.0.0 <6.0.0",
|
|
@@ -75,5 +75,5 @@
|
|
|
75
75
|
"Dockerfile",
|
|
76
76
|
"docker-healthcheck.js"
|
|
77
77
|
],
|
|
78
|
-
"gitHead": "
|
|
78
|
+
"gitHead": "f404be69becb27a1fd853a6ff1903554e76e7d17"
|
|
79
79
|
}
|
|
@@ -15,6 +15,15 @@ import { rejectOnAbort } from '../request-diagnostics.js'
|
|
|
15
15
|
|
|
16
16
|
const log = createLogger('platform/task-run')
|
|
17
17
|
|
|
18
|
+
/** Workspace scope must be on every TaskRun event so list projections can Apply it. */
|
|
19
|
+
function taskRunScopePayload ({ taskId, workspaceId }) {
|
|
20
|
+
return {
|
|
21
|
+
taskId,
|
|
22
|
+
moduleId: moduleIdFromTaskId(taskId),
|
|
23
|
+
belongsTo: workspaceId,
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
18
27
|
function assertNotAborted (context) {
|
|
19
28
|
if (context.signal?.aborted) {
|
|
20
29
|
throw context.signal.reason instanceof Error
|
|
@@ -91,6 +100,8 @@ export const TaskRunService = {
|
|
|
91
100
|
const durationMs = Date.now() - startMs
|
|
92
101
|
await TaskRunService._appendCompleted({
|
|
93
102
|
runId,
|
|
103
|
+
taskId,
|
|
104
|
+
workspaceId,
|
|
94
105
|
actorId,
|
|
95
106
|
durationMs,
|
|
96
107
|
resultSummary: summarizeResult(result),
|
|
@@ -114,6 +125,8 @@ export const TaskRunService = {
|
|
|
114
125
|
const durationMs = Date.now() - startMs
|
|
115
126
|
await TaskRunService._appendFailed({
|
|
116
127
|
runId,
|
|
128
|
+
taskId,
|
|
129
|
+
workspaceId,
|
|
117
130
|
actorId,
|
|
118
131
|
durationMs,
|
|
119
132
|
error: summarizeError(error),
|
|
@@ -180,26 +193,34 @@ export const TaskRunService = {
|
|
|
180
193
|
}
|
|
181
194
|
},
|
|
182
195
|
|
|
183
|
-
async _appendCompleted ({ runId, actorId, durationMs, resultSummary }) {
|
|
196
|
+
async _appendCompleted ({ runId, taskId, workspaceId, actorId, durationMs, resultSummary }) {
|
|
184
197
|
try {
|
|
185
198
|
await Aggregate.Of(TaskRun, runId)
|
|
186
199
|
.then(Aggregate.Add({
|
|
187
200
|
event: 'Completed',
|
|
188
201
|
createdBy: actorId ?? undefined,
|
|
189
|
-
payload: {
|
|
202
|
+
payload: {
|
|
203
|
+
durationMs,
|
|
204
|
+
resultSummary,
|
|
205
|
+
...taskRunScopePayload({ taskId, workspaceId }),
|
|
206
|
+
},
|
|
190
207
|
}))
|
|
191
208
|
} catch (err) {
|
|
192
209
|
log.warn('[TaskRunService] Failed to record Completed', { runId }, err)
|
|
193
210
|
}
|
|
194
211
|
},
|
|
195
212
|
|
|
196
|
-
async _appendFailed ({ runId, actorId, durationMs, error }) {
|
|
213
|
+
async _appendFailed ({ runId, taskId, workspaceId, actorId, durationMs, error }) {
|
|
197
214
|
try {
|
|
198
215
|
await Aggregate.Of(TaskRun, runId)
|
|
199
216
|
.then(Aggregate.Add({
|
|
200
217
|
event: 'Failed',
|
|
201
218
|
createdBy: actorId ?? undefined,
|
|
202
|
-
payload: {
|
|
219
|
+
payload: {
|
|
220
|
+
durationMs,
|
|
221
|
+
error,
|
|
222
|
+
...taskRunScopePayload({ taskId, workspaceId }),
|
|
223
|
+
},
|
|
203
224
|
}))
|
|
204
225
|
} catch (err) {
|
|
205
226
|
log.warn('[TaskRunService] Failed to record Failed', { runId }, err)
|
|
@@ -132,12 +132,28 @@ describe('TaskRunList projection', () => {
|
|
|
132
132
|
resourceId: 'run1',
|
|
133
133
|
event: 'Completed',
|
|
134
134
|
created: 2000,
|
|
135
|
-
payload: {
|
|
135
|
+
payload: {
|
|
136
|
+
durationMs: 1000,
|
|
137
|
+
resultSummary: null,
|
|
138
|
+
belongsTo: 'ws1',
|
|
139
|
+
taskId: '@ossy/media-tasks/tasks/resize',
|
|
140
|
+
moduleId: 'media-tasks',
|
|
141
|
+
},
|
|
136
142
|
}, state)
|
|
137
143
|
|
|
138
144
|
expect(state.runs[0].status).toBe('success')
|
|
139
145
|
expect(state.runs[0].durationMs).toBe(1000)
|
|
140
146
|
})
|
|
147
|
+
|
|
148
|
+
it('scopes Completed/Failed from payload.belongsTo (changestream dispatch)', () => {
|
|
149
|
+
expect(TaskRunListProjection.scopeFromEvent({
|
|
150
|
+
payload: { durationMs: 10 },
|
|
151
|
+
})).toBeNull()
|
|
152
|
+
|
|
153
|
+
expect(TaskRunListProjection.scopeFromEvent({
|
|
154
|
+
payload: { durationMs: 10, belongsTo: 'ws1' },
|
|
155
|
+
})).toBe('ws1')
|
|
156
|
+
})
|
|
141
157
|
})
|
|
142
158
|
|
|
143
159
|
describe('ActionInvocation entity fold', () => {
|