mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
Use project key scope type in selector
This commit is contained in:
+8
-4
@@ -10,16 +10,20 @@
|
||||
import { onMount } from 'svelte';
|
||||
import { func } from '../store';
|
||||
import { isValueOfStringEnum } from '$lib/helpers/types';
|
||||
import { Runtime, type Scopes as ScopesType } from '@appwrite.io/console';
|
||||
import {
|
||||
Runtime,
|
||||
type ProjectKeyScopes,
|
||||
type Scopes as FunctionScopes
|
||||
} from '@appwrite.io/console';
|
||||
import Scopes from '$routes/(console)/project-[region]-[project]/overview/api-keys/scopes.svelte';
|
||||
import { symmetricDifference } from '$lib/helpers/array';
|
||||
import { Link } from '$lib/elements';
|
||||
|
||||
const functionId = page.params.function;
|
||||
let functionScopes: ScopesType[] = null;
|
||||
let functionScopes: ProjectKeyScopes[] = null;
|
||||
|
||||
onMount(async () => {
|
||||
functionScopes ??= $func.scopes as ScopesType[];
|
||||
functionScopes ??= $func.scopes as ProjectKeyScopes[];
|
||||
});
|
||||
|
||||
async function updateScopes() {
|
||||
@@ -39,7 +43,7 @@
|
||||
logging: $func.logging || undefined,
|
||||
entrypoint: $func.entrypoint || undefined,
|
||||
commands: $func.commands || undefined,
|
||||
scopes: functionScopes || undefined,
|
||||
scopes: (functionScopes as unknown as FunctionScopes[]) || undefined,
|
||||
installationId: $func.installationId || undefined,
|
||||
providerRepositoryId: $func.providerRepositoryId || undefined,
|
||||
providerBranch: $func.providerBranch || undefined,
|
||||
|
||||
@@ -46,11 +46,9 @@
|
||||
Selector,
|
||||
Typography
|
||||
} from '@appwrite.io/pink-svelte';
|
||||
import type { ProjectKeyScopes, Scopes } from '@appwrite.io/console';
|
||||
import type { ProjectKeyScopes } from '@appwrite.io/console';
|
||||
|
||||
type ScopeValue = ProjectKeyScopes | Scopes;
|
||||
|
||||
let { scopes = $bindable([]) }: { scopes: ScopeValue[] } = $props();
|
||||
let { scopes = $bindable([]) }: { scopes: ProjectKeyScopes[] } = $props();
|
||||
|
||||
let allScopesList: ScopeDefinition[] = $state([]);
|
||||
let mounted = $state(false);
|
||||
@@ -194,10 +192,10 @@
|
||||
});
|
||||
}
|
||||
|
||||
function generateSyncedScopes(activeScopesObj: Record<string, boolean>): Scopes[] {
|
||||
function generateSyncedScopes(activeScopesObj: Record<string, boolean>): ProjectKeyScopes[] {
|
||||
return Object.entries(activeScopesObj)
|
||||
.filter(([scope, isActive]) => isActive && scopeCatalog.has(scope))
|
||||
.map(([scope]) => scope as Scopes);
|
||||
.map(([scope]) => scope as ProjectKeyScopes);
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user