Merge pull request #1345 from Infisical/daniel/more-pg-endpoint-fixes

(Fix): Old Python SDK versions
This commit is contained in:
Maidul Islam
2024-01-29 07:10:29 -05:00
committed by GitHub
2 changed files with 18 additions and 2 deletions

View File

@@ -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(),

View File

@@ -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 };
}
});