Skip to content

Commit 968b85a

Browse files
committed
Use project key scope type in selector
1 parent 273503f commit 968b85a

2 files changed

Lines changed: 12 additions & 10 deletions

File tree

src/routes/(console)/project-[region]-[project]/functions/function-[function]/settings/updateScopes.svelte

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,20 @@
1010
import { onMount } from 'svelte';
1111
import { func } from '../store';
1212
import { isValueOfStringEnum } from '$lib/helpers/types';
13-
import { Runtime, type Scopes as ScopesType } from '@appwrite.io/console';
13+
import {
14+
Runtime,
15+
type ProjectKeyScopes,
16+
type Scopes as FunctionScopes
17+
} from '@appwrite.io/console';
1418
import Scopes from '$routes/(console)/project-[region]-[project]/overview/api-keys/scopes.svelte';
1519
import { symmetricDifference } from '$lib/helpers/array';
1620
import { Link } from '$lib/elements';
1721
1822
const functionId = page.params.function;
19-
let functionScopes: ScopesType[] = null;
23+
let functionScopes: ProjectKeyScopes[] = null;
2024
2125
onMount(async () => {
22-
functionScopes ??= $func.scopes as ScopesType[];
26+
functionScopes ??= $func.scopes as ProjectKeyScopes[];
2327
});
2428
2529
async function updateScopes() {
@@ -39,7 +43,7 @@
3943
logging: $func.logging || undefined,
4044
entrypoint: $func.entrypoint || undefined,
4145
commands: $func.commands || undefined,
42-
scopes: functionScopes || undefined,
46+
scopes: (functionScopes as unknown as FunctionScopes[]) || undefined,
4347
installationId: $func.installationId || undefined,
4448
providerRepositoryId: $func.providerRepositoryId || undefined,
4549
providerBranch: $func.providerBranch || undefined,

src/routes/(console)/project-[region]-[project]/overview/api-keys/scopes.svelte

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,9 @@
4646
Selector,
4747
Typography
4848
} from '@appwrite.io/pink-svelte';
49-
import type { ProjectKeyScopes, Scopes } from '@appwrite.io/console';
49+
import type { ProjectKeyScopes } from '@appwrite.io/console';
5050
51-
type ScopeValue = ProjectKeyScopes | Scopes;
52-
53-
let { scopes = $bindable([]) }: { scopes: ScopeValue[] } = $props();
51+
let { scopes = $bindable([]) }: { scopes: ProjectKeyScopes[] } = $props();
5452
5553
let allScopesList: ScopeDefinition[] = $state([]);
5654
let mounted = $state(false);
@@ -194,10 +192,10 @@
194192
});
195193
}
196194
197-
function generateSyncedScopes(activeScopesObj: Record<string, boolean>): Scopes[] {
195+
function generateSyncedScopes(activeScopesObj: Record<string, boolean>): ProjectKeyScopes[] {
198196
return Object.entries(activeScopesObj)
199197
.filter(([scope, isActive]) => isActive && scopeCatalog.has(scope))
200-
.map(([scope]) => scope as Scopes);
198+
.map(([scope]) => scope as ProjectKeyScopes);
201199
}
202200
</script>
203201

0 commit comments

Comments
 (0)