web & sdk: improved sdk (better failover and batching)

This commit is contained in:
Carl-Gerhard Lindesvärd
2024-01-12 11:31:46 +01:00
parent 8e7558790e
commit 5b5ad23f66
26 changed files with 1266 additions and 377 deletions

View File

@@ -59,6 +59,7 @@ export const clientRouter = createTRPCRouter({
name: z.string(),
projectId: z.string(),
organizationSlug: z.string(),
withCors: z.boolean().default(true),
})
)
.mutation(async ({ input }) => {
@@ -69,13 +70,14 @@ export const clientRouter = createTRPCRouter({
organization_id: organization.id,
project_id: input.projectId,
name: input.name,
secret: await hashPassword(secret),
secret: input.withCors ? null : await hashPassword(secret),
},
});
return {
clientSecret: secret,
clientSecret: input.withCors ? null : secret,
clientId: client.id,
cors: client.cors,
};
}),
remove: protectedProcedure