(config: unknown)
| 110 | } |
| 111 | |
| 112 | export function parsePermissionGroupConfig(config: unknown): PermissionGroupConfig { |
| 113 | if (!config || typeof config !== 'object') { |
| 114 | return DEFAULT_PERMISSION_GROUP_CONFIG |
| 115 | } |
| 116 | |
| 117 | const c = config as Record<string, unknown> |
| 118 | |
| 119 | return { |
| 120 | allowedIntegrations: Array.isArray(c.allowedIntegrations) ? c.allowedIntegrations : null, |
| 121 | allowedModelProviders: Array.isArray(c.allowedModelProviders) ? c.allowedModelProviders : null, |
| 122 | deniedModels: Array.isArray(c.deniedModels) |
| 123 | ? c.deniedModels.filter((m): m is string => typeof m === 'string') |
| 124 | : [], |
| 125 | deniedTools: Array.isArray(c.deniedTools) |
| 126 | ? c.deniedTools.filter((t): t is string => typeof t === 'string') |
| 127 | : [], |
| 128 | hideTraceSpans: typeof c.hideTraceSpans === 'boolean' ? c.hideTraceSpans : false, |
| 129 | hideKnowledgeBaseTab: |
| 130 | typeof c.hideKnowledgeBaseTab === 'boolean' ? c.hideKnowledgeBaseTab : false, |
| 131 | hideTablesTab: typeof c.hideTablesTab === 'boolean' ? c.hideTablesTab : false, |
| 132 | hideCopilot: typeof c.hideCopilot === 'boolean' ? c.hideCopilot : false, |
| 133 | hideIntegrationsTab: typeof c.hideIntegrationsTab === 'boolean' ? c.hideIntegrationsTab : false, |
| 134 | hideSecretsTab: typeof c.hideSecretsTab === 'boolean' ? c.hideSecretsTab : false, |
| 135 | hideApiKeysTab: typeof c.hideApiKeysTab === 'boolean' ? c.hideApiKeysTab : false, |
| 136 | hideInboxTab: typeof c.hideInboxTab === 'boolean' ? c.hideInboxTab : false, |
| 137 | hideFilesTab: typeof c.hideFilesTab === 'boolean' ? c.hideFilesTab : false, |
| 138 | disableMcpTools: typeof c.disableMcpTools === 'boolean' ? c.disableMcpTools : false, |
| 139 | disableCustomTools: typeof c.disableCustomTools === 'boolean' ? c.disableCustomTools : false, |
| 140 | disableSkills: typeof c.disableSkills === 'boolean' ? c.disableSkills : false, |
| 141 | disableInvitations: typeof c.disableInvitations === 'boolean' ? c.disableInvitations : false, |
| 142 | disablePublicApi: typeof c.disablePublicApi === 'boolean' ? c.disablePublicApi : false, |
| 143 | disablePublicFileSharing: |
| 144 | typeof c.disablePublicFileSharing === 'boolean' ? c.disablePublicFileSharing : false, |
| 145 | allowedFileShareAuthTypes: Array.isArray(c.allowedFileShareAuthTypes) |
| 146 | ? c.allowedFileShareAuthTypes.filter((t): t is ShareAuthType => |
| 147 | (FILE_SHARE_AUTH_TYPES as readonly string[]).includes(t as string) |
| 148 | ) |
| 149 | : null, |
| 150 | hideDeployApi: typeof c.hideDeployApi === 'boolean' ? c.hideDeployApi : false, |
| 151 | hideDeployMcp: typeof c.hideDeployMcp === 'boolean' ? c.hideDeployMcp : false, |
| 152 | hideDeployChatbot: typeof c.hideDeployChatbot === 'boolean' ? c.hideDeployChatbot : false, |
| 153 | hideDeployTemplate: typeof c.hideDeployTemplate === 'boolean' ? c.hideDeployTemplate : false, |
| 154 | } |
| 155 | } |
no outgoing calls
no test coverage detected