@shipfox/api-server 16.0.0 → 17.0.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 +61 -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 +20 -20
- package/src/modules.test.ts +18 -5
- package/src/modules.ts +13 -1
- package/test/published/_environment.mjs +7 -6
- 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": "17.0.0",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "git+https://github.com/ShipfoxHQ/shipfox.git",
|
|
@@ -22,37 +22,37 @@
|
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@shipfox/annotations": "
|
|
25
|
+
"@shipfox/annotations": "17.0.0",
|
|
26
|
+
"@shipfox/api-agent": "17.0.0",
|
|
26
27
|
"@shipfox/annotations-dto": "12.3.0",
|
|
27
|
-
"@shipfox/api-agent": "
|
|
28
|
-
"@shipfox/api-
|
|
29
|
-
"@shipfox/api-auth": "
|
|
30
|
-
"@shipfox/api-
|
|
31
|
-
"@shipfox/api-
|
|
32
|
-
"@shipfox/api-
|
|
33
|
-
"@shipfox/api-
|
|
34
|
-
"@shipfox/api-email-challenges": "1.1.10",
|
|
35
|
-
"@shipfox/api-integration-core": "16.0.0",
|
|
28
|
+
"@shipfox/api-agent-dto": "17.0.0",
|
|
29
|
+
"@shipfox/api-auth": "17.0.0",
|
|
30
|
+
"@shipfox/api-auth-dto": "17.0.0",
|
|
31
|
+
"@shipfox/api-definitions": "17.0.0",
|
|
32
|
+
"@shipfox/api-dispatcher": "17.0.0",
|
|
33
|
+
"@shipfox/api-integration-core": "17.0.0",
|
|
34
|
+
"@shipfox/api-email-challenges": "1.1.11",
|
|
36
35
|
"@shipfox/api-integration-core-dto": "16.0.0",
|
|
37
|
-
"@shipfox/api-logs": "
|
|
38
|
-
"@shipfox/api-projects": "16.0.0",
|
|
36
|
+
"@shipfox/api-logs": "17.0.0",
|
|
39
37
|
"@shipfox/api-projects-dto": "15.0.0",
|
|
40
|
-
"@shipfox/api-
|
|
38
|
+
"@shipfox/api-projects": "17.0.0",
|
|
39
|
+
"@shipfox/api-definitions-dto": "17.0.0",
|
|
40
|
+
"@shipfox/api-runners": "17.0.0",
|
|
41
41
|
"@shipfox/api-runners-dto": "16.0.0",
|
|
42
|
-
"@shipfox/api-secrets": "
|
|
42
|
+
"@shipfox/api-secrets": "17.0.0",
|
|
43
43
|
"@shipfox/api-secrets-dto": "12.0.0",
|
|
44
|
-
"@shipfox/api-triggers": "
|
|
45
|
-
"@shipfox/api-workflows": "16.0.0",
|
|
46
|
-
"@shipfox/api-workflows-dto": "16.0.0",
|
|
44
|
+
"@shipfox/api-triggers": "17.0.0",
|
|
47
45
|
"@shipfox/api-workspaces-dto": "15.0.0",
|
|
48
|
-
"@shipfox/api-
|
|
46
|
+
"@shipfox/api-workflows": "17.0.0",
|
|
47
|
+
"@shipfox/api-workspaces": "17.0.0",
|
|
49
48
|
"@shipfox/config": "1.2.4",
|
|
50
49
|
"@shipfox/node-error-monitoring": "0.3.0",
|
|
51
50
|
"@shipfox/node-fastify": "0.4.3",
|
|
51
|
+
"@shipfox/api-workflows-dto": "17.0.0",
|
|
52
52
|
"@shipfox/node-jwt": "0.4.0",
|
|
53
53
|
"@shipfox/node-module": "1.0.7",
|
|
54
54
|
"@shipfox/node-opentelemetry": "0.6.5",
|
|
55
|
-
"@shipfox/node-postgres": "0.5.
|
|
55
|
+
"@shipfox/node-postgres": "0.5.1"
|
|
56
56
|
},
|
|
57
57
|
"imports": {
|
|
58
58
|
"#*": "./dist/*"
|
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
|
],
|
|
@@ -244,8 +246,10 @@ describe('defaultModules', () => {
|
|
|
244
246
|
contract: workflowsInterModuleContract,
|
|
245
247
|
handlers: {
|
|
246
248
|
deliverEventToJobListener: vi.fn(),
|
|
249
|
+
getLeasedAgentSessionContext: vi.fn(),
|
|
247
250
|
getLeasedAgentToolContext: vi.fn(),
|
|
248
251
|
getStepLogContext: vi.fn(),
|
|
252
|
+
listJobStepAttempts: vi.fn(),
|
|
249
253
|
resolveWorkflowRunTriggerReference: vi.fn(),
|
|
250
254
|
startDevRun: vi.fn(),
|
|
251
255
|
startRunFromTrigger: vi.fn(),
|
|
@@ -329,15 +333,18 @@ describe('defaultModules', () => {
|
|
|
329
333
|
it('uses the default Agent module factory when none is supplied', async () => {
|
|
330
334
|
await defaultModules();
|
|
331
335
|
|
|
332
|
-
expect(mocks.createAgentModule).toHaveBeenCalledWith({
|
|
336
|
+
expect(mocks.createAgentModule).toHaveBeenCalledWith({
|
|
337
|
+
secrets: expect.any(Object),
|
|
338
|
+
workflows: expect.any(Object),
|
|
339
|
+
});
|
|
333
340
|
expect(mocks.createAgentModule.mock.calls[0]?.[0].secrets).not.toHaveProperty('getSecret');
|
|
334
341
|
});
|
|
335
342
|
|
|
336
343
|
it('composes Agent with the shared Secrets client and registers the supplied module', async () => {
|
|
337
344
|
const customAgentModule = mocks.createAgentModule();
|
|
338
345
|
mocks.createAgentModule.mockClear();
|
|
339
|
-
const agentModule = vi.fn<DefaultAgentModuleFactory>((
|
|
340
|
-
mocks.createAgentModule(
|
|
346
|
+
const agentModule = vi.fn<DefaultAgentModuleFactory>((options) =>
|
|
347
|
+
mocks.createAgentModule(options),
|
|
341
348
|
);
|
|
342
349
|
|
|
343
350
|
const modules = await defaultModules({agentModule});
|
|
@@ -352,7 +359,10 @@ describe('defaultModules', () => {
|
|
|
352
359
|
};
|
|
353
360
|
const secretValues = await agentSecrets.getSecretsByNamespace(scope);
|
|
354
361
|
|
|
355
|
-
expect(agentModule).toHaveBeenCalledWith({
|
|
362
|
+
expect(agentModule).toHaveBeenCalledWith({
|
|
363
|
+
secrets: expect.any(Object),
|
|
364
|
+
workflows: expect.any(Object),
|
|
365
|
+
});
|
|
356
366
|
expect(secretValues).toEqual({values: {}});
|
|
357
367
|
expect(mocks.getSecretsByNamespace).toHaveBeenCalledWith(
|
|
358
368
|
scope,
|
|
@@ -360,7 +370,10 @@ describe('defaultModules', () => {
|
|
|
360
370
|
);
|
|
361
371
|
expect(agentSecrets).not.toHaveProperty('getSecret');
|
|
362
372
|
expect(agentSecrets).not.toHaveProperty('getVariablesByNamespace');
|
|
363
|
-
expect(mocks.createAgentModule).toHaveBeenCalledWith({
|
|
373
|
+
expect(mocks.createAgentModule).toHaveBeenCalledWith({
|
|
374
|
+
secrets: agentSecrets,
|
|
375
|
+
workflows: expect.any(Object),
|
|
376
|
+
});
|
|
364
377
|
expect(mocks.createAgentModule).toHaveBeenCalledTimes(1);
|
|
365
378
|
expect(modules.filter((module) => module.name === 'agent')).toEqual([customAgentModule]);
|
|
366
379
|
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
|
|
|
@@ -37,12 +37,13 @@ export function publishedTestEnvironment() {
|
|
|
37
37
|
SLACK_OAUTH_CLIENT_SECRET: 'external-consumer-client-secret',
|
|
38
38
|
SLACK_OAUTH_REDIRECT_URL: 'https://shipfox.example.com/integrations/slack/callback',
|
|
39
39
|
SLACK_SIGNING_SECRET: 'external-consumer-signing-secret',
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
40
|
+
OBJECT_STORAGE_S3_ACCESS_KEY_ID: 'external-consumer-access-key',
|
|
41
|
+
OBJECT_STORAGE_S3_BUCKET: 'shipfox',
|
|
42
|
+
OBJECT_STORAGE_S3_ENDPOINT: 'http://127.0.0.1:3900',
|
|
43
|
+
OBJECT_STORAGE_S3_FORCE_PATH_STYLE: 'true',
|
|
44
|
+
OBJECT_STORAGE_S3_REGION: 'garage',
|
|
45
|
+
OBJECT_STORAGE_S3_SECRET_ACCESS_KEY: 'external-consumer-secret-key',
|
|
46
|
+
AGENT_SESSION_ENCRYPTION_KEK: 'MDEyMzQ1Njc4OWFiY2RlZjAxMjM0NTY3ODlhYmNkZWY=',
|
|
46
47
|
POSTGRES_DATABASE: postgresDatabase,
|
|
47
48
|
POSTGRES_HOST: postgresHost,
|
|
48
49
|
POSTGRES_MAX_CONNECTIONS: '5',
|