@shipfox/api-server 15.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 +54 -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 +15 -15
- package/src/modules.test.ts +18 -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": "
|
|
5
|
+
"version": "16.1.0",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "git+https://github.com/ShipfoxHQ/shipfox.git",
|
|
@@ -24,28 +24,28 @@
|
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@shipfox/annotations": "15.0.0",
|
|
26
26
|
"@shipfox/annotations-dto": "12.3.0",
|
|
27
|
-
"@shipfox/api-agent": "
|
|
28
|
-
"@shipfox/api-agent-dto": "
|
|
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": "
|
|
32
|
-
"@shipfox/api-definitions-dto": "
|
|
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": "
|
|
36
|
-
"@shipfox/api-integration-core-dto": "
|
|
37
|
-
"@shipfox/api-logs": "
|
|
38
|
-
"@shipfox/api-projects": "
|
|
35
|
+
"@shipfox/api-integration-core": "16.1.0",
|
|
36
|
+
"@shipfox/api-integration-core-dto": "16.0.0",
|
|
37
|
+
"@shipfox/api-logs": "16.1.0",
|
|
38
|
+
"@shipfox/api-projects": "16.0.0",
|
|
39
39
|
"@shipfox/api-projects-dto": "15.0.0",
|
|
40
|
-
"@shipfox/api-runners": "
|
|
41
|
-
"@shipfox/api-runners-dto": "
|
|
40
|
+
"@shipfox/api-runners": "16.1.0",
|
|
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": "
|
|
45
|
-
"@shipfox/api-workflows": "
|
|
46
|
-
"@shipfox/api-workflows-dto": "
|
|
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
|
-
"@shipfox/api-workspaces": "
|
|
48
|
+
"@shipfox/api-workspaces": "16.0.0",
|
|
49
49
|
"@shipfox/config": "1.2.4",
|
|
50
50
|
"@shipfox/node-error-monitoring": "0.3.0",
|
|
51
51
|
"@shipfox/node-fastify": "0.4.3",
|
package/src/modules.test.ts
CHANGED
|
@@ -121,6 +121,7 @@ describe('defaultModules', () => {
|
|
|
121
121
|
name: 'integrations',
|
|
122
122
|
interModulePresentations: [
|
|
123
123
|
defineInterModulePresentation(integrationsInterModuleContract, {
|
|
124
|
+
callTool: vi.fn(),
|
|
124
125
|
createCheckoutSpec: vi.fn(),
|
|
125
126
|
fetchSourceFile: vi.fn(),
|
|
126
127
|
getAgentToolsContext: vi.fn(),
|
|
@@ -206,6 +207,8 @@ describe('defaultModules', () => {
|
|
|
206
207
|
getValidationCatalog: vi.fn(),
|
|
207
208
|
resolveAgentConfig: vi.fn(),
|
|
208
209
|
resolveRuntimeCredentials: vi.fn(),
|
|
210
|
+
claimSession: vi.fn(),
|
|
211
|
+
carryOverSessions: vi.fn(),
|
|
209
212
|
},
|
|
210
213
|
},
|
|
211
214
|
],
|
|
@@ -245,6 +248,7 @@ describe('defaultModules', () => {
|
|
|
245
248
|
deliverEventToJobListener: vi.fn(),
|
|
246
249
|
getLeasedAgentToolContext: vi.fn(),
|
|
247
250
|
getStepLogContext: vi.fn(),
|
|
251
|
+
listJobStepAttempts: vi.fn(),
|
|
248
252
|
resolveWorkflowRunTriggerReference: vi.fn(),
|
|
249
253
|
startDevRun: vi.fn(),
|
|
250
254
|
startRunFromTrigger: vi.fn(),
|
|
@@ -328,15 +332,18 @@ describe('defaultModules', () => {
|
|
|
328
332
|
it('uses the default Agent module factory when none is supplied', async () => {
|
|
329
333
|
await defaultModules();
|
|
330
334
|
|
|
331
|
-
expect(mocks.createAgentModule).toHaveBeenCalledWith({
|
|
335
|
+
expect(mocks.createAgentModule).toHaveBeenCalledWith({
|
|
336
|
+
secrets: expect.any(Object),
|
|
337
|
+
workflows: expect.any(Object),
|
|
338
|
+
});
|
|
332
339
|
expect(mocks.createAgentModule.mock.calls[0]?.[0].secrets).not.toHaveProperty('getSecret');
|
|
333
340
|
});
|
|
334
341
|
|
|
335
342
|
it('composes Agent with the shared Secrets client and registers the supplied module', async () => {
|
|
336
343
|
const customAgentModule = mocks.createAgentModule();
|
|
337
344
|
mocks.createAgentModule.mockClear();
|
|
338
|
-
const agentModule = vi.fn<DefaultAgentModuleFactory>((
|
|
339
|
-
mocks.createAgentModule(
|
|
345
|
+
const agentModule = vi.fn<DefaultAgentModuleFactory>((options) =>
|
|
346
|
+
mocks.createAgentModule(options),
|
|
340
347
|
);
|
|
341
348
|
|
|
342
349
|
const modules = await defaultModules({agentModule});
|
|
@@ -351,7 +358,10 @@ describe('defaultModules', () => {
|
|
|
351
358
|
};
|
|
352
359
|
const secretValues = await agentSecrets.getSecretsByNamespace(scope);
|
|
353
360
|
|
|
354
|
-
expect(agentModule).toHaveBeenCalledWith({
|
|
361
|
+
expect(agentModule).toHaveBeenCalledWith({
|
|
362
|
+
secrets: expect.any(Object),
|
|
363
|
+
workflows: expect.any(Object),
|
|
364
|
+
});
|
|
355
365
|
expect(secretValues).toEqual({values: {}});
|
|
356
366
|
expect(mocks.getSecretsByNamespace).toHaveBeenCalledWith(
|
|
357
367
|
scope,
|
|
@@ -359,7 +369,10 @@ describe('defaultModules', () => {
|
|
|
359
369
|
);
|
|
360
370
|
expect(agentSecrets).not.toHaveProperty('getSecret');
|
|
361
371
|
expect(agentSecrets).not.toHaveProperty('getVariablesByNamespace');
|
|
362
|
-
expect(mocks.createAgentModule).toHaveBeenCalledWith({
|
|
372
|
+
expect(mocks.createAgentModule).toHaveBeenCalledWith({
|
|
373
|
+
secrets: agentSecrets,
|
|
374
|
+
workflows: expect.any(Object),
|
|
375
|
+
});
|
|
363
376
|
expect(mocks.createAgentModule).toHaveBeenCalledTimes(1);
|
|
364
377
|
expect(modules.filter((module) => module.name === 'agent')).toEqual([customAgentModule]);
|
|
365
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
|
|