Fix build failures

This commit is contained in:
Matej Bačo
2026-04-08 17:23:01 +02:00
parent 366c4ef798
commit d9d3b756dd
12 changed files with 80 additions and 84 deletions
@@ -152,8 +152,7 @@
try {
const result: Models.Addon | Models.PaymentAuthentication =
await sdk.forConsole.organizations.createBaaAddon({
organizationId: $organization.$id,
key: 'baa'
organizationId: $organization.$id
});
if ('clientSecret' in result) {
@@ -31,8 +31,7 @@
try {
const result: Models.Addon | Models.PaymentAuthentication =
await sdk.forConsole.organizations.createBaaAddon({
organizationId: $organization.$id,
key: 'baa'
organizationId: $organization.$id
});
if ('clientSecret' in result) {
@@ -14,12 +14,10 @@
import { addNotification } from '$lib/stores/notifications';
import { writable } from 'svelte/store';
import Scopes from '../api-keys/scopes.svelte';
import { type Scopes as ScopesType } from '@appwrite.io/console';
import { ID, type Scopes as ScopesType } from '@appwrite.io/console';
import { page } from '$app/state';
import { copy } from '$lib/helpers/copy';
const projectId = page.params.project;
let showExitModal = false;
let formComponent: Form;
let isSubmitting = writable(false);
@@ -30,12 +28,14 @@
async function create() {
try {
const { $id, secret } = await sdk.forConsole.projects.createKey({
projectId,
name,
scopes,
expire: expire || undefined
});
const { $id, secret } = await sdk
.forProject(page.params.region, page.params.project)
.project.createKey({
keyId: ID.unique(),
name,
scopes,
expire: expire || undefined
});
if ($onboarding) {
await invalidate(Dependencies.PROJECT);
@@ -26,8 +26,7 @@
async function handleDelete() {
try {
isApiKey
? await sdk.forConsole.projects.deleteKey({
projectId,
? await sdk.forProject(page.params.region, page.params.project).project.deleteKey({
keyId: key.$id
})
: await sdk.forConsole.projects.deleteDevKey({
@@ -27,10 +27,11 @@
await Promise.all(
keyIds.map((key) =>
isApiKey
? sdk.forConsole.projects.deleteKey({
projectId,
keyId: key
})
? sdk
.forProject(page.params.region, page.params.project)
.project.deleteKey({
keyId: key
})
: sdk.forConsole.projects.deleteDevKey({
projectId,
keyId: key
@@ -43,8 +43,7 @@
async function updateName() {
try {
if (isApiKey) {
await sdk.forConsole.projects.updateKey({
projectId: $project.$id,
await sdk.forProject($project.region, $project.$id).project.updateKey({
keyId: key.$id,
name,
scopes,
@@ -76,8 +75,7 @@
async function updateScopes() {
try {
await sdk.forConsole.projects.updateKey({
projectId: $project.$id,
await sdk.forProject($project.region, $project.$id).project.updateKey({
keyId: key.$id,
name: key.name,
scopes,
@@ -28,8 +28,7 @@
async function updateExpire() {
try {
if (isApiKey) {
await sdk.forConsole.projects.updateKey({
projectId,
await sdk.forProject(page.params.region, page.params.project).project.updateKey({
keyId: key.$id,
name: key.name,
scopes: (key as Models.Key).scopes as Scopes[],
@@ -5,8 +5,6 @@ import type { PageLoad } from './$types';
export const load: PageLoad = async ({ params, depends }) => {
depends(Dependencies.KEYS);
return {
keys: await sdk.forConsole.projects.listKeys({
projectId: params.project
})
keys: await sdk.forProject(params.region, params.project).project.listKeys()
};
};
@@ -7,8 +7,7 @@ import type { PageLoad } from './$types';
export const load: PageLoad = async ({ params, depends }) => {
depends(Dependencies.KEY);
const key = await sdk.forConsole.projects.getKey({
projectId: params.project,
const key = await sdk.forProject(params.region, params.project).project.getKey({
keyId: params.key
});
if (key.expire) {
@@ -14,7 +14,7 @@
import Details from './details.svelte';
import ExportModal from './exportModal.svelte';
import { readOnly } from '$lib/stores/billing';
import { Scopes, type Models } from '@appwrite.io/console';
import { ID, Scopes, type Models } from '@appwrite.io/console';
import { canWriteProjects } from '$lib/stores/roles';
import {
IconCloud,
@@ -86,29 +86,31 @@
const deployToCloud = async () => {
const currEndpoint = getCurrentEndpoint();
// Create API key
const { secret } = await sdk.forConsole.projects.createKey({
projectId: $project.$id,
name: `[AUTO-GENERATED] Migration ${new Date().toISOString()}`,
scopes: [
Scopes.UsersRead,
Scopes.TeamsRead,
Scopes.DatabasesRead,
Scopes.CollectionsRead /* legacy */,
Scopes.AttributesRead /* legacy */,
Scopes.IndexesRead,
Scopes.DocumentsRead /* legacy */,
Scopes.TablesRead,
Scopes.ColumnsRead,
Scopes.RowsRead,
Scopes.FilesRead,
Scopes.BucketsRead,
Scopes.FunctionsRead,
Scopes.ExecutionRead,
Scopes.LocaleRead,
Scopes.AvatarsRead,
Scopes.HealthRead
]
});
const { secret } = await sdk
.forProject(page.params.region, page.params.project)
.project.createKey({
keyId: ID.unique(),
name: `[AUTO-GENERATED] Migration ${new Date().toISOString()}`,
scopes: [
Scopes.UsersRead,
Scopes.TeamsRead,
Scopes.DatabasesRead,
Scopes.CollectionsRead /* legacy */,
Scopes.AttributesRead /* legacy */,
Scopes.IndexesRead,
Scopes.DocumentsRead /* legacy */,
Scopes.TablesRead,
Scopes.ColumnsRead,
Scopes.RowsRead,
Scopes.FilesRead,
Scopes.BucketsRead,
Scopes.FunctionsRead,
Scopes.ExecutionRead,
Scopes.LocaleRead,
Scopes.AvatarsRead,
Scopes.HealthRead
]
});
const migrationData = {
endpoint: currEndpoint,
@@ -10,7 +10,7 @@
import { sdk } from '$lib/stores/sdk';
import { user } from '$lib/stores/user';
import { organization } from '$lib/stores/organization';
import { Scopes } from '@appwrite.io/console';
import { ID, Scopes } from '@appwrite.io/console';
export let show = false;
@@ -88,34 +88,36 @@
const currEndpoint = getCurrentEndpoint();
// Create API key
const { secret } = await sdk.forConsole.projects.createKey({
projectId: $project.$id,
name: `[AUTO-GENERATED] Migration ${new Date().toISOString()}`,
scopes: [
Scopes.UsersRead,
Scopes.TeamsRead,
Scopes.DatabasesRead,
Scopes.CollectionsRead /* legacy */,
Scopes.AttributesRead /* legacy */,
Scopes.IndexesRead,
Scopes.DocumentsRead /* legacy */,
Scopes.TablesRead,
Scopes.ColumnsRead,
Scopes.RowsRead,
Scopes.FilesRead,
Scopes.BucketsRead,
Scopes.FunctionsRead,
Scopes.ExecutionRead,
Scopes.SitesRead,
Scopes.ProvidersRead,
Scopes.TopicsRead,
Scopes.SubscribersRead,
Scopes.MessagesRead,
Scopes.LocaleRead,
Scopes.AvatarsRead,
Scopes.HealthRead
]
});
const { secret } = await sdk
.forProject(page.params.region, page.params.project)
.project.createKey({
keyId: ID.unique(),
name: `[AUTO-GENERATED] Migration ${new Date().toISOString()}`,
scopes: [
Scopes.UsersRead,
Scopes.TeamsRead,
Scopes.DatabasesRead,
Scopes.CollectionsRead /* legacy */,
Scopes.AttributesRead /* legacy */,
Scopes.IndexesRead,
Scopes.DocumentsRead /* legacy */,
Scopes.TablesRead,
Scopes.ColumnsRead,
Scopes.RowsRead,
Scopes.FilesRead,
Scopes.BucketsRead,
Scopes.FunctionsRead,
Scopes.ExecutionRead,
Scopes.SitesRead,
Scopes.ProvidersRead,
Scopes.TopicsRead,
Scopes.SubscribersRead,
Scopes.MessagesRead,
Scopes.LocaleRead,
Scopes.AvatarsRead,
Scopes.HealthRead
]
});
const migrationData = {
endpoint: currEndpoint,
@@ -23,7 +23,7 @@
async function updateLabels() {
try {
await sdk.forConsole.projects.updateLabels({ projectId: $project.$id, labels });
await sdk.forProject($project.region, $project.$id).project.updateLabels({ labels });
await invalidate(Dependencies.PROJECT);
isDisabled = true;
addNotification({