@shipfox/api-auth-dto 15.0.0 → 18.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-auth-dto",
3
3
  "license": "MIT",
4
- "version": "15.0.0",
4
+ "version": "18.0.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/ShipfoxHQ/shipfox.git",
@@ -95,6 +95,12 @@ export const suspendAdministratorUserBodySchema = z.object({
95
95
 
96
96
  export type SuspendAdministratorUserBodyDto = z.infer<typeof suspendAdministratorUserBodySchema>;
97
97
 
98
+ export const impersonateUserBodySchema = z.object({
99
+ reason: reasonSchema,
100
+ });
101
+
102
+ export type ImpersonateUserBodyDto = z.infer<typeof impersonateUserBodySchema>;
103
+
98
104
  export const reactivateAdministratorUserBodySchema = z
99
105
  .object({
100
106
  reason: reasonSchema.optional(),
@@ -72,6 +72,36 @@ export const loginResponseSchema = z.object({
72
72
 
73
73
  export type LoginResponseDto = z.infer<typeof loginResponseSchema>;
74
74
 
75
+ /**
76
+ * A session response for an externally minted (adopted) session, which may
77
+ * carry the optional impersonation mark. The cookie-based login and refresh
78
+ * responses never set it. The impersonation mint route emits its own
79
+ * `impersonateResponseSchema`; client shells map that shape into this one.
80
+ */
81
+ export const sessionResponseSchema = loginResponseSchema.extend({
82
+ impersonator_id: z.string().uuid().optional(),
83
+ });
84
+
85
+ export type SessionResponseDto = z.infer<typeof sessionResponseSchema>;
86
+
87
+ /**
88
+ * The impersonation mint, replay, and renewal response. Mirrors
89
+ * `loginResponseSchema` with deliberate deviations: no refresh cookie is set,
90
+ * no `admin_role` exists (the target can hold none), and `expires_at`,
91
+ * `server_time`, and `impersonator_id` are explicit so the client never
92
+ * decodes the JWT. `server_time` is the issuer's clock at response time; the
93
+ * client anchors countdown and Extend availability on it.
94
+ */
95
+ export const impersonateResponseSchema = z.object({
96
+ token: z.string(),
97
+ expires_at: z.string().datetime(),
98
+ server_time: z.string().datetime(),
99
+ impersonator_id: z.string().uuid(),
100
+ user: userDtoSchema,
101
+ });
102
+
103
+ export type ImpersonateResponseDto = z.infer<typeof impersonateResponseSchema>;
104
+
75
105
  export const refreshResponseSchema = loginResponseSchema;
76
106
 
77
107
  export type RefreshResponseDto = z.infer<typeof refreshResponseSchema>;
@@ -79,6 +109,7 @@ export type RefreshResponseDto = z.infer<typeof refreshResponseSchema>;
79
109
  export const meResponseSchema = z.object({
80
110
  user: userDtoSchema,
81
111
  admin_role: adminRoleSchema.nullable().optional(),
112
+ impersonator_id: z.string().uuid().optional(),
82
113
  });
83
114
 
84
115
  export type MeResponseDto = z.infer<typeof meResponseSchema>;
@@ -33,6 +33,8 @@ export {
33
33
  type GrantAdminRoleResponseDto,
34
34
  grantAdminRoleBodySchema,
35
35
  grantAdminRoleResponseSchema,
36
+ type ImpersonateUserBodyDto,
37
+ impersonateUserBodySchema,
36
38
  isAdminRole,
37
39
  type ListAdminGrantsQueryDto,
38
40
  type ListAdminGrantsResponseDto,
@@ -55,6 +57,8 @@ export {
55
57
  type ChangePasswordBodyDto,
56
58
  changePasswordBodySchema,
57
59
  emailSchema,
60
+ type ImpersonateResponseDto,
61
+ impersonateResponseSchema,
58
62
  type LoginBodyDto,
59
63
  type LoginMethodDto,
60
64
  type LoginMethodsResponseDto,
@@ -76,10 +80,12 @@ export {
76
80
  passwordSchema,
77
81
  type RefreshResponseDto,
78
82
  refreshResponseSchema,
83
+ type SessionResponseDto,
79
84
  type SignupAcceptErrorDto,
80
85
  type SignupBodyDto,
81
86
  type SignupMembershipDto,
82
87
  type SignupResponseDto,
88
+ sessionResponseSchema,
83
89
  signupAcceptErrorSchema,
84
90
  signupBodySchema,
85
91
  signupMembershipSchema,
@@ -13,6 +13,7 @@ export const runnerSessionTokenClaimsSchema = z.object({
13
13
  scope: z.literal('workspace'),
14
14
  labels: z.array(z.string()).min(1),
15
15
  maxClaims: z.number().int().positive().nullable(),
16
+ lifecycleCapabilities: z.array(z.string()).max(8).optional(),
16
17
  aud: z.literal(RUNNER_SESSION_TOKEN_AUDIENCE),
17
18
  iat: z.number().int(),
18
19
  exp: z.number().int(),