@shipfox/api-runners-dto 12.4.0 → 14.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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@shipfox/api-runners-dto",
3
3
  "license": "MIT",
4
- "version": "12.4.0",
4
+ "version": "14.0.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/ShipfoxHQ/shipfox.git",
package/src/events.ts CHANGED
@@ -4,7 +4,6 @@ const nonEmptyStringSchema = z.string().nonempty();
4
4
  const isoDateTimeSchema = z.string().datetime();
5
5
 
6
6
  export const RUNNER_JOB_LEASE_EXPIRED = 'runners.job.lease_expired' as const;
7
- export const RUNNER_JOB_QUEUED = 'runners.job.queued' as const;
8
7
  export const RUNNER_JOB_CLAIMED = 'runners.job.claimed' as const;
9
8
 
10
9
  export const runnerJobLeaseExpiredEventSchema = z.object({
@@ -15,15 +14,6 @@ export const runnerJobLeaseExpiredEventSchema = z.object({
15
14
  });
16
15
  export type RunnerJobLeaseExpiredEvent = z.infer<typeof runnerJobLeaseExpiredEventSchema>;
17
16
 
18
- export const runnerJobQueuedEventSchema = z.object({
19
- workflowRunId: nonEmptyStringSchema,
20
- workflowRunAttemptId: nonEmptyStringSchema,
21
- jobId: nonEmptyStringSchema,
22
- jobExecutionId: nonEmptyStringSchema,
23
- queuedAt: isoDateTimeSchema,
24
- });
25
- export type RunnerJobQueuedEvent = z.infer<typeof runnerJobQueuedEventSchema>;
26
-
27
17
  export const runnerJobClaimedEventSchema = z.object({
28
18
  workflowRunId: nonEmptyStringSchema,
29
19
  workflowRunAttemptId: nonEmptyStringSchema,
@@ -35,12 +25,10 @@ export type RunnerJobClaimedEvent = z.infer<typeof runnerJobClaimedEventSchema>;
35
25
 
36
26
  export interface RunnersEventMap {
37
27
  [RUNNER_JOB_LEASE_EXPIRED]: RunnerJobLeaseExpiredEvent;
38
- [RUNNER_JOB_QUEUED]: RunnerJobQueuedEvent;
39
28
  [RUNNER_JOB_CLAIMED]: RunnerJobClaimedEvent;
40
29
  }
41
30
 
42
31
  export const runnersEventSchemas = {
43
32
  [RUNNER_JOB_LEASE_EXPIRED]: runnerJobLeaseExpiredEventSchema,
44
- [RUNNER_JOB_QUEUED]: runnerJobQueuedEventSchema,
45
33
  [RUNNER_JOB_CLAIMED]: runnerJobClaimedEventSchema,
46
34
  } satisfies Record<keyof RunnersEventMap, z.ZodType>;
package/src/index.ts CHANGED
@@ -39,7 +39,9 @@ export {
39
39
  heartbeatBodySchema,
40
40
  heartbeatResponseSchema,
41
41
  type InstallationProvisionerTokenStatus,
42
+ type InstallationRunnersStatus,
42
43
  installationProvisionerTokenStatusSchema,
44
+ installationRunnersStatusSchema,
43
45
  type ListActiveProvisionersResponseDto,
44
46
  type ListAdministratorProvisionerTokensQueryDto,
45
47
  type ListAdministratorProvisionerTokensResponseDto,
@@ -138,13 +140,10 @@ export {
138
140
  export {
139
141
  RUNNER_JOB_CLAIMED,
140
142
  RUNNER_JOB_LEASE_EXPIRED,
141
- RUNNER_JOB_QUEUED,
142
143
  type RunnerJobClaimedEvent,
143
144
  type RunnerJobLeaseExpiredEvent,
144
- type RunnerJobQueuedEvent,
145
145
  type RunnersEventMap,
146
146
  runnerJobClaimedEventSchema,
147
147
  runnerJobLeaseExpiredEventSchema,
148
- runnerJobQueuedEventSchema,
149
148
  runnersEventSchemas,
150
149
  } from './events.js';
@@ -1,22 +1,6 @@
1
1
  import {runnersInterModuleContract} from './inter-module.js';
2
2
 
3
- const id = '00000000-0000-4000-8000-000000000001';
4
-
5
3
  describe('runnersInterModuleContract', () => {
6
- test('accepts stable job-execution identities for idempotent commands', () => {
7
- const input = runnersInterModuleContract.methods.enqueueJobExecution.input.parse({
8
- workspaceId: id,
9
- workflowRunId: id,
10
- workflowRunAttemptId: id,
11
- jobId: id,
12
- jobExecutionId: id,
13
- projectId: id,
14
- requiredLabels: ['linux'],
15
- });
16
-
17
- expect(input.jobExecutionId).toBe(id);
18
- });
19
-
20
4
  test('exposes bounded JSON capability results', () => {
21
5
  const result =
22
6
  runnersInterModuleContract.methods.getEffectiveRunnerToolCapabilities.output.parse({
@@ -29,12 +13,4 @@ describe('runnersInterModuleContract', () => {
29
13
  reportFresh: true,
30
14
  });
31
15
  });
32
-
33
- test('defines the scheduling validation failure', () => {
34
- const details = runnersInterModuleContract.methods.enqueueJobExecution.errors[
35
- 'empty-required-labels'
36
- ].parse({});
37
-
38
- expect(details).toEqual({});
39
- });
40
16
  });
@@ -7,29 +7,6 @@ const idSchema = z.string().uuid();
7
7
  export const runnersInterModuleContract = defineInterModuleContract({
8
8
  module: 'runners',
9
9
  methods: {
10
- enqueueJobExecution: {
11
- input: z.object({
12
- workspaceId: idSchema,
13
- workflowRunId: idSchema,
14
- workflowRunAttemptId: idSchema,
15
- jobId: idSchema,
16
- jobExecutionId: idSchema,
17
- projectId: idSchema,
18
- requiredLabels: z.array(z.string()),
19
- }),
20
- output: z.object({}),
21
- errors: {
22
- 'empty-required-labels': z.object({}),
23
- },
24
- },
25
- releaseJobExecution: {
26
- input: z.object({jobExecutionId: idSchema}),
27
- output: z.object({}),
28
- },
29
- cancelJobs: {
30
- input: z.object({jobIds: z.array(idSchema)}),
31
- output: z.object({}),
32
- },
33
10
  getLeaseState: {
34
11
  input: z.object({
35
12
  jobId: idSchema,
@@ -50,6 +50,8 @@ export {
50
50
  export {
51
51
  type ActiveProvisionerDto,
52
52
  activeProvisionerDtoSchema,
53
+ type InstallationRunnersStatus,
54
+ installationRunnersStatusSchema,
53
55
  type ListActiveProvisionersResponseDto,
54
56
  listActiveProvisionersResponseSchema,
55
57
  } from './list-active-provisioners.js';
@@ -0,0 +1,44 @@
1
+ import {
2
+ installationRunnersStatusSchema,
3
+ listActiveProvisionersResponseSchema,
4
+ } from './list-active-provisioners.js';
5
+
6
+ describe('list active provisioners schemas', () => {
7
+ it('accepts an installation_runners status of managed', () => {
8
+ expect(installationRunnersStatusSchema.parse('managed')).toBe('managed');
9
+ });
10
+
11
+ it('accepts an installation_runners status of none', () => {
12
+ expect(installationRunnersStatusSchema.parse('none')).toBe('none');
13
+ });
14
+
15
+ it('rejects any other installation_runners status', () => {
16
+ const result = installationRunnersStatusSchema.safeParse('unknown');
17
+
18
+ expect(result.success).toBe(false);
19
+ });
20
+
21
+ it('parses a response with provisioners and installation_runners', () => {
22
+ const response = {
23
+ provisioners: [
24
+ {
25
+ id: crypto.randomUUID(),
26
+ name: 'Docker provisioner',
27
+ prefix: 'sf_pt_abcde',
28
+ last_seen_at: '2026-05-08T01:00:00.000Z',
29
+ },
30
+ ],
31
+ installation_runners: 'managed',
32
+ };
33
+
34
+ expect(listActiveProvisionersResponseSchema.parse(response)).toEqual(response);
35
+ });
36
+
37
+ it('defaults installation_runners for responses from older servers', () => {
38
+ const result = listActiveProvisionersResponseSchema.parse({
39
+ provisioners: [],
40
+ });
41
+
42
+ expect(result).toEqual({provisioners: [], installation_runners: 'none'});
43
+ });
44
+ });
@@ -1,5 +1,7 @@
1
1
  import {z} from 'zod';
2
2
 
3
+ export const installationRunnersStatusSchema = z.enum(['managed', 'none']);
4
+
3
5
  export const activeProvisionerDtoSchema = z.object({
4
6
  id: z.string().uuid(),
5
7
  name: z.string().nullable(),
@@ -9,8 +11,10 @@ export const activeProvisionerDtoSchema = z.object({
9
11
 
10
12
  export const listActiveProvisionersResponseSchema = z.object({
11
13
  provisioners: z.array(activeProvisionerDtoSchema),
14
+ installation_runners: installationRunnersStatusSchema.default('none'),
12
15
  });
13
16
 
17
+ export type InstallationRunnersStatus = z.infer<typeof installationRunnersStatusSchema>;
14
18
  export type ActiveProvisionerDto = z.infer<typeof activeProvisionerDtoSchema>;
15
19
  export type ListActiveProvisionersResponseDto = z.infer<
16
20
  typeof listActiveProvisionersResponseSchema