@shipfox/api-runners-dto 6.0.0 → 9.0.1
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 +22 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/schemas/assign-runner-instances.d.ts +11 -0
- package/dist/schemas/assign-runner-instances.d.ts.map +1 -0
- package/dist/schemas/assign-runner-instances.js +15 -0
- package/dist/schemas/assign-runner-instances.js.map +1 -0
- package/dist/schemas/index.d.ts +2 -3
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/index.js +2 -3
- package/dist/schemas/index.js.map +1 -1
- package/dist/schemas/report-runner-instances.d.ts +2 -17
- package/dist/schemas/report-runner-instances.d.ts.map +1 -1
- package/dist/schemas/report-runner-instances.js +1 -13
- package/dist/schemas/report-runner-instances.js.map +1 -1
- package/dist/tsconfig.test.tsbuildinfo +1 -1
- package/package.json +5 -14
- package/src/index.ts +4 -21
- package/src/schemas/assign-runner-instances.test.ts +27 -0
- package/src/schemas/assign-runner-instances.ts +19 -0
- package/src/schemas/index.ts +5 -24
- package/src/schemas/report-runner-instances.ts +1 -21
- package/tsconfig.build.tsbuildinfo +1 -1
- package/dist/schemas/assign-capacity.d.ts +0 -18
- package/dist/schemas/assign-capacity.d.ts.map +0 -1
- package/dist/schemas/assign-capacity.js +0 -19
- package/dist/schemas/assign-capacity.js.map +0 -1
- package/dist/schemas/mint-registration-tokens.d.ts +0 -28
- package/dist/schemas/mint-registration-tokens.d.ts.map +0 -1
- package/dist/schemas/mint-registration-tokens.js +0 -24
- package/dist/schemas/mint-registration-tokens.js.map +0 -1
- package/src/schemas/assign-capacity.ts +0 -22
- package/src/schemas/mint-registration-tokens.test.ts +0 -28
- package/src/schemas/mint-registration-tokens.ts +0 -38
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shipfox/api-runners-dto",
|
|
3
3
|
"license": "MIT",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "9.0.1",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/ShipfoxHQ/shipfox.git",
|
|
@@ -11,10 +11,6 @@
|
|
|
11
11
|
"type": "module",
|
|
12
12
|
"main": "dist/index.js",
|
|
13
13
|
"types": "dist/index.d.ts",
|
|
14
|
-
"imports": {
|
|
15
|
-
"#test/*": "./test/*",
|
|
16
|
-
"#*": "./dist/*"
|
|
17
|
-
},
|
|
18
14
|
"exports": {
|
|
19
15
|
".": {
|
|
20
16
|
"types": "./dist/index.d.ts",
|
|
@@ -27,16 +23,11 @@
|
|
|
27
23
|
},
|
|
28
24
|
"dependencies": {
|
|
29
25
|
"zod": "^4.4.3",
|
|
30
|
-
"@shipfox/inter-module": "0.2.
|
|
31
|
-
"@shipfox/runner-labels": "0.1.
|
|
26
|
+
"@shipfox/inter-module": "0.2.1",
|
|
27
|
+
"@shipfox/runner-labels": "0.1.2"
|
|
32
28
|
},
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"@shipfox/depcruise": "1.0.2",
|
|
36
|
-
"@shipfox/swc": "1.2.6",
|
|
37
|
-
"@shipfox/ts-config": "1.3.8",
|
|
38
|
-
"@shipfox/typescript": "1.1.7",
|
|
39
|
-
"@shipfox/vitest": "1.2.3"
|
|
29
|
+
"imports": {
|
|
30
|
+
"#*": "./dist/*"
|
|
40
31
|
},
|
|
41
32
|
"scripts": {
|
|
42
33
|
"build": "shipfox-swc",
|
package/src/index.ts
CHANGED
|
@@ -3,24 +3,18 @@ export {
|
|
|
3
3
|
type ActiveRunnerDto,
|
|
4
4
|
type ActiveRunnerStateDto,
|
|
5
5
|
type ActiveRunnersResponseDto,
|
|
6
|
-
type
|
|
7
|
-
type
|
|
8
|
-
type AttachProviderRunnerBodyDto,
|
|
9
|
-
type AttachProviderRunnerResponseDto,
|
|
6
|
+
type AssignRunnerInstancesBodyDto,
|
|
7
|
+
type AssignRunnerInstancesResponseDto,
|
|
10
8
|
activeProvisionerDtoSchema,
|
|
11
9
|
activeRunnerDtoSchema,
|
|
12
10
|
activeRunnerStateSchema,
|
|
13
11
|
activeRunnersResponseSchema,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
attachProviderRunnerBodySchema,
|
|
17
|
-
attachProviderRunnerResponseSchema,
|
|
12
|
+
assignRunnerInstancesBodySchema,
|
|
13
|
+
assignRunnerInstancesResponseSchema,
|
|
18
14
|
attachRunnerControlProviderIdBodySchema,
|
|
19
15
|
type ClaimedJobResponseDto,
|
|
20
16
|
type CreateManualRegistrationTokenBodyDto,
|
|
21
17
|
type CreateManualRegistrationTokenResponseDto,
|
|
22
|
-
type CreatePlannedCapacityBodyDto,
|
|
23
|
-
type CreatePlannedCapacityResponseDto,
|
|
24
18
|
type CreateProvisionerTokenBodyDto,
|
|
25
19
|
type CreateProvisionerTokenResponseDto,
|
|
26
20
|
type CreateRunnerInstancesBodyDto,
|
|
@@ -28,8 +22,6 @@ export {
|
|
|
28
22
|
claimedJobResponseSchema,
|
|
29
23
|
createManualRegistrationTokenBodySchema,
|
|
30
24
|
createManualRegistrationTokenResponseSchema,
|
|
31
|
-
createPlannedCapacityBodySchema,
|
|
32
|
-
createPlannedCapacityResponseSchema,
|
|
33
25
|
createProvisionerTokenBodySchema,
|
|
34
26
|
createProvisionerTokenResponseSchema,
|
|
35
27
|
createRunnerInstancesBodySchema,
|
|
@@ -54,15 +46,7 @@ export {
|
|
|
54
46
|
MAX_PROVISIONER_TOKEN_TTL_SECONDS,
|
|
55
47
|
MAX_RECONCILE_OBSERVED_RUNNERS,
|
|
56
48
|
type ManualRegistrationTokenDto,
|
|
57
|
-
type MintedRegistrationTokenDto,
|
|
58
|
-
type MintRegistrationTokensBatchBodyDto,
|
|
59
|
-
type MintRegistrationTokensBatchResponseDto,
|
|
60
|
-
type MintRegistrationTokensRunnerInstanceDto,
|
|
61
49
|
manualRegistrationTokenDtoSchema,
|
|
62
|
-
mintedRegistrationTokenSchema,
|
|
63
|
-
mintRegistrationTokensBatchBodySchema,
|
|
64
|
-
mintRegistrationTokensBatchResponseSchema,
|
|
65
|
-
mintRegistrationTokensRunnerInstanceSchema,
|
|
66
50
|
type PollDemandBodyDto,
|
|
67
51
|
type PollDemandResponseDto,
|
|
68
52
|
type PollDemandTemplateDto,
|
|
@@ -76,7 +60,6 @@ export {
|
|
|
76
60
|
providerRunnerStateSchema,
|
|
77
61
|
provisionerIdentityResponseSchema,
|
|
78
62
|
provisionerTokenDtoSchema,
|
|
79
|
-
REGISTRATION_TOKEN_BATCH_HARD_MAX,
|
|
80
63
|
type ReconcileDesiredIntentDto,
|
|
81
64
|
type ReconciledBoundJobDto,
|
|
82
65
|
type ReconciledRunnerInstanceDto,
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import {assignRunnerInstancesBodySchema} from './assign-runner-instances.js';
|
|
2
|
+
|
|
3
|
+
describe('assignRunnerInstancesBodySchema', () => {
|
|
4
|
+
it('accepts a reservation and unique runner instances', () => {
|
|
5
|
+
const result = assignRunnerInstancesBodySchema.safeParse({
|
|
6
|
+
reservation_id: '018f0d4c-5f42-7b7e-9d9b-4a7d8e6f0001',
|
|
7
|
+
runner_instance_ids: [
|
|
8
|
+
'018f0d4c-5f42-7b7e-9d9b-4a7d8e6f0002',
|
|
9
|
+
'018f0d4c-5f42-7b7e-9d9b-4a7d8e6f0003',
|
|
10
|
+
],
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
expect(result.success).toBe(true);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it('rejects duplicate runner instances', () => {
|
|
17
|
+
const result = assignRunnerInstancesBodySchema.safeParse({
|
|
18
|
+
reservation_id: '018f0d4c-5f42-7b7e-9d9b-4a7d8e6f0001',
|
|
19
|
+
runner_instance_ids: [
|
|
20
|
+
'018f0d4c-5f42-7b7e-9d9b-4a7d8e6f0002',
|
|
21
|
+
'018f0d4c-5f42-7b7e-9d9b-4a7d8e6f0002',
|
|
22
|
+
],
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
expect(result.success).toBe(false);
|
|
26
|
+
});
|
|
27
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {z} from 'zod';
|
|
2
|
+
|
|
3
|
+
export const assignRunnerInstancesBodySchema = z
|
|
4
|
+
.object({
|
|
5
|
+
reservation_id: z.string().uuid(),
|
|
6
|
+
runner_instance_ids: z.array(z.string().uuid()).min(1).max(1000),
|
|
7
|
+
})
|
|
8
|
+
.strict()
|
|
9
|
+
.refine((body) => new Set(body.runner_instance_ids).size === body.runner_instance_ids.length, {
|
|
10
|
+
message: 'runner_instance_ids values must be unique',
|
|
11
|
+
path: ['runner_instance_ids'],
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export const assignRunnerInstancesResponseSchema = z.object({
|
|
15
|
+
runner_instance_ids: z.array(z.string().uuid()),
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export type AssignRunnerInstancesBodyDto = z.infer<typeof assignRunnerInstancesBodySchema>;
|
|
19
|
+
export type AssignRunnerInstancesResponseDto = z.infer<typeof assignRunnerInstancesResponseSchema>;
|
package/src/schemas/index.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export {
|
|
2
|
-
type
|
|
3
|
-
type
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
} from './assign-
|
|
2
|
+
type AssignRunnerInstancesBodyDto,
|
|
3
|
+
type AssignRunnerInstancesResponseDto,
|
|
4
|
+
assignRunnerInstancesBodySchema,
|
|
5
|
+
assignRunnerInstancesResponseSchema,
|
|
6
|
+
} from './assign-runner-instances.js';
|
|
7
7
|
export {
|
|
8
8
|
type ClaimedJobResponseDto,
|
|
9
9
|
claimedJobResponseSchema,
|
|
@@ -34,17 +34,6 @@ export {
|
|
|
34
34
|
type RevokeManualRegistrationTokenResponseDto,
|
|
35
35
|
revokeManualRegistrationTokenResponseSchema,
|
|
36
36
|
} from './manual-registration-token.js';
|
|
37
|
-
export {
|
|
38
|
-
type MintedRegistrationTokenDto,
|
|
39
|
-
type MintRegistrationTokensBatchBodyDto,
|
|
40
|
-
type MintRegistrationTokensBatchResponseDto,
|
|
41
|
-
type MintRegistrationTokensRunnerInstanceDto,
|
|
42
|
-
mintedRegistrationTokenSchema,
|
|
43
|
-
mintRegistrationTokensBatchBodySchema,
|
|
44
|
-
mintRegistrationTokensBatchResponseSchema,
|
|
45
|
-
mintRegistrationTokensRunnerInstanceSchema,
|
|
46
|
-
REGISTRATION_TOKEN_BATCH_HARD_MAX,
|
|
47
|
-
} from './mint-registration-tokens.js';
|
|
48
37
|
export {
|
|
49
38
|
type DemandStatDto,
|
|
50
39
|
demandStatSchema,
|
|
@@ -97,17 +86,9 @@ export {
|
|
|
97
86
|
type ActiveRunnerDto,
|
|
98
87
|
type ActiveRunnerStateDto,
|
|
99
88
|
type ActiveRunnersResponseDto,
|
|
100
|
-
type AttachProviderRunnerBodyDto,
|
|
101
|
-
type AttachProviderRunnerResponseDto,
|
|
102
89
|
activeRunnerDtoSchema,
|
|
103
90
|
activeRunnerStateSchema,
|
|
104
91
|
activeRunnersResponseSchema,
|
|
105
|
-
attachProviderRunnerBodySchema,
|
|
106
|
-
attachProviderRunnerResponseSchema,
|
|
107
|
-
type CreatePlannedCapacityBodyDto,
|
|
108
|
-
type CreatePlannedCapacityResponseDto,
|
|
109
|
-
createPlannedCapacityBodySchema,
|
|
110
|
-
createPlannedCapacityResponseSchema,
|
|
111
92
|
MAX_PROVIDER_KIND_LENGTH,
|
|
112
93
|
MAX_PROVIDER_RUNNER_REASON_LENGTH,
|
|
113
94
|
MAX_PROVIDER_RUNNER_REPORT_EVENTS,
|
|
@@ -19,6 +19,7 @@ export const providerKindSchema = z.string().min(1).max(MAX_PROVIDER_KIND_LENGTH
|
|
|
19
19
|
|
|
20
20
|
export const providerRunnerReportEventSchema = z
|
|
21
21
|
.object({
|
|
22
|
+
runner_instance_id: z.string().uuid().optional(),
|
|
22
23
|
provider_runner_id: z.string().min(1).max(255),
|
|
23
24
|
reservation_id: z.string().uuid().optional(),
|
|
24
25
|
template_key: z.string().min(1).max(255).optional(),
|
|
@@ -40,23 +41,6 @@ export const reportRunnerInstancesResponseSchema = z.object({
|
|
|
40
41
|
reservations_released: z.number().int().min(0),
|
|
41
42
|
});
|
|
42
43
|
|
|
43
|
-
export const createPlannedCapacityBodySchema = z
|
|
44
|
-
.object({
|
|
45
|
-
provider_kind: providerKindSchema.optional(),
|
|
46
|
-
template_key: z.string().min(1).max(255).optional(),
|
|
47
|
-
})
|
|
48
|
-
.strict();
|
|
49
|
-
|
|
50
|
-
export const createPlannedCapacityResponseSchema = z.object({
|
|
51
|
-
capacity_id: z.string().uuid(),
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
export const attachProviderRunnerBodySchema = z
|
|
55
|
-
.object({provider_runner_id: z.string().min(1).max(255)})
|
|
56
|
-
.strict();
|
|
57
|
-
|
|
58
|
-
export const attachProviderRunnerResponseSchema = z.object({attached: z.boolean()});
|
|
59
|
-
|
|
60
44
|
export const activeRunnerStateSchema = z.enum(['starting', 'running', 'stopping', 'busy']);
|
|
61
45
|
|
|
62
46
|
export const activeRunnerDtoSchema = z.object({
|
|
@@ -82,10 +66,6 @@ export type RunnerInstanceStateDto = z.infer<typeof providerRunnerStateSchema>;
|
|
|
82
66
|
export type RunnerInstanceReportEventDto = z.infer<typeof providerRunnerReportEventSchema>;
|
|
83
67
|
export type ReportRunnerInstancesBodyDto = z.infer<typeof reportRunnerInstancesBodySchema>;
|
|
84
68
|
export type ReportRunnerInstancesResponseDto = z.infer<typeof reportRunnerInstancesResponseSchema>;
|
|
85
|
-
export type CreatePlannedCapacityBodyDto = z.infer<typeof createPlannedCapacityBodySchema>;
|
|
86
|
-
export type CreatePlannedCapacityResponseDto = z.infer<typeof createPlannedCapacityResponseSchema>;
|
|
87
|
-
export type AttachProviderRunnerBodyDto = z.infer<typeof attachProviderRunnerBodySchema>;
|
|
88
|
-
export type AttachProviderRunnerResponseDto = z.infer<typeof attachProviderRunnerResponseSchema>;
|
|
89
69
|
export type ActiveRunnerStateDto = z.infer<typeof activeRunnerStateSchema>;
|
|
90
70
|
export type ActiveRunnerDto = z.infer<typeof activeRunnerDtoSchema>;
|
|
91
71
|
export type ActiveRunnersResponseDto = z.infer<typeof activeRunnersResponseSchema>;
|