@shipfox/api-logs 5.0.0 → 6.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.
Files changed (37) hide show
  1. package/.turbo/turbo-build.log +4 -4
  2. package/CHANGELOG.md +32 -0
  3. package/dist/config.d.ts +1 -0
  4. package/dist/config.d.ts.map +1 -1
  5. package/dist/config.js +5 -10
  6. package/dist/config.js.map +1 -1
  7. package/dist/core/append-logs.d.ts +2 -6
  8. package/dist/core/append-logs.d.ts.map +1 -1
  9. package/dist/core/append-logs.js +7 -16
  10. package/dist/core/append-logs.js.map +1 -1
  11. package/dist/index.d.ts +5 -1
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +63 -59
  14. package/dist/index.js.map +1 -1
  15. package/dist/presentation/routes/append-logs.d.ts +2 -1
  16. package/dist/presentation/routes/append-logs.d.ts.map +1 -1
  17. package/dist/presentation/routes/append-logs.js +61 -61
  18. package/dist/presentation/routes/append-logs.js.map +1 -1
  19. package/dist/presentation/routes/index.d.ts +2 -1
  20. package/dist/presentation/routes/index.d.ts.map +1 -1
  21. package/dist/presentation/routes/index.js +25 -23
  22. package/dist/presentation/routes/index.js.map +1 -1
  23. package/dist/tsconfig.test.tsbuildinfo +1 -1
  24. package/package.json +16 -13
  25. package/src/config.test.ts +8 -32
  26. package/src/config.ts +10 -15
  27. package/src/core/append-logs.test.ts +13 -19
  28. package/src/core/append-logs.ts +12 -20
  29. package/src/index.ts +63 -51
  30. package/src/presentation/routes/append-logs.test.ts +3 -2
  31. package/src/presentation/routes/append-logs.ts +54 -50
  32. package/src/presentation/routes/index.ts +22 -19
  33. package/src/presentation/routes/read-logs.test.ts +3 -2
  34. package/test/env.ts +1 -3
  35. package/test/fixtures/lease-token.ts +2 -1
  36. package/test/fixtures/workflows-client.ts +17 -0
  37. package/tsconfig.build.tsbuildinfo +1 -1
package/test/env.ts CHANGED
@@ -4,9 +4,7 @@ process.env.POSTGRES_USERNAME ??= 'shipfox';
4
4
  process.env.POSTGRES_PASSWORD ??= 'password';
5
5
  process.env.POSTGRES_DATABASE = 'api_test';
6
6
  process.env.POSTGRES_MAX_CONNECTIONS ??= '5';
7
- process.env.AUTH_JWT_SECRET = 'test-secret';
8
- process.env.AUTH_JOB_LEASE_TOKEN_SECRET = 'test-lease-secret';
9
- process.env.AUTH_RUNNER_SESSION_TOKEN_SECRET = 'test-runner-session-secret';
7
+ process.env.AUTH_ROOT_KEY = 'MDEyMzQ1Njc4OWFiY2RlZjAxMjM0NTY3ODlhYmNkZWY=';
10
8
  process.env.SECRETS_ENCRYPTION_KEK = 'ZmVkY2JhOTg3NjU0MzIxMGZlZGNiYTk4NzY1NDMyMTA=';
11
9
 
12
10
  // Small accrual budget so cap/budget tests use tiny payloads: base 100 bytes,
@@ -1,8 +1,9 @@
1
1
  import {JOB_LEASE_TOKEN_AUDIENCE} from '@shipfox/api-auth-dto';
2
+ import {jobLeaseTokenKey} from '@shipfox/node-auth-root-key';
2
3
  import {signHs256} from '@shipfox/node-jwt';
3
4
 
4
5
  // Matches test/env.ts; the lease-token auth method reads this same value from config.
5
- const SECRET = process.env.AUTH_JOB_LEASE_TOKEN_SECRET ?? 'test-lease-secret';
6
+ const SECRET = jobLeaseTokenKey();
6
7
 
7
8
  export interface MintLeaseTokenParams {
8
9
  jobId: string;
@@ -0,0 +1,17 @@
1
+ import {
2
+ type WorkflowsModuleClient,
3
+ workflowsInterModuleContract,
4
+ } from '@shipfox/api-workflows-dto/inter-module';
5
+ import {defineInterModulePresentation} from '@shipfox/inter-module';
6
+ import {createFakeInterModuleClients} from '@shipfox/node-module/inter-module/testing';
7
+
8
+ export function createTestWorkflowsClient(): WorkflowsModuleClient {
9
+ return createFakeInterModuleClients({
10
+ workflows: defineInterModulePresentation(workflowsInterModuleContract, {
11
+ startRunFromTrigger: vi.fn(),
12
+ deliverEventToJobListener: vi.fn(),
13
+ getStepLogContext: () => ({harness: 'pi' as const}),
14
+ getLeasedAgentToolContext: vi.fn(),
15
+ }),
16
+ }).workflows;
17
+ }