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
This commit is contained in:
1 parent
2ca45d935e
commit
8435ed7fd9
2 files changed
+12
-3
No files matched your search
+9
-2
@@ -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<string, unknown>) {
|
||||
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<string, unknown>) {
|
||||
tenantId,
|
||||
tenantSlug,
|
||||
tenantName,
|
||||
providerUserId: stringValue(remoteUser?.providerUserId)
|
||||
providerUserId: stringValue(remoteUser?.providerUserId),
|
||||
provider
|
||||
},
|
||||
auth: {
|
||||
refreshTtl: 300
|
||||
|
||||
@@ -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", [
|
||||
|
||||
Reference in new issue
Block a user