From 8435ed7fd9cd37485e3f384bbf1d43a51d3d7cf6 Mon Sep 17 00:00:00 2001 From: yunyingk Date: Fri, 31 Jul 2026 09:57:19 +0800 Subject: [PATCH] feat(config): support provider field for seal source and display provider in corps list - Add optional provider and providerName to NativeSealSourceSchema - Extract provider from remote user/tenant in addSealCorp - Output provider field in corps list and corps current commands --- src/cli.ts | 11 +++++++++-- src/core/config/types.ts | 4 +++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/cli.ts b/src/cli.ts index a09a9f1..af671e9 100755 --- a/src/cli.ts +++ b/src/cli.ts @@ -88,6 +88,7 @@ async function main() { id: item.id, name: item.name, sourceType: item.source.type, + provider: (item.source as any).provider ?? item.source.type, current: item.id === currentCorpId }))); return; @@ -98,7 +99,8 @@ async function main() { printJson({ id: corp.id, name: corp.name, - sourceType: corp.source.type + sourceType: corp.source.type, + provider: (corp.source as any).provider ?? corp.source.type }); return; } @@ -688,6 +690,10 @@ async function addSealCorp(input: Record) { stringValue(remoteUser?.id) ?? "seal"; + const provider = optionalString(input, "provider") ?? + stringValue(remoteUser?.provider) ?? + stringValue((remoteTenant as any)?.providerConfig?.provider); + const config: CorpConfig = { id, name: tenantName ?? id, @@ -708,7 +714,8 @@ async function addSealCorp(input: Record) { tenantId, tenantSlug, tenantName, - providerUserId: stringValue(remoteUser?.providerUserId) + providerUserId: stringValue(remoteUser?.providerUserId), + provider }, auth: { refreshTtl: 300 diff --git a/src/core/config/types.ts b/src/core/config/types.ts index 8cd2c4e..72266b2 100644 --- a/src/core/config/types.ts +++ b/src/core/config/types.ts @@ -47,7 +47,9 @@ export const NativeSealSourceSchema = z.object({ tenantId: z.string().optional(), tenantSlug: z.string().optional(), tenantName: z.string().optional(), - providerUserId: z.string().optional() + providerUserId: z.string().optional(), + provider: z.string().optional(), + providerName: z.string().optional() }); export const SealSourceSchema = z.discriminatedUnion("type", [