@shipfox/client-runners 5.0.0 → 6.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.
Files changed (94) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/CHANGELOG.md +38 -0
  3. package/dist/components/create-manual-registration-token-form.d.ts +3 -3
  4. package/dist/components/create-manual-registration-token-form.d.ts.map +1 -1
  5. package/dist/components/create-manual-registration-token-form.js +8 -23
  6. package/dist/components/create-manual-registration-token-form.js.map +1 -1
  7. package/dist/components/create-provisioner-token-form.d.ts +3 -3
  8. package/dist/components/create-provisioner-token-form.d.ts.map +1 -1
  9. package/dist/components/create-provisioner-token-form.js +8 -23
  10. package/dist/components/create-provisioner-token-form.js.map +1 -1
  11. package/dist/components/manual-registration-token-errors.d.ts.map +1 -1
  12. package/dist/components/manual-registration-token-errors.js +0 -1
  13. package/dist/components/manual-registration-token-errors.js.map +1 -1
  14. package/dist/components/manual-registration-token-format.d.ts +0 -2
  15. package/dist/components/manual-registration-token-format.d.ts.map +1 -1
  16. package/dist/components/manual-registration-token-format.js +0 -3
  17. package/dist/components/manual-registration-token-format.js.map +1 -1
  18. package/dist/components/manual-registration-token-list.d.ts +2 -2
  19. package/dist/components/manual-registration-token-list.d.ts.map +1 -1
  20. package/dist/components/manual-registration-token-list.js +12 -19
  21. package/dist/components/manual-registration-token-list.js.map +1 -1
  22. package/dist/components/manual-registration-tokens-settings-section.d.ts.map +1 -1
  23. package/dist/components/manual-registration-tokens-settings-section.js +1 -1
  24. package/dist/components/manual-registration-tokens-settings-section.js.map +1 -1
  25. package/dist/components/provisioner-token-errors.d.ts.map +1 -1
  26. package/dist/components/provisioner-token-errors.js +0 -1
  27. package/dist/components/provisioner-token-errors.js.map +1 -1
  28. package/dist/components/provisioner-token-format.d.ts +0 -18
  29. package/dist/components/provisioner-token-format.d.ts.map +1 -1
  30. package/dist/components/provisioner-token-format.js +0 -25
  31. package/dist/components/provisioner-token-format.js.map +1 -1
  32. package/dist/components/provisioner-token-list.d.ts +2 -2
  33. package/dist/components/provisioner-token-list.d.ts.map +1 -1
  34. package/dist/components/provisioner-token-list.js +9 -19
  35. package/dist/components/provisioner-token-list.js.map +1 -1
  36. package/dist/components/provisioner-tokens-settings-section.js +2 -2
  37. package/dist/components/provisioner-tokens-settings-section.js.map +1 -1
  38. package/dist/components/token-expiration-select.d.ts +7 -0
  39. package/dist/components/token-expiration-select.d.ts.map +1 -1
  40. package/dist/components/token-expiration-select.js +8 -0
  41. package/dist/components/token-expiration-select.js.map +1 -1
  42. package/dist/components/token-settings-sections.stories.d.ts.map +1 -1
  43. package/dist/components/token-settings-sections.stories.js +66 -23
  44. package/dist/components/token-settings-sections.stories.js.map +1 -1
  45. package/dist/core/token.d.ts +66 -0
  46. package/dist/core/token.d.ts.map +1 -0
  47. package/dist/core/token.js +37 -0
  48. package/dist/core/token.js.map +1 -0
  49. package/dist/feature.d.ts +13 -0
  50. package/dist/feature.d.ts.map +1 -1
  51. package/dist/feature.js +17 -16
  52. package/dist/feature.js.map +1 -1
  53. package/dist/hooks/api/manual-registration-tokens.d.ts +13 -71
  54. package/dist/hooks/api/manual-registration-tokens.d.ts.map +1 -1
  55. package/dist/hooks/api/manual-registration-tokens.js +40 -19
  56. package/dist/hooks/api/manual-registration-tokens.js.map +1 -1
  57. package/dist/hooks/api/provisioner-tokens.d.ts +17 -115
  58. package/dist/hooks/api/provisioner-tokens.d.ts.map +1 -1
  59. package/dist/hooks/api/provisioner-tokens.js +59 -32
  60. package/dist/hooks/api/provisioner-tokens.js.map +1 -1
  61. package/dist/hooks/api/token-mapper.d.ts +12 -0
  62. package/dist/hooks/api/token-mapper.d.ts.map +1 -0
  63. package/dist/hooks/api/token-mapper.js +61 -0
  64. package/dist/hooks/api/token-mapper.js.map +1 -0
  65. package/dist/tsconfig.test.tsbuildinfo +1 -1
  66. package/package.json +9 -9
  67. package/src/components/create-manual-registration-token-form.tsx +11 -21
  68. package/src/components/create-provisioner-token-form.tsx +11 -21
  69. package/src/components/form-errors.test.ts +2 -2
  70. package/src/components/manual-registration-token-errors.ts +0 -1
  71. package/src/components/manual-registration-token-format.test.ts +4 -4
  72. package/src/components/manual-registration-token-format.ts +0 -7
  73. package/src/components/manual-registration-token-list.tsx +13 -22
  74. package/src/components/manual-registration-tokens-settings-section.tsx +3 -5
  75. package/src/components/provisioner-token-errors.ts +0 -1
  76. package/src/components/provisioner-token-form-errors.test.ts +2 -2
  77. package/src/components/provisioner-token-format.test.ts +15 -14
  78. package/src/components/provisioner-token-format.ts +0 -29
  79. package/src/components/provisioner-token-list.tsx +14 -23
  80. package/src/components/provisioner-tokens-settings-section.tsx +4 -4
  81. package/src/components/token-expiration-select.test.ts +15 -0
  82. package/src/components/token-expiration-select.tsx +6 -0
  83. package/src/components/token-settings-sections.stories.tsx +72 -23
  84. package/src/core/token.test.ts +30 -0
  85. package/src/core/token.ts +83 -0
  86. package/src/feature.ts +19 -17
  87. package/src/hooks/api/manual-registration-tokens.test.ts +8 -5
  88. package/src/hooks/api/manual-registration-tokens.ts +71 -24
  89. package/src/hooks/api/provisioner-tokens.test.ts +10 -7
  90. package/src/hooks/api/provisioner-tokens.ts +100 -36
  91. package/src/hooks/api/token-mapper.test.ts +161 -0
  92. package/src/hooks/api/token-mapper.ts +79 -0
  93. package/tsconfig.build.tsbuildinfo +1 -1
  94. package/vercel.json +5 -0
