mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
Merge pull request #1345 from Infisical/daniel/more-pg-endpoint-fixes
(Fix): Old Python SDK versions
This commit is contained in:
@@ -38,7 +38,12 @@ export const sanitizedServiceTokenUserSchema = UsersSchema.pick({
|
||||
firstName: true,
|
||||
lastName: true,
|
||||
mfaMethods: true
|
||||
});
|
||||
}).merge(
|
||||
z.object({
|
||||
__v: z.number().default(0),
|
||||
_id: z.string()
|
||||
})
|
||||
);
|
||||
|
||||
export const secretRawSchema = z.object({
|
||||
id: z.string(),
|
||||
|
||||
@@ -36,8 +36,19 @@ export const registerServiceTokenRouter = async (server: FastifyZodProvider) =>
|
||||
actor: req.permission.type
|
||||
});
|
||||
|
||||
const formattedUser = {
|
||||
...user,
|
||||
_id: user.id,
|
||||
__v: 0
|
||||
} as const;
|
||||
|
||||
const formattedServiceToken = {
|
||||
...serviceToken,
|
||||
_id: serviceToken.id
|
||||
} as const;
|
||||
|
||||
// We return the user here because older versions of the deprecated Python SDK depend on it to properly parse the API response.
|
||||
return { ...serviceToken, workspace: serviceToken.projectId, user };
|
||||
return { ...formattedServiceToken, workspace: serviceToken.projectId, user: formattedUser };
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user