@shipfox/api-server 16.0.0 → 16.1.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/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +27 -0
- package/dist/modules.d.ts +9 -0
- package/dist/modules.d.ts.map +1 -1
- package/dist/modules.js +2 -1
- package/dist/modules.js.map +1 -1
- package/dist/tsconfig.test.tsbuildinfo +1 -1
- package/package.json +11 -11
- package/src/modules.test.ts +17 -5
- package/src/modules.ts +13 -1
- package/tsconfig.build.tsbuildinfo +1 -1
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@shipfox/api-server",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"private": false,
|
|
5
|
-
"version": "16.
|
|
5
|
+
"version": "16.1.0",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "git+https://github.com/ShipfoxHQ/shipfox.git",
|
|
@@ -24,26 +24,26 @@
|
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@shipfox/annotations": "15.0.0",
|
|
26
26
|
"@shipfox/annotations-dto": "12.3.0",
|
|
27
|
-
"@shipfox/api-agent": "16.
|
|
28
|
-
"@shipfox/api-agent-dto": "16.
|
|
27
|
+
"@shipfox/api-agent": "16.1.0",
|
|
28
|
+
"@shipfox/api-agent-dto": "16.1.0",
|
|
29
29
|
"@shipfox/api-auth": "15.0.0",
|
|
30
30
|
"@shipfox/api-auth-dto": "15.0.0",
|
|
31
|
-
"@shipfox/api-definitions": "16.
|
|
32
|
-
"@shipfox/api-definitions-dto": "16.
|
|
31
|
+
"@shipfox/api-definitions": "16.1.0",
|
|
32
|
+
"@shipfox/api-definitions-dto": "16.1.0",
|
|
33
33
|
"@shipfox/api-dispatcher": "15.0.0",
|
|
34
34
|
"@shipfox/api-email-challenges": "1.1.10",
|
|
35
|
-
"@shipfox/api-integration-core": "16.
|
|
35
|
+
"@shipfox/api-integration-core": "16.1.0",
|
|
36
36
|
"@shipfox/api-integration-core-dto": "16.0.0",
|
|
37
|
-
"@shipfox/api-logs": "16.
|
|
37
|
+
"@shipfox/api-logs": "16.1.0",
|
|
38
38
|
"@shipfox/api-projects": "16.0.0",
|
|
39
39
|
"@shipfox/api-projects-dto": "15.0.0",
|
|
40
|
-
"@shipfox/api-runners": "16.
|
|
40
|
+
"@shipfox/api-runners": "16.1.0",
|
|
41
41
|
"@shipfox/api-runners-dto": "16.0.0",
|
|
42
42
|
"@shipfox/api-secrets": "15.0.0",
|
|
43
43
|
"@shipfox/api-secrets-dto": "12.0.0",
|
|
44
|
-
"@shipfox/api-triggers": "16.
|
|
45
|
-
"@shipfox/api-workflows": "16.
|
|
46
|
-
"@shipfox/api-workflows-dto": "16.
|
|
44
|
+
"@shipfox/api-triggers": "16.1.0",
|
|
45
|
+
"@shipfox/api-workflows": "16.1.0",
|
|
46
|
+
"@shipfox/api-workflows-dto": "16.1.0",
|
|
47
47
|
"@shipfox/api-workspaces-dto": "15.0.0",
|
|
48
48
|
"@shipfox/api-workspaces": "16.0.0",
|
|
49
49
|
"@shipfox/config": "1.2.4",
|
package/src/modules.test.ts
CHANGED
|
@@ -207,6 +207,8 @@ describe('defaultModules', () => {
|
|
|
207
207
|
getValidationCatalog: vi.fn(),
|
|
208
208
|
resolveAgentConfig: vi.fn(),
|
|
209
209
|
resolveRuntimeCredentials: vi.fn(),
|
|
210
|
+
claimSession: vi.fn(),
|
|
211
|
+
carryOverSessions: vi.fn(),
|
|
210
212
|
},
|
|
211
213
|
},
|
|
212
214
|
],
|
|
@@ -246,6 +248,7 @@ describe('defaultModules', () => {
|
|
|
246
248
|
deliverEventToJobListener: vi.fn(),
|
|
247
249
|
getLeasedAgentToolContext: vi.fn(),
|
|
248
250
|
getStepLogContext: vi.fn(),
|
|
251
|
+
listJobStepAttempts: vi.fn(),
|
|
249
252
|
resolveWorkflowRunTriggerReference: vi.fn(),
|
|
250
253
|
startDevRun: vi.fn(),
|
|
251
254
|
startRunFromTrigger: vi.fn(),
|
|
@@ -329,15 +332,18 @@ describe('defaultModules', () => {
|
|
|
329
332
|
it('uses the default Agent module factory when none is supplied', async () => {
|
|
330
333
|
await defaultModules();
|
|
331
334
|
|
|
332
|
-
expect(mocks.createAgentModule).toHaveBeenCalledWith({
|
|
335
|
+
expect(mocks.createAgentModule).toHaveBeenCalledWith({
|
|
336
|
+
secrets: expect.any(Object),
|
|
337
|
+
workflows: expect.any(Object),
|
|
338
|
+
});
|
|
333
339
|
expect(mocks.createAgentModule.mock.calls[0]?.[0].secrets).not.toHaveProperty('getSecret');
|
|
334
340
|
});
|
|
335
341
|
|
|
336
342
|
it('composes Agent with the shared Secrets client and registers the supplied module', async () => {
|
|
337
343
|
const customAgentModule = mocks.createAgentModule();
|
|
338
344
|
mocks.createAgentModule.mockClear();
|
|
339
|
-
const agentModule = vi.fn<DefaultAgentModuleFactory>((
|
|
340
|
-
mocks.createAgentModule(
|
|
345
|
+
const agentModule = vi.fn<DefaultAgentModuleFactory>((options) =>
|
|
346
|
+
mocks.createAgentModule(options),
|
|
341
347
|
);
|
|
342
348
|
|
|
343
349
|
const modules = await defaultModules({agentModule});
|
|
@@ -352,7 +358,10 @@ describe('defaultModules', () => {
|
|
|
352
358
|
};
|
|
353
359
|
const secretValues = await agentSecrets.getSecretsByNamespace(scope);
|
|
354
360
|
|
|
355
|
-
expect(agentModule).toHaveBeenCalledWith({
|
|
361
|
+
expect(agentModule).toHaveBeenCalledWith({
|
|
362
|
+
secrets: expect.any(Object),
|
|
363
|
+
workflows: expect.any(Object),
|
|
364
|
+
});
|
|
356
365
|
expect(secretValues).toEqual({values: {}});
|
|
357
366
|
expect(mocks.getSecretsByNamespace).toHaveBeenCalledWith(
|
|
358
367
|
scope,
|
|
@@ -360,7 +369,10 @@ describe('defaultModules', () => {
|
|
|
360
369
|
);
|
|
361
370
|
expect(agentSecrets).not.toHaveProperty('getSecret');
|
|
362
371
|
expect(agentSecrets).not.toHaveProperty('getVariablesByNamespace');
|
|
363
|
-
expect(mocks.createAgentModule).toHaveBeenCalledWith({
|
|
372
|
+
expect(mocks.createAgentModule).toHaveBeenCalledWith({
|
|
373
|
+
secrets: agentSecrets,
|
|
374
|
+
workflows: expect.any(Object),
|
|
375
|
+
});
|
|
364
376
|
expect(mocks.createAgentModule).toHaveBeenCalledTimes(1);
|
|
365
377
|
expect(modules.filter((module) => module.name === 'agent')).toEqual([customAgentModule]);
|
|
366
378
|
expect(
|
package/src/modules.ts
CHANGED
|
@@ -26,7 +26,10 @@ import {
|
|
|
26
26
|
} from '@shipfox/api-secrets-dto/inter-module';
|
|
27
27
|
import {createTriggersModule} from '@shipfox/api-triggers';
|
|
28
28
|
import {createWorkflowsModule} from '@shipfox/api-workflows';
|
|
29
|
-
import {
|
|
29
|
+
import {
|
|
30
|
+
type WorkflowsModuleClient,
|
|
31
|
+
workflowsInterModuleContract,
|
|
32
|
+
} from '@shipfox/api-workflows-dto/inter-module';
|
|
30
33
|
import {createWorkspacesModule} from '@shipfox/api-workspaces';
|
|
31
34
|
import {
|
|
32
35
|
type WorkspacesInterModuleClient,
|
|
@@ -62,6 +65,14 @@ export type DefaultAuthModuleFactory = (options: {
|
|
|
62
65
|
*/
|
|
63
66
|
export type DefaultAgentModuleFactory = (options: {
|
|
64
67
|
secrets: Pick<SecretsInterModuleClient, 'deleteSecrets' | 'getSecretsByNamespace' | 'setSecrets'>;
|
|
68
|
+
/**
|
|
69
|
+
* Optional: the step-attempt-terminated release and the stale-claim reap cron
|
|
70
|
+
* are always registered so composed claim creators get a release backstop;
|
|
71
|
+
* only the job-terminated grace sweep is gated on this client, so a factory
|
|
72
|
+
* built without it stays claim/release-free (as before the session release
|
|
73
|
+
* stack landed).
|
|
74
|
+
*/
|
|
75
|
+
workflows?: WorkflowsModuleClient | undefined;
|
|
65
76
|
}) => ShipfoxModule;
|
|
66
77
|
export type DefaultRunnersModuleFactory = (options: {auth: AuthInterModuleClient}) => ShipfoxModule;
|
|
67
78
|
export type DefaultModulesExtension = (options: {
|
|
@@ -183,6 +194,7 @@ export async function defaultModules(
|
|
|
183
194
|
const extensionModules = options.extension?.({workspaces: workspacesClient}) ?? [];
|
|
184
195
|
const agentModule = (options.agentModule ?? createAgentModule)({
|
|
185
196
|
secrets: createAgentSecretsClient(secretsClient),
|
|
197
|
+
workflows: workflowsClient,
|
|
186
198
|
});
|
|
187
199
|
if (options.agentModule) validateCustomAgentModule(agentModule);
|
|
188
200
|
|