@@ -1,12 +1,29 @@
1
- import type {
2
- CreateProvisionerTokenBodyDto,
3
- CreateProvisionerTokenResponseDto,
4
- ListActiveProvisionersResponseDto,
5
- ListProvisionerTokensResponseDto,
6
- RevokeProvisionerTokenResponseDto,
1
+ import {
2
+ createProvisionerTokenResponseSchema,
3
+ listActiveProvisionersResponseSchema,
4
+ listProvisionerTokensResponseSchema,
5
+ revokeProvisionerTokenResponseSchema,
7
6
  } from '@shipfox/api-runners-dto';
8
- import {apiRequest} from '@shipfox/client-api';
9
- import {useMutation, useQuery} from '@tanstack/react-query';
7
+ import {checkedApiRequest} from '@shipfox/client-api';
8
+ import {
9
+ type FetchQueryOptions,
10
+ queryOptions,
11
+ useMutation,
12
+ useQuery,
13
+ useQueryClient,
14
+ } from '@tanstack/react-query';
15
+ import type {
16
+ ActiveProvisioner,
17
+ CreatedProvisionerToken,
18
+ CreateTokenCommand,
19
+ ProvisionerToken,
20
+ } from '#core/token.js';
21
+ import {
22
+ toActiveProvisioner,
23
+ toCreatedProvisionerToken,
24
+ toCreateTokenBody,
25
+ toProvisionerToken,
26
+ } from './token-mapper.js';
10
27
 
11
28
  const PROVISIONER_TOKEN_REFETCH_INTERVAL_MS = 30_000;
12
29
 
@@ -17,30 +34,48 @@ export const provisionerTokenQueryKeys = {
17
34
  [...provisionerTokenQueryKeys.all, 'provisioners', workspaceId] as const,
18
35
  };
19
36
 
37
+ type ProvisionerTokensQueryOptions = FetchQueryOptions<
38
+ ProvisionerToken[],
39
+ Error,
40
+ ProvisionerToken[],
41
+ ReturnType<typeof provisionerTokenQueryKeys.list>
42
+ >;
43
+
44
+ type ActiveProvisionersQueryOptions = FetchQueryOptions<
45
+ ActiveProvisioner[],
46
+ Error,
47
+ ActiveProvisioner[],
48
+ ReturnType<typeof provisionerTokenQueryKeys.active>
49
+ >;
50
+
20
51
  export async function listProvisionerTokens({
21
52
  workspaceId,
22
53
  signal,
23
54
  }: {
24
55
  workspaceId: string;
25
56
  signal?: AbortSignal;
26
- }) {
27
- return await apiRequest<ListProvisionerTokensResponseDto>(
57
+ }): Promise<ProvisionerToken[]> {
58
+ const response = await checkedApiRequest(
59
+ listProvisionerTokensResponseSchema,
28
60
  `/workspaces/${workspaceId}/provisioners/tokens`,
29
61
  {signal},
30
62
  );
63
+ return response.tokens.map(toProvisionerToken);
31
64
  }
32
65
 
33
66
  export async function createProvisionerToken({
34
67
  workspaceId,
35
- body,
68
+ command,
36
69
  }: {
37
70
  workspaceId: string;
38
- body: CreateProvisionerTokenBodyDto;
39
- }) {
40
- return await apiRequest<CreateProvisionerTokenResponseDto>(
71
+ command: CreateTokenCommand;
72
+ }): Promise<CreatedProvisionerToken> {
73
+ const response = await checkedApiRequest(
74
+ createProvisionerTokenResponseSchema,
41
75
  `/workspaces/${workspaceId}/provisioners/tokens`,
42
- {method: 'POST', body},
76
+ {method: 'POST', body: toCreateTokenBody(command)},
43
77
  );
78
+ return toCreatedProvisionerToken(response);
44
79
  }
45
80
 
46
81
  export async function revokeProvisionerToken({
@@ -49,11 +84,13 @@ export async function revokeProvisionerToken({
49
84
  }: {
50
85
  workspaceId: string;
51
86
  tokenId: string;
52
- }) {
53
- return await apiRequest<RevokeProvisionerTokenResponseDto>(
87
+ }): Promise<ProvisionerToken> {
88
+ const response = await checkedApiRequest(
89
+ revokeProvisionerTokenResponseSchema,
54
90
  `/workspaces/${workspaceId}/provisioners/tokens/${tokenId}/revoke`,
55
91
  {method: 'POST'},
56
92
  );
93
+ return toProvisionerToken(response);
57
94
  }
58
95
 
59
96
  export async function listActiveProvisioners({
@@ -62,41 +99,68 @@ export async function listActiveProvisioners({
62
99
  }: {
63
100
  workspaceId: string;
64
101
  signal?: AbortSignal;
65
- }) {
66
- return await apiRequest<ListActiveProvisionersResponseDto>(
102
+ }): Promise<ActiveProvisioner[]> {
103
+ const response = await checkedApiRequest(
104
+ listActiveProvisionersResponseSchema,
67
105
  `/workspaces/${workspaceId}/provisioners/active`,
68
106
  {signal},
69
107
  );
108
+ return response.provisioners.map(toActiveProvisioner);
70
109
  }
71
110
 
72
- export function useProvisionerTokensQuery(workspaceId: string | undefined) {
73
- return useQuery({
74
- queryKey: workspaceId
75
- ? provisionerTokenQueryKeys.list(workspaceId)
76
- : [...provisionerTokenQueryKeys.all, 'tokens'],
77
- enabled: Boolean(workspaceId),
78
- queryFn: ({signal}) => listProvisionerTokens({workspaceId: workspaceId ?? '', signal}),
111
+ export function provisionerTokensQueryOptions(workspaceId: string): ProvisionerTokensQueryOptions {
112
+ return queryOptions({
113
+ queryKey: provisionerTokenQueryKeys.list(workspaceId),
114
+ queryFn: ({signal}) => listProvisionerTokens({workspaceId, signal}),
79
115
  refetchInterval: PROVISIONER_TOKEN_REFETCH_INTERVAL_MS,
80
116
  refetchIntervalInBackground: false,
81
117
  });
82
118
  }
83
119
 
84
- export function useCreateProvisionerTokenMutation() {
85
- return useMutation({mutationFn: createProvisionerToken});
120
+ export function activeProvisionersQueryOptions(
121
+ workspaceId: string,
122
+ ): ActiveProvisionersQueryOptions {
123
+ return queryOptions({
124
+ queryKey: provisionerTokenQueryKeys.active(workspaceId),
125
+ queryFn: ({signal}) => listActiveProvisioners({workspaceId, signal}),
126
+ refetchInterval: PROVISIONER_TOKEN_REFETCH_INTERVAL_MS,
127
+ refetchIntervalInBackground: false,
128
+ });
86
129
  }
87
130
 
88
- export function useRevokeProvisionerTokenMutation() {
89
- return useMutation({mutationFn: revokeProvisionerToken});
131
+ export function useProvisionerTokensQuery(workspaceId: string | undefined) {
132
+ return useQuery({
133
+ ...provisionerTokensQueryOptions(workspaceId ?? ''),
134
+ enabled: Boolean(workspaceId),
135
+ });
90
136
  }
91
137
 
92
138
  export function useActiveProvisionersQuery(workspaceId: string | undefined) {
93
139
  return useQuery({
94
- queryKey: workspaceId
95
- ? provisionerTokenQueryKeys.active(workspaceId)
96
- : [...provisionerTokenQueryKeys.all, 'provisioners'],
140
+ ...activeProvisionersQueryOptions(workspaceId ?? ''),
97
141
  enabled: Boolean(workspaceId),
98
- queryFn: ({signal}) => listActiveProvisioners({workspaceId: workspaceId ?? '', signal}),
99
- refetchInterval: PROVISIONER_TOKEN_REFETCH_INTERVAL_MS,
100
- refetchIntervalInBackground: false,
142
+ });
143
+ }
144
+
145
+ export function useCreateProvisionerTokenMutation(workspaceId: string) {
146
+ const queryClient = useQueryClient();
147
+ return useMutation({
148
+ mutationFn: (command: CreateTokenCommand) => createProvisionerToken({workspaceId, command}),
149
+ onSuccess: async () => {
150
+ await queryClient.invalidateQueries(provisionerTokensQueryOptions(workspaceId));
151
+ },
152
+ });
153
+ }
154
+
155
+ export function useRevokeProvisionerTokenMutation(workspaceId: string) {
156
+ const queryClient = useQueryClient();
157
+ return useMutation({
158
+ mutationFn: (tokenId: string) => revokeProvisionerToken({workspaceId, tokenId}),
159
+ onSuccess: async () => {
160
+ await Promise.all([
161
+ queryClient.invalidateQueries(provisionerTokensQueryOptions(workspaceId)),
162
+ queryClient.invalidateQueries(activeProvisionersQueryOptions(workspaceId)),
163
+ ]);
164
+ },
101
165
  });
102
166
  }
@@ -0,0 +1,161 @@
1
+ import {
2
+ toActiveProvisioner,
3
+ toCreatedManualRegistrationToken,
4
+ toCreatedProvisionerToken,
5
+ toCreateTokenBody,
6
+ toManualRegistrationToken,
7
+ toProvisionerToken,
8
+ } from './token-mapper.js';
9
+
10
+ describe('toManualRegistrationToken', () => {
11
+ test('maps a transport token to its package-owned model', () => {
12
+ const result = toManualRegistrationToken({
13
+ id: '11111111-1111-4111-8111-111111111111',
14
+ workspace_id: '22222222-2222-4222-8222-222222222222',
15
+ prefix: 'sf_mrt_test',
16
+ name: null,
17
+ expires_at: null,
18
+ revoked_at: null,
19
+ created_at: '2026-07-22T10:00:00.000Z',
20
+ updated_at: '2026-07-22T10:00:00.000Z',
21
+ });
22
+
23
+ expect(result).toEqual({
24
+ id: '11111111-1111-4111-8111-111111111111',
25
+ workspaceId: '22222222-2222-4222-8222-222222222222',
26
+ prefix: 'sf_mrt_test',
27
+ name: null,
28
+ expiresAt: null,
29
+ revokedAt: null,
30
+ createdAt: '2026-07-22T10:00:00.000Z',
31
+ updatedAt: '2026-07-22T10:00:00.000Z',
32
+ });
33
+ });
34
+ });
35
+
36
+ describe('toProvisionerToken', () => {
37
+ test('maps a transport provisioner token to its package-owned model', () => {
38
+ const result = toProvisionerToken({
39
+ id: '33333333-3333-4333-8333-333333333333',
40
+ scope: 'workspace',
41
+ workspace_id: '22222222-2222-4222-8222-222222222222',
42
+ prefix: 'sf_pt_test',
43
+ name: 'Docker provisioner',
44
+ created_by_user_id: '44444444-4444-4444-8444-444444444444',
45
+ revoked_by_user_id: null,
46
+ expires_at: null,
47
+ revoked_at: null,
48
+ last_seen_at: '2026-07-22T09:00:00.000Z',
49
+ created_at: '2026-07-22T10:00:00.000Z',
50
+ updated_at: '2026-07-22T10:00:00.000Z',
51
+ });
52
+
53
+ expect(result).toEqual({
54
+ id: '33333333-3333-4333-8333-333333333333',
55
+ workspaceId: '22222222-2222-4222-8222-222222222222',
56
+ prefix: 'sf_pt_test',
57
+ name: 'Docker provisioner',
58
+ expiresAt: null,
59
+ revokedAt: null,
60
+ createdAt: '2026-07-22T10:00:00.000Z',
61
+ updatedAt: '2026-07-22T10:00:00.000Z',
62
+ createdByUserId: '44444444-4444-4444-8444-444444444444',
63
+ revokedByUserId: null,
64
+ lastSeenAt: '2026-07-22T09:00:00.000Z',
65
+ });
66
+ });
67
+ });
68
+
69
+ describe('toActiveProvisioner', () => {
70
+ test('maps a transport active provisioner to its package-owned model', () => {
71
+ const result = toActiveProvisioner({
72
+ id: '33333333-3333-4333-8333-333333333333',
73
+ name: 'Docker provisioner',
74
+ prefix: 'sf_pt_test',
75
+ last_seen_at: '2026-07-22T09:00:00.000Z',
76
+ });
77
+
78
+ expect(result).toEqual({
79
+ id: '33333333-3333-4333-8333-333333333333',
80
+ name: 'Docker provisioner',
81
+ prefix: 'sf_pt_test',
82
+ lastSeenAt: '2026-07-22T09:00:00.000Z',
83
+ });
84
+ });
85
+ });
86
+
87
+ describe('toCreatedManualRegistrationToken', () => {
88
+ test('maps a raw-token creation response to its package-owned model', () => {
89
+ const result = toCreatedManualRegistrationToken({
90
+ id: '77777777-7777-4777-8777-777777777777',
91
+ raw_token: 'sf_mrt_raw-created-token',
92
+ prefix: 'sf_mrt_test',
93
+ name: null,
94
+ workspace_id: '22222222-2222-4222-8222-222222222222',
95
+ expires_at: null,
96
+ created_at: '2026-07-22T10:00:00.000Z',
97
+ });
98
+
99
+ expect(result).toEqual({
100
+ token: 'sf_mrt_raw-created-token',
101
+ id: '77777777-7777-4777-8777-777777777777',
102
+ prefix: 'sf_mrt_test',
103
+ name: null,
104
+ workspaceId: '22222222-2222-4222-8222-222222222222',
105
+ expiresAt: null,
106
+ createdAt: '2026-07-22T10:00:00.000Z',
107
+ });
108
+ });
109
+ });
110
+
111
+ describe('toCreatedProvisionerToken', () => {
112
+ test('maps a raw-token provisioner creation response to its package-owned model', () => {
113
+ const result = toCreatedProvisionerToken({
114
+ id: '77777777-7777-4777-8777-777777777777',
115
+ raw_token: 'sf_pt_raw-created-token',
116
+ prefix: 'sf_pt_test',
117
+ name: 'Docker provisioner',
118
+ workspace_id: '22222222-2222-4222-8222-222222222222',
119
+ created_by_user_id: '44444444-4444-4444-8444-444444444444',
120
+ revoked_by_user_id: null,
121
+ expires_at: null,
122
+ revoked_at: null,
123
+ last_seen_at: null,
124
+ created_at: '2026-07-22T10:00:00.000Z',
125
+ updated_at: '2026-07-22T10:00:00.000Z',
126
+ scope: 'workspace',
127
+ });
128
+
129
+ expect(result).toEqual({
130
+ token: 'sf_pt_raw-created-token',
131
+ id: '77777777-7777-4777-8777-777777777777',
132
+ prefix: 'sf_pt_test',
133
+ name: 'Docker provisioner',
134
+ workspaceId: '22222222-2222-4222-8222-222222222222',
135
+ expiresAt: null,
136
+ createdAt: '2026-07-22T10:00:00.000Z',
137
+ createdByUserId: '44444444-4444-4444-8444-444444444444',
138
+ revokedByUserId: null,
139
+ revokedAt: null,
140
+ lastSeenAt: null,
141
+ updatedAt: '2026-07-22T10:00:00.000Z',
142
+ });
143
+ });
144
+ });
145
+
146
+ describe('toCreateTokenBody', () => {
147
+ test('omits both optional fields for an unnamed, non-expiring command', () => {
148
+ const result = toCreateTokenBody({expiration: {kind: 'never'}});
149
+
150
+ expect(result).toEqual({});
151
+ });
152
+
153
+ test('includes name and ttl_seconds for a named, expiring command', () => {
154
+ const result = toCreateTokenBody({
155
+ name: 'Local runner',
156
+ expiration: {kind: 'expires-after', seconds: 86_400},
157
+ });
158
+
159
+ expect(result).toEqual({name: 'Local runner', ttl_seconds: 86_400});
160
+ });
161
+ });
@@ -0,0 +1,79 @@
1
+ import type {
2
+ ActiveProvisionerDto,
3
+ CreateManualRegistrationTokenResponseDto,
4
+ CreateProvisionerTokenResponseDto,
5
+ ManualRegistrationTokenDto,
6
+ ProvisionerTokenDto,
7
+ } from '@shipfox/api-runners-dto';
8
+ import type {
9
+ ActiveProvisioner,
10
+ CreatedManualRegistrationToken,
11
+ CreatedProvisionerToken,
12
+ CreateTokenCommand,
13
+ ManualRegistrationToken,
14
+ ProvisionerToken,
15
+ } from '#core/token.js';
16
+
17
+ export function toCreateTokenBody(command: CreateTokenCommand) {
18
+ return {
19
+ ...(command.name ? {name: command.name} : {}),
20
+ ...(command.expiration.kind === 'expires-after'
21
+ ? {ttl_seconds: command.expiration.seconds}
22
+ : {}),
23
+ };
24
+ }
25
+
26
+ export function toManualRegistrationToken(
27
+ dto: ManualRegistrationTokenDto,
28
+ ): ManualRegistrationToken {
29
+ return {
30
+ id: dto.id,
31
+ workspaceId: dto.workspace_id,
32
+ prefix: dto.prefix,
33
+ name: dto.name,
34
+ expiresAt: dto.expires_at,
35
+ revokedAt: dto.revoked_at,
36
+ createdAt: dto.created_at,
37
+ updatedAt: dto.updated_at,
38
+ };
39
+ }
40
+
41
+ export function toProvisionerToken(dto: ProvisionerTokenDto): ProvisionerToken {
42
+ return {
43
+ ...toManualRegistrationToken(dto),
44
+ createdByUserId: dto.created_by_user_id,
45
+ revokedByUserId: dto.revoked_by_user_id,
46
+ lastSeenAt: dto.last_seen_at,
47
+ };
48
+ }
49
+
50
+ export function toActiveProvisioner(dto: ActiveProvisionerDto): ActiveProvisioner {
51
+ return {id: dto.id, name: dto.name, prefix: dto.prefix, lastSeenAt: dto.last_seen_at};
52
+ }
53
+
54
+ export function toCreatedManualRegistrationToken(
55
+ dto: CreateManualRegistrationTokenResponseDto,
56
+ ): CreatedManualRegistrationToken {
57
+ return {
58
+ token: dto.raw_token,
59
+ id: dto.id,
60
+ prefix: dto.prefix,
61
+ name: dto.name,
62
+ workspaceId: dto.workspace_id,
63
+ expiresAt: dto.expires_at,
64
+ createdAt: dto.created_at,
65
+ };
66
+ }
67
+
68
+ export function toCreatedProvisionerToken(
69
+ dto: CreateProvisionerTokenResponseDto,
70
+ ): CreatedProvisionerToken {
71
+ return {
72
+ ...toCreatedManualRegistrationToken(dto),
73
+ createdByUserId: dto.created_by_user_id,
74
+ revokedByUserId: dto.revoked_by_user_id,
75
+ revokedAt: dto.revoked_at,
76
+ lastSeenAt: dto.last_seen_at,
77
+ updatedAt: dto.updated_at,
78
+ };
79
+ }