fix: handle live seal response shapes
This commit is contained in:
1 parent
340dfbf993
commit
c6bae13dff
2 files changed
+13
-7
No files matched your search
@@ -54,6 +54,12 @@ function defaultSealUrl(corp: CorpConfig, source: HoseSealSource): string {
|
||||
return `https://${source.corpId.toLowerCase()}.sealai.cc`;
|
||||
}
|
||||
|
||||
function hoseUid(source: HoseSealSource): string {
|
||||
return source.staffId.includes(":")
|
||||
? source.staffId
|
||||
: `${source.corpId}:${source.staffId}`;
|
||||
}
|
||||
|
||||
function hoseClient(source: HoseSealSource): KyInstance {
|
||||
return ky.create({
|
||||
prefix: normalizeBaseUrl(source.domain),
|
||||
@@ -125,7 +131,7 @@ async function fetchHoseCloseApiToken(
|
||||
openapiToken: string
|
||||
): Promise<TokenEntry> {
|
||||
const client = hoseClient(source);
|
||||
const uid = `${source.corpId}:${source.staffId}`;
|
||||
const uid = hoseUid(source);
|
||||
|
||||
const response = await client
|
||||
.post("api/openapi/v1.1/provisional/getProvisionalAuth", {
|
||||
|
||||
@@ -28,7 +28,7 @@ export const SealTenantSchema = z.object({
|
||||
name: z.string(),
|
||||
tenantSlug: z.string().optional(),
|
||||
isDemo: z.boolean().default(false),
|
||||
logoUrl: z.string().optional(),
|
||||
logoUrl: z.string().nullable().optional(),
|
||||
hoseCorpConfig: HoseCorpConfigSchema.optional()
|
||||
});
|
||||
|
||||
@@ -87,14 +87,14 @@ export const ApprovalDocumentSchema = z.object({
|
||||
enabled: z.boolean().default(true),
|
||||
scenarios: z.array(z.string()).default([]),
|
||||
tags: z.array(z.string()).default([]),
|
||||
category: z.string().optional(),
|
||||
category: z.string().nullable().optional(),
|
||||
categoryTags: z.array(z.string()).default([]),
|
||||
createdBy: z.string().optional(),
|
||||
createdByName: z.string().optional(),
|
||||
createdBy: z.string().nullable().optional(),
|
||||
createdByName: z.string().nullable().optional(),
|
||||
createdAt: z.number().optional(),
|
||||
updatedAt: z.number().optional(),
|
||||
updatedBy: z.string().optional(),
|
||||
updatedByName: z.string().optional(),
|
||||
updatedBy: z.string().nullable().optional(),
|
||||
updatedByName: z.string().nullable().optional(),
|
||||
isDeleted: z.boolean().default(false)
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